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:
alvocool
2026-11-02 08:45:41 +03:00
parent 1a5867a98f
commit b31bc47cc0
7 changed files with 860 additions and 2 deletions

View File

@@ -0,0 +1,55 @@
// MOCK DATA — TEMPORARY. See MockSwitch.dart.
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
/// Secure storage held in memory, so mock mode never touches the keychain or
/// browser storage. Seeded as signed in.
class MockStorage extends FlutterSecureStorage {
static final Map<String, String> _values = <String, String>{};
const MockStorage();
@override
Future<String?> read({
required String key,
AppleOptions? iOptions,
AndroidOptions? aOptions,
LinuxOptions? lOptions,
WebOptions? webOptions,
AppleOptions? mOptions,
WindowsOptions? wOptions,
}) async {
return _values[key];
}
@override
Future<void> write({
required String key,
required String? value,
AppleOptions? iOptions,
AndroidOptions? aOptions,
LinuxOptions? lOptions,
WebOptions? webOptions,
AppleOptions? mOptions,
WindowsOptions? wOptions,
}) async {
if (value == null) {
_values.remove(key);
return;
}
_values[key] = value;
}
@override
Future<void> delete({
required String key,
AppleOptions? iOptions,
AndroidOptions? aOptions,
LinuxOptions? lOptions,
WebOptions? webOptions,
AppleOptions? mOptions,
WindowsOptions? wOptions,
}) async {
_values.remove(key);
}
}