ktlint and cleanup

This commit is contained in:
Benoit Marty 2021-03-31 09:25:35 +02:00
parent f2f735ace1
commit e4e13aaa97
4 changed files with 18 additions and 20 deletions

View file

@ -24,8 +24,10 @@ import im.vector.app.core.pushers.PushersManager
import im.vector.app.core.resources.StringProvider
import im.vector.app.features.settings.troubleshoot.TroubleshootTest
import im.vector.app.push.fcm.FcmHelper
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
import org.matrix.android.sdk.api.session.pushers.PushGatewayFailure
import kotlinx.coroutines.*
import javax.inject.Inject
/**
@ -45,22 +47,22 @@ class TestPushFromPushGateway @Inject constructor(private val context: AppCompat
return
}
action = GlobalScope.launch {
runCatching { pushersManager.testPush(fcmToken) }
.fold(
{
// Wait for the push to be received
description = stringProvider.getString(R.string.settings_troubleshoot_test_push_loop_waiting_for_push)
status = TestStatus.RUNNING
},
{
description = if (it is PushGatewayFailure.PusherRejected) {
stringProvider.getString(R.string.settings_troubleshoot_test_push_loop_failed)
} else {
errorFormatter.toHumanReadable(it)
status = runCatching { pushersManager.testPush(fcmToken) }
.fold(
{
// Wait for the push to be received
description = stringProvider.getString(R.string.settings_troubleshoot_test_push_loop_waiting_for_push)
TestStatus.RUNNING
},
{
description = if (it is PushGatewayFailure.PusherRejected) {
stringProvider.getString(R.string.settings_troubleshoot_test_push_loop_failed)
} else {
errorFormatter.toHumanReadable(it)
}
TestStatus.FAILED
}
status = TestStatus.FAILED
}
)
)
}
}

View file

@ -21,8 +21,6 @@ import im.vector.app.core.di.ActiveSessionHolder
import im.vector.app.core.resources.AppNameProvider
import im.vector.app.core.resources.LocaleProvider
import im.vector.app.core.resources.StringProvider
import org.matrix.android.sdk.api.MatrixCallback
import org.matrix.android.sdk.api.util.Cancelable
import java.util.UUID
import javax.inject.Inject
import kotlin.math.abs

View file

@ -65,7 +65,6 @@ import org.commonmark.parser.Parser
import org.commonmark.renderer.html.HtmlRenderer
import org.matrix.android.sdk.api.MatrixCallback
import org.matrix.android.sdk.api.MatrixPatterns
import org.matrix.android.sdk.api.NoOpMatrixCallback
import org.matrix.android.sdk.api.extensions.tryOrNull
import org.matrix.android.sdk.api.query.QueryStringValue
import org.matrix.android.sdk.api.raw.RawService

View file

@ -25,7 +25,6 @@ import im.vector.app.core.di.ActiveSessionHolder
import im.vector.app.core.extensions.vectorComponent
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import org.matrix.android.sdk.api.NoOpMatrixCallback
import org.matrix.android.sdk.api.session.Session
import org.matrix.android.sdk.api.session.room.Room
import org.matrix.android.sdk.api.session.room.read.ReadService