Skip to content

Commit 7cbe2ed

Browse files
committed
Merge commit '827a47189094a6bc7800eaccc3ed069841251373' into sync-login-lib
# Conflicts: # libs/login/WordPressLoginFlow/build.gradle # libs/login/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginUsernamePasswordFragment.java # libs/login/gradle.properties-example
2 parents 36e7506 + cddcc40 commit 7cbe2ed

File tree

11 files changed

+46
-8
lines changed

11 files changed

+46
-8
lines changed

vendored/WordPressLoginFlow/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ buildscript {
44
jcenter()
55
}
66
dependencies {
7-
classpath 'com.android.tools.build:gradle:3.3.1'
7+
classpath 'com.android.tools.build:gradle:3.3.2'
88
}
99
}
1010

@@ -35,9 +35,9 @@ dependencies {
3535
exclude group: "com.mcxiaoke.volley"
3636
}
3737

38-
implementation 'androidx.appcompat:appcompat:1.0.0'
38+
implementation 'androidx.appcompat:appcompat:1.0.2'
3939
implementation 'androidx.vectordrawable:vectordrawable-animated:1.0.0'
40-
implementation 'androidx.media:media:1.0.0'
40+
implementation 'androidx.media:media:1.0.1'
4141
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
4242
implementation 'androidx.gridlayout:gridlayout:1.0.0'
4343
implementation 'com.google.android.material:material:1.0.0'
@@ -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:8cdbf03cf3d595ef904bab3c1dc207e39242c882") {
54+
implementation("com.github.wordpress-mobile.WordPress-FluxC-Android:fluxc:9f07b031646dd3e6021d4b8e0a35647c9109ff27") {
5555
exclude group: "com.android.support"
5656
exclude group: "org.wordpress", module: "utils"
5757
}

vendored/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginBaseFormFragment.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@
3434
import org.wordpress.android.fluxc.generated.AccountActionBuilder;
3535
import org.wordpress.android.fluxc.generated.SiteActionBuilder;
3636
import org.wordpress.android.fluxc.store.AccountStore;
37+
import org.wordpress.android.fluxc.store.AccountStore.AccountErrorType;
3738
import org.wordpress.android.fluxc.store.AccountStore.OnAccountChanged;
3839
import org.wordpress.android.fluxc.store.SiteStore;
3940
import org.wordpress.android.fluxc.store.SiteStore.OnSiteChanged;
4041
import org.wordpress.android.fluxc.store.SiteStore.SiteErrorType;
4142
import org.wordpress.android.util.AppLog;
4243
import org.wordpress.android.util.EditTextUtils;
4344
import org.wordpress.android.util.ToastUtils;
45+
import org.wordpress.android.util.ToastUtils.Duration;
4446

4547
import javax.inject.Inject;
4648

