Merge pull request #6569 from vector-im/feature/adm/ftue-copy-review

FTUE - Copy review
This commit is contained in:
Benoit Marty 2022-07-19 14:49:28 +02:00 committed by GitHub
commit 70c62233d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 130 additions and 127 deletions

1
changelog.d/6547.feature Normal file
View file

@ -0,0 +1 @@
Updates the copy within the FTUE onboarding

View file

@ -645,6 +645,7 @@ class OnboardingViewModel @AssistedInject constructor(
val homeServerCapabilities = session.homeServerCapabilitiesService().getHomeServerCapabilities()
val capabilityOverrides = vectorOverrides.forceHomeserverCapabilities?.firstOrNull()
state.personalizationState.copy(
displayName = state.registrationState.selectedMatrixId?.let { MatrixPatterns.extractUserNameFromId(it) },
supportsChangingDisplayName = capabilityOverrides?.canChangeDisplayName ?: homeServerCapabilities.canChangeDisplayName,
supportsChangingProfilePicture = capabilityOverrides?.canChangeAvatar ?: homeServerCapabilities.canChangeAvatar
)

View file

@ -16,15 +16,18 @@
package im.vector.app.features.onboarding.ftueauth
import android.graphics.Typeface
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.text.toSpannable
import androidx.core.view.isVisible
import im.vector.app.R
import im.vector.app.core.animations.play
import im.vector.app.core.di.ActiveSessionHolder
import im.vector.app.core.utils.isAnimationEnabled
import im.vector.app.core.utils.styleMatchingText
import im.vector.app.databinding.FragmentFtueAccountCreatedBinding
import im.vector.app.features.onboarding.OnboardingAction
import im.vector.app.features.onboarding.OnboardingViewEvents
@ -47,7 +50,9 @@ class FtueAuthAccountCreatedFragment @Inject constructor(
}
private fun setupViews() {
views.accountCreatedSubtitle.text = getString(R.string.ftue_account_created_subtitle, activeSessionHolder.getActiveSession().myUserId)
val userId = activeSessionHolder.getActiveSession().myUserId
val subtitle = getString(R.string.ftue_account_created_subtitle, userId).toSpannable().styleMatchingText(userId, Typeface.BOLD)
views.accountCreatedSubtitle.text = subtitle
views.accountCreatedPersonalize.debouncedClicks { viewModel.handle(OnboardingAction.PersonalizeProfile) }
views.accountCreatedTakeMeHome.debouncedClicks { viewModel.handle(OnboardingAction.PostViewEvent(OnboardingViewEvents.OnTakeMeHome)) }
views.accountCreatedTakeMeHomeCta.debouncedClicks { viewModel.handle(OnboardingAction.PostViewEvent(OnboardingViewEvents.OnTakeMeHome)) }

View file

@ -20,14 +20,17 @@ 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.extensions.associateContentStateWith
import im.vector.app.core.extensions.autofillEmail
import im.vector.app.core.extensions.clearErrorOnChange
import im.vector.app.core.extensions.content
import im.vector.app.core.extensions.isEmail
import im.vector.app.core.extensions.setOnImeDoneListener
import im.vector.app.core.extensions.toReducedUrl
import im.vector.app.databinding.FragmentFtueEmailInputBinding
import im.vector.app.features.onboarding.OnboardingAction
import im.vector.app.features.onboarding.OnboardingViewState
import im.vector.app.features.onboarding.RegisterAction
import org.matrix.android.sdk.api.auth.registration.RegisterThreePid
import javax.inject.Inject
@ -56,6 +59,10 @@ class FtueAuthEmailEntryFragment @Inject constructor() : AbstractFtueAuthFragmen
viewModel.handle(OnboardingAction.PostRegisterAction(RegisterAction.AddThreePid(RegisterThreePid.Email(email))))
}
override fun updateWithState(state: OnboardingViewState) {
views.emailEntryHeaderSubtitle.text = getString(R.string.ftue_auth_email_subtitle, state.selectedHomeserver.userFacingUrl.toReducedUrl())
}
override fun onError(throwable: Throwable) {
views.emailEntryInput.error = errorFormatter.toHumanReadable(throwable)
}

View file

@ -27,8 +27,10 @@ import im.vector.app.core.extensions.autofillPhoneNumber
import im.vector.app.core.extensions.content
import im.vector.app.core.extensions.editText
import im.vector.app.core.extensions.setOnImeDoneListener
import im.vector.app.core.extensions.toReducedUrl
import im.vector.app.databinding.FragmentFtuePhoneInputBinding
import im.vector.app.features.onboarding.OnboardingAction
import im.vector.app.features.onboarding.OnboardingViewState
import im.vector.app.features.onboarding.RegisterAction
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
@ -77,6 +79,10 @@ class FtueAuthPhoneEntryFragment @Inject constructor(
}
}
override fun updateWithState(state: OnboardingViewState) {
views.phoneEntryHeaderSubtitle.text = getString(R.string.ftue_auth_phone_subtitle, state.selectedHomeserver.userFacingUrl.toReducedUrl())
}
override fun onError(throwable: Throwable) {
views.phoneEntryInput.error = errorFormatter.toHumanReadable(throwable)
}

