Skip to content

feat(app): add device button action switch - #12305

Open
arhxam wants to merge 1 commit into
BasedHardware:mainfrom
arhxam:feat/disable-device-button-actions
Open

feat(app): add device button action switch#12305
arhxam wants to merge 1 commit into
BasedHardware:mainfrom
arhxam:feat/disable-device-button-actions

Conversation

@arhxam

@arhxam arhxam commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

What changed and why

Add a default-on, persisted master switch for Omi device button actions. Interactive onboarding still receives the button event first, while normal single-, double-, and long-press actions return before side effects when the user disables the switch.

Closes #4458

Product invariants affected

none

How it was verified

  • flutter test test/unit/device_button_policy_test.dart test/widgets/device_settings_double_tap_test.dart — all 9 preference, policy, persistence, and settings-widget tests passed.
  • flutter gen-l10n — generated all 48 supported locale implementations with zero untranslated messages.
  • bash scripts/analyze_ratchet.sh — analyzer ratchet passed.
  • The physical button path was not exercised because no paired Omi device is available locally.

Tests

  • Added default-on, disabled, and persistence policy coverage.
  • Added widget coverage for toggling and reloading the setting.
  • Regenerated and validated every supported locale.
  • Physical-device button presses (hardware unavailable).

Failure-Class: none

Review in cubic

@Git-on-my-level

Copy link
Copy Markdown
Collaborator

Thanks @arhxam - this is a clean, well-scoped implementation of #4458, and the default-on choice preserves today's behavior for existing users.

What I verified:

  • app/lib/services/capture/capture_controller.dart - the gate sits inside the single onButtonReceived handler (the only BLE button listener registration; every device connector funnels through it), after the interactive-onboarding interception and before the double-tap, single-tap, and legacy long-press branches (button states 1/2/3/5), so one check covers every user-configured action with no bypass path.
  • app/lib/backend/preferences.dart - deviceButtonEnabled defaults to true, so existing users are unaffected until they opt out.
  • app/lib/services/capture/device_button_policy.dart - small policy seam that keeps the gate unit-testable; app/test/unit/device_button_policy_test.dart covers default-on, disabled, and reload persistence, and app/test/widgets/device_settings_double_tap_test.dart exercises the actual switch widget plus persistence across a reload.
  • l10n - the two new strings carry @ descriptions in app_en.arb, all supported locales are populated, and the regenerated app_localizations*.dart files match (Generated Files check is green).
  • CI: Dart Analyze & Tests, Formatting, Android Compile Smoke, and PR Metadata Preflight all pass.

Two non-blocking notes for the maintainer:

  1. The switch is a single global preference but lives on a per-device settings page - worth deciding whether v1 should stay global (matches the issue's ask) or become per-device.
  2. During interactive onboarding step 1, the single-tap fall-through reaches the new gate, so a user who has disabled button actions will not get the voice-command demo tap during re-onboarding (the onboarding provider still receives the event first). Probably the right trade-off, just flagging the interaction.

Nice work shipping tests alongside the feature. Product direction decision on the switch scope (global vs per-device) needs maintainer sign-off before merge.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added needs-maintainer-review Needs a human maintainer to sign off before merge flutter flutter work labels Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flutter flutter work needs-maintainer-review Needs a human maintainer to sign off before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow button to be completely disabled because kids exist...

2 participants