App crashes on "troubleshoot notifications" button (#3187)
This commit is contained in:
parent
c08868bc3c
commit
9fc00fe6ff
@ -3,6 +3,7 @@ Changes in Element 1.1.6 (2021-04-16)
|
|||||||
|
|
||||||
Bugfix 🐛:
|
Bugfix 🐛:
|
||||||
- Fix crash on the timeline
|
- Fix crash on the timeline
|
||||||
|
- App crashes on "troubleshoot notifications" button (#3187)
|
||||||
|
|
||||||
Changes in Element 1.1.5 (2021-04-15)
|
Changes in Element 1.1.5 (2021-04-15)
|
||||||
===================================================
|
===================================================
|
||||||
|
@ -24,9 +24,11 @@ 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.features.settings.troubleshoot.TroubleshootTest
|
||||||
import im.vector.app.push.fcm.FcmHelper
|
import im.vector.app.push.fcm.FcmHelper
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
import org.matrix.android.sdk.api.session.pushers.PushGatewayFailure
|
import org.matrix.android.sdk.api.session.pushers.PushGatewayFailure
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@ -47,7 +49,10 @@ class TestPushFromPushGateway @Inject constructor(private val context: AppCompat
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
action = GlobalScope.launch {
|
action = GlobalScope.launch {
|
||||||
status = runCatching { pushersManager.testPush(fcmToken) }
|
val result = runCatching { pushersManager.testPush(fcmToken) }
|
||||||
|
|
||||||
|
withContext(Dispatchers.Main) {
|
||||||
|
status = result
|
||||||
.fold(
|
.fold(
|
||||||
{
|
{
|
||||||
// Wait for the push to be received
|
// Wait for the push to be received
|
||||||
@ -65,6 +70,7 @@ class TestPushFromPushGateway @Inject constructor(private val context: AppCompat
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onPushReceived() {
|
override fun onPushReceived() {
|
||||||
description = stringProvider.getString(R.string.settings_troubleshoot_test_push_loop_success)
|
description = stringProvider.getString(R.string.settings_troubleshoot_test_push_loop_success)
|
||||||
|
@ -20,8 +20,11 @@ import androidx.activity.result.ActivityResultLauncher
|
|||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.di.ActiveSessionHolder
|
import im.vector.app.core.di.ActiveSessionHolder
|
||||||
import im.vector.app.core.resources.StringProvider
|
import im.vector.app.core.resources.StringProvider
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
|
import org.matrix.android.sdk.api.extensions.tryOrNull
|
||||||
import org.matrix.android.sdk.api.pushrules.RuleIds
|
import org.matrix.android.sdk.api.pushrules.RuleIds
|
||||||
import org.matrix.android.sdk.api.pushrules.RuleKind
|
import org.matrix.android.sdk.api.pushrules.RuleKind
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
@ -50,13 +53,15 @@ class TestAccountSettings @Inject constructor(private val stringProvider: String
|
|||||||
if (manager?.diagStatus == TestStatus.RUNNING) return // wait before all is finished
|
if (manager?.diagStatus == TestStatus.RUNNING) return // wait before all is finished
|
||||||
|
|
||||||
GlobalScope.launch {
|
GlobalScope.launch {
|
||||||
runCatching {
|
tryOrNull {
|
||||||
session.updatePushRuleEnableStatus(RuleKind.OVERRIDE, defaultRule, !defaultRule.enabled)
|
session.updatePushRuleEnableStatus(RuleKind.OVERRIDE, defaultRule, !defaultRule.enabled)
|
||||||
}
|
}
|
||||||
|
withContext(Dispatchers.Main) {
|
||||||
manager?.retry(activityResultLauncher)
|
manager?.retry(activityResultLauncher)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
status = TestStatus.FAILED
|
status = TestStatus.FAILED
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user