up pr: code reviewed
This commit is contained in:
parent
6c153d04da
commit
4ac4755868
|
@ -444,8 +444,9 @@ dependencies {
|
||||||
implementation "com.google.dagger:dagger:$daggerVersion"
|
implementation "com.google.dagger:dagger:$daggerVersion"
|
||||||
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
|
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
|
||||||
|
|
||||||
// Unifiedpush
|
// UnifiedPush
|
||||||
implementation 'com.github.UnifiedPush:android-connector:1.1.3'
|
implementation 'com.github.UnifiedPush:android-connector:1.2.0'
|
||||||
|
// UnifiedPush gplay flavor only
|
||||||
gplayImplementation 'com.github.UnifiedPush:android-embedded_fcm_distributor:1.1.0'
|
gplayImplementation 'com.github.UnifiedPush:android-embedded_fcm_distributor:1.1.0'
|
||||||
|
|
||||||
// OSS License, gplay flavor only
|
// OSS License, gplay flavor only
|
||||||
|
|
|
@ -35,7 +35,6 @@ class NotificationTroubleshootTestManagerFactory @Inject constructor(
|
||||||
private val testSystemSettings: TestSystemSettings,
|
private val testSystemSettings: TestSystemSettings,
|
||||||
private val testAccountSettings: TestAccountSettings,
|
private val testAccountSettings: TestAccountSettings,
|
||||||
private val testDeviceSettings: TestDeviceSettings,
|
private val testDeviceSettings: TestDeviceSettings,
|
||||||
private val testBingRulesSettings: TestPushRulesSettings,
|
|
||||||
private val testNewEndpoint: TestNewEndpoint,
|
private val testNewEndpoint: TestNewEndpoint,
|
||||||
private val testTokenRegistration: TestTokenRegistration,
|
private val testTokenRegistration: TestTokenRegistration,
|
||||||
private val testPushFromPushGateway: TestPushFromPushGateway,
|
private val testPushFromPushGateway: TestPushFromPushGateway,
|
||||||
|
@ -51,13 +50,12 @@ class NotificationTroubleshootTestManagerFactory @Inject constructor(
|
||||||
mgr.addTest(testSystemSettings)
|
mgr.addTest(testSystemSettings)
|
||||||
mgr.addTest(testAccountSettings)
|
mgr.addTest(testAccountSettings)
|
||||||
mgr.addTest(testDeviceSettings)
|
mgr.addTest(testDeviceSettings)
|
||||||
|
mgr.addTest(testPushRulesSettings)
|
||||||
if (UPHelper.distributorExists(fragment.requireContext())) {
|
if (UPHelper.distributorExists(fragment.requireContext())) {
|
||||||
mgr.addTest(testBingRulesSettings)
|
|
||||||
mgr.addTest(testNewEndpoint)
|
mgr.addTest(testNewEndpoint)
|
||||||
mgr.addTest(testTokenRegistration)
|
mgr.addTest(testTokenRegistration)
|
||||||
mgr.addTest(testPushFromPushGateway)
|
mgr.addTest(testPushFromPushGateway)
|
||||||
} else {
|
} else {
|
||||||
mgr.addTest(testPushRulesSettings)
|
|
||||||
mgr.addTest(testAutoStartBoot)
|
mgr.addTest(testAutoStartBoot)
|
||||||
mgr.addTest(testBackgroundRestrictions)
|
mgr.addTest(testBackgroundRestrictions)
|
||||||
mgr.addTest(testBatteryOptimization)
|
mgr.addTest(testBatteryOptimization)
|
||||||
|
|
|
@ -36,7 +36,6 @@ class NotificationTroubleshootTestManagerFactory @Inject constructor(
|
||||||
private val testSystemSettings: TestSystemSettings,
|
private val testSystemSettings: TestSystemSettings,
|
||||||
private val testAccountSettings: TestAccountSettings,
|
private val testAccountSettings: TestAccountSettings,
|
||||||
private val testDeviceSettings: TestDeviceSettings,
|
private val testDeviceSettings: TestDeviceSettings,
|
||||||
private val testBingRulesSettings: TestPushRulesSettings,
|
|
||||||
private val testPlayServices: TestPlayServices,
|
private val testPlayServices: TestPlayServices,
|
||||||
private val testNewEndpoint: TestNewEndpoint,
|
private val testNewEndpoint: TestNewEndpoint,
|
||||||
private val testTokenRegistration: TestTokenRegistration,
|
private val testTokenRegistration: TestTokenRegistration,
|
||||||
|
@ -53,14 +52,13 @@ class NotificationTroubleshootTestManagerFactory @Inject constructor(
|
||||||
mgr.addTest(testSystemSettings)
|
mgr.addTest(testSystemSettings)
|
||||||
mgr.addTest(testAccountSettings)
|
mgr.addTest(testAccountSettings)
|
||||||
mgr.addTest(testDeviceSettings)
|
mgr.addTest(testDeviceSettings)
|
||||||
|
mgr.addTest(testPushRulesSettings)
|
||||||
if (UPHelper.distributorExists(fragment.requireContext())) {
|
if (UPHelper.distributorExists(fragment.requireContext())) {
|
||||||
mgr.addTest(testBingRulesSettings)
|
|
||||||
mgr.addTest(testPlayServices)
|
mgr.addTest(testPlayServices)
|
||||||
mgr.addTest(testNewEndpoint)
|
mgr.addTest(testNewEndpoint)
|
||||||
mgr.addTest(testTokenRegistration)
|
mgr.addTest(testTokenRegistration)
|
||||||
mgr.addTest(testPushFromPushGateway)
|
mgr.addTest(testPushFromPushGateway)
|
||||||
} else {
|
} else {
|
||||||
mgr.addTest(testPushRulesSettings)
|
|
||||||
mgr.addTest(testAutoStartBoot)
|
mgr.addTest(testAutoStartBoot)
|
||||||
mgr.addTest(testBackgroundRestrictions)
|
mgr.addTest(testBackgroundRestrictions)
|
||||||
mgr.addTest(testBatteryOptimization)
|
mgr.addTest(testBatteryOptimization)
|
||||||
|
|
|
@ -71,8 +71,9 @@ class PushersManager @Inject constructor(
|
||||||
val appId = stringProvider.getString(R.string.pusher_app_id)
|
val appId = stringProvider.getString(R.string.pusher_app_id)
|
||||||
return if (UPHelper.isEmbeddedDistributor(context)) {
|
return if (UPHelper.isEmbeddedDistributor(context)) {
|
||||||
appId
|
appId
|
||||||
} else
|
} else {
|
||||||
"${appId}.up"
|
"$appId.up"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
|
@ -19,6 +19,7 @@ import android.content.Context
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.core.content.edit
|
import androidx.core.content.edit
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.di.DefaultSharedPreferences
|
import im.vector.app.core.di.DefaultSharedPreferences
|
||||||
import im.vector.app.push.fcm.FcmHelper
|
import im.vector.app.push.fcm.FcmHelper
|
||||||
|
@ -104,7 +105,7 @@ object UPHelper {
|
||||||
up.registerApp(context)
|
up.registerApp(context)
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
val builder: AlertDialog.Builder = AlertDialog.Builder(context)
|
val builder: AlertDialog.Builder = MaterialAlertDialogBuilder(context)
|
||||||
builder.setTitle(context.getString(R.string.unifiedpush_getdistributors_dialog_title))
|
builder.setTitle(context.getString(R.string.unifiedpush_getdistributors_dialog_title))
|
||||||
|
|
||||||
val distributorsArray = distributors.toTypedArray()
|
val distributorsArray = distributors.toTypedArray()
|
||||||
|
@ -142,8 +143,9 @@ object UPHelper {
|
||||||
// register app_id type upfcm on sygnal
|
// register app_id type upfcm on sygnal
|
||||||
// the pushkey if FCM key
|
// the pushkey if FCM key
|
||||||
val up = Registration()
|
val up = Registration()
|
||||||
if (up.getDistributor(context) == context.packageName)
|
if (up.getDistributor(context) == context.packageName) {
|
||||||
return context.getString(R.string.pusher_http_url)
|
return context.getString(R.string.pusher_http_url)
|
||||||
|
}
|
||||||
// else, unifiedpush, and pushkey is an endpoint
|
// else, unifiedpush, and pushkey is an endpoint
|
||||||
val default = context.getString(R.string.default_push_gateway_http_url)
|
val default = context.getString(R.string.default_push_gateway_http_url)
|
||||||
endpoint?.let {
|
endpoint?.let {
|
||||||
|
@ -175,5 +177,4 @@ object UPHelper {
|
||||||
val up = Registration()
|
val up = Registration()
|
||||||
return up.getDistributor(context) == context.packageName
|
return up.getDistributor(context) == context.packageName
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,9 @@ class TestNewEndpoint @Inject constructor(private val context: AppCompatActivity
|
||||||
if (!endpoint.isNullOrEmpty()) {
|
if (!endpoint.isNullOrEmpty()) {
|
||||||
status = TestStatus.SUCCESS
|
status = TestStatus.SUCCESS
|
||||||
description = stringProvider.getString(R.string.settings_troubleshoot_test_endpoint_success, endpoint)
|
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)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,10 @@
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!-- Note: pusher_http_url should have path '/_matrix/push/v1/notify' -->
|
<!-- Note: pusher_http_url should have path '/_matrix/push/v1/notify' -->
|
||||||
|
<!-- It is the push gateway for FCM embedded distributor -->
|
||||||
<string name="pusher_http_url" translatable="false">https://matrix.org/_matrix/push/v1/notify</string>
|
<string name="pusher_http_url" translatable="false">https://matrix.org/_matrix/push/v1/notify</string>
|
||||||
<!-- Note: pusher_http_url should have path '/_matrix/push/v1/notify' -->
|
<!-- Note: default_push_gateway_http_url should have path '/_matrix/push/v1/notify' -->
|
||||||
|
<!-- It is the push gateway for UnifiedPush -->
|
||||||
<string name="default_push_gateway_http_url" translatable="false">https://matrix.gateway.unifiedpush.org/_matrix/push/v1/notify</string>
|
<string name="default_push_gateway_http_url" translatable="false">https://matrix.gateway.unifiedpush.org/_matrix/push/v1/notify</string>
|
||||||
<!-- Note: pusher_app_id cannot exceed 64 chars -->
|
<!-- Note: pusher_app_id cannot exceed 64 chars -->
|
||||||
<string name="pusher_app_id" translatable="false">im.vector.app.android</string>
|
<string name="pusher_app_id" translatable="false">im.vector.app.android</string>
|
||||||
|
|
Loading…
Reference in New Issue