mirror of
https://github.com/immich-app/immich.git
synced 2025-07-31 15:08:44 -04:00
feat: don't wait for network on app startup (#20232)
This commit is contained in:
parent
7f2e4f85f8
commit
2e0ee6ec05
@ -42,30 +42,22 @@ class SplashScreenPageState extends ConsumerState<SplashScreenPage> {
|
|||||||
final endpoint = Store.tryGet(StoreKey.serverEndpoint);
|
final endpoint = Store.tryGet(StoreKey.serverEndpoint);
|
||||||
final accessToken = Store.tryGet(StoreKey.accessToken);
|
final accessToken = Store.tryGet(StoreKey.accessToken);
|
||||||
|
|
||||||
bool isAuthSuccess = false;
|
|
||||||
|
|
||||||
if (accessToken != null && serverUrl != null && endpoint != null) {
|
if (accessToken != null && serverUrl != null && endpoint != null) {
|
||||||
try {
|
ref.read(authProvider.notifier).saveAuthInfo(accessToken: accessToken).then(
|
||||||
isAuthSuccess = await ref.read(authProvider.notifier).saveAuthInfo(
|
(a) => {
|
||||||
accessToken: accessToken,
|
log.info('Successfully updated auth info with access token: $accessToken'),
|
||||||
);
|
},
|
||||||
} catch (error, stackTrace) {
|
onError: (exception) => {
|
||||||
log.severe(
|
log.severe(
|
||||||
'Cannot set success login info',
|
'Failed to update auth info with access token: $accessToken',
|
||||||
error,
|
),
|
||||||
stackTrace,
|
ref.read(authProvider.notifier).logout(),
|
||||||
);
|
context.replaceRoute(const LoginRoute()),
|
||||||
}
|
},
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
isAuthSuccess = false;
|
|
||||||
log.severe(
|
log.severe(
|
||||||
'Missing authentication, server, or endpoint info from the local store',
|
'Missing crucial offline login info - Logging out completely',
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isAuthSuccess) {
|
|
||||||
log.severe(
|
|
||||||
'Unable to login using offline or online methods - Logging out completely',
|
|
||||||
);
|
);
|
||||||
ref.read(authProvider.notifier).logout();
|
ref.read(authProvider.notifier).logout();
|
||||||
context.replaceRoute(const LoginRoute());
|
context.replaceRoute(const LoginRoute());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user