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:
Henrique Velloso
2026-02-20 17:55:52 -03:00
parent 8c4a499073
commit 4af716b206
+8 -11
View File
@@ -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');
}
}());
},
);