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, Dec 7, 12:34 PM
Unknown Object (File)
Sat, Dec 7, 12:34 PM
Unknown Object (File)
Sat, Dec 7, 12:32 PM
Unknown Object (File)
Sat, Dec 7, 12:21 PM
Unknown Object (File)
Wed, Dec 4, 8:47 PM
Unknown Object (File)
Nov 23 2024, 1:38 PM
Unknown Object (File)
Nov 23 2024, 1:37 PM
Unknown Object (File)
Nov 23 2024, 1:04 PM
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!