mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-18 13:00:18 +03:00
up: troubleshoot list
This commit is contained in:
parent
a3a946fb75
commit
434739ad31
12 changed files with 122 additions and 111 deletions
|
@ -16,21 +16,29 @@
|
||||||
package im.vector.app.push.fcm
|
package im.vector.app.push.fcm
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import im.vector.app.fdroid.features.settings.troubleshoot.TestAutoStartBoot
|
import im.vector.app.core.pushers.UPHelper
|
||||||
import im.vector.app.fdroid.features.settings.troubleshoot.TestBackgroundRestrictions
|
import im.vector.app.features.settings.troubleshoot.TestAutoStartBoot
|
||||||
import im.vector.app.fdroid.features.settings.troubleshoot.TestBatteryOptimization
|
import im.vector.app.features.settings.troubleshoot.TestBackgroundRestrictions
|
||||||
|
import im.vector.app.features.settings.troubleshoot.TestBatteryOptimization
|
||||||
import im.vector.app.features.settings.troubleshoot.NotificationTroubleshootTestManager
|
import im.vector.app.features.settings.troubleshoot.NotificationTroubleshootTestManager
|
||||||
import im.vector.app.features.settings.troubleshoot.TestAccountSettings
|
import im.vector.app.features.settings.troubleshoot.TestAccountSettings
|
||||||
import im.vector.app.features.settings.troubleshoot.TestDeviceSettings
|
import im.vector.app.features.settings.troubleshoot.TestDeviceSettings
|
||||||
|
import im.vector.app.features.settings.troubleshoot.TestNewEndpoint
|
||||||
import im.vector.app.features.settings.troubleshoot.TestNotification
|
import im.vector.app.features.settings.troubleshoot.TestNotification
|
||||||
|
import im.vector.app.features.settings.troubleshoot.TestPushFromPushGateway
|
||||||
import im.vector.app.features.settings.troubleshoot.TestPushRulesSettings
|
import im.vector.app.features.settings.troubleshoot.TestPushRulesSettings
|
||||||
import im.vector.app.features.settings.troubleshoot.TestSystemSettings
|
import im.vector.app.features.settings.troubleshoot.TestSystemSettings
|
||||||
|
import im.vector.app.features.settings.troubleshoot.TestTokenRegistration
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class NotificationTroubleshootTestManagerFactory @Inject constructor(
|
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 testTokenRegistration: TestTokenRegistration,
|
||||||
|
private val testPushFromPushGateway: TestPushFromPushGateway,
|
||||||
private val testPushRulesSettings: TestPushRulesSettings,
|
private val testPushRulesSettings: TestPushRulesSettings,
|
||||||
private val testAutoStartBoot: TestAutoStartBoot,
|
private val testAutoStartBoot: TestAutoStartBoot,
|
||||||
private val testBackgroundRestrictions: TestBackgroundRestrictions,
|
private val testBackgroundRestrictions: TestBackgroundRestrictions,
|
||||||
|
@ -43,10 +51,17 @@ 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())) {
|
||||||
mgr.addTest(testAutoStartBoot)
|
mgr.addTest(testBingRulesSettings)
|
||||||
mgr.addTest(testBackgroundRestrictions)
|
mgr.addTest(testNewEndpoint)
|
||||||
mgr.addTest(testBatteryOptimization)
|
mgr.addTest(testTokenRegistration)
|
||||||
|
mgr.addTest(testPushFromPushGateway)
|
||||||
|
} else {
|
||||||
|
mgr.addTest(testPushRulesSettings)
|
||||||
|
mgr.addTest(testAutoStartBoot)
|
||||||
|
mgr.addTest(testBackgroundRestrictions)
|
||||||
|
mgr.addTest(testBatteryOptimization)
|
||||||
|
}
|
||||||
mgr.addTest(testNotification)
|
mgr.addTest(testNotification)
|
||||||
return mgr
|
return mgr
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,83 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2018 New Vector Ltd
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package im.vector.app.gplay.features.settings.troubleshoot
|
|
||||||
|
|
||||||
import android.content.Intent
|
|
||||||
import androidx.activity.result.ActivityResultLauncher
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import im.vector.app.R
|
|
||||||
import im.vector.app.core.resources.StringProvider
|
|
||||||
import im.vector.app.core.utils.startAddGoogleAccountIntent
|
|
||||||
import im.vector.app.features.settings.troubleshoot.TroubleshootTest
|
|
||||||
import im.vector.app.push.fcm.FcmHelper
|
|
||||||
import timber.log.Timber
|
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Test that app can successfully retrieve a new endpoint
|
|
||||||
*/
|
|
||||||
class TestNewEndpoint @Inject constructor(private val context: AppCompatActivity,
|
|
||||||
private val stringProvider: StringProvider) : TroubleshootTest(R.string.settings_troubleshoot_test_fcm_title) {
|
|
||||||
|
|
||||||
override fun perform(activityResultLauncher: ActivityResultLauncher<Intent>) {
|
|
||||||
description = "bypassed"
|
|
||||||
status = TestStatus.SUCCESS
|
|
||||||
/**
|
|
||||||
* TODO
|
|
||||||
*/
|
|
||||||
/*status = TestStatus.RUNNING
|
|
||||||
try {
|
|
||||||
FirebaseMessaging.getInstance().token
|
|
||||||
.addOnCompleteListener(context) { task ->
|
|
||||||
if (!task.isSuccessful) {
|
|
||||||
// Can't find where this constant is (not documented -or deprecated in docs- and all obfuscated)
|
|
||||||
description = when (val errorMsg = task.exception?.localizedMessage ?: "Unknown") {
|
|
||||||
"SERVICE_NOT_AVAILABLE" -> {
|
|
||||||
stringProvider.getString(R.string.settings_troubleshoot_test_fcm_failed_service_not_available, errorMsg)
|
|
||||||
}
|
|
||||||
"TOO_MANY_REGISTRATIONS" -> {
|
|
||||||
stringProvider.getString(R.string.settings_troubleshoot_test_fcm_failed_too_many_registration, errorMsg)
|
|
||||||
}
|
|
||||||
"ACCOUNT_MISSING" -> {
|
|
||||||
quickFix = object : TroubleshootQuickFix(R.string.settings_troubleshoot_test_fcm_failed_account_missing_quick_fix) {
|
|
||||||
override fun doFix() {
|
|
||||||
startAddGoogleAccountIntent(context, activityResultLauncher)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stringProvider.getString(R.string.settings_troubleshoot_test_fcm_failed_account_missing, errorMsg)
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
stringProvider.getString(R.string.settings_troubleshoot_test_fcm_failed, errorMsg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
status = TestStatus.FAILED
|
|
||||||
} else {
|
|
||||||
task.result?.let { token ->
|
|
||||||
val tok = token.take(8) + "********************"
|
|
||||||
description = stringProvider.getString(R.string.settings_troubleshoot_test_fcm_success, tok)
|
|
||||||
Timber.e("Retrieved FCM token success [$tok].")
|
|
||||||
// Ensure it is well store in our local storage
|
|
||||||
FcmHelper.storeFcmToken(context, token)
|
|
||||||
}
|
|
||||||
status = TestStatus.SUCCESS
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e: Throwable) {
|
|
||||||
description = stringProvider.getString(R.string.settings_troubleshoot_test_fcm_failed, e.localizedMessage)
|
|
||||||
status = TestStatus.FAILED
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -16,16 +16,20 @@
|
||||||
package im.vector.app.push.fcm
|
package im.vector.app.push.fcm
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
|
import im.vector.app.core.pushers.UPHelper
|
||||||
import im.vector.app.features.settings.troubleshoot.NotificationTroubleshootTestManager
|
import im.vector.app.features.settings.troubleshoot.NotificationTroubleshootTestManager
|
||||||
import im.vector.app.features.settings.troubleshoot.TestAccountSettings
|
import im.vector.app.features.settings.troubleshoot.TestAccountSettings
|
||||||
|
import im.vector.app.features.settings.troubleshoot.TestAutoStartBoot
|
||||||
|
import im.vector.app.features.settings.troubleshoot.TestBackgroundRestrictions
|
||||||
|
import im.vector.app.features.settings.troubleshoot.TestBatteryOptimization
|
||||||
import im.vector.app.features.settings.troubleshoot.TestDeviceSettings
|
import im.vector.app.features.settings.troubleshoot.TestDeviceSettings
|
||||||
import im.vector.app.features.settings.troubleshoot.TestNotification
|
import im.vector.app.features.settings.troubleshoot.TestNotification
|
||||||
import im.vector.app.features.settings.troubleshoot.TestPushRulesSettings
|
import im.vector.app.features.settings.troubleshoot.TestPushRulesSettings
|
||||||
import im.vector.app.features.settings.troubleshoot.TestSystemSettings
|
import im.vector.app.features.settings.troubleshoot.TestSystemSettings
|
||||||
import im.vector.app.gplay.features.settings.troubleshoot.TestNewEndpoint
|
import im.vector.app.features.settings.troubleshoot.TestNewEndpoint
|
||||||
import im.vector.app.gplay.features.settings.troubleshoot.TestPlayServices
|
import im.vector.app.gplay.features.settings.troubleshoot.TestPlayServices
|
||||||
import im.vector.app.gplay.features.settings.troubleshoot.TestPushFromPushGateway
|
import im.vector.app.features.settings.troubleshoot.TestPushFromPushGateway
|
||||||
import im.vector.app.gplay.features.settings.troubleshoot.TestTokenRegistration
|
import im.vector.app.features.settings.troubleshoot.TestTokenRegistration
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class NotificationTroubleshootTestManagerFactory @Inject constructor(
|
class NotificationTroubleshootTestManagerFactory @Inject constructor(
|
||||||
|
@ -37,6 +41,10 @@ class NotificationTroubleshootTestManagerFactory @Inject constructor(
|
||||||
private val testNewEndpoint: TestNewEndpoint,
|
private val testNewEndpoint: TestNewEndpoint,
|
||||||
private val testTokenRegistration: TestTokenRegistration,
|
private val testTokenRegistration: TestTokenRegistration,
|
||||||
private val testPushFromPushGateway: TestPushFromPushGateway,
|
private val testPushFromPushGateway: TestPushFromPushGateway,
|
||||||
|
private val testPushRulesSettings: TestPushRulesSettings,
|
||||||
|
private val testAutoStartBoot: TestAutoStartBoot,
|
||||||
|
private val testBackgroundRestrictions: TestBackgroundRestrictions,
|
||||||
|
private val testBatteryOptimization: TestBatteryOptimization,
|
||||||
private val testNotification: TestNotification
|
private val testNotification: TestNotification
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
@ -45,11 +53,18 @@ class NotificationTroubleshootTestManagerFactory @Inject constructor(
|
||||||
mgr.addTest(testSystemSettings)
|
mgr.addTest(testSystemSettings)
|
||||||
mgr.addTest(testAccountSettings)
|
mgr.addTest(testAccountSettings)
|
||||||
mgr.addTest(testDeviceSettings)
|
mgr.addTest(testDeviceSettings)
|
||||||
mgr.addTest(testBingRulesSettings)
|
if (UPHelper.DistributorExists(fragment.requireContext())) {
|
||||||
mgr.addTest(testPlayServices)
|
mgr.addTest(testBingRulesSettings)
|
||||||
mgr.addTest(testNewEndpoint)
|
mgr.addTest(testPlayServices)
|
||||||
mgr.addTest(testTokenRegistration)
|
mgr.addTest(testNewEndpoint)
|
||||||
mgr.addTest(testPushFromPushGateway)
|
mgr.addTest(testTokenRegistration)
|
||||||
|
mgr.addTest(testPushFromPushGateway)
|
||||||
|
} else {
|
||||||
|
mgr.addTest(testPushRulesSettings)
|
||||||
|
mgr.addTest(testAutoStartBoot)
|
||||||
|
mgr.addTest(testBackgroundRestrictions)
|
||||||
|
mgr.addTest(testBatteryOptimization)
|
||||||
|
}
|
||||||
mgr.addTest(testNotification)
|
mgr.addTest(testNotification)
|
||||||
return mgr
|
return mgr
|
||||||
}
|
}
|
||||||
|
|
|
@ -357,6 +357,10 @@
|
||||||
android:name=".features.settings.troubleshoot.TestNotificationReceiver"
|
android:name=".features.settings.troubleshoot.TestNotificationReceiver"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
|
|
||||||
|
<receiver
|
||||||
|
android:name=".features.settings.troubleshoot.TestNewEndpoint"
|
||||||
|
android:exported="false" />
|
||||||
|
|
||||||
<!-- Exported false, should only be accessible from this app!! -->
|
<!-- Exported false, should only be accessible from this app!! -->
|
||||||
<receiver
|
<receiver
|
||||||
android:name=".features.notifications.NotificationBroadcastReceiver"
|
android:name=".features.notifications.NotificationBroadcastReceiver"
|
||||||
|
|
|
@ -145,4 +145,9 @@ object UPHelper {
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun DistributorExists(context: Context): Boolean {
|
||||||
|
val up = Registration()
|
||||||
|
return up.getDistributor(context).isNotEmpty()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package im.vector.app.fdroid.features.settings.troubleshoot
|
package im.vector.app.features.settings.troubleshoot
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import androidx.activity.result.ActivityResultLauncher
|
import androidx.activity.result.ActivityResultLauncher
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2018 New Vector Ltd
|
* Copyright (c) 2021 New Vector Ltd
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package im.vector.app.fdroid.features.settings.troubleshoot
|
package im.vector.app.features.settings.troubleshoot
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.ConnectivityManager
|
import android.net.ConnectivityManager
|
||||||
|
@ -23,7 +23,6 @@ import androidx.core.content.getSystemService
|
||||||
import androidx.core.net.ConnectivityManagerCompat
|
import androidx.core.net.ConnectivityManagerCompat
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.resources.StringProvider
|
import im.vector.app.core.resources.StringProvider
|
||||||
import im.vector.app.features.settings.troubleshoot.TroubleshootTest
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class TestBackgroundRestrictions @Inject constructor(private val context: AppCompatActivity,
|
class TestBackgroundRestrictions @Inject constructor(private val context: AppCompatActivity,
|
|
@ -13,7 +13,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package im.vector.app.fdroid.features.settings.troubleshoot
|
package im.vector.app.features.settings.troubleshoot
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import androidx.activity.result.ActivityResultLauncher
|
import androidx.activity.result.ActivityResultLauncher
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2018 New Vector Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package im.vector.app.features.settings.troubleshoot
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
|
import androidx.activity.result.ActivityResultLauncher
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import im.vector.app.R
|
||||||
|
import im.vector.app.core.pushers.UPHelper
|
||||||
|
import im.vector.app.core.resources.StringProvider
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test that app can successfully retrieve a new endpoint
|
||||||
|
*/
|
||||||
|
class TestNewEndpoint @Inject constructor(private val context: AppCompatActivity,
|
||||||
|
private val stringProvider: StringProvider) : TroubleshootTest(R.string.settings_troubleshoot_test_endpoint_title) {
|
||||||
|
|
||||||
|
override fun perform(activityResultLauncher: ActivityResultLauncher<Intent>) {
|
||||||
|
status = TestStatus.RUNNING
|
||||||
|
|
||||||
|
val endpoint = UPHelper.getUpEndpoint(context)
|
||||||
|
|
||||||
|
if (!endpoint.isNullOrEmpty()) {
|
||||||
|
status = TestStatus.SUCCESS
|
||||||
|
description = stringProvider.getString(R.string.settings_troubleshoot_test_endpoint_success, endpoint)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
status = TestStatus.FAILED
|
||||||
|
description = stringProvider.getString(R.string.settings_troubleshoot_test_endpoint_failed)
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2020 New Vector Ltd
|
* Copyright (c) 2021 New Vector Ltd
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package im.vector.app.gplay.features.settings.troubleshoot
|
package im.vector.app.features.settings.troubleshoot
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import androidx.activity.result.ActivityResultLauncher
|
import androidx.activity.result.ActivityResultLauncher
|
||||||
|
@ -24,7 +24,6 @@ import im.vector.app.core.error.ErrorFormatter
|
||||||
import im.vector.app.core.pushers.PushersManager
|
import im.vector.app.core.pushers.PushersManager
|
||||||
import im.vector.app.core.resources.StringProvider
|
import im.vector.app.core.resources.StringProvider
|
||||||
import im.vector.app.features.session.coroutineScope
|
import im.vector.app.features.session.coroutineScope
|
||||||
import im.vector.app.features.settings.troubleshoot.TroubleshootTest
|
|
||||||
import im.vector.app.core.pushers.UPHelper
|
import im.vector.app.core.pushers.UPHelper
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
|
@ -46,6 +45,7 @@ class TestPushFromPushGateway @Inject constructor(private val context: AppCompat
|
||||||
private var action: Job? = null
|
private var action: Job? = null
|
||||||
private var pushReceived: Boolean = false
|
private var pushReceived: Boolean = false
|
||||||
|
|
||||||
|
|
||||||
override fun perform(activityResultLauncher: ActivityResultLauncher<Intent>) {
|
override fun perform(activityResultLauncher: ActivityResultLauncher<Intent>) {
|
||||||
pushReceived = false
|
pushReceived = false
|
||||||
UPHelper.getUpEndpoint(context) ?: run {
|
UPHelper.getUpEndpoint(context) ?: run {
|
|
@ -13,7 +13,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package im.vector.app.gplay.features.settings.troubleshoot
|
package im.vector.app.features.settings.troubleshoot
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import androidx.activity.result.ActivityResultLauncher
|
import androidx.activity.result.ActivityResultLauncher
|
||||||
|
@ -26,7 +26,6 @@ import im.vector.app.R
|
||||||
import im.vector.app.core.di.ActiveSessionHolder
|
import im.vector.app.core.di.ActiveSessionHolder
|
||||||
import im.vector.app.core.pushers.PushersManager
|
import im.vector.app.core.pushers.PushersManager
|
||||||
import im.vector.app.core.resources.StringProvider
|
import im.vector.app.core.resources.StringProvider
|
||||||
import im.vector.app.features.settings.troubleshoot.TroubleshootTest
|
|
||||||
import im.vector.app.core.pushers.UPHelper
|
import im.vector.app.core.pushers.UPHelper
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -37,7 +36,7 @@ class TestTokenRegistration @Inject constructor(private val context: AppCompatAc
|
||||||
private val stringProvider: StringProvider,
|
private val stringProvider: StringProvider,
|
||||||
private val pushersManager: PushersManager,
|
private val pushersManager: PushersManager,
|
||||||
private val activeSessionHolder: ActiveSessionHolder)
|
private val activeSessionHolder: ActiveSessionHolder)
|
||||||
: TroubleshootTest(R.string.settings_troubleshoot_test_token_registration_title) {
|
: TroubleshootTest(R.string.settings_troubleshoot_test_pusher_registration_title) {
|
||||||
|
|
||||||
override fun perform(activityResultLauncher: ActivityResultLauncher<Intent>) {
|
override fun perform(activityResultLauncher: ActivityResultLauncher<Intent>) {
|
||||||
// Check if we have a registered pusher for this token
|
// Check if we have a registered pusher for this token
|
||||||
|
@ -57,7 +56,7 @@ class TestTokenRegistration @Inject constructor(private val context: AppCompatAc
|
||||||
it.pushKey == pushToken && it.state == PusherState.REGISTERED
|
it.pushKey == pushToken && it.state == PusherState.REGISTERED
|
||||||
}
|
}
|
||||||
if (pushers.isEmpty()) {
|
if (pushers.isEmpty()) {
|
||||||
description = stringProvider.getString(R.string.settings_troubleshoot_test_token_registration_failed,
|
description = stringProvider.getString(R.string.settings_troubleshoot_test_pusher_registration_failed,
|
||||||
stringProvider.getString(R.string.sas_error_unknown))
|
stringProvider.getString(R.string.sas_error_unknown))
|
||||||
quickFix = object : TroubleshootQuickFix(R.string.settings_troubleshoot_test_token_registration_quick_fix) {
|
quickFix = object : TroubleshootQuickFix(R.string.settings_troubleshoot_test_token_registration_quick_fix) {
|
||||||
override fun doFix() {
|
override fun doFix() {
|
||||||
|
@ -76,7 +75,7 @@ class TestTokenRegistration @Inject constructor(private val context: AppCompatAc
|
||||||
|
|
||||||
status = TestStatus.FAILED
|
status = TestStatus.FAILED
|
||||||
} else {
|
} else {
|
||||||
description = stringProvider.getString(R.string.settings_troubleshoot_test_token_registration_success)
|
description = stringProvider.getString(R.string.settings_troubleshoot_test_pusher_registration_success)
|
||||||
status = TestStatus.SUCCESS
|
status = TestStatus.SUCCESS
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1110,6 +1110,12 @@
|
||||||
<string name="template_settings_troubleshoot_test_play_services_failed">${app_name} uses Google Play Services to deliver push messages but it doesn’t seem to be configured correctly:\n%1$s</string>
|
<string name="template_settings_troubleshoot_test_play_services_failed">${app_name} uses Google Play Services to deliver push messages but it doesn’t seem to be configured correctly:\n%1$s</string>
|
||||||
<string name="settings_troubleshoot_test_play_services_quickfix">Fix Play Services</string>
|
<string name="settings_troubleshoot_test_play_services_quickfix">Fix Play Services</string>
|
||||||
|
|
||||||
|
<!-- Unifiedpush Endpoint -->
|
||||||
|
<string name="settings_troubleshoot_test_endpoint_title">Endpoint</string>
|
||||||
|
<string name="settings_troubleshoot_test_endpoint_success">Endpoint successfully retrieved:\n%1$s</string>
|
||||||
|
<string name="settings_troubleshoot_test_endpoint_failed">Failed to retrieved Endpoint.</string>
|
||||||
|
|
||||||
|
<!-- FCM Token, not used anymore -->
|
||||||
<string name="settings_troubleshoot_test_fcm_title">Firebase Token</string>
|
<string name="settings_troubleshoot_test_fcm_title">Firebase Token</string>
|
||||||
<string name="settings_troubleshoot_test_fcm_success">FCM token successfully retrieved:\n%1$s</string>
|
<string name="settings_troubleshoot_test_fcm_success">FCM token successfully retrieved:\n%1$s</string>
|
||||||
<string name="settings_troubleshoot_test_fcm_failed">Failed to retrieved FCM token:\n%1$s</string>
|
<string name="settings_troubleshoot_test_fcm_failed">Failed to retrieved FCM token:\n%1$s</string>
|
||||||
|
@ -1121,6 +1127,12 @@
|
||||||
<string name="template_settings_troubleshoot_test_fcm_failed_account_missing">[%1$s]\nThis error is out of control of ${app_name}. There is no Google account on the phone. Please open the account manager and add a Google account.</string>
|
<string name="template_settings_troubleshoot_test_fcm_failed_account_missing">[%1$s]\nThis error is out of control of ${app_name}. There is no Google account on the phone. Please open the account manager and add a Google account.</string>
|
||||||
<string name="settings_troubleshoot_test_fcm_failed_account_missing_quick_fix">Add Account</string>
|
<string name="settings_troubleshoot_test_fcm_failed_account_missing_quick_fix">Add Account</string>
|
||||||
|
|
||||||
|
<!-- Pusher registration -->
|
||||||
|
<string name="settings_troubleshoot_test_pusher_registration_title">Pusher Registration</string>
|
||||||
|
<string name="settings_troubleshoot_test_pusher_registration_success">Pusher successfully registered to HomeServer.</string>
|
||||||
|
<string name="settings_troubleshoot_test_pusher_registration_failed">Failed to register pusher to HomeServer:\n%1$s</string>
|
||||||
|
|
||||||
|
<!-- FCM token, not used -->
|
||||||
<string name="settings_troubleshoot_test_token_registration_title">Token Registration</string>
|
<string name="settings_troubleshoot_test_token_registration_title">Token Registration</string>
|
||||||
<string name="settings_troubleshoot_test_token_registration_success">FCM token successfully registered to HomeServer.</string>
|
<string name="settings_troubleshoot_test_token_registration_success">FCM token successfully registered to HomeServer.</string>
|
||||||
<string name="settings_troubleshoot_test_token_registration_failed">Failed to register FCM token to HomeServer:\n%1$s</string>
|
<string name="settings_troubleshoot_test_token_registration_failed">Failed to register FCM token to HomeServer:\n%1$s</string>
|
||||||
|
|
Loading…
Add table
Reference in a new issue