Update Saqel Platform: 2026-09-08 17:51:07

This commit is contained in:
Hamza-Ayed
2026-09-08 17:51:07 +03:00
parent 902cf00152
commit 75451ebc3f
12 changed files with 84 additions and 39 deletions
@@ -4,6 +4,7 @@ import '../utils/app_logger.dart';
/// Ultra-Resilient Storage Service for Teacher Studio
class StorageService {
static final Map<String, String> _volatileStore = <String, String>{};
final FlutterSecureStorage _secureStorage;
StorageService({FlutterSecureStorage? secureStorage})
@@ -21,6 +22,7 @@ class StorageService {
static const String _keyUser = 'saqel_teacher_user_data';
Future<void> _writeSafe(String key, String value) async {
_volatileStore[key] = value;
try {
await _secureStorage.write(key: key, value: value);
} on PlatformException catch (e) {
@@ -34,13 +36,15 @@ class StorageService {
if (val != null && val.isNotEmpty) return val;
} catch (_) {}
return null;
return _volatileStore[key];
}
Future<void> saveToken(String token) async => await _writeSafe(_keyToken, token);
Future<String?> getToken() async => await _readSafe(_keyToken);
Future<void> clearSession() async {
_volatileStore.remove(_keyToken);
_volatileStore.remove(_keyUser);
try {
await _secureStorage.delete(key: _keyToken);
await _secureStorage.delete(key: _keyUser);