From 22a03792020e522cd615ae8bd719d6955f86bee8 Mon Sep 17 00:00:00 2001 From: Jonas Bark Date: Fri, 17 Oct 2025 09:41:33 +0200 Subject: [PATCH] revise restart mechanism, fix Android 'Exit' notification button issue --- ios/Podfile.lock | 6 ------ lib/utils/requirements/android.dart | 1 - lib/widgets/title.dart | 21 ++++++++++++--------- pubspec.lock | 19 ++++++------------- pubspec.yaml | 18 ++++++++++-------- 5 files changed, 28 insertions(+), 37 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 38e5fce..234dd09 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -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 diff --git a/lib/utils/requirements/android.dart b/lib/utils/requirements/android.dart index d11b02d..00373a0 100644 --- a/lib/utils/requirements/android.dart +++ b/lib/utils/requirements/android.dart @@ -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); }); diff --git a/lib/widgets/title.dart b/lib/widgets/title.dart index c041d78..8703319 100755 --- a/lib/widgets/title.dart +++ b/lib/widgets/title.dart @@ -198,15 +198,18 @@ class _AppTitleState extends State { 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); + } + }, + ), ), ); } diff --git a/pubspec.lock b/pubspec.lock index 1d2a5ad..e19fb9e 100755 --- a/pubspec.lock +++ b/pubspec.lock @@ -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: diff --git a/pubspec.yaml b/pubspec.yaml index cef2811..4f513c4 100755 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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