Skip to content

Conversation

AsCress
Copy link
Collaborator

@AsCress AsCress commented Sep 15, 2025

Fixes #2911
Adds initialization of connection to the board upon clicking the 'Connect Device' button.
Copy changes in the Connect Device screen.

Screenshots / Recordings

untitled.webm

Summary by Sourcery

Initialize device connection on 'Connect Device' action, refine navigation and UI alignment on the Connect Device screen, and bulk-expand localization with updated copy and new keys for control labels, barometer experiments, and playback controls.

New Features:

  • Bulk-add new localization keys for control panel labels (Data, Configure, Set Gain, Set Channel, Set Rate, mV), barometer experiment instructions, and playback controls across all supported locales.

Bug Fixes:

  • Initialize the board connection when the Connect Device button is pressed.

Enhancements:

  • Update navigation logic to reset or navigate correctly to the Connect Device screen.
  • Center-align step instructions and update their copy to specify cable types and correct OTG wording.

@AsCress AsCress requested a review from marcnause September 15, 2025 17:14
@AsCress AsCress self-assigned this Sep 15, 2025
@AsCress AsCress added Fix Solution to an existing issue in app flutter labels Sep 15, 2025
Copy link
Contributor

sourcery-ai bot commented Sep 15, 2025

Reviewer's Guide

This PR adds initialization of the board connection and refines navigation when the 'Connect Device' button is pressed, centers the layout of the Connect Device screen, and applies copy updates and bulk localization key additions across supported locales.

Sequence diagram for Connect Device button interaction

sequenceDiagram
actor User
participant "Connect Device Button"
participant Provider
participant Navigator
User->>"Connect Device Button": Click
"Connect Device Button"->>Provider: initialize()
alt On /connectDevice route
    "Connect Device Button"->>Navigator: popUntil('/connectDevice')
else Not on /connectDevice route
    "Connect Device Button"->>Navigator: pushNamedAndRemoveUntil('/connectDevice', isFirst)
end
Loading

File-Level Changes

Change Details Files
Initialize board connection and update Connect Device navigation
  • Invoke provider.initialize() on Connect Device button press
  • Use popUntil or pushNamedAndRemoveUntil to land on '/connectDevice'
lib/view/widgets/main_scaffold_widget.dart
Center-align Connect Device screen content
  • Change Column.crossAxisAlignment from start to center
  • Add TextAlign.center to each step instruction Text widget
lib/view/connect_device_screen.dart
Update connection step copy and expand localization keys
  • Revise step1 and step2 instruction strings for clarity
  • Add new keys: data, configure, setGain, setChannel, setRate, millivolts
  • Introduce barometer experiment and playback-related strings
  • Remove duplicate 'configure' definition in base localization
lib/l10n/app_localizations.dart
lib/l10n/app_localizations_en.dart
lib/l10n/app_localizations_de.dart
lib/l10n/app_localizations_es.dart
lib/l10n/app_localizations_fr.dart
lib/l10n/app_localizations_he.dart
lib/l10n/app_localizations_hi.dart
lib/l10n/app_localizations_id.dart
lib/l10n/app_localizations_ja.dart
lib/l10n/app_localizations_nb.dart
lib/l10n/app_localizations_pt.dart
lib/l10n/app_localizations_ru.dart
lib/l10n/app_localizations_uk.dart
lib/l10n/app_localizations_vi.dart
lib/l10n/app_localizations_zh.dart
lib/l10n/app_en.arb

Assessment against linked issues

Issue Objective Addressed Explanation
#2911 Clicking the 'Connect Device' button should open the option to connect the hardware (i.e., trigger initialization and navigate to the Connect Device screen).
#2911 Introductory text with option to connect device should be visible on the Connect Device screen.
#2911 Device options (e.g., V5, V6) and basic guide on how to identify the hardware, as well as options to connect via USB or Bluetooth, should be available and clearly described.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • After calling provider.initialize in the Connect Device button handler, consider showing a loading indicator or error feedback so users know when the connection is in progress or has failed.
  • The push/pop navigation logic in main_scaffold_widget’s onPressed is a bit dense—extract it into a reusable helper function or service to improve readability and centralize route management.
  • In ConnectDeviceScreen, you have several similarly styled, centered Text widgets—consider creating a small helper widget or iterating over a list of steps to reduce duplication.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- After calling provider.initialize in the Connect Device button handler, consider showing a loading indicator or error feedback so users know when the connection is in progress or has failed.
- The push/pop navigation logic in main_scaffold_widget’s onPressed is a bit dense—extract it into a reusable helper function or service to improve readability and centralize route management.
- In ConnectDeviceScreen, you have several similarly styled, centered Text widgets—consider creating a small helper widget or iterating over a list of steps to reduce duplication.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

github-actions bot commented Sep 15, 2025

Build Status

Build successful. APKs to test: https://github.com/fossasia/pslab-app/actions/runs/17895290592/artifacts/4066271503.

Screenshots

Android Screenshots
iPhone Screenshots
iPad Screenshots

Copy link
Member

@mariobehling mariobehling left a comment

Choose a reason for hiding this comment

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

Update the description on the connection screen, e.g. use USB instead of Micro-USB and add the info that it is possible to connect via Bluetooth if the PSLab has the Bluetooth option.

@mariobehling
Copy link
Member

Also note that the top bar has a black font color instead of white. I think this should probably be solved in a separate PR.

@AsCress
Copy link
Collaborator Author

AsCress commented Sep 17, 2025

@mariobehling I'll check this for all instruments and solve separately.

@AsCress
Copy link
Collaborator Author

AsCress commented Sep 17, 2025

@mariobehling Made the changes as follows:
Screenshot_1758117286

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix Solution to an existing issue in app flutter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Connect device button not working
3 participants