Add removable mock mode for a clickable preview
Runs the whole app on seeded in-memory data with no backend or device storage, behind useMockData in lib/Grounded/mock/MockSwitch.dart. To remove: delete lib/Grounded/mock/ and the lines tagged "MOCK:" in ParentViewModel (or revert this commit, keeping the notification guard). Also skips local notifications on web, where the plugin and dart:io Platform both throw. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KhQh614DMeYoQEH9SoMRUw
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
|
||||
import '../about/external/data/Commitment.dart';
|
||||
@@ -32,7 +33,7 @@ class LocalNotificationEngine {
|
||||
static bool _ready = false;
|
||||
|
||||
static Future<void> init() async {
|
||||
if (_ready) {
|
||||
if (_ready || kIsWeb) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -105,6 +106,10 @@ class LocalNotificationEngine {
|
||||
/// The ongoing notification for a running task. Shows the live remaining
|
||||
/// time so it is useful from the lock screen without unlocking.
|
||||
static Future<void> showSessionNotification(LiveSession session) async {
|
||||
// The browser has no notification channels; the runner works without.
|
||||
if (kIsWeb) {
|
||||
return;
|
||||
}
|
||||
await init();
|
||||
|
||||
final String remaining = session.requiredSeconds > 0
|
||||
@@ -144,6 +149,10 @@ class LocalNotificationEngine {
|
||||
}
|
||||
|
||||
static Future<void> cancelSessionNotification() async {
|
||||
// The browser has no notification channels; the runner works without.
|
||||
if (kIsWeb) {
|
||||
return;
|
||||
}
|
||||
await init();
|
||||
await plugin.cancel(id: sessionNotificationId);
|
||||
}
|
||||
@@ -156,6 +165,9 @@ class LocalNotificationEngine {
|
||||
EscalationTier tier,
|
||||
ToneLevel tone,
|
||||
) async {
|
||||
if (kIsWeb) {
|
||||
return;
|
||||
}
|
||||
await init();
|
||||
|
||||
final bool nonNegotiable =
|
||||
@@ -198,6 +210,10 @@ class LocalNotificationEngine {
|
||||
}
|
||||
|
||||
static Future<void> cancelAll() async {
|
||||
// The browser has no notification channels; the runner works without.
|
||||
if (kIsWeb) {
|
||||
return;
|
||||
}
|
||||
await init();
|
||||
await plugin.cancelAll();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user