From 4c7fc39455504c41bd8c021b0cc97cc6321f18f1 Mon Sep 17 00:00:00 2001 From: uvtqt Date: Tue, 17 Nov 2026 08:19:29 +0100 Subject: [PATCH 1/3] alarm: the test-buzz snackbar says the buzz was sent and no longer queues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The app gets no signal when the strap stops buzzing, so 'Buzzing the band' / 'Band vibriert…' claimed a state it cannot see. Repeat taps also queued one 4-second snackbar each, keeping it on screen long after the band stopped. Reword to 'Buzz sent to the band' (de/es/ru too) and replace the current snackbar instead of queueing behind it. Co-Authored-By: Claude Opus 5.5 --- lib/l10n/app_de.arb | 2 +- lib/l10n/app_en.arb | 4 ++-- lib/l10n/app_es.arb | 2 +- lib/l10n/app_ru.arb | 2 +- lib/ui2/profile/alarm.dart | 10 +++++++--- test/ui2_alarm_test.dart | 33 +++++++++++++++++++++++++++++++++ 6 files changed, 45 insertions(+), 8 deletions(-) diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index 387e2646b..427565814 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -94,7 +94,7 @@ "alarmChangeTheTime": "Uhrzeit ändern", "alarmTestTheBuzz": "Vibration testen", "alarmCancelTheAlarm": "Wecker löschen", - "alarmBuzzingTheBand": "Band vibriert…", + "alarmBuzzingTheBand": "Vibration ans Band gesendet", "alarmCancelled": "Wecker gelöscht", "alarmSentToBand": "Wecker ans Band gesendet", "alarmInThePast": "Dieser Zeitpunkt liegt in der Vergangenheit – der Wecker hat bereits geklingelt oder wurde verpasst", diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 4e83d12d2..a8f137e72 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -393,9 +393,9 @@ "@alarmCancelTheAlarm": { "description": "Button: cancel the alarm." }, - "alarmBuzzingTheBand": "Buzzing the band", + "alarmBuzzingTheBand": "Buzz sent to the band", "@alarmBuzzingTheBand": { - "description": "Snackbar: testing the buzz." + "description": "Snackbar: the test buzz command reached the band. The app gets no signal when the buzz ends, so this must not claim the band is still buzzing." }, "alarmCancelled": "Alarm cancelled", "@alarmCancelled": { diff --git a/lib/l10n/app_es.arb b/lib/l10n/app_es.arb index eb9add55d..49e9670de 100644 --- a/lib/l10n/app_es.arb +++ b/lib/l10n/app_es.arb @@ -91,7 +91,7 @@ "alarmChangeTheTime": "Cambiar la hora", "alarmTestTheBuzz": "Probar la vibración", "alarmCancelTheAlarm": "Cancelar la alarma", - "alarmBuzzingTheBand": "Vibrando la banda", + "alarmBuzzingTheBand": "Vibración enviada a la banda", "alarmCancelled": "Alarma cancelada", "alarmSentToBand": "Alarma enviada a la banda", "alarmInThePast": "En el pasado: ya sonó o se pasó", diff --git a/lib/l10n/app_ru.arb b/lib/l10n/app_ru.arb index fb3c59901..d4028beae 100644 --- a/lib/l10n/app_ru.arb +++ b/lib/l10n/app_ru.arb @@ -100,7 +100,7 @@ "alarmChangeTheTime": "Изменить время", "alarmTestTheBuzz": "Проверить вибрацию", "alarmCancelTheAlarm": "Отменить будильник", - "alarmBuzzingTheBand": "Браслет вибрирует", + "alarmBuzzingTheBand": "Вибрация отправлена на браслет", "alarmCancelled": "Будильник отменён", "alarmSentToBand": "Будильник отправлен на браслет", "alarmInThePast": "Время прошло — будильник уже сработал или был пропущен", diff --git a/lib/ui2/profile/alarm.dart b/lib/ui2/profile/alarm.dart index e740cefdd..190d3ea62 100644 --- a/lib/ui2/profile/alarm.dart +++ b/lib/ui2/profile/alarm.dart @@ -358,7 +358,7 @@ class AlarmScreenView extends StatelessWidget { color: C.blue, soft: true, onTap: () => _run( - c, onTest, l?.alarmBuzzingTheBand ?? 'Buzzing the band')), + c, onTest, l?.alarmBuzzingTheBand ?? 'Buzz sent to the band')), const SizedBox(height: S.x3), ], if (at != null || anyDayEnabled) @@ -444,8 +444,12 @@ class AlarmScreenView extends StatelessWidget { } } - static void _say(BuildContext c, String msg) => - ScaffoldMessenger.of(c).showSnackBar(SnackBar(content: Text(msg))); + /// Replaces whatever this screen said last instead of queueing behind it: + /// repeat taps would otherwise stack one 4-second snackbar each and keep an + /// old result on screen long after it stopped being true. + static void _say(BuildContext c, String msg) => ScaffoldMessenger.of(c) + ..hideCurrentSnackBar() + ..showSnackBar(SnackBar(content: Text(msg))); static String _hhmm(DateTime d) => _hhmmOf(d.hour, d.minute); diff --git a/test/ui2_alarm_test.dart b/test/ui2_alarm_test.dart index 66dacb1a6..a6f1b5a13 100644 --- a/test/ui2_alarm_test.dart +++ b/test/ui2_alarm_test.dart @@ -137,4 +137,37 @@ void main() { expect(find.text('Fired or missed'), findsOneWidget); }); }); + group('the test buzz', () { + setUp(() => ClockFormatController.seed(ClockFormat.h24)); + tearDown(ClockFormatController.debugReset); + + // The app gets no signal when the strap stops buzzing, so the confirmation + // may only say the command was sent, and repeat taps must not queue one + // 4-second snackbar each and keep "buzzing" on screen long after the band + // has stopped. + testWidgets('says the buzz was sent, once, however often it is tapped', + (t) async { + final now = DateTime(2026, 8, 22, 9); + await t.pumpWidget(MaterialApp( + home: AlarmScreenView( + armedAt: DateTime(2026, 8, 23, 6, 30), + state: AlarmArmState.confirmed, + connected: true, + now: now, + onTest: () async {}))); + final button = find.text('Test the buzz'); + await t.ensureVisible(button); + for (var i = 0; i < 3; i++) { + await t.tap(button); + await t.pump(); + } + await t.pump(const Duration(milliseconds: 750)); + expect(find.text('Buzz sent to the band'), findsOneWidget); + expect(find.textContaining('Buzzing'), findsNothing); + // One snackbar's lifetime later nothing is left waiting in the queue. + await t.pump(const Duration(seconds: 5)); + await t.pump(const Duration(seconds: 1)); + expect(find.text('Buzz sent to the band'), findsNothing); + }); + }); } From d2390cdec5ddb751781ead24a7105a91445265e8 Mon Sep 17 00:00:00 2001 From: uvtqt Date: Tue, 17 Nov 2026 10:47:04 +0100 Subject: [PATCH 2/3] alarm: drop queued snackbars too, and leave other screens' messages alone hideCurrentSnackBar only hid the visible one, so a result that landed while the previous one was leaving still queued behind another. clearSnackBars drops the queue as well, and only while the alarm screen is on top. Also reword the zh/hi/fr strings, which still said the band was buzzing. Co-Authored-By: Claude Opus 5.5 --- lib/l10n/app_fr.arb | 2 +- lib/l10n/app_hi.arb | 2 +- lib/l10n/app_zh.arb | 2 +- lib/ui2/profile/alarm.dart | 16 ++++++++++------ test/ui2_alarm_test.dart | 30 ++++++++++++++++++++++++++++++ 5 files changed, 43 insertions(+), 9 deletions(-) diff --git a/lib/l10n/app_fr.arb b/lib/l10n/app_fr.arb index fdd2ab4b0..4d2a096d8 100644 --- a/lib/l10n/app_fr.arb +++ b/lib/l10n/app_fr.arb @@ -91,7 +91,7 @@ "alarmChangeTheTime": "Changer l’heure", "alarmTestTheBuzz": "Tester la vibration", "alarmCancelTheAlarm": "Annuler l’alarme", - "alarmBuzzingTheBand": "Vibration du bracelet", + "alarmBuzzingTheBand": "Vibration envoyée au bracelet", "alarmCancelled": "Alarme annulée", "alarmSentToBand": "Alarme envoyée au bracelet", "alarmInThePast": "Dans le passé — elle s’est déjà déclenchée ou a été manquée", diff --git a/lib/l10n/app_hi.arb b/lib/l10n/app_hi.arb index d72ac832a..aee73a723 100644 --- a/lib/l10n/app_hi.arb +++ b/lib/l10n/app_hi.arb @@ -91,7 +91,7 @@ "alarmChangeTheTime": "समय बदलें", "alarmTestTheBuzz": "बज़ का परीक्षण करें", "alarmCancelTheAlarm": "अलार्म रद्द करें", - "alarmBuzzingTheBand": "बैंड बज़ हो रहा है", + "alarmBuzzingTheBand": "बैंड को बज़ भेजा गया", "alarmCancelled": "अलार्म रद्द", "alarmSentToBand": "अलार्म बैंड पर भेजा गया", "alarmInThePast": "अतीत में — यह पहले ही बज चुका है या छूट गया है", diff --git a/lib/l10n/app_zh.arb b/lib/l10n/app_zh.arb index b7261524e..987e1ee27 100644 --- a/lib/l10n/app_zh.arb +++ b/lib/l10n/app_zh.arb @@ -91,7 +91,7 @@ "alarmChangeTheTime": "更改时间", "alarmTestTheBuzz": "测试振动", "alarmCancelTheAlarm": "取消闹钟", - "alarmBuzzingTheBand": "腕带振动中", + "alarmBuzzingTheBand": "已向腕带发送振动", "alarmCancelled": "闹钟已取消", "alarmSentToBand": "闹钟已发送到腕带", "alarmInThePast": "已过去——已响铃或已错过", diff --git a/lib/ui2/profile/alarm.dart b/lib/ui2/profile/alarm.dart index 190d3ea62..cf27f3235 100644 --- a/lib/ui2/profile/alarm.dart +++ b/lib/ui2/profile/alarm.dart @@ -444,12 +444,16 @@ class AlarmScreenView extends StatelessWidget { } } - /// Replaces whatever this screen said last instead of queueing behind it: - /// repeat taps would otherwise stack one 4-second snackbar each and keep an - /// old result on screen long after it stopped being true. - static void _say(BuildContext c, String msg) => ScaffoldMessenger.of(c) - ..hideCurrentSnackBar() - ..showSnackBar(SnackBar(content: Text(msg))); + /// Replaces what this screen said before, shown or still queued, instead of + /// stacking behind it: repeat taps would otherwise queue one 4-second + /// snackbar each and keep an old result on screen long after it stopped + /// being true. Only while this screen is on top — a result that lands after + /// the user moved on must not wipe another screen's message. + static void _say(BuildContext c, String msg) { + final messenger = ScaffoldMessenger.of(c); + if (ModalRoute.of(c)?.isCurrent ?? true) messenger.clearSnackBars(); + messenger.showSnackBar(SnackBar(content: Text(msg))); + } static String _hhmm(DateTime d) => _hhmmOf(d.hour, d.minute); diff --git a/test/ui2_alarm_test.dart b/test/ui2_alarm_test.dart index a6f1b5a13..b7aacd2d0 100644 --- a/test/ui2_alarm_test.dart +++ b/test/ui2_alarm_test.dart @@ -169,5 +169,35 @@ void main() { await t.pump(const Duration(seconds: 1)); expect(find.text('Buzz sent to the band'), findsNothing); }); + + testWidgets('a result that lands while the last one is leaving replaces it', + (t) async { + // Tap, let the message show, tap again (its exit starts), and tap a + // third time mid-exit: only the latest may follow, not a queue of two. + await t.pumpWidget(MaterialApp( + home: AlarmScreenView( + armedAt: DateTime(2026, 8, 23, 6, 30), + state: AlarmArmState.confirmed, + connected: true, + now: DateTime(2026, 8, 22, 9), + onTest: () async {}))); + final button = find.text('Test the buzz'); + await t.ensureVisible(button); + Future step(int ms) async { + for (var i = 0; i < ms ~/ 50; i++) { + await t.pump(const Duration(milliseconds: 50)); + } + } + + await t.tap(button); + await step(1000); + await t.tap(button); + await step(50); + await t.tap(button); + // One message's enter, 4 s on screen and exit, with a second of slack; + // a second queued message would still be showing here. + await step(6000); + expect(find.text('Buzz sent to the band'), findsNothing); + }); }); } From 2d7b678366f60fa16e7b806df760bcd3bcaf3b64 Mon Sep 17 00:00:00 2001 From: Mohammad Abdul Sahil <127765312+abdulsaheel@users.noreply.github.com> Date: Wed, 18 Nov 2026 21:38:25 +0530 Subject: [PATCH 3/3] alarm: leave hi and zh buzz strings to translators, check only one snackbar shows --- lib/l10n/app_hi.arb | 2 +- lib/l10n/app_zh.arb | 2 +- test/ui2_alarm_test.dart | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/l10n/app_hi.arb b/lib/l10n/app_hi.arb index aee73a723..d72ac832a 100644 --- a/lib/l10n/app_hi.arb +++ b/lib/l10n/app_hi.arb @@ -91,7 +91,7 @@ "alarmChangeTheTime": "समय बदलें", "alarmTestTheBuzz": "बज़ का परीक्षण करें", "alarmCancelTheAlarm": "अलार्म रद्द करें", - "alarmBuzzingTheBand": "बैंड को बज़ भेजा गया", + "alarmBuzzingTheBand": "बैंड बज़ हो रहा है", "alarmCancelled": "अलार्म रद्द", "alarmSentToBand": "अलार्म बैंड पर भेजा गया", "alarmInThePast": "अतीत में — यह पहले ही बज चुका है या छूट गया है", diff --git a/lib/l10n/app_zh.arb b/lib/l10n/app_zh.arb index 987e1ee27..b7261524e 100644 --- a/lib/l10n/app_zh.arb +++ b/lib/l10n/app_zh.arb @@ -91,7 +91,7 @@ "alarmChangeTheTime": "更改时间", "alarmTestTheBuzz": "测试振动", "alarmCancelTheAlarm": "取消闹钟", - "alarmBuzzingTheBand": "已向腕带发送振动", + "alarmBuzzingTheBand": "腕带振动中", "alarmCancelled": "闹钟已取消", "alarmSentToBand": "闹钟已发送到腕带", "alarmInThePast": "已过去——已响铃或已错过", diff --git a/test/ui2_alarm_test.dart b/test/ui2_alarm_test.dart index b7aacd2d0..260e8c479 100644 --- a/test/ui2_alarm_test.dart +++ b/test/ui2_alarm_test.dart @@ -194,6 +194,10 @@ void main() { await t.tap(button); await step(50); await t.tap(button); + await step(1000); + // The latest message is up, alone. + expect(find.byType(SnackBar), findsOneWidget); + expect(find.text('Buzz sent to the band'), findsOneWidget); // One message's enter, 4 s on screen and exit, with a second of slack; // a second queued message would still be showing here. await step(6000);