[go: nahoru, domu]

Skip to content

Commit

Permalink
Squashed 'libs/login/' changes from 33d3a31871..aec79e59e2
Browse files Browse the repository at this point in the history
aec79e59e2 Merge pull request #14 from wordpress-mobile/merge-wca
58ff2a2c8e Revert gradle plugin version update
38ba0160b0 Merge commit 'b7d105538004776cc4f7e83fae83136d48d29e90' into update-login-lib
cfc89d9ba0 Merge pull request #12 from wordpress-mobile/merge-wpa
04bcfb3028 Update default login lib FluxC branch
f5c678ca52 Merge commit '4cd695bb51cd7d26364e30e4986b14a48e854b0d' into update-login-subtree
5647062940 Username/password login on email_login_not_allowed
6309b4caea Add image illustration email alert
2ab920a545 Rename background color resources
b89d1a9e81 Rename color from action mode status bar tint to status bar action mode
4c94f3c511 Rename color from status bar tint to status bar
9d910786ea Update color references from white to android resource
e937a741b1 Merge commit '6e839250c045708ce14c430fd22981def2a87e61' into feature/update-login-library
9e8634fa2c Upgrade from 4.6 to gradle version 4.10.1
ebe32d22e1 Ensure mOldSitesIDs is created
0e7433ebf3 Use a default progress message to avoid resources not found exception
0d01e95fd9 Update build tools to 28.0.3
330a9cde65 Update to Gradle plugin 3.2.1
5eee6ef87d Rename login magic link image asset
9cb3c4d458 Fix NPE crash by disregarding email hint result if fragment view not init

git-subtree-dir: libs/login
git-subtree-split: aec79e59e2e34665a6e300c666a7c40312a5da3d
  • Loading branch information
