mirror of
https://github.com/kuhyx/wake-alarm.git
synced 2026-11-11 21:34:07 +01:00
Dart side of the alarm (items 1, 4, 3). main.dart had no init seam at all; it now has ensureInitialized(), a navigatorKey and a /ring route. - challenge.dart: all five kinds ported from _challenges.py so both halves behave identically. kDismissCodeLength/kDismissFlashSeconds are duplicated from _constants.py, not synced — noted in the file, since Dart cannot read Python. - alarm_scheduler.dart: the Dart side of the single MethodChannel. - ring_screen.dart: room proof first, then a challenge, then dismiss. Back is a no-op (PopScope) so the alarm cannot be escaped. - room_proof.dart: NFC or QR satisfies on its own; steps NEVER do alone — the phone is stationary while you walk to it, so steps only accrue after pickup and can be faked by shaking it in bed. Steps count only together with elapsed time, as the fallback when both others fail. - home_screen: arms the app's own alarm instead of asking the user to confirm in the Clock app (item 1's "no user interaction"). SET_ALARM stays as redundancy with SKIP_UI=true. Re-arm has three hooks and needs all three: startup, BOOT_COMPLETED, and dismiss. The plan assumed LogStore.changes would cover this; that stream does not exist in crdt_sync_dart (verified — the library has no Stream at all), so the picker's save is only one hook and a restart would otherwise arm nothing. Fixed a real gap the API 36 AVD exposed: POST_NOTIFICATIONS was never requested at runtime, so a fresh install sat at importance=NONE and the full-screen intent was rejected outright — the alarm would ring with no dismiss screen. MainActivity now requests it, and canUseFullScreenIntent() also checks areNotificationsEnabled() so the check gates rather than warns. Verified on the API 36 AVD: screen Asleep -> Awake, AlarmActivity became the top resumed activity over the lockscreen, service isForeground=true types=0x2 (mediaPlayback) category=alarm, no crash. flutter test: 54 pass. dart analyze: clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EckWmyfetYq3Mi8MAnUudh
24 lines
734 B
Dart
24 lines
734 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:wake_alarm_sync/services/alarm_scheduler.dart';
|
|
|
|
/// Debug entrypoint that starts the ring immediately on launch.
|
|
///
|
|
/// Used to exercise the Kotlin foreground-service and full-screen-intent path
|
|
/// on an emulator, where the normal flow needs a sync backend first. Not part
|
|
/// of the shipped app: `flutter build apk` uses `lib/main.dart`.
|
|
Future<void> main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
await AlarmScheduler().ringNow();
|
|
runApp(const _Probe());
|
|
}
|
|
|
|
class _Probe extends StatelessWidget {
|
|
const _Probe();
|
|
|
|
@override
|
|
Widget build(BuildContext context) => const MaterialApp(
|
|
home: Scaffold(body: Center(child: Text('ring probe'))),
|
|
);
|
|
}
|