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: added missing back buttons to settings pages #1387

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/legacy/app/container-imp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class AppContainer implements Container {

//This is an example of how to customize the screen layout and use custom header for wallets who wnat to hide default navigation header
//To hide navigation header for a specific page, use headerShown: false in the screen options like this
/*
/**
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this change? Left over from when you were thinking of moving this commented example?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided to leave the comment where it is as it doesn't make much sense in the default config either. My sonar cube plugin also flags this to be deleted but with /** it treats it as more than just a code block

this.container.registerInstance(TOKENS.OBJECT_SCREEN_CONFIG, {
...DefaultScreenOptionsDictionary,
[Screens.Terms]: {
Expand Down Expand Up @@ -51,7 +51,7 @@ export class AppContainer implements Container {
}

public resolve<K extends keyof TokenMapping>(token: K): TokenMapping[K] {
return this._container.resolve(token) as TokenMapping[K]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this change? It seems unrelated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've got a sonar cube plugin and flagged the casting as unnecessary

return this._container.resolve(token)
}
public resolveAll<K extends keyof TokenMapping, T extends K[]>(
tokens: [...T]
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy/core/App/container-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export class MainContainer implements Container {
}

public resolve<K extends keyof TokenMapping>(token: K): TokenMapping[K] {
return this._container.resolve(token) as TokenMapping[K]
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've got a sonar cube plugin and flagged the casting as unnecessary

return this._container.resolve(token)
}
public resolveAll<K extends keyof TokenMapping, T extends K[]>(
tokens: [...T]
Expand Down
6 changes: 6 additions & 0 deletions packages/legacy/core/App/navigators/OnboardingStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ const OnboardingStack: React.FC = () => {
return {
...ScreenOptionsDictionary[Screens.Onboarding],
title: t('Screens.Onboarding'),
headerLeft: () => false,
}
},
},
Expand All @@ -125,6 +126,7 @@ const OnboardingStack: React.FC = () => {
options: () => ({
...ScreenOptionsDictionary[Screens.Terms],
title: t('Screens.Terms'),
headerLeft: () => false,
}),
component: Terms,
},
Expand All @@ -135,13 +137,15 @@ const OnboardingStack: React.FC = () => {
options: () => ({
...ScreenOptionsDictionary[Screens.CreatePIN],
title: t('Screens.CreatePIN'),
headerLeft: () => false,
}),
},
{
name: Screens.NameWallet,
options: () => ({
...ScreenOptionsDictionary[Screens.NameWallet],
title: t('Screens.NameWallet'),
headerLeft: () => false,
}),
component: NameWallet,
},
Expand All @@ -150,6 +154,7 @@ const OnboardingStack: React.FC = () => {
options: () => ({
...ScreenOptionsDictionary[Screens.UseBiometry],
title: t('Screens.Biometry'),
headerLeft: () => false,
}),
component: useBiometry,
},
Expand All @@ -158,6 +163,7 @@ const OnboardingStack: React.FC = () => {
options: () => ({
...ScreenOptionsDictionary[Screens.UsePushNotifications],
title: t('Screens.UsePushNotifications'),
headerLeft: () => false,
}),
children: PushNotification as any,
},
Expand Down
16 changes: 1 addition & 15 deletions packages/legacy/core/App/navigators/SettingStack.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { createStackNavigator } from '@react-navigation/stack'
import React, { useEffect, useState } from 'react'
import React from 'react'
import { useTranslation } from 'react-i18next'
import { DeviceEventEmitter } from 'react-native'

import { EventTypes } from '../constants'
import { useTheme } from '../contexts/theme'
import HistorySettings from '../modules/history/ui/HistorySettings'
import DataRetention from '../screens/DataRetention'
Expand All @@ -25,7 +23,6 @@ import AutoLock from '../screens/AutoLock'
const SettingStack: React.FC = () => {
const Stack = createStackNavigator<SettingStackParams>()
const theme = useTheme()
const [biometryUpdatePending, setBiometryUpdatePending] = useState<boolean>(false)
const { t } = useTranslation()
const [pages, { screen: terms }, UseBiometry, developer, ScreenOptionsDictionary] = useServices([
TOKENS.SCREEN_ONBOARDING_PAGES,
Expand All @@ -38,16 +35,6 @@ const SettingStack: React.FC = () => {
const OnboardingTheme = theme.OnboardingTheme
const carousel = createCarouselStyle(OnboardingTheme)

useEffect(() => {
al-rosenthal marked this conversation as resolved.
Show resolved Hide resolved
const handleBiometry = DeviceEventEmitter.addListener(EventTypes.BIOMETRY_UPDATE, (value: boolean) => {
setBiometryUpdatePending(value)
})

return () => {
handleBiometry.remove()
}
}, [])

return (
<Stack.Navigator screenOptions={{ ...defaultStackOptions }}>
<Stack.Screen
Expand Down Expand Up @@ -109,7 +96,6 @@ const SettingStack: React.FC = () => {
component={UseBiometry}
options={{
title: t('Screens.Biometry'),
headerLeft: biometryUpdatePending ? () => null : undefined,
headerBackTestID: testIdWithKey('Back'),
...ScreenOptionsDictionary[Screens.UseBiometry],
}}
Expand Down
11 changes: 5 additions & 6 deletions packages/legacy/core/App/navigators/defaultStackOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,29 @@ export const DefaultScreenOptionsDictionary: ScreenOptionsType = {
[Screens.Onboarding]: {
headerTintColor: OnboardingTheme.headerTintColor,
gestureEnabled: false,
headerLeft: () => false,
},
[Screens.Terms]: {
headerTintColor: OnboardingTheme.headerTintColor,
headerLeft: () => false,
headerBackTestID: testIdWithKey('Back'),
},
[Screens.CreatePIN]: {
headerLeft: () => false,
headerBackTestID: testIdWithKey('Back'),
},
[Screens.NameWallet]: {
headerTintColor: OnboardingTheme.headerTintColor,
headerLeft: () => false,
headerBackTestID: testIdWithKey('Back'),
},
[Screens.UseBiometry]: {
headerTintColor: OnboardingTheme.headerTintColor,
headerLeft: () => false,
headerBackTestID: testIdWithKey('Back'),
},
[Screens.Developer]: {
headerTintColor: OnboardingTheme.headerTintColor,
headerBackTestID: testIdWithKey('Back'),
},
[Screens.UsePushNotifications]: {
headerTintColor: OnboardingTheme.headerTintColor,
headerLeft: () => false,
headerBackTestID: testIdWithKey('Back'),
},
}

Expand Down
5 changes: 1 addition & 4 deletions packages/legacy/core/App/screens/UseBiometry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import { CommonActions, useNavigation } from '@react-navigation/native'
import { StackNavigationProp } from '@react-navigation/stack'
import React, { useState, useEffect, useCallback, useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import { StyleSheet, Text, View, Modal, ScrollView, DeviceEventEmitter, Linking, Platform } from 'react-native'
import { StyleSheet, Text, View, Modal, ScrollView, Linking, Platform } from 'react-native'
al-rosenthal marked this conversation as resolved.
Show resolved Hide resolved
import { PERMISSIONS, RESULTS, request, check, PermissionStatus } from 'react-native-permissions'
import { SafeAreaView } from 'react-native-safe-area-context'

import Button, { ButtonType } from '../components/buttons/Button'
import ToggleButton from '../components/buttons/ToggleButton'
import { EventTypes } from '../constants'
import { useAnimatedComponents } from '../contexts/animated-components'
import { useAuth } from '../contexts/auth'
import { DispatchAction } from '../contexts/reducers/store'
Expand Down Expand Up @@ -153,7 +152,6 @@ const UseBiometry: React.FC = () => {
(newValue: boolean) => {
if (screenUsage === UseBiometryUsage.ToggleOnOff) {
setCanSeeCheckPIN(true)
DeviceEventEmitter.emit(EventTypes.BIOMETRY_UPDATE, true)
if (
historyEventsLogger.logToggleBiometry &&
store.onboarding.didAgreeToTerms &&
Expand Down Expand Up @@ -249,7 +247,6 @@ const UseBiometry: React.FC = () => {
if (status) {
setBiometryEnabled((previousState) => !previousState)
}
DeviceEventEmitter.emit(EventTypes.BIOMETRY_UPDATE, false)
if (
historyEventsLogger.logToggleBiometry &&
store.onboarding.didAgreeToTerms &&
Expand Down