Page MenuHomePhabricator

[native] Pull `displayFailureAlert` out of `EditUserAvatarProvider`
ClosedPublic

Authored by atul on Jun 14 2023, 11:31 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Sep 28, 6:17 PM
Unknown Object (File)
Wed, Sep 25, 7:23 PM
Unknown Object (File)
Sun, Sep 22, 8:38 PM
Unknown Object (File)
Mon, Sep 16, 2:52 AM
Unknown Object (File)
Mon, Sep 16, 2:52 AM
Unknown Object (File)
Mon, Sep 16, 2:51 AM
Unknown Object (File)
Mon, Sep 16, 2:41 AM
Unknown Object (File)
Aug 31 2024, 9:30 AM
Subscribers

Details

Summary

As part of making EditUserAvatarProvider "platform-agnostic" so it can be used across web and native, we're pulling displayFailureAlert (which uses react-native:Alert.alert(...)) out of EditUserAvatarProvider.

We will similarly need to pass selectFromGallery(...) and useUploadSelectedMedia as props to make EditUserAvatarProvider "fully" platform-agnostic.

Test Plan
  1. Killed keyserver to ensure update avatar request would fail
  2. Ensured that Alert was displayed on native as expected:

Simulator Screenshot - iPhone 14 Pro - 2023-06-14 at 14.16.51.png (2×1 px, 597 KB)

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

atul edited the summary of this revision. (Show Details)
atul requested review of this revision.Jun 14 2023, 11:53 AM

Code looks good, but pls see comment inline

native/root.react.js
74–80 ↗(On Diff #27778)

Personally not a fan of putting this logic in the root.react.js file, is there a utils file we could stick this in?

This revision is now accepted and ready to land.Jun 14 2023, 12:14 PM
native/root.react.js
74–80 ↗(On Diff #27778)

Ah yeah left a note in subsequent diff, but later in the stack once we move EditUserAvatarProvider to lib (as BaseEditUserAvatarProvider), we introduce a new NativeEditUserAvatarProvider component that handles passing platform-specific props to BaseEditUserAvatarProvider.

74–80 ↗(On Diff #27778)
native/root.react.js
74–80 ↗(On Diff #27778)

okay sweet thanks for considering that!