fix:参考金值,研听,研值工程通用通用工程公共能力,重点对比网络请求、登录认证、状态管理、本地存储、WebView、推送、版本更新、一键登录、主题/UI 等模块,确定后续统一整改方案

This commit is contained in:
jingyun committed 2026-09-10 09:52:36 +08:00
1 parent 6997a65c96
commit d364c6d908
46 files changed
+2060 -395

No files matched your search

@@ -0,0 +1,29 @@
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'storage_service.dart';
/// Typed boundary for non-sensitive preferences and display caches.
///
/// Feature code depends on this class instead of constructing or retaining a
/// [SharedPreferences] instance.
class PreferencesStorage {
const PreferencesStorage(this._preferences);
final SharedPreferences _preferences;
bool getBool(String key, {bool defaultValue = false}) =>
_preferences.getBool(key) ?? defaultValue;
String? getString(String key) => _preferences.getString(key);
bool containsKey(String key) => _preferences.containsKey(key);
Future<void> setBool(String key, bool value) =>
_preferences.setBool(key, value);
Future<void> setString(String key, String value) =>
_preferences.setString(key, value);
Future<void> remove(String key) => _preferences.remove(key);
}
final preferencesStorageProvider = Provider<PreferencesStorage>(
(ref) => PreferencesStorage(StorageService.to.preferences),
);