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(suite-native): welcome flow ui review fixes #16868

Merged
merged 1 commit into from
Feb 10, 2025

Conversation

PeKne
Copy link
Contributor

@PeKne PeKne commented Feb 6, 2025

Description

  • fixes issues found by @shenkys during welcome flow UI review

@PeKne PeKne added the mobile Suite Lite issues and PRs label Feb 6, 2025
@PeKne PeKne requested a review from a team as a code owner February 6, 2025 11:30
Copy link

coderabbitai bot commented Feb 6, 2025

Walkthrough

This pull request introduces modifications to two screens within the onboarding module. In the AnalyticsConsentScreen, a new function toggleAnalyticsConsent has been added to consolidate the logic for toggling the consent state. This function is now triggered by both the TouchableOpacity's onPress event and the Switch's onChange event, replacing the previous direct state update. In the BiometricsScreen, new styling utilities from @trezor/styles are imported, and a custom style (titleStyle) is defined and applied to the title text for letter spacing adjustments. Additionally, layout changes have been made by modifying alignment properties and updating spacing values. These changes affect the control flow for tracking analytics consent and update the visual styling and layout of the biometrics onboarding screen.

Possibly related PRs

  • refactor(suite-native): icon list item used in analytics screen #16606: The changes in the main PR, specifically the introduction of the toggleAnalyticsConsent function in AnalyticsConsentScreen, are related to the modifications made in this PR, which also involves the AnalyticsConsentScreen and focuses on enhancing the code structure by reusing the IconListItem component.

Suggested labels

bug


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d379436 and 7f10710.

📒 Files selected for processing (2)
  • suite-native/module-onboarding/src/screens/AnalyticsConsentScreen.tsx (3 hunks)
  • suite-native/module-onboarding/src/screens/BiometricsScreen.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • suite-native/module-onboarding/src/screens/AnalyticsConsentScreen.tsx
  • suite-native/module-onboarding/src/screens/BiometricsScreen.tsx
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: EAS Update
  • GitHub Check: prepare_android_test_app
  • GitHub Check: Setup and Cache Dependencies
  • GitHub Check: Analyze with CodeQL (javascript)

🪧 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. (Beta)
  • @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 (2)
suite-native/module-onboarding/src/screens/AnalyticsConsentScreen.tsx (1)

100-119: Add accessibility props to enhance screen reader support.

The UI changes improve user interaction by making the entire consent area tappable, with consistent behavior between tapping the area and toggling the switch. Consider enhancing accessibility by adding the following props:

 <TouchableOpacity
   onPress={toggleAnalyticsConsent}
   activeOpacity={0.5}
+  accessible={true}
+  accessibilityRole="switch"
+  accessibilityState={{ checked: isEnabled }}
+  accessibilityLabel={<Translation id="moduleOnboarding.analyticsConsentScreen.helpSwitchTitle" />}
 >
suite-native/module-onboarding/src/screens/BiometricsScreen.tsx (1)

99-99: Fix inconsistent test ID.

The test ID "@onboarding/UserDataConsent/enableBtn" appears to be copied from a different screen. Consider updating it to match the current screen name.

-            testID="@onboarding/UserDataConsent/enableBtn"
+            testID="@onboarding/Biometrics/enableBtn"
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0a1177d and d379436.

📒 Files selected for processing (2)
  • suite-native/module-onboarding/src/screens/AnalyticsConsentScreen.tsx (3 hunks)
  • suite-native/module-onboarding/src/screens/BiometricsScreen.tsx (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: EAS Update
  • GitHub Check: Setup and Cache Dependencies
  • GitHub Check: prepare_android_test_app
  • GitHub Check: Analyze with CodeQL (javascript)
🔇 Additional comments (7)
suite-native/module-onboarding/src/screens/AnalyticsConsentScreen.tsx (2)

2-2: LGTM!

The TouchableOpacity import is correctly added to support the enhanced touch interaction.


61-63: LGTM! Well-structured state update.

The toggleAnalyticsConsent function correctly uses the functional update pattern and centralizes the toggle logic, improving maintainability.

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

20-25: LGTM! Well-documented styling change.

The title style definition is clear and the comment effectively explains the design requirement for reduced letter spacing.


30-30: LGTM! Clean hook usage.

The hook destructuring is focused and follows React best practices.


78-78: LGTM! Improved layout centering.

The Box component now properly centers its content both vertically and horizontally, which should provide better visual balance.


81-81: LGTM! Good use of design tokens.

Using the predefined spacing token "sp40" instead of a numeric value improves maintainability and ensures consistent spacing across the app.


93-93: LGTM! Proper style application.

The custom titleStyle is correctly applied to adjust the letter spacing as per the design requirements.

Copy link

github-actions bot commented Feb 6, 2025

🚀 Expo preview is ready!

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

Learn more about 𝝠 Expo Github Action

@PeKne
Copy link
Contributor Author

PeKne commented Feb 6, 2025

/rebase

Copy link

github-actions bot commented Feb 6, 2025

@trezor-ci trezor-ci force-pushed the fix/native/onboarding-ui-review branch from d379436 to 7f10710 Compare February 6, 2025 13:21
Comment on lines +104 to +105
<Box
flexDirection="row"
Copy link
Contributor

Choose a reason for hiding this comment

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

What about using VStack here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

VStack does not make sense here because the flexDirection="row". Did you mean HStack? Anyway, I don't see any benefit of using Stack component here. Why would you like to use is?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, HStack is what I meant. And I believe it makes sense since you don't have to specify direction explicitly.

Copy link
Contributor

@yanascz yanascz left a comment

Choose a reason for hiding this comment

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

👍

@PeKne PeKne merged commit 25ffdcd into develop Feb 10, 2025
17 checks passed
@PeKne PeKne deleted the fix/native/onboarding-ui-review branch February 10, 2025 12:14
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: 🏃‍♀️ In progress
Development

Successfully merging this pull request may close these issues.

2 participants