Page MenuHomePhabricator

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

Authored by atul on Aug 8 2023, 1:36 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Jan 5, 8:06 PM
Unknown Object (File)
Sun, Jan 5, 1:52 PM
Unknown Object (File)
Tue, Dec 31, 12:17 AM
Unknown Object (File)
Tue, Dec 31, 12:17 AM
Unknown Object (File)
Tue, Dec 31, 12:17 AM
Unknown Object (File)
Tue, Dec 31, 12:17 AM
Unknown Object (File)
Tue, Dec 31, 12:09 AM
Unknown Object (File)
Nov 23 2024, 11:44 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
master
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

native/avatars/avatar-hooks.js
313

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

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

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

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

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.