-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[native] Introduce
useNativeSetUserAvatar
and use throughout native
Summary: Basically D8339 but for `setUserAvatar` instead of `updateImageUserAvatar`. `setUserAvatar` in `*EditUserAvatarProvider` 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 `EditUserAvatarProvider` platform-agnostic, we introduce the `useNativeSetUserAvatar` hook. It wraps the platform-agnostic `setUserAvatar` with a `try/catch` which displays an alert on `native` if an exception is caught in the `catch` block. We replace usages of `setUserAvatar` on `native` with `nativeSetUserAvatar` (which is "created" via the hook). This removes the final usage of `displayFailureAlert` in `*EditUserAvatarProvider`, so I'll remove the prop altogether in the next diff (to avoid cluttering up this one). --- Depends on D8340 Test Plan: The modified flows continue to work as expected. When intentionally breaking the `update_user_avatar` endpoint, the alert continues to surface as expected. Reviewers: ashoat, ginsu, rohan Reviewed By: ashoat Subscribers: tomek Differential Revision: https://phab.comm.dev/D8341
- Loading branch information
1 parent
13c5d23
commit 1dae323
Showing
6 changed files
with
57 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters