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, Oct 26, 1:02 AM
Unknown Object (File)
Tue, Oct 22, 12:54 PM
Unknown Object (File)
Tue, Oct 22, 12:54 PM
Unknown Object (File)
Tue, Oct 22, 12:53 PM
Unknown Object (File)
Tue, Oct 22, 5:02 AM
Unknown Object (File)
Thu, Oct 17, 9:00 PM
Unknown Object (File)
Oct 13 2024, 10:05 AM
Unknown Object (File)
Oct 13 2024, 9:15 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!