diff --git a/vector/src/main/java/im/vector/app/features/auth/ReAuthActivity.kt b/vector/src/main/java/im/vector/app/features/auth/ReAuthActivity.kt index 0385973386..ce23111a95 100644 --- a/vector/src/main/java/im/vector/app/features/auth/ReAuthActivity.kt +++ b/vector/src/main/java/im/vector/app/features/auth/ReAuthActivity.kt @@ -113,7 +113,7 @@ class ReAuthActivity : SimpleFragmentActivity(), ReAuthViewModel.Factory { override fun 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) { if (it.ssoFallbackPageWasShown) { Timber.d("## UIA ssoFallbackPageWasShown tentative success") diff --git a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapSharedViewModel.kt b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapSharedViewModel.kt index 42278cd948..fe55d81cc4 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapSharedViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapSharedViewModel.kt @@ -55,6 +55,7 @@ import org.matrix.android.sdk.internal.util.awaitCallback import java.io.OutputStream import kotlin.coroutines.Continuation import kotlin.coroutines.resume +import kotlin.coroutines.resumeWithException class BootstrapSharedViewModel @AssistedInject constructor( @Assisted initialState: BootstrapViewState, @@ -421,7 +422,7 @@ class BootstrapSharedViewModel @AssistedInject constructor( _viewEvents.post(BootstrapViewEvents.RequestReAuth(flowResponse, errCode)) } else -> { - promise.resumeWith(Result.failure(UnsupportedOperationException())) + promise.resumeWithException(UnsupportedOperationException()) } } } diff --git a/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt b/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt index 44e02fea0b..62bdc61b63 100644 --- a/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/HomeActivityViewModel.kt @@ -52,6 +52,7 @@ import org.matrix.android.sdk.rx.rx import timber.log.Timber import kotlin.coroutines.Continuation import kotlin.coroutines.resume +import kotlin.coroutines.resumeWithException class HomeActivityViewModel @AssistedInject constructor( @Assisted initialState: HomeActivityViewState, @@ -228,7 +229,7 @@ class HomeActivityViewModel @AssistedInject constructor( ) ) } else { - promise.resumeWith(Result.failure(Exception("Cannot silently initialize cross signing, UIA missing"))) + promise.resumeWithException(Exception("Cannot silently initialize cross signing, UIA missing")) } } }, diff --git a/vector/src/main/java/im/vector/app/features/settings/account/deactivation/DeactivateAccountViewModel.kt b/vector/src/main/java/im/vector/app/features/settings/account/deactivation/DeactivateAccountViewModel.kt index f561a78caf..80af64d9f3 100644 --- a/vector/src/main/java/im/vector/app/features/settings/account/deactivation/DeactivateAccountViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/settings/account/deactivation/DeactivateAccountViewModel.kt @@ -38,6 +38,7 @@ import org.matrix.android.sdk.api.auth.UserPasswordAuth import timber.log.Timber import kotlin.coroutines.Continuation import kotlin.coroutines.resume +import kotlin.coroutines.resumeWithException data class DeactivateAccountViewState( val passwordShown: Boolean = false @@ -64,7 +65,7 @@ class DeactivateAccountViewModel @AssistedInject constructor(@Assisted private v if (pendingAuth != null) { uiaContinuation?.resume(pendingAuth!!) } else { - uiaContinuation?.resumeWith(Result.failure((IllegalArgumentException()))) + uiaContinuation?.resumeWithException(IllegalArgumentException()) } } is DeactivateAccountAction.PasswordAuthDone -> { @@ -79,7 +80,7 @@ class DeactivateAccountViewModel @AssistedInject constructor(@Assisted private v } DeactivateAccountAction.ReAuthCancelled -> { Timber.d("## UIA - Reauth cancelled") - uiaContinuation?.resumeWith(Result.failure((Exception()))) + uiaContinuation?.resumeWithException(Exception()) uiaContinuation = null pendingAuth = null } diff --git a/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsViewModel.kt b/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsViewModel.kt index 566dea2cd4..8bdf97b6ec 100644 --- a/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsViewModel.kt @@ -49,6 +49,7 @@ import org.matrix.android.sdk.rx.rx import timber.log.Timber import kotlin.coroutines.Continuation import kotlin.coroutines.resume +import kotlin.coroutines.resumeWithException class CrossSigningSettingsViewModel @AssistedInject constructor( @Assisted private val initialState: CrossSigningSettingsViewState, @@ -130,7 +131,7 @@ class CrossSigningSettingsViewModel @AssistedInject constructor( if (pendingAuth != null) { uiaContinuation?.resume(pendingAuth!!) } else { - uiaContinuation?.resumeWith(Result.failure((IllegalArgumentException()))) + uiaContinuation?.resumeWithException(IllegalArgumentException()) } } is CrossSigningSettingsAction.PasswordAuthDone -> { @@ -146,7 +147,7 @@ class CrossSigningSettingsViewModel @AssistedInject constructor( CrossSigningSettingsAction.ReAuthCancelled -> { Timber.d("## UIA - Reauth cancelled") _viewEvents.post(CrossSigningSettingsViewEvents.HideModalWaitingView) - uiaContinuation?.resumeWith(Result.failure((Exception()))) + uiaContinuation?.resumeWithException(Exception()) uiaContinuation = null pendingAuth = null } diff --git a/vector/src/main/java/im/vector/app/features/settings/devices/DevicesViewModel.kt b/vector/src/main/java/im/vector/app/features/settings/devices/DevicesViewModel.kt index a56a7b8d48..c48b08e806 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devices/DevicesViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devices/DevicesViewModel.kt @@ -64,6 +64,7 @@ import java.util.concurrent.TimeUnit import javax.net.ssl.HttpsURLConnection import kotlin.coroutines.Continuation import kotlin.coroutines.resume +import kotlin.coroutines.resumeWithException data class DevicesViewState( val myDeviceId: String = "", @@ -217,7 +218,7 @@ class DevicesViewModel @AssistedInject constructor( if (pendingAuth != null) { uiaContinuation?.resume(pendingAuth!!) } else { - uiaContinuation?.resumeWith(Result.failure((IllegalArgumentException()))) + uiaContinuation?.resumeWithException(IllegalArgumentException()) } Unit } @@ -235,7 +236,7 @@ class DevicesViewModel @AssistedInject constructor( DevicesAction.ReAuthCancelled -> { Timber.d("## UIA - Reauth cancelled") // _viewEvents.post(DevicesViewEvents.Loading) - uiaContinuation?.resumeWith(Result.failure((Exception()))) + uiaContinuation?.resumeWithException(Exception()) uiaContinuation = null pendingAuth = null } diff --git a/vector/src/main/java/im/vector/app/features/settings/threepids/ThreePidsSettingsViewModel.kt b/vector/src/main/java/im/vector/app/features/settings/threepids/ThreePidsSettingsViewModel.kt index a1d4d6227b..89d632b813 100644 --- a/vector/src/main/java/im/vector/app/features/settings/threepids/ThreePidsSettingsViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/settings/threepids/ThreePidsSettingsViewModel.kt @@ -46,6 +46,7 @@ import org.matrix.android.sdk.rx.rx import timber.log.Timber import kotlin.coroutines.Continuation import kotlin.coroutines.resume +import kotlin.coroutines.resumeWithException class ThreePidsSettingsViewModel @AssistedInject constructor( @Assisted initialState: ThreePidsSettingsViewState, @@ -140,7 +141,7 @@ class ThreePidsSettingsViewModel @AssistedInject constructor( if (pendingAuth != null) { uiaContinuation?.resume(pendingAuth!!) } else { - uiaContinuation?.resumeWith(Result.failure((IllegalArgumentException()))) + uiaContinuation?.resumeWithException(IllegalArgumentException()) } } is ThreePidsSettingsAction.PasswordAuthDone -> { @@ -155,7 +156,7 @@ class ThreePidsSettingsViewModel @AssistedInject constructor( } ThreePidsSettingsAction.ReAuthCancelled -> { Timber.d("## UIA - Reauth cancelled") - uiaContinuation?.resumeWith(Result.failure((Exception()))) + uiaContinuation?.resumeWithException(Exception()) uiaContinuation = null pendingAuth = null }