Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(suite-native): new onboarding stack initialized
Browse files Browse the repository at this point in the history
PeKne committed Jan 14, 2025
1 parent 8ae9d90 commit 472192b
Showing 11 changed files with 265 additions and 175 deletions.
159 changes: 40 additions & 119 deletions suite-native/app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./libDev"
},
"compilerOptions": { "outDir": "./libDev" },
"references": [
{
"path": "../../suite-common/analytics"
@@ -31,126 +29,52 @@
{
"path": "../../suite-common/wallet-types"
},
{
"path": "../accounts"
},
{
"path": "../alerts"
},
{
"path": "../analytics"
},
{
"path": "../atoms"
},
{
"path": "../biometrics"
},
{
"path": "../coin-enabling"
},
{
"path": "../config"
},
{
"path": "../connection-status"
},
{
"path": "../device"
},
{
"path": "../device-authorization"
},
{
"path": "../discovery"
},
{
"path": "../icons"
},
{
"path": "../intl"
},
{
"path": "../message-system"
},
{
"path": "../module-accounts-import"
},
{ "path": "../accounts" },
{ "path": "../alerts" },
{ "path": "../analytics" },
{ "path": "../atoms" },
{ "path": "../biometrics" },
{ "path": "../coin-enabling" },
{ "path": "../config" },
{ "path": "../connection-status" },
{ "path": "../device" },
{ "path": "../device-authorization" },
{ "path": "../discovery" },
{ "path": "../icons" },
{ "path": "../intl" },
{ "path": "../message-system" },
{ "path": "../module-accounts-import" },
{
"path": "../module-accounts-management"
},
{
"path": "../module-add-accounts"
},
{
"path": "../module-authorize-device"
},
{
"path": "../module-connect-popup"
},
{
"path": "../module-dev-utils"
},
{
"path": "../module-device-settings"
},
{
"path": "../module-home"
},
{
"path": "../module-onboarding"
},
{
"path": "../module-onboarding-legacy"
},
{
"path": "../module-send"
},
{
"path": "../module-settings"
},
{ "path": "../module-add-accounts" },
{ "path": "../module-authorize-device" },
{ "path": "../module-connect-popup" },
{ "path": "../module-dev-utils" },
{ "path": "../module-device-settings" },
{ "path": "../module-home" },
{ "path": "../module-onboarding" },
{ "path": "../module-onboarding-legacy" },
{ "path": "../module-send" },
{ "path": "../module-settings" },
{
"path": "../module-staking-management"
},
{
"path": "../navigation"
},
{
"path": "../notifications"
},
{
"path": "../receive"
},
{
"path": "../settings"
},
{
"path": "../state"
},
{
"path": "../storage"
},
{
"path": "../theme"
},
{
"path": "../toasts"
},
{
"path": "../transactions"
},
{
"path": "../../packages/connect"
},
{ "path": "../navigation" },
{ "path": "../notifications" },
{ "path": "../receive" },
{ "path": "../settings" },
{ "path": "../state" },
{ "path": "../storage" },
{ "path": "../theme" },
{ "path": "../toasts" },
{ "path": "../transactions" },
{ "path": "../../packages/connect" },
{
"path": "../../packages/react-native-usb"
},
{
"path": "../../packages/styles"
},
{
"path": "../../packages/theme"
},
{ "path": "../../packages/styles" },
{ "path": "../../packages/theme" },
{
"path": "../../packages/trezor-user-env-link"
},
@@ -161,8 +85,5 @@
"path": "../../packages/connect-mobile"
}
],
"include": [
".",
"**.json"
]
}
"include": [".", "**.json"]
}
7 changes: 6 additions & 1 deletion suite-native/intl/src/en.ts
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@

