feat: 重构 Reminder Notification 系统并更新应用包名

This commit is contained in:
qzl
2026-03-30 18:36:57 +08:00
parent 9fb2a6857b
commit 91bf3c3f96
90 changed files with 5133 additions and 3017 deletions
+25
View File
@@ -39,6 +39,10 @@ class MemoryCacheStore implements CacheStore {
Future<void> remove(String key) async {
_values.remove(key);
}
Future<void> removeByPrefix(String prefix) async {
_values.removeWhere((key, _) => key.startsWith(prefix));
}
}
class SharedPrefsCacheStore implements CacheStore {
@@ -135,6 +139,18 @@ class PersistentCacheStore implements CacheStore {
final store = SharedPrefsCacheStore(prefs: prefs);
await store.remove(key);
}
Future<void> removeByPrefix(String prefix) async {
final prefs = await _getPrefs();
if (prefs == null) {
_fallbackValues.removeWhere((key, _) => key.startsWith(prefix));
return;
}
final targets = prefs.getKeys().where((key) => key.startsWith(prefix));
for (final key in targets) {
await prefs.remove(key);
}
}
}
class HybridCacheStore {
@@ -166,6 +182,15 @@ class HybridCacheStore {
await persistent.remove(key);
}
Future<void> clearByPrefix(String prefix) async {
if (memory is MemoryCacheStore) {
await (memory as MemoryCacheStore).removeByPrefix(prefix);
}
if (persistent is PersistentCacheStore) {
await (persistent as PersistentCacheStore).removeByPrefix(prefix);
}
}
Future<T> getOrLoad<T>(String key, {required Future<T> Function() loader}) {
final running = _inflight[key];
if (running != null) {