mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-01-27 09:31:20 +01:00
Use resumeWithException() facility (no other change)
This commit is contained in:
parent
544c1e4a6a
commit
8c1b99586b
@ -113,7 +113,7 @@ class ReAuthActivity : SimpleFragmentActivity(), ReAuthViewModel.Factory {
|
|||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
// It's the only way we have to know if sso falback flow was successful
|
// It's the only way we have to know if sso fallback flow was successful
|
||||||
withState(sharedViewModel) {
|
withState(sharedViewModel) {
|
||||||
if (it.ssoFallbackPageWasShown) {
|
if (it.ssoFallbackPageWasShown) {
|
||||||
Timber.d("## UIA ssoFallbackPageWasShown tentative success")
|
Timber.d("## UIA ssoFallbackPageWasShown tentative success")
|
||||||
|
@ -55,6 +55,7 @@ import org.matrix.android.sdk.internal.util.awaitCallback
|
|||||||
import java.io.OutputStream
|
import java.io.OutputStream
|
||||||
import kotlin.coroutines.Continuation
|
import kotlin.coroutines.Continuation
|
||||||
import kotlin.coroutines.resume
|
import kotlin.coroutines.resume
|
||||||
|
import kotlin.coroutines.resumeWithException
|
||||||
|
|
||||||
class BootstrapSharedViewModel @AssistedInject constructor(
|
class BootstrapSharedViewModel @AssistedInject constructor(
|
||||||
@Assisted initialState: BootstrapViewState,
|
@Assisted initialState: BootstrapViewState,
|
||||||
@ -421,7 +422,7 @@ class BootstrapSharedViewModel @AssistedInject constructor(
|
|||||||
_viewEvents.post(BootstrapViewEvents.RequestReAuth(flowResponse, errCode))
|
_viewEvents.post(BootstrapViewEvents.RequestReAuth(flowResponse, errCode))
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
promise.resumeWith(Result.failure(UnsupportedOperationException()))
|
promise.resumeWithException(UnsupportedOperationException())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,7 @@ import org.matrix.android.sdk.rx.rx
|
|||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import kotlin.coroutines.Continuation
|
import kotlin.coroutines.Continuation
|
||||||
import kotlin.coroutines.resume
|
import kotlin.coroutines.resume
|
||||||
|
import kotlin.coroutines.resumeWithException
|
||||||
|
|
||||||
class HomeActivityViewModel @AssistedInject constructor(
|
class HomeActivityViewModel @AssistedInject constructor(
|
||||||
@Assisted initialState: HomeActivityViewState,
|
@Assisted initialState: HomeActivityViewState,
|
||||||
@ -228,7 +229,7 @@ class HomeActivityViewModel @AssistedInject constructor(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
promise.resumeWith(Result.failure(Exception("Cannot silently initialize cross signing, UIA missing")))
|
promise.resumeWithException(Exception("Cannot silently initialize cross signing, UIA missing"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -38,6 +38,7 @@ import org.matrix.android.sdk.api.auth.UserPasswordAuth
|
|||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import kotlin.coroutines.Continuation
|
import kotlin.coroutines.Continuation
|
||||||
import kotlin.coroutines.resume
|
import kotlin.coroutines.resume
|
||||||
|
import kotlin.coroutines.resumeWithException
|
||||||
|
|
||||||
data class DeactivateAccountViewState(
|
data class DeactivateAccountViewState(
|
||||||
val passwordShown: Boolean = false
|
val passwordShown: Boolean = false
|
||||||
@ -64,7 +65,7 @@ class DeactivateAccountViewModel @AssistedInject constructor(@Assisted private v
|
|||||||
if (pendingAuth != null) {
|
if (pendingAuth != null) {
|
||||||
uiaContinuation?.resume(pendingAuth!!)
|
uiaContinuation?.resume(pendingAuth!!)
|
||||||
} else {
|
} else {
|
||||||
uiaContinuation?.resumeWith(Result.failure((IllegalArgumentException())))
|
uiaContinuation?.resumeWithException(IllegalArgumentException())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is DeactivateAccountAction.PasswordAuthDone -> {
|
is DeactivateAccountAction.PasswordAuthDone -> {
|
||||||
@ -79,7 +80,7 @@ class DeactivateAccountViewModel @AssistedInject constructor(@Assisted private v
|
|||||||
}
|
}
|
||||||
DeactivateAccountAction.ReAuthCancelled -> {
|
DeactivateAccountAction.ReAuthCancelled -> {
|
||||||
Timber.d("## UIA - Reauth cancelled")
|
Timber.d("## UIA - Reauth cancelled")
|
||||||
uiaContinuation?.resumeWith(Result.failure((Exception())))
|
uiaContinuation?.resumeWithException(Exception())
|
||||||
uiaContinuation = null
|
uiaContinuation = null
|
||||||
pendingAuth = null
|
pendingAuth = null
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@ import org.matrix.android.sdk.rx.rx
|
|||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import kotlin.coroutines.Continuation
|
import kotlin.coroutines.Continuation
|
||||||
import kotlin.coroutines.resume
|
import kotlin.coroutines.resume
|
||||||
|
import kotlin.coroutines.resumeWithException
|
||||||
|
|
||||||
class CrossSigningSettingsViewModel @AssistedInject constructor(
|
class CrossSigningSettingsViewModel @AssistedInject constructor(
|
||||||
@Assisted private val initialState: CrossSigningSettingsViewState,
|
@Assisted private val initialState: CrossSigningSettingsViewState,
|
||||||
@ -130,7 +131,7 @@ class CrossSigningSettingsViewModel @AssistedInject constructor(
|
|||||||
if (pendingAuth != null) {
|
if (pendingAuth != null) {
|
||||||
uiaContinuation?.resume(pendingAuth!!)
|
uiaContinuation?.resume(pendingAuth!!)
|
||||||
} else {
|
} else {
|
||||||
uiaContinuation?.resumeWith(Result.failure((IllegalArgumentException())))
|
uiaContinuation?.resumeWithException(IllegalArgumentException())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is CrossSigningSettingsAction.PasswordAuthDone -> {
|
is CrossSigningSettingsAction.PasswordAuthDone -> {
|
||||||
@ -146,7 +147,7 @@ class CrossSigningSettingsViewModel @AssistedInject constructor(
|
|||||||
CrossSigningSettingsAction.ReAuthCancelled -> {
|
CrossSigningSettingsAction.ReAuthCancelled -> {
|
||||||
Timber.d("## UIA - Reauth cancelled")
|
Timber.d("## UIA - Reauth cancelled")
|
||||||
_viewEvents.post(CrossSigningSettingsViewEvents.HideModalWaitingView)
|
_viewEvents.post(CrossSigningSettingsViewEvents.HideModalWaitingView)
|
||||||
uiaContinuation?.resumeWith(Result.failure((Exception())))
|
uiaContinuation?.resumeWithException(Exception())
|
||||||
uiaContinuation = null
|
uiaContinuation = null
|
||||||
pendingAuth = null
|
pendingAuth = null
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,7 @@ import java.util.concurrent.TimeUnit
|
|||||||
import javax.net.ssl.HttpsURLConnection
|
import javax.net.ssl.HttpsURLConnection
|
||||||
import kotlin.coroutines.Continuation
|
import kotlin.coroutines.Continuation
|
||||||
import kotlin.coroutines.resume
|
import kotlin.coroutines.resume
|
||||||
|
import kotlin.coroutines.resumeWithException
|
||||||
|
|
||||||
data class DevicesViewState(
|
data class DevicesViewState(
|
||||||
val myDeviceId: String = "",
|
val myDeviceId: String = "",
|
||||||
@ -217,7 +218,7 @@ class DevicesViewModel @AssistedInject constructor(
|
|||||||
if (pendingAuth != null) {
|
if (pendingAuth != null) {
|
||||||
uiaContinuation?.resume(pendingAuth!!)
|
uiaContinuation?.resume(pendingAuth!!)
|
||||||
} else {
|
} else {
|
||||||
uiaContinuation?.resumeWith(Result.failure((IllegalArgumentException())))
|
uiaContinuation?.resumeWithException(IllegalArgumentException())
|
||||||
}
|
}
|
||||||
Unit
|
Unit
|
||||||
}
|
}
|
||||||
@ -235,7 +236,7 @@ class DevicesViewModel @AssistedInject constructor(
|
|||||||
DevicesAction.ReAuthCancelled -> {
|
DevicesAction.ReAuthCancelled -> {
|
||||||
Timber.d("## UIA - Reauth cancelled")
|
Timber.d("## UIA - Reauth cancelled")
|
||||||
// _viewEvents.post(DevicesViewEvents.Loading)
|
// _viewEvents.post(DevicesViewEvents.Loading)
|
||||||
uiaContinuation?.resumeWith(Result.failure((Exception())))
|
uiaContinuation?.resumeWithException(Exception())
|
||||||
uiaContinuation = null
|
uiaContinuation = null
|
||||||
pendingAuth = null
|
pendingAuth = null
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ import org.matrix.android.sdk.rx.rx
|
|||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import kotlin.coroutines.Continuation
|
import kotlin.coroutines.Continuation
|
||||||
import kotlin.coroutines.resume
|
import kotlin.coroutines.resume
|
||||||
|
import kotlin.coroutines.resumeWithException
|
||||||
|
|
||||||
class ThreePidsSettingsViewModel @AssistedInject constructor(
|
class ThreePidsSettingsViewModel @AssistedInject constructor(
|
||||||
@Assisted initialState: ThreePidsSettingsViewState,
|
@Assisted initialState: ThreePidsSettingsViewState,
|
||||||
@ -140,7 +141,7 @@ class ThreePidsSettingsViewModel @AssistedInject constructor(
|
|||||||
if (pendingAuth != null) {
|
if (pendingAuth != null) {
|
||||||
uiaContinuation?.resume(pendingAuth!!)
|
uiaContinuation?.resume(pendingAuth!!)
|
||||||
} else {
|
} else {
|
||||||
uiaContinuation?.resumeWith(Result.failure((IllegalArgumentException())))
|
uiaContinuation?.resumeWithException(IllegalArgumentException())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is ThreePidsSettingsAction.PasswordAuthDone -> {
|
is ThreePidsSettingsAction.PasswordAuthDone -> {
|
||||||
@ -155,7 +156,7 @@ class ThreePidsSettingsViewModel @AssistedInject constructor(
|
|||||||
}
|
}
|
||||||
ThreePidsSettingsAction.ReAuthCancelled -> {
|
ThreePidsSettingsAction.ReAuthCancelled -> {
|
||||||
Timber.d("## UIA - Reauth cancelled")
|
Timber.d("## UIA - Reauth cancelled")
|
||||||
uiaContinuation?.resumeWith(Result.failure((Exception())))
|
uiaContinuation?.resumeWithException(Exception())
|
||||||
uiaContinuation = null
|
uiaContinuation = null
|
||||||
pendingAuth = null
|
pendingAuth = null
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user