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

Refactor/native/split device and app onboarding modules #17605

Merged

Conversation

PeKne
Copy link
Contributor

@PeKne PeKne commented Mar 12, 2025

There were multiple bugs in device onboarding flow introduced recently. This PR is attempt to get the flow to somehow stable state again.

Description

@PeKne PeKne added the mobile Suite Lite issues and PRs label Mar 12, 2025
@PeKne PeKne requested a review from a team as a code owner March 12, 2025 12:45
Copy link

coderabbitai bot commented Mar 12, 2025

Walkthrough

The pull request introduces a dedicated device onboarding flow into the application. A new dependency (@suite-native/module-device-onboarding) is added along with its corresponding package configuration and TypeScript settings. The navigation structure is updated by adding a new device onboarding stack navigator and modifying routes, parameter lists, and enums to reference device-specific screens. Several existing components and hooks, including those handling device connection/disconnection and firmware installation, are updated to use the new device onboarding routes and translation keys. Additionally, modifications include renaming components and removing legacy dependencies and references from the previous onboarding setup. These changes collectively restructure navigation, module dependencies, and UI components to segregate device onboarding from the traditional onboarding flow without altering the underlying business logic.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
suite-native/module-device-onboarding/src/screens/ConfirmFirmwareUpdateScreen.tsx (1)

19-19: Component name updated but import path might need revision.

The component has been renamed from OnboardingScreenWithExitButton to DeviceOnboardingScreenWithExitButton, but the import path still references the file as OnboardingScreenWithExitButton. This could lead to confusion in the codebase.

Consider updating the file name in the import path to match the new component name:

-import { DeviceOnboardingScreenWithExitButton } from '../components/OnboardingScreenWithExitButton';
+import { DeviceOnboardingScreenWithExitButton } from '../components/DeviceOnboardingScreenWithExitButton';
suite-native/module-device-onboarding/src/screens/UninitializedDeviceLandingScreen.tsx (1)

17-17: Component name updated but import path might need revision.

The component has been renamed from OnboardingScreenWithExitButton to DeviceOnboardingScreenWithExitButton, but the import path still references the file as OnboardingScreenWithExitButton. This could lead to confusion in the codebase.

Consider updating the file name in the import path to match the new component name:

-import { DeviceOnboardingScreenWithExitButton } from '../components/OnboardingScreenWithExitButton';
+import { DeviceOnboardingScreenWithExitButton } from '../components/DeviceOnboardingScreenWithExitButton';
suite-native/device/src/hooks/useHandleDeviceConnection.ts (1)

215-218: Dependency array contains unused variable

The isOnboardingStackFocused variable is still included in the dependency array (line 215) even though it no longer appears to be used in this effect. Consider removing it to avoid unnecessary re-renders.

    }, [
        isNoPhysicalDeviceConnected,
        isOnboardingFinished,
        navigation,
        shouldBlockSendReviewRedirect,
        isFirmwareInstallationRunning,
        isDeviceCompromisedModalFocused,
        isSuspiciousDeviceScreenFocused,
-       isOnboardingStackFocused,
        handleOnboardingDeviceDisconnection,
        isConnectAndUnlockDeviceScreenFocused,
        isDeviceOnboardingStackFocused,
    ]);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e346ba7 and a66c676.

