mirror of
https://github.com/zapstore/zapstore.git
synced 2026-10-05 12:38:24 +00:00
fix: Refactor auto sign-out logic for Amber uninstallation
Reorganize the sign-out process to ensure the toast notification is displayed after a successful sign-out.
This commit is contained in:
+8
-11
@@ -112,21 +112,18 @@ class ZapstoreApp extends HookConsumerWidget {
|
||||
if (previous != true || isAmberInstalled) return;
|
||||
if (ref.read(Signer.activePubkeyProvider) == null) return;
|
||||
|
||||
unawaited(() async {
|
||||
try {
|
||||
await ref.read(amberSignerProvider).signOut();
|
||||
|
||||
final toastContext = rootNavigatorKey.currentState?.overlay?.context;
|
||||
if (toastContext != null && toastContext.mounted) {
|
||||
toastContext.showInfo('Amber was removed, you were signed out');
|
||||
}
|
||||
|
||||
unawaited(
|
||||
ref
|
||||
.read(amberSignerProvider)
|
||||
.signOut()
|
||||
.catchError(
|
||||
(Object error, StackTrace stackTrace) => debugPrint(
|
||||
'Auto sign-out after Amber uninstall failed: $error',
|
||||
),
|
||||
),
|
||||
);
|
||||
} catch (error) {
|
||||
debugPrint('Auto sign-out after Amber uninstall failed: $error');
|
||||
}
|
||||
}());
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user