Removing unused Session recovery action from onboarding
This commit is contained in:
parent
cee5ea03ae
commit
8115b4b6e6
|
@ -21,7 +21,6 @@ import im.vector.app.features.login.LoginConfig
|
|||
import im.vector.app.features.login.ServerType
|
||||
import im.vector.app.features.login.SignMode
|
||||
import org.matrix.android.sdk.api.auth.data.Credentials
|
||||
import org.matrix.android.sdk.api.auth.data.SsoIdentityProvider
|
||||
import org.matrix.android.sdk.api.auth.registration.RegisterThreePid
|
||||
import org.matrix.android.sdk.internal.network.ssl.Fingerprint
|
||||
|
||||
|
@ -71,11 +70,6 @@ sealed class OnboardingAction : VectorViewModelAction {
|
|||
// Homeserver history
|
||||
object ClearHomeServerHistory : OnboardingAction()
|
||||
|
||||
// For the soft logout case
|
||||
data class SetupSsoForSessionRecovery(val homeServerUrl: String,
|
||||
val deviceId: String,
|
||||
val ssoIdentityProviders: List<SsoIdentityProvider>?) : OnboardingAction()
|
||||
|
||||
data class PostViewEvent(val viewEvent: OnboardingViewEvents) : OnboardingAction()
|
||||
|
||||
data class UserAcceptCertificate(val fingerprint: Fingerprint) : OnboardingAction()
|
||||
|
|
|
@ -143,7 +143,6 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
is OnboardingAction.ResetPasswordMailConfirmed -> handleResetPasswordMailConfirmed()
|
||||
is OnboardingAction.RegisterAction -> handleRegisterAction(action)
|
||||
is OnboardingAction.ResetAction -> handleResetAction(action)
|
||||
is OnboardingAction.SetupSsoForSessionRecovery -> handleSetupSsoForSessionRecovery(action)
|
||||
is OnboardingAction.UserAcceptCertificate -> handleUserAcceptCertificate(action)
|
||||
OnboardingAction.ClearHomeServerHistory -> handleClearHomeServerHistory()
|
||||
is OnboardingAction.PostViewEvent -> _viewEvents.post(action.viewEvent)
|
||||
|
@ -249,18 +248,6 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun handleSetupSsoForSessionRecovery(action: OnboardingAction.SetupSsoForSessionRecovery) {
|
||||
setState {
|
||||
copy(
|
||||
signMode = SignMode.SignIn,
|
||||
loginMode = LoginMode.Sso(action.ssoIdentityProviders),
|
||||
homeServerUrlFromUser = action.homeServerUrl,
|
||||
homeServerUrl = action.homeServerUrl,
|
||||
deviceId = action.deviceId
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleRegisterAction(action: OnboardingAction.RegisterAction) {
|
||||
when (action) {
|
||||
is OnboardingAction.CaptchaDone -> handleCaptchaDone(action)
|
||||
|
|
|
@ -30,7 +30,6 @@ import android.view.ViewGroup
|
|||
import android.webkit.SslErrorHandler
|
||||
import android.webkit.WebView
|
||||
import android.webkit.WebViewClient
|
||||
import com.airbnb.mvrx.activityViewModel
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.utils.AssetReader
|
||||
|
@ -40,8 +39,6 @@ import im.vector.app.features.login.SignMode
|
|||
import im.vector.app.features.onboarding.OnboardingAction
|
||||
import im.vector.app.features.onboarding.OnboardingViewEvents
|
||||
import im.vector.app.features.onboarding.OnboardingViewState
|
||||
import im.vector.app.features.signout.soft.SoftLogoutAction
|
||||
import im.vector.app.features.signout.soft.SoftLogoutViewModel
|
||||
import org.matrix.android.sdk.api.auth.data.Credentials
|
||||
import org.matrix.android.sdk.internal.di.MoshiProvider
|
||||
import timber.log.Timber
|
||||
|
@ -56,15 +53,11 @@ class FtueAuthWebFragment @Inject constructor(
|
|||
private val assetReader: AssetReader
|
||||
) : AbstractFtueAuthFragment<FragmentLoginWebBinding>() {
|
||||
|
||||
// TODO confirm the need of this viewModel
|
||||
val softLogoutViewModel: SoftLogoutViewModel by activityViewModel()
|
||||
|
||||
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentLoginWebBinding {
|
||||
return FragmentLoginWebBinding.inflate(inflater, container, false)
|
||||
}
|
||||
|
||||
private var isWebViewLoaded = false
|
||||
private var isForSessionRecovery = false
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
@ -76,8 +69,6 @@ class FtueAuthWebFragment @Inject constructor(
|
|||
override fun updateWithState(state: OnboardingViewState) {
|
||||
setupTitle(state)
|
||||
|
||||
isForSessionRecovery = state.deviceId?.isNotBlank() == true
|
||||
|
||||
if (!isWebViewLoaded) {
|
||||
setupWebView(state)
|
||||
isWebViewLoaded = true
|
||||
|
@ -240,11 +231,7 @@ class FtueAuthWebFragment @Inject constructor(
|
|||
}
|
||||
|
||||
private fun notifyViewModel(credentials: Credentials) {
|
||||
if (isForSessionRecovery) {
|
||||
softLogoutViewModel.handle(SoftLogoutAction.WebLoginSuccess(credentials))
|
||||
} else {
|
||||
viewModel.handle(OnboardingAction.WebLoginSuccess(credentials))
|
||||
}
|
||||
viewModel.handle(OnboardingAction.WebLoginSuccess(credentials))
|
||||
}
|
||||
|
||||
override fun resetViewModel() {
|
||||
|
|
Loading…
Reference in New Issue