diff --git a/native/avatars/edit-user-avatar-provider.react.js b/native/avatars/edit-user-avatar-provider.react.js --- a/native/avatars/edit-user-avatar-provider.react.js +++ b/native/avatars/edit-user-avatar-provider.react.js @@ -7,15 +7,20 @@ updateUserAvatarActionTypes, } from 'lib/actions/user-actions.js'; import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; -import type { UpdateUserAvatarRequest } from 'lib/types/avatar-types.js'; +import type { + ImageAvatarDBContent, + UpdateUserAvatarRequest, +} from 'lib/types/avatar-types.js'; import type { LoadingStatus } from 'lib/types/loading-types.js'; -import type { NativeMediaSelection } from 'lib/types/media-types.js'; +import type { + MediaLibrarySelection, + NativeMediaSelection, +} from 'lib/types/media-types.js'; import { useDispatchActionPromise, useServerCall, } from 'lib/utils/action-utils.js'; -import { selectFromGallery, useUploadSelectedMedia } from './avatar-hooks.js'; import { useSelector } from '../redux/redux-utils.js'; export type UserAvatarSelection = @@ -47,10 +52,19 @@ type Props = { +displayFailureAlert: () => mixed, + +selectFromGallery: () => Promise, + +useUploadSelectedMedia: ( + setProcessingOrUploadInProgress?: (inProgress: boolean) => mixed, + ) => (selection: NativeMediaSelection) => Promise, +children: React.Node, }; function EditUserAvatarProvider(props: Props): React.Node { - const { displayFailureAlert, children } = props; + const { + displayFailureAlert, + selectFromGallery, + useUploadSelectedMedia, + children, + } = props; const registrationModeRef = React.useRef(registrationModeOff); @@ -114,7 +128,7 @@ return; } await updateImageUserAvatar(selection); - }, [updateImageUserAvatar]); + }, [selectFromGallery, updateImageUserAvatar]); const setUserAvatar = React.useCallback( async (request: UpdateUserAvatarRequest) => { diff --git a/native/root.react.js b/native/root.react.js --- a/native/root.react.js +++ b/native/root.react.js @@ -23,6 +23,10 @@ import { actionLogger } from 'lib/utils/action-logger.js'; import { RegistrationContextProvider } from './account/registration/registration-context-provider.react.js'; +import { + selectFromGallery, + useUploadSelectedMedia, +} from './avatars/avatar-hooks.js'; import { EditThreadAvatarProvider } from './avatars/edit-thread-avatar-provider.react.js'; import { EditUserAvatarProvider } from './avatars/edit-user-avatar-provider.react.js'; import ChatContextProvider from './chat/chat-context-provider.react.js'; @@ -273,6 +277,8 @@