diff --git a/vector/build.gradle b/vector/build.gradle index d270e571f8..a8a42ba83f 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -444,8 +444,9 @@ dependencies { implementation "com.google.dagger:dagger:$daggerVersion" kapt "com.google.dagger:dagger-compiler:$daggerVersion" - // Unifiedpush - implementation 'com.github.UnifiedPush:android-connector:1.1.3' + // UnifiedPush + implementation 'com.github.UnifiedPush:android-connector:1.2.0' + // UnifiedPush gplay flavor only gplayImplementation 'com.github.UnifiedPush:android-embedded_fcm_distributor:1.1.0' // OSS License, gplay flavor only diff --git a/vector/src/fdroid/java/im/vector/app/push/fcm/NotificationTroubleshootTestManagerFactory.kt b/vector/src/fdroid/java/im/vector/app/push/fcm/NotificationTroubleshootTestManagerFactory.kt index 4a73457c01..56c96f5b2b 100644 --- a/vector/src/fdroid/java/im/vector/app/push/fcm/NotificationTroubleshootTestManagerFactory.kt +++ b/vector/src/fdroid/java/im/vector/app/push/fcm/NotificationTroubleshootTestManagerFactory.kt @@ -35,7 +35,6 @@ class NotificationTroubleshootTestManagerFactory @Inject constructor( private val testSystemSettings: TestSystemSettings, private val testAccountSettings: TestAccountSettings, private val testDeviceSettings: TestDeviceSettings, - private val testBingRulesSettings: TestPushRulesSettings, private val testNewEndpoint: TestNewEndpoint, private val testTokenRegistration: TestTokenRegistration, private val testPushFromPushGateway: TestPushFromPushGateway, @@ -51,13 +50,12 @@ class NotificationTroubleshootTestManagerFactory @Inject constructor( mgr.addTest(testSystemSettings) mgr.addTest(testAccountSettings) mgr.addTest(testDeviceSettings) + mgr.addTest(testPushRulesSettings) if (UPHelper.distributorExists(fragment.requireContext())) { - mgr.addTest(testBingRulesSettings) mgr.addTest(testNewEndpoint) mgr.addTest(testTokenRegistration) mgr.addTest(testPushFromPushGateway) } else { - mgr.addTest(testPushRulesSettings) mgr.addTest(testAutoStartBoot) mgr.addTest(testBackgroundRestrictions) mgr.addTest(testBatteryOptimization) diff --git a/vector/src/gplay/java/im/vector/app/push/fcm/NotificationTroubleshootTestManagerFactory.kt b/vector/src/gplay/java/im/vector/app/push/fcm/NotificationTroubleshootTestManagerFactory.kt index 36afcb28f3..673733d452 100644 --- a/vector/src/gplay/java/im/vector/app/push/fcm/NotificationTroubleshootTestManagerFactory.kt +++ b/vector/src/gplay/java/im/vector/app/push/fcm/NotificationTroubleshootTestManagerFactory.kt @@ -36,7 +36,6 @@ class NotificationTroubleshootTestManagerFactory @Inject constructor( private val testSystemSettings: TestSystemSettings, private val testAccountSettings: TestAccountSettings, private val testDeviceSettings: TestDeviceSettings, - private val testBingRulesSettings: TestPushRulesSettings, private val testPlayServices: TestPlayServices, private val testNewEndpoint: TestNewEndpoint, private val testTokenRegistration: TestTokenRegistration, @@ -53,14 +52,13 @@ class NotificationTroubleshootTestManagerFactory @Inject constructor( mgr.addTest(testSystemSettings) mgr.addTest(testAccountSettings) mgr.addTest(testDeviceSettings) + mgr.addTest(testPushRulesSettings) if (UPHelper.distributorExists(fragment.requireContext())) { - mgr.addTest(testBingRulesSettings) mgr.addTest(testPlayServices) mgr.addTest(testNewEndpoint) mgr.addTest(testTokenRegistration) mgr.addTest(testPushFromPushGateway) } else { - mgr.addTest(testPushRulesSettings) mgr.addTest(testAutoStartBoot) mgr.addTest(testBackgroundRestrictions) mgr.addTest(testBatteryOptimization) diff --git a/vector/src/main/java/im/vector/app/core/pushers/PushersManager.kt b/vector/src/main/java/im/vector/app/core/pushers/PushersManager.kt index 6910c0ae0c..5ebbfd5b81 100644 --- a/vector/src/main/java/im/vector/app/core/pushers/PushersManager.kt +++ b/vector/src/main/java/im/vector/app/core/pushers/PushersManager.kt @@ -71,8 +71,9 @@ class PushersManager @Inject constructor( val appId = stringProvider.getString(R.string.pusher_app_id) return if (UPHelper.isEmbeddedDistributor(context)) { appId - } else - "${appId}.up" + } else { + "$appId.up" + } } companion object { diff --git a/vector/src/main/java/im/vector/app/core/pushers/UPHelper.kt b/vector/src/main/java/im/vector/app/core/pushers/UPHelper.kt index e8c06ef1cc..5f34ae4f3a 100644 --- a/vector/src/main/java/im/vector/app/core/pushers/UPHelper.kt +++ b/vector/src/main/java/im/vector/app/core/pushers/UPHelper.kt @@ -19,6 +19,7 @@ import android.content.Context import android.content.pm.PackageManager import androidx.appcompat.app.AlertDialog import androidx.core.content.edit +import com.google.android.material.dialog.MaterialAlertDialogBuilder import im.vector.app.R import im.vector.app.core.di.DefaultSharedPreferences import im.vector.app.push.fcm.FcmHelper @@ -104,7 +105,7 @@ object UPHelper { up.registerApp(context) } else -> { - val builder: AlertDialog.Builder = AlertDialog.Builder(context) + val builder: AlertDialog.Builder = MaterialAlertDialogBuilder(context) builder.setTitle(context.getString(R.string.unifiedpush_getdistributors_dialog_title)) val distributorsArray = distributors.toTypedArray() @@ -142,8 +143,9 @@ object UPHelper { // register app_id type upfcm on sygnal // the pushkey if FCM key val up = Registration() - if (up.getDistributor(context) == context.packageName) + if (up.getDistributor(context) == context.packageName) { return context.getString(R.string.pusher_http_url) + } // else, unifiedpush, and pushkey is an endpoint val default = context.getString(R.string.default_push_gateway_http_url) endpoint?.let { @@ -175,5 +177,4 @@ object UPHelper { val up = Registration() return up.getDistributor(context) == context.packageName } - } diff --git a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestNewEndpoint.kt b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestNewEndpoint.kt index 075505fd75..cb09046628 100644 --- a/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestNewEndpoint.kt +++ b/vector/src/main/java/im/vector/app/features/settings/troubleshoot/TestNewEndpoint.kt @@ -38,9 +38,9 @@ class TestNewEndpoint @Inject constructor(private val context: AppCompatActivity if (!endpoint.isNullOrEmpty()) { status = TestStatus.SUCCESS description = stringProvider.getString(R.string.settings_troubleshoot_test_endpoint_success, endpoint) - return + } else { + status = TestStatus.FAILED + description = stringProvider.getString(R.string.settings_troubleshoot_test_endpoint_failed) } - status = TestStatus.FAILED - description = stringProvider.getString(R.string.settings_troubleshoot_test_endpoint_failed) } } diff --git a/vector/src/main/res/values/config.xml b/vector/src/main/res/values/config.xml index 4616b55796..b5d92337bc 100755 --- a/vector/src/main/res/values/config.xml +++ b/vector/src/main/res/values/config.xml @@ -14,8 +14,10 @@ --> + https://matrix.org/_matrix/push/v1/notify - + + https://matrix.gateway.unifiedpush.org/_matrix/push/v1/notify im.vector.app.android