Skip to content

Commit

Permalink
Squashed 'libs/login/' changes from 5a21797a03..69e488759c
Browse files Browse the repository at this point in the history
69e488759c Fix tracks connected info property naming
REVERT: 5a21797a03 Merge pull request #23 from wordpress-mobile/merge/woocommerce-android/1224-amanda-new
REVERT: 3b1db07c38 Merge commit '615ebab45e1bc3d0cdd3a9da060026fef704d3a8' into amanda/test_git_subtree
REVERT: 43ac7e9468 Merge pull request #22 from wordpress-mobile/merge-wca
REVERT: d4d717cf16 Send redirectUrl to listener and strip protocol before saving
REVERT: 979ddf4aec Merge commit '827a47189094a6bc7800eaccc3ed069841251373' into sync-login-lib
REVERT: df3c11ed09 added textAlignment property to secondary button in login
REVERT: da783ea3c7 Login screens: added textAlignment property to labels
REVERT: 6d486bbf6b Merge pull request #21 from wordpress-mobile/merge-wpa-develop
REVERT: 57a2d00b14 Update login lib standalone FluxC hash
REVERT: 0ea2405def Merge commit 'ad485b27b26ffb38b8718940b0b7556b902dc28c' into sync-login-lib
REVERT: 6df15ab86b Update 2FA unavailable API error message
REVERT: eefd72f317 Show error and continue login on OAuth client 2FA error
REVERT: 578dca7f29 Update androidx dependencies
REVERT: 1d09d1536d Fix AndroidX import order
REVERT: 48df84638f Fix import ordering for androidx
REVERT: d3dc35035a Migrate to AndroidX
REVERT: 78c5307f7a Merge pull request #16 from wordpress-mobile/fix_crash_in_login_email_fragment
REVERT: 4d6c83f111 Merge pull request #9890 from wordpress-mobile/update-dagger-version-to-v2.22.1
REVERT: edd8684ec4 Merge pull request #18 from wordpress-mobile/new-wpandroid-changes
REVERT: 9cbf3f17ff Merge pull request #9885 from wordpress-mobile/update-login-library
REVERT: 71729e5e76 Merge pull request #17 from wordpress-mobile/issue/glide-4.9
REVERT: 0ddf4dcdbd Update Glide version to 4.9.0
REVERT: f7860b9861 Updated Dagger in the login library
REVERT: aabdedf672 Merge commit '099b5a011d32283eb6c79b0e599b5272a597e849' into update-login-library
REVERT: 1eb7f4f156 Updated Glide to 4.9.0
REVERT: a32cc8c09d Add crash fix to SignupEmailFragment
REVERT: 08109fa90f Adds non-null check to onActivityResult
REVERT: 664b67f62d Fix  #9826: make sure we Play Services are available before running the email hint picker
REVERT: 94a0ae2a39 Merge pull request #9743 from wordpress-mobile/feature/manage_insights_readonly
REVERT: 7cad17e264 Fix a few ContentDescription lint errors
REVERT: 9f171b55d0 Merge branch 'feature/manage_insights_readonly' into issue/9464-manage-insights
REVERT: 663a168903 Add the missing drawable resources

git-subtree-dir: libs/login
git-subtree-split: 69e488759c04a9ffae4f39183d3a526501f1ed8b
  • Loading branch information
AmandaRiu committed Aug 1, 2019
1 parent 3a2393c commit 2338a63
Show file tree
Hide file tree
Showing 18 changed files with 27 additions and 74 deletions.
8 changes: 4 additions & 4 deletions WordPressLoginFlow/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.android.tools.build:gradle:3.3.1'
}
}

Expand Down Expand Up @@ -35,9 +35,9 @@ dependencies {
exclude group: "com.mcxiaoke.volley"
}

implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable-animated:1.0.0'
implementation 'androidx.media:media:1.0.1'
implementation 'androidx.media:media:1.0.0'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
Expand All @@ -51,7 +51,7 @@ dependencies {
exclude group: "org.wordpress", module: "utils"
}
} else {
implementation("com.github.wordpress-mobile.WordPress-FluxC-Android:fluxc:9f07b031646dd3e6021d4b8e0a35647c9109ff27") {
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 @@ -34,15 +34,13 @@
import org.wordpress.android.fluxc.generated.AccountActionBuilder;
import org.wordpress.android.fluxc.generated.SiteActionBuilder;
import org.wordpress.android.fluxc.store.AccountStore;
import org.wordpress.android.fluxc.store.AccountStore.AccountErrorType;
import org.wordpress.android.fluxc.store.AccountStore.OnAccountChanged;
import org.wordpress.android.fluxc.store.SiteStore;
import org.wordpress.android.fluxc.store.SiteStore.OnSiteChanged;
import org.wordpress.android.fluxc.store.SiteStore.SiteErrorType;
import org.wordpress.android.util.AppLog;
import org.wordpress.android.util.EditTextUtils;
import org.wordpress.android.util.ToastUtils;
import org.wordpress.android.util.ToastUtils.Duration;

import javax.inject.Inject;

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

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

if (event.causeOfChange == AccountAction.FETCH_ACCOUNT) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import com.google.android.gms.auth.api.credentials.CredentialPickerConfig;
import com.google.android.gms.auth.api.credentials.HintRequest;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener;
Expand Down Expand Up @@ -463,12 +462,6 @@ public void onConnectionSuspended(int i) {
}

public void getEmailHints() {
GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
if (getContext() == null
|| googleApiAvailability.isGooglePlayServicesAvailable(getContext()) != ConnectionResult.SUCCESS) {
AppLog.w(T.NUX, LOG_TAG + ": Couldn't start hint picker - Play Services unavailable");
return;
}
HintRequest hintRequest = new HintRequest.Builder()
.setHintPickerConfig(new CredentialPickerConfig.Builder()
.setShowCancelButton(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ interface SelfSignedSSLCallback {
// Login Site Address input callbacks
void alreadyLoggedInWpcom(ArrayList<Integer> oldSitesIds);
void gotWpcomSiteInfo(String siteAddress, String siteName, String siteIconUrl);
void gotConnectedSiteInfo(@NonNull String siteAddress, @Nullable String redirectUrl, boolean hasJetpack);
void gotConnectedSiteInfo(String siteAddress, boolean hasJetpack);
void gotXmlRpcEndpoint(String inputSiteAddress, String endpointAddress);
void handleSslCertificateError(MemorizingTrustManager memorizingTrustManager, SelfSignedSSLCallback callback);
void helpSiteAddress(String url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,13 +402,24 @@ public void onFetchedConnectSiteInfo(OnConnectSiteInfoChecked event) {
// TODO: If we plan to keep this logic we should convert these labels to constants
HashMap<String, String> properties = new HashMap<>();
properties.put("url", event.info.url);
properties.put("urlAfterRedirects", event.info.urlAfterRedirects);
properties.put("url_after_redirects", event.info.urlAfterRedirects);
properties.put("exists", Boolean.toString(event.info.exists));
properties.put("hasJetpack", Boolean.toString(event.info.hasJetpack));
properties.put("isJetpackActive", Boolean.toString(event.info.isJetpackActive));
properties.put("isJetpackConnected", Boolean.toString(event.info.isJetpackConnected));
properties.put("isWordPress", Boolean.toString(event.info.isWordPress));
properties.put("isWPCom", Boolean.toString(event.info.isWPCom));
properties.put("has_jetpack", Boolean.toString(event.info.hasJetpack));
properties.put("is_jetpack_active", Boolean.toString(event.info.isJetpackActive));
properties.put("is_jetpack_connected", Boolean.toString(event.info.isJetpackConnected));
properties.put("is_wordpress", Boolean.toString(event.info.isWordPress));
properties.put("is_wp_com", Boolean.toString(event.info.isWPCom));

// Determining if jetpack is actually installed takes additional logic. This final
// calculated event property will make querying this event more straight-forward:
boolean hasJetpack = false;
if (event.info.isWPCom && event.info.hasJetpack) {
// This is likely an atomic site.
hasJetpack = true;
} else if (event.info.hasJetpack && event.info.isJetpackActive && event.info.isJetpackConnected) {
hasJetpack = true;
}
properties.put("login_calculated_has_jetpack", Boolean.toString(hasJetpack));
mAnalyticsListener.trackConnectedSiteInfoSucceeded(properties);

if (!event.info.exists) {
Expand All @@ -418,17 +429,7 @@ public void onFetchedConnectSiteInfo(OnConnectSiteInfoChecked event) {
// Not a WordPress site
showError(R.string.enter_wordpress_site);
} else {
boolean hasJetpack = false;
if (event.info.isWPCom && event.info.hasJetpack) {
// This is likely an atomic site.
hasJetpack = true;
} else if (event.info.hasJetpack && event.info.isJetpackActive && event.info.isJetpackConnected) {
hasJetpack = true;
}
mLoginListener.gotConnectedSiteInfo(
event.info.url,
event.info.urlAfterRedirects,
hasJetpack);
mLoginListener.gotConnectedSiteInfo(event.info.url, hasJetpack);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import android.widget.ScrollView;
import android.widget.TextView;


import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.google.android.gms.auth.api.credentials.CredentialPickerConfig;
import com.google.android.gms.auth.api.credentials.HintRequest;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener;
Expand Down Expand Up @@ -298,12 +297,6 @@ public void onConnectionSuspended(int i) {
}

public void getEmailHints() {
GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
if (getContext() == null
|| googleApiAvailability.isGooglePlayServicesAvailable(getContext()) != ConnectionResult.SUCCESS) {
AppLog.w(T.NUX, LOG_TAG + ": Couldn't start hint picker - Play Services unavailable");
return;
}
HintRequest hintRequest = new HintRequest.Builder()
.setHintPickerConfig(new CredentialPickerConfig.Builder()
.setShowCancelButton(true)
Expand All @@ -325,10 +318,6 @@ 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
4 changes: 0 additions & 4 deletions WordPressLoginFlow/src/main/res/drawable/shape_oval_green.xml

This file was deleted.

4 changes: 0 additions & 4 deletions WordPressLoginFlow/src/main/res/drawable/shape_oval_red.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

<ImageView
android:id="@+id/gravatar"
android:importantForAccessibility="no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_extra_large"
android:layout_marginBottom="@dimen/margin_extra_large"
android:textAlignment="viewStart"
android:gravity="start"
tools:text="@string/enter_site_address" />

<LinearLayout
Expand Down
2 changes: 0 additions & 2 deletions WordPressLoginFlow/src/main/res/layout/login_email_screen.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
android:layout_marginBottom="@dimen/margin_extra_large"
android:layout_marginTop="@dimen/margin_extra_large"
android:layout_width="match_parent"
android:textAlignment="viewStart"
android:gravity="start"
tools:text="@string/enter_email_wordpress_com"
style="@style/LoginTheme.TextLabel" >
</TextView>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
android:paddingEnd="@dimen/margin_medium_large"
android:layout_marginRight="@dimen/margin_extra_large"
android:layout_marginEnd="@dimen/margin_extra_large"
android:textAlignment="viewStart"
android:gravity="start|center_vertical"
tools:text="Secondary action"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

<ImageView
android:id="@+id/gravatar"
android:importantForAccessibility="no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_extra_large"
android:textAlignment="viewStart"
android:gravity="start"
android:layout_marginBottom="@dimen/margin_extra_large"
tools:text="@string/enter_site_address" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

<ImageView
android:id="@+id/login_blavatar"
android:importantForAccessibility="no"
android:layout_width="@dimen/blavatar_sz"
android:layout_height="@dimen/blavatar_sz"
android:background="@android:color/white"
Expand All @@ -37,7 +36,6 @@

<ImageView
android:id="@+id/login_blavatar_static"
android:importantForAccessibility="no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/login_background_color"
Expand Down
1 change: 0 additions & 1 deletion WordPressLoginFlow/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
<string name="cannot_add_duplicate_site">This site already exists in the app, you can\'t add it.</string>
<string name="duplicate_site_detected">A duplicate site has been detected.</string>
<string name="error_fetch_my_profile">Couldn\'t retrieve your profile</string>
<string name="error_disabled_apis">Could not fetch settings: Some APIs are unavailable for this OAuth app ID + account combination.</string>
<string name="login_to_to_connect_jetpack">Log in to the WordPress.com account you used to connect Jetpack.</string>
<string name="auth_required">Log in again to continue.</string>
<string name="checking_email">Checking email</string>
Expand Down
3 changes: 0 additions & 3 deletions gradle.properties-example
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,3 @@ wp.debug.wpcom_login_email =
wp.debug.wpcom_login_username =
wp.debug.wpcom_login_password =
wp.debug.wpcom_website_url =

android.useAndroidX=true
android.enableJetifier=true

0 comments on commit 2338a63

Please sign in to comment.