Skip to content

Commit a3e05b9

Browse files
authored
Merge pull request #12 from wordpress-mobile/merge-wpa
Import changes from WPAndroid
2 parents 512d03c + 8e5be76 commit a3e05b9

16 files changed

+35
-16
lines changed

WordPressLoginFlow/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ dependencies {
5151
exclude group: "org.wordpress", module: "utils"
5252
}
5353
} else {
54-
implementation("com.github.wordpress-mobile.WordPress-FluxC-Android:fluxc:7c4fa0333cef380aa80b92adbb5e4803b90dd7e5") {
54+
implementation("com.github.wordpress-mobile.WordPress-FluxC-Android:fluxc:8cdbf03cf3d595ef904bab3c1dc207e39242c882") {
5555
exclude group: "com.android.support"
5656
exclude group: "org.wordpress", module: "utils"
5757
}

WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginEmailPasswordFragment.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import org.wordpress.android.util.AppLog.T;
2727
import org.wordpress.android.util.AutoForeground;
2828
import org.wordpress.android.util.NetworkUtils;
29+
import org.wordpress.android.util.ToastUtils;
30+
import org.wordpress.android.util.ToastUtils.Duration;
2931

3032
import java.util.ArrayList;
3133

@@ -310,6 +312,14 @@ public void onLoginStateUpdated(LoginState loginState) {
310312
onLoginFinished(false);
311313
showError(getString(R.string.cannot_add_duplicate_site));
312314
break;
315+
case FAILURE_USE_WPCOM_USERNAME_INSTEAD_OF_EMAIL:
316+
onLoginFinished(false);
317+
mLoginListener.loginViaWpcomUsernameInstead();
318+
ToastUtils.showToast(getContext(), R.string.error_user_username_instead_of_email, Duration.LONG);
319+
320+
// consume the state so we don't re-redirect to username login if user backs up
321+
LoginWpcomService.clearLoginServiceState();
322+
break;
313323
case FAILURE:
314324
onLoginFinished(false);
315325
showError(getString(R.string.error_generic));

WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginWpcomService.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public enum LoginStep {
5656
FAILURE_SOCIAL_2FA,
5757
FAILURE_FETCHING_ACCOUNT,
5858
FAILURE_CANNOT_ADD_DUPLICATE_SITE,
59+
FAILURE_USE_WPCOM_USERNAME_INSTEAD_OF_EMAIL,
5960
FAILURE;
6061

6162
public final int progressPercent;
@@ -97,7 +98,8 @@ public boolean isError() {
9798
|| mStep == LoginStep.FAILURE_2FA
9899
|| mStep == LoginStep.FAILURE_SOCIAL_2FA
99100
|| mStep == LoginStep.FAILURE_FETCHING_ACCOUNT
100-
|| mStep == LoginStep.FAILURE_CANNOT_ADD_DUPLICATE_SITE;
101+
|| mStep == LoginStep.FAILURE_CANNOT_ADD_DUPLICATE_SITE
102+
|| mStep == LoginStep.FAILURE_USE_WPCOM_USERNAME_INSTEAD_OF_EMAIL;
101103
}
102104

103105
@Override
@@ -203,6 +205,8 @@ public Notification getNotification(LoginState state) {
203205
return LoginNotification.failure(this, R.string.notification_2fa_needed);
204206
case FAILURE_SOCIAL_2FA:
205207
return LoginNotification.failure(this, R.string.notification_2fa_needed);
208+
case FAILURE_USE_WPCOM_USERNAME_INSTEAD_OF_EMAIL:
209+
return LoginNotification.failure(this, R.string.notification_wpcom_username_needed);
206210
case FAILURE_FETCHING_ACCOUNT:
207211
case FAILURE_CANNOT_ADD_DUPLICATE_SITE:
208212
case FAILURE:
@@ -285,6 +289,9 @@ private void handleAuthError(AuthenticationErrorType error, String errorMessage)
285289
setState(LoginStep.FAILURE_2FA);
286290
}
287291

292+
break;
293+
case EMAIL_LOGIN_NOT_ALLOWED:
294+
setState(LoginStep.FAILURE_USE_WPCOM_USERNAME_INSTEAD_OF_EMAIL);
288295
break;
289296
case INVALID_REQUEST:
290297
// TODO: FluxC: could be specific?

WordPressLoginFlow/src/main/res/drawable-ldrtl-v18/ic_arrow_left_white_24dp.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
android:pivotY="12"
1010
android:scaleX="-1">
1111
<path
12-
android:fillColor="@color/white"
12+
android:fillColor="@android:color/white"
1313
android:pathData="M20,11H7.8l5.6,-5.6L12,4l-8,8l8,8l1.4,-1.4L7.8,13H20V11z"></path>
1414
</group>
1515
</vector>

WordPressLoginFlow/src/main/res/drawable/ic_arrow_left_white_24dp.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
android:viewportWidth="24.0" >
77

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

WordPressLoginFlow/src/main/res/drawable/ic_placeholder_blavatar_grey_lighten_20_40dp.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</path>
1212

1313
<path
14-
android:fillColor="@color/white"
14+
android:fillColor="@android:color/white"
1515
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" >
1616
</path>
1717

WordPressLoginFlow/src/main/res/drawable/login_toolbar_icon.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
android:viewportWidth="32.0" >
77

88
<path
9-
android:fillColor="@color/white"
9+
android:fillColor="@android:color/white"
1010
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" >
1111
</path>
1212

WordPressLoginFlow/src/main/res/layout-land/login_magic_link_sent_screen.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
android:layout_height="@dimen/magic_link_sent_illustration_sz"
2323
android:scaleType="centerInside"
2424
android:contentDescription="@null"
25-
app:srcCompat="@drawable/img_email_alert_120dp"/>
25+
app:srcCompat="@drawable/img_illustration_email_alert_120dp"/>
2626

2727
<TextView
2828
android:id="@+id/label"

WordPressLoginFlow/src/main/res/layout-land/signup_magic_link.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
android:layout_height="@dimen/magic_link_sent_illustration_sz"
2525
android:layout_width="@dimen/magic_link_sent_illustration_sz"
2626
android:scaleType="centerInside"
27-
app:srcCompat="@drawable/img_email_alert_120dp" >
27+
app:srcCompat="@drawable/img_illustration_email_alert_120dp" >
2828
</ImageView>
2929

3030
<TextView

0 commit comments

Comments
 (0)