replaced account data singleton with a session model
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import '../model/account_data.dart';
|
||||
import '../session/session_manager.dart';
|
||||
import 'api_response.dart';
|
||||
import 'cache_store.dart';
|
||||
import 'errors/parse_exception.dart';
|
||||
@@ -47,7 +47,7 @@ abstract class RequestCache<T extends ApiResponse?> {
|
||||
static void ignore(Exception e) {}
|
||||
|
||||
Future<void> start(String document) async {
|
||||
final epoch = AccountData().sessionEpoch;
|
||||
final epoch = SessionManager().sessionEpoch;
|
||||
try {
|
||||
final entry = await CacheStore.instance.read(document);
|
||||
var lastUpdate = entry?.lastUpdate ?? 0;
|
||||
@@ -85,7 +85,7 @@ abstract class RequestCache<T extends ApiResponse?> {
|
||||
final newValue = await onLoad();
|
||||
// The cache is shared, so a late response of a signed-out
|
||||
// account would otherwise be cached for the next one.
|
||||
if (!AccountData().isCurrentSession(epoch)) {
|
||||
if (!SessionManager().isCurrentSession(epoch)) {
|
||||
onError(const StaleSessionException());
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user