diff options
author | Shravya Ramesh <shravs1208@gmail.com> | 2021-04-09 14:37:06 -0700 |
---|---|---|
committer | Shravya Ramesh <shravs1208@gmail.com> | 2021-04-09 14:37:06 -0700 |
commit | 45041863a432ed5ba02f896f0c4f3c23ae7830ed (patch) | |
tree | 1b025124211aaade2d0660eed518ca5a20443e20 | |
parent | bdd1ed17600da7b766e2b0fa97ad4cbf01234819 (diff) |
removed chat client inside userlogin
-rw-r--r-- | src/components/profile/Content.tsx | 2 | ||||
-rw-r--r-- | src/screens/onboarding/CategorySelection.tsx | 2 | ||||
-rw-r--r-- | src/screens/onboarding/InvitationCodeVerification.tsx | 2 | ||||
-rw-r--r-- | src/store/reducers/userReducer.ts | 5 | ||||
-rw-r--r-- | src/utils/users.ts | 10 |
5 files changed, 5 insertions, 16 deletions
diff --git a/src/components/profile/Content.tsx b/src/components/profile/Content.tsx index 0d2a0331..0052b61d 100644 --- a/src/components/profile/Content.tsx +++ b/src/components/profile/Content.tsx @@ -84,7 +84,7 @@ const Content: React.FC<ContentProps> = ({userXId, screenType}) => { const refrestState = async () => { setRefreshing(true); if (!userXId) { - await userLogin(dispatch, loggedInUser, chatClient); + await userLogin(dispatch, loggedInUser); } else { await fetchUserX(dispatch, user, screenType); } diff --git a/src/screens/onboarding/CategorySelection.tsx b/src/screens/onboarding/CategorySelection.tsx index 1407575c..ab5ff3be 100644 --- a/src/screens/onboarding/CategorySelection.tsx +++ b/src/screens/onboarding/CategorySelection.tsx @@ -170,7 +170,7 @@ const CategorySelection: React.FC<CategorySelectionProps> = ({ dispatch(updateIsOnboardedUser(true)); const token = await getTokenOrLogout(dispatch); await postMomentCategories(selectedCategories, token); - userLogin(dispatch, {userId: userId, username: username}, chatClient); + userLogin(dispatch, {userId: userId, username: username}); } else { dispatch( updateMomentCategories( diff --git a/src/screens/onboarding/InvitationCodeVerification.tsx b/src/screens/onboarding/InvitationCodeVerification.tsx index 774a7a11..6bc0ac9d 100644 --- a/src/screens/onboarding/InvitationCodeVerification.tsx +++ b/src/screens/onboarding/InvitationCodeVerification.tsx @@ -79,7 +79,7 @@ const InvitationCodeVerification: React.FC<InvitationCodeVerificationProps> = ({ const username = route.params.username; await AsyncStorage.setItem('userId', userId); await AsyncStorage.setItem('username', username); - userLogin(dispatch, {userId, username}, chatClient); + userLogin(dispatch, {userId, username}); } else { Alert.alert(ERROR_INVALID_INVITATION_CODE); } diff --git a/src/store/reducers/userReducer.ts b/src/store/reducers/userReducer.ts index 0b958cac..a8789c1d 100644 --- a/src/store/reducers/userReducer.ts +++ b/src/store/reducers/userReducer.ts @@ -75,9 +75,6 @@ const userDataSlice = createSlice({ state.avatar = ''; state.cover = ''; }, - setChatClientReady: (state, action) => { - state.chatClientReady = action.payload.chatClientReady; - }, }, }); @@ -93,6 +90,6 @@ export const { setReplyPosted, setSuggestedPeopleImage, clearHeaderAndProfileImages, - setChatClientReady, + // setChatClientReady, } = userDataSlice.actions; export const userDataReducer = userDataSlice.reducer; diff --git a/src/utils/users.ts b/src/utils/users.ts index ec09198d..7148eb79 100644 --- a/src/utils/users.ts +++ b/src/utils/users.ts @@ -22,7 +22,6 @@ import { ScreenType, UserType, } from './../types/types'; -import {connectChatAccount} from './messages'; const loadData = async (dispatch: AppDispatch, user: UserType) => { await Promise.all([ @@ -43,11 +42,7 @@ const loadData = async (dispatch: AppDispatch, user: UserType) => { * @param dispatch This is the dispatch object from the redux store * @param user The user if at all any */ -export const userLogin = async ( - dispatch: AppDispatch, - user: UserType, - chatClient?, -) => { +export const userLogin = async (dispatch: AppDispatch, user: UserType) => { try { let localUser = {...user}; if (!user.userId) { @@ -67,9 +62,6 @@ export const userLogin = async ( AsyncStorage.setItem('username', user.username), ]); } - if (chatClient) { - connectChatAccount(localUser.userId, chatClient, dispatch); - } await loadData(dispatch, localUser); } catch (error) { console.log(error); |