diff options
author | Ivan Chen <ivan@thetaggid.com> | 2021-02-01 12:24:45 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-01 12:24:45 -0500 |
commit | 7a09cc96bf1fe468a612bb44362bbef24fccc773 (patch) | |
tree | f2d65dddf647729c08878db0dfb6a80892bf7d69 | |
parent | b7509400433169e698450e4a7667d268439dcf41 (diff) | |
parent | 85c9a80e8867ff5303bfcc49b79b8bc5f25a2f61 (diff) |
Merge pull request #210 from ashmgarv/hotfixes
[HOTFIX] Fix for chaching and comments notification navigation
-rw-r--r-- | src/components/notifications/Notification.tsx | 13 | ||||
-rw-r--r-- | src/services/MomentService.ts | 2 | ||||
-rw-r--r-- | src/store/actions/userX.ts | 81 | ||||
-rw-r--r-- | src/types/types.ts | 8 |
4 files changed, 3 insertions, 101 deletions
diff --git a/src/components/notifications/Notification.tsx b/src/components/notifications/Notification.tsx index a3d1080b..e0ae231e 100644 --- a/src/components/notifications/Notification.tsx +++ b/src/components/notifications/Notification.tsx @@ -2,7 +2,7 @@ import {useNavigation} from '@react-navigation/native'; import React, {useEffect, useState} from 'react'; import {Alert, Image, StyleSheet, Text, View} from 'react-native'; import {TouchableWithoutFeedback} from 'react-native-gesture-handler'; -import {useDispatch, useSelector, useStore} from 'react-redux'; +import {useDispatch, useStore} from 'react-redux'; import {ERROR_DELETED_OBJECT} from '../../constants/strings'; import { loadImageFromURL, @@ -13,12 +13,9 @@ import { acceptFriendRequest, declineFriendRequest, loadUserNotifications, - loadUserX, - loadUserXSpecifics, updateReplyPosted, updateUserXFriends, } from '../../store/actions'; -import {NO_MOMENTS} from '../../store/initialStates'; import {RootState} from '../../store/rootReducer'; import {MomentType, NotificationType, ScreenType} from '../../types'; import { @@ -68,13 +65,7 @@ const Notification: React.FC<NotificationProps> = (props) => { useEffect(() => { if (onTapLoadProfile) { - dispatch( - loadUserXSpecifics( - {userId: id, username: username}, - ['Profile', 'Moments'], - screenType, - ), - ); + fetchUserX(dispatch, {userId: id, username: username}, screenType); } return () => { setOnTapLoadProfile(false); diff --git a/src/services/MomentService.ts b/src/services/MomentService.ts index 0110a0d6..2354d18e 100644 --- a/src/services/MomentService.ts +++ b/src/services/MomentService.ts @@ -100,7 +100,7 @@ export const loadMomentThumbnail = async (momentId: string) => { try { const token = await AsyncStorage.getItem('token'); const response = await RNFetchBlob.config({ - fileCache: true, + fileCache: false, appendExt: 'jpg', }).fetch('GET', MOMENT_THUMBNAIL_ENDPOINT + `${momentId}/`, { Authorization: 'Token ' + token, diff --git a/src/store/actions/userX.ts b/src/store/actions/userX.ts index af8188f1..07bea678 100644 --- a/src/store/actions/userX.ts +++ b/src/store/actions/userX.ts @@ -1,4 +1,3 @@ -import {UserXSpecifics} from './../../types/types'; import {userXInStore} from './../../utils/'; import {getTokenOrLogout, loadAllSocialsForUser} from './../../utils'; import {UserType, ScreenType} from '../../types/types'; @@ -86,86 +85,6 @@ export const loadUserX = ( } }; -export const loadUserXSpecifics = ( - user: UserType, - specifics: UserXSpecifics[], - screenType: ScreenType, -): ThunkAction<Promise<void>, RootState, unknown, Action<string>> => async ( - dispatch, -) => { - const {userId} = user; - await dispatch({type: userXRequested.type, payload: {screenType, userId}}); - await dispatch({ - type: userXUserFetched.type, - payload: {screenType, userId, user}, - }); - const token = await getTokenOrLogout(dispatch); - for (let specific of specifics) { - switch (specific) { - case 'Profile': - console.log(specific); - loadProfileInfo(token, userId).then((data) => { - dispatch({ - type: userXProfileFetched.type, - payload: {screenType, userId, data}, - }); - }); - break; - case 'Socials': - loadAllSocialsForUser(userId).then((data) => - dispatch({ - type: userXSocialsFetched.type, - payload: {screenType, userId, data}, - }), - ); - break; - case 'Avatar': - loadAvatar(userId, false).then((data) => - dispatch({ - type: userXAvatarFetched.type, - payload: {screenType, userId, data}, - }), - ); - break; - case 'Cover': - loadCover(token, userId).then((data) => - dispatch({ - type: userXCoverFetched.type, - payload: {screenType, userId, data}, - }), - ); - break; - case 'Friends': - loadFriends(userId, token).then((data) => - dispatch({ - type: userXFriendsFetched.type, - payload: {screenType, userId, data}, - }), - ); - break; - case 'Moments': - console.log(specific); - loadMoments(userId, token).then((data) => - dispatch({ - type: userXMomentsFetched.type, - payload: {screenType, userId, data}, - }), - ); - break; - case 'MomentCategories': - loadMomentCategories(userId, token).then((data) => { - dispatch({ - type: userXMomentCategoriesFetched.type, - payload: {screenType, userId, data}, - }); - }); - break; - default: - break; - } - } -}; - export const updateUserXFriends = ( userId: string, state: RootState, diff --git a/src/types/types.ts b/src/types/types.ts index e9abc789..1775cd5f 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -186,11 +186,3 @@ export type NotificationType = { }; export type TypeOfComment = 'Comment' | 'Thread'; -export type UserXSpecifics = - | 'Profile' - | 'Socials' - | 'Avatar' - | 'Cover' - | 'Friends' - | 'Moments' - | 'MomentCategories'; |