HomePhabricator
Diffusion Comm 2dabda2b573f

[lib] Make `displayFailureAlert` optional in `BaseEditUserAvatar`

Description

[lib] Make displayFailureAlert optional in BaseEditUserAvatar

Summary:
displayFailureAlert is native-specific functionality which we won't implement for web.

We previously had an implementation using alert(...), but showing a browser alert was not consistent with the rest of web's error handling. It makes sense to have displayFailureAlert be optional and only implement it for native. Later in the stack we will handle this from native/.../avatar-hooks.js instead.

NOTE: The higher level goal with this (and subsequent) refactor(s) is for [web/native]/.../avatar-hooks.react.js to be platform-specific and entity(user vs. thread)-agnostic AND for edit-*-avatar-provider.react.js to be platform-agnostic and entity-specific. Right now there's some coupling between the two that makes implementation of image avatars on web pretty difficult... will work on cleaning things up in this stack. TLDR: avatar providers will be common interface between client and keyserver and avatar hooks will be platform-specific implementations to get things from platform-specific types (eg MediaLibrarySelection) to platform-agnostic types (eg UpdateUserAvatarRequest) so they can be passed to API provided by providers.

Depends on D8315

Test Plan: Alerts continue to appear as expected on native. Alerts continue NOT to appear on web as expected.

Reviewers: ashoat, ginsu, rohan

Reviewed By: ginsu

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D8316

Details

Provenance
atulAuthored on Jun 27 2023, 8:23 AM
Reviewer
ginsu
Differential Revision
D8316: [lib] Make `displayFailureAlert` optional in `BaseEditUserAvatar`
Parents
rCOMM9bfaa6dc2a89: [web] Update button label after successful copy
Branches
Unknown
Tags
Unknown