Page MenuHomePhabricator

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

Authored by atul on Jun 26 2023, 2:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 23, 2:22 PM
Unknown Object (File)
Sat, Nov 23, 2:08 PM
Unknown Object (File)
Sat, Nov 23, 2:08 PM
Unknown Object (File)
Sat, Nov 23, 1:14 PM
Unknown Object (File)
Sat, Nov 23, 7:07 AM
Unknown Object (File)
Wed, Nov 13, 5:19 AM
Unknown Object (File)
Sat, Nov 9, 3:39 AM
Unknown Object (File)
Fri, Nov 1, 4:10 AM
Subscribers

Details

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.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Later in the stack we will handle this from native/.../avatar-hooks.js instead.

Specifically we'll just throw an exception from the "platform-agnostic" provider, and surface the error to user in "platform-specific" way via avatar-hooks.react.js

atul published this revision for review.Jun 26 2023, 3:02 PM
This revision is now accepted and ready to land.Jun 26 2023, 4:10 PM
This revision was landed with ongoing or failed builds.Jun 27 2023, 8:30 AM
This revision was automatically updated to reflect the committed changes.