@@ -291,9 +293,15 @@ public void onAccountChanged(OnAccountChanged event) {
291293

292294
if (event.isError()) {
293295
AppLog.e(AppLog.T.API, "onAccountChanged has error: " + event.error.type + " - " + event.error.message);
294-
ToastUtils.showToast(getContext(), R.string.error_fetch_my_profile);
295-
onLoginFinished(false);
296-
return;
296+
if (event.error.type == AccountErrorType.SETTINGS_FETCH_REAUTHORIZATION_REQUIRED_ERROR) {
297+
// This probably means we're logging in to 2FA-enabled account with a non-production WP.com client id.
298+
// A few WordPress.com APIs like /me/settings/ won't work for this account.
299+
ToastUtils.showToast(getContext(), R.string.error_disabled_apis, Duration.LONG);
300+
} else {
301+
ToastUtils.showToast(getContext(), R.string.error_fetch_my_profile, Duration.LONG);
302+
onLoginFinished(false);
303+
return;
304+
}
297305
}
298306

299307
if (event.causeOfChange == AccountAction.FETCH_ACCOUNT) {

vendored/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginEmailFragment.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.google.android.gms.auth.api.credentials.CredentialPickerConfig;
3030
import com.google.android.gms.auth.api.credentials.HintRequest;
3131
import com.google.android.gms.common.ConnectionResult;
32+
import com.google.android.gms.common.GoogleApiAvailability;
3233
import com.google.android.gms.common.api.GoogleApiClient;
3334
import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
3435
import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener;
@@ -462,6 +463,12 @@ public void onConnectionSuspended(int i) {
462463
}
463464

464465
public void getEmailHints() {
466+
GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
467+
if (getContext() == null
468+
|| googleApiAvailability.isGooglePlayServicesAvailable(getContext()) != ConnectionResult.SUCCESS) {
469+
AppLog.w(T.NUX, LOG_TAG + ": Couldn't start hint picker - Play Services unavailable");
470+
return;
471+
}
465472
HintRequest hintRequest = new HintRequest.Builder()
466473
.setHintPickerConfig(new CredentialPickerConfig.Builder()
467474
.setShowCancelButton(true)

vendored/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginUsernamePasswordFragment.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import android.widget.ScrollView;
1616
import android.widget.TextView;
1717

18-
1918
import androidx.annotation.LayoutRes;
2019
import androidx.annotation.NonNull;
2120
import androidx.annotation.Nullable;

vendored/WordPressLoginFlow/src/main/java/org/wordpress/android/login/SignupEmailFragment.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.google.android.gms.auth.api.credentials.CredentialPickerConfig;
2626
import com.google.android.gms.auth.api.credentials.HintRequest;
2727
import com.google.android.gms.common.ConnectionResult;
28+
import com.google.android.gms.common.GoogleApiAvailability;
2829
import com.google.android.gms.common.api.GoogleApiClient;
2930
import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
3031
import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener;
@@ -297,6 +298,12 @@ public void onConnectionSuspended(int i) {
297298
}
298299

299300
public void getEmailHints() {
301+
GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
302+
if (getContext() == null
303+
|| googleApiAvailability.isGooglePlayServicesAvailable(getContext()) != ConnectionResult.SUCCESS) {
304+
AppLog.w(T.NUX, LOG_TAG + ": Couldn't start hint picker - Play Services unavailable");
305+
return;
306+
}
300307
HintRequest hintRequest = new HintRequest.Builder()
301308
.setHintPickerConfig(new CredentialPickerConfig.Builder()
302309
.setShowCancelButton(true)
@@ -318,6 +325,10 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
318325
super.onActivityResult(requestCode, resultCode, data);
319326

320327
if (requestCode == EMAIL_CREDENTIALS_REQUEST_CODE) {
328+
if (mEmailInput == null) {
329+
// Activity result received before the fragments onCreateView(), disregard result.
330+
return;
331+
}
321332
if (resultCode == RESULT_OK) {
322333
Credential credential = data.getParcelableExtra(Credential.EXTRA_KEY);
323334
mEmailInput.getEditText().setText(credential.getId());
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" >
3+
<solid android:color="@color/alert_green" />
4+
</shape>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" >
3+
<solid android:color="@color/alert_red" />
4+
</shape>

vendored/WordPressLoginFlow/src/main/res/layout-land/login_magic_link_request_screen.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
<ImageView
2222
android:id="@+id/gravatar"
23+
android:importantForAccessibility="no"
2324
android:layout_width="wrap_content"
2425
android:layout_height="wrap_content"/>
2526

vendored/WordPressLoginFlow/src/main/res/layout/login_magic_link_request_screen.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
<ImageView
2929
android:id="@+id/gravatar"
30+
android:importantForAccessibility="no"
3031
android:layout_width="wrap_content"
3132
android:layout_height="wrap_content"/>
3233

vendored/WordPressLoginFlow/src/main/res/layout/login_username_password_screen.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
<ImageView
3030
android:id="@+id/login_blavatar"
31+
android:importantForAccessibility="no"
3132
android:layout_width="@dimen/blavatar_sz"
3233
android:layout_height="@dimen/blavatar_sz"
3334
android:background="@android:color/white"
@@ -36,6 +37,7 @@
3637

3738
<ImageView
3839
android:id="@+id/login_blavatar_static"
40+
android:importantForAccessibility="no"
3941
android:layout_width="wrap_content"
4042
android:layout_height="wrap_content"
4143
android:background="@color/login_background_color"

0 commit comments

Comments
 (0)