aforcier committed Apr 15, 2019
1 parent 4cd695b commit 65a19cc
Show file tree
Hide file tree
Showing 18 changed files with 46 additions and 20 deletions.
2 changes: 1 addition & 1 deletion WordPressLoginFlow/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ dependencies {
exclude group: "org.wordpress", module: "utils"
}
} else {
implementation("com.github.wordpress-mobile.WordPress-FluxC-Android:fluxc:7c4fa0333cef380aa80b92adbb5e4803b90dd7e5") {
implementation("com.github.wordpress-mobile.WordPress-FluxC-Android:fluxc:8cdbf03cf3d595ef904bab3c1dc207e39242c882") {
exclude group: "com.android.support"
exclude group: "org.wordpress", module: "utils"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ public class Login2FaFragment extends LoginBaseFormFragment<LoginListener> imple

private WPLoginInputRow m2FaInput;

private @StringRes int mInProgressMessageId;
private static final @StringRes int DEFAULT_PROGRESS_MESSAGE_ID = R.string.logging_in;
private @StringRes int mInProgressMessageId = DEFAULT_PROGRESS_MESSAGE_ID;

ArrayList<Integer> mOldSitesIDs;

private Button mSecondaryButton;
Expand Down Expand Up @@ -241,7 +243,7 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
// retrieve mInProgressMessageId before super.onActivityCreated() so the string will be available to the
// progress bar helper if in progress
if (savedInstanceState != null) {
mInProgressMessageId = savedInstanceState.getInt(KEY_IN_PROGRESS_MESSAGE_ID, 0);
mInProgressMessageId = savedInstanceState.getInt(KEY_IN_PROGRESS_MESSAGE_ID, DEFAULT_PROGRESS_MESSAGE_ID);
mOldSitesIDs = savedInstanceState.getIntegerArrayList(KEY_OLD_SITES_IDS);
} else {
mAnalyticsListener.trackTwoFactorFormViewed();
Expand Down Expand Up @@ -370,7 +372,7 @@ private void show2FaError(String message) {
@Override
protected void endProgress() {
super.endProgress();
mInProgressMessageId = 0;
mInProgressMessageId = DEFAULT_PROGRESS_MESSAGE_ID;
}

private void handleAuthError(AuthenticationErrorType error, String errorMessage) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class LoginEmailFragment extends LoginBaseFormFragment<LoginListener> imp
public static final String TAG = "login_email_fragment_tag";
public static final int MAX_EMAIL_LENGTH = 100;

private ArrayList<Integer> mOldSitesIDs;
private ArrayList<Integer> mOldSitesIDs = new ArrayList<>();
private GoogleApiClient mGoogleApiClient;
private String mGoogleEmail;
private String mRequestedEmail;
Expand Down Expand Up @@ -445,6 +445,11 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);

if (requestCode == EMAIL_CREDENTIALS_REQUEST_CODE) {
if (mEmailInput == null) {
// Activity result received before the fragments onCreateView(), disregard result.
return;
}

if (resultCode == RESULT_OK) {
Credential credential = data.getParcelableExtra(Credential.EXTRA_KEY);
mEmailInput.getEditText().setText(credential.getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import org.wordpress.android.util.AppLog.T;
import org.wordpress.android.util.AutoForeground;
import org.wordpress.android.util.NetworkUtils;
import org.wordpress.android.util.ToastUtils;
import org.wordpress.android.util.ToastUtils.Duration;

import java.util.ArrayList;

Expand Down Expand Up @@ -310,6 +312,14 @@ public void onLoginStateUpdated(LoginState loginState) {
onLoginFinished(false);
showError(getString(R.string.cannot_add_duplicate_site));
break;
case FAILURE_USE_WPCOM_USERNAME_INSTEAD_OF_EMAIL:
onLoginFinished(false);
mLoginListener.loginViaWpcomUsernameInstead();
ToastUtils.showToast(getContext(), R.string.error_user_username_instead_of_email, Duration.LONG);

// consume the state so we don't re-redirect to username login if user backs up
LoginWpcomService.clearLoginServiceState();
break;
case FAILURE:
onLoginFinished(false);
showError(getString(R.string.error_generic));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public enum LoginStep {
FAILURE_SOCIAL_2FA,
FAILURE_FETCHING_ACCOUNT,
FAILURE_CANNOT_ADD_DUPLICATE_SITE,
FAILURE_USE_WPCOM_USERNAME_INSTEAD_OF_EMAIL,
FAILURE;

public final int progressPercent;
Expand Down Expand Up @@ -97,7 +98,8 @@ public boolean isError() {
|| mStep == LoginStep.FAILURE_2FA
|| mStep == LoginStep.FAILURE_SOCIAL_2FA
|| mStep == LoginStep.FAILURE_FETCHING_ACCOUNT
|| mStep == LoginStep.FAILURE_CANNOT_ADD_DUPLICATE_SITE;
|| mStep == LoginStep.FAILURE_CANNOT_ADD_DUPLICATE_SITE
|| mStep == LoginStep.FAILURE_USE_WPCOM_USERNAME_INSTEAD_OF_EMAIL;
}

@Override
Expand Down Expand Up @@ -203,6 +205,8 @@ public Notification getNotification(LoginState state) {
return LoginNotification.failure(this, R.string.notification_2fa_needed);
case FAILURE_SOCIAL_2FA:
return LoginNotification.failure(this, R.string.notification_2fa_needed);
case FAILURE_USE_WPCOM_USERNAME_INSTEAD_OF_EMAIL:
return LoginNotification.failure(this, R.string.notification_wpcom_username_needed);
case FAILURE_FETCHING_ACCOUNT:
case FAILURE_CANNOT_ADD_DUPLICATE_SITE:
case FAILURE:
Expand Down Expand Up @@ -285,6 +289,9 @@ private void handleAuthError(AuthenticationErrorType error, String errorMessage)
setState(LoginStep.FAILURE_2FA);
}

break;
case EMAIL_LOGIN_NOT_ALLOWED:
setState(LoginStep.FAILURE_USE_WPCOM_USERNAME_INSTEAD_OF_EMAIL);
break;
case INVALID_REQUEST:
// TODO: FluxC: could be specific?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
android:pivotY="12"
android:scaleX="-1">
<path
android:fillColor="@color/white"
android:fillColor="@android:color/white"
android:pathData="M20,11H7.8l5.6,-5.6L12,4l-8,8l8,8l1.4,-1.4L7.8,13H20V11z"></path>
</group>
</vector>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
android:viewportWidth="24.0" >

<path
android:fillColor="@color/white"
android:fillColor="@android:color/white"
android:pathData="M20,11H7.8l5.6,-5.6L12,4l-8,8l8,8l1.4,-1.4L7.8,13H20V11z" >
</path>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</path>

<path
android:fillColor="@color/white"
android:fillColor="@android:color/white"
android:pathData="M20.2,7.5C13.3,7.5,7.7,13.1,7.7,20s5.6,12.5,12.5,12.5S32.7,26.9,32.7,20S27.1,7.5,20.2,7.5z M20.2,30l2.5-2.5l1.2-1.2v-2.5h-2.5v-1.2l-1.2-1.2h-3.8V25l2.5,2.5v2.4c-4.9-0.6-8.8-4.8-8.8-9.9l1.2,1.2h2.5v-2.5h2.5l3.8-3.8v-2.5h-2.5l-1.2-1.2v-0.5c1.2-0.5,2.4-0.7,3.8-0.7s2.6,0.3,3.8,0.7v1.8l-1.2,1.2v2.5l1.2,1.2l3.9-3.9c0.9,1.1,1.6,2.5,2,3.9h-2.2L25.2,20v2.5l1.2,1.2h2.5l0.4,0.4C27.7,27.6,24.2,30,20.2,30z" >
</path>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
android:viewportWidth="32.0" >

<path
android:fillColor="@color/white"
android:fillColor="@android:color/white"
android:pathData="M16,2.7C8.6,2.7 2.7,8.6 2.7,16s6,13.3 13.3,13.3s13.3,-6 13.3,-13.3S23.4,2.7 16,2.7zM4.7,16c0,-1.6 0.4,-3.2 1,-4.6l5.4,14.8C7.3,24.4 4.7,20.5 4.7,16zM16,27.3c-1.1,0 -2.2,-0.2 -3.2,-0.5l3.4,-9.9l3.5,9.5c0,0.1 0.1,0.1 0.1,0.2C18.6,27.1 17.3,27.3 16,27.3L16,27.3zM17.6,10.7c0.7,0 1.3,-0.1 1.3,-0.1c0.6,-0.1 0.5,-1 -0.1,-0.9c0,0 -1.8,0.1 -3,0.1c-1.1,0 -3,-0.1 -3,-0.1c-0.6,0 -0.7,0.9 -0.1,0.9c0,0 0.6,0.1 1.2,0.1l1.8,4.8L13.2,23L9.1,10.7c0.7,0 1.3,-0.1 1.3,-0.1c0.6,-0.1 0.5,-1 -0.1,-0.9c0,0 -1.8,0.1 -3,0.1c-0.2,0 -0.5,0 -0.7,0c2,-3.1 5.5,-5.1 9.5,-5.1c3,0 5.6,1.1 7.7,3c0,0 -0.1,0 -0.1,0c-1.1,0 -1.9,1 -1.9,2c0,0.9 0.5,1.7 1.1,2.7c0.4,0.8 0.9,1.7 0.9,3.1c0,1 -0.4,2.1 -0.9,3.7l-1.1,3.8C21.7,22.9 17.6,10.7 17.6,10.7zM21.7,25.8l3.5,-10c0.6,-1.6 0.9,-2.9 0.9,-4.1c0,-0.4 0,-0.8 -0.1,-1.2c0.9,1.6 1.4,3.5 1.4,5.4C27.3,20.2 25.1,23.8 21.7,25.8L21.7,25.8z" >
</path>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
android:layout_height="@dimen/magic_link_sent_illustration_sz"
android:scaleType="centerInside"
android:contentDescription="@null"
app:srcCompat="@drawable/img_email_alert_120dp"/>
app:srcCompat="@drawable/login_email_alert"/>

<TextView
android:id="@+id/label"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
android:layout_height="@dimen/magic_link_sent_illustration_sz"
android:layout_width="@dimen/magic_link_sent_illustration_sz"
android:scaleType="centerInside"
app:srcCompat="@drawable/img_email_alert_120dp" >
app:srcCompat="@drawable/login_email_alert" >
</ImageView>

<TextView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
android:scaleType="centerInside"
android:layout_marginTop="@dimen/margin_extra_extra_large"
android:contentDescription="@null"
app:srcCompat="@drawable/img_email_alert_120dp"/>
app:srcCompat="@drawable/login_email_alert"/>

<TextView
android:id="@+id/label"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
android:id="@+id/login_blavatar"
android:layout_width="@dimen/blavatar_sz"
android:layout_height="@dimen/blavatar_sz"
android:background="@color/white"
android:background="@android:color/white"
android:gravity="center_vertical"
app:srcCompat="@drawable/ic_placeholder_blavatar_grey_lighten_20_40dp" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
android:layout_height="@dimen/magic_link_sent_illustration_sz"
android:layout_width="@dimen/magic_link_sent_illustration_sz"
android:scaleType="centerInside"
app:srcCompat="@drawable/img_email_alert_120dp" >
app:srcCompat="@drawable/login_email_alert" >
</ImageView>

<TextView
Expand Down
8 changes: 4 additions & 4 deletions WordPressLoginFlow/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
colorControlHighlight control highlights (ripples, list selectors)
-->
<color name="color_primary">@color/blue_wordpress</color>
<color name="color_primary_dark">@color/status_bar_tint</color>
<color name="color_primary_dark">@color/status_bar</color>
<color name="color_accent">@color/orange_jazzy</color>
<color name="color_control_normal">@color/white</color>
<color name="color_control_activated">@color/blue_light</color>
Expand All @@ -23,7 +23,7 @@
<color name="white_self_hosted_back">#F1F1F1</color>
<!-- note that black should NOT be used for text - use grey_dark instead -->
<color name="black">#000000</color>
<color name="default_background">@color/grey_lighten_30</color>
<color name="background_default">@color/grey_lighten_30</color>

<!-- ==================================== -->
<!-- WordPress.com Colors -->
Expand Down Expand Up @@ -91,8 +91,8 @@
<!-- App specific colors -->
<!-- We could use blue_dark for the status bar color, but to adhere to the material design spec very closely,
we're using a shade of blue_wordpress -->
<color name="status_bar_tint">#006b98</color>
<color name="action_mode_status_bar_tint">#ff517188</color>
<color name="status_bar">#006b98</color>
<color name="status_bar_action_mode">#ff517188</color>

<!-- Login -->
<color name="login_theme_accent_color">@color/blue_medium</color>
Expand Down
2 changes: 2 additions & 0 deletions WordPressLoginFlow/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
<string name="auth_required">Log in again to continue.</string>
<string name="checking_email">Checking email</string>
<string name="email_invalid">Enter a valid email address</string>
<string name="error_user_username_instead_of_email">Please log in using your WordPress.com username instead of your email address.</string>
<string name="logging_in">Logging in</string>
<string name="forgot_password">Lost your password?</string>
<string name="error_generic">An error occurred</string>
Expand All @@ -111,6 +112,7 @@
<string name="notification_error_wrong_password">Please double check your password to continue.</string>
<string name="notification_2fa_needed">Please provide an authentication code to continue.</string>
<string name="notification_login_failed">An error has occurred.</string>
<string name="notification_wpcom_username_needed">Please log in with your username and password.</string>

<!-- Screen titles -->
<string name="email_address_login_title">Email address login</string>
Expand Down
2 changes: 1 addition & 1 deletion WordPressLoginFlow/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<item name="colorPrimary">@color/color_primary</item>
<item name="colorAccent">@color/login_theme_accent_color</item>

<item name="android:statusBarColor" tools:targetApi="21">@color/status_bar_tint</item>
<item name="android:statusBarColor" tools:targetApi="21">@color/status_bar</item>
<item name="android:windowBackground">@color/login_background_color</item>
<item name="actionMenuTextColor">@android:color/white</item>
</style>
Expand Down

0 comments on commit 65a19cc

Please sign in to comment.