From 8802ceab6d54c1ad30b00ef1b8b299646dfaf44e Mon Sep 17 00:00:00 2001 From: atavism Date: Thu, 3 Oct 2024 07:22:39 -0700 Subject: [PATCH] updates to immediately exit app after clean-up --- lib/core/service/lantern_ffi_service.dart | 8 +++----- lib/features/home/home.dart | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/core/service/lantern_ffi_service.dart b/lib/core/service/lantern_ffi_service.dart index 36afc75cd..29308ac96 100644 --- a/lib/core/service/lantern_ffi_service.dart +++ b/lib/core/service/lantern_ffi_service.dart @@ -63,10 +63,7 @@ class LanternFFI { static String websocketAddr() => _lanternFFI.websocketAddr().cast().toDartString(); - static void exit() { - _lanternFFI.exitApp(); - //SystemChannels.platform.invokeMethod('SystemNavigator.pop'); - } + static Future exit() async => _lanternFFI.exitApp(); // Initialize the system proxy isolate static Future _initializeSystemProxyIsolate() async { @@ -194,7 +191,8 @@ class LanternFFI { } static FutureOr checkUpdates(dynamic args) async { - final updateUrl = await _lanternFFI.checkUpdates().cast().toDartString(); + final updateUrl = + await _lanternFFI.checkUpdates().cast().toDartString(); checkAPIError(updateUrl, 'we_are_experiencing_technical_difficulties'.i18n); return updateUrl; } diff --git a/lib/features/home/home.dart b/lib/features/home/home.dart index b05b188dc..8f67a4a1e 100644 --- a/lib/features/home/home.dart +++ b/lib/features/home/home.dart @@ -202,7 +202,7 @@ class _HomePageState extends State with TrayListener, WindowListener { onPressed: () async { Navigator.of(context).pop(); // clean up FFI and system tray - LanternFFI.exit(); + await LanternFFI.exit(); await trayManager.destroy(); exit(0); }, @@ -252,7 +252,7 @@ class _HomePageState extends State with TrayListener, WindowListener { label: 'exit'.i18n, onClick: (item) async { await trayManager.destroy(); - LanternFFI.exit(); + await LanternFFI.exit(); // Exit app immediately after cleanup exit(0); }),