Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(profile): register new screens for settings, help, invite #5121

Merged
merged 31 commits into from
Mar 21, 2024

Conversation

finnian0826
Copy link
Contributor

@finnian0826 finnian0826 commented Mar 18, 2024

Description

Registers new screens and modifies headers so can navigate back.

Test plan

Unit tests updated.

Manual tests:

Feature gate false:

old.mp4

Feature gate true:

new.mp4

Related issues

Backwards compatibility

Network scalability

If a new NetworkId and/or Network are added in the future, the changes in this PR will:

  • N/A

@@ -435,7 +435,7 @@ export const Account = ({ navigation, route }: Props) => {
}

return (
<SafeAreaView style={styles.container}>
<SafeAreaView style={styles.container} edges={['bottom']}>
Copy link
Collaborator

@MuckT MuckT Mar 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does edges need to be conditional also?

Copy link

codecov bot commented Mar 18, 2024

Codecov Report

Attention: Patch coverage is 90.32258% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 85.69%. Comparing base (3bc5f91) to head (8e63bfc).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5121      +/-   ##
==========================================
+ Coverage   85.56%   85.69%   +0.12%     
==========================================
  Files         729      729              
  Lines       29823    29833      +10     
  Branches     5144     5154      +10     
==========================================
+ Hits        25519    25565      +46     
+ Misses       4068     4033      -35     
+ Partials      236      235       -1     
Files Coverage Δ
src/account/Settings.tsx 91.70% <100.00%> (+0.14%) ⬆️
src/account/Support.tsx 100.00% <100.00%> (ø)
src/backup/BackupQuiz.tsx 84.89% <100.00%> (+19.42%) ⬆️
src/keylessBackup/KeylessBackupProgress.tsx 99.20% <100.00%> (ø)
src/navigator/DrawerNavigator.tsx 93.89% <ø> (ø)
src/navigator/ProfileMenu.tsx 98.00% <100.00%> (+6.00%) ⬆️
src/navigator/Screens.tsx 100.00% <100.00%> (ø)
src/pincode/PincodeSet.tsx 94.69% <100.00%> (ø)
src/backup/BackupPhrase.tsx 87.32% <75.00%> (-0.18%) ⬇️
src/backup/BackupComplete.tsx 77.41% <33.33%> (ø)

... and 4 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3bc5f91...8e63bfc. Read the comment docs.

Copy link

emerge-tools bot commented Mar 18, 2024

1 build increased size

Name Version Download Change Install Change Approval
Celo (test)
org.celo.mobile.test
1.80.0 (145) 24.2 MB ⬆️ 893 B 60.4 MB ⬆️ 4.1 kB N/A

Celo (test) 1.80.0 (145)
org.celo.mobile.test

⚖️ Compare build
📦 Install build
⏱️ Analyze build performance

Total install size change: ⬆️ 4.1 kB
Total download size change: ⬆️ 893 B

Largest size changes

Item Install Size Change
main.jsbundle ⬆️ 4.1 kB

🛸 Powered by Emerge Tools

@finnian0826 finnian0826 marked this pull request as ready for review March 18, 2024 20:58
navigate(
getFeatureGate(StatsigFeatureGates.USE_TAB_NAVIGATOR)
? Screens.Settings
: Screens.SettingsDrawer,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this will lead to a crash if a feature gate changes when the app is backgrounded. Can you test the follow scenario?

  1. Have the feature on for your wallet, navigate to this screen (or any of the below screens)
  2. Background the app
  3. Change your wallet to be on the false variant and give a few mins for things to be updated
  4. Foreground the app and invoke the action to go to settings

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simulator Screenshot - iPhone 14 Pro - 2024-03-19 at 10 31 36
@satish-ravi you're right, I get this error when following this procedure to go back to settings. Is there a way to do navigate to make sure the screens are available, or should it just navigate home?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can navigate to Screens.DrawerNavigator with initial screen name as Screens.SettingsDrawer, there should be examples of others.

navigate(Screens.Settings, { promptConfirmRemovalModal: true })
navigate(
getFeatureGate(StatsigFeatureGates.USE_TAB_NAVIGATOR)
? Screens.Settings
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonder if we have to clear the stack before navigating to the new settings screen with back. Previously we landed back on the drawer and there was no way for the user to go back, but wonder if this opens up the possibility on landing on an inconsistent state in the app.

@@ -166,7 +166,7 @@ describe('Pincode', () => {
})

expect(updatePin).toHaveBeenCalledWith(mockAccount.toLowerCase(), oldPin, mockPin)
expect(navigate).toBeCalledWith(Screens.Settings)
expect(navigate).toBeCalledWith(Screens.SettingsDrawer)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to switch any test that checks settings navigation to run against the true variant (or test both scenarios). Might also be worth wrapping navigating to settings into a helper function given my comments above. I don't think it will be as simple as navigating one or the other screen

src/account/Support.tsx Outdated Show resolved Hide resolved
@@ -231,6 +231,12 @@ export function navigateHome(fromModal?: boolean) {
}, timeout)
}

export function navigateToSettings(promptConfirmRemovalModal: boolean) {
getFeatureGate(StatsigFeatureGates.USE_TAB_NAVIGATOR)
? navigateClearingStack(Screens.Settings, { promptConfirmRemovalModal })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually would the user get stuck on the settings screen here? this would reset settings to the first screen. wonder if we should just navigate home, although not sure if it will break stuff. Maybe good to check in with product as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I was thinking of just navigating to home, I'll check with product and see

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I synced with Laura on this and we don't want to navigate home instead of settings in most places. Seems like there's only a handful of places where we navigate to settings. So let's do this:

  • change keyless backup progress screen to navigate home instead of settings (as the flow can start from either settings or notifications screen)
  • to solve the edge case of feature gate changing when the user is on the Settings screen and backgrounded, I think we can get away with using the same screen enum. If we do that, then the version of settings screen that the flow started with will already be on the stack, so any navigate(Screen.Settings) would just pop back to that screen, instead of adding the new version of the screen to the stack. This should work as long as there is no flow that starts from somewhere else in the app and ends in settings, which I believe is only the keyless backup progress screen which we've addressed above.

<Navigator.Screen
name={Screens.Settings}
component={SettingsScreen}
options={isTabNav ? headerWithBackButton : noHeader}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we just register the back button always? I think this version of the screen should only be used in the tab navigator anyway. The screens I believe are registered at startup and won't be refreshed if the gate changes when app is backgrounded.

Copy link
Collaborator

@MuckT MuckT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@finnian0826 Thanks for working to getting this across the finish line! 🚀

return navigatedFromSettings ? (
<CancelButton onCancel={onCancel} style={styles.cancelButton} />
return settingsScreen ? (
<CancelButton onCancel={() => navigateHome()} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably fine to go home here but the settingsScreen param now allows us to retain existing behavior right? We can navigate similar to what is done in BackupComplete?

Comment on lines 422 to 424
cancelButton: {
color: colors.gray4,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question as above

return (
<SafeAreaView style={styles.container}>
<CustomHeader
style={{ paddingHorizontal: variables.contentPadding }}
left={
navigatedFromSettings ? (
<CancelButton style={styles.cancelButton} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like this was just navigating back previously ? could we retain the same behavior here?

Comment on lines 197 to 199
cancelButton: {
color: colors.gray4,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason to remove this styling?

const backupCompleted = useSelector(backupCompletedSelector)
const { t } = useTranslation()

useEffect(() => {
const timer = setTimeout(() => {
if (navigatedFromSettings) {
navigate(Screens.Settings, { promptConfirmRemovalModal: true })
if (settingsScreen) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be worth leaving a cleanup comment here. I liked your naming on isAccountRemoval, maybe we can do that when we clean the drawer ? Should be also fine to just describe this in the linear issue @MuckT created.

@finnian0826 finnian0826 added this pull request to the merge queue Mar 20, 2024
Merged via the queue into main with commit dde91eb Mar 21, 2024
16 checks passed
@finnian0826 finnian0826 deleted the finnian0826/settings-help-invite branch March 21, 2024 00:14
github-merge-queue bot pushed a commit that referenced this pull request Apr 26, 2024
### Description

Reverts changes done in #5121 , can just pass a boolean to the that
there's a single Settings screen

### Test plan

CI, manually trying reset

### Related issues

- Part of ACT-1133

### Backwards compatibility

Yes

### Network scalability

N/A
shottah pushed a commit to zed-io/kolektivo that referenced this pull request May 15, 2024
…-inc#5121)

### Description

Registers new screens and modifies headers so can navigate back.

### Test plan

Unit tests updated.

**Manual tests:**

Feature gate false:


https://github.com/valora-inc/wallet/assets/140328381/74b676ea-334a-4c49-ae17-f868ac98b776


Feature gate true:


https://github.com/valora-inc/wallet/assets/140328381/91ded2a7-d54f-43a8-8f65-a33ac8a3fbaf


### Related issues

- Fixes ACT-1132

### Backwards compatibility

<!-- Brief explanation of why these changes are/are not backwards
compatible. -->

### Network scalability

If a new NetworkId and/or Network are added in the future, the changes
in this PR will:

- N/A

---------

Co-authored-by: Tom McGuire <Mcgtom10@gmail.com>
Co-authored-by: Satish Ravi <satish.ravi@valoraapp.com>
shottah pushed a commit to zed-io/kolektivo that referenced this pull request May 15, 2024
…inc#5336)

### Description

Reverts changes done in valora-inc#5121 , can just pass a boolean to the that
there's a single Settings screen

### Test plan

CI, manually trying reset

### Related issues

- Part of ACT-1133

### Backwards compatibility

Yes

### Network scalability

N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants