From aa3348e72e14dd3e5f966893f3b1d2ccf48f30e2 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Fri, 30 Apr 2021 16:59:26 +0200 Subject: [PATCH] chore: Update UP and automatically re-register UP on startup --- android/app/build.gradle | 2 +- lib/utils/background_push.dart | 5 +++++ pubspec.lock | 10 ++++------ pubspec.yaml | 5 +---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 8ca97b18..53a57da3 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -85,7 +85,7 @@ dependencies { androidTestImplementation 'androidx.test:runner:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' implementation "net.zetetic:android-database-sqlcipher:4.4.0" // needed for moor_ffi w/ sqlcipher - implementation 'com.github.UnifiedPush:android-connector:1.0.0-beta3' // needed for unifiedpush + implementation 'com.github.UnifiedPush:android-connector:1.1.0' // needed for unifiedpush } if(file("google-services.json").exists()){ diff --git a/lib/utils/background_push.dart b/lib/utils/background_push.dart index 2f56b7a7..9686c8ea 100644 --- a/lib/utils/background_push.dart +++ b/lib/utils/background_push.dart @@ -319,6 +319,11 @@ class BackgroundPush { await _newUpEndpoint( await store.getItem(SettingKeys.unifiedPushEndpoint)); } + + // re-register the app without a dialog. This should be safe, + // and allows recovering from app deletion in gotify, for instance + Logs().i('[Push] UnifiedPush registration found, re-registering'); + await UnifiedPush.registerApp(); } Future _onFcmMessage(Map message) async { diff --git a/pubspec.lock b/pubspec.lock index c13f3caa..174c5bdb 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1113,12 +1113,10 @@ packages: unifiedpush: dependency: "direct main" description: - path: "." - ref: main - resolved-ref: a75da94b9b6687abd24951579a13644ed2a62a28 - url: "https://github.com/UnifiedPush/flutter-connector.git" - source: git - version: "1.0.1" + name: unifiedpush + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" universal_html: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 14c40ce7..66f319af 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -65,10 +65,7 @@ dependencies: sqflite: ^2.0.0+3 # Still used to obtain the database location sqlite3: ^1.0.0 swipe_to_action: ^0.1.0 - unifiedpush: - git: - url: https://github.com/UnifiedPush/flutter-connector.git - ref: main + unifiedpush: ^1.0.2 universal_html: ^2.0.8 url_launcher: ^6.0.3