diff --git a/ios/Ecency.xcodeproj/project.pbxproj b/ios/Ecency.xcodeproj/project.pbxproj index 9268615c0..0cab5b242 100644 --- a/ios/Ecency.xcodeproj/project.pbxproj +++ b/ios/Ecency.xcodeproj/project.pbxproj @@ -42,6 +42,7 @@ 05B6C4AF24C306CE00B7FA60 /* SimpleLineIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 34E88D888DD444F8B285363C /* SimpleLineIcons.ttf */; }; 05B6C4B024C306CE00B7FA60 /* Zocial.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 980BC9BC0D3B4AC69645C842 /* Zocial.ttf */; }; 0A1D279E0D3CD306C889592E /* libPods-Ecency-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7093E51BBC0EE2F41AB19EBA /* libPods-Ecency-tvOS.a */; }; + 1CD0B89E258019B600A7D78E /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1CD0B89B258019B600A7D78E /* GoogleService-Info.plist */; }; 2B3CF3607B7CB9B7296FD5EF /* (null) in Frameworks */ = {isa = PBXBuildFile; }; 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; @@ -125,6 +126,7 @@ 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Ecency/Info.plist; sourceTree = ""; }; 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Ecency/main.m; sourceTree = ""; }; 150E6CAFA5EF11AE47ED825C /* Pods-RnDiffAppTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RnDiffAppTests.release.xcconfig"; path = "Target Support Files/Pods-RnDiffAppTests/Pods-RnDiffAppTests.release.xcconfig"; sourceTree = ""; }; + 1CD0B89B258019B600A7D78E /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 22F5F05A06E142C2B41A4D38 /* MaterialCommunityIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = MaterialCommunityIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf"; sourceTree = ""; }; 263FA8C0EF21473FAAAD3EDD /* MaterialIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = MaterialIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/MaterialIcons.ttf"; sourceTree = ""; }; 2D02E47B1E0B4A5D006451C7 /* Ecency-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Ecency-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -373,6 +375,7 @@ isa = PBXGroup; children = ( 588019232355C26B008397D1 /* AppCenter-Config.plist */, + 1CD0B89B258019B600A7D78E /* GoogleService-Info.plist */, 13B07FAE1A68108700A75B9A /* Ecency */, 832341AE1AAA6A7D00B99B32 /* Libraries */, 00E356EF1AD99517003FC87E /* EcencyTests */, @@ -617,6 +620,7 @@ 05B6C49F24C306CE00B7FA60 /* Roboto-medium.ttf in Resources */, 05B6C4A024C306CE00B7FA60 /* FontAwesome5_Regular.ttf in Resources */, 05B6C4A124C306CE00B7FA60 /* FontAwesome5_Solid.ttf in Resources */, + 1CD0B89E258019B600A7D78E /* GoogleService-Info.plist in Resources */, 05B6C4A224C306CE00B7FA60 /* Fontisto.ttf in Resources */, 05B6C4A324C306CE00B7FA60 /* RobotoMono-Regular.ttf in Resources */, 05B6C4A424C306CE00B7FA60 /* Sansation_Bold.ttf in Resources */, diff --git a/ios/Podfile.lock b/ios/Podfile.lock index acadc1ccc..5eb2add02 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -708,4 +708,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 1f30c7da5061dbc47185442a6ab4a3c95ac48c04 -COCOAPODS: 1.9.3 +COCOAPODS: 1.9.1 diff --git a/src/components/posts/container/postsContainer.js b/src/components/posts/container/postsContainer.js index 7549a1637..9bb99eb71 100644 --- a/src/components/posts/container/postsContainer.js +++ b/src/components/posts/container/postsContainer.js @@ -28,6 +28,8 @@ const PostsContainer = ({ tag, filterOptionsValue, feedUsername, + feedSubfilterOptions, + feedSubfilterOptionsValue, }) => { const dispatch = useDispatch(); @@ -50,6 +52,11 @@ const PostsContainer = ({ const [selectedFilterValue, setSelectedFilterValue] = useState( filterOptionsValue && filterOptionsValue[selectedFilterIndex], ); + const [selectedFeedSubfilterIndex, setSelectedFeedSubfilterIndex] = useState(0); + const [selectedFeedSubfilterValue, setSelectedFeedSubfilterValue] = useState( + feedSubfilterOptionsValue && feedSubfilterOptions[selectedFeedSubfilterIndex], + ); + const elem = useRef(null); const isMountedRef = useIsMountedRef(); @@ -67,6 +74,7 @@ const PostsContainer = ({ isConnected, pageType, selectedOptionIndex, + selectedFeedSubfilterIndex, ]); useEffect(() => { @@ -75,6 +83,7 @@ const PostsContainer = ({ setStartAuthor(''); setStartPermlink(''); setSelectedFilterIndex(selectedOptionIndex || 0); + isLoggedIn && setSelectedFeedSubfilterIndex(selectedFeedSubfilterIndex || 0); setIsNoPost(false); _loadPosts(); @@ -83,7 +92,14 @@ const PostsContainer = ({ changeForceLoadPostState(false); } } - }, [_loadPosts, changeForceLoadPostState, username, forceLoadPost, selectedOptionIndex]); + }, [ + _loadPosts, + changeForceLoadPostState, + username, + forceLoadPost, + selectedOptionIndex, + selectedFeedSubfilterIndex, + ]); useEffect(() => { if (!startAuthor && !startPermlink) { @@ -146,6 +162,7 @@ const PostsContainer = ({ } const filter = type || selectedFilterValue; + const subfilter = selectedFeedSubfilterValue; let options = {}; const limit = 7; let func = null; @@ -157,15 +174,25 @@ const PostsContainer = ({ getFor === 'blog' || filter === 'reblogs' ) { - func = getAccountPosts; - options = { - account: feedUsername, - limit, - sort: filter, - }; + if (filter === 'feed' && subfilter === 'communities') { + func = getRankedPosts; + options = { + observer: feedUsername, + sort: 'trending', + tag: 'my', + }; + } else { + func = getAccountPosts; + options = { + observer: feedUsername || '', + account: feedUsername, + limit, + sort: filter, + }; - if (pageType === 'profiles' && (filter === 'feed' || filter === 'posts')) { - options.sort = 'posts'; + if (pageType === 'profiles' && (filter === 'feed' || filter === 'posts')) { + options.sort = 'posts'; + } } } else { func = getRankedPosts; @@ -241,7 +268,7 @@ const PostsContainer = ({ _getPromotePosts(); }; - const _handleOnDropdownSelect = (index) => { + const _handleFilterOnDropdownSelect = (index) => { setSelectedFilterIndex(index); setPosts([]); setStartPermlink(''); @@ -249,6 +276,14 @@ const PostsContainer = ({ setIsNoPost(false); }; + const _handleFeedSubfilterOnDropdownSelect = (index) => { + setSelectedFeedSubfilterIndex(index); + setPosts([]); + setStartPermlink(''); + setStartAuthor(''); + setIsNoPost(false); + }; + return ( ); }; diff --git a/src/components/posts/view/postsView.js b/src/components/posts/view/postsView.js index 66bebb1f6..cb696dc04 100644 --- a/src/components/posts/view/postsView.js +++ b/src/components/posts/view/postsView.js @@ -35,14 +35,19 @@ const PostsView = ({ selectedFilterValue, setSelectedFilterValue, filterOptionsValue, - handleOnDropdownSelect, + handleFilterOnDropdownSelect, handleOnRefreshPosts, loadPosts, + feedSubfilterOptions, + selectedFeedSubfilterIndex, + feedSubfilterOptionsValue, + handleFeedSubfilterOnDropdownSelect, + setSelectedFeedSubfilterValue, }) => { const intl = useIntl(); const postsList = useRef(null); - const _handleOnDropdownSelect = async (index) => { + const _handleFilterOnDropdownSelect = async (index) => { if (index === selectedFilterIndex) { _scrollTop(); } else { @@ -50,7 +55,19 @@ const PostsView = ({ setSelectedFilterValue(filterOptionsValue[index]); } - handleOnDropdownSelect(index); + handleFilterOnDropdownSelect(index); + } + }; + + const _handleFeedSubfilterOnDropdownSelect = async (index) => { + if (index === selectedFeedSubfilterIndex) { + _scrollTop(); + } else { + if (feedSubfilterOptions && feedSubfilterOptions.length > 0) { + setSelectedFeedSubfilterValue(feedSubfilterOptionsValue[index]); + } + + handleFeedSubfilterOnDropdownSelect(index); } }; @@ -93,7 +110,12 @@ const PostsView = ({ id: 'profile.havent_posted', })} defaultText={intl.formatMessage({ - id: selectedFilterValue === 'feed' ? 'profile.follow_people' : 'profile.havent_posted', + id: + selectedFilterValue === 'feed' + ? setSelectedFeedSubfilterValue === 'friends' + ? 'profile.follow_people' + : 'profile.follow_communities' + : 'profile.havent_posted', })} /> ); @@ -169,10 +191,21 @@ const PostsView = ({ defaultText={filterOptions[selectedOptionIndex]} rightIconName="view-module" rightIconType="MaterialIcons" - onDropdownSelect={_handleOnDropdownSelect} + onDropdownSelect={_handleFilterOnDropdownSelect} onRightIconPress={handleImagesHide} /> )} + {isLoggedIn && selectedFilterValue === 'feed' && ( + + intl.formatMessage({ id: `home.${item.toLowerCase()}` }).toUpperCase(), + )} + selectedOptionIndex={selectedFeedSubfilterIndex} + defaultText={feedSubfilterOptions[selectedFeedSubfilterIndex]} + onDropdownSelect={_handleFeedSubfilterOnDropdownSelect} + /> + )} { return ( @@ -23,9 +28,11 @@ const FeedScreen = () => {