From 4af716b206d5b328a57e4170eeea248506a56018 Mon Sep 17 00:00:00 2001 From: Henrique Velloso Date: Fri, 20 Feb 2026 17:55:52 -0300 Subject: [PATCH] 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. --- lib/main.dart | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index c6c1bb1..1b3671f 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -112,21 +112,18 @@ class ZapstoreApp extends HookConsumerWidget { if (previous != true || isAmberInstalled) return; if (ref.read(Signer.activePubkeyProvider) == null) return; - final toastContext = rootNavigatorKey.currentState?.overlay?.context; - if (toastContext != null && toastContext.mounted) { - toastContext.showInfo('Amber was removed, you were signed out'); - } + unawaited(() async { + try { + await ref.read(amberSignerProvider).signOut(); - unawaited( - ref - .read(amberSignerProvider) - .signOut() - .catchError( - (Object error, StackTrace stackTrace) => debugPrint( - 'Auto sign-out after Amber uninstall failed: $error', - ), - ), - ); + final toastContext = rootNavigatorKey.currentState?.overlay?.context; + if (toastContext != null && toastContext.mounted) { + toastContext.showInfo('Amber was removed, you were signed out'); + } + } catch (error) { + debugPrint('Auto sign-out after Amber uninstall failed: $error'); + } + }()); }, );