More background refreshing

This commit is contained in:
2024-06-15 16:33:30 +02:00
parent 35ab9a26c0
commit eea219a205
8 changed files with 180 additions and 128 deletions

View File

@@ -118,7 +118,6 @@ class AppAuth extends ChangeNotifier implements TokenSource {
final user = await APIClient.getUser(this, _userID!);
_user = user;
notifyListeners();
await save();
@@ -142,14 +141,12 @@ class AppAuth extends ChangeNotifier implements TokenSource {
final client = await APIClient.getClient(this, _clientID!);
_client = client;
notifyListeners();
await save();
return client;
} on APIException catch (_) {
_client = null;
notifyListeners();
return null;
} catch (exc) {
_client = null;

View File

@@ -5,6 +5,8 @@ import 'package:xid/xid.dart';
part 'application_log.g.dart';
class ApplicationLog {
//TODO max size, auto clear old
static void debug(String message, {String? additional, StackTrace? trace}) {
(additional != null && additional != '') ? print('[DEBUG] ${message}: ${additional}') : print('[DEBUG] ${message}');

View File

@@ -6,6 +6,8 @@ import 'package:xid/xid.dart';
part 'request_log.g.dart';
class RequestLog {
//TODO max size, auto clear old
static void addRequestException(String name, DateTime tStart, String method, Uri uri, String reqbody, Map<String, String> reqheaders, dynamic e, StackTrace trace) {
Hive.box<SCNRequest>('scn-requests').add(SCNRequest(
id: Xid().toString(),