From 5fb1a226b93578dcba8310b9d57c72a096b1c614 Mon Sep 17 00:00:00 2001 From: AmandaRiu Date: Wed, 3 Jul 2019 19:45:47 -0600 Subject: [PATCH 1/6] Squashed 'libs/login/' changes from 78c5307f7a..979ddf4aec 979ddf4aec Merge commit '827a47189094a6bc7800eaccc3ed069841251373' into sync-login-lib df3c11ed09 added textAlignment property to secondary button in login da783ea3c7 Login screens: added textAlignment property to labels 6d486bbf6b Merge pull request #21 from wordpress-mobile/merge-wpa-develop 57a2d00b14 Update login lib standalone FluxC hash 0ea2405def Merge commit 'ad485b27b26ffb38b8718940b0b7556b902dc28c' into sync-login-lib 6df15ab86b Update 2FA unavailable API error message eefd72f317 Show error and continue login on OAuth client 2FA error ca3b68e817 Merge branch 'amanda/signin-has-woo' into amanda/signin-tracks-events 4755048046 Remove part of login site error msg and add help button 3cc4f31b3b Refresh branch with AndroidX changes in develop 76c40f3034 Fixed incorrect ordering of imports in login library 08a9f0c65a First pass at AndroidX migration. Used the migration wizard then did far too much cleanup. a46ceeb96b Track connected site info requests, success, and failures 47528a1c33 Special handling for atomic sites 578dca7f29 Update androidx dependencies 1d09d1536d Fix AndroidX import order 48df84638f Fix import ordering for androidx d3dc35035a Migrate to AndroidX e9e219db2f Add logic to get connected site info for woo login mode. 873db9b385 Add new logic to change the label to show the site logging into 9f442e9a2f Add new WOO_LOGIN_MODE 309eeda212 Add new string to handle non-WordPress site error dfc6991275 Revert "Add new loginMode for woo and update related error strings" 9b44d78d3e Add debug property to populate site address during login 45ae481c03 Add new loginMode for woo and update related error strings 91731b6196 Add a way to hide the option to login by site address 4d6c83f111 Merge pull request #9890 from wordpress-mobile/update-dagger-version-to-v2.22.1 9cbf3f17ff Merge pull request #9885 from wordpress-mobile/update-login-library 0ddf4dcdbd Update Glide version to 4.9.0 f7860b9861 Updated Dagger in the login library 1c311d430c Updated Dagger in the login library 79dd984392 Updated login library to Glide 4.9.0 e995e12f02 Revert sdk change for login library 954e7ddebc Updated targetSdkVersion to 28 7ee1e1c003 Added another catch block to handle NoActivityFoundException 804225d94f Merge commit 'a9cf59e44590548a123efeb521f9ff99b3277072' into update-login-lib git-subtree-dir: libs/login git-subtree-split: 979ddf4aec664cf9afafa1cdf7d99599488f1eee --- WordPressLoginFlow/build.gradle | 24 +++--- .../android/login/GoogleFragment.java | 5 +- .../android/login/Login2FaFragment.java | 11 +-- .../android/login/LoginAnalyticsListener.java | 3 + .../android/login/LoginBaseFormFragment.java | 33 +++++--- .../android/login/LoginEmailFragment.java | 68 +++++++++++---- .../login/LoginEmailPasswordFragment.java | 9 +- .../login/LoginHttpAuthDialogFragment.java | 9 +- .../android/login/LoginListener.java | 7 +- .../login/LoginMagicLinkRequestFragment.java | 11 +-- .../login/LoginMagicLinkSentFragment.java | 11 +-- .../wordpress/android/login/LoginMode.java | 3 +- .../login/LoginSiteAddressFragment.java | 84 ++++++++++++++++++- .../LoginSiteAddressHelpDialogFragment.java | 7 +- .../login/LoginUsernamePasswordFragment.java | 7 +- .../android/login/LoginWpcomService.java | 7 +- .../login/SignupBottomSheetDialog.java | 6 +- .../android/login/SignupEmailFragment.java | 9 +- .../android/login/SignupGoogleFragment.java | 3 +- .../login/SignupMagicLinkFragment.java | 13 +-- .../login/widgets/WPBottomSheetDialog.java | 6 +- .../login/widgets/WPLoginInputRow.java | 10 ++- .../login_magic_link_request_screen.xml | 4 +- .../login_magic_link_sent_screen.xml | 4 +- .../signup_bottom_sheet_dialog.xml | 12 +-- .../res/layout-land/signup_magic_link.xml | 4 +- .../main/res/layout/login_alert_http_auth.xml | 12 +-- .../layout/login_email_password_screen.xml | 2 + .../main/res/layout/login_email_screen.xml | 2 + .../src/main/res/layout/login_form_screen.xml | 5 +- .../src/main/res/layout/login_input_row.xml | 2 +- .../login_magic_link_request_screen.xml | 2 +- .../res/layout/login_site_address_screen.xml | 2 + .../res/layout/signup_bottom_sheet_dialog.xml | 12 +-- .../src/main/res/layout/toolbar_login.xml | 4 +- .../src/main/res/values/strings.xml | 6 +- config/checkstyle.xml | 2 +- gradle.properties-example | 4 + 38 files changed, 295 insertions(+), 130 deletions(-) diff --git a/WordPressLoginFlow/build.gradle b/WordPressLoginFlow/build.gradle index 4539b7b12211..786af0be0fa2 100644 --- a/WordPressLoginFlow/build.gradle +++ b/WordPressLoginFlow/build.gradle @@ -4,7 +4,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' + classpath 'com.android.tools.build:gradle:3.3.2' } } @@ -35,12 +35,12 @@ dependencies { exclude group: "com.mcxiaoke.volley" } - implementation 'com.android.support:appcompat-v7:28.0.0' - implementation 'com.android.support:animated-vector-drawable:28.0.0' - implementation 'com.android.support:support-media-compat:28.0.0' - implementation 'com.android.support:support-v13:28.0.0' - implementation 'com.android.support:gridlayout-v7:28.0.0' - implementation 'com.android.support:design:28.0.0' + implementation 'androidx.appcompat:appcompat:1.0.2' + implementation 'androidx.vectordrawable:vectordrawable-animated:1.0.0' + implementation 'androidx.media:media:1.0.1' + 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' api 'com.google.android.gms:play-services-auth:15.0.1' @@ -51,7 +51,7 @@ dependencies { exclude group: "org.wordpress", module: "utils" } } else { - implementation("com.github.wordpress-mobile.WordPress-FluxC-Android:fluxc:8cdbf03cf3d595ef904bab3c1dc207e39242c882") { + implementation("com.github.wordpress-mobile.WordPress-FluxC-Android:fluxc:9f07b031646dd3e6021d4b8e0a35647c9109ff27") { exclude group: "com.android.support" exclude group: "org.wordpress", module: "utils" } @@ -61,11 +61,11 @@ dependencies { annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0' // Dagger - implementation 'com.google.dagger:dagger:2.11' - annotationProcessor 'com.google.dagger:dagger-compiler:2.11' + implementation 'com.google.dagger:dagger:2.22.1' + annotationProcessor 'com.google.dagger:dagger-compiler:2.22.1' compileOnly 'org.glassfish:javax.annotation:10.0-b28' - implementation 'com.google.dagger:dagger-android-support:2.11' - annotationProcessor 'com.google.dagger:dagger-android-processor:2.11' + implementation 'com.google.dagger:dagger-android-support:2.22.1' + annotationProcessor 'com.google.dagger:dagger-android-processor:2.22.1' lintChecks 'org.wordpress:lint:1.0.1' } diff --git a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/GoogleFragment.java b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/GoogleFragment.java index cdb255b4a018..1d41c8d45593 100644 --- a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/GoogleFragment.java +++ b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/GoogleFragment.java @@ -4,10 +4,11 @@ import android.content.Intent; import android.content.IntentSender; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.Fragment; import android.util.Log; +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; + import com.google.android.gms.auth.api.Auth; import com.google.android.gms.auth.api.signin.GoogleSignInOptions; import com.google.android.gms.common.ConnectionResult; diff --git a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/Login2FaFragment.java b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/Login2FaFragment.java index 074e30e44c84..917cc60cf752 100644 --- a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/Login2FaFragment.java +++ b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/Login2FaFragment.java @@ -3,11 +3,6 @@ import android.content.ClipboardManager; import android.content.Context; import android.os.Bundle; -import android.support.annotation.LayoutRes; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.StringRes; -import android.support.v7.app.AlertDialog; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; @@ -20,6 +15,12 @@ import android.widget.EditText; import android.widget.TextView; +import androidx.annotation.LayoutRes; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.StringRes; +import androidx.appcompat.app.AlertDialog; + import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; import org.wordpress.android.fluxc.generated.AccountActionBuilder; diff --git a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginAnalyticsListener.java b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginAnalyticsListener.java index 231b1d09d04f..0143865f1d07 100644 --- a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginAnalyticsListener.java +++ b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginAnalyticsListener.java @@ -51,4 +51,7 @@ public interface LoginAnalyticsListener { void trackUrlHelpScreenViewed(); void trackUsernamePasswordFormViewed(); void trackWpComBackgroundServiceUpdate(Map properties); + void trackConnectedSiteInfoRequested(String url); + void trackConnectedSiteInfoFailed(String url, String errorContext, String errorType, String errorDescription); + void trackConnectedSiteInfoSucceeded(Map properties); } diff --git a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginBaseFormFragment.java b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginBaseFormFragment.java index eba9357aa352..a91b70dc85e0 100644 --- a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginBaseFormFragment.java +++ b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginBaseFormFragment.java @@ -5,15 +5,6 @@ import android.content.DialogInterface; import android.net.Uri; import android.os.Bundle; -import android.support.annotation.CallSuper; -import android.support.annotation.LayoutRes; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.StringRes; -import android.support.v4.app.Fragment; -import android.support.v7.app.ActionBar; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.Menu; @@ -26,6 +17,16 @@ import android.widget.EditText; import android.widget.TextView; +import androidx.annotation.CallSuper; +import androidx.annotation.LayoutRes; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.StringRes; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; +import androidx.fragment.app.Fragment; + import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; import org.wordpress.android.fluxc.Dispatcher; @@ -33,6 +34,7 @@ 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; @@ -40,6 +42,7 @@ 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; @@ -290,9 +293,15 @@ public void onAccountChanged(OnAccountChanged event) { if (event.isError()) { AppLog.e(AppLog.T.API, "onAccountChanged has error: " + event.error.type + " - " + event.error.message); - ToastUtils.showToast(getContext(), R.string.error_fetch_my_profile); - onLoginFinished(false); - return; + 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; + } } if (event.causeOfChange == AccountAction.FETCH_ACCOUNT) { diff --git a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginEmailFragment.java b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginEmailFragment.java index b00b63b0fe78..4fa31858f042 100644 --- a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginEmailFragment.java +++ b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginEmailFragment.java @@ -1,14 +1,11 @@ package org.wordpress.android.login; import android.app.PendingIntent; +import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.content.IntentSender; import android.os.Bundle; -import android.support.annotation.LayoutRes; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v7.app.AlertDialog; import android.text.Editable; import android.text.Html; import android.text.TextWatcher; @@ -22,6 +19,11 @@ import android.widget.LinearLayout; import android.widget.TextView; +import androidx.annotation.LayoutRes; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AlertDialog; + import com.google.android.gms.auth.api.Auth; import com.google.android.gms.auth.api.credentials.Credential; import com.google.android.gms.auth.api.credentials.CredentialPickerConfig; @@ -66,6 +68,9 @@ public class LoginEmailFragment extends LoginBaseFormFragment imp private static final int GOOGLE_API_CLIENT_ID = 1002; private static final int EMAIL_CREDENTIALS_REQUEST_CODE = 25100; + private static final String ARG_HIDE_LOGIN_BY_SITE_OPTION = "ARG_HIDE_LOGIN_BY_SITE_OPTION"; + private static final String ARG_LOGIN_SITE_URL = "ARG_LOGIN_SITE_URL"; + public static final String TAG = "login_email_fragment_tag"; public static final int MAX_EMAIL_LENGTH = 100; @@ -78,6 +83,17 @@ public class LoginEmailFragment extends LoginBaseFormFragment imp protected WPLoginInputRow mEmailInput; protected boolean mHasDismissedEmailHints; protected boolean mIsDisplayingEmailHints; + protected boolean mHideLoginWithSiteOption; + protected String mLoginSiteUrl; + + public static LoginEmailFragment newInstance(Boolean hideLoginWithSiteOption, String url) { + LoginEmailFragment fragment = new LoginEmailFragment(); + Bundle args = new Bundle(); + args.putBoolean(ARG_HIDE_LOGIN_BY_SITE_OPTION, hideLoginWithSiteOption); + args.putString(ARG_LOGIN_SITE_URL, url); + fragment.setArguments(args); + return fragment; + } @Override protected @LayoutRes int getContentLayout() { @@ -102,6 +118,9 @@ protected void setupLabel(@NonNull TextView label) { case WPCOM_LOGIN_ONLY: label.setText(R.string.enter_email_wordpress_com); break; + case WOO_LOGIN_MODE: + label.setText(getString(R.string.enter_email_for_site, mLoginSiteUrl)); + break; case JETPACK_STATS: label.setText(R.string.login_to_to_connect_jetpack); break; @@ -161,18 +180,22 @@ public void onClick(View view) { }); LinearLayout siteLoginButton = rootView.findViewById(R.id.login_site_button); - siteLoginButton.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View view) { - if (mLoginListener != null) { - if (mLoginListener.getLoginMode() == LoginMode.JETPACK_STATS) { - mLoginListener.loginViaWpcomUsernameInstead(); - } else { - mLoginListener.loginViaSiteAddress(); + if (mHideLoginWithSiteOption) { + siteLoginButton.setVisibility(View.GONE); + } else { + siteLoginButton.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + if (mLoginListener != null) { + if (mLoginListener.getLoginMode() == LoginMode.JETPACK_STATS) { + mLoginListener.loginViaWpcomUsernameInstead(); + } else { + mLoginListener.loginViaSiteAddress(); + } } } - } - }); + }); + } ImageView siteLoginButtonIcon = rootView.findViewById(R.id.login_site_button_icon); TextView siteLoginButtonText = rootView.findViewById(R.id.login_site_button_text); @@ -180,6 +203,7 @@ public void onClick(View view) { switch (mLoginListener.getLoginMode()) { case FULL: case WPCOM_LOGIN_ONLY: + case WOO_LOGIN_MODE: case SHARE_INTENT: siteLoginButtonIcon.setImageResource(R.drawable.ic_domains_grey_24dp); siteLoginButtonText.setText(R.string.enter_site_address_instead); @@ -210,6 +234,13 @@ public void onClick(View view) { } } }); + } else if (mLoginListener.getLoginMode() == LoginMode.WOO_LOGIN_MODE) { + secondaryButton.setText(getResources().getString(R.string.login_need_help_finding_connected_email)); + secondaryButton.setOnClickListener(new OnClickListener() { + public void onClick(View view) { + mLoginListener.showHelpFindingConnectedEmail(); + } + }); } else { secondaryButton.setVisibility(View.GONE); } @@ -243,6 +274,13 @@ public void onAttach(Context context) { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + + Bundle args = getArguments(); + if (args != null) { + mHideLoginWithSiteOption = args.getBoolean(ARG_HIDE_LOGIN_BY_SITE_OPTION, false); + mLoginSiteUrl = args.getString(ARG_LOGIN_SITE_URL, ""); + } + mGoogleApiClient = new GoogleApiClient.Builder(getActivity()) .addConnectionCallbacks(LoginEmailFragment.this) .enableAutoManage(getActivity(), GOOGLE_API_CLIENT_ID, LoginEmailFragment.this) @@ -444,6 +482,8 @@ public void getEmailHints() { startIntentSenderForResult(intent.getIntentSender(), EMAIL_CREDENTIALS_REQUEST_CODE, null, 0, 0, 0, null); } catch (IntentSender.SendIntentException exception) { AppLog.d(T.NUX, LOG_TAG + "Could not start email hint picker" + exception); + } catch (ActivityNotFoundException exception) { + AppLog.d(T.NUX, LOG_TAG + "Could not find any activity to handle email hint picker" + exception); } } diff --git a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginEmailPasswordFragment.java b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginEmailPasswordFragment.java index 420a765aa770..86a20ed80edd 100644 --- a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginEmailPasswordFragment.java +++ b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginEmailPasswordFragment.java @@ -2,9 +2,6 @@ import android.content.Context; import android.os.Bundle; -import android.support.annotation.LayoutRes; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; @@ -15,10 +12,14 @@ import android.widget.EditText; import android.widget.TextView; +import androidx.annotation.LayoutRes; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; -import org.wordpress.android.login.LoginWpcomService.OnCredentialsOK; import org.wordpress.android.login.LoginWpcomService.LoginState; +import org.wordpress.android.login.LoginWpcomService.OnCredentialsOK; import org.wordpress.android.login.util.SiteUtils; import org.wordpress.android.login.widgets.WPLoginInputRow; import org.wordpress.android.login.widgets.WPLoginInputRow.OnEditorCommitListener; diff --git a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginHttpAuthDialogFragment.java b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginHttpAuthDialogFragment.java index aa4f013c036f..66b1151b9ddf 100644 --- a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginHttpAuthDialogFragment.java +++ b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginHttpAuthDialogFragment.java @@ -5,10 +5,6 @@ import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v4.app.DialogFragment; -import android.support.v7.app.AlertDialog; import android.text.Editable; import android.text.TextWatcher; import android.view.ContextThemeWrapper; @@ -17,6 +13,11 @@ import android.widget.EditText; import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.DialogFragment; + import org.wordpress.android.util.EditTextUtils; public class LoginHttpAuthDialogFragment extends DialogFragment { diff --git a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginListener.java b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginListener.java index e17875f309df..a55fb4125142 100644 --- a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginListener.java +++ b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginListener.java @@ -1,8 +1,9 @@ package org.wordpress.android.login; import android.net.Uri; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import org.wordpress.android.fluxc.network.MemorizingTrustManager; import org.wordpress.android.fluxc.store.SiteStore; @@ -25,6 +26,7 @@ interface SelfSignedSSLCallback { void helpEmailScreen(String email); void helpSocialEmailScreen(String email); void addGoogleLoginFragment(); + void showHelpFindingConnectedEmail(); // Login Request Magic Link callbacks void showMagicLinkSentScreen(String email); @@ -46,6 +48,7 @@ interface SelfSignedSSLCallback { // Login Site Address input callbacks void alreadyLoggedInWpcom(ArrayList oldSitesIds); void gotWpcomSiteInfo(String siteAddress, String siteName, String siteIconUrl); + void gotConnectedSiteInfo(String siteAddress, boolean hasJetpack); void gotXmlRpcEndpoint(String inputSiteAddress, String endpointAddress); void handleSslCertificateError(MemorizingTrustManager memorizingTrustManager, SelfSignedSSLCallback callback); void helpSiteAddress(String url); diff --git a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginMagicLinkRequestFragment.java b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginMagicLinkRequestFragment.java index 14e2afa5db42..6082ec3b1404 100644 --- a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginMagicLinkRequestFragment.java +++ b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginMagicLinkRequestFragment.java @@ -5,11 +5,6 @@ import android.content.DialogInterface; import android.graphics.drawable.Drawable; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; -import android.support.v7.app.ActionBar; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -19,6 +14,12 @@ import android.widget.Button; import android.widget.ImageView; +import androidx.annotation.Nullable; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; +import androidx.fragment.app.Fragment; + import com.bumptech.glide.Glide; import com.bumptech.glide.load.DataSource; import com.bumptech.glide.load.engine.GlideException; diff --git a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginMagicLinkSentFragment.java b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginMagicLinkSentFragment.java index 683b6396acce..54ce0dc1aa18 100644 --- a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginMagicLinkSentFragment.java +++ b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginMagicLinkSentFragment.java @@ -2,11 +2,6 @@ import android.content.Context; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; -import android.support.v7.app.ActionBar; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -14,6 +9,12 @@ import android.view.View; import android.view.ViewGroup; +import androidx.annotation.Nullable; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; +import androidx.fragment.app.Fragment; + import javax.inject.Inject; import dagger.android.support.AndroidSupportInjection; diff --git a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginMode.java b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginMode.java index 8e569c053bd1..c71973571efb 100644 --- a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginMode.java +++ b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginMode.java @@ -9,7 +9,8 @@ public enum LoginMode { JETPACK_STATS, WPCOM_LOGIN_DEEPLINK, WPCOM_REAUTHENTICATE, - SHARE_INTENT; + SHARE_INTENT, + WOO_LOGIN_MODE; private static final String ARG_LOGIN_MODE = "ARG_LOGIN_MODE"; diff --git a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginSiteAddressFragment.java b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginSiteAddressFragment.java index c5d52db215be..2bcbfff80faa 100644 --- a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginSiteAddressFragment.java +++ b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginSiteAddressFragment.java @@ -4,9 +4,6 @@ import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.support.annotation.LayoutRes; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; @@ -18,6 +15,10 @@ import android.widget.EditText; import android.widget.TextView; +import androidx.annotation.LayoutRes; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; import org.wordpress.android.fluxc.Dispatcher; @@ -28,6 +29,7 @@ import org.wordpress.android.fluxc.network.discovery.SelfHostedEndpointFinder.DiscoveryError; import org.wordpress.android.fluxc.store.AccountStore; import org.wordpress.android.fluxc.store.AccountStore.OnDiscoveryResponse; +import org.wordpress.android.fluxc.store.SiteStore.OnConnectSiteInfoChecked; import org.wordpress.android.fluxc.store.SiteStore.OnWPComSiteFetched; import org.wordpress.android.login.util.SiteUtils; import org.wordpress.android.login.widgets.WPLoginInputRow; @@ -39,6 +41,7 @@ import org.wordpress.android.util.UrlUtils; import java.util.ArrayList; +import java.util.HashMap; import javax.inject.Inject; @@ -86,6 +89,9 @@ protected void setupContent(ViewGroup rootView) { // important for accessibility - talkback getActivity().setTitle(R.string.site_address_login_title); mSiteAddressInput = rootView.findViewById(R.id.login_site_address_row); + if (BuildConfig.DEBUG) { + mSiteAddressInput.getEditText().setText(BuildConfig.DEBUG_WPCOM_WEBSITE_URL); + } mSiteAddressInput.addTextChangedListener(this); mSiteAddressInput.setOnEditorCommitListener(this); } @@ -162,7 +168,16 @@ protected void discover() { mRequestedSiteAddress = cleanedSiteAddress; String cleanedXmlrpcSuffix = UrlUtils.removeXmlrpcSuffix(mRequestedSiteAddress); - mDispatcher.dispatch(SiteActionBuilder.newFetchWpcomSiteByUrlAction(cleanedXmlrpcSuffix)); + + if (mLoginListener.getLoginMode() == LoginMode.WOO_LOGIN_MODE) { + // TODO: This is temporary code to test out sign in flow milestone 1 effectiveness. If we move + // forward with this flow, we will need to just call the XMLRPC discovery code and handle all the + // edge cases such as HTTP auth and self-signed SSL. + mAnalyticsListener.trackConnectedSiteInfoRequested(cleanedXmlrpcSuffix); + mDispatcher.dispatch(SiteActionBuilder.newFetchConnectSiteInfoAction(cleanedXmlrpcSuffix)); + } else { + mDispatcher.dispatch(SiteActionBuilder.newFetchWpcomSiteByUrlAction(cleanedXmlrpcSuffix)); + } startProgress(); } @@ -353,4 +368,65 @@ public void onDiscoverySucceeded(OnDiscoveryResponse event) { AppLog.i(T.NUX, "Discovery succeeded, endpoint: " + event.xmlRpcEndpoint); mLoginListener.gotXmlRpcEndpoint(requestedSiteAddress, event.xmlRpcEndpoint); } + + @SuppressWarnings("unused") + @Subscribe(threadMode = ThreadMode.MAIN) + public void onFetchedConnectSiteInfo(OnConnectSiteInfoChecked event) { + if (mRequestedSiteAddress == null) { + // bail if user canceled + return; + } + + if (!isAdded()) { + return; + } + + // hold the URL in a variable to use below otherwise it gets cleared up by endProgress + final String requestedSiteAddress = mRequestedSiteAddress; + + if (isInProgress()) { + endProgress(); + } + + if (event.isError()) { + mAnalyticsListener.trackConnectedSiteInfoFailed( + requestedSiteAddress, + event.getClass().getSimpleName(), + event.error.type.name(), + event.error.message); + + AppLog.e(T.API, "onFetchedConnectSiteInfo has error: " + event.error.message); + + showError(R.string.invalid_site_url_message); + } else { + // TODO: If we plan to keep this logic we should convert these labels to constants + HashMap properties = new HashMap<>(); + properties.put("url", event.info.url); + properties.put("urlAfterRedirects", 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)); + mAnalyticsListener.trackConnectedSiteInfoSucceeded(properties); + + if (!event.info.exists) { + // Site does not exist + showError(R.string.invalid_site_url_message); + } else if (!event.info.isWordPress) { + // 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, hasJetpack); + } + } + } } diff --git a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginSiteAddressHelpDialogFragment.java b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginSiteAddressHelpDialogFragment.java index 07a0353fd489..eca020bf209f 100644 --- a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginSiteAddressHelpDialogFragment.java +++ b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginSiteAddressHelpDialogFragment.java @@ -4,11 +4,12 @@ import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.DialogFragment; -import android.support.v7.app.AlertDialog; import android.view.ContextThemeWrapper; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.DialogFragment; + import org.wordpress.android.fluxc.store.AccountStore; import org.wordpress.android.fluxc.store.SiteStore; diff --git a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginUsernamePasswordFragment.java b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginUsernamePasswordFragment.java index 3f3eea205c7a..e02c72321141 100644 --- a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginUsernamePasswordFragment.java +++ b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginUsernamePasswordFragment.java @@ -3,9 +3,6 @@ import android.content.Context; import android.graphics.Rect; import android.os.Bundle; -import android.support.annotation.LayoutRes; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; @@ -18,6 +15,10 @@ import android.widget.ScrollView; import android.widget.TextView; +import androidx.annotation.LayoutRes; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import com.bumptech.glide.Glide; import com.bumptech.glide.request.RequestOptions; diff --git a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginWpcomService.java b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginWpcomService.java index 86e9cf1e8e29..947b3c09c511 100644 --- a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginWpcomService.java +++ b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginWpcomService.java @@ -3,9 +3,10 @@ import android.app.Notification; import android.content.Context; import android.content.Intent; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.StringRes; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.StringRes; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; diff --git a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/SignupBottomSheetDialog.java b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/SignupBottomSheetDialog.java index 03f6b5798154..700670277c69 100644 --- a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/SignupBottomSheetDialog.java +++ b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/SignupBottomSheetDialog.java @@ -2,13 +2,15 @@ import android.content.Context; import android.content.DialogInterface; -import android.support.annotation.NonNull; -import android.support.design.widget.BottomSheetBehavior; import android.text.Html; import android.view.LayoutInflater; import android.view.View; import android.widget.Button; +import androidx.annotation.NonNull; + +import com.google.android.material.bottomsheet.BottomSheetBehavior; + import org.wordpress.android.login.widgets.WPBottomSheetDialog; public class SignupBottomSheetDialog extends WPBottomSheetDialog { diff --git a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/SignupEmailFragment.java b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/SignupEmailFragment.java index ad667dfcf5e3..0d2a66f8167d 100644 --- a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/SignupEmailFragment.java +++ b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/SignupEmailFragment.java @@ -5,10 +5,6 @@ import android.content.Intent; import android.content.IntentSender; import android.os.Bundle; -import android.support.annotation.LayoutRes; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v7.app.AlertDialog; import android.text.Editable; import android.text.TextWatcher; import android.util.Patterns; @@ -19,6 +15,11 @@ import android.widget.Button; import android.widget.TextView; +import androidx.annotation.LayoutRes; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AlertDialog; + import com.google.android.gms.auth.api.Auth; import com.google.android.gms.auth.api.credentials.Credential; import com.google.android.gms.auth.api.credentials.CredentialPickerConfig; diff --git a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/SignupGoogleFragment.java b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/SignupGoogleFragment.java index 91ffe71d8094..cc71f9112690 100644 --- a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/SignupGoogleFragment.java +++ b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/SignupGoogleFragment.java @@ -4,7 +4,8 @@ import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.support.annotation.NonNull; + +import androidx.annotation.NonNull; import com.google.android.gms.auth.api.Auth; import com.google.android.gms.auth.api.signin.GoogleSignInAccount; diff --git a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/SignupMagicLinkFragment.java b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/SignupMagicLinkFragment.java index 882c6226298c..30cc011cb1d7 100644 --- a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/SignupMagicLinkFragment.java +++ b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/SignupMagicLinkFragment.java @@ -4,12 +4,6 @@ import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; -import android.support.v7.app.ActionBar; -import android.support.v7.app.AlertDialog; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.Menu; @@ -19,6 +13,13 @@ import android.view.ViewGroup; import android.widget.Button; +import androidx.annotation.Nullable; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; +import androidx.fragment.app.Fragment; + import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; import org.wordpress.android.fluxc.Dispatcher; diff --git a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/widgets/WPBottomSheetDialog.java b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/widgets/WPBottomSheetDialog.java index 24b2da033616..9f77f1e2b305 100644 --- a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/widgets/WPBottomSheetDialog.java +++ b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/widgets/WPBottomSheetDialog.java @@ -1,10 +1,12 @@ package org.wordpress.android.login.widgets; import android.content.Context; -import android.support.annotation.NonNull; -import android.support.design.widget.BottomSheetDialog; import android.view.WindowManager; +import androidx.annotation.NonNull; + +import com.google.android.material.bottomsheet.BottomSheetDialog; + import org.wordpress.android.login.R; import org.wordpress.android.util.DisplayUtils; diff --git a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/widgets/WPLoginInputRow.java b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/widgets/WPLoginInputRow.java index d9ef1f90c19d..1cb90f8b2f83 100644 --- a/WordPressLoginFlow/src/main/java/org/wordpress/android/login/widgets/WPLoginInputRow.java +++ b/WordPressLoginFlow/src/main/java/org/wordpress/android/login/widgets/WPLoginInputRow.java @@ -9,10 +9,6 @@ import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; -import android.support.annotation.Nullable; -import android.support.design.widget.TextInputLayout; -import android.support.v4.content.ContextCompat; -import android.support.v4.graphics.drawable.DrawableCompat; import android.text.TextWatcher; import android.util.AttributeSet; import android.util.SparseArray; @@ -24,6 +20,12 @@ import android.widget.RelativeLayout; import android.widget.TextView; +import androidx.annotation.Nullable; +import androidx.core.content.ContextCompat; +import androidx.core.graphics.drawable.DrawableCompat; + +import com.google.android.material.textfield.TextInputLayout; + import org.wordpress.android.login.R; /** diff --git a/WordPressLoginFlow/src/main/res/layout-land/login_magic_link_request_screen.xml b/WordPressLoginFlow/src/main/res/layout-land/login_magic_link_request_screen.xml index 3a99b4023af4..e8edec571f4e 100644 --- a/WordPressLoginFlow/src/main/res/layout-land/login_magic_link_request_screen.xml +++ b/WordPressLoginFlow/src/main/res/layout-land/login_magic_link_request_screen.xml @@ -60,7 +60,7 @@ android:clipToPadding="false" tools:ignore="InconsistentLayout"> - - - - - - + - - + - - + diff --git a/WordPressLoginFlow/src/main/res/layout-land/signup_magic_link.xml b/WordPressLoginFlow/src/main/res/layout-land/signup_magic_link.xml index 86412338692d..9a9e425626f0 100644 --- a/WordPressLoginFlow/src/main/res/layout-land/signup_magic_link.xml +++ b/WordPressLoginFlow/src/main/res/layout-land/signup_magic_link.xml @@ -59,7 +59,7 @@ android:paddingTop="@dimen/margin_medium_large" tools:ignore="InconsistentLayout"> - - + diff --git a/WordPressLoginFlow/src/main/res/layout/login_alert_http_auth.xml b/WordPressLoginFlow/src/main/res/layout/login_alert_http_auth.xml index cca0fea52a19..320e38aba742 100644 --- a/WordPressLoginFlow/src/main/res/layout/login_alert_http_auth.xml +++ b/WordPressLoginFlow/src/main/res/layout/login_alert_http_auth.xml @@ -5,21 +5,21 @@ android:layout_height="match_parent" android:padding="?attr/dialogPreferredPadding"> - - - + - - - + diff --git a/WordPressLoginFlow/src/main/res/layout/login_email_password_screen.xml b/WordPressLoginFlow/src/main/res/layout/login_email_password_screen.xml index d0fb277070dd..bd28c1e74ca3 100644 --- a/WordPressLoginFlow/src/main/res/layout/login_email_password_screen.xml +++ b/WordPressLoginFlow/src/main/res/layout/login_email_password_screen.xml @@ -18,6 +18,8 @@ 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" /> diff --git a/WordPressLoginFlow/src/main/res/layout/login_form_screen.xml b/WordPressLoginFlow/src/main/res/layout/login_form_screen.xml index b098889bca1c..b73464ee00ae 100644 --- a/WordPressLoginFlow/src/main/res/layout/login_form_screen.xml +++ b/WordPressLoginFlow/src/main/res/layout/login_form_screen.xml @@ -37,7 +37,7 @@ android:layout_alignParentBottom="true" android:clipToPadding="false"> - - - - diff --git a/WordPressLoginFlow/src/main/res/layout/signup_bottom_sheet_dialog.xml b/WordPressLoginFlow/src/main/res/layout/signup_bottom_sheet_dialog.xml index eab8ce45968c..d41a6be9e682 100644 --- a/WordPressLoginFlow/src/main/res/layout/signup_bottom_sheet_dialog.xml +++ b/WordPressLoginFlow/src/main/res/layout/signup_bottom_sheet_dialog.xml @@ -13,7 +13,7 @@ android:paddingRight="@dimen/margin_extra_large" android:paddingTop="@dimen/margin_medium" > - - + - - + - - + diff --git a/WordPressLoginFlow/src/main/res/layout/toolbar_login.xml b/WordPressLoginFlow/src/main/res/layout/toolbar_login.xml index 8e069fad8b25..bac5435ba1ba 100644 --- a/WordPressLoginFlow/src/main/res/layout/toolbar_login.xml +++ b/WordPressLoginFlow/src/main/res/layout/toolbar_login.xml @@ -1,5 +1,5 @@ - - + diff --git a/WordPressLoginFlow/src/main/res/values/strings.xml b/WordPressLoginFlow/src/main/res/values/strings.xml index 43060a6f5771..26c045e7c2ab 100644 --- a/WordPressLoginFlow/src/main/res/values/strings.xml +++ b/WordPressLoginFlow/src/main/res/values/strings.xml @@ -15,6 +15,7 @@ Your notifications travel with you — see comments and likes as they happen. Manage your Jetpack-powered site on the go — you\'ve got WordPress in your pocket. Log in to WordPress.com using an email address to manage all your WordPress sites. + Log in with WordPress.com to connect to %1$s Next Open mail Alternatively: @@ -82,6 +83,7 @@ This site already exists in the app, you can\'t add it. A duplicate site has been detected. Couldn\'t retrieve your profile + Could not fetch settings: Some APIs are unavailable for this OAuth app ID + account combination. Log in to the WordPress.com account you used to connect Jetpack. Log in again to continue. Checking email @@ -99,7 +101,7 @@ site XMLRPC endpoint. The app needs that in order to communicate with your site. Contact your host to solve this problem. Please enter a WordPress.com or Jetpack-connected self-hosted WordPress site - + The website at this address is not a WordPress site. For us to connect to it, the site must have WordPress installed. A network error occurred. Please check your connection and try again. Logged in! @@ -138,4 +140,6 @@ placeholder + + Need help finding the email you connected with? diff --git a/config/checkstyle.xml b/config/checkstyle.xml index ae088941c51b..2ebaaac1412c 100644 --- a/config/checkstyle.xml +++ b/config/checkstyle.xml @@ -154,7 +154,7 @@ - + diff --git a/gradle.properties-example b/gradle.properties-example index 25f6dd86df44..d6cbf29bcc27 100644 --- a/gradle.properties-example +++ b/gradle.properties-example @@ -4,3 +4,7 @@ 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 From fcd4382495664e1baca74a50742760dfb663aa98 Mon Sep 17 00:00:00 2001 From: AmandaRiu Date: Wed, 3 Jul 2019 19:59:24 -0600 Subject: [PATCH 2/6] Fix build errors by implementing new interface methods in login lib These methods are not used by the WordPress app so they don't do anything and are only implemented to allow a successful build. These new methods were added for the Woo app. --- .../android/ui/accounts/LoginActivity.java | 8 ++++++++ .../ui/accounts/login/LoginAnalyticsTracker.java | 14 ++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/accounts/LoginActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/accounts/LoginActivity.java index ff0ea0cf5736..368cabb80005 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/accounts/LoginActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/accounts/LoginActivity.java @@ -826,4 +826,12 @@ private void dismissSignupSheet() { public AndroidInjector supportFragmentInjector() { return mFragmentInjector; } + + @Override public void showHelpFindingConnectedEmail() { + // Not used in WordPress app + } + + @Override public void gotConnectedSiteInfo(String siteAddress, boolean hasJetpack) { + // Not used in WordPress app + } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/accounts/login/LoginAnalyticsTracker.java b/WordPress/src/main/java/org/wordpress/android/ui/accounts/login/LoginAnalyticsTracker.java index 3fd1b6bcb983..c9af77eb8258 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/accounts/login/LoginAnalyticsTracker.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/accounts/login/LoginAnalyticsTracker.java @@ -236,4 +236,18 @@ public void trackUsernamePasswordFormViewed() { public void trackWpComBackgroundServiceUpdate(Map properties) { AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_WPCOM_BACKGROUND_SERVICE_UPDATE, properties); } + + @Override public void trackConnectedSiteInfoRequested(String url) { + // Not used in WordPress app + } + + @Override + public void trackConnectedSiteInfoFailed(String url, String errorContext, String errorType, + String errorDescription) { + // Not used in WordPress app + } + + @Override public void trackConnectedSiteInfoSucceeded(Map properties) { + // Not used in WordPress app + } } From 1e51fe9b223a3f918a44aeceef0514404e36b4c3 Mon Sep 17 00:00:00 2001 From: AmandaRiu Date: Wed, 3 Jul 2019 19:59:42 -0600 Subject: [PATCH 3/6] Copy new login lib strings to main strings file for localization --- WordPress/src/main/res/values/strings.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/WordPress/src/main/res/values/strings.xml b/WordPress/src/main/res/values/strings.xml index 52efb3f9d613..12c001b6453f 100644 --- a/WordPress/src/main/res/values/strings.xml +++ b/WordPress/src/main/res/values/strings.xml @@ -2270,6 +2270,7 @@ Enter your password instead Alternatively: Log in to WordPress.com using an email address to manage all your WordPress sites. + Log in with WordPress.com to connect to %1$s Next Open mail Log in by entering your site address. @@ -2320,6 +2321,8 @@ Google login could not be started. \nMaybe try a different account? Please enter a WordPress.com or Jetpack-connected self-hosted WordPress site + The website at this address is not a WordPress site. For us to connect to it, the site must have WordPress installed. + Need help finding the email you connected with? Email address login Site address login From 3d43b3c2ca0d96045f697c1072cee483956de918 Mon Sep 17 00:00:00 2001 From: AmandaRiu Date: Mon, 15 Jul 2019 21:10:19 -0600 Subject: [PATCH 4/6] Revert unintentional config changes --- .idea/codeStyles/Project.xml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index e83ad190f0af..40146908b459 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -1,10 +1,42 @@ + + +