Skip to content

Commit

Permalink
Merge pull request #6 from wordpress-mobile/merge-wca
Browse files Browse the repository at this point in the history
Incorporate updates from WooAndroid
  • Loading branch information
malinajirka authored Oct 18, 2018
2 parents 8ed7a4f + b526124 commit 7e1e347
Show file tree
Hide file tree
Showing 27 changed files with 118 additions and 83 deletions.
14 changes: 10 additions & 4 deletions libs/login/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.android.tools.build:gradle:3.1.3'
}
}

Expand Down Expand Up @@ -38,13 +38,19 @@ dependencies {
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'

implementation 'com.google.android.gms:play-services-auth:15.0.1'
api 'com.google.android.gms:play-services-auth:15.0.1'

// Share FluxC version from host project if defined, otherwise fallback to default
if (project.hasProperty("fluxCVersion")) {
implementation "com.github.wordpress-mobile.WordPress-FluxC-Android:fluxc:$fluxCVersion"
implementation("com.github.wordpress-mobile.WordPress-FluxC-Android:fluxc:$fluxCVersion") {
exclude group: "com.android.support"
exclude group: "org.wordpress", module: "utils"
}
} else {
implementation 'com.github.wordpress-mobile.WordPress-FluxC-Android:fluxc:d4e583f21840111065f12e743cbf31de4307266b'
implementation("com.github.wordpress-mobile.WordPress-FluxC-Android:fluxc:7c4fa0333cef380aa80b92adbb5e4803b90dd7e5") {
exclude group: "com.android.support"
exclude group: "org.wordpress", module: "utils"
}
}

implementation 'com.github.bumptech.glide:glide:4.6.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ protected void setupLabel(@NonNull TextView label) {
label.setText(R.string.login_log_in_for_share_intent);
break;
case FULL:
case WPCOM_LOGIN_ONLY:
label.setText(R.string.enter_email_wordpress_com);
break;
case JETPACK_STATS:
Expand Down Expand Up @@ -177,6 +178,7 @@ public void onClick(View view) {

switch (mLoginListener.getLoginMode()) {
case FULL:
case WPCOM_LOGIN_ONLY:
case SHARE_INTENT:
siteLoginButtonIcon.setImageResource(R.drawable.ic_domains_grey_24dp);
siteLoginButtonText.setText(R.string.enter_site_address_instead);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.wordpress.android.fluxc.generated.AuthenticationActionBuilder;
import org.wordpress.android.fluxc.store.AccountStore;
import org.wordpress.android.fluxc.store.AccountStore.AuthEmailPayload;
import org.wordpress.android.fluxc.store.AccountStore.AuthEmailPayloadScheme;
import org.wordpress.android.fluxc.store.AccountStore.AuthEmailPayloadSource;
import org.wordpress.android.fluxc.store.AccountStore.OnAuthEmailSent;
import org.wordpress.android.util.AppLog;
Expand All @@ -51,6 +52,7 @@ public class LoginMagicLinkRequestFragment extends Fragment {
private static final String KEY_IN_PROGRESS = "KEY_IN_PROGRESS";
private static final String KEY_GRAVATAR_IN_PROGRESS = "KEY_GRAVATAR_IN_PROGRESS";
private static final String ARG_EMAIL_ADDRESS = "ARG_EMAIL_ADDRESS";
private static final String ARG_MAGIC_LINK_SCHEME = "ARG_MAGIC_LINK_SCHEME";
private static final String ARG_IS_JETPACK_CONNECT = "ARG_IS_JETPACK_CONNECT";
private static final String ARG_JETPACK_CONNECT_SOURCE = "ARG_JETPACK_CONNECT_SOURCE";

Expand All @@ -59,6 +61,7 @@ public class LoginMagicLinkRequestFragment extends Fragment {
private LoginListener mLoginListener;

private String mEmail;
private AuthEmailPayloadScheme mMagicLinkScheme;
private String mJetpackConnectSource;

private View mAvatarProgressBar;
Expand All @@ -71,12 +74,12 @@ public class LoginMagicLinkRequestFragment extends Fragment {
@Inject protected Dispatcher mDispatcher;

@Inject protected LoginAnalyticsListener mAnalyticsListener;

public static LoginMagicLinkRequestFragment newInstance(String email, boolean isJetpackConnect,
String jetpackConnectSource) {
public static LoginMagicLinkRequestFragment newInstance(String email, AuthEmailPayloadScheme scheme,
boolean isJetpackConnect, String jetpackConnectSource) {
LoginMagicLinkRequestFragment fragment = new LoginMagicLinkRequestFragment();
Bundle args = new Bundle();
args.putString(ARG_EMAIL_ADDRESS, email);
args.putSerializable(ARG_MAGIC_LINK_SCHEME, scheme);
args.putBoolean(ARG_IS_JETPACK_CONNECT, isJetpackConnect);
args.putString(ARG_JETPACK_CONNECT_SOURCE, jetpackConnectSource);
fragment.setArguments(args);
Expand All @@ -100,6 +103,7 @@ public void onCreate(Bundle savedInstanceState) {

if (getArguments() != null) {
mEmail = getArguments().getString(ARG_EMAIL_ADDRESS);
mMagicLinkScheme = (AuthEmailPayloadScheme) getArguments().getSerializable(ARG_MAGIC_LINK_SCHEME);
mIsJetpackConnect = getArguments().getBoolean(ARG_IS_JETPACK_CONNECT);
mJetpackConnectSource = getArguments().getString(ARG_JETPACK_CONNECT_SOURCE);
}
Expand All @@ -119,7 +123,8 @@ public void onClick(View v) {
showMagicLinkRequestProgressDialog();
AuthEmailPayloadSource source = getAuthEmailPayloadSource();
AuthEmailPayload authEmailPayload = new AuthEmailPayload(mEmail, false,
mIsJetpackConnect ? AccountStore.AuthEmailPayloadFlow.JETPACK : null, source);
mIsJetpackConnect ? AccountStore.AuthEmailPayloadFlow.JETPACK : null,
source, mMagicLinkScheme);
mDispatcher.dispatch(AuthenticationActionBuilder.newSendAuthEmailAction(authEmailPayload));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
public enum LoginMode {
FULL,
SELFHOSTED_ONLY,
WPCOM_LOGIN_ONLY,
JETPACK_STATS,
WPCOM_LOGIN_DEEPLINK,
WPCOM_REAUTHENTICATE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,19 @@ public void onWPComSiteFetched(OnWPComSiteFetched event) {
}

if (event.isError()) {
// not a wp.com site so, start the discovery process
mDispatcher.dispatch(AuthenticationActionBuilder.newDiscoverEndpointAction(mRequestedSiteAddress));
// Not a WordPress.com or Jetpack site
if (mLoginListener.getLoginMode() == LoginMode.WPCOM_LOGIN_ONLY) {
showError(R.string.enter_wpcom_or_jetpack_site);
endProgress();
} else {
// Start the discovery process
mDispatcher.dispatch(AuthenticationActionBuilder.newDiscoverEndpointAction(mRequestedSiteAddress));
}
} else {
if (event.site.isJetpackInstalled()) {
// if Jetpack site, treat it as selfhosted and start the discovery process
if (event.site.isJetpackInstalled() && mLoginListener.getLoginMode() != LoginMode.WPCOM_LOGIN_ONLY) {
// If Jetpack site, treat it as self-hosted and start the discovery process
// An exception is WPCOM_LOGIN_ONLY mode - in that case we're only interested in adding sites
// through WordPress.com login, and should proceed along that login path
mDispatcher.dispatch(AuthenticationActionBuilder.newDiscoverEndpointAction(mRequestedSiteAddress));
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,30 +114,30 @@ public String getStepName() {
private static class LoginNotification {
static Notification progress(Context context, int progress) {
return AutoForegroundNotification.progress(context,
context.getString(R.string.notification_channel_normal_id),
context.getString(R.string.login_notification_channel_id),
progress,
R.string.notification_login_title_in_progress,
R.string.notification_logging_in,
R.drawable.ic_my_sites_24dp,
R.color.blue_wordpress);
R.drawable.login_notification_icon,
R.color.login_notification_accent_color);
}

static Notification success(Context context) {
return AutoForegroundNotification.success(context,
context.getString(R.string.notification_channel_normal_id),
context.getString(R.string.login_notification_channel_id),
R.string.notification_login_title_success,
R.string.notification_logged_in,
R.drawable.ic_my_sites_24dp,
R.color.blue_wordpress);
R.drawable.login_notification_icon,
R.color.login_notification_accent_color);
}

static Notification failure(Context context, @StringRes int content) {
return AutoForegroundNotification.failure(context,
context.getString(R.string.notification_channel_normal_id),
context.getString(R.string.login_notification_channel_id),
R.string.notification_login_title_stopped,
content,
R.drawable.ic_my_sites_24dp,
R.color.blue_wordpress);
R.drawable.login_notification_icon,
R.color.login_notification_accent_color);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
tools:ignore="InconsistentLayout">

<android.support.v7.widget.AppCompatButton
style="@style/WordPress.Button.Secondary"
style="@style/LoginTheme.Button.Secondary"
android:id="@+id/login_enter_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand All @@ -78,7 +78,7 @@
android:text="@string/enter_your_password_instead"/>

<android.support.v7.widget.AppCompatButton
style="@style/WordPress.Button.Primary"
style="@style/LoginTheme.Button.Primary"
android:id="@+id/login_request_magic_link"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
tools:ignore="InconsistentLayout">

<android.support.v7.widget.AppCompatButton
style="@style/WordPress.Button.Secondary"
style="@style/LoginTheme.Button.Secondary"
android:id="@+id/login_enter_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand All @@ -68,7 +68,7 @@
android:text="@string/enter_your_password_instead"/>

<android.support.v7.widget.AppCompatButton
style="@style/WordPress.Button.Primary"
style="@style/LoginTheme.Button.Primary"
android:id="@+id/login_open_email_client"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
android:layout_width="match_parent"
android:padding="@dimen/margin_extra_large"
android:text="@string/signup_terms_of_service_text"
style="@style/WordPress.Button.Secondary" >
style="@style/LoginTheme.Button.Secondary" >
</android.support.v7.widget.AppCompatButton>

<LinearLayout
Expand All @@ -38,7 +38,7 @@
android:layout_weight="1"
android:layout_width="wrap_content"
android:text="@string/signup_with_email_button"
android:theme="@style/WordPress.Button" >
android:theme="@style/LoginTheme.Button" >
</android.support.v7.widget.AppCompatButton>

<android.support.v7.widget.AppCompatButton
Expand All @@ -49,7 +49,7 @@
android:layout_weight="1"
android:layout_width="wrap_content"
android:text="@string/signup_with_google_button"
android:theme="@style/WordPress.Button" >
android:theme="@style/LoginTheme.Button" >
</android.support.v7.widget.AppCompatButton>

</LinearLayout>
Expand Down
2 changes: 1 addition & 1 deletion libs/login/src/main/res/layout-land/signup_magic_link.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/open_mail"
style="@style/WordPress.Button.Primary" >
style="@style/LoginTheme.Button.Primary" >
</android.support.v7.widget.AppCompatButton>

</RelativeLayout>
Expand Down
2 changes: 1 addition & 1 deletion libs/login/src/main/res/layout/login_alert_http_auth.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_extra_large"
app:passwordToggleEnabled="true"
app:passwordToggleTint="@color/grey">
app:passwordToggleTint="@color/login_input_password_icon_color">

<android.support.design.widget.TextInputEditText
android:id="@+id/login_http_password"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
android:scaleType="fitCenter"
android:adjustViewBounds="true"
app:srcCompat="@drawable/login_site_address_help"
android:importantForAccessibility="no"
android:contentDescription="@null"/>

</LinearLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:importantForAccessibility="no"
android:tint="@color/grey_lighten_10"
android:tint="@color/login_input_icon_color"
app:srcCompat="@drawable/ic_user_grey_24dp"/>

<LinearLayout
Expand Down Expand Up @@ -74,7 +74,7 @@
android:textAlignment="viewStart"
android:gravity="start"
app:passwordToggleEnabled="true"
app:passwordToggleTint="@color/grey"
app:passwordToggleTint="@color/login_input_password_icon_color"
app:wpIconDrawable="@drawable/ic_lock_grey_24dp"
tools:ignore="UnusedAttribute" >
</org.wordpress.android.login.widgets.WPLoginInputRow>
Expand Down
4 changes: 2 additions & 2 deletions libs/login/src/main/res/layout/login_form_screen.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
android:clipToPadding="false">

<android.support.v7.widget.AppCompatButton
style="@style/WordPress.Button.Secondary"
style="@style/LoginTheme.Button.Secondary"
android:id="@+id/secondary_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand All @@ -56,7 +56,7 @@
tools:text="Secondary action"/>

<android.support.v7.widget.AppCompatButton
style="@style/WordPress.Button.Primary"
style="@style/LoginTheme.Button.Primary"
android:id="@+id/primary_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand Down
2 changes: 1 addition & 1 deletion libs/login/src/main/res/layout/login_input_row.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
android:layout_marginRight="@dimen/margin_extra_large"
android:layout_marginEnd="@dimen/margin_extra_large"
android:importantForAccessibility="no"
android:tint="@color/grey_lighten_10"
android:tint="@color/login_input_icon_color"
app:srcCompat="@drawable/ic_user_grey_24dp"/>

<org.wordpress.android.util.widgets.WPTextInputLayout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

<android.support.v7.widget.AppCompatButton
android:id="@+id/login_enter_password"
style="@style/WordPress.Button.Secondary"
style="@style/LoginTheme.Button.Secondary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@

<TextView
android:id="@+id/login_enter_password"
style="@style/WordPress.Button.Secondary"
style="@style/LoginTheme.Button.Secondary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/login_open_email_client"
android:layout_marginTop="@dimen/margin_extra_extra_extra_large"
android:layout_centerHorizontal="true"
android:textColor="@color/blue_wordpress"
android:textColor="@color/login_secondary_button_text_color"
android:text="@string/enter_your_password_instead" />

</RelativeLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
android:hint="@string/password"
android:inputType="textPassword"
app:passwordToggleEnabled="true"
app:passwordToggleTint="@color/grey"
app:passwordToggleTint="@color/login_input_password_icon_color"
android:textAlignment="viewStart"
android:gravity="start"
android:accessibilityLiveRegion="assertive"
Expand Down
6 changes: 3 additions & 3 deletions libs/login/src/main/res/layout/signup_bottom_sheet_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
android:layout_width="match_parent"
android:padding="@dimen/margin_extra_large"
android:text="@string/signup_terms_of_service_text"
style="@style/WordPress.Button.Secondary" >
style="@style/LoginTheme.Button.Secondary" >
</android.support.v7.widget.AppCompatButton>

<android.support.v7.widget.AppCompatButton
Expand All @@ -30,7 +30,7 @@
android:layout_marginTop="@dimen/margin_extra_small"
android:layout_width="match_parent"
android:text="@string/signup_with_email_button"
android:theme="@style/WordPress.Button" >
android:theme="@style/LoginTheme.Button" >
</android.support.v7.widget.AppCompatButton>

<android.support.v7.widget.AppCompatButton
Expand All @@ -39,7 +39,7 @@
android:layout_marginBottom="@dimen/margin_extra_small"
android:layout_width="match_parent"
android:text="@string/signup_with_google_button"
android:theme="@style/WordPress.Button" >
android:theme="@style/LoginTheme.Button" >
</android.support.v7.widget.AppCompatButton>

</LinearLayout>
4 changes: 2 additions & 2 deletions libs/login/src/main/res/layout/toolbar_login.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/blue_wordpress"
android:background="@color/login_toolbar_color"
android:elevation="@dimen/appbar_elevation"
app:contentInsetLeft="@dimen/toolbar_content_offset"
app:contentInsetStart="@dimen/toolbar_content_offset"
Expand All @@ -20,5 +20,5 @@
android:layout_height="24dp"
android:layout_gravity="center"
android:contentDescription="@null"
app:srcCompat="@drawable/ic_my_sites_white_32dp"/>
app:srcCompat="@drawable/login_toolbar_icon"/>
</android.support.v7.widget.Toolbar>
Loading

0 comments on commit 7e1e347

Please sign in to comment.