Page MenuHomePhabricator

[native] Introduce `useNativeSetThreadAvatar` and use throughout `native`
ClosedPublic

Authored by atul on Aug 8 2023, 1:36 AM.
Tags
None
Referenced Files
F3276640: D8757.diff
Sat, Nov 16, 7:33 AM
Unknown Object (File)
Fri, Nov 8, 11:34 AM
Unknown Object (File)
Sun, Oct 27, 10:32 AM
Unknown Object (File)
Sun, Oct 27, 10:32 AM
Unknown Object (File)
Sun, Oct 27, 10:32 AM
Unknown Object (File)
Sun, Oct 27, 10:31 AM
Unknown Object (File)
Sun, Oct 27, 10:13 AM
Unknown Object (File)
Sep 27 2024, 2:50 PM
Subscribers

Details

Summary

Thread equivalent of D8341

setThreadAvatar previously had a call to displayFailureAlert, however, this function is only relevant on native since we don't display alerts on web.

As part of making the provider platform-agnostic, we "lift up" error handling/alert displaying to avatar-hooks.

We replace usages of setThreadAvatar on native with nativeSetUserAvatar.

Test Plan

The modified flows on native continue to work as expected.

Diff Detail

Repository
rCOMM Comm
Branch
arcpatch-D8757 (branched from master)
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

native/avatars/avatar-hooks.js
313 ↗(On Diff #29610)

There should be a separate UpdateThreadAvatarRequest (which excludes ENS request). Will handle cleaning of avatar-types in a diff later in this stack.

atul requested review of this revision.Aug 8 2023, 1:54 AM

I don't think you should be swallowing the exception. If you disagree, can you please explain and then re-request review?

native/avatars/avatar-hooks.js
327 ↗(On Diff #29610)

In the old code, we would still throw an exception here. Is there a reason you're swalling it now instead?

native/chat/settings/emoji-thread-avatar-creation.react.js
44 ↗(On Diff #29610)

I think you'll end up displaying this "Avatar updated!" toast on failure because you're not re-throwing the exception you catch

This revision is now accepted and ready to land.Aug 8 2023, 7:12 AM
native/avatars/avatar-hooks.js
327 ↗(On Diff #29610)

No, the exception should be definitely be re-thrown. Thanks for catching that, I've had multiple promise/exception handling issues in this stack... will try to be more careful going forward.

native/chat/settings/emoji-thread-avatar-creation.react.js
44 ↗(On Diff #29610)

Yeah, the exception in nativeSetThreadAvatar should be re-thrown.

rethrow exception in useNativeSetThreadAvatar

This revision was landed with ongoing or failed builds.Aug 8 2023, 6:31 PM
This revision was automatically updated to reflect the committed changes.