HomePhabricator
Diffusion Comm a6e4615a5521

[native] Introduce naive `useSelectFromGalleryAndUpdateThreadAvatar` hook

Description

[native] Introduce naive useSelectFromGalleryAndUpdateThreadAvatar hook

Summary:

NOTE: This is largely copy/pasted from D7510. Putting this up so we can avoid using useSelectFromGalleryAndUpdateUserAvatar in EditThreadAvatar (as we're doing in D7510) and to potentially unblock @ginsu's camera work. I'm totally aware there's duplicated code between useSelectFromGalleryAndUpdateUserAvatar and useSelectFromGalleryAndUpdateThreadAvatar. I'm currently working on error handling/displaying status+progress with useSelectFromGalleryAndUpdateUserAvatar. Once I'm done with that I'll take another look to see what functionality can be consolidated between useSelectFromGalleryAndUpdateUserAvatar and useSelectFromGalleryAndUpdateThreadAvatar.

This hook composes together the previously created image avatar-related hooks (eg useProcessSelectedMedia, useUploadProcessedMedia, etc) to

  1. Display the system image picker so user can select image
  2. Process the selected image
  3. Upload the processed image
  4. Update the thread avatar with the threadID of the thread and uploadID of the uploaded processed image.

There's still work to be done in terms of displaying status/progress, handling erorrs, etc... but this diff gets things working "end to end." Putting it up now to unblock @ginsu's camera work.


Depends on D7510

Test Plan: Able to successfully set image avatar for thread:

Reviewers: ashoat, ginsu

Reviewed By: ashoat

Subscribers: tomek, ginsu

Differential Revision: https://phab.comm.dev/D7511

Details