fix(splash): distinguish network errors from auth errors in session check

This commit is contained in:
2026-04-26 05:11:48 +02:00
parent d9465996d7
commit 516197b819
2 changed files with 7 additions and 6 deletions

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:sf_infrastructure/sf_infrastructure.dart';
import 'package:sf_shared/sf_shared.dart';
import 'package:shared_preferences/shared_preferences.dart';
@@ -28,6 +29,10 @@ class CheckSessionUseCaseImpl implements CheckSessionUseCase {
try {
await _userRepository.getUserInfo();
} catch (e) {
if (e is ApiException && e.isNetworkError) {
debugPrint('[CheckSession] network error, assuming valid session: $e');
return InitialRoute.home;
}
debugPrint('[CheckSession] no session: $e');
return InitialRoute.login;
}
@@ -40,7 +45,7 @@ class CheckSessionUseCaseImpl implements CheckSessionUseCase {
}
} catch (e) {
debugPrint('[CheckSession] devices check failed: $e');
return InitialRoute.deviceSetup;
return InitialRoute.home;
}
debugPrint('[CheckSession] → home');