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
+11 -14
View File
@@ -112,21 +112,18 @@ class ZapstoreApp extends HookConsumerWidget {
if (previous != true || isAmberInstalled) return; if (previous != true || isAmberInstalled) return;
if (ref.read(Signer.activePubkeyProvider) == null) return; if (ref.read(Signer.activePubkeyProvider) == null) return;
final toastContext = rootNavigatorKey.currentState?.overlay?.context; unawaited(() async {
if (toastContext != null && toastContext.mounted) { try {
toastContext.showInfo('Amber was removed, you were signed out'); await ref.read(amberSignerProvider).signOut();
}
unawaited( final toastContext = rootNavigatorKey.currentState?.overlay?.context;
ref if (toastContext != null && toastContext.mounted) {
.read(amberSignerProvider) toastContext.showInfo('Amber was removed, you were signed out');
.signOut() }
.catchError( } catch (error) {
(Object error, StackTrace stackTrace) => debugPrint( debugPrint('Auto sign-out after Amber uninstall failed: $error');
'Auto sign-out after Amber uninstall failed: $error', }
), }());
),
);
}, },
); );