Page MenuHomePhabricator

[native] introduce user avatar camera modal
ClosedPublic

Authored by ginsu on Apr 25 2023, 1:17 PM.
Tags
None
Referenced Files
F2146801: D7624.id25711.diff
Sun, Jun 30, 12:26 AM
Unknown Object (File)
Fri, Jun 28, 10:40 PM
Unknown Object (File)
Wed, Jun 26, 10:26 PM
Unknown Object (File)
Wed, Jun 26, 9:34 AM
Unknown Object (File)
Tue, Jun 25, 2:29 PM
Unknown Object (File)
Tue, Jun 18, 7:18 AM
Unknown Object (File)
Tue, Jun 18, 7:18 AM
Unknown Object (File)
Tue, Jun 18, 7:18 AM
Subscribers

Details

Summary

Introduce user avatar camera modal

Depends on D7676

Test Plan

Difficult to provide a demo video, but I was able to use my camera to take a photo and the photo i snapped was set as my avatar after hitting "send" in the camera modal. Also tested going back, and when I hit the "X" button it just goes back to the profile screen. I also double checked that the loading state was in sync with the edit user avatar provider

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ginsu edited the test plan for this revision. (Show Details)
ginsu added reviewers: ashoat, atul.
native/avatars/edit-user-avatar-provider.react.js
105–127 ↗(On Diff #25711)

shoot didn't realize how much copy + paste I was doing here. Will create another diff and put it in the stack before this diff and update this diff accordingly

ginsu published this revision for review.Apr 25 2023, 1:23 PM
ginsu planned changes to this revision.

Need to create a function to factor out code I commented above

ashoat requested changes to this revision.Apr 27 2023, 4:52 AM
ashoat added inline comments.
native/avatars/edit-user-avatar.react.js
50 ↗(On Diff #25752)

Can we use UserAvatarCameraModalRouteName here instead of copy-pasting the string? And can you make sure you haven't done this anywhere else?

native/media/user-avatar-camera-modal.react.js
25–30 ↗(On Diff #25752)

This useCallback is not necessary, and is only here because you typed BaseProps in CameraModal poorly.

You should be able to pass updateImageUserAvatar directly to CameraModal if you type handlePhotoCapture as (capture: PhotoCapture) => mixed. There's no reason that CameraModal needs to care about the return type there, so you should make the contract as "permissive" as possible, and let the function return anything it wants (mixed). That way it can return eg. a Promise without causing type errors.

This revision now requires changes to proceed.Apr 27 2023, 4:52 AM
native/avatars/edit-user-avatar.react.js
50 ↗(On Diff #25752)

Did a global search and couldn't find any other instances of this

This revision is now accepted and ready to land.Apr 27 2023, 1:30 PM
This revision was automatically updated to reflect the committed changes.