From 8f605c4b1cbcf8ea03d7b39f6475ca94f554eaa9 Mon Sep 17 00:00:00 2001 From: julian Date: Thu, 27 Jun 2024 15:07:01 -0600 Subject: [PATCH] https://github.com/cypherstack/stack_wallet/issues/317 --- lib/pages/wallet_view/wallet_view.dart | 60 +++++++++++++------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/lib/pages/wallet_view/wallet_view.dart b/lib/pages/wallet_view/wallet_view.dart index bfe2cb8c5..ea9ca50e4 100644 --- a/lib/pages/wallet_view/wallet_view.dart +++ b/lib/pages/wallet_view/wallet_view.dart @@ -80,7 +80,6 @@ import '../buy_view/buy_in_wallet_view.dart'; import '../cashfusion/cashfusion_view.dart'; import '../coin_control/coin_control_view.dart'; import '../exchange_view/wallet_initiated_exchange_view.dart'; -import '../home_view/home_view.dart'; import '../monkey/monkey_view.dart'; import '../notification_views/notifications_view.dart'; import '../ordinals/ordinals_view.dart'; @@ -257,40 +256,43 @@ class _WalletViewState extends ConsumerState { super.dispose(); } - DateTime? _cachedTime; + // DateTime? _cachedTime; Future _onWillPop() async { if (_rescanningOnOpen || _lelantusRescanRecovery) { return false; } - final now = DateTime.now(); - const timeout = Duration(milliseconds: 1500); - if (_cachedTime == null || now.difference(_cachedTime!) > timeout) { - _cachedTime = now; - unawaited( - showDialog( - context: context, - barrierDismissible: false, - builder: (_) => WillPopScope( - onWillPop: () async { - Navigator.of(context).popUntil( - ModalRoute.withName(HomeView.routeName), - ); - _logout(); - return false; - }, - child: const StackDialog(title: "Tap back again to exit wallet"), - ), - ).timeout( - timeout, - onTimeout: () => Navigator.of(context).popUntil( - ModalRoute.withName(WalletView.routeName), - ), - ), - ); - } - return false; + _logout(); + + return true; + // final now = DateTime.now(); + // const timeout = Duration(milliseconds: 1500); + // if (_cachedTime == null || now.difference(_cachedTime!) > timeout) { + // _cachedTime = now; + // unawaited( + // showDialog( + // context: context, + // barrierDismissible: false, + // builder: (_) => WillPopScope( + // onWillPop: () async { + // Navigator.of(context).popUntil( + // ModalRoute.withName(HomeView.routeName), + // ); + // _logout(); + // return false; + // }, + // child: const StackDialog(title: "Tap back again to exit wallet"), + // ), + // ).timeout( + // timeout, + // onTimeout: () => Navigator.of(context).popUntil( + // ModalRoute.withName(WalletView.routeName), + // ), + // ), + // ); + // } + // return false; } void _logout() async {