From 90b0a43b44891024ce1aaabce67079cd16ce3f79 Mon Sep 17 00:00:00 2001 From: Sorunome Date: Fri, 30 Apr 2021 09:52:58 +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.yaml | 5 +---- 3 files changed, 7 insertions(+), 5 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..3b98f25b 100644 --- a/lib/utils/background_push.dart +++ b/lib/utils/background_push.dart @@ -318,6 +318,11 @@ class BackgroundPush { // make sure the endpoint is up-to-date etc. 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(); } } diff --git a/pubspec.yaml b/pubspec.yaml index 215b0b21..dd467ee4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -14,10 +14,7 @@ dependencies: git: url: https://gitlab.com/famedly/famedlysdk.git ref: main - unifiedpush: - git: - url: https://github.com/UnifiedPush/flutter-connector.git - ref: main + unifiedpush: ^1.0.2 fcm_shared_isolate: git: url: https://gitlab.com/famedly/libraries/fcm_shared_isolate.git