export const en = {
generic: {
trezorSuite: 'Trezor Suite',
header: '<green>Trezor Suite</green> <grey>Lite</grey>',
buttons: {
back: 'Back',
@@ -763,8 +764,12 @@ export const en = {
},
moduleOnboarding: {
welcomeScreen: {
subtitle: 'Take control.',
button: "Let's get started",

// TODO: this should be removed when is the new onboarding enabled by default
welcome: 'Welcome to',
subtitle: 'Securely track, manage & receive\ncrypto on the go',
subtitleLegacy: 'Securely track, manage & receive\ncrypto on the go',
trezorLink: 'Don’t have a Trezor? <trezorLink>Get one here.</trezorLink>',
nextButton: 'Get started',
},
1 change: 1 addition & 0 deletions suite-native/module-dev-utils/package.json
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@
},
"dependencies": {
"@mobily/ts-belt": "^3.13.1",
"@react-navigation/native": "6.1.18",
"@react-navigation/native-stack": "6.11.0",
"@sentry/react-native": "6.5.0",
"@suite-common/message-system": "workspace:*",
115 changes: 70 additions & 45 deletions suite-native/module-dev-utils/src/screens/DevUtilsScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import { Alert } from 'react-native';

import { useNavigation } from '@react-navigation/native';
import * as Sentry from '@sentry/react-native';

import { getEnv, isDevelopOrDebugEnv } from '@suite-native/config';
import { Button, Card, VStack, TitleHeader } from '@suite-native/atoms';
import {
Screen,
StackProps,
DevUtilsStackParamList,
DevUtilsStackRoutes,
ScreenSubHeader,
RootStackRoutes,
StackToStackCompositeNavigationProps,
RootStackParamList,
OnboardingStackRoutes,
} from '@suite-native/navigation';
import { clearStorage } from '@suite-native/storage';
import { getCommitHash, getSuiteVersion } from '@trezor/env-utils';
@@ -20,48 +24,69 @@ import { TestnetsToggle } from '../components/TestnetsToggle';
import { DevicePassphraseSwitch } from '../components/DevicePassphraseSwitch';
import { MessageSystemInfo } from '../components/MessageSystemInfo';

export const DevUtilsScreen = ({
navigation,
}: StackProps<DevUtilsStackParamList, DevUtilsStackRoutes.DevUtils>) => (
<Screen screenHeader={<ScreenSubHeader content="DEV utils" />}>
<VStack spacing="sp16">
<Card>
<VStack spacing="sp16">
<TitleHeader
title="Build version"
subtitle={`${getEnv()}-${getSuiteVersion()}, commit ${getCommitHash() || 'N/A in debug build'}`}
/>
{isDevelopOrDebugEnv() && (
<Button onPress={() => navigation.navigate(DevUtilsStackRoutes.Demo)}>
See Component Demo
</Button>
)}
<FeatureFlags />
{isDevelopOrDebugEnv() && (
<>
<RenderingUtils />
<DevicePassphraseSwitch />
</>
)}
type NavigationProps = StackToStackCompositeNavigationProps<
DevUtilsStackParamList,
DevUtilsStackRoutes.DevUtils,
RootStackParamList
>;

export const DevUtilsScreen = () => {
const navigation = useNavigation<NavigationProps>();

const navigateToNewWelcomeFlow = () =>
navigation.navigate(RootStackRoutes.Onboarding, {
screen: OnboardingStackRoutes.Welcome,
});

<Button
onPress={() => {
const errorMessage = `Sentry test error - ${Date.now()}`;
Sentry.captureException(new Error(errorMessage));
Alert.alert('Sentry error thrown', errorMessage);
}}
>
Throw Sentry error
</Button>
<Button colorScheme="redElevation0" onPress={clearStorage}>
Wipe all data
</Button>
</VStack>
</Card>
<Card>
<TestnetsToggle />
</Card>
<MessageSystemInfo />
</VStack>
</Screen>
);
return (
<Screen screenHeader={<ScreenSubHeader content="DEV utils" />}>
<VStack spacing="sp16">
<Card>
<VStack spacing="sp16">
<TitleHeader
title="Build version"
subtitle={`${getEnv()}-${getSuiteVersion()}, commit ${getCommitHash() || 'N/A in debug build'}`}
/>
{isDevelopOrDebugEnv() && (
<>
<Button
onPress={() => navigation.navigate(DevUtilsStackRoutes.Demo)}
>
See Component Demo
</Button>
{/* This button will be present for limited time only, until the new welcome flow is finished and enabled by default. */}
<Button onPress={navigateToNewWelcomeFlow}>
Open New Welcome Flow
</Button>
</>
)}
<FeatureFlags />
{isDevelopOrDebugEnv() && (
<>
<RenderingUtils />
<DevicePassphraseSwitch />
</>
)}

<Button
onPress={() => {
const errorMessage = `Sentry test error - ${Date.now()}`;
Sentry.captureException(new Error(errorMessage));
Alert.alert('Sentry error thrown', errorMessage);
}}
>
Throw Sentry error
</Button>
<Button colorScheme="redElevation0" onPress={clearStorage}>
Wipe all data
</Button>
</VStack>
</Card>
<Card>
<TestnetsToggle />
</Card>
<MessageSystemInfo />
</VStack>
</Screen>
);
};
25 changes: 25 additions & 0 deletions suite-native/module-onboarding/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "@suite-native/module-onboarding",
"version": "1.0.0",
"private": true,
"license": "See LICENSE.md in repo root",
"sideEffects": false,
"main": "src/index",
"scripts": {
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build"
},
"dependencies": {
"@react-navigation/native": "6.1.18",
"@react-navigation/native-stack": "6.11.0",
"@suite-native/atoms": "workspace:*",
"@suite-native/icons": "workspace:*",
"@suite-native/intl": "workspace:*",
"@suite-native/navigation": "workspace:*",
"@trezor/env-utils": "workspace:*",
"@trezor/styles": "workspace:*",
"expo-linear-gradient": "^14.0.1",
"react": "18.2.0",
"react-native": "0.76.1"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions suite-native/module-onboarding/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './navigation/OnboardingStackNavigator';
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { createNativeStackNavigator } from '@react-navigation/native-stack';

import {
OnboardingStackParamList,
OnboardingStackRoutes,
stackNavigationOptionsConfig,
} from '@suite-native/navigation';

import { WelcomeScreen } from '../screens/WelcomeScreen';

export const OnboardingStack = createNativeStackNavigator<OnboardingStackParamList>();

export const OnboardingStackNavigator = () => (
<OnboardingStack.Navigator
initialRouteName={OnboardingStackRoutes.Welcome}
screenOptions={stackNavigationOptionsConfig}
>
<OnboardingStack.Screen name={OnboardingStackRoutes.Welcome} component={WelcomeScreen} />
</OnboardingStack.Navigator>
);
Loading

0 comments on commit 472192b

Please sign in to comment.