diff --git a/likeminds-feed-reactnative-integration/components/LMCreatePostButton/index.tsx b/likeminds-feed-reactnative-integration/components/LMCreatePostButton/index.tsx index 477cfb93..6bb2ac00 100644 --- a/likeminds-feed-reactnative-integration/components/LMCreatePostButton/index.tsx +++ b/likeminds-feed-reactnative-integration/components/LMCreatePostButton/index.tsx @@ -1,6 +1,6 @@ import { View, Text, TouchableOpacity, Image } from "react-native"; import React from "react"; -import { styles } from "../../screens/universalFeed/styles"; +import { styles } from "../../screens/feed/styles"; import { LMFeedAnalytics } from "../../analytics/LMFeedAnalytics"; import { Events } from "../../enums/Events"; import { @@ -8,9 +8,9 @@ import { CLEAR_SELECTED_TOPICS_FOR_CREATE_POST_SCREEN, } from "../../store/types/types"; import { - UniversalFeedContextValues, - useUniversalFeedContext, - useUniversalFeedCustomisableMethodsContext, + FeedContextValues, + useFeedContext, + useFeedCustomisableMethodsContext, } from "../../context"; import { useAppDispatch } from "../../store/store"; import STYLES from "../../constants/Styles"; @@ -20,11 +20,11 @@ import { WordAction } from "../../enums/Variables"; const LMCreatePostButton = ({ customText }: { customText?: string }) => { const dispatch = useAppDispatch(); - const { showCreatePost, newPostButtonClick }: UniversalFeedContextValues = - useUniversalFeedContext(); - const universalFeedStyle = STYLES.$UNIVERSAL_FEED_STYLE; + const { showCreatePost, newPostButtonClick }: FeedContextValues = + useFeedContext(); + const feedStyle = STYLES.$FEED_STYLE; const { newPostButtonClickProps } = - useUniversalFeedCustomisableMethodsContext(); + useFeedCustomisableMethodsContext(); return ( { showCreatePost ? styles.newPostButtonEnable : styles.newPostButtonDisable, - universalFeedStyle?.newPostButtonStyle, + feedStyle?.newPostButtonStyle, ]} // handles post uploading status and member rights to create post onPress={() => { @@ -50,9 +50,9 @@ const LMCreatePostButton = ({ customText }: { customText?: string }) => { source={require("../../assets/images/add_post_icon3x.png")} resizeMode={"contain"} style={styles.newPostButtonIcon} - {...universalFeedStyle?.newPostIcon} + {...feedStyle?.newPostIcon} /> - + {customText ? customText : `NEW ${pluralizeOrCapitalize((CommunityConfigs?.getCommunityConfigs("feed_metadata"))?.value?.post ?? "post",WordAction.allCapitalSingular)}`} diff --git a/likeminds-feed-reactnative-integration/components/LMUniversalFeedHeader/index.tsx b/likeminds-feed-reactnative-integration/components/LMFeedHeader/index.tsx similarity index 90% rename from likeminds-feed-reactnative-integration/components/LMUniversalFeedHeader/index.tsx rename to likeminds-feed-reactnative-integration/components/LMFeedHeader/index.tsx index b88cd332..64ed644a 100644 --- a/likeminds-feed-reactnative-integration/components/LMUniversalFeedHeader/index.tsx +++ b/likeminds-feed-reactnative-integration/components/LMFeedHeader/index.tsx @@ -2,9 +2,9 @@ import { View, Text, TouchableOpacity, Image, SafeAreaView } from "react-native" import React, { useState } from "react"; import LMHeader from "../LMHeader"; import { - UniversalFeedContextValues, - useUniversalFeedContext, - useUniversalFeedCustomisableMethodsContext, + FeedContextValues, + useFeedContext, + useFeedCustomisableMethodsContext, } from "../../context"; import { LMFeedAnalytics } from "../../analytics/LMFeedAnalytics"; import { Events } from "../../enums/Events"; @@ -17,18 +17,18 @@ import { nameInitials } from "../../utils"; import { LMProfilePicture } from "../../uiComponents"; import { useLMFeed } from "../../lmFeedProvider"; -const LMUniversalFeedHeader = () => { +const LMFeedHeader = () => { const { unreadNotificationCount, onTapNotificationBell, memberData - }: UniversalFeedContextValues = useUniversalFeedContext(); + }: FeedContextValues = useFeedContext(); const {isUserOnboardingRequired} = useLMFeed() const navigation = useNavigation(); - const universalFeedStyle = STYLES.$UNIVERSAL_FEED_STYLE; + const feedStyle = STYLES.$FEED_STYLE; const postHeaderStyle = STYLES.$POST_LIST_STYLE.header const { onTapNotificationBellProp } = - useUniversalFeedCustomisableMethodsContext(); + useFeedCustomisableMethodsContext(); return ( { } - {...universalFeedStyle?.screenHeader} + {...feedStyle?.screenHeader} /> ); }; -export default LMUniversalFeedHeader; +export default LMFeedHeader; diff --git a/likeminds-feed-reactnative-integration/components/LMFilterTopics/index.tsx b/likeminds-feed-reactnative-integration/components/LMFilterTopics/index.tsx index 6520c3ea..fb0ff43f 100644 --- a/likeminds-feed-reactnative-integration/components/LMFilterTopics/index.tsx +++ b/likeminds-feed-reactnative-integration/components/LMFilterTopics/index.tsx @@ -3,19 +3,19 @@ import React, { useEffect, useState } from "react"; import { Client } from "../../client"; import { useAppDispatch, useAppSelector } from "../../store/store"; import { - UniversalFeedContextValues, - useUniversalFeedContext, + FeedContextValues, + useFeedContext, } from "../../context"; import { - CLEAR_SELECTED_TOPICS_FROM_UNIVERSAL_FEED_SCREEN, - MAPPED_TOPICS_FROM_UNIVERSAL_FEED_SCREEN, - SELECTED_TOPICS_FOR_UNIVERSAL_FEED_SCREEN, - SELECTED_TOPICS_FROM_UNIVERSAL_FEED_SCREEN, + CLEAR_SELECTED_TOPICS_FROM_FEED_SCREEN, + MAPPED_TOPICS_FROM_FEED_SCREEN, + SELECTED_TOPICS_FOR_FEED_SCREEN, + SELECTED_TOPICS_FROM_FEED_SCREEN, SET_TOPICS, } from "../../store/types/types"; import Layout from "../../constants/Layout"; import STYLES from "../../constants/Styles"; -import { styles } from "../../screens/universalFeed/styles"; +import { styles } from "../../screens/feed/styles"; import { TOPIC_FEED } from "../../constants/screenNames"; import { CommunityConfigs } from "../../communityConfigs"; import { WordAction } from "../../enums/Variables"; @@ -32,14 +32,14 @@ const LMFilterTopics = () => { setIsAnyMatchingPost, setFeedPageNumber, setIsPaginationStopped - }: UniversalFeedContextValues = useUniversalFeedContext(); + }: FeedContextValues = useFeedContext(); const myClient = Client.myClient; const [showTopics, setShowTopics] = useState(false); const topicsStyle = STYLES.$TOPICS_STYLE; const [topicsPage, setTopicsPage] = useState(1); const selectedTopics = useAppSelector( - (state) => state.feed.selectedTopicsForUniversalFeedScreen + (state) => state.feed.selectedTopicsForFeedScreen ); const topics = useAppSelector((state) => state.feed.topics); const mappedTopics = useAppSelector((state) => state.feed.mappedTopics); @@ -61,7 +61,7 @@ const LMFilterTopics = () => { name: topics[topicId]?.name || "Unknown", // Use optional chaining and provide a default name if not found })); dispatch({ - type: MAPPED_TOPICS_FROM_UNIVERSAL_FEED_SCREEN, + type: MAPPED_TOPICS_FROM_FEED_SCREEN, body: { topics: filteredTopicArray }, }); getUnreadCount(); @@ -69,7 +69,7 @@ const LMFilterTopics = () => { const handleAllTopicPress = () => { dispatch({ - type: CLEAR_SELECTED_TOPICS_FROM_UNIVERSAL_FEED_SCREEN, + type: CLEAR_SELECTED_TOPICS_FROM_FEED_SCREEN, }); /* @ts-ignore */ return navigation.navigate(TOPIC_FEED); @@ -78,7 +78,7 @@ const LMFilterTopics = () => { const handleIndividualTopicsPress = () => { const arrayOfIds = mappedTopics.map((obj) => obj.id); dispatch({ - type: SELECTED_TOPICS_FROM_UNIVERSAL_FEED_SCREEN, + type: SELECTED_TOPICS_FROM_FEED_SCREEN, body: { topics: arrayOfIds }, }); /* @ts-ignore */ @@ -90,11 +90,11 @@ const LMFilterTopics = () => { const filteredTopics = selectedTopics?.filter(topic => topic != (newItems[index])?.id); newItems.splice(index, 1); // Remove the item at the specified index dispatch({ - type: MAPPED_TOPICS_FROM_UNIVERSAL_FEED_SCREEN, + type: MAPPED_TOPICS_FROM_FEED_SCREEN, body: { topics: newItems }, }); // Update the state with the new array dispatch({ - type: SELECTED_TOPICS_FOR_UNIVERSAL_FEED_SCREEN, + type: SELECTED_TOPICS_FOR_FEED_SCREEN, body: { topics: filteredTopics }, }); // Update the state with the new array setFeedPageNumber(1); @@ -279,11 +279,11 @@ const LMFilterTopics = () => { { dispatch({ - type: MAPPED_TOPICS_FROM_UNIVERSAL_FEED_SCREEN, + type: MAPPED_TOPICS_FROM_FEED_SCREEN, body: { topics: [] }, }); dispatch({ - type: SELECTED_TOPICS_FOR_UNIVERSAL_FEED_SCREEN, + type: SELECTED_TOPICS_FOR_FEED_SCREEN, body: { topics: [] }, }); setFeedPageNumber(1); diff --git a/likeminds-feed-reactnative-integration/components/LMMedia/LMCreatePostVideo/index.tsx b/likeminds-feed-reactnative-integration/components/LMMedia/LMCreatePostVideo/index.tsx index 225280ee..e4be6364 100644 --- a/likeminds-feed-reactnative-integration/components/LMMedia/LMCreatePostVideo/index.tsx +++ b/likeminds-feed-reactnative-integration/components/LMMedia/LMCreatePostVideo/index.tsx @@ -22,7 +22,7 @@ import { import { CREATE_POST, POST_DETAIL, - UNIVERSAL_FEED, + FEED, } from "../../../constants/screenNames"; import RNVideo from "../../../optionalDependencies/Video"; import { useLMFeed } from "../../../lmFeedProvider"; @@ -177,7 +177,7 @@ import { : flowToCreatePostScreen ? true : pauseStatus === true && - previousRoute?.name === UNIVERSAL_FEED && + previousRoute?.name === FEED && currentRoute?.name !== CREATE_POST ? pauseStatus : videoInFeed @@ -214,7 +214,7 @@ import { : flowToCreatePostScreen ? true : pauseStatus === true && - previousRoute?.name === UNIVERSAL_FEED && + previousRoute?.name === FEED && currentRoute?.name !== CREATE_POST ? pauseStatus : videoInFeed diff --git a/likeminds-feed-reactnative-integration/components/LMMedia/LMVideo/index.tsx b/likeminds-feed-reactnative-integration/components/LMMedia/LMVideo/index.tsx index 2d519abe..f8ddeec4 100644 --- a/likeminds-feed-reactnative-integration/components/LMMedia/LMVideo/index.tsx +++ b/likeminds-feed-reactnative-integration/components/LMMedia/LMVideo/index.tsx @@ -22,7 +22,7 @@ import { StackNavigationProp } from "@react-navigation/stack"; import { CREATE_POST, POST_DETAIL, - UNIVERSAL_FEED, + FEED, } from "../../../constants/screenNames"; import RNVideo from "../../../optionalDependencies/Video"; import { useLMFeed } from "../../../lmFeedProvider"; @@ -180,7 +180,7 @@ const LMVideo = React.memo( : flowToCreatePostScreen ? true : pauseStatus === true && - previousRoute?.name === UNIVERSAL_FEED && + previousRoute?.name === FEED && currentRoute?.name !== CREATE_POST ? pauseStatus : videoInFeed @@ -218,7 +218,7 @@ const LMVideo = React.memo( : flowToCreatePostScreen ? true : pauseStatus === true && - previousRoute?.name === UNIVERSAL_FEED && + previousRoute?.name === FEED && currentRoute?.name !== CREATE_POST ? pauseStatus : videoInFeed diff --git a/likeminds-feed-reactnative-integration/components/LMPoll/LMPostPollUI/index.tsx b/likeminds-feed-reactnative-integration/components/LMPoll/LMPostPollUI/index.tsx index 16b3e8b0..8a692679 100644 --- a/likeminds-feed-reactnative-integration/components/LMPoll/LMPostPollUI/index.tsx +++ b/likeminds-feed-reactnative-integration/components/LMPoll/LMPostPollUI/index.tsx @@ -21,7 +21,7 @@ import LMPostPollText from "../../LMPost/LMPostPollText"; import { decode } from "../../../utils"; import { LMText } from "../../../uiComponents"; import { PollType } from "../../../enums/Poll"; -import { useUniversalFeedCustomisableMethodsContext } from "../../../context"; +import { useFeedCustomisableMethodsContext } from "../../../context"; import { usePollCustomisableMethodsContext } from "../../../context/pollCustomisableCallback"; const LMPostPollUI = ({ diff --git a/likeminds-feed-reactnative-integration/components/LMPoll/LMPostPollView/index.tsx b/likeminds-feed-reactnative-integration/components/LMPoll/LMPostPollView/index.tsx index bb55cef6..5cc5340a 100644 --- a/likeminds-feed-reactnative-integration/components/LMPoll/LMPostPollView/index.tsx +++ b/likeminds-feed-reactnative-integration/components/LMPoll/LMPostPollView/index.tsx @@ -26,7 +26,7 @@ import { POLL_RESULT } from "../../../constants/screenNames"; import { PollMultiSelectState, PollType } from "../../../enums/Poll"; import { GetPostRequest } from "@likeminds.community/feed-rn"; import { getPost } from "../../../store/actions/postDetail"; -import { useUniversalFeedContext } from "../../../context"; +import { useFeedContext } from "../../../context"; const LMPostPollView = ({ item, @@ -35,7 +35,7 @@ const LMPostPollView = ({ editPollAttachment, }: any) => { const { navigation, setSelectedPollOptions, addPollOption, submitPoll } = - useUniversalFeedContext(); + useFeedContext(); const [selectedPolls, setSelectedPolls] = useState([]); const [showSelected, setShowSelected] = useState(false); diff --git a/likeminds-feed-reactnative-integration/components/LMPost/LMPostMedia/index.tsx b/likeminds-feed-reactnative-integration/components/LMPost/LMPostMedia/index.tsx index a7d6215a..19cefd2a 100644 --- a/likeminds-feed-reactnative-integration/components/LMPost/LMPostMedia/index.tsx +++ b/likeminds-feed-reactnative-integration/components/LMPost/LMPostMedia/index.tsx @@ -22,7 +22,7 @@ import { } from "../../../store/types/types"; import { CAROUSEL_SCREEN, - UNIVERSAL_FEED, + FEED, } from "../../../constants/screenNames"; import STYLES from "../../../constants/Styles"; import LMPostPollView from "../../LMPoll/LMPostPollView"; @@ -105,7 +105,7 @@ const LMPostMedia = React.memo(() => { } // videoInFeed={mediaProps?.videoProps?.videoInFeed} videoInFeed={ - previousRoute?.name === UNIVERSAL_FEED ? false : true + previousRoute?.name === FEED ? false : true } videoInCarousel={false} showMuteUnmute={true} @@ -194,7 +194,7 @@ const LMPostMedia = React.memo(() => { ? mediaProps?.videoProps?.autoPlay : true, videoInFeed: - previousRoute?.name === UNIVERSAL_FEED ? false : true, + previousRoute?.name === FEED ? false : true, postId: post?.id, }} /> diff --git a/likeminds-feed-reactnative-integration/components/LMPostUploadIndicator/index.tsx b/likeminds-feed-reactnative-integration/components/LMPostUploadIndicator/index.tsx index 0aec812d..ebbbefae 100644 --- a/likeminds-feed-reactnative-integration/components/LMPostUploadIndicator/index.tsx +++ b/likeminds-feed-reactnative-integration/components/LMPostUploadIndicator/index.tsx @@ -2,52 +2,22 @@ import { View, Text, Platform } from "react-native"; import React from "react"; import LMLoader from "../LMLoader"; import STYLES from "../../constants/Styles"; -import { styles } from "../../screens/universalFeed/styles"; +import { styles } from "../../screens/feed/styles"; import { POST_UPLOADING } from "../../constants/Strings"; import { - UniversalFeedContextValues, - useUniversalFeedContext, + FeedContextValues, + useFeedContext, } from "../../context"; const LMPostUploadIndicator = () => { - const { postUploading }: UniversalFeedContextValues = - useUniversalFeedContext(); + const { postUploading }: FeedContextValues = + useFeedContext(); return ( {/* post uploading section */} {postUploading && ( - {/* post uploading media preview */} - {/* {uploadingMediaAttachmentType === IMAGE_ATTACHMENT_TYPE && ( - - )} - {uploadingMediaAttachmentType === VIDEO_ATTACHMENT_TYPE && ( - - )} - {uploadingMediaAttachmentType === DOCUMENT_ATTACHMENT_TYPE && ( - - )} */} {POST_UPLOADING} {/* progress loader */} diff --git a/likeminds-feed-reactnative-integration/constants/Styles.ts b/likeminds-feed-reactnative-integration/constants/Styles.ts index 138c3947..8f2f41c9 100644 --- a/likeminds-feed-reactnative-integration/constants/Styles.ts +++ b/likeminds-feed-reactnative-integration/constants/Styles.ts @@ -11,7 +11,7 @@ import { PostLikesListStyleProps, PostListStyleProps, TopicsStyle, - UniversalFeedStyleProps, + FeedStyleProps, UserOnboardingStylesProps, } from "../lmFeedProvider/types"; @@ -160,7 +160,7 @@ export class LMFeedTheme { public $LMLoaderSizeAndroid: number; public $POLL_STYLE: PollStyle; - public $UNIVERSAL_FEED_STYLE: UniversalFeedStyleProps; + public $FEED_STYLE: FeedStyleProps; public $POST_LIST_STYLE: PostListStyleProps; public $LOADER_STYLE: LoaderStyleProps; public $POST_DETAIL_STYLE: PostDetailStyleProps; @@ -280,7 +280,7 @@ export class LMFeedTheme { this.$LMLoaderSizeiOS = 10; this.$LMLoaderSizeAndroid = 25; this.$POLL_STYLE = {}; - this.$UNIVERSAL_FEED_STYLE = {}; + this.$FEED_STYLE = {}; this.$POST_LIST_STYLE = {}; this.$LOADER_STYLE = {}; this.$POST_DETAIL_STYLE = {}; @@ -339,9 +339,9 @@ export class LMFeedTheme { }; } - public setUniversalFeedStyles(universalFeedStyles: UniversalFeedStyleProps) { - this.$UNIVERSAL_FEED_STYLE = { - ...universalFeedStyles, + public setFeedStyles(feedStyles: FeedStyleProps) { + this.$FEED_STYLE = { + ...feedStyles, }; } diff --git a/likeminds-feed-reactnative-integration/constants/screenNames.ts b/likeminds-feed-reactnative-integration/constants/screenNames.ts index ef26b020..2ba136e7 100644 --- a/likeminds-feed-reactnative-integration/constants/screenNames.ts +++ b/likeminds-feed-reactnative-integration/constants/screenNames.ts @@ -1,5 +1,5 @@ // app screens -export const UNIVERSAL_FEED = "UniversalFeed"; +export const FEED = "Feed"; export const POST_LIKES_LIST = "PostLikesList"; export const CREATE_POST = "CreatePost"; export const POST_DETAIL = "PostDetail"; diff --git a/likeminds-feed-reactnative-integration/context/universalFeedCallbacksContext.tsx b/likeminds-feed-reactnative-integration/context/feedCallbacksContext.tsx similarity index 78% rename from likeminds-feed-reactnative-integration/context/universalFeedCallbacksContext.tsx rename to likeminds-feed-reactnative-integration/context/feedCallbacksContext.tsx index a61f4a21..231b180a 100644 --- a/likeminds-feed-reactnative-integration/context/universalFeedCallbacksContext.tsx +++ b/likeminds-feed-reactnative-integration/context/feedCallbacksContext.tsx @@ -1,7 +1,7 @@ import { LMMenuItemsViewData, LMPostViewData } from "../models"; import React, { createContext, ReactNode, useContext } from "react"; -export interface UniversalFeedCallbacksContextProps { +export interface FeedCallbacksContextProps { children?: ReactNode; isHeadingEnabled: boolean; isTopResponse: boolean; @@ -27,7 +27,7 @@ export interface UniversalFeedCallbacksContextProps { onSharePostClicked?: (id: string) => void; } -export interface UniversalFeedCustomisableMethodsContext { +export interface FeedCustomisableMethodsContext { isHeadingEnabled: boolean; isTopResponse: boolean; hideTopicsView?: boolean; @@ -52,21 +52,21 @@ export interface UniversalFeedCustomisableMethodsContext { onSharePostClicked?: (id: string) => void; } -const UniversalFeedCustomisableMethodsContext = createContext< - UniversalFeedCustomisableMethodsContext | undefined +const FeedCustomisableMethodsContext = createContext< + FeedCustomisableMethodsContext | undefined >(undefined); -export const useUniversalFeedCustomisableMethodsContext = () => { - const context = useContext(UniversalFeedCustomisableMethodsContext); +export const useFeedCustomisableMethodsContext = () => { + const context = useContext(FeedCustomisableMethodsContext); if (!context) { throw new Error( - "useUniversalFeedCustomisableMethodsContext must be used within an UniversalFeedCustomisableMethodsContext" + "useFeedCustomisableMethodsContext must be used within an FeedCustomisableMethodsContext" ); } return context; }; -export const UniversalFeedCustomisableMethodsContextProvider = ({ +export const FeedCustomisableMethodsContextProvider = ({ children, postLikeHandlerProp, savePostHandlerProp, @@ -84,8 +84,8 @@ export const UniversalFeedCustomisableMethodsContextProvider = ({ isHeadingEnabled = false, isTopResponse = false, hideTopicsView = false -}: UniversalFeedCallbacksContextProps) => { - const contextValues: UniversalFeedCustomisableMethodsContext = { +}: FeedCallbacksContextProps) => { + const contextValues: FeedCustomisableMethodsContext = { postLikeHandlerProp, savePostHandlerProp, selectPinPostProp, @@ -105,8 +105,8 @@ export const UniversalFeedCustomisableMethodsContextProvider = ({ }; return ( - + {children} - + ); }; diff --git a/likeminds-feed-reactnative-integration/context/universalFeedContext.tsx b/likeminds-feed-reactnative-integration/context/feedContext.tsx similarity index 95% rename from likeminds-feed-reactnative-integration/context/universalFeedContext.tsx rename to likeminds-feed-reactnative-integration/context/feedContext.tsx index 97fe41a4..6f89e138 100644 --- a/likeminds-feed-reactnative-integration/context/universalFeedContext.tsx +++ b/likeminds-feed-reactnative-integration/context/feedContext.tsx @@ -44,7 +44,7 @@ import { LMAttachmentViewData, LMPostViewData } from "../models"; import { CREATE_POST, NOTIFICATION_FEED, - UNIVERSAL_FEED, + FEED, } from "../constants/screenNames"; import { getUnreadNotificationCount, @@ -67,9 +67,9 @@ import { import { useLMFeed } from "../lmFeedProvider"; import { FeedType } from "../enums/FeedType"; -interface UniversalFeedContextProps { +interface FeedContextProps { children?: ReactNode; - navigation: NativeStackNavigationProp; + navigation: NativeStackNavigationProp; route: { key: string; name: string; @@ -79,8 +79,8 @@ interface UniversalFeedContextProps { predefinedTopics?: string[]; } -export interface UniversalFeedContextValues { - navigation: NativeStackNavigationProp; +export interface FeedContextValues { + navigation: NativeStackNavigationProp; feedData: Array; accessToken: string; memberData: {}; @@ -120,32 +120,32 @@ export interface UniversalFeedContextValues { feedType?: FeedType; } -const UniversalFeedContext = createContext< - UniversalFeedContextValues | undefined +const FeedContext = createContext< + FeedContextValues | undefined >(undefined); -export const useUniversalFeedContext = () => { - const context = useContext(UniversalFeedContext); +export const useFeedContext = () => { + const context = useContext(FeedContext); if (!context) { throw new Error( - "useUniversalFeedContext must be used within an UniversalFeedContextProvider" + "useFeedContext must be used within an FeedContextProvider" ); } return context; }; -export const UniversalFeedContextProvider = ({ +export const FeedContextProvider = ({ children, navigation, predefinedTopics, -}: UniversalFeedContextProps) => { +}: FeedContextProps) => { const dispatch = useAppDispatch(); const feedData = useAppSelector((state) => state.feed.feed); const accessToken = useAppSelector((state) => state.login.accessToken); const memberData = useAppSelector((state) => state.login.member); const memberRight = useAppSelector((state) => state.login.memberRights); const selectedTopics = useAppSelector( - (state) => state.feed.selectedTopicsForUniversalFeedScreen + (state) => state.feed.selectedTopicsForFeedScreen ); const [postUploading, setPostUploading] = useState(false); const [feedPageNumber, setFeedPageNumber] = useState(1); @@ -240,7 +240,7 @@ export const UniversalFeedContextProvider = ({ useEffect(() => { LMFeedAnalytics.track( Events.FEED_OPENED, - new Map([[Keys.FEED_TYPE, Keys.UNIVERSAL_FEED]]) + new Map([[Keys.FEED_TYPE, Keys.FEED]]) ); }, []); @@ -395,7 +395,7 @@ export const UniversalFeedContextProvider = ({ heading !== "" || topics?.length > 0 || Object.keys(poll).length > 0) && - route.name === UNIVERSAL_FEED + route.name === FEED ) { setPostUploading(true); postAdd(); @@ -663,7 +663,7 @@ export const UniversalFeedContextProvider = ({ } }; - const contextValues: UniversalFeedContextValues = { + const contextValues: FeedContextValues = { navigation, feedData, accessToken, @@ -705,8 +705,8 @@ export const UniversalFeedContextProvider = ({ }; return ( - + {children} - + ); }; diff --git a/likeminds-feed-reactnative-integration/context/index.ts b/likeminds-feed-reactnative-integration/context/index.ts index e9db66ab..b8659b8e 100644 --- a/likeminds-feed-reactnative-integration/context/index.ts +++ b/likeminds-feed-reactnative-integration/context/index.ts @@ -1,8 +1,8 @@ import { - UniversalFeedContextProvider, - UniversalFeedContextValues, - useUniversalFeedContext, -} from "./universalFeedContext"; + FeedContextProvider, + FeedContextValues, + useFeedContext, +} from "./feedContext"; import { PostListContextProvider, PostListContextValues, @@ -33,10 +33,10 @@ import { useLMPostContext, } from "./postItemContext"; import { - UniversalFeedCustomisableMethodsContextProvider, - UniversalFeedCustomisableMethodsContext, - useUniversalFeedCustomisableMethodsContext, -} from "./universalFeedCallbacksContext"; + FeedCustomisableMethodsContextProvider, + FeedCustomisableMethodsContext, + useFeedCustomisableMethodsContext, +} from "./feedCallbacksContext"; import { PostDetailCustomisableMethodsContextProvider, PostDetailCustomisableMethodsContext, @@ -65,9 +65,9 @@ import { import UserOnboardingContextProvider from "./userOnboardingContext"; import UserOnboardingCallbacksContextProvider from "./userOnboardingCallbacksContext" export { - UniversalFeedContextProvider, - UniversalFeedContextValues, - useUniversalFeedContext, + FeedContextProvider, + FeedContextValues, + useFeedContext, PostListContextProvider, PostListContextValues, usePostListContext, @@ -83,9 +83,9 @@ export { LMPostContextProvider, LMPostContextValues, useLMPostContext, - UniversalFeedCustomisableMethodsContext, - UniversalFeedCustomisableMethodsContextProvider, - useUniversalFeedCustomisableMethodsContext, + FeedCustomisableMethodsContext, + FeedCustomisableMethodsContextProvider, + useFeedCustomisableMethodsContext, PostDetailCustomisableMethodsContextProvider, PostDetailCustomisableMethodsContext, usePostDetailCustomisableMethodsContext, diff --git a/likeminds-feed-reactnative-integration/context/notificationFeedContext.tsx b/likeminds-feed-reactnative-integration/context/notificationFeedContext.tsx index ccf451f6..842e14a3 100644 --- a/likeminds-feed-reactnative-integration/context/notificationFeedContext.tsx +++ b/likeminds-feed-reactnative-integration/context/notificationFeedContext.tsx @@ -27,7 +27,7 @@ import { clearPostDetail } from "../store/actions/postDetail"; import { CREATE_POST, POST_DETAIL, - UNIVERSAL_FEED, + FEED, } from "../constants/screenNames"; import { NAVIGATED_FROM_NOTIFICATION } from "../constants/Strings"; import { Client } from "../client"; @@ -98,7 +98,7 @@ export const NotificationFeedContextProvider = ({ const commentRegexPattern = /^route:\/\/post_detail\?post_id=[\w\d]+&comment_id=[\w\d]+$/; const createPostRegexPattern = /^route:\/\/create_post$/; - const universalFeedRegexPattern = /^route:\/\/feed\?type=universal$/; + const feedRegexPattern = /^route:\/\/feed\?type=universal$/; const PAGE_SIZE = 20; // this functions gets notification feed data const fetchNotificationFeed = async (page) => { @@ -162,8 +162,8 @@ export const NotificationFeedContextProvider = ({ ])) : activity?.cta.match(createPostRegexPattern) ? navigation.navigate(CREATE_POST) - : activity?.cta.match(universalFeedRegexPattern) - ? navigation.navigate(UNIVERSAL_FEED) + : activity?.cta.match(feedRegexPattern) + ? navigation.navigate(FEED) : null; }; const onRefresh = async () => { diff --git a/likeminds-feed-reactnative-integration/context/postListContext.tsx b/likeminds-feed-reactnative-integration/context/postListContext.tsx index f6fb2656..d1515a86 100644 --- a/likeminds-feed-reactnative-integration/context/postListContext.tsx +++ b/likeminds-feed-reactnative-integration/context/postListContext.tsx @@ -65,7 +65,7 @@ import { postLikesClear } from "../store/actions/postLikes"; import { ActivityIndicator, View } from "react-native"; import Layout from "../constants/Layout"; import STYLES from "../constants/Styles"; -import { useUniversalFeedContext } from "../context/universalFeedContext"; +import { useFeedContext } from "../context/feedContext"; import { useIsFocused } from "@react-navigation/native"; import { HIDE_POST_STATE, SET_CURRENT_ID_OF_VIDEO } from "../store/types/types"; import { SHOW_TOAST } from "..//store/types/loader"; @@ -80,7 +80,7 @@ interface PostListContextProps { children?: ReactNode; navigation: NativeStackNavigationProp< RootStackParamList, - "PostsList" | "UniversalFeed" + "PostsList" | "Feed" >; route: { key: string; @@ -97,7 +97,7 @@ interface MutableRefObject { export interface PostListContextValues { navigation: NativeStackNavigationProp< RootStackParamList, - "PostsList" | "UniversalFeed" + "PostsList" | "Feed" >; feedData: Array; accessToken: string; @@ -167,7 +167,7 @@ export const PostListContextProvider = ({ const accessToken = useAppSelector((state) => state.login.accessToken); const showLoader = useAppSelector((state) => state.loader.count); const topics = useAppSelector( - (state) => state.feed.selectedTopicsForUniversalFeedScreen + (state) => state.feed.selectedTopicsForFeedScreen ); const [modalPosition, setModalPosition] = useState({ x: 0, y: 0 }); const [showActionListModal, setShowActionListModal] = useState(false); @@ -186,7 +186,7 @@ export const PostListContextProvider = ({ predefinedTopics, postSeen, feedType, - } = useUniversalFeedContext(); + } = useFeedContext(); const PAGE_SIZE = 20; const [postInViewport, setPostInViewport] = useState(""); @@ -204,7 +204,7 @@ export const PostListContextProvider = ({ } }, [postInViewport, isFocus]); - // this functions gets universal feed data + // this functions gets feed data const fetchFeed = async (page: number) => { const payload = { page: page, diff --git a/likeminds-feed-reactnative-integration/context/userOnboardingContext.tsx b/likeminds-feed-reactnative-integration/context/userOnboardingContext.tsx index e7c2829a..f187ec37 100644 --- a/likeminds-feed-reactnative-integration/context/userOnboardingContext.tsx +++ b/likeminds-feed-reactnative-integration/context/userOnboardingContext.tsx @@ -14,7 +14,7 @@ import { useAppDispatch, useAppSelector } from "../store/store"; import { RootStackParamList } from "../models/RootStackParamsList"; import { NativeStackNavigationProp } from "@react-navigation/native-stack"; import { selectImageVideo, uploadFilesToAWS } from "../utils"; -import { useUniversalFeedContext } from "../context"; +import { useFeedContext } from "../context"; import { convertImageVideoMetaData } from "../viewDataModels"; import { Asset } from "react-native-image-picker"; import { SHOW_TOAST } from "../store/types/loader"; @@ -23,7 +23,7 @@ import { getMemberState } from "../store/actions/login"; import { BackHandler } from "react-native"; import { useLMFeed } from "../lmFeedProvider"; import { REFRESH_FROM_ONBOARDING_SCREEN } from "../store/types/types"; -import { UNIVERSAL_FEED } from "../constants/screenNames"; +import { FEED } from "../constants/screenNames"; interface userOnboardingContextProps { children?: ReactNode; @@ -132,7 +132,7 @@ export default function UserOnboardingContextProvider({ }); navigation.goBack(); } else { - navigation.navigate(UNIVERSAL_FEED); + navigation.navigate(FEED); } } else { if (withAPIKeySecurity) { diff --git a/likeminds-feed-reactnative-integration/customModals/AddOptionModal/index.tsx b/likeminds-feed-reactnative-integration/customModals/AddOptionModal/index.tsx index 986d8660..8ebb678d 100644 --- a/likeminds-feed-reactnative-integration/customModals/AddOptionModal/index.tsx +++ b/likeminds-feed-reactnative-integration/customModals/AddOptionModal/index.tsx @@ -8,7 +8,7 @@ import { SUBMIT_TEXT, } from "../../constants/Strings"; import { styles } from "../../components/LMPoll/styles"; -import { useUniversalFeedCustomisableMethodsContext } from "../../context"; +import { useFeedCustomisableMethodsContext } from "../../context"; import { usePollCustomisableMethodsContext } from "../../context/pollCustomisableCallback"; import STYLES from "../../constants/Styles"; diff --git a/likeminds-feed-reactnative-integration/customModals/DeleteModal/index.tsx b/likeminds-feed-reactnative-integration/customModals/DeleteModal/index.tsx index 81d74ab3..c69e1bff 100644 --- a/likeminds-feed-reactnative-integration/customModals/DeleteModal/index.tsx +++ b/likeminds-feed-reactnative-integration/customModals/DeleteModal/index.tsx @@ -41,7 +41,7 @@ import { LMFeedAnalytics } from "../../analytics/LMFeedAnalytics"; import { Events } from "../../enums/Events"; import { Keys } from "../../enums/Keys"; import { getPostType } from "../../utils/analytics"; -import { UNIVERSAL_FEED } from "../../constants/screenNames"; +import { FEED } from "../../constants/screenNames"; import { Client } from "../../client"; import { usePostDetailContext } from "../../context"; import { CommunityConfigs } from "../../communityConfigs"; @@ -59,7 +59,7 @@ interface DeleteModalProps { parentCommentId?: string; navigation?: NativeStackNavigationProp< RootStackParamList, - "PostDetail" | "UniversalFeed" | "PostsList" + "PostDetail" | "Feed" | "PostsList" >; repliesArrayUnderComments?: any } @@ -121,7 +121,7 @@ const DeleteModal = ({ const routesLength = routes?.length; if ( routesLength > 0 && - routes[routesLength - 1]?.name !== UNIVERSAL_FEED + routes[routesLength - 1]?.name !== FEED ) { navigation?.goBack(); } diff --git a/likeminds-feed-reactnative-integration/enums/FeedType.ts b/likeminds-feed-reactnative-integration/enums/FeedType.ts index f2e5a015..e07e16c6 100644 --- a/likeminds-feed-reactnative-integration/enums/FeedType.ts +++ b/likeminds-feed-reactnative-integration/enums/FeedType.ts @@ -1,4 +1,4 @@ export enum FeedType { PERSONALISED_FEED = "PERSONALISED_FEED", - UNIVERSAL_FEED = "UNIVERSAL_FEED", + FEED = "FEED", } diff --git a/likeminds-feed-reactnative-integration/enums/Keys.ts b/likeminds-feed-reactnative-integration/enums/Keys.ts index 60cb70bf..82a457d0 100644 --- a/likeminds-feed-reactnative-integration/enums/Keys.ts +++ b/likeminds-feed-reactnative-integration/enums/Keys.ts @@ -30,5 +30,5 @@ export enum Keys { YES = "yes", NO = "no", TOPICS_ADDED = "topics_added", - UNIVERSAL_FEED = "universal_feed", + FEED = "feed", } diff --git a/likeminds-feed-reactnative-integration/index.ts b/likeminds-feed-reactnative-integration/index.ts index 4da27406..3807400d 100644 --- a/likeminds-feed-reactnative-integration/index.ts +++ b/likeminds-feed-reactnative-integration/index.ts @@ -2,7 +2,7 @@ import { LMOverlayProvider } from "./lmOverlayProvider"; import { initMyClient } from "./setup"; import { ContextProvider } from "./store/contextStore"; import { - UniversalFeed, + Feed, PostsList, PostDetail, CreatePost, @@ -14,7 +14,7 @@ import { LMFeedPollResult, } from "./screens"; import { - UNIVERSAL_FEED, + FEED, CREATE_POST, POSTS_LIST, POST_DETAIL, @@ -26,7 +26,7 @@ import { } from "./constants/screenNames"; import { usePostDetailContext, - useUniversalFeedContext, + useFeedContext, usePostLikesListContext, useCreatePostContext, usePostListContext, @@ -34,7 +34,7 @@ import { PostDetailContextProvider, PostLikesListContextProvider, PostListContextProvider, - UniversalFeedContextProvider, + FeedContextProvider, CreatePostContextProvider, NotificationFeedContextProvider, useNotificationFeedContext, @@ -54,7 +54,7 @@ import CarouselScreen from "./screens/carouselScreen"; import LMCreatePostButton from "./components/LMCreatePostButton"; import LMFilterTopics from "./components/LMFilterTopics"; import LMPostUploadIndicator from "./components/LMPostUploadIndicator"; -import LMUniversalFeedHeader from "./components/LMUniversalFeedHeader"; +import LMFeedHeader from "./components/LMFeedHeader"; import { LMSocialFeedPostDetailScreen, LMCreatePollScreen, @@ -90,7 +90,7 @@ export { LMOverlayProvider, initMyClient, ContextProvider, - UniversalFeed, + Feed, PostsList, PostDetail, CreatePost, @@ -102,8 +102,8 @@ export { LMCreatePostButton, LMFilterTopics, LMPostUploadIndicator, - LMUniversalFeedHeader, - UNIVERSAL_FEED, + LMFeedHeader, + FEED, TOPIC_FEED, CAROUSEL_SCREEN, CREATE_POST, @@ -116,10 +116,10 @@ export { usePostDetailContext, usePostLikesListContext, usePostListContext, - useUniversalFeedContext, + useFeedContext, useNotificationFeedContext, useCreatePollContext, - UniversalFeedContextProvider, + FeedContextProvider, PostDetailContextProvider, PostLikesListContextProvider, PostListContextProvider, diff --git a/likeminds-feed-reactnative-integration/lmFeedProvider/types.ts b/likeminds-feed-reactnative-integration/lmFeedProvider/types.ts index 1a49edc4..75b4b3b4 100644 --- a/likeminds-feed-reactnative-integration/lmFeedProvider/types.ts +++ b/likeminds-feed-reactnative-integration/lmFeedProvider/types.ts @@ -27,8 +27,8 @@ interface ThemeStyles { lightBackgroundColor?: string; } -// custom style interface for universal feed screen -export interface UniversalFeedStyleProps { +// custom style interface for feed screen +export interface FeedStyleProps { newPostButtonStyle?: ViewStyle; newPostButtonText?: TextStyle; newPostIcon?: ImageProps; @@ -455,7 +455,7 @@ export interface CreatePollStyle { export interface ThemeContextProps { textStyle?: TextStyles; - universalFeedStyle?: UniversalFeedStyleProps; + feedStyle?: FeedStyleProps; postListStyle?: PostListStyleProps; loaderStyle?: LoaderStyleProps; postDetailStyle?: PostDetailStyleProps; diff --git a/likeminds-feed-reactnative-integration/models/RootStackParamsList.ts b/likeminds-feed-reactnative-integration/models/RootStackParamsList.ts index cc2e16d7..15636da7 100644 --- a/likeminds-feed-reactnative-integration/models/RootStackParamsList.ts +++ b/likeminds-feed-reactnative-integration/models/RootStackParamsList.ts @@ -1,5 +1,5 @@ export type RootStackParamList = { - UniversalFeed: undefined; + Feed: undefined; PostsList: undefined; PostDetail: Array | undefined; CreatePost: any; diff --git a/likeminds-feed-reactnative-integration/navigation/SwitchComponent.tsx b/likeminds-feed-reactnative-integration/navigation/SwitchComponent.tsx index 4537468b..4f501962 100644 --- a/likeminds-feed-reactnative-integration/navigation/SwitchComponent.tsx +++ b/likeminds-feed-reactnative-integration/navigation/SwitchComponent.tsx @@ -1,12 +1,12 @@ import * as React from 'react'; import {NavigationContainer} from '@react-navigation/native'; import {createStackNavigator} from '@react-navigation/stack'; -import {PostDetail, PostsList, UniversalFeed} from '../screens'; +import {PostDetail, PostsList, Feed} from '../screens'; import {navigationRef} from './RootNavigation'; import { POSTS_LIST, POST_DETAIL, - UNIVERSAL_FEED, + FEED, } from '../constants/screenNames'; const Stack = createStackNavigator(); @@ -15,7 +15,7 @@ const SwitchComponent = () => { return ( - + diff --git a/likeminds-feed-reactnative-integration/notification/index.ts b/likeminds-feed-reactnative-integration/notification/index.ts index 68b4edec..ae525e19 100644 --- a/likeminds-feed-reactnative-integration/notification/index.ts +++ b/likeminds-feed-reactnative-integration/notification/index.ts @@ -1,5 +1,5 @@ import { NAVIGATED_FROM_NOTIFICATION } from "../constants/Strings"; -import { CREATE_POST, POST_DETAIL, UNIVERSAL_FEED } from "../constants/screenNames"; +import { CREATE_POST, POST_DETAIL, FEED } from "../constants/screenNames"; import notifee, {AndroidImportance, EventType} from '@notifee/react-native'; @@ -11,7 +11,7 @@ export interface RouteParams { // to get notification routes export function getRoute(route: any) { if (route === undefined) { - return {route: UNIVERSAL_FEED, params: {}}; + return {route: FEED, params: {}}; } let params = {} as RouteParams, @@ -36,13 +36,13 @@ export function getRoute(route: any) { } default: return { - route: UNIVERSAL_FEED, + route: FEED, params: { navigationRoute: navigationRoute[1]}, }; } } else { return { - route: UNIVERSAL_FEED, + route: FEED, params: { navigationRoute: navigationRoute[1] }, }; } diff --git a/likeminds-feed-reactnative-integration/screens/universalFeed/index.tsx b/likeminds-feed-reactnative-integration/screens/feed/index.tsx similarity index 85% rename from likeminds-feed-reactnative-integration/screens/universalFeed/index.tsx rename to likeminds-feed-reactnative-integration/screens/feed/index.tsx index 30de3bf5..5eb2d8a7 100644 --- a/likeminds-feed-reactnative-integration/screens/universalFeed/index.tsx +++ b/likeminds-feed-reactnative-integration/screens/feed/index.tsx @@ -1,14 +1,14 @@ import React, { ReactNode } from "react"; import { View } from "react-native"; import { styles } from "./styles"; -import { UniversalFeedCustomisableMethodsContextProvider } from "../../context"; +import { FeedCustomisableMethodsContextProvider } from "../../context"; import { NativeStackNavigationProp } from "@react-navigation/native-stack"; import { LMMenuItemsViewData, RootStackParamList } from "../../models"; import { PollCustomisableMethodsContextProvider } from "../../context/pollCustomisableCallback"; -interface UniversalFeedProps { +interface FeedProps { children?: React.ReactNode; - navigation?: NativeStackNavigationProp; + navigation?: NativeStackNavigationProp; route?: { key: string; name: string; @@ -42,11 +42,11 @@ interface UniversalFeedProps { hideTopicsView?: boolean; } -interface UniversalFeedComponentProps { +interface FeedComponentProps { children: ReactNode; } -const UniversalFeed = ({ +const Feed = ({ navigation, route, children, @@ -69,14 +69,14 @@ const UniversalFeed = ({ isHeadingEnabled = false, isTopResponse = false, hideTopicsView = false -}: UniversalFeedProps) => { +}: FeedProps) => { return ( - - - + + ); }; -const UniversalFeedComponent = ({ children }) => { +const FeedComponent = ({ children }) => { return {children}; }; -export { UniversalFeed }; +export { Feed }; diff --git a/likeminds-feed-reactnative-integration/screens/universalFeed/styles.ts b/likeminds-feed-reactnative-integration/screens/feed/styles.ts similarity index 100% rename from likeminds-feed-reactnative-integration/screens/universalFeed/styles.ts rename to likeminds-feed-reactnative-integration/screens/feed/styles.ts diff --git a/likeminds-feed-reactnative-integration/screens/index.ts b/likeminds-feed-reactnative-integration/screens/index.ts index cd966ebb..52d2f86a 100644 --- a/likeminds-feed-reactnative-integration/screens/index.ts +++ b/likeminds-feed-reactnative-integration/screens/index.ts @@ -1,4 +1,4 @@ -import { UniversalFeed } from "./universalFeed"; +import { Feed } from "./feed"; import { PostsList } from "./postsList"; import { PostDetail } from "./postDetail"; import { CreatePost } from "./createPost"; @@ -10,7 +10,7 @@ import { LMFeedNotificationFeedScreen } from "./notificationFeed"; import { LMFeedNotificationFeedListView } from "./notificationsList"; import UserOnboardingScreen from "./userOnboardingScreen" export { - UniversalFeed, + Feed, PostsList, PostDetail, CreatePost, diff --git a/likeminds-feed-reactnative-integration/screens/postsList/index.tsx b/likeminds-feed-reactnative-integration/screens/postsList/index.tsx index c15425a6..066a402e 100644 --- a/likeminds-feed-reactnative-integration/screens/postsList/index.tsx +++ b/likeminds-feed-reactnative-integration/screens/postsList/index.tsx @@ -31,10 +31,10 @@ import { clearPostDetail } from "../../store/actions/postDetail"; import { PostListContextProvider, PostListContextValues, - UniversalFeedContextValues, + FeedContextValues, usePostListContext, - useUniversalFeedContext, - useUniversalFeedCustomisableMethodsContext, + useFeedContext, + useFeedCustomisableMethodsContext, } from "../../context"; import { postLikesClear } from "../../store/actions/postLikes"; import LMPost from "../../components/LMPost/LMPost"; @@ -88,7 +88,7 @@ const PostsListComponent = ({ localRefresh, postSeen, feedType, - }: UniversalFeedContextValues = useUniversalFeedContext(); + }: FeedContextValues = useFeedContext(); const { navigation, feedData, @@ -138,7 +138,7 @@ const PostsListComponent = ({ isHeadingEnabled, isTopResponse, hideTopicsView, - } = useUniversalFeedCustomisableMethodsContext(); + } = useFeedCustomisableMethodsContext(); const hasFetched = useRef(false); diff --git a/likeminds-feed-reactnative-integration/screens/topicFeed/index.tsx b/likeminds-feed-reactnative-integration/screens/topicFeed/index.tsx index 9626df90..ceaaa5af 100644 --- a/likeminds-feed-reactnative-integration/screens/topicFeed/index.tsx +++ b/likeminds-feed-reactnative-integration/screens/topicFeed/index.tsx @@ -17,13 +17,13 @@ import { import { StackNavigationProp } from "@react-navigation/stack"; import { useNavigation } from "@react-navigation/native"; import { useAppDispatch, useAppSelector } from "../../store/store"; -import { useUniversalFeedContext } from "../../context/universalFeedContext"; +import { useFeedContext } from "../../context/feedContext"; import { CLEAR_FEED, CLEAR_SELECTED_TOPICS, CLEAR_SELECTED_TOPICS_FOR_CREATE_POST_SCREEN, SELECTED_TOPICS_FOR_CREATE_POST_SCREEN, - SELECTED_TOPICS_FOR_UNIVERSAL_FEED_SCREEN, + SELECTED_TOPICS_FOR_FEED_SCREEN, SET_TOPICS, } from "../../store/types/types"; import { getFeed, getTopicsFeed } from "../../store/actions/feed"; @@ -34,7 +34,7 @@ const TopicFeed = () => { const navigation = useNavigation>(); let routes = navigation.getState()?.routes; let previousRoute = routes[routes?.length - 2]; - const { setFeedPageNumber, setIsPaginationStopped } = useUniversalFeedContext() + const { setFeedPageNumber, setIsPaginationStopped } = useFeedContext() const topicsStyle: any = STYLES.$TOPICS_STYLE; @@ -59,7 +59,7 @@ const TopicFeed = () => { const [newTopics, setNewTopics] = useState([] as any); const [stopPagination, setStopPagination] = useState(false); let sortedTopics: any = []; - let sortedTopicsFromUniversalFeed: any = []; + let sortedTopicsFromFeed: any = []; const dispatch = useAppDispatch(); @@ -72,8 +72,8 @@ const TopicFeed = () => { ); const allTopics = useAppSelector((state) => state.feed.topics); - const selectedTopicsFromUniversalFeedScreen = useAppSelector( - (state) => state.feed.selectedTopicsFromUniversalFeedScreen + const selectedTopicsFromFeedScreen = useAppSelector( + (state) => state.feed.selectedTopicsFromFeedScreen ); const filterEnabledTrue = (topicId) => { @@ -123,12 +123,12 @@ const TopicFeed = () => { const filteredTopics = Object.entries(allTopics) .filter( ([topicId, topic]: any) => - !selectedTopicsFromUniversalFeedScreen.includes(topicId) + !selectedTopicsFromFeedScreen.includes(topicId) ) .map(([topicId]) => topicId); let newArr = [ - ...selectedTopicsFromUniversalFeedScreen, + ...selectedTopicsFromFeedScreen, ...filteredTopics, ]; @@ -149,13 +149,13 @@ const TopicFeed = () => { widgetId: topic.widgetId, }; }); - sortedTopicsFromUniversalFeed = newTopics; - setNewTopics(selectedTopicsFromUniversalFeedScreen); + sortedTopicsFromFeed = newTopics; + setNewTopics(selectedTopicsFromFeedScreen); } - }, [topicsSelected, selectedTopicsFromUniversalFeedScreen]); + }, [topicsSelected, selectedTopicsFromFeedScreen]); const handleUpdateAndNavigateBack = async () => { - if (previousRoute?.name === "UniversalFeed") { + if (previousRoute?.name === "Feed") { let body; if (newTopics[0] === "0") { body = { topics: [] }; @@ -163,7 +163,7 @@ const TopicFeed = () => { body = { topics: newTopics }; } await dispatch({ - type: SELECTED_TOPICS_FOR_UNIVERSAL_FEED_SCREEN, + type: SELECTED_TOPICS_FOR_FEED_SCREEN, body, }); setFeedPageNumber(1); @@ -318,18 +318,18 @@ const TopicFeed = () => { const fetchTopics = async () => { const apiRes = await myClient?.getTopics({ - isEnabled: previousRoute?.name === "UniversalFeed" ? null : true, + isEnabled: previousRoute?.name === "Feed" ? null : true, search: search, searchType: "name", page: 1, pageSize: 10, } as any); const res = apiRes?.data; - if (previousRoute?.name === "UniversalFeed") { + if (previousRoute?.name === "Feed") { const updatedTopics = search ? [...res?.topics] - : sortedTopicsFromUniversalFeed?.length > 0 - ? [{ id: "0", name: "All Topics" }, ...sortedTopicsFromUniversalFeed] + : sortedTopicsFromFeed?.length > 0 + ? [{ id: "0", name: "All Topics" }, ...sortedTopicsFromFeed] : [{ id: "0", name: "All Topics" }, ...res?.topics]; setTopics(updatedTopics); } else { diff --git a/likeminds-feed-reactnative-integration/screens/userOnboardingScreen/index.tsx b/likeminds-feed-reactnative-integration/screens/userOnboardingScreen/index.tsx index 1e162493..2e6beaa1 100644 --- a/likeminds-feed-reactnative-integration/screens/userOnboardingScreen/index.tsx +++ b/likeminds-feed-reactnative-integration/screens/userOnboardingScreen/index.tsx @@ -34,13 +34,13 @@ import { useLMFeed } from "../../lmFeedProvider"; import { LMButton, LMIcon, LMInputText, LMText } from "../../uiComponents"; import { UserOnboardingCallbacksContextProvider, - useUniversalFeedContext, + useFeedContext, } from "../../context"; import { useAppDispatch } from "../../store/store"; import { useUserOnboardingContext } from "../../context/userOnboardingContext"; import { useUserOnboardingCallbacksContext } from "../../context/userOnboardingCallbacksContext"; import { Client } from "../../client"; -import { UNIVERSAL_FEED } from "../../constants/screenNames"; +import { FEED } from "../../constants/screenNames"; import { navigationRef } from "../../navigation/RootNavigation"; interface userOnboardingCallbacksContextProps { @@ -217,7 +217,7 @@ function UserOnboardingScreen() { useEffect(() => { if (isInitiated && !isEditing) { setTimeout( - () => navigation.dispatch(StackActions.replace(UNIVERSAL_FEED)), + () => navigation.dispatch(StackActions.replace(FEED)), 0 ); } diff --git a/likeminds-feed-reactnative-integration/store/actions/feed.ts b/likeminds-feed-reactnative-integration/store/actions/feed.ts index 94843f45..aa84dbf2 100644 --- a/likeminds-feed-reactnative-integration/store/actions/feed.ts +++ b/likeminds-feed-reactnative-integration/store/actions/feed.ts @@ -1,9 +1,9 @@ import { Alert } from "react-native"; import { CALL_API } from "../apiMiddleware"; import { - UNIVERSAL_FEED_DATA, - UNIVERSAL_FEED_FAILED, - UNIVERSAL_FEED_SUCCESS, + FEED_DATA, + FEED_FAILED, + FEED_SUCCESS, REPORT_TAGS_SUCCESS, REPORT_TAGS_FAILED, REPORT_TAGS_DATA, @@ -28,12 +28,12 @@ import { DELETE_POST_STATE, AUTO_PLAY_POST_VIDEO, CLEAR_FEED, - UNIVERSAL_FEED_REFRESH_SUCCESS, + FEED_REFRESH_SUCCESS, HIDE_POST, HIDE_POST_SUCCESS, HIDE_POST_FAILED, HIDE_POST_STATE, - UNIVERSAL_TOPICS_FEED_SUCCESS, + TOPICS_FEED_SUCCESS, PERSONALISED_FEED_SUCCESS, PERSONALISED_FEED_DATA, PERSONALISED_FEED_FAILED, @@ -52,18 +52,18 @@ import { SavePostRequest, } from "@likeminds.community/feed-rn"; -// get universal feed API action +// get feed API action export const getFeed = (payload: GetFeedRequest, showLoader: boolean) => () => { try { return { - type: UNIVERSAL_FEED_SUCCESS, + type: FEED_SUCCESS, [CALL_API]: { func: Client.myClient.getFeed(payload), body: payload, types: [ - UNIVERSAL_FEED_DATA, - UNIVERSAL_FEED_SUCCESS, - UNIVERSAL_FEED_FAILED, + FEED_DATA, + FEED_SUCCESS, + FEED_FAILED, ], showLoader: showLoader, }, @@ -97,14 +97,14 @@ export const getPersonalisedFeed = (payload: GetPersonalisedFeedRequest, showLoa export const getTopicsFeed = (payload: GetFeedRequest, showLoader: boolean) => () => { try { return { - type: UNIVERSAL_TOPICS_FEED_SUCCESS, + type: TOPICS_FEED_SUCCESS, [CALL_API]: { func: Client.myClient.getFeed(payload), body: payload, types: [ - UNIVERSAL_FEED_DATA, - UNIVERSAL_TOPICS_FEED_SUCCESS, - UNIVERSAL_FEED_FAILED, + FEED_DATA, + TOPICS_FEED_SUCCESS, + FEED_FAILED, ], showLoader: showLoader, }, @@ -119,14 +119,14 @@ export const refreshFeed = (payload: GetFeedRequest, showLoader: boolean) => () => { try { return { - type: UNIVERSAL_FEED_REFRESH_SUCCESS, + type: FEED_REFRESH_SUCCESS, [CALL_API]: { func: Client.myClient.getFeed(payload), body: payload, types: [ - UNIVERSAL_FEED_DATA, - UNIVERSAL_FEED_REFRESH_SUCCESS, - UNIVERSAL_FEED_FAILED, + FEED_DATA, + FEED_REFRESH_SUCCESS, + FEED_FAILED, ], showLoader: showLoader, }, diff --git a/likeminds-feed-reactnative-integration/store/reducers/createPostReducer.ts b/likeminds-feed-reactnative-integration/store/reducers/createPostReducer.ts index 2bab6af2..bf116641 100644 --- a/likeminds-feed-reactnative-integration/store/reducers/createPostReducer.ts +++ b/likeminds-feed-reactnative-integration/store/reducers/createPostReducer.ts @@ -33,7 +33,7 @@ export const initialState: CreatePostReducerState = { postContent: "", heading: "", topics: [], - poll: {}, // to send poll data on universal feed screen + poll: {}, // to send poll data on feed screen selectedTopics: [], disbaledTopics: [], predefinedTopics: [], diff --git a/likeminds-feed-reactnative-integration/store/reducers/feedReducer.ts b/likeminds-feed-reactnative-integration/store/reducers/feedReducer.ts index 0d0434c3..de92c0d9 100644 --- a/likeminds-feed-reactnative-integration/store/reducers/feedReducer.ts +++ b/likeminds-feed-reactnative-integration/store/reducers/feedReducer.ts @@ -1,7 +1,7 @@ import { convertSingleFeedPost, convertToLMPostViewData, - convertUniversalFeedPosts, + convertFeedPosts, } from "../../viewDataModels"; import { PIN_POST_ID, @@ -10,24 +10,24 @@ import { UNPIN_THIS_POST, } from "../../constants/Strings"; import { - UNIVERSAL_FEED_SUCCESS, + FEED_SUCCESS, REPORT_TAGS_SUCCESS, PIN_POST_STATE, DELETE_POST_STATE, - UNIVERSAL_FEED_REFRESH_SUCCESS, + FEED_REFRESH_SUCCESS, LIKE_POST_STATE, SAVE_POST_STATE, EDIT_POST_SUCCESS, CREATE_COMMENT_SUCCESS, DELETE_COMMENT_STATE, AUTO_PLAY_POST_VIDEO, - SELECTED_TOPICS_FOR_UNIVERSAL_FEED_SCREEN, + SELECTED_TOPICS_FOR_FEED_SCREEN, SELECTED_TOPICS_FOR_CREATE_POST_SCREEN, CLEAR_SELECTED_TOPICS_FOR_CREATE_POST_SCREEN, POST_DATA_SUCCESS, SET_TOPICS, - SELECTED_TOPICS_FROM_UNIVERSAL_FEED_SCREEN, - CLEAR_SELECTED_TOPICS_FROM_UNIVERSAL_FEED_SCREEN, + SELECTED_TOPICS_FROM_FEED_SCREEN, + CLEAR_SELECTED_TOPICS_FROM_FEED_SCREEN, STATUS_BAR_STYLE, SET_MUTED_STATE, SET_PAUSED_STATUS, @@ -35,13 +35,13 @@ import { SET_REPORT_MODEL_STATUS_IN_POST_DETAIL, SET_FLOW_TO_CREATE_POST_SCREEN, SET_FLOW_TO_CAROUSEL_SCREEN, - MAPPED_TOPICS_FROM_UNIVERSAL_FEED_SCREEN, + MAPPED_TOPICS_FROM_FEED_SCREEN, SET_NOTIFICATION_COUNT, SET_FLOW_TO_POST_DETAIL_SCREEN, HIDE_POST_STATE, CLEAR_SELECTED_TOPICS, CLEAR_FEED, - UNIVERSAL_TOPICS_FEED_SUCCESS, + TOPICS_FEED_SUCCESS, REFRESH_FROM_ONBOARDING_SCREEN, PERSONALISED_FEED_SUCCESS, PERSONALISED_FEED_REFRESH_SUCCESS, @@ -57,9 +57,9 @@ export interface FeedReducerState { autoPlayVideoPostId: ""; topics: {}; mappedTopics: {}; - selectedTopicsForUniversalFeedScreen: []; + selectedTopicsForFeedScreen: []; selectedTopicsForCreatePostScreen: []; - selectedTopicsFromUniversalFeedScreen: []; + selectedTopicsFromFeedScreen: []; statusBarStyle: string; muteStatus: boolean; pauseStatus: boolean; @@ -79,9 +79,9 @@ export const initialState: FeedReducerState = { autoPlayVideoPostId: "", topics: {}, mappedTopics: {}, - selectedTopicsForUniversalFeedScreen: [], + selectedTopicsForFeedScreen: [], selectedTopicsForCreatePostScreen: [], - selectedTopicsFromUniversalFeedScreen: [], + selectedTopicsFromFeedScreen: [], statusBarStyle: Styles.$STATUS_BAR_STYLE.default ? Styles.$STATUS_BAR_STYLE.default : "", @@ -148,12 +148,12 @@ export const feedReducer = (state = initialState, action) => { return { ...state, statusBarStyle: color }; } - case UNIVERSAL_TOPICS_FEED_SUCCESS: { + case TOPICS_FEED_SUCCESS: { const { users = {}, topics } = action.body; let feedData = state.feed; let usersData = state.users; // model converter function - const post = convertUniversalFeedPosts(action.body); + const post = convertFeedPosts(action.body); // this handles pagination and appends new post data with previous data feedData = [...post]; // this appends the new users data with previous data @@ -166,26 +166,26 @@ export const feedReducer = (state = initialState, action) => { }; } - case SELECTED_TOPICS_FROM_UNIVERSAL_FEED_SCREEN: { + case SELECTED_TOPICS_FROM_FEED_SCREEN: { const { topics = {} } = action.body; return { ...state, - selectedTopicsFromUniversalFeedScreen: topics, + selectedTopicsFromFeedScreen: topics, }; } - case CLEAR_SELECTED_TOPICS_FROM_UNIVERSAL_FEED_SCREEN: { + case CLEAR_SELECTED_TOPICS_FROM_FEED_SCREEN: { return { ...state, - selectedTopicsFromUniversalFeedScreen: [], + selectedTopicsFromFeedScreen: [], }; } - case SELECTED_TOPICS_FOR_UNIVERSAL_FEED_SCREEN: { + case SELECTED_TOPICS_FOR_FEED_SCREEN: { const { topics = {} } = action.body; return { ...state, - selectedTopicsForUniversalFeedScreen: topics, + selectedTopicsForFeedScreen: topics, }; } @@ -209,7 +209,7 @@ export const feedReducer = (state = initialState, action) => { return { ...state, topics: { ...state.topics, ...topics } }; } - case MAPPED_TOPICS_FROM_UNIVERSAL_FEED_SCREEN: { + case MAPPED_TOPICS_FROM_FEED_SCREEN: { const { topics = {} } = action.body; return { ...state, @@ -220,16 +220,16 @@ export const feedReducer = (state = initialState, action) => { case CLEAR_SELECTED_TOPICS: { return { ...state, - selectedTopicsForUniversalFeedScreen: [], + selectedTopicsForFeedScreen: [], }; } - case UNIVERSAL_FEED_SUCCESS: { + case FEED_SUCCESS: { const { users = {}, topics } = action.body; let feedData = state.feed; let usersData = state.users; // model converter function - const post = convertUniversalFeedPosts(action.body); + const post = convertFeedPosts(action.body); // this handles pagination and appends new post data with previous data feedData = feedData ? [...feedData, ...post] : [...post]; // this appends the new users data with previous data @@ -242,10 +242,10 @@ export const feedReducer = (state = initialState, action) => { }; } - case UNIVERSAL_FEED_REFRESH_SUCCESS: { + case FEED_REFRESH_SUCCESS: { const { users = {} } = action.body; // model converter function - const post = convertUniversalFeedPosts(action.body); + const post = convertFeedPosts(action.body); return { ...state, feed: post, users: users }; } @@ -254,7 +254,7 @@ export const feedReducer = (state = initialState, action) => { let feedData = state.feed; let usersData = state.users; // model converter function - const post = convertUniversalFeedPosts(action.body); + const post = convertFeedPosts(action.body); // this handles pagination and appends new post data with previous data feedData = feedData ? [...feedData, ...post] : [...post]; // this appends the new users data with previous data @@ -270,7 +270,7 @@ export const feedReducer = (state = initialState, action) => { case PERSONALISED_FEED_REFRESH_SUCCESS: { const { users = {} } = action.body; // model converter function - const post = convertUniversalFeedPosts(action.body); + const post = convertFeedPosts(action.body); return { ...state, feed: post, users: users }; } diff --git a/likeminds-feed-reactnative-integration/store/types/types.ts b/likeminds-feed-reactnative-integration/store/types/types.ts index cdc3da73..d3c9d809 100644 --- a/likeminds-feed-reactnative-integration/store/types/types.ts +++ b/likeminds-feed-reactnative-integration/store/types/types.ts @@ -21,24 +21,24 @@ export const SET_FLOW_TO_CAROUSEL_SCREEN = "SET_FLOW_TO_CAROUSEL_SCREEN"; export const SET_NOTIFICATION_COUNT = "SET_NOTIFICATION_COUNT"; export const SET_FLOW_TO_POST_DETAIL_SCREEN = "SET_FLOW_TO_POST_DETAIL_SCREEN"; -export const UNIVERSAL_FEED_DATA = "UNIVERSAL_FEED_DATA"; +export const FEED_DATA = "FEED_DATA"; export const REFRESH_FROM_ONBOARDING_SCREEN = "REFRESH_FROM_ONBOARDING_SCREEN"; -export const UNIVERSAL_FEED_FAILED = "UNIVERSAL_FEED_FAILED"; -export const UNIVERSAL_FEED_SUCCESS = "UNIVERSAL_FEED_SUCCESS"; -export const UNIVERSAL_TOPICS_FEED_SUCCESS = "UNIVERSAL_TOPICS_FEED_SUCCESS"; -export const UNIVERSAL_FEED_REFRESH_SUCCESS = "UNIVERSAL_FEED_REFRESH_SUCCESS"; -export const SELECTED_TOPICS_FOR_UNIVERSAL_FEED_SCREEN = - "SELECTED_TOPICS_FOR_UNIVERSAL_FEED_SCREEN"; +export const FEED_FAILED = "FEED_FAILED"; +export const FEED_SUCCESS = "FEED_SUCCESS"; +export const TOPICS_FEED_SUCCESS = "TOPICS_FEED_SUCCESS"; +export const FEED_REFRESH_SUCCESS = "FEED_REFRESH_SUCCESS"; +export const SELECTED_TOPICS_FOR_FEED_SCREEN = + "SELECTED_TOPICS_FOR_FEED_SCREEN"; export const SELECTED_TOPICS_FOR_CREATE_POST_SCREEN = "SELECTED_TOPICS_FOR_CREATE_POST_SCREEN"; export const CLEAR_SELECTED_TOPICS_FOR_CREATE_POST_SCREEN = "CLEAR_SELECTED_TOPICS_FOR_CREATE_POST_SCREEN"; -export const SELECTED_TOPICS_FROM_UNIVERSAL_FEED_SCREEN = - "SELECTED_TOPICS_FROM_UNIVERSAL_FEED_SCREEN"; -export const MAPPED_TOPICS_FROM_UNIVERSAL_FEED_SCREEN = - "MAPPED_TOPICS_FROM_UNIVERSAL_FEED_SCREEN"; -export const CLEAR_SELECTED_TOPICS_FROM_UNIVERSAL_FEED_SCREEN = - "CLEAR_SELECTED_TOPICS_FROM_UNIVERSAL_FEED_SCREEN"; +export const SELECTED_TOPICS_FROM_FEED_SCREEN = + "SELECTED_TOPICS_FROM_FEED_SCREEN"; +export const MAPPED_TOPICS_FROM_FEED_SCREEN = + "MAPPED_TOPICS_FROM_FEED_SCREEN"; +export const CLEAR_SELECTED_TOPICS_FROM_FEED_SCREEN = + "CLEAR_SELECTED_TOPICS_FROM_FEED_SCREEN"; export const LIKE_POST = "LIKE_POST"; export const LIKE_POST_FAILED = "LIKE_POST_FAILED"; diff --git a/likeminds-feed-reactnative-integration/viewDataModels/index.ts b/likeminds-feed-reactnative-integration/viewDataModels/index.ts index f0af040e..bf435768 100644 --- a/likeminds-feed-reactnative-integration/viewDataModels/index.ts +++ b/likeminds-feed-reactnative-integration/viewDataModels/index.ts @@ -42,7 +42,7 @@ import { LMFeedWidgetViewData } from "../models/LMWidgetData"; * @param data: [GetFeedResponse] * @returns list of [LMPostViewData] */ -export function convertUniversalFeedPosts(data: { +export function convertFeedPosts(data: { posts: Post[]; topics: { [key: string]: LMTopicViewData }; users: { [key: string]: LMUserViewData }; diff --git a/likeminds-feed-reactnative-integration/wrappers/detailScreenWrapper.tsx b/likeminds-feed-reactnative-integration/wrappers/detailScreenWrapper.tsx index 125b01d3..6b382f18 100644 --- a/likeminds-feed-reactnative-integration/wrappers/detailScreenWrapper.tsx +++ b/likeminds-feed-reactnative-integration/wrappers/detailScreenWrapper.tsx @@ -1,18 +1,18 @@ import React from "react"; import { PostDetailContextProvider, - UniversalFeedContextProvider, + FeedContextProvider, } from "../context"; import { PostDetail } from "../screens/postDetail"; const DetailWrapper = ({ navigation, route }: any) => { return ( - + {/* @ts-ignore */} - + ); }; diff --git a/likeminds-feed-reactnative-integration/wrappers/qnaFeedCreateWrapper.tsx b/likeminds-feed-reactnative-integration/wrappers/qnaFeedCreateWrapper.tsx index 1c90a239..a9c0c819 100644 --- a/likeminds-feed-reactnative-integration/wrappers/qnaFeedCreateWrapper.tsx +++ b/likeminds-feed-reactnative-integration/wrappers/qnaFeedCreateWrapper.tsx @@ -3,7 +3,7 @@ import { View } from "react-native"; import { CreatePost, CreatePostContextProvider, - UniversalFeedContextProvider, + FeedContextProvider, useCreatePostContext, } from "../index"; import { @@ -57,10 +57,10 @@ const CreateScreen = () => { export default function QnAFeedCreateWrapper({ navigation, route }) { return ( - + - + ); } diff --git a/likeminds-feed-reactnative-integration/wrappers/qnaFeedPostDetailWrapper.tsx b/likeminds-feed-reactnative-integration/wrappers/qnaFeedPostDetailWrapper.tsx index 8dc74808..2a3e9d81 100644 --- a/likeminds-feed-reactnative-integration/wrappers/qnaFeedPostDetailWrapper.tsx +++ b/likeminds-feed-reactnative-integration/wrappers/qnaFeedPostDetailWrapper.tsx @@ -1,7 +1,7 @@ import React from "react"; import { PostDetailContextProvider, - UniversalFeedContextProvider, + FeedContextProvider, useLMPostContext, } from "../context"; import { PostDetail } from "../screens/postDetail"; @@ -9,12 +9,12 @@ import LMPostQnAFeedFooter from "../components/LMPost/LMPostQnAFeedFooter"; const LMQnAPostDetailScreen = ({ navigation, route }: any) => { return ( - + {/* @ts-ignore */} } /> - + ); }; diff --git a/likeminds-feed-reactnative-integration/wrappers/qnaFeedScreenWrapper.tsx b/likeminds-feed-reactnative-integration/wrappers/qnaFeedScreenWrapper.tsx index ffc28952..b1a1d165 100644 --- a/likeminds-feed-reactnative-integration/wrappers/qnaFeedScreenWrapper.tsx +++ b/likeminds-feed-reactnative-integration/wrappers/qnaFeedScreenWrapper.tsx @@ -1,15 +1,15 @@ import React, { useState, useEffect } from "react"; import { PostListContextProvider, - UniversalFeedContextProvider, + FeedContextProvider, useLMPostContext, usePostListContext, } from "../context"; import { useAppSelector } from "../store/store"; import { token } from "../utils/pushNotifications"; import { View } from "react-native"; -import { UniversalFeed } from "../screens/universalFeed"; -import LMUniversalFeedHeader from "../components/LMUniversalFeedHeader"; +import { Feed } from "../screens/feed"; +import LMFeedHeader from "../components/LMFeedHeader"; import LMFilterTopics from "../components/LMFilterTopics"; import LMPostUploadIndicator from "../components/LMPostUploadIndicator"; import { PostsList } from "../screens/postsList"; @@ -17,10 +17,15 @@ import LMCreatePostButton from "../components/LMCreatePostButton"; import LMPostQnAFeedFooter from "../components/LMPost/LMPostQnAFeedFooter"; import STYLES from "../constants/Styles"; import { LINK_ATTACHMENT_TYPE } from "../constants/Strings"; -import { LMPostContent, LMPostFooter, LMPostHeader, LMPostMedia } from "../components"; +import { + LMPostContent, + LMPostFooter, + LMPostHeader, + LMPostMedia, +} from "../components"; import LMPostTopResponse from "../components/LMPost/LMPostTopResponse"; import LMPostHeading from "../components/LMPost/LMPostHeading"; -const Feed = () => { +const QnAFeed = () => { const [FCMToken, setFCMToken] = useState(""); /// Setup notifications @@ -34,26 +39,24 @@ const Feed = () => { return ( - - + + - } - /> + } /> - + ); }; const QnAFeedWrapper = ({ navigation, route }) => { return ( - + - + - + ); }; diff --git a/likeminds-feed-reactnative-integration/wrappers/socialFeedCreateWrapper.tsx b/likeminds-feed-reactnative-integration/wrappers/socialFeedCreateWrapper.tsx index 61bfaf89..ac3ed1a2 100644 --- a/likeminds-feed-reactnative-integration/wrappers/socialFeedCreateWrapper.tsx +++ b/likeminds-feed-reactnative-integration/wrappers/socialFeedCreateWrapper.tsx @@ -1,7 +1,7 @@ import React from "react"; import { CreatePostContextProvider, - UniversalFeedContextProvider, + FeedContextProvider, } from "../context"; import { CreatePost } from "../screens/createPost"; import LMCreatePostHeader from "../components/LMCreatePost/LMCreatePostHeader"; @@ -16,7 +16,7 @@ import LMCreatePostMedia from "../components/LMCreatePost/LMCreatePostMedia"; const SocialFeedCreateWrapper = ({ navigation, route }) => { return ( - + {/* @ts-ignore */} @@ -48,7 +48,7 @@ const SocialFeedCreateWrapper = ({ navigation, route }) => { - + ); }; diff --git a/likeminds-feed-reactnative-integration/wrappers/socialFeedScreenWrapper.tsx b/likeminds-feed-reactnative-integration/wrappers/socialFeedScreenWrapper.tsx index d2fe92f7..f5a9549a 100644 --- a/likeminds-feed-reactnative-integration/wrappers/socialFeedScreenWrapper.tsx +++ b/likeminds-feed-reactnative-integration/wrappers/socialFeedScreenWrapper.tsx @@ -1,19 +1,19 @@ import React, { useState, useEffect } from "react"; import { PostListContextProvider, - UniversalFeedContextProvider, + FeedContextProvider, } from "../context"; import { useAppSelector } from "../store/store"; import { token } from "../utils/pushNotifications"; import { View } from "react-native"; -import { UniversalFeed } from "../screens/universalFeed"; -import LMUniversalFeedHeader from "../components/LMUniversalFeedHeader"; +import { Feed } from "../screens/feed"; +import LMFeedHeader from "../components/LMFeedHeader"; import LMFilterTopics from "../components/LMFilterTopics"; import LMPostUploadIndicator from "../components/LMPostUploadIndicator"; import { PostsList } from "../screens/postsList"; import LMCreatePostButton from "../components/LMCreatePostButton"; -const Feed = () => { +const SocialFeed = () => { const [FCMToken, setFCMToken] = useState(""); /// Setup notifications @@ -27,24 +27,24 @@ const Feed = () => { return ( - - + + - + ); }; const LMSocialFeedScreen = ({ navigation, route }) => { return ( - + - + - + ); }; diff --git a/likeminds-feed-reactnative-integration/wrappers/topicFeedScreenWrapper.tsx b/likeminds-feed-reactnative-integration/wrappers/topicFeedScreenWrapper.tsx index 0cebd7ea..cd33bac3 100644 --- a/likeminds-feed-reactnative-integration/wrappers/topicFeedScreenWrapper.tsx +++ b/likeminds-feed-reactnative-integration/wrappers/topicFeedScreenWrapper.tsx @@ -1,17 +1,17 @@ import React from "react"; import { - UniversalFeedContextProvider, + FeedContextProvider, CreatePostContextProvider, } from "../context"; import { TopicFeed } from "../screens/topicFeed"; const TopicFeedWrapper = ({ navigation, route }) => { return ( - + - + ); }; diff --git a/likeminds-feed-reactnative-integration/wrappers/userOnboardingScreenWrapper.tsx b/likeminds-feed-reactnative-integration/wrappers/userOnboardingScreenWrapper.tsx index f278cc59..7bb9f7fd 100644 --- a/likeminds-feed-reactnative-integration/wrappers/userOnboardingScreenWrapper.tsx +++ b/likeminds-feed-reactnative-integration/wrappers/userOnboardingScreenWrapper.tsx @@ -1,6 +1,6 @@ import React from "react"; import { - UniversalFeedContextProvider, + FeedContextProvider, UserOnboardingContextProvider, } from "../context"; import UserOnboardingScreen from "../screens/userOnboardingScreen"; diff --git a/qna-feed/App.tsx b/qna-feed/App.tsx index 318abc61..81866d00 100644 --- a/qna-feed/App.tsx +++ b/qna-feed/App.tsx @@ -1,6 +1,6 @@ import React, {useEffect, useState} from 'react'; import { - UNIVERSAL_FEED, + FEED, TOPIC_FEED, POST_DETAIL, CREATE_POST, @@ -49,7 +49,7 @@ import { import {LMFeedClient, InitiateUserRequest} from '@likeminds.community/feed-rn'; import {LoginSchemaRO} from './login/loginSchemaRO'; import {GestureHandlerRootView} from 'react-native-gesture-handler'; -import UniversalFeedScreen from './screens/UniversalFeedScreen'; +import FeedScreen from './screens/FeedScreen'; import PostDetailsScreen from './screens/PostDetailsScreen'; import {FeedType} from '@likeminds.community/feed-rn-core'; @@ -256,10 +256,10 @@ const App = () => { { + const mappedTopics = useAppSelector((state: any) => state.feed.mappedTopics); + const [FCMToken, setFCMToken] = useState(''); + + /// Setup notifications + useEffect(() => { + token().then(res => { + if (!!res) { + setFCMToken(res); + } + }); + }, []); + + return ( + + + + + + } + /> + + + + ); +}; + +const FeedScreen = ({navigation, route}) => { + return ( + + + + + + ); +}; + +export default FeedScreen; diff --git a/qna-feed/screens/PostDetailsScreen.tsx b/qna-feed/screens/PostDetailsScreen.tsx index 741678ce..45b26e75 100644 --- a/qna-feed/screens/PostDetailsScreen.tsx +++ b/qna-feed/screens/PostDetailsScreen.tsx @@ -2,19 +2,19 @@ import React from "react"; import { PostDetail, PostDetailContextProvider, - UniversalFeedContextProvider, + FeedContextProvider, } from "@likeminds.community/feed-rn-core"; import LMPostQnAFeedFooter from "@likeminds.community/feed-rn-core/components/LMPost/LMPostQnAFeedFooter"; import CustomPost from "../components/CustomPost"; const PostDetailsScreen = ({ navigation, route }: any) => { return ( - + {/* @ts-ignore */} } /> - + ); }; diff --git a/qna-feed/screens/UniversalFeedScreen.tsx b/qna-feed/screens/UniversalFeedScreen.tsx deleted file mode 100644 index 18cf5a5c..00000000 --- a/qna-feed/screens/UniversalFeedScreen.tsx +++ /dev/null @@ -1,59 +0,0 @@ -import React, { useState, useEffect } from "react"; -import { - LMCreatePostButton, - LMFilterTopics, - LMPostUploadIndicator, - LMUniversalFeedHeader, - PostListContextProvider, - PostsList, - UniversalFeed, - UniversalFeedContextProvider, - usePostListContext, -} from "@likeminds.community/feed-rn-core"; -import { Text, View } from "react-native"; -import { token } from "../pushNotification"; -import LMPostQnAFeedFooter from "@likeminds.community/feed-rn-core/components/LMPost/LMPostQnAFeedFooter"; -import { useAppSelector } from "@likeminds.community/feed-rn-core/store/store"; -import CustomPost from "../components/CustomPost"; - - -const Feed = () => { - const mappedTopics = useAppSelector((state: any) => state.feed.mappedTopics); - const [FCMToken, setFCMToken] = useState(""); - - /// Setup notifications - useEffect(() => { - token().then((res) => { - if (!!res) { - setFCMToken(res); - } - }); - }, []); - - return ( - - - - - - } - /> - - - - ); -}; - -const UniversalFeedScreen = ({ navigation, route }) => { - return ( - - - - - - ); -}; - -export default UniversalFeedScreen; \ No newline at end of file diff --git a/qna-feed/screens/createScreenWrapper.tsx b/qna-feed/screens/createScreenWrapper.tsx index 10e52169..1f2dcf22 100644 --- a/qna-feed/screens/createScreenWrapper.tsx +++ b/qna-feed/screens/createScreenWrapper.tsx @@ -1,14 +1,14 @@ import React from 'react'; -import {CreatePostContextProvider, UniversalFeedContextProvider} from '@likeminds.community/feed-rn-core'; +import {CreatePostContextProvider, FeedContextProvider} from '@likeminds.community/feed-rn-core'; import CreateScreen from './createScreen'; const CreateWrapper = ({navigation, route}: any) => { return ( - + - + ); }; diff --git a/social-feed/App.tsx b/social-feed/App.tsx index b090cd11..1325c1d4 100644 --- a/social-feed/App.tsx +++ b/social-feed/App.tsx @@ -1,6 +1,6 @@ import React, {useEffect, useState} from 'react'; import { - UNIVERSAL_FEED, + FEED, TOPIC_FEED, POST_DETAIL, CREATE_POST, @@ -263,10 +263,10 @@ const App = () => { }} /> { const [actionAlertModalVisible, setActionAlertModalVisible] = useState(false); - const {showCreatePost}: UniversalFeedContextValues = - useUniversalFeedContext(); - const universalFeedStyle = STYLES.$UNIVERSAL_FEED_STYLE; + const {showCreatePost}: FeedContextValues = + useFeedContext(); + const feedStyle = STYLES.$FEED_STYLE; const hideActionModal = () => { setActionAlertModalVisible(false); @@ -31,14 +31,14 @@ const CreatePostButton = () => { showCreatePost ? styles.newPostButtonEnable : styles.newPostButtonDisable, - universalFeedStyle?.newPostButtonStyle, + feedStyle?.newPostButtonStyle, ]} // handles post uploading status and member rights to create post onPress={() => { showActionModal(); }}> + style={[styles.newPostText, feedStyle?.newPostButtonText]}> NEW POST diff --git a/social-feed/components/CreatePostTypeModal/index.tsx b/social-feed/components/CreatePostTypeModal/index.tsx index 5278eb03..19a0b2ae 100644 --- a/social-feed/components/CreatePostTypeModal/index.tsx +++ b/social-feed/components/CreatePostTypeModal/index.tsx @@ -13,9 +13,9 @@ import { useAppSelector, } from '@likeminds.community/feed-rn-core/store/store'; import { - UniversalFeedContextValues, - useUniversalFeedContext, - useUniversalFeedCustomisableMethodsContext, + FeedContextValues, + useFeedContext, + useFeedCustomisableMethodsContext, } from '@likeminds.community/feed-rn-core/context'; import {SET_PREDEFINED_TOPICS} from '@likeminds.community/feed-rn-core/store/types/types'; import {LMFeedAnalytics} from '@likeminds.community/feed-rn-core'; @@ -23,10 +23,10 @@ import {Events} from '@likeminds.community/feed-rn-core/enums/Events'; const CreatePostTypeModal = ({actionAlertModalVisible, hideActionModal}) => { const dispatch = useAppDispatch(); - const {showCreatePost, newPostButtonClick}: UniversalFeedContextValues = - useUniversalFeedContext(); + const {showCreatePost, newPostButtonClick}: FeedContextValues = + useFeedContext(); const {newPostButtonClickProps} = - useUniversalFeedCustomisableMethodsContext(); + useFeedCustomisableMethodsContext(); const topics = useAppSelector(state => state.feed.topics); return ( diff --git a/social-feed/components/FilterTopics/index.tsx b/social-feed/components/FilterTopics/index.tsx index 5e8c8010..ef1a1aa4 100644 --- a/social-feed/components/FilterTopics/index.tsx +++ b/social-feed/components/FilterTopics/index.tsx @@ -4,16 +4,16 @@ import { useAppDispatch, useAppSelector, } from '@likeminds.community/feed-rn-core/store/store'; -import {useUniversalFeedContext} from '@likeminds.community/feed-rn-core'; -import {UniversalFeedContextValues} from '@likeminds.community/feed-rn-core/context'; +import {useFeedContext} from '@likeminds.community/feed-rn-core'; +import {FeedContextValues} from '@likeminds.community/feed-rn-core/context'; import {Client} from '@likeminds.community/feed-rn-core/client'; import { - MAPPED_TOPICS_FROM_UNIVERSAL_FEED_SCREEN, - SELECTED_TOPICS_FOR_UNIVERSAL_FEED_SCREEN, + MAPPED_TOPICS_FROM_FEED_SCREEN, + SELECTED_TOPICS_FOR_FEED_SCREEN, SET_TOPICS, } from '@likeminds.community/feed-rn-core/store/types/types'; import Layout from '@likeminds.community/feed-rn-core/constants/Layout'; -import {styles} from '@likeminds.community/feed-rn-core/screens/universalFeed/styles'; +import {styles} from '@likeminds.community/feed-rn-core/screens/feed/styles'; const FilterTopics = () => { const dispatch = useAppDispatch(); @@ -21,13 +21,13 @@ const FilterTopics = () => { feedData, navigation, getNotificationsCount, - }: UniversalFeedContextValues = useUniversalFeedContext(); + }: FeedContextValues = useFeedContext(); const myClient = Client.myClient; const [showTopics, setShowTopics] = useState(false); const [isAnyMatchFound, setIsAnyMatchFound] = useState(true); const selectedTopics = useAppSelector( - state => state.feed.selectedTopicsForUniversalFeedScreen, + state => state.feed.selectedTopicsForFeedScreen, ); const topics = useAppSelector(state => state.feed.topics); const mappedTopics = useAppSelector(state => state.feed.mappedTopics); @@ -43,7 +43,7 @@ const FilterTopics = () => { name: topics[topicId]?.name || 'Unknown', // Use optional chaining and provide a default name if not found })); dispatch({ - type: MAPPED_TOPICS_FROM_UNIVERSAL_FEED_SCREEN, + type: MAPPED_TOPICS_FROM_FEED_SCREEN, body: {topics: filteredTopicArray}, }); getUnreadCount(); @@ -52,7 +52,7 @@ const FilterTopics = () => { const handleIndividualTopicsPress = async topicId => { /* @ts-ignore */ await dispatch({ - type: SELECTED_TOPICS_FOR_UNIVERSAL_FEED_SCREEN, + type: SELECTED_TOPICS_FOR_FEED_SCREEN, body: {topics: [topicId]}, }); }; @@ -132,7 +132,7 @@ const FilterTopics = () => { { await dispatch({ - type: SELECTED_TOPICS_FOR_UNIVERSAL_FEED_SCREEN, + type: SELECTED_TOPICS_FOR_FEED_SCREEN, body: {topics: []}, }); }}> diff --git a/social-feed/feedScreen/createScreenWrapper.tsx b/social-feed/feedScreen/createScreenWrapper.tsx index 81f91d92..3533a153 100644 --- a/social-feed/feedScreen/createScreenWrapper.tsx +++ b/social-feed/feedScreen/createScreenWrapper.tsx @@ -1,14 +1,14 @@ import React from 'react'; -import {CreatePostContextProvider, UniversalFeedContextProvider} from '@likeminds.community/feed-rn-core'; +import {CreatePostContextProvider, FeedContextProvider} from '@likeminds.community/feed-rn-core'; import CreateScreen from './createScreen'; const CreateWrapper = ({navigation, route}) => { return ( - + - + ); }; diff --git a/social-feed/feedScreen/detailScreen.tsx b/social-feed/feedScreen/detailScreen.tsx index 21210957..8e0fb0a3 100644 --- a/social-feed/feedScreen/detailScreen.tsx +++ b/social-feed/feedScreen/detailScreen.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { PostDetail, usePostDetailContext, - useUniversalFeedContext, + useFeedContext, } from '@likeminds.community/feed-rn-core'; import {Alert, Platform, Share} from 'react-native'; @@ -20,7 +20,7 @@ const DetailScreen = ({navigation}) => { onCommentOverflowMenuClick, } = usePostDetailContext(); const {addPollOption, setSelectedPollOptions, submitPoll} = - useUniversalFeedContext(); + useFeedContext(); const customGetCommentsRepliesProp = ( postId, diff --git a/social-feed/feedScreen/detailScreenWrapper.tsx b/social-feed/feedScreen/detailScreenWrapper.tsx index a6358d76..5dff29e5 100644 --- a/social-feed/feedScreen/detailScreenWrapper.tsx +++ b/social-feed/feedScreen/detailScreenWrapper.tsx @@ -2,16 +2,16 @@ import React from 'react'; import DetailScreen from './detailScreen'; import { PostDetailContextProvider, - UniversalFeedContextProvider, + FeedContextProvider, } from '@likeminds.community/feed-rn-core'; const DetailWrapper = ({navigation, route}) => { return ( - + - + ); }; diff --git a/social-feed/feedScreen/feed.tsx b/social-feed/feedScreen/feed.tsx index 312f84bb..8467f9c0 100644 --- a/social-feed/feedScreen/feed.tsx +++ b/social-feed/feedScreen/feed.tsx @@ -3,11 +3,11 @@ import { LMCreatePostButton, LMFilterTopics, LMPostUploadIndicator, - LMUniversalFeedHeader, + LMFeedHeader, PostsList, - UniversalFeed, + Feed, usePostListContext, - useUniversalFeedContext, + useFeedContext, } from '@likeminds.community/feed-rn-core'; import {getUniqueId} from 'react-native-device-info'; import {Alert, Platform, Share} from 'react-native'; @@ -17,7 +17,7 @@ import {useAppSelector} from '@likeminds.community/feed-rn-core/store/store'; import FilterTopics from '../components/FilterTopics'; import CreatePostButton from '../components/CreatePostButton'; -const Feed = () => { +const SocialFeed = () => { const { postLikeHandler, savePostHandler, @@ -35,7 +35,7 @@ const Feed = () => { addPollOption, setSelectedPollOptions, submitPoll, - } = useUniversalFeedContext(); + } = useFeedContext(); const mappedTopics = useAppSelector(state => state.feed.mappedTopics); const [FCMToken, setFCMToken] = useState(''); @@ -146,14 +146,8 @@ const Feed = () => { }); }, []); - // useEffect(() => { - // if (FCMToken) { - // pushAPI(FCMToken, accessToken); - // } - // }, [FCMToken]); - return ( - customPostLike(id)} savePostHandlerProp={(id, saved) => customPostSave(id, saved)} onSelectCommentCountProp={id => customHandleCommentClick(id)} @@ -173,13 +167,13 @@ const Feed = () => { onSubmitButtonClicked={customPollSubmitButtonClick} onAddPollOptionsClicked={customAddPollOptionsClick} onPollOptionClicked={customPollOptionClicked}> - + - + ); }; -export default Feed; +export default SocialFeed; diff --git a/social-feed/feedScreen/feedWrapper.tsx b/social-feed/feedScreen/feedWrapper.tsx index 03fa1b2e..65aae103 100644 --- a/social-feed/feedScreen/feedWrapper.tsx +++ b/social-feed/feedScreen/feedWrapper.tsx @@ -1,14 +1,14 @@ import React from 'react' import Feed from './feed' -import { PostListContextProvider, UniversalFeedContextProvider } from '@likeminds.community/feed-rn-core' +import { PostListContextProvider, FeedContextProvider } from '@likeminds.community/feed-rn-core' const FeedWrapper = ({navigation, route}) => { return ( - + - + ) } diff --git a/social-feed/feedScreen/topicFeedScreenWrapper.tsx b/social-feed/feedScreen/topicFeedScreenWrapper.tsx index dfc67337..43ee810c 100644 --- a/social-feed/feedScreen/topicFeedScreenWrapper.tsx +++ b/social-feed/feedScreen/topicFeedScreenWrapper.tsx @@ -1,17 +1,17 @@ import React from 'react'; import { TopicFeed, - UniversalFeedContextProvider, + FeedContextProvider, } from '@likeminds.community/feed-rn-core'; import {CreatePostContextProvider} from '@likeminds.community/feed-rn-core/context/createPostContext'; const TopicFeedWrapper = ({navigation, route}) => { return ( - + - + ); }; diff --git a/social-feed/styles.ts b/social-feed/styles.ts index 7aa69bd1..774bd9e6 100644 --- a/social-feed/styles.ts +++ b/social-feed/styles.ts @@ -113,7 +113,7 @@ export const carouselScreenStyle = { }, }; -export const customUniversalFeedStyles = { +export const customFeedStyles = { newPostButtonStyle: { backgroundColor: '#007bff', padding: 10,