Page MenuHomePhabricator

[native] introduce use ens avatar option to edit avatar
AbandonedPublic

Authored by ginsu on Apr 17 2023, 12:33 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 8 2024, 11:57 PM
Unknown Object (File)
Feb 27 2024, 2:58 PM
Unknown Object (File)
Feb 27 2024, 2:58 PM
Unknown Object (File)
Feb 27 2024, 2:50 PM
Unknown Object (File)
Feb 21 2024, 10:42 AM
Unknown Object (File)
Feb 11 2024, 1:36 AM
Unknown Object (File)
Feb 8 2024, 12:40 PM
Unknown Object (File)
Feb 6 2024, 2:40 AM
Subscribers

Details

Reviewers
ashoat
atul
Summary

Add use ens avatar to the edit avatar action sheet. We only want to show this option if the user has a valid ens uri and they are trying to edit a user avatar

Depends on D7461 and D7458

Test Plan

I was able to update my avatar to ens and test everything rendered correctly by hardcoding '0x07124c3b6687e78aec8f13a2312cba72a0bed387' as my ethAddress and used other values like the provider from this gist

What the action sheet looks like on android:

Screenshot 2023-04-17 at 3.07.30 AM.png (1×978 px, 429 KB)

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

ashoat requested changes to this revision.Apr 17 2023, 5:11 AM
ashoat added inline comments.
native/components/edit-avatar.react.js
29–30

One potential alternative would be to explicitly limit children to being React.ComponentType<typeof UserAvatar> | React.ComponentType<typeof ThreadAvatar> here.

(Alternately, React.ComponentType<typeof UserAvatar | typeof ThreadAvatar> might work... not sure.)

Then you could introspect on the children you were passed at runtime by eg. checking children.name, which would obviate the need for childAvatarType.

Not sure how easily this will work or if it's worth it to do now.

42–60

It feels like this component has two sets of functionality now – saving thread avatars and saving user avatars.

How much code do the two workflows really share? If there's a substantial amount of shared code, is there a better way to share that code than to have them in the same component?

I suspect we probably don't need two separate components here, but could be wrong. Maybe we can discuss when you get into the office today?

This revision now requires changes to proceed.Apr 17 2023, 5:11 AM
native/components/edit-avatar.react.js
29–30

Great idea, tinkered with it locally and it is not difficult at all, will have an update for this out here shortly

42–60

How much code do the two workflows really share?

Up this point in the stack the two workflows don't have a ton to share outside of the action sheet and edit badge. However, the plan is to also have callbacks for onPressAvatarPhotoGalleryFlow and onPressAvatarCameraFlow in this component as well, and those will be directly used and shared by both workflows. When these callbacks get introduced I was also planning on introducing the necessary loaders for thread avatars like I did for user avatars in this diff. I just didn't do it yet because you can't set a thread avatar to an ENS avatar type.

Just like the EmojiAvatarCreation component I thought it would be the best design to have EditAvatar be a general purpose component for both user and thread avatars, but having it general purpose would mean being able to save a user and thread avatar.

Hopefully this gives you more context into my thinking, but happy to discuss more IRL or here if you think there is still a better way to design this.

Talked with this offline with @ginsu and we concluded that EditAvatar is being overloaded and doing two things instead of one. We concluded we're going to split this component and EmojiAvatarCreation into two components

D7546 makes this diff obsolete