added support for multiple accounts, guardian login bugfixes, ui changes

This commit is contained in:
2026-09-23 20:50:12 +02:00
parent 630497abdd
commit 84098af7e2
37 changed files with 1759 additions and 376 deletions
@@ -20,6 +20,15 @@ class MarianumConnectAuthInterceptor extends Interceptor {
// each spawning a fresh row in api_tokens.
Future<bool>? _pendingReLogin;
static Future<bool>? _anyPendingReLogin;
/// Resolves once no silent re-login is running. An account switch waits for
/// it — the renewed token would otherwise land in the next account's slot.
static Future<void> idle() async {
final pending = _anyPendingReLogin;
if (pending != null) await pending;
}
MarianumConnectAuthInterceptor({
MarianumConnectTokenStorage tokenStorage =
const MarianumConnectTokenStorage(),
@@ -85,8 +94,10 @@ class MarianumConnectAuthInterceptor extends Interceptor {
if (inFlight != null) return inFlight;
final fresh = _performReLogin();
_pendingReLogin = fresh;
_anyPendingReLogin = fresh;
fresh.whenComplete(() {
if (identical(_pendingReLogin, fresh)) _pendingReLogin = null;
if (identical(_anyPendingReLogin, fresh)) _anyPendingReLogin = null;
});
return fresh;
}