diff options
author | Ivan Chen <ivan.if.chen@gmail.com> | 2021-05-13 17:59:29 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-13 17:59:29 -0400 |
commit | 1e948b556fd53c02d7462576b183cdd6c4c793bb (patch) | |
tree | cbfb5ca1678e48f1b3be0b7a1512ee33bab2ea91 /src/utils/users.ts | |
parent | 848afa989c2a0c324b65778dc05e03b7856f62c3 (diff) |
Revert "[TMA-844] Plus sign for profile and header in profile, ability to add on the sc…"
Diffstat (limited to 'src/utils/users.ts')
-rw-r--r-- | src/utils/users.ts | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/src/utils/users.ts b/src/utils/users.ts index 430c843f..334cb3c0 100644 --- a/src/utils/users.ts +++ b/src/utils/users.ts @@ -1,4 +1,3 @@ -import {Alert} from 'react-native'; import AsyncStorage from '@react-native-community/async-storage'; import {INTEGRATED_SOCIAL_LIST} from '../constants'; import {isUserBlocked, loadSocialPosts, removeBadgesService} from '../services'; @@ -25,8 +24,6 @@ import { UserType, UniversityBadge, } from './../types/types'; -import ImagePicker from 'react-native-image-crop-picker'; -import {patchEditProfile} from '../services'; const loadData = async (dispatch: AppDispatch, user: UserType) => { await Promise.all([ @@ -243,82 +240,3 @@ export const navigateToProfile = async ( screenType, }); }; - -export const patchProfile = async ( - title: 'profile' | 'header', - userId: string, -) => { - let imageSettings = {}; - let screenTitle: string; - let requestTitle: string; - let fileName: string; - switch (title) { - case 'header': - screenTitle = 'Select Header Picture'; - requestTitle = 'largeProfilePicture'; - fileName = 'large_profile_pic.jpg'; - imageSettings = { - smartAlbums: [ - 'Favorites', - 'RecentlyAdded', - 'SelfPortraits', - 'Screenshots', - 'UserLibrary', - ], - width: 580, - height: 580, - cropping: true, - cropperToolbarTitle: screenTitle, - mediaType: 'photo', - }; - break; - case 'profile': - screenTitle = 'Select Profile Picture'; - requestTitle = 'smallProfilePicture'; - fileName = 'small_profile_pic.jpg'; - imageSettings = { - smartAlbums: [ - 'Favorites', - 'RecentlyAdded', - 'SelfPortraits', - 'Screenshots', - 'UserLibrary', - ], - width: 580, - height: 580, - cropping: true, - cropperToolbarTitle: screenTitle, - mediaType: 'photo', - cropperCircleOverlay: true, - }; - break; - default: - screenTitle = ''; - requestTitle = ''; - fileName = ''; - } - - return await ImagePicker.openPicker(imageSettings) - .then((picture) => { - if ('path' in picture) { - const request = new FormData(); - request.append(requestTitle, { - uri: picture.path, - name: fileName, - type: 'image/jpg', - }); - - return patchEditProfile(request, userId) - .then((_) => { - return true; - }) - .catch((error) => { - Alert.alert(error); - return false; - }); - } - }) - .catch((_) => { - return false; - }); -}; |