mirror of
https://github.com/jonasbark/swiftcontrol.git
synced 2026-11-30 01:34:57 +01:00
The right puck switches itself off after a minute of not being used. BikeControl now prevents that on its own, with no button to press. The sequence lives in prop; this side supplies what only it knows and shows the rider the one case they can fix. - the gate reads raw adverts, not the device list: the sibling only has to be nearby, and a left puck the rider ignored — every left puck in right-side-only mode — still counts. Discovery is also the retrigger, since an ignored puck never completes a handshake - an optional step on the controller card, and a note on the right puck's own card, when no left puck is in range. An offer, never a blocker - drops the D-pad line from "use the right side only" Fixes a related bug: the controller link counted every undone step, optional or not, so an optional offer alone turned a working controller amber and held back "Ready to ride". The other two links already excluded optional steps. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
34 lines
1.2 KiB
Dart
34 lines
1.2 KiB
Dart
import 'package:bike_control/utils/i18n_extension.dart';
|
|
import 'package:bike_control/widgets/ui/warning.dart';
|
|
import 'package:prop/prop.dart';
|
|
import 'package:shadcn_flutter/shadcn_flutter.dart';
|
|
|
|
/// Tells the rider why their right puck is still going to power itself off.
|
|
///
|
|
/// Keeping it awake needs both pucks on the air once. When only the right one
|
|
/// is connected there is nothing the app can do about it, and nothing on the
|
|
/// card would otherwise say so — the puck simply switches off a minute later
|
|
/// and looks broken. Shown only in that state; the moment the left puck
|
|
/// connects the sequence runs and this goes away on its own.
|
|
class ClickV2KeepAwakeWarning extends StatelessWidget {
|
|
const ClickV2KeepAwakeWarning({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ValueListenableBuilder<ClickKeepAwakeStatus>(
|
|
valueListenable: ClickLogic.keepAwakeStatus,
|
|
builder: (context, status, _) {
|
|
if (status != ClickKeepAwakeStatus.waitingForLeftSide) {
|
|
return const SizedBox.shrink();
|
|
}
|
|
return Warning(
|
|
important: false,
|
|
children: [
|
|
Text(context.i18n.clickV2_keepAwakeNeedsLeftSide).xSmall,
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|