⛔ Files ignored due to path filters (6)
  • suite-native/module-device-onboarding/src/assets/t3b1.png is excluded by !**/*.png
  • suite-native/module-device-onboarding/src/assets/t3b1Seal1.png is excluded by !**/*.png
  • suite-native/module-device-onboarding/src/assets/t3b1Seal2.png is excluded by !**/*.png
  • suite-native/module-device-onboarding/src/assets/t3t1.png is excluded by !**/*.png
  • suite-native/module-device-onboarding/src/assets/t3t1Seal.png is excluded by !**/*.png
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (31)
  • suite-native/app/package.json (1 hunks)
  • suite-native/app/src/navigation/RootStackNavigator.tsx (2 hunks)
  • suite-native/app/tsconfig.json (1 hunks)
  • suite-native/device/src/hooks/useHandleDeviceConnection.ts (7 hunks)
  • suite-native/device/src/hooks/useHandleOnboardingDeviceDisconnection.tsx (1 hunks)
  • suite-native/device/src/index.ts (1 hunks)
  • suite-native/firmware/src/components/FirmwareInstallationScreenContent.tsx (3 hunks)
  • suite-native/firmware/src/hooks/useFirmware.tsx (1 hunks)
  • suite-native/firmware/src/index.ts (1 hunks)
  • suite-native/intl/src/en.ts (1 hunks)
  • suite-native/module-device-onboarding/package.json (1 hunks)
  • suite-native/module-device-onboarding/src/components/OnboardingScreenWithExitButton.tsx (2 hunks)
  • suite-native/module-device-onboarding/src/components/SecurityCheckStepCard.tsx (4 hunks)
  • suite-native/module-device-onboarding/src/components/SecuritySealDescription.tsx (2 hunks)
  • suite-native/module-device-onboarding/src/components/SecuritySealImages.tsx (1 hunks)
  • suite-native/module-device-onboarding/src/index.ts (1 hunks)
  • suite-native/module-device-onboarding/src/navigation/DeviceOnboardingStackNavigator.tsx (1 hunks)
  • suite-native/module-device-onboarding/src/redux.d.ts (1 hunks)
  • suite-native/module-device-onboarding/src/screens/ConfirmFirmwareUpdateScreen.tsx (4 hunks)
  • suite-native/module-device-onboarding/src/screens/FirmwareInstallationScreen.tsx (2 hunks)
  • suite-native/module-device-onboarding/src/screens/SecurityCheckScreen.tsx (5 hunks)
  • suite-native/module-device-onboarding/src/screens/SuspiciousDeviceScreen.tsx (5 hunks)
  • suite-native/module-device-onboarding/src/screens/UninitializedDeviceLandingScreen.tsx (4 hunks)
  • suite-native/module-device-onboarding/tsconfig.json (1 hunks)
  • suite-native/module-onboarding/package.json (0 hunks)
  • suite-native/module-onboarding/src/components/E2ESkipOnboardingButton.e2e.tsx (1 hunks)
  • suite-native/module-onboarding/src/navigation/OnboardingStackNavigator.tsx (0 hunks)
  • suite-native/module-onboarding/src/screens/BiometricsScreen.tsx (1 hunks)
  • suite-native/module-onboarding/tsconfig.json (0 hunks)
  • suite-native/navigation/src/navigators.ts (3 hunks)
  • suite-native/navigation/src/routes.ts (2 hunks)
💤 Files with no reviewable changes (3)
  • suite-native/module-onboarding/src/navigation/OnboardingStackNavigator.tsx
  • suite-native/module-onboarding/package.json
  • suite-native/module-onboarding/tsconfig.json
⏰ Context from checks skipped due to timeout of 90000ms (14)
  • GitHub Check: PR-check / node-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: PR-check / web-override init-api-flaky
  • GitHub Check: PR-check / node-override init-api-flaky
  • GitHub Check: PR-check / web-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: build-deploy
  • GitHub Check: build-deploy
  • GitHub Check: EAS Update
  • GitHub Check: transport-e2e-test
  • GitHub Check: Setup and Cache Dependencies
  • GitHub Check: prepare_android_test_app
  • GitHub Check: test
  • GitHub Check: Analyze with CodeQL (javascript)
  • GitHub Check: build-web
  • GitHub Check: Socket Security: Pull Request Alerts
🔇 Additional comments (73)
suite-native/module-device-onboarding/src/components/SecuritySealImages.tsx (1)

53-56: Translation ID Updated to Reflect Module Separation

The updated translation ID now follows the new module naming scheme ("moduleDeviceOnboarding...") which aligns well with the PR objectives aimed at splitting the onboarding process. Please ensure that this new key exists in your internationalization resource files to avoid missing translations at runtime.

suite-native/firmware/src/hooks/useFirmware.tsx (1)

18-18: Changed parameter from required to optional which improves flexibility

The params parameter is now optional, allowing the hook to be called without arguments. This is a good enhancement that enables more flexible usage of the hook, especially in scenarios where you don't need to pass any parameters initially.

suite-native/navigation/src/navigators.ts (3)

22-22: LGTM: DeviceOnboardingStackRoutes import added

This import is correctly added to support the new device onboarding navigation structure.


122-132: Good separation of device onboarding from general onboarding flow

The separation of device-specific onboarding routes into their own parameter list enhances modularity and separation of concerns. This change aligns well with the PR objective of splitting device and app onboarding modules.


214-214: LGTM: RootStackParamList updated with new DeviceOnboardingStack

The root stack has been correctly updated to include the new device onboarding navigation stack, which is necessary for navigating to the device onboarding flow.

suite-native/module-device-onboarding/src/components/OnboardingScreenWithExitButton.tsx (4)

10-11: LGTM: Added import for useFirmware hook

The import is correctly added to support the firmware installation state management feature.


14-14: Consistent renaming for device-specific components

The component has been appropriately renamed from OnboardingExitButtonScreenHeader to DeviceOnboardingExitButtonScreenHeader and the exported component from OnboardingScreenWithExitButton to DeviceOnboardingScreenWithExitButton, maintaining consistency with the PR's objective of separating device onboarding.

Also applies to: 65-66


21-21: Added firmware installation state management

The component now properly manages firmware installation state with setIsFirmwareInstallationRunning(false) when exiting, which helps prevent issues with hanging firmware installation processes if the user cancels. The dependencies array has been correctly updated to include the new function.

Also applies to: 35-36, 41-48


25-26: Updated translation keys for device-specific context

Translation keys have been updated from moduleOnboarding to moduleDeviceOnboarding prefix, ensuring proper localization context for the device onboarding flow.

Also applies to: 30-31

suite-native/firmware/src/index.ts (1)

7-7: LGTM: Exported useFirmware hook

The useFirmware hook is now properly exported from the index file, making it accessible to other modules that need firmware installation functionality without having to import it from the specific hooks directory.

suite-native/module-device-onboarding/src/index.ts (1)

1-2: Looks good! Appropriate barrel file export.

This simple export statement follows best practices for re-exporting components from a module, making the DeviceOnboardingStackNavigator accessible to consumers of this package.

suite-native/device/src/index.ts (1)

8-8: Hook export adds clear device disconnection handling for onboarding.

This export makes the new useHandleOnboardingDeviceDisconnection hook publicly available, which aligns with the PR objective of improving device onboarding stability by providing specialized handling for device disconnection events during onboarding.

suite-native/app/tsconfig.json (1)

57-57: Correctly configured TypeScript reference path.

The reference path to the new module has been properly added to the TypeScript configuration, maintaining alphabetical ordering. This is necessary for proper type checking and IDE support.

suite-native/app/package.json (1)

66-66: Correctly added module dependency.

The new @suite-native/module-device-onboarding dependency has been properly added with the workspace resolution syntax, consistent with other internal dependencies. This addition supports the PR's goal of splitting device onboarding into a separate module.

suite-native/app/src/navigation/RootStackNavigator.tsx (2)

16-16: LGTM! Properly importing the new device onboarding navigator.

The import statement correctly references the new DeviceOnboardingStackNavigator from the module-device-onboarding package.


94-97: LGTM! Well-integrated device onboarding screen in the navigation stack.

The new DeviceOnboardingStack screen is properly added to the appropriate navigation group with the slide_from_bottom animation, consistent with other similar flows in the application. The placement with other bottom-sliding navigation flows is logical and maintains UI consistency.

suite-native/module-onboarding/src/components/E2ESkipOnboardingButton.e2e.tsx (1)

14-15: Good improvement for test stability

Removing the setTimeout and directly dispatching the action before navigation eliminates a potential source of flaky end-to-end tests. Timeouts in tests often lead to race conditions and intermittent failures.

suite-native/module-device-onboarding/src/screens/FirmwareInstallationScreen.tsx (3)

4-4: Updated import path to reflect new module structure

The import path now correctly uses the dedicated device onboarding component, which aligns with the PR objective of splitting onboarding into device-specific and general app modules.


16-16: Updated component name to match the imported component

The component name has been updated to use DeviceOnboardingScreenWithExitButton which matches the imported component, maintaining consistency across the codebase.

Also applies to: 22-22


20-20: Added retry control for firmware installation

The new isRetryAllowed prop provides explicit control over whether retry functionality is available during firmware installation. Setting it to false prevents users from retrying a failed firmware installation, which is appropriate in the context of initial device onboarding.

suite-native/intl/src/en.ts (2)

780-781: New device onboarding module structure in translations

The introduction of a dedicated moduleDeviceOnboarding section in the translations file supports the separation of device onboarding from general app onboarding, which aligns with the PR's main objective.


782-843: Comprehensive device onboarding translations

The translations cover all necessary UI elements for the device onboarding flow, including:

  • Uninitialized device screens with different firmware states
  • Security check guidance
  • Error handling for device disconnection
  • Cancellation confirmations

This thorough coverage ensures a consistent user experience throughout the device onboarding process.

suite-native/module-device-onboarding/src/navigation/DeviceOnboardingStackNavigator.tsx (4)

1-8: Well-structured navigator imports

The imports are organized logically, with React Navigation's core functionality first, followed by parameter types and route definitions, and then configuration options. This organization makes the code easier to maintain.


9-14: Organized screen imports

All required screen components are imported alphabetically, which improves readability and makes it easier to identify which screens are included in this navigation stack.


15-16: Type-safe navigation stack

The navigator is created with proper TypeScript typing (DeviceOnboardingStackParamList), ensuring type safety when navigating between screens and passing parameters.


17-43: Well-implemented device onboarding navigation flow

The DeviceOnboardingStackNavigator component implements a clear, sequential flow for device onboarding:

  1. Starting with the uninitialized device landing screen
  2. Handling suspicious device detection
  3. Performing security checks
  4. Managing firmware installation
  5. Confirming firmware updates

All screens use consistent navigation options through the shared stackNavigationOptionsConfig. This structure aligns perfectly with the PR objective of creating a dedicated device onboarding flow.

suite-native/navigation/src/routes.ts (2)

5-5: Good addition to the routing structure!

Adding DeviceOnboardingStack to the RootStackRoutes enum supports the separation of device-specific onboarding flows from the general app onboarding, which aligns well with the PR objective of stabilizing the device onboarding process.


36-42: Well-structured device onboarding routes

The new DeviceOnboardingStackRoutes enum properly captures the various screens needed for the device onboarding flow. This clear separation of concerns will make the codebase more maintainable and isolate device-specific initialization flows from the general app onboarding.

suite-native/firmware/src/components/FirmwareInstallationScreenContent.tsx (3)

48-48: Good addition of control parameter

Adding the optional isRetryAllowed property enhances component flexibility by allowing parent components to control retry button visibility.


57-57: Smart choice for backward compatibility

Setting the default value to true maintains backward compatibility with existing implementations while allowing new implementations to disable the retry option when needed.


233-237: Properly implemented conditional rendering

The conditional rendering of the retry button is well implemented, ensuring it only appears when explicitly allowed. This change helps address the firmware installation issues mentioned in the PR objectives.

suite-native/module-onboarding/src/screens/BiometricsScreen.tsx (1)

49-50: Fixed state transition timing

Good simplification by removing the timeout-based state change. Dispatching setIsOnboardingFinished() immediately before navigation ensures proper state sequencing and helps prevent the device disconnected error mentioned in the PR objectives. This approach avoids race conditions that could occur with the previous timeout implementation.

suite-native/module-device-onboarding/src/components/SecuritySealDescription.tsx (2)

36-37: Correct namespace update for translations

Updating the translation prefix from moduleOnboarding to moduleDeviceOnboarding properly aligns with the new module structure. This ensures correct translations are used in the device-specific context.


64-71: Consistent translation key updates

The translation IDs have been consistently updated across all instances in this component, ensuring proper localization within the new module structure.

suite-native/module-device-onboarding/src/screens/ConfirmFirmwareUpdateScreen.tsx (4)

13-15: Import names updated to align with new module structure.

The import names have been properly updated from OnboardingStackParamList and OnboardingStackRoutes to DeviceOnboardingStackParamList and DeviceOnboardingStackRoutes to reflect the new module structure.


21-24: Type definition updated for navigation prop.

The type definition for NavigationProp has been correctly updated to use DeviceOnboardingStackParamList and DeviceOnboardingStackRoutes.ConfirmFirmwareUpdate.


43-45: Navigation route updated to new device onboarding structure.

The navigation has been correctly updated to use DeviceOnboardingStackRoutes.FirmwareInstallation to match the new navigation structure.


54-65: Component usage updated to reflect new naming.

The component usage has been updated from OnboardingScreenWithExitButton to DeviceOnboardingScreenWithExitButton to maintain consistency with the new module structure.

suite-native/module-device-onboarding/src/screens/SuspiciousDeviceScreen.tsx (4)

9-10: Import names updated to align with new module structure.

The import names have been properly updated from OnboardingStackParamList and OnboardingStackRoutes to DeviceOnboardingStackParamList and DeviceOnboardingStackRoutes to reflect the new module structure.


38-40: Screen props type updated to use new stack parameter list.

The screen props type has been correctly updated to use DeviceOnboardingStackParamList and DeviceOnboardingStackRoutes.SuspiciousDevice instead of their Onboarding counterparts.


74-79: Translation ID prefix updated to new module.

The translation ID has been correctly updated to use moduleDeviceOnboarding.suspiciousDeviceScreen.title instead of moduleOnboarding.suspiciousDeviceScreen.title.


88-89: Translation IDs consistently updated across component.

All translation IDs in the component have been consistently updated to use the moduleDeviceOnboarding prefix instead of moduleOnboarding, which aligns with the new module structure.

Also applies to: 96-97, 104-105, 113-114

suite-native/device/src/hooks/useHandleOnboardingDeviceDisconnection.tsx (2)

72-79: Alert translation IDs updated to new module.

The translation IDs for the device disconnected alert have been correctly updated to use the moduleDeviceOnboarding prefix instead of moduleOnboarding.


85-88: Secondary button behavior enhanced with navigation.

The secondary button handler has been enhanced to navigate back after hiding the alert, which improves the user experience by returning them to the previous screen when they cancel the reconnection.

This change maintains the original functionality of hiding the alert while adding the improved UX of navigating back when the user cancels.

suite-native/module-device-onboarding/src/screens/UninitializedDeviceLandingScreen.tsx (8)

8-10: Import names updated to align with new module structure.

The import names have been properly updated from OnboardingStackParamList and OnboardingStackRoutes to DeviceOnboardingStackParamList and DeviceOnboardingStackRoutes to reflect the new module structure.


48-49: Translation IDs updated for firmware-related content.

The translation IDs for firmware-related content have been correctly updated to use the moduleDeviceOnboarding prefix instead of moduleOnboarding.

Also applies to: 52-53, 58-59


76-79: Screen props type updated to use new stack parameter list.

The screen props type has been correctly updated to use DeviceOnboardingStackParamList and DeviceOnboardingStackRoutes.UninitializedDeviceLanding instead of their Onboarding counterparts.


83-87: Navigation routes updated to new device onboarding structure.

The navigation routes in the confirmation button handler have been correctly updated to use DeviceOnboardingStackRoutes.ConfirmFirmwareUpdate and DeviceOnboardingStackRoutes.SecurityCheck to match the new navigation structure.


90-94: Navigation route updated for suspicious device flow.

The navigation to the suspicious device screen has been correctly updated to use DeviceOnboardingStackRoutes.SuspiciousDevice to match the new navigation structure.


96-100: Navigation route consistently updated across handlers.

The navigation route in the device looks different handler has been correctly updated to use DeviceOnboardingStackRoutes.SuspiciousDevice to match the new navigation structure, maintaining consistency across all navigation handlers.


103-133: Component usage updated to reflect new naming.

The component usage has been updated from OnboardingScreenWithExitButton to DeviceOnboardingScreenWithExitButton to maintain consistency with the new module structure.


112-113: Translation IDs consistently updated for UI buttons and labels.

All translation IDs for buttons and labels have been consistently updated to use the moduleDeviceOnboarding prefix instead of moduleOnboarding, which ensures consistency across the UI.

Also applies to: 120-121, 128-129

suite-native/module-device-onboarding/src/screens/SecurityCheckScreen.tsx (6)

8-10: Good refactoring to separate device onboarding from general onboarding

The navigation routes and params have been correctly updated to use the device-specific types, which aligns well with the PR objective of splitting the onboarding modules.


15-15: Import path updated for consistency

The component import has been properly updated to use DeviceOnboardingScreenWithExitButton from the correct path, maintaining consistency with the module separation.


21-21: Translation IDs correctly updated to match the new module

The translation keys have been properly updated from moduleOnboarding to moduleDeviceOnboarding across all components, which ensures consistent localization within the new module structure.

Also applies to: 25-25, 42-43, 48-51, 88-89, 91-91


67-68: Props type correctly updated to use device-specific navigation

The component props have been properly updated to use DeviceOnboardingStackParamList and DeviceOnboardingStackRoutes.SecurityCheck, ensuring type safety with the new navigation structure.


78-78: Navigation route updated to reflect new module

Navigation is now correctly targeting DeviceOnboardingStackRoutes.FirmwareInstallation, maintaining the flow through the device-specific navigation stack.


82-82: Component usage updated to match new module

The component now properly uses DeviceOnboardingScreenWithExitButton instead of OnboardingScreenWithExitButton, consistent with the module separation.

Also applies to: 110-110

suite-native/module-device-onboarding/src/components/SecurityCheckStepCard.tsx (4)

24-26: Updated imports for device-specific navigation

The component correctly imports the new device-specific navigation types, aligning with the module separation approach.


42-45: Navigation props type updated for device-specific context

The NavigationProps type is now correctly using DeviceOnboardingStackParamList and DeviceOnboardingStackRoutes.SecurityCheck, ensuring type safety with the new navigation structure.


74-74: Navigation route updated for suspicious device screen

The navigation call now correctly targets DeviceOnboardingStackRoutes.SuspiciousDevice, maintaining consistency with the new module structure.


131-131: Translation ID updated for decline button

The translation key has been properly updated to use moduleDeviceOnboarding namespace, ensuring consistency with the module restructuring.

suite-native/device/src/hooks/useHandleDeviceConnection.ts (8)

25-25: Import added for device-specific navigation routes

The component now correctly imports DeviceOnboardingStackRoutes, which is necessary for the device-specific navigation flow.


76-76: Updated route reference for suspicious device screen

The isSuspiciousDeviceScreenFocused check now correctly references DeviceOnboardingStackRoutes.SuspiciousDevice, aligning with the new navigation structure.


86-86: Added tracking for device onboarding stack focus

A new variable isDeviceOnboardingStackFocused has been added to track when the device onboarding stack is focused, which is essential for the split navigation flows.


97-105: Updated conditions for device onboarding navigation

The navigation logic now includes additional checks for isOnboardingFinished and prevents navigation during firmware installation, which helps address the bug mentioned in the PR description where a device disconnected error was displayed during firmware installation.


107-109: Navigation updated to use device-specific stack

Navigation now correctly targets the dedicated device onboarding stack, implementing the core of the module separation described in the PR objectives.


114-114: Dependencies updated in useEffect

The dependency array has been properly updated to include the new conditions and variables, ensuring the effect runs when relevant state changes.

Also applies to: 120-121


176-176: Added check for firmware installation

This additional check prevents disrupting the device disconnection handling during firmware installation, addressing part of the issue mentioned in the PR description.


194-194: Updated check for device onboarding stack

The device disconnection handling now correctly checks for isDeviceOnboardingStackFocused instead of the general onboarding stack, aligning with the split module approach.

suite-native/module-device-onboarding/package.json (1)

1-33: Package structure looks good for the new device onboarding module.

The package configuration is well-structured with appropriate dependencies for a device onboarding module. I see all the necessary React Navigation components, Redux toolkit, and workspace dependencies that would be needed for implementing device connection flows and firmware installation.

suite-native/module-device-onboarding/src/redux.d.ts (1)

1-7: Redux type declaration for async thunks is properly implemented.

This declaration file correctly extends the Redux Dispatch interface to handle async thunk actions from Redux Toolkit. This is a standard pattern that will ensure proper typing when dispatching async actions throughout the module.

suite-native/module-device-onboarding/tsconfig.json (1)

1-14: TypeScript configuration is properly set up with all necessary references.

The TypeScript configuration extends the base project configuration and correctly references all the required dependencies. The references match the workspace dependencies declared in the package.json file, which is good practice for maintaining consistency across the project.

Copy link

🚀 Expo preview is ready!

  • Project → trezor-suite-preview
  • Platforms → android, ios
  • Scheme → trezorsuitelite
  • Runtime Version → 26
  • More info

Learn more about 𝝠 Expo Github Action

Copy link
Member

@matejkriz matejkriz left a comment

Choose a reason for hiding this comment

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

Code looks good, great improvement. Happy path works, haven't tested unhappy paths (revision check failed, closing screes, going back...)

@PeKne PeKne merged commit 309f55f into develop Mar 12, 2025
63 of 78 checks passed
@PeKne PeKne deleted the refactor/native/split-device-and-app-onboarding-modules branch March 12, 2025 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mobile Suite Lite issues and PRs
Projects
Status: 🎯 To do
2 participants