bugfixes, better background operation robustness and platform-specific error handling

This commit is contained in:
2026-07-12 19:17:49 +02:00
parent babc347b18
commit a7111844b1
6 changed files with 41 additions and 21 deletions
@@ -36,7 +36,15 @@ class MarianumConnectAuthInterceptor extends Interceptor {
// Token mitschicken statt ein eigenes 401 einzufangen.
final pending = _pendingReLogin;
if (pending != null) await pending;
final token = await _tokenStorage.readToken();
// Reading the keystore can throw while the device is locked (iOS
// errSecInteractionNotAllowed on background requests). Degrade to an
// unauthenticated request instead of surfacing a platform error.
String? token;
try {
token = await _tokenStorage.readToken();
} catch (_) {
token = null;
}
if (token != null && token.isNotEmpty) {
options.headers['Authorization'] = 'Bearer $token';
}