mirror of
https://github.com/immich-app/immich.git
synced 2026-01-26 19:34:18 -08:00
Compare commits
1 Commits
chore/tran
...
chore/add-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea5c24ea7b |
@@ -45,6 +45,7 @@ class SplashScreenPageState extends ConsumerState<SplashScreenPage> {
|
||||
}
|
||||
|
||||
void resumeSession() async {
|
||||
log.fine("Resuming previous session if possible...");
|
||||
final serverUrl = Store.tryGet(StoreKey.serverUrl);
|
||||
final endpoint = Store.tryGet(StoreKey.serverEndpoint);
|
||||
final accessToken = Store.tryGet(StoreKey.accessToken);
|
||||
@@ -58,6 +59,7 @@ class SplashScreenPageState extends ConsumerState<SplashScreenPage> {
|
||||
unawaited(
|
||||
ref.read(authProvider.notifier).saveAuthInfo(accessToken: accessToken).then(
|
||||
(_) async {
|
||||
log.fine("Successfully updated auth info with stored access token");
|
||||
try {
|
||||
wsProvider.connect();
|
||||
unawaited(infoProvider.getServerInfo());
|
||||
@@ -114,6 +116,7 @@ class SplashScreenPageState extends ConsumerState<SplashScreenPage> {
|
||||
return;
|
||||
}
|
||||
|
||||
log.fine("Navigating to main application...");
|
||||
unawaited(context.replaceRoute(Store.isBetaTimelineEnabled ? const TabShellRoute() : const TabControllerRoute()));
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@ import 'package:immich_mobile/providers/api.provider.dart';
|
||||
import 'package:immich_mobile/providers/infrastructure/user.provider.dart';
|
||||
import 'package:immich_mobile/services/api.service.dart';
|
||||
import 'package:immich_mobile/services/auth.service.dart';
|
||||
import 'package:immich_mobile/services/background_upload.service.dart';
|
||||
import 'package:immich_mobile/services/foreground_upload.service.dart';
|
||||
import 'package:immich_mobile/services/secure_storage.service.dart';
|
||||
import 'package:immich_mobile/services/background_upload.service.dart';
|
||||
import 'package:immich_mobile/services/widget.service.dart';
|
||||
import 'package:immich_mobile/utils/debug_print.dart';
|
||||
import 'package:immich_mobile/utils/hash.dart';
|
||||
@@ -123,6 +123,7 @@ class AuthNotifier extends StateNotifier<AuthState> {
|
||||
}
|
||||
|
||||
Future<bool> saveAuthInfo({required String accessToken}) async {
|
||||
_log.fine("Saving authentication information...");
|
||||
await _apiService.setAccessToken(accessToken);
|
||||
|
||||
final serverEndpoint = Store.get(StoreKey.serverEndpoint);
|
||||
@@ -132,13 +133,16 @@ class AuthNotifier extends StateNotifier<AuthState> {
|
||||
// Get the deviceid from the store if it exists, otherwise generate a new one
|
||||
String deviceId = Store.tryGet(StoreKey.deviceId) ?? await FlutterUdid.consistentUdid;
|
||||
|
||||
_log.fine("Fetching stored user information");
|
||||
UserDto? user = _userService.tryGetMyUser();
|
||||
|
||||
try {
|
||||
_log.fine("Fetching user information from server");
|
||||
final serverUser = await _userService.refreshMyUser().timeout(_timeoutDuration);
|
||||
if (serverUser == null) {
|
||||
_log.severe("Unable to get user information from the server.");
|
||||
} else {
|
||||
_log.fine("Successfully fetched user information from server");
|
||||
// If the user information is successfully retrieved, update the store
|
||||
// Due to the flow of the code, this will always happen on first login
|
||||
user = serverUser;
|
||||
|
||||
Reference in New Issue
Block a user