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,26 @@
// MOCK DATA — TEMPORARY. See MockSwitch.dart.
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import '../about/internal/application/MeDescription.dart';
import '../about/internal/application/UserDetails.dart';
import '../memory/InternalMemory.dart';
import 'MockStorage.dart';
/// The real [InternalMemory], pointed at in-memory storage and pre-seeded
/// with a signed-in user so the app opens straight onto Home.
class MockMemory extends InternalMemory {
static bool _seeded = false;
MockMemory() {
if (!_seeded) {
_seeded = true;
setMyDescription(
MeDescription(id: "mock-user", name: "Alex", token: "mock-token"));
setUserDetails(UserDetails(pic: "", name: "Alex"));
}
}
@override
FlutterSecureStorage get groundedStorage => const MockStorage();
}