View file

@ -57,7 +57,7 @@ class FtueAuthResetPasswordBreakerFragment : AbstractFtueAuthFragment<FragmentFt
views.resetPasswordBreakerGradientContainer.setBackgroundResource(themeProvider.ftueBreakerBackground())
views.resetPasswordBreakerTitle.text = getString(R.string.ftue_auth_reset_password_breaker_title)
.colorTerminatingFullStop(ThemeUtils.getColor(requireContext(), R.attr.colorSecondary))
views.resetPasswordBreakerSubtitle.text = getString(R.string.ftue_auth_email_verification_subtitle, params.email)
views.resetPasswordBreakerSubtitle.text = getString(R.string.ftue_auth_password_reset_email_confirmation_subtitle, params.email)
views.resetPasswordBreakerResendEmail.debouncedClicks { viewModel.handle(OnboardingAction.ResendResetPassword) }
views.resetPasswordBreakerFooter.debouncedClicks {
viewModel.handle(OnboardingAction.PostViewEvent(OnboardingViewEvents.OnResetPasswordBreakerConfirmed))

View file

@ -21,13 +21,16 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.R
import im.vector.app.core.extensions.associateContentStateWith
import im.vector.app.core.extensions.clearErrorOnChange
import im.vector.app.core.extensions.content
import im.vector.app.core.extensions.isEmail
import im.vector.app.core.extensions.setOnImeDoneListener
import im.vector.app.core.extensions.toReducedUrl
import im.vector.app.databinding.FragmentFtueResetPasswordEmailInputBinding
import im.vector.app.features.onboarding.OnboardingAction
import im.vector.app.features.onboarding.OnboardingViewState
@AndroidEntryPoint
class FtueAuthResetPasswordEmailEntryFragment : AbstractFtueAuthFragment<FragmentFtueResetPasswordEmailInputBinding>() {
@ -53,6 +56,13 @@ class FtueAuthResetPasswordEmailEntryFragment : AbstractFtueAuthFragment<Fragmen
viewModel.handle(OnboardingAction.ResetPassword(email = email, newPassword = null))
}
override fun updateWithState(state: OnboardingViewState) {
views.emailEntryHeaderSubtitle.text = getString(
R.string.ftue_auth_reset_password_email_subtitle,
state.selectedHomeserver.userFacingUrl.toReducedUrl()
)
}
override fun onError(throwable: Throwable) {
views.emailEntryInput.error = errorFormatter.toHumanReadable(throwable)
}

View file

@ -114,7 +114,9 @@ class FtueAuthTermsFragment @Inject constructor(
}
override fun updateWithState(state: OnboardingViewState) {
policyController.homeServer = state.selectedHomeserver.userFacingUrl.toReducedUrl()
val homeserverName = state.selectedHomeserver.userFacingUrl.toReducedUrl()
views.termsHeaderSubtitle.text = getString(R.string.ftue_auth_terms_subtitle, homeserverName)
policyController.homeServer = homeserverName
renderState()
}

View file

@ -140,7 +140,7 @@
style="@style/Widget.Vector.TextInputLayout.Username"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="@string/username"
android:hint="@string/ftue_auth_login_username_entry"
app:layout_constraintBottom_toTopOf="@id/entrySpacing"
app:layout_constraintEnd_toEndOf="@id/loginGutterEnd"
app:layout_constraintStart_toStartOf="@id/loginGutterStart"

View file

@ -58,24 +58,10 @@
android:gravity="center"
android:text="@string/ftue_display_name_title"
android:textColor="?vctr_content_primary"
app:layout_constraintBottom_toTopOf="@id/displayNameHeaderSubtitle"
app:layout_constraintEnd_toEndOf="@id/displayNameGutterEnd"
app:layout_constraintStart_toStartOf="@id/displayNameGutterStart"
app:layout_constraintTop_toBottomOf="@id/displayNameHeaderIcon" />
<TextView
android:id="@+id/displayNameHeaderSubtitle"
style="@style/Widget.Vector.TextView.Subtitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
android:text="@string/ftue_display_name_subtitle"
android:textColor="?vctr_content_secondary"
app:layout_constraintBottom_toTopOf="@id/titleContentSpacing"
app:layout_constraintEnd_toEndOf="@id/displayNameGutterEnd"
app:layout_constraintStart_toStartOf="@id/displayNameGutterStart"
app:layout_constraintTop_toBottomOf="@id/displayNameHeaderTitle" />
app:layout_constraintTop_toBottomOf="@id/displayNameHeaderIcon" />
<Space
android:id="@+id/titleContentSpacing"
@ -83,7 +69,7 @@
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@id/displayNameInput"
app:layout_constraintHeight_percent="0.03"
app:layout_constraintTop_toBottomOf="@id/displayNameHeaderSubtitle" />
app:layout_constraintTop_toBottomOf="@id/displayNameHeaderTitle" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/displayNameInput"

View file

@ -70,7 +70,6 @@
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
android:text="@string/ftue_auth_email_subtitle"
android:textColor="?vctr_content_secondary"
app:layout_constraintBottom_toTopOf="@id/titleContentSpacing"
app:layout_constraintEnd_toEndOf="@id/emailEntryGutterEnd"

View file

@ -53,26 +53,12 @@
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center"
android:text="@string/ftue_auth_create_account_title"
android:text="@string/ftue_auth_captcha_title"
android:textColor="?vctr_content_primary"
app:layout_constraintBottom_toTopOf="@id/captchaHeaderSubtitle"
app:layout_constraintEnd_toEndOf="@id/captchaGutterEnd"
app:layout_constraintStart_toStartOf="@id/captchaGutterStart"
app:layout_constraintTop_toBottomOf="@id/captchaHeaderIcon" />
<TextView
android:id="@+id/captchaHeaderSubtitle"
style="@style/Widget.Vector.TextView.Subtitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
android:text="@string/auth_recaptcha_message"
android:textColor="?vctr_content_secondary"
app:layout_constraintBottom_toTopOf="@id/titleContentSpacing"
app:layout_constraintEnd_toEndOf="@id/captchaGutterEnd"
app:layout_constraintStart_toStartOf="@id/captchaGutterStart"
app:layout_constraintTop_toBottomOf="@id/captchaHeaderTitle" />
app:layout_constraintTop_toBottomOf="@id/captchaHeaderIcon" />
<Space
android:id="@+id/titleContentSpacing"
@ -80,7 +66,7 @@
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@id/loginCaptchaWevView"
app:layout_constraintHeight_percent="0.03"
app:layout_constraintTop_toBottomOf="@id/captchaHeaderSubtitle" />
app:layout_constraintTop_toBottomOf="@id/captchaHeaderTitle" />
<WebView
android:id="@+id/loginCaptchaWevView"

View file

@ -73,7 +73,6 @@
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
android:text="@string/ftue_auth_terms_subtitle"
android:textColor="?vctr_content_secondary"
app:layout_constraintBottom_toTopOf="@id/titleContentSpacing"
app:layout_constraintEnd_toEndOf="@id/termsGutterEnd"

View file

@ -70,7 +70,6 @@
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
android:text="@string/ftue_auth_phone_subtitle"
android:textColor="?vctr_content_secondary"
app:layout_constraintBottom_toTopOf="@id/titleContentSpacing"
app:layout_constraintEnd_toEndOf="@id/phoneEntryGutterEnd"

View file

@ -70,7 +70,6 @@
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
android:text="@string/ftue_auth_reset_password_email_subtitle"
android:textColor="?vctr_content_secondary"
app:layout_constraintBottom_toTopOf="@id/titleContentSpacing"
app:layout_constraintEnd_toEndOf="@id/emailEntryGutterEnd"

View file

@ -97,7 +97,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="@string/ftue_auth_choose_server_entry_hint"
app:layout_constraintBottom_toTopOf="@id/chooseServerEntryFooter"
app:layout_constraintBottom_toTopOf="@id/actionSpacing"
app:layout_constraintEnd_toEndOf="@id/chooseServerGutterEnd"
app:layout_constraintStart_toStartOf="@id/chooseServerGutterStart"
app:layout_constraintTop_toBottomOf="@id/titleContentSpacing">
@ -111,25 +111,13 @@
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:id="@+id/chooseServerEntryFooter"
style="@style/Widget.Vector.TextView.Micro"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="@string/ftue_auth_choose_server_entry_footer"
app:layout_constraintBottom_toTopOf="@id/actionSpacing"
app:layout_constraintEnd_toEndOf="@id/chooseServerGutterEnd"
app:layout_constraintStart_toStartOf="@id/chooseServerGutterStart"
app:layout_constraintTop_toBottomOf="@id/chooseServerInput" />
<Space
android:id="@+id/actionSpacing"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@id/chooseServerSubmit"
app:layout_constraintHeight_percent="0.02"
app:layout_constraintTop_toBottomOf="@id/chooseServerEntryFooter" />
app:layout_constraintHeight_percent="0.03"
app:layout_constraintTop_toBottomOf="@id/chooseServerInput" />
<Button
android:id="@+id/chooseServerSubmit"

View file

@ -10,56 +10,5 @@
<string name="cut_the_slack_from_teams" translatable="false">Cut the slack from teams.</string>
<!-- WIP -->
<string name="ftue_auth_create_account_title">Create your account</string>
<!-- Note for translators, %s is the full matrix of the account being created, eg @hello:matrix.org -->
<string name="ftue_auth_create_account_username_entry_footer">Others can discover you %s</string>
<string name="ftue_auth_create_account_password_entry_footer">Must be 8 characters or more</string>
<string name="ftue_auth_create_account_choose_server_header">Where your conversations will live</string>
<string name="ftue_auth_create_account_sso_section_header">Or</string>
<string name="ftue_auth_create_account_edit_server_selection">Edit</string>
<string name="ftue_auth_welcome_back_title">Welcome back!</string>
<string name="ftue_auth_choose_server_title">Choose your server</string>
<string name="ftue_auth_choose_server_subtitle">What is the address of your server? Server is like a home for all your data.</string>
<string name="ftue_auth_choose_server_entry_hint">Server URL</string>
<string name="ftue_auth_choose_server_entry_footer">You can only connect to a server that has already been set up</string>
<string name="ftue_auth_choose_server_ems_title">Want to host your own server?</string>
<string name="ftue_auth_choose_server_ems_subtitle">Element Matrix Services (EMS) is a robust and reliable hosting service for fast, secure and real time communication. Find out how on <a href="${ftue_ems_url}">element.io/ems</a></string>
<string name="ftue_auth_choose_server_ems_cta">Get in touch</string>
<string name="ftue_auth_terms_title">Privacy policy</string>
<string name="ftue_auth_terms_subtitle">Please read through T&amp;C. You must accept in order to continue.</string>
<string name="ftue_auth_email_title">Enter your email address</string>
<string name="ftue_auth_email_subtitle">This will help verify your account and enables password recovery.</string>
<string name="ftue_auth_email_entry_title">Email Address</string>
<string name="ftue_auth_phone_title">Enter your phone number</string>
<string name="ftue_auth_phone_subtitle">This will help verify your account and enables password recovery.</string>
<string name="ftue_auth_phone_entry_title">Phone Number</string>
<string name="ftue_auth_phone_confirmation_entry_title">Confirmation code</string>
<string name="ftue_auth_reset_password_email_subtitle">We will send you a verification link.</string>
<string name="ftue_auth_reset_password_breaker_title">Check your email.</string>
<string name="ftue_auth_new_password_entry_title">New Password</string>
<string name="ftue_auth_new_password_title">Choose a new password</string>
<string name="ftue_auth_new_password_subtitle">Make sure it\'s 8 characters or more.</string>
<string name="ftue_auth_reset_password">Reset password</string>
<string name="ftue_auth_sign_out_all_devices">Sign out all devices</string>
<string name="ftue_auth_phone_confirmation_title">Confirm your phone number</string>
<!-- Note for translators, %s is the users international phone number -->
<string name="ftue_auth_phone_confirmation_subtitle">We just sent a code to %s. Enter it below to verify it\'s you.</string>
<string name="ftue_auth_phone_confirmation_resend_code">Resend code</string>
<string name="ftue_auth_email_verification_title">Check your email to verify.</string>
<!-- Note for translators, %s is the users email address -->
<string name="ftue_auth_email_verification_subtitle">To confirm your email address, tap the button in the email we just sent to %s</string>
<string name="ftue_auth_email_verification_footer">Did not receive an email?</string>
<string name="ftue_auth_email_resend_email">Resend email</string>
<string name="ftue_auth_forgot_password">Forgot password</string>
<string name="ftue_auth_password_reset_confirmation">Password reset</string>
<string name="location_map_view_copyright" translatable="false">© MapTiler © OpenStreetMap contributors</string>
</resources>

View file

@ -1903,31 +1903,93 @@
<string name="ftue_auth_carousel_workplace_body">${app_name} is also great for the workplace. Its trusted by the worlds most secure organisations.</string>
<string name="ftue_auth_use_case_title">Who will you chat to the most?</string>
<string name="ftue_auth_use_case_subtitle">We\'ll help you get connected.</string>
<string name="ftue_auth_use_case_subtitle">We\'ll help you get connected</string>
<string name="ftue_auth_use_case_option_one">Friends and family</string>
<string name="ftue_auth_use_case_option_two">Teams</string>
<string name="ftue_auth_use_case_option_three">Communities</string>
<!-- Note to translators: the %s is replaced by the content of ftue_auth_use_case_skip_partial -->
<string name="ftue_auth_use_case_skip">Not sure yet? You can %s</string>
<string name="ftue_auth_use_case_skip_partial">skip this question</string>
<string name="ftue_auth_use_case_skip">Not sure yet? %s</string>
<string name="ftue_auth_use_case_skip_partial">Skip this question</string>
<string name="ftue_auth_use_case_join_existing_server">Looking to join an existing server?</string>
<string name="ftue_auth_use_case_connect_to_server">Connect to server</string>
<string name="ftue_account_created_personalize">Personalize profile</string>
<string name="ftue_account_created_take_me_home">Take me home</string>
<string name="ftue_account_created_congratulations_title">Congratulations!</string>
<string name="ftue_account_created_subtitle">Your account %s has been created.</string>
<string name="ftue_account_created_subtitle">Your account %s has been created</string>
<string name="ftue_auth_create_account_title">Create your account</string>
<!-- Note for translators, %s is the full matrix of the account being created, eg @hello:matrix.org -->
<string name="ftue_auth_create_account_username_entry_footer">Others can discover you %s</string>
<string name="ftue_auth_create_account_password_entry_footer">Must be 8 characters or more</string>
<string name="ftue_auth_create_account_choose_server_header">Where your conversations will live</string>
<string name="ftue_auth_create_account_sso_section_header">Or</string>
<string name="ftue_auth_create_account_edit_server_selection">Edit</string>
<string name="ftue_auth_welcome_back_title">Welcome back!</string>
<string name="ftue_auth_choose_server_title">Select your server</string>
<string name="ftue_auth_choose_server_subtitle">What is the address of your server? This is like a home for all your data</string>
<string name="ftue_auth_choose_server_entry_hint">Server URL</string>
<string name="ftue_auth_choose_server_ems_title">Want to host your own server?</string>
<string name="ftue_auth_choose_server_ems_subtitle">Element Matrix Services (EMS) is a robust and reliable hosting service for fast, secure and real time communication. Find out how on <a href="${ftue_ems_url}">element.io/ems</a></string>
<string name="ftue_auth_choose_server_ems_cta">Get in touch</string>
<string name="ftue_auth_terms_title">Server policies</string>
<!-- Note for translators, %s is the homeserver name, eg matrix.org -->
<string name="ftue_auth_terms_subtitle">Please read through %s\'s terns and policies</string>
<string name="ftue_auth_email_title">Enter your email</string>
<!-- Note for translators, %s is the homeserver name, eg matrix.org -->
<string name="ftue_auth_email_subtitle">%s needs to verify your account</string>
<string name="ftue_auth_email_entry_title">Email</string>
<string name="ftue_auth_phone_title">Enter your phone number</string>
<!-- Note for translators, %s is the homeserver name, eg matrix.org -->
<string name="ftue_auth_phone_subtitle">%s needs to verify your account</string>
<string name="ftue_auth_phone_entry_title">Phone Number</string>
<string name="ftue_auth_phone_confirmation_entry_title">Confirmation code</string>
<!-- Note for translators, %s is the homeserver name, eg matrix.org -->
<string name="ftue_auth_reset_password_email_subtitle">%s will send you a verification link</string>
<string name="ftue_auth_reset_password_breaker_title">Check your email.</string>
<string name="ftue_auth_new_password_entry_title">New Password</string>
<string name="ftue_auth_new_password_title">Choose a new password</string>
<string name="ftue_auth_new_password_subtitle">Make sure it\'s 8 characters or more.</string>
<string name="ftue_auth_reset_password">Reset password</string>
<string name="ftue_auth_sign_out_all_devices">Sign out all devices</string>
<string name="ftue_auth_phone_confirmation_title">Confirm your phone number</string>
<!-- Note for translators, %s is the users international phone number -->
<string name="ftue_auth_phone_confirmation_subtitle">A code was sent to %s</string>
<string name="ftue_auth_phone_confirmation_resend_code">Resend code</string>
<string name="ftue_auth_email_verification_title">Check your email to verify.</string>
<!-- Note for translators, %s is the users email address -->
<string name="ftue_auth_email_verification_subtitle">To confirm your email, tap the button in the email we just sent to %s</string>
<string name="ftue_auth_email_verification_footer">Did not receive an email?</string>
<string name="ftue_auth_email_resend_email">Resend email</string>
<string name="ftue_auth_forgot_password">Forgot password</string>
<string name="ftue_auth_password_reset_confirmation">Password reset</string>
<!-- Note for translators, %s is the users email address -->
<string name="ftue_auth_password_reset_email_confirmation_subtitle">Follow the instructions send to %s</string>
<string name="ftue_auth_captcha_title">Are you a human?</string>
<string name="ftue_auth_login_username_entry">Username / Email / Phone</string>
<string name="ftue_display_name_title">Choose a display name</string>
<!-- TODO remove -->
<!--suppress UnusedResources -->
<string name="ftue_display_name_subtitle">This will be shown when you send messages.</string>
<string name="ftue_display_name_entry_title">Display Name</string>
<string name="ftue_display_name_entry_footer">You can change this later</string>
<string name="ftue_profile_picture_title">Add a profile picture</string>
<string name="ftue_profile_picture_subtitle">You can change this anytime.</string>
<string name="ftue_profile_picture_subtitle">Time to put a face to the name</string>
<string name="ftue_personalize_lets_go">Let\'s go</string>
<string name="ftue_personalize_complete_title">You\'re all set!</string>
<string name="ftue_personalize_complete_subtitle">Your preferences have been saved.</string>
<string name="ftue_personalize_complete_title">Looking good!</string>
<string name="ftue_personalize_complete_subtitle">Head to settings anytime to update your profile</string>
<string name="ftue_personalize_submit">Save and continue</string>
<string name="ftue_personalize_skip_this_step">Skip this step</string>

View file

@ -72,6 +72,8 @@ private val SELECTED_HOMESERVER_STATE = SelectedHomeserverState(preferredLoginMo
private val SELECTED_HOMESERVER_STATE_SUPPORTED_LOGOUT_DEVICES = SelectedHomeserverState(isLogoutDevicesSupported = true)
private const val AN_EMAIL = "hello@example.com"
private const val A_PASSWORD = "a-password"
private const val A_USERNAME = "hello-world"
private const val A_MATRIX_ID = "@$A_USERNAME:matrix.org"
class OnboardingViewModelTest {
@ -405,15 +407,6 @@ class OnboardingViewModelTest {
.finish()
}
private fun availableRegistrationState(userName: String, homeServerUrl: String) = RegistrationState(
isUserNameAvailable = true,
selectedMatrixId = "@$userName:${homeServerUrl.removePrefix("https://")}"
)
private fun initialRegistrationState(homeServerUrl: String) = initialState.copy(
onboardingFlow = OnboardingFlow.SignUp, selectedHomeserver = SelectedHomeserverState(userFacingUrl = homeServerUrl)
)
@Test
fun `given in the sign up flow, when editing homeserver errors, then does not update the selected homeserver state and emits error`() = runTest {
viewModelWith(initialState.copy(onboardingFlow = OnboardingFlow.SignUp))
@ -433,7 +426,8 @@ class OnboardingViewModelTest {
}
@Test
fun `given personalisation enabled, when registering account, then updates state and emits account created event`() = runTest {
fun `given matrix id and personalisation enabled, when registering account, then updates state and emits account created event`() = runTest {
viewModelWith(initialState.copy(registrationState = RegistrationState(selectedMatrixId = A_MATRIX_ID)))
fakeVectorFeatures.givenPersonalisationEnabled()
givenSuccessfullyCreatesAccount(A_HOMESERVER_CAPABILITIES)
givenRegistrationResultFor(RegisterAction.StartRegistration, RegistrationActionHandler.Result.RegistrationComplete(fakeSession))
@ -445,7 +439,7 @@ class OnboardingViewModelTest {
.assertStatesChanges(
initialState,
{ copy(isLoading = true) },
{ copy(isLoading = false, personalizationState = A_HOMESERVER_CAPABILITIES.toPersonalisationState()) }
{ copy(isLoading = false, personalizationState = A_HOMESERVER_CAPABILITIES.toPersonalisationState(A_USERNAME)) }
)
.assertEvents(OnboardingViewEvents.OnAccountCreated)
.finish()
@ -738,9 +732,19 @@ class OnboardingViewModelTest {
private fun givenUserNameIsUnavailable(userName: String, failure: Failure.ServerError) {
fakeAuthenticationService.givenRegistrationWizard(FakeRegistrationWizard().also { it.givenUserNameIsUnavailable(userName, failure) })
}
private fun availableRegistrationState(userName: String, homeServerUrl: String) = RegistrationState(
isUserNameAvailable = true,
selectedMatrixId = "@$userName:${homeServerUrl.removePrefix("https://")}"
)
private fun initialRegistrationState(homeServerUrl: String) = initialState.copy(
onboardingFlow = OnboardingFlow.SignUp, selectedHomeserver = SelectedHomeserverState(userFacingUrl = homeServerUrl)
)
}
private fun HomeServerCapabilities.toPersonalisationState() = PersonalizationState(
private fun HomeServerCapabilities.toPersonalisationState(displayName: String? = null) = PersonalizationState(
supportsChangingDisplayName = canChangeDisplayName,
supportsChangingProfilePicture = canChangeAvatar
supportsChangingProfilePicture = canChangeAvatar,
displayName = displayName,
)