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)
Tue, Nov 5, 2:10 AM
Unknown Object (File)
Oct 6 2024, 6:22 PM
Unknown Object (File)
Oct 6 2024, 6:22 PM
Unknown Object (File)
Oct 6 2024, 4:34 PM
Unknown Object (File)
Oct 3 2024, 2:57 AM
Unknown Object (File)
Oct 3 2024, 2:56 AM
Unknown Object (File)
Oct 3 2024, 2:56 AM
Unknown Object (File)
Oct 3 2024, 2:51 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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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 ↗(On Diff #25298)

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 ↗(On Diff #25298)

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 ↗(On Diff #25298)

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

native/avatars/edit-user-avatar.react.js
25 ↗(On Diff #25298)

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 ↗(On Diff #25298)

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 ↗(On Diff #25298)

Have before and after in D7499