mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 10:25:35 +03:00
launching the edit selection from the ftue variant entry point
This commit is contained in:
parent
985dbfe97d
commit
51c294a6fc
5 changed files with 24 additions and 20 deletions
|
@ -37,6 +37,7 @@ sealed class OnboardingViewEvents : VectorViewEvents {
|
|||
object OpenUseCaseSelection : OnboardingViewEvents()
|
||||
object OpenServerSelection : OnboardingViewEvents()
|
||||
object OpenCombinedRegister : OnboardingViewEvents()
|
||||
object EditServerSelection : OnboardingViewEvents()
|
||||
data class OnServerSelectionDone(val serverType: ServerType) : OnboardingViewEvents()
|
||||
object OnLoginFlowRetrieved : OnboardingViewEvents()
|
||||
data class OnSignModeSelected(val signMode: SignMode) : OnboardingViewEvents()
|
||||
|
|
|
@ -646,19 +646,17 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
else -> LoginMode.Unsupported
|
||||
}
|
||||
|
||||
val serverSelection = ServerSelectionState(
|
||||
description = when (data.homeServerUrl) {
|
||||
matrixOrgUrl -> stringProvider.getString(R.string.ftue_auth_create_account_matrix_dot_org_server_description)
|
||||
else -> null
|
||||
},
|
||||
userUrlInput = homeServerConnectionConfig.homeServerUri.toString(),
|
||||
hostedUrl = data.homeServerUrl
|
||||
)
|
||||
|
||||
setState {
|
||||
copy(
|
||||
serverSelectionState = serverSelectionState.copy(
|
||||
description = when (data.homeServerUrl) {
|
||||
matrixOrgUrl -> stringProvider.getString(R.string.ftue_auth_create_account_matrix_dot_org_server_description)
|
||||
else -> null
|
||||
},
|
||||
userUrlInput = homeServerConnectionConfig.homeServerUri.toString(),
|
||||
hostedUrl = data.homeServerUrl
|
||||
),
|
||||
isLoading = false,
|
||||
serverSelectionState = serverSelection,
|
||||
loginMode = loginMode,
|
||||
loginModeSupportedTypes = data.supportedLoginTypes.toList()
|
||||
)
|
||||
|
|
|
@ -22,7 +22,6 @@ import android.view.LayoutInflater
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.autofill.HintConstants
|
||||
import androidx.core.text.isDigitsOnly
|
||||
import androidx.core.view.isVisible
|
||||
|
@ -30,8 +29,6 @@ import androidx.lifecycle.lifecycleScope
|
|||
import com.airbnb.mvrx.withState
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.extensions.addFragment
|
||||
import im.vector.app.core.extensions.commitTransaction
|
||||
import im.vector.app.core.extensions.content
|
||||
import im.vector.app.core.extensions.editText
|
||||
import im.vector.app.core.extensions.hasContentFlow
|
||||
|
@ -39,7 +36,6 @@ import im.vector.app.core.extensions.hasSurroundingSpaces
|
|||
import im.vector.app.core.extensions.hideKeyboard
|
||||
import im.vector.app.core.extensions.hidePassword
|
||||
import im.vector.app.core.extensions.realignPercentagesToParent
|
||||
import im.vector.app.core.extensions.toMvRxBundle
|
||||
import im.vector.app.core.extensions.toReducedUrl
|
||||
import im.vector.app.databinding.FragmentFtueSignUpCombinedBinding
|
||||
import im.vector.app.features.login.LoginMode
|
||||
|
@ -47,6 +43,7 @@ import im.vector.app.features.login.SSORedirectRouterActivity
|
|||
import im.vector.app.features.login.ServerType
|
||||
import im.vector.app.features.login.SocialLoginButtonsView
|
||||
import im.vector.app.features.onboarding.OnboardingAction
|
||||
import im.vector.app.features.onboarding.OnboardingViewEvents
|
||||
import im.vector.app.features.onboarding.OnboardingViewState
|
||||
import kotlinx.coroutines.flow.combine
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
|
@ -69,13 +66,9 @@ class FtueAuthCombinedRegisterFragment @Inject constructor() : AbstractSSOFtueAu
|
|||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
setupSubmitButton()
|
||||
|
||||
views.createAccountRoot.realignPercentagesToParent()
|
||||
|
||||
views.editServerButton.debouncedClicks {
|
||||
requireActivity().supportFragmentManager.commitTransaction(true) {
|
||||
add(R.id.loginFragmentContainer, FtueAuthCombinedServerSelectionFragment(), null)
|
||||
}
|
||||
viewModel.handle(OnboardingAction.PostViewEvent(OnboardingViewEvents.EditServerSelection))
|
||||
}
|
||||
|
||||
views.createAccountPasswordInput.editText().setOnEditorActionListener { _, actionId, _ ->
|
||||
|
|
|
@ -20,6 +20,7 @@ import android.os.Bundle
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import im.vector.app.core.extensions.content
|
||||
import im.vector.app.core.extensions.editText
|
||||
import im.vector.app.core.extensions.realignPercentagesToParent
|
||||
import im.vector.app.core.extensions.toReducedUrl
|
||||
|
@ -29,7 +30,7 @@ import im.vector.app.features.onboarding.OnboardingViewEvents
|
|||
import im.vector.app.features.onboarding.OnboardingViewState
|
||||
import javax.inject.Inject
|
||||
|
||||
class FtueAuthCombinedServerSelectionFragment @Inject constructor() : AbstractSSOFtueAuthFragment<FragmentFtueServerSelectionCombinedBinding>() {
|
||||
class FtueAuthCombinedServerSelectionFragment @Inject constructor() : AbstractFtueAuthFragment<FragmentFtueServerSelectionCombinedBinding>() {
|
||||
|
||||
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentFtueServerSelectionCombinedBinding {
|
||||
return FragmentFtueServerSelectionCombinedBinding.inflate(inflater, container, false)
|
||||
|
@ -42,6 +43,10 @@ class FtueAuthCombinedServerSelectionFragment @Inject constructor() : AbstractSS
|
|||
views.chooseServerToolbar.setNavigationOnClickListener {
|
||||
viewModel.handle(OnboardingAction.PostViewEvent(OnboardingViewEvents.OnBack))
|
||||
}
|
||||
|
||||
views.chooseServerSubmit.debouncedClicks {
|
||||
viewModel.handle(OnboardingAction.UpdateHomeServer(views.chooseServerInput.content()))
|
||||
}
|
||||
}
|
||||
|
||||
override fun resetViewModel() {
|
||||
|
|
|
@ -233,6 +233,13 @@ class FtueAuthVariant(
|
|||
OnboardingViewEvents.OnChooseProfilePicture -> onChooseProfilePicture()
|
||||
OnboardingViewEvents.OnPersonalizationComplete -> onPersonalizationComplete()
|
||||
OnboardingViewEvents.OnBack -> activity.popBackstack()
|
||||
OnboardingViewEvents.EditServerSelection -> {
|
||||
activity.addFragmentToBackstack(
|
||||
views.loginFragmentContainer,
|
||||
FtueAuthCombinedServerSelectionFragment::class.java,
|
||||
option = commonOption
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue