adding post account created screen, going to the personalise next steps are still TODO
This commit is contained in:
parent
8212b7e219
commit
023b32367b
|
@ -97,6 +97,7 @@ import im.vector.app.features.login2.created.AccountCreatedFragment
|
|||
import im.vector.app.features.login2.terms.LoginTermsFragment2
|
||||
import im.vector.app.features.matrixto.MatrixToRoomSpaceFragment
|
||||
import im.vector.app.features.matrixto.MatrixToUserFragment
|
||||
import im.vector.app.features.onboarding.ftueauth.FtueAuthAccountCreatedFragment
|
||||
import im.vector.app.features.onboarding.ftueauth.FtueAuthCaptchaFragment
|
||||
import im.vector.app.features.onboarding.ftueauth.FtueAuthGenericTextInputFormFragment
|
||||
import im.vector.app.features.onboarding.ftueauth.FtueAuthLoginFragment
|
||||
|
@ -473,6 +474,11 @@ interface FragmentModule {
|
|||
@FragmentKey(FtueAuthTermsFragment::class)
|
||||
fun bindFtueAuthTermsFragment(fragment: FtueAuthTermsFragment): Fragment
|
||||
|
||||
@Binds
|
||||
@IntoMap
|
||||
@FragmentKey(FtueAuthAccountCreatedFragment::class)
|
||||
fun bindFtueAuthAccountCreatedFragment(fragment: FtueAuthAccountCreatedFragment): Fragment
|
||||
|
||||
@Binds
|
||||
@IntoMap
|
||||
@FragmentKey(UserListFragment::class)
|
||||
|
|
|
@ -79,4 +79,7 @@ sealed class OnboardingAction : VectorViewModelAction {
|
|||
data class PostViewEvent(val viewEvent: OnboardingViewEvents) : OnboardingAction()
|
||||
|
||||
data class UserAcceptCertificate(val fingerprint: Fingerprint) : OnboardingAction()
|
||||
|
||||
object TakeMeHome: OnboardingAction()
|
||||
object PersonalizeProfile: OnboardingAction()
|
||||
}
|
||||
|
|
|
@ -50,4 +50,6 @@ sealed class OnboardingViewEvents : VectorViewEvents {
|
|||
data class OnWebLoginError(val errorCode: Int, val description: String, val failingUrl: String) : OnboardingViewEvents()
|
||||
object OnAccountCreated: OnboardingViewEvents()
|
||||
object OnAccountSignedIn: OnboardingViewEvents()
|
||||
object OnTakeMeHome: OnboardingViewEvents()
|
||||
object OnPersonalizeProfile: OnboardingViewEvents()
|
||||
}
|
||||
|
|
|
@ -147,6 +147,8 @@ class OnboardingViewModel @AssistedInject constructor(
|
|||
is OnboardingAction.UserAcceptCertificate -> handleUserAcceptCertificate(action)
|
||||
OnboardingAction.ClearHomeServerHistory -> handleClearHomeServerHistory()
|
||||
is OnboardingAction.PostViewEvent -> _viewEvents.post(action.viewEvent)
|
||||
OnboardingAction.PersonalizeProfile -> _viewEvents.post(OnboardingViewEvents.OnPersonalizeProfile)
|
||||
OnboardingAction.TakeMeHome -> _viewEvents.post(OnboardingViewEvents.OnTakeMeHome)
|
||||
}.exhaustive
|
||||
}
|
||||
|
||||
|
|
|
@ -70,9 +70,7 @@ data class OnboardingViewState(
|
|||
asyncHomeServerLoginFlowRequest is Loading ||
|
||||
asyncResetPassword is Loading ||
|
||||
asyncResetMailConfirmed is Loading ||
|
||||
asyncRegistration is Loading ||
|
||||
// Keep loading when it is success because of the delay to switch to the next Activity
|
||||
asyncLoginAction is Success
|
||||
asyncRegistration is Loading
|
||||
}
|
||||
|
||||
fun isUserLogged(): Boolean {
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2021 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package im.vector.app.features.onboarding.ftueauth
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.di.ActiveSessionHolder
|
||||
import im.vector.app.databinding.FragmentFtueAccountCreatedBinding
|
||||
import im.vector.app.features.onboarding.OnboardingAction
|
||||
import javax.inject.Inject
|
||||
|
||||
class FtueAuthAccountCreatedFragment @Inject constructor(
|
||||
private val activeSessionHolder: ActiveSessionHolder
|
||||
) : AbstractFtueAuthFragment<FragmentFtueAccountCreatedBinding>() {
|
||||
|
||||
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentFtueAccountCreatedBinding {
|
||||
return FragmentFtueAccountCreatedBinding.inflate(inflater, container, false)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
setupViews()
|
||||
}
|
||||
|
||||
private fun setupViews() {
|
||||
views.accountCreatedSubtitle.text = getString(R.string.ftue_account_created_subtitle, activeSessionHolder.getActiveSession().myUserId)
|
||||
views.accountCreatedPersonalize.setOnClickListener { viewModel.handle(OnboardingAction.PersonalizeProfile) }
|
||||
views.accountCreatedTakeMeHome.setOnClickListener { viewModel.handle(OnboardingAction.TakeMeHome) }
|
||||
}
|
||||
|
||||
override fun resetViewModel() {
|
||||
// Nothing to do
|
||||
}
|
||||
}
|
|
@ -222,6 +222,9 @@ class FtueAuthVariant(
|
|||
}
|
||||
OnboardingViewEvents.OnAccountCreated -> onAccountCreated()
|
||||
OnboardingViewEvents.OnAccountSignedIn -> onAccountSignedIn()
|
||||
OnboardingViewEvents.OnPersonalizeProfile -> TODO()
|
||||
OnboardingViewEvents.OnTakeMeHome -> navigateToHome(createdAccount = true)
|
||||
|
||||
}.exhaustive
|
||||
}
|
||||
|
||||
|
@ -366,7 +369,15 @@ class FtueAuthVariant(
|
|||
}
|
||||
|
||||
private fun onAccountCreated() {
|
||||
navigateToHome(createdAccount = true)
|
||||
if (vectorFeatures.isOnboardingPersonalizeEnabled()) {
|
||||
activity.addFragmentToBackstack(
|
||||
views.loginFragmentContainer,
|
||||
FtueAuthAccountCreatedFragment::class.java,
|
||||
option = commonOption
|
||||
)
|
||||
} else {
|
||||
navigateToHome(createdAccount = true)
|
||||
}
|
||||
}
|
||||
|
||||
private fun navigateToHome(createdAccount: Boolean) {
|
||||
|
|
|
@ -0,0 +1,127 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?colorSecondary">
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/ftueAuthGutterStart"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="@dimen/ftue_auth_gutter_start_percent" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/ftueAuthGutterEnd"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="@dimen/ftue_auth_gutter_end_percent" />
|
||||
|
||||
<Space
|
||||
android:id="@+id/accountCreatedSpace1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/accountCreatedLogo"
|
||||
app:layout_constraintHeight_percent="0.10"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_chainStyle="spread_inside" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/accountCreatedLogo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:importantForAccessibility="no"
|
||||
android:src="@drawable/ic_user_round"
|
||||
app:layout_constraintBottom_toTopOf="@id/accountCreatedSpace2"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHeight_percent="0.15"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/accountCreatedSpace1"
|
||||
app:tint="@color/element_background_light" />
|
||||
|
||||
<Space
|
||||
android:id="@+id/accountCreatedSpace2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/accountCreatedTitle"
|
||||
app:layout_constraintHeight_percent="0.05"
|
||||
app:layout_constraintTop_toBottomOf="@id/accountCreatedLogo" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/accountCreatedTitle"
|
||||
style="@style/Widget.Vector.TextView.Title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/ftue_account_created_congratulations_title"
|
||||
android:textColor="@color/element_background_light"
|
||||
android:transitionName="loginTitleTransition"
|
||||
app:layout_constraintBottom_toTopOf="@id/accountCreatedSubtitle"
|
||||
app:layout_constraintEnd_toEndOf="@id/ftueAuthGutterEnd"
|
||||
app:layout_constraintStart_toStartOf="@id/ftueAuthGutterStart"
|
||||
app:layout_constraintTop_toBottomOf="@id/accountCreatedSpace2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/accountCreatedSubtitle"
|
||||
style="@style/Widget.Vector.TextView.Subtitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/element_background_light"
|
||||
app:layout_constraintBottom_toTopOf="@id/accountCreatedSpace4"
|
||||
app:layout_constraintEnd_toEndOf="@id/ftueAuthGutterEnd"
|
||||
app:layout_constraintStart_toStartOf="@id/ftueAuthGutterStart"
|
||||
app:layout_constraintTop_toBottomOf="@id/accountCreatedTitle"
|
||||
tools:text="Your account @hello:matrix.org has been created" />
|
||||
|
||||
<Space
|
||||
android:id="@+id/accountCreatedSpace4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/accountCreatedPersonalize"
|
||||
app:layout_constraintTop_toBottomOf="@id/accountCreatedSubtitle" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/accountCreatedPersonalize"
|
||||
style="@style/Widget.Vector.Button.Login"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:backgroundTint="@color/element_background_light"
|
||||
android:text="@string/ftue_account_created_personalize"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="?colorSecondary"
|
||||
android:transitionName="loginSubmitTransition"
|
||||
app:layout_constraintBottom_toTopOf="@id/accountCreatedSpace5"
|
||||
app:layout_constraintEnd_toEndOf="@id/ftueAuthGutterEnd"
|
||||
app:layout_constraintStart_toStartOf="@id/ftueAuthGutterStart"
|
||||
app:layout_constraintTop_toBottomOf="@id/accountCreatedSpace4"
|
||||
tools:text="@string/ftue_account_created_personalize" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/accountCreatedTakeMeHome"
|
||||
style="@style/Widget.Vector.Button.Text.Login"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/ftue_account_created_take_me_home"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="@color/element_background_light"
|
||||
android:transitionName="loginSubmitTransition"
|
||||
app:layout_constraintBottom_toTopOf="@id/accountCreatedSpace5"
|
||||
app:layout_constraintEnd_toEndOf="@id/ftueAuthGutterEnd"
|
||||
app:layout_constraintStart_toStartOf="@id/ftueAuthGutterStart"
|
||||
app:layout_constraintTop_toBottomOf="@id/accountCreatedPersonalize" />
|
||||
|
||||
<Space
|
||||
android:id="@+id/accountCreatedSpace5"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHeight_percent="0.05"
|
||||
app:layout_constraintTop_toBottomOf="@id/accountCreatedPersonalize" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -16,4 +16,10 @@
|
|||
|
||||
<!-- onboarding english only word play -->
|
||||
<string name="cut_the_slack_from_teams" translatable="false">Cut the slack from teams.</string>
|
||||
|
||||
<!-- WIP -->
|
||||
<string name="ftue_account_created_personalize" translatable="false">Personalise profile</string>
|
||||
<string name="ftue_account_created_take_me_home" translatable="false">Take me home</string>
|
||||
<string name="ftue_account_created_congratulations_title" translatable="false">Congratulations!</string>
|
||||
<string name="ftue_account_created_subtitle" translatable="false">Your account %s has been created</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue