Page MenuHomePhabricator

[native] Pull `useSelectAndUploadFromGallery` out of `Edit[User/Thread]Avatar`
ClosedPublic

Authored by atul on Apr 18 2023, 12:27 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 3, 2:57 AM
Unknown Object (File)
Thu, Oct 3, 2:56 AM
Unknown Object (File)
Thu, Oct 3, 2:56 AM
Unknown Object (File)
Thu, Oct 3, 2:51 AM
Unknown Object (File)
Wed, Oct 2, 9:07 PM
Unknown Object (File)
Tue, Sep 17, 9:13 PM
Unknown Object (File)
Tue, Sep 17, 9:25 AM
Unknown Object (File)
Mon, Sep 9, 5:58 AM
Subscribers

Details

Summary

Pull out common functionality from Edit[User/Thread]Avatar and move to newly introduced avatar-hooks.js.

Added entry to editAvatarOptions in both components to consume this hook.


Depends on D7497

Test Plan
  1. Click on pencil icon
  2. Ensure that the system media gallery appears as expected
  3. Ensure that the selection is processed as expected (logging + breakpoint)
  4. Ensure that selected image appears in keyserver uploads table:

1d60c3.png (1×3 px, 2 MB)

c40a6d.png (1×3 px, 1 MB)

Diff Detail

Repository
rCOMM Comm
Branch
master
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

atul published this revision for review.Apr 18 2023, 12:28 PM
atul edited the test plan for this revision. (Show Details)
atul added inline comments.
native/avatars/edit-user-avatar.react.js
25

For now useSelectAndUploadFromGallery just returns the function that launches that media gallery and processes + uploads the selection. In the future it'll probably also return some information about progress.

native/avatars/edit-thread-avatar.react.js
46–50

Here's how things looks on Android. I think we should use emote-smile for consistency for emoji

c8ad87.png (244×834 px, 26 KB)

Assuming this is a clean refactor so only skimmed it

native/avatars/edit-thread-avatar.react.js
46–50

What does emote-smile look like? Agree this doesn't look great

native/avatars/edit-user-avatar.react.js
25

Makes sense. Not sure if the "information about progress" will be returned by the call to useSelectAndUploadFromGallery() or the call to selectAndUploadFromGallery(), but I think the latter makes more sense since there's no progress to speak of in the former

41–52

Thank you for adding this!

This revision is now accepted and ready to land.Apr 18 2023, 1:14 PM
native/avatars/edit-thread-avatar.react.js
46–50

Have before and after in D7499