diff options
| author | Ivan Chen <ivan@thetaggid.com> | 2021-01-27 19:32:21 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-27 19:32:21 -0500 |
| commit | 19d2a861f260c02031d951f3d43bff8ac672146d (patch) | |
| tree | 253abceb267dfb75ac9118995886ff152c1ba74b /src/services | |
| parent | 60d3d97ad6913369762877a9dbfdaac0473deb28 (diff) | |
| parent | dc9556867dd44b706c43678d40802a335ff40658 (diff) | |
Merge pull request #203 from IvanIFChen/tma577-profile-slowness
[TMA-577] Profile Slowness
Diffstat (limited to 'src/services')
| -rw-r--r-- | src/services/CommonService.ts | 22 | ||||
| -rw-r--r-- | src/services/ExploreService.ts (renamed from src/services/ExploreServices.ts) | 1 | ||||
| -rw-r--r-- | src/services/MomentService.ts (renamed from src/services/MomentServices.ts) | 0 | ||||
| -rw-r--r-- | src/services/UserFriendsService.ts (renamed from src/services/UserFriendsServices.ts) | 0 | ||||
| -rw-r--r-- | src/services/index.ts | 7 |
5 files changed, 26 insertions, 4 deletions
diff --git a/src/services/CommonService.ts b/src/services/CommonService.ts new file mode 100644 index 00000000..4f9fb47a --- /dev/null +++ b/src/services/CommonService.ts @@ -0,0 +1,22 @@ +import RNFetchBlob from 'rn-fetch-blob'; + +export const loadImageFromURL = async (url: string) => { + try { + if (!url) { + return undefined; + } + const response = await RNFetchBlob.config({ + fileCache: true, + appendExt: 'jpg', + }).fetch('GET', url); + const status = response.info().status; + if (status === 200) { + return response.path(); + } else { + return undefined; + } + } catch (error) { + console.log(error); + return undefined; + } +}; diff --git a/src/services/ExploreServices.ts b/src/services/ExploreService.ts index ca4f1b69..980258be 100644 --- a/src/services/ExploreServices.ts +++ b/src/services/ExploreService.ts @@ -1,5 +1,4 @@ import AsyncStorage from '@react-native-community/async-storage'; -import {getDeviceToken} from 'react-native-device-info'; import {ALL_USERS_ENDPOINT, DISCOVER_ENDPOINT} from '../constants'; import {EMPTY_EXPLORE_SECTIONS} from '../store/initialStates'; import {ExploreSectionType, ProfilePreviewType} from '../types'; diff --git a/src/services/MomentServices.ts b/src/services/MomentService.ts index 0110a0d6..0110a0d6 100644 --- a/src/services/MomentServices.ts +++ b/src/services/MomentService.ts diff --git a/src/services/UserFriendsServices.ts b/src/services/UserFriendsService.ts index f2e15824..f2e15824 100644 --- a/src/services/UserFriendsServices.ts +++ b/src/services/UserFriendsService.ts diff --git a/src/services/index.ts b/src/services/index.ts index f558247f..9c168d4f 100644 --- a/src/services/index.ts +++ b/src/services/index.ts @@ -1,12 +1,13 @@ export * from './UserProfileService'; export * from './SocialLinkingService'; -export * from './MomentServices'; -export * from './ExploreServices'; -export * from './UserFriendsServices'; +export * from './MomentService'; +export * from './ExploreService'; +export * from './UserFriendsService'; export * from './ReportingService'; export * from './BlockUserService'; export * from './MomentCategoryService'; export * from './NotificationService'; export * from './FCMService'; export * from './WaitlistUserService'; +export * from './CommonService'; export * from './CommentService'; |
