Skip to content

Commit

Permalink
🔧 Fix(notification.dart): Fix clicking twice to exit the application
Browse files Browse the repository at this point in the history
  • Loading branch information
Cranyozen committed Mar 31, 2024
1 parent f40c3fd commit 80e15c4
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions kitx_mobile/lib/services/notification.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:io';

import 'package:awesome_notifications/awesome_notifications.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
Expand Down Expand Up @@ -51,7 +53,13 @@ class NotificationService {
}
} else if (key == 'action_view_exit') {
// Exit app
SystemNavigator.pop(); // Probably not working on iOS (by Copilot)
instances.shutdownDevicesServer();

// Delete all notifications
AwesomeNotifications().cancelAll();

await SystemNavigator.pop(); // Probably not working on iOS (by Copilot)
exit(0);
}
}

Expand All @@ -74,12 +82,14 @@ class NotificationService {
NotificationActionButton(
key: 'action_view_button',
label: (serviceStatus == ServiceStatus.running) ? 'Public_Stop'.tr : 'Public_Launch'.tr,
actionType: ActionType.SilentAction,
actionType: ActionType.KeepOnTop,
autoDismissible: false,
),
NotificationActionButton(
key: 'action_view_exit',
label: 'Public_Quit'.tr,
actionType: ActionType.SilentAction,
autoDismissible: false,
),
]);
}
Expand Down

0 comments on commit 80e15c4

Please sign in to comment.