-
Notifications
You must be signed in to change notification settings - Fork 136
Issue/12918 support account creation UI changes #12935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
JorgeMucientes
merged 12 commits into
trunk
from
issue/12918-support-account-creation-ui-changes
Nov 20, 2024
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d90f0a1
Handle the case where user enters an non WP.com email
JorgeMucientes f369a34
Handle the case where user enters an non WP.com user account
JorgeMucientes db8e144
Handle the case where user enters a username instead of email
JorgeMucientes c6b1d97
Handle the case where user enters a username instead of email
JorgeMucientes bfca393
Send sign up magic link if email doesn't exist
JorgeMucientes 6fc1e0a
Add tracking for Jetpack flow signup
JorgeMucientes beb0cc5
Update fluxc changeset to latest version
JorgeMucientes 48bc64a
Adds a new text to make sure user double checks the email is correct
JorgeMucientes c15b716
Add isSignup property when unknown user email is entered
JorgeMucientes b8904b1
Update FluxC changeset
JorgeMucientes 0ba9f71
Merge branch 'trunk' into issue/12918-support-account-creation-ui-cha…
JorgeMucientes e425df2
Remove "address" wording when referring to username
JorgeMucientes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,11 +4,14 @@ import androidx.lifecycle.SavedStateHandle | |
| import androidx.lifecycle.asLiveData | ||
| import androidx.lifecycle.viewModelScope | ||
| import com.woocommerce.android.OnChangedException | ||
| import com.woocommerce.android.R | ||
| import com.woocommerce.android.analytics.AnalyticsEvent.JETPACK_SETUP_LOGIN_FLOW | ||
| import com.woocommerce.android.analytics.AnalyticsTracker | ||
| import com.woocommerce.android.analytics.AnalyticsTrackerWrapper | ||
| import com.woocommerce.android.model.JetpackStatus | ||
| import com.woocommerce.android.ui.login.WPComLoginRepository | ||
| import com.woocommerce.android.util.FeatureFlag | ||
| import com.woocommerce.android.util.StringUtils | ||
| import com.woocommerce.android.viewmodel.MultiLiveEvent | ||
| import com.woocommerce.android.viewmodel.MultiLiveEvent.Event.Exit | ||
| import com.woocommerce.android.viewmodel.MultiLiveEvent.Event.ShowSnackbar | ||
|
|
@@ -21,7 +24,6 @@ import kotlinx.coroutines.flow.combine | |
| import kotlinx.coroutines.launch | ||
| import org.wordpress.android.fluxc.store.AccountStore.AuthOptionsError | ||
| import org.wordpress.android.fluxc.store.AccountStore.AuthOptionsErrorType | ||
| import org.wordpress.android.login.R | ||
| import javax.inject.Inject | ||
|
|
||
| @HiltViewModel | ||
|
|
@@ -90,17 +92,36 @@ class JetpackActivationWPComEmailViewModel @Inject constructor( | |
| wpComLoginRepository.fetchAuthOptions(emailOrUsername).fold( | ||
| onSuccess = { | ||
| if (it.isPasswordless) { | ||
| triggerEvent(ShowMagicLinkScreen(emailOrUsername, navArgs.jetpackStatus)) | ||
| triggerEvent( | ||
| ShowMagicLinkScreen(emailOrUsername, navArgs.jetpackStatus, isNewWpComAccount = false) | ||
| ) | ||
| } else { | ||
| triggerEvent(ShowPasswordScreen(emailOrUsername, navArgs.jetpackStatus)) | ||
| } | ||
| }, | ||
| onFailure = { | ||
| val failure = (it as? OnChangedException)?.error as? AuthOptionsError | ||
| var isSignup = false | ||
|
|
||
| when (failure?.type) { | ||
| AuthOptionsErrorType.UNKNOWN_USER -> { | ||
| errorMessage.value = R.string.email_not_registered_wpcom | ||
| when { | ||
| !StringUtils.isValidEmail(emailOrUsername) -> | ||
| errorMessage.value = R.string.username_not_registered_wpcom | ||
hichamboushaba marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| FeatureFlag.JETPACK_FLOW_ACCOUNT_CREATION.isEnabled() -> { | ||
| triggerEvent( | ||
| ShowMagicLinkScreen( | ||
| emailOrUsername, | ||
| navArgs.jetpackStatus, | ||
| isNewWpComAccount = true | ||
| ) | ||
| ) | ||
| isSignup = true | ||
| } | ||
|
|
||
| else -> errorMessage.value = R.string.email_not_registered_wpcom | ||
| } | ||
| } | ||
|
|
||
| AuthOptionsErrorType.EMAIL_LOGIN_NOT_ALLOWED -> { | ||
|
|
@@ -113,18 +134,26 @@ class JetpackActivationWPComEmailViewModel @Inject constructor( | |
| } | ||
| } | ||
|
|
||
| analyticsTrackerWrapper.track( | ||
| JETPACK_SETUP_LOGIN_FLOW, | ||
| mapOf( | ||
| AnalyticsTracker.KEY_STEP to AnalyticsTracker.VALUE_JETPACK_SETUP_STEP_EMAIL_ADDRESS, | ||
| AnalyticsTracker.KEY_FAILURE to (failure?.type?.name ?: "Unknown error") | ||
| ) | ||
| ) | ||
| trackLoginFlowAuthOptionError(failure, isSignup) | ||
| } | ||
| ) | ||
| isLoadingDialogShown.value = false | ||
| } | ||
|
|
||
| private fun trackLoginFlowAuthOptionError( | ||
| failure: AuthOptionsError?, | ||
| isSignup: Boolean | ||
| ) { | ||
| analyticsTrackerWrapper.track( | ||
| JETPACK_SETUP_LOGIN_FLOW, | ||
| mapOf( | ||
| AnalyticsTracker.KEY_STEP to AnalyticsTracker.VALUE_JETPACK_SETUP_STEP_EMAIL_ADDRESS, | ||
| AnalyticsTracker.KEY_FAILURE to (failure?.type?.name ?: "Unknown error"), | ||
| AnalyticsTracker.KEY_IS_SIGN_UP to isSignup | ||
| ) | ||
| ) | ||
| } | ||
|
|
||
|
Comment on lines
+143
to
+156
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @JorgeMucientes sorry for missing this during my review, I just paid attention to this while I'm working on tracks for iOS, I noticed we track the case of |
||
| data class ViewState( | ||
| val emailOrUsername: String, | ||
| val isJetpackInstalled: Boolean, | ||
|
|
@@ -141,6 +170,7 @@ class JetpackActivationWPComEmailViewModel @Inject constructor( | |
|
|
||
| data class ShowMagicLinkScreen( | ||
| val emailOrUsername: String, | ||
| val jetpackStatus: JetpackStatus | ||
| val jetpackStatus: JetpackStatus, | ||
| val isNewWpComAccount: Boolean, | ||
| ) : MultiLiveEvent.Event() | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.