revise restart mechanism, fix Android 'Exit' notification button issue

This commit is contained in:
Jonas Bark
2025-10-17 09:41:33 +02:00
parent c06a426490
commit 22a0379202
5 changed files with 28 additions and 37 deletions

View File

@@ -13,8 +13,6 @@ PODS:
- Flutter
- permission_handler_apple (9.3.0):
- Flutter
- restart (1.0.0):
- Flutter
- restart_app (0.0.1):
- Flutter
- shared_preferences_foundation (0.0.1):
@@ -36,7 +34,6 @@ DEPENDENCIES:
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- restart (from `.symlinks/plugins/restart/ios`)
- restart_app (from `.symlinks/plugins/restart_app/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- universal_ble (from `.symlinks/plugins/universal_ble/darwin`)
@@ -58,8 +55,6 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/package_info_plus/ios"
permission_handler_apple:
:path: ".symlinks/plugins/permission_handler_apple/ios"
restart:
:path: ".symlinks/plugins/restart/ios"
restart_app:
:path: ".symlinks/plugins/restart_app/ios"
shared_preferences_foundation:
@@ -79,7 +74,6 @@ SPEC CHECKSUMS:
image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1
package_info_plus: c0502532a26c7662a62a356cebe2692ec5fe4ec4
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
restart: b5fe16e6e038f0024b2f3af43768e9d2a1557554
restart_app: 806659942bf932f6ce51c5372f91ce5e81c8c14a
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
universal_ble: cf52a7b3fd2e7c14d6d7262e9fdadb72ab6b88a6

View File

@@ -164,7 +164,6 @@ class NotificationRequirement extends PlatformRequirement {
@pragma('vm:entry-point')
void notificationTapBackground(NotificationResponse notificationResponse) {
if (notificationResponse.actionId != null) {
connection.reset();
AndroidFlutterLocalNotificationsPlugin().stopForegroundService().then((_) {
exit(0);
});

View File

@@ -198,15 +198,18 @@ class _AppTitleState extends State<AppTitle> {
SnackBar(
content: Text('Restart the app to use the new version'),
duration: Duration(seconds: 10),
action: Platform.isIOS || Platform.isAndroid
? SnackBarAction(
label: 'Restart',
onPressed: () {
connection.reset();
Restart.restartApp();
},
)
: null,
action: SnackBarAction(
label: 'Restart',
onPressed: () {
if (Platform.isIOS || Platform.isAndroid) {
connection.reset();
Restart.restartApp(delayBeforeRestart: 1000);
} else {
connection.reset();
exit(0);
}
},
),
),
);
}

View File

@@ -731,22 +731,15 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.2.0"
restart:
dependency: "direct main"
description:
name: restart
sha256: "70c12d26900b7c451b99eb012dea7b0d5f229f93e705c3915df41c5ddd0b97cd"
url: "https://pub.dev"
source: hosted
version: "1.0.0+1"
restart_app:
dependency: "direct main"
description:
name: restart_app
sha256: "00d5ec3e9de871cedbe552fc41e615b042b5ec654385e090e0983f6d02f655ed"
url: "https://pub.dev"
source: hosted
version: "1.3.2"
path: "."
ref: "feature/resolve-all-open-issues"
resolved-ref: de208e0d393812f1a6edb0a20cef7fb49cec957c
url: "https://github.com/maple135790/restart_app.git"
source: git
version: "1.4.0"
screen_retriever:
dependency: transitive
description:

View File

@@ -12,7 +12,12 @@ dependencies:
url_launcher: ^6.3.1
flutter_local_notifications: ^19.4.1
universal_ble: ^0.21.1
# fork to allow iOS background BLE connections
universal_ble:
git:
url: https://github.com/jonasbark/universal_ble.git
intl: any
version: ^3.0.0
bluetooth_low_energy: ^6.1.0
@@ -33,17 +38,14 @@ dependencies:
# shorebird related
shorebird_code_push: ^2.0.5
restart_app: ^1.3.2
restart: ^1.0.0+1
restart_app:
git:
url: https://github.com/maple135790/restart_app.git
ref: feature/resolve-all-open-issues
package_info_plus: ^9.0.0
in_app_update: ^4.2.5
http: ^1.3.0
dependency_overrides:
universal_ble:
git:
url: https://github.com/jonasbark/universal_ble.git
dev_dependencies:
flutter_test:
sdk: flutter