Skip to content

Commit

Permalink
updates to immediately exit app after clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
atavism committed Oct 3, 2024
1 parent 100ee4b commit 8802cea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions lib/core/service/lantern_ffi_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@ class LanternFFI {
static String websocketAddr() =>
_lanternFFI.websocketAddr().cast<Utf8>().toDartString();

static void exit() {
_lanternFFI.exitApp();
//SystemChannels.platform.invokeMethod('SystemNavigator.pop');
}
static Future<void> exit() async => _lanternFFI.exitApp();

// Initialize the system proxy isolate
static Future<void> _initializeSystemProxyIsolate() async {
Expand Down Expand Up @@ -194,7 +191,8 @@ class LanternFFI {
}

static FutureOr<String> checkUpdates(dynamic args) async {
final updateUrl = await _lanternFFI.checkUpdates().cast<Utf8>().toDartString();
final updateUrl =
await _lanternFFI.checkUpdates().cast<Utf8>().toDartString();
checkAPIError(updateUrl, 'we_are_experiencing_technical_difficulties'.i18n);
return updateUrl;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/features/home/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class _HomePageState extends State<HomePage> 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);
},
Expand Down Expand Up @@ -252,7 +252,7 @@ class _HomePageState extends State<HomePage> with TrayListener, WindowListener {
label: 'exit'.i18n,
onClick: (item) async {
await trayManager.destroy();
LanternFFI.exit();
await LanternFFI.exit();
// Exit app immediately after cleanup
exit(0);
}),
Expand Down

0 comments on commit 8802cea

Please sign in to comment.