Skip to content

fix(trezor): pin input not visible in light mode#3034

Merged
CharlVS merged 2 commits intodevfrom
bugfix/trezor-pin-lightmode
Jul 31, 2025
Merged

fix(trezor): pin input not visible in light mode#3034
CharlVS merged 2 commits intodevfrom
bugfix/trezor-pin-lightmode

Conversation

@takenagain
Copy link
Copy Markdown
Contributor

@takenagain takenagain commented Jul 31, 2025

Aligns the light-mode keyPadColor initialisation with the dark theme approach.

Before

image

After

image

Summary by CodeRabbit

  • New Features

    • Improved handling of Trezor authentication cancellation by explicitly dispatching a cancellation event when the PIN dialog is closed.
  • Style

    • Minor formatting adjustments for improved code readability.
  • Refactor

    • Updated theme color assignment to use a fixed color value for the keypad background, ensuring consistent appearance.

matches the dark theme implementation
i.e. if user presses cancel on the pin input screen
@takenagain takenagain self-assigned this Jul 31, 2025
Copilot AI review requested due to automatic review settings July 31, 2025 19:49
@takenagain takenagain added the bug Something isn't working label Jul 31, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jul 31, 2025

Walkthrough

The changes update the handling of color initialization in the light theme, enhance the Trezor authentication cancellation logic by integrating SDK cancellation, and ensure that closing the Trezor PIN dialog dispatches a cancellation event to the authentication bloc. Formatting improvements are also included.

Changes

Cohort / File(s) Change Summary
Theme Color Initialization
app_theme/lib/src/light/theme_custom_light.dart
Refactored keyPadColor from a late-initialized variable to a final constant, removing dynamic assignment logic.
Trezor Auth Cancellation Logic
lib/bloc/auth_bloc/trezor_auth_mixin.dart
Improved _onTrezorCancel to cancel hardware device initialization via SDK and log errors; formatting tweaks.
Trezor PIN Dialog Cancellation
lib/views/common/hw_wallet_dialog/show_trezor_pin_dialog.dart
Modified dialog close handler to dispatch AuthTrezorCancelled event before closing the dialog.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant TrezorPinDialog
    participant AuthBloc
    participant TrezorSDK

    User->>TrezorPinDialog: Close dialog (without PIN)
    TrezorPinDialog->>AuthBloc: Dispatch AuthTrezorCancelled
    AuthBloc->>TrezorSDK: cancelHardwareDeviceInitialization (if taskId present)
    TrezorSDK-->>AuthBloc: (Handles cancellation or throws)
    AuthBloc->>AuthBloc: Emit initial authentication state
    TrezorPinDialog->>TrezorPinDialog: Close popup
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

QA

Suggested reviewers

  • CharlVS
  • smk762

Poem

A rabbit hopped through fields of code,
Where colors fixed and constants showed.
Trezor’s PIN, when closed in haste,
Now cancels tasks—no time to waste!
With each small tweak and tidy line,
The code grows clear—review in time!
🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 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 5d57faf and 6779802.

📒 Files selected for processing (3)
  • app_theme/lib/src/light/theme_custom_light.dart (1 hunks)
  • lib/bloc/auth_bloc/trezor_auth_mixin.dart (4 hunks)
  • lib/views/common/hw_wallet_dialog/show_trezor_pin_dialog.dart (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Build Mobile (Android)
  • GitHub Check: Build Mobile (iOS)
  • GitHub Check: Build Desktop (linux)
  • GitHub Check: Build Desktop (windows)
🔇 Additional comments (5)
lib/views/common/hw_wallet_dialog/show_trezor_pin_dialog.dart (1)

31-34: LGTM! Proper cancellation event handling.

The addition of AuthTrezorCancelled event dispatch before closing ensures proper coordination between the UI and authentication state management. This integrates well with the cancellation logic in the auth bloc.

lib/bloc/auth_bloc/trezor_auth_mixin.dart (4)

52-52: Minor formatting improvement.

Formatting alignment looks good.


75-77: Minor formatting improvement.

Line break formatting enhances readability.


192-192: Minor formatting improvement.

Formatting alignment looks good.


210-217: Excellent cancellation handling implementation.

The enhanced _onTrezorCancel method properly:

  • Retrieves the current task ID from state
  • Calls SDK cancellation with appropriate exception handling
  • Includes logging for debugging failed cancellations
  • Always resets to initial state

This integrates well with the dialog changes to provide coordinated cancellation flow.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bugfix/trezor-pin-lightmode

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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests 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
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a visual issue where Trezor PIN input was not visible in light mode by correcting the theme color initialization approach. It also adds proper cancellation handling for Trezor authentication operations.

Key changes:

  • Aligns light mode keyPadColor initialization with the dark theme approach by making it a constant instead of theme-dependent
  • Adds explicit cancellation handling when the Trezor PIN dialog is closed
  • Includes various code formatting improvements and cleanup

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
app_theme/lib/src/light/theme_custom_light.dart Changes keyPadColor from theme-dependent initialization to a constant value to fix visibility in light mode
lib/views/common/hw_wallet_dialog/show_trezor_pin_dialog.dart Adds proper cancellation event when PIN dialog is closed
lib/bloc/auth_bloc/trezor_auth_mixin.dart Implements cancellation handling and includes code formatting improvements

@takenagain
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jul 31, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@takenagain takenagain added this to the v0.9.2 Release milestone Jul 31, 2025
@github-actions
Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 6779802):

https://walletrc--pull-3034-merge-a0kw75s6.web.app

(expires Thu, 07 Aug 2025 19:52:42 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: f66a4ff03faa546f12f0ae5a841bd9eff2714dcc

@takenagain takenagain requested review from CharlVS and smk762 July 31, 2025 19:54
@CharlVS CharlVS merged commit e9ef13d into dev Jul 31, 2025
9 of 13 checks passed
smk762 pushed a commit that referenced this pull request Aug 1, 2025
* fix(trezor): revert keyPadColor to manual custom color

matches the dark theme implementation

* fix(trezor): call SDK HW cancellation for cancel event

i.e. if user presses cancel on the pin input screen
smk762 pushed a commit that referenced this pull request Aug 1, 2025
* fix(trezor): revert keyPadColor to manual custom color

matches the dark theme implementation

* fix(trezor): call SDK HW cancellation for cancel event

i.e. if user presses cancel on the pin input screen
smk762 pushed a commit that referenced this pull request Aug 1, 2025
* fix(trezor): revert keyPadColor to manual custom color

matches the dark theme implementation

* fix(trezor): call SDK HW cancellation for cancel event

i.e. if user presses cancel on the pin input screen
smk762 pushed a commit that referenced this pull request Aug 1, 2025
* fix(trezor): revert keyPadColor to manual custom color

matches the dark theme implementation

* fix(trezor): call SDK HW cancellation for cancel event

i.e. if user presses cancel on the pin input screen
smk762 pushed a commit that referenced this pull request Aug 1, 2025
* fix(trezor): revert keyPadColor to manual custom color

matches the dark theme implementation

* fix(trezor): call SDK HW cancellation for cancel event

i.e. if user presses cancel on the pin input screen
@takenagain takenagain deleted the bugfix/trezor-pin-lightmode branch August 4, 2025 09:35
smk762 pushed a commit that referenced this pull request Aug 8, 2025
* fix(trezor): revert keyPadColor to manual custom color

matches the dark theme implementation

* fix(trezor): call SDK HW cancellation for cancel event

i.e. if user presses cancel on the pin input screen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants