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
- Display the system image picker so user can select image
- Process the selected image
- Upload the processed image
- 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