From 9c66e2a98825b88d2deb3b484d610ed7e5981f26 Mon Sep 17 00:00:00 2001 From: Shiki Date: Thu, 18 Jul 2019 16:42:59 -0600 Subject: [PATCH 1/8] PublicizeEvents: Add reason for ActionCompleted --- .../android/ui/publicize/PublicizeEvents.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeEvents.java b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeEvents.java index d3b9b522dd80..5224c881fd1c 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeEvents.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeEvents.java @@ -1,8 +1,13 @@ package org.wordpress.android.ui.publicize; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import org.json.JSONObject; import org.wordpress.android.ui.publicize.PublicizeConstants.ConnectAction; +import java.net.URL; + /** * Publicize-related EventBus event classes */ @@ -17,12 +22,21 @@ public static class ConnectionsChanged { public static class ActionCompleted { private final boolean mSucceeded; private final ConnectAction mAction; + /** + * The reason for why {@link #mSucceeded} is false. + */ + @Nullable private final Reason mReason; private String mService; public ActionCompleted(boolean succeeded, ConnectAction action, String service) { + this(succeeded, action, service, null); + } + + ActionCompleted(boolean succeeded, ConnectAction action, String service, @Nullable Reason reason) { mSucceeded = succeeded; mAction = action; mService = service; + mReason = reason; } public ConnectAction getAction() { @@ -36,6 +50,31 @@ public boolean didSucceed() { public String getService() { return mService; } + + @Nullable public Reason getReason() { + return mReason; + } + + public static class Reason { + private final int mMessageResId; + /** + * A URL that the user can be forward to in order to explain more about the {@link #mMessageResId}. + */ + @NonNull private final URL mExplanationURL; + + Reason(int messageResId, @NonNull URL explanationURL) { + mMessageResId = messageResId; + mExplanationURL = explanationURL; + } + + public int getMessageResId() { + return mMessageResId; + } + + @NonNull public URL getExplanationURL() { + return mExplanationURL; + } + } } public static class ActionAccountChosen { From aa61e30fd36d9459b4112376b25cea3100627e71 Mon Sep 17 00:00:00 2001 From: Shiki Date: Thu, 18 Jul 2019 16:46:37 -0600 Subject: [PATCH 2/8] Add error message for failed FB connections This message was copied from iOS. --- WordPress/src/main/res/values/strings.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/WordPress/src/main/res/values/strings.xml b/WordPress/src/main/res/values/strings.xml index d1cb1414f9dd..be0a0ad5568f 100644 --- a/WordPress/src/main/res/values/strings.xml +++ b/WordPress/src/main/res/values/strings.xml @@ -1903,6 +1903,8 @@ Connecting account Change the text of the sharing buttons\' label. This text won\'t appear until you add at least one sharing button. This will be included in tweets when people share using the Twitter button + The Facebook connection could not be made because this account does not have access to any pages. Facebook supports sharing connections to Facebook Pages, but not to Facebook Profiles. + https://en.support.wordpress.com/publicize/#facebook-pages Current Theme From 892934516129a986704a45c625c6f22ee7f5ac47 Mon Sep 17 00:00:00 2001 From: Shiki Date: Thu, 18 Jul 2019 16:53:26 -0600 Subject: [PATCH 3/8] Throw an exception in shouldShowChooserDialog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This exception handling is only for Facebook. Based on iOS, it doesn’t look like we need to handle the other service types. --- .../android/models/PublicizeService.java | 2 ++ .../ui/publicize/PublicizeActions.java | 26 ++++++++++++++++--- .../android/ui/publicize/PublicizeEvents.java | 12 ++++----- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/models/PublicizeService.java b/WordPress/src/main/java/org/wordpress/android/models/PublicizeService.java index c833490b071c..448a4b51ced4 100644 --- a/WordPress/src/main/java/org/wordpress/android/models/PublicizeService.java +++ b/WordPress/src/main/java/org/wordpress/android/models/PublicizeService.java @@ -3,6 +3,8 @@ import org.wordpress.android.util.StringUtils; public class PublicizeService { + public static final String FACEBOOK_SERVICE_ID = "facebook"; + private String mId; private String mLabel; private String mDescription; diff --git a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeActions.java b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeActions.java index b0b610db70a0..080c8c4b7986 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeActions.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeActions.java @@ -11,12 +11,14 @@ import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; +import org.wordpress.android.R; import org.wordpress.android.WordPress; import org.wordpress.android.datasets.PublicizeTable; import org.wordpress.android.models.PublicizeConnection; import org.wordpress.android.models.PublicizeService; import org.wordpress.android.ui.publicize.PublicizeConstants.ConnectAction; import org.wordpress.android.ui.publicize.PublicizeEvents.ActionCompleted; +import org.wordpress.android.ui.publicize.PublicizeEvents.ActionCompleted.Reason; import org.wordpress.android.util.AppLog; import org.wordpress.android.util.JSONUtils; @@ -36,6 +38,14 @@ public interface OnPublicizeActionListener { void onRequestReconnect(PublicizeService service, PublicizeConnection connection); } + private static class PublicizeConnectionValidationException extends Exception { + @NonNull private final Reason mReason; + + PublicizeConnectionValidationException(@NonNull Reason reason) { + mReason = reason; + } + } + /* * disconnect a currently connected publicize service */ @@ -169,10 +179,11 @@ public void onErrorResponse(VolleyError volleyError) { WordPress.getRestClientUtilsV1_1().post(path, params, null, listener, errorListener); } - private static boolean shouldShowChooserDialog(long siteId, String serviceId, JSONObject jsonObject) { + private static boolean shouldShowChooserDialog(long siteId, String serviceId, JSONObject jsonObject) + throws PublicizeConnectionValidationException { JSONArray jsonConnectionList = jsonObject.optJSONArray("connections"); - if (jsonConnectionList == null || jsonConnectionList.length() <= 1) { + if (jsonConnectionList == null || jsonConnectionList.length() <= 0) { return false; } @@ -191,10 +202,17 @@ private static boolean shouldShowChooserDialog(long siteId, String serviceId, JS } } + final boolean hasExternalAccounts = totalExternalAccounts > 0; if (PublicizeTable.onlyExternalConnections(serviceId)) { - return totalExternalAccounts > 0; + if (!hasExternalAccounts && serviceId.equals(PublicizeService.FACEBOOK_SERVICE_ID)) { + final Reason reason = new Reason(R.string.sharing_facebook_account_must_have_pages, + R.string.sharing_facebook_account_must_have_pages_explanation_url); + throw new PublicizeConnectionValidationException(reason); + } else { + return hasExternalAccounts; + } } else { - return totalAccounts > 0 || totalExternalAccounts > 0; + return totalAccounts > 0 || hasExternalAccounts; } } catch (JSONException e) { return false; diff --git a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeEvents.java b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeEvents.java index 5224c881fd1c..5e18796d66c0 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeEvents.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeEvents.java @@ -58,21 +58,21 @@ public String getService() { public static class Reason { private final int mMessageResId; /** - * A URL that the user can be forward to in order to explain more about the {@link #mMessageResId}. + * A resource Id containing a URL which points to a page, explaining more about {@link #mMessageResId}. */ - @NonNull private final URL mExplanationURL; + private final int mExplanationURLResId; - Reason(int messageResId, @NonNull URL explanationURL) { + Reason(int messageResId, int explanationURLResId) { mMessageResId = messageResId; - mExplanationURL = explanationURL; + mExplanationURLResId = explanationURLResId; } public int getMessageResId() { return mMessageResId; } - @NonNull public URL getExplanationURL() { - return mExplanationURL; + public int getExplanationURLResId() { + return mExplanationURLResId; } } } From 887aacf7e0479167b9c6347c1ddc727834292b67 Mon Sep 17 00:00:00 2001 From: Shiki Date: Thu, 18 Jul 2019 16:55:41 -0600 Subject: [PATCH 4/8] Handle PublicizeConnectionValidationException Show an alert when the Facebook account cannot be linked because there are no Pages. --- .../android/ui/publicize/PublicizeActions.java | 10 +++++++++- .../ui/publicize/PublicizeListActivity.java | 16 +++++++++++++++- WordPress/src/main/res/values/strings.xml | 1 + 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeActions.java b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeActions.java index 080c8c4b7986..6040f95b1a70 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeActions.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeActions.java @@ -124,7 +124,15 @@ private static void connectStepOne(final long siteId, final String serviceId, fi RestRequest.Listener listener = new RestRequest.Listener() { @Override public void onResponse(JSONObject jsonObject) { - if (shouldShowChooserDialog(siteId, serviceId, jsonObject)) { + final boolean showChooserDialog; + try { + showChooserDialog = shouldShowChooserDialog(siteId, serviceId, jsonObject); + } catch (PublicizeConnectionValidationException e) { + EventBus.getDefault().post(new ActionCompleted(false, ConnectAction.CONNECT, serviceId, e.mReason)); + return; + } + + if (showChooserDialog) { // show dialog showing multiple options EventBus.getDefault() .post(new PublicizeEvents.ActionRequestChooseAccount(siteId, serviceId, jsonObject)); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeListActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeListActivity.java index b234a24885ce..3e2028657dde 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeListActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeListActivity.java @@ -7,6 +7,7 @@ import android.view.ContextThemeWrapper; import android.view.MenuItem; +import androidx.annotation.NonNull; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; @@ -27,6 +28,7 @@ import org.wordpress.android.models.PublicizeConnection; import org.wordpress.android.models.PublicizeService; import org.wordpress.android.ui.publicize.PublicizeConstants.ConnectAction; +import org.wordpress.android.ui.publicize.PublicizeEvents.ActionCompleted; import org.wordpress.android.ui.publicize.adapters.PublicizeServiceAdapter; import org.wordpress.android.ui.publicize.services.PublicizeUpdateService; import org.wordpress.android.util.LocaleManager; @@ -322,7 +324,11 @@ public void onEventMainThread(PublicizeEvents.ActionCompleted event) { AnalyticsUtils.trackWithSiteDetails(Stat.PUBLICIZE_SERVICE_DISCONNECTED, mSite, analyticsProperties); } } else { - ToastUtils.showToast(this, R.string.error_generic); + if (event.getReason() != null) { + showAlertForFailureReason(event.getReason()); + } else { + ToastUtils.showToast(this, R.string.error_generic); + } } } @@ -372,4 +378,12 @@ public void onButtonPrefsClicked() { .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE) .commit(); } + + private void showAlertForFailureReason(@NonNull ActionCompleted.Reason reason) { + final AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setMessage(reason.getMessageResId()); + builder.setNeutralButton(R.string.learn_more, (dialog, which) -> dialog.dismiss()); + builder.setPositiveButton(R.string.ok, (dialog, which) -> dialog.dismiss()); + builder.show(); + } } diff --git a/WordPress/src/main/res/values/strings.xml b/WordPress/src/main/res/values/strings.xml index be0a0ad5568f..a7d5228be089 100644 --- a/WordPress/src/main/res/values/strings.xml +++ b/WordPress/src/main/res/values/strings.xml @@ -110,6 +110,7 @@ Write Post dismiss exit + OK Not now From 3e61ecb96f0aade29f528195dde2792787bd27c6 Mon Sep 17 00:00:00 2001 From: Shiki Date: Thu, 18 Jul 2019 17:26:22 -0600 Subject: [PATCH 5/8] =?UTF-8?q?Publicize:=20Remove=20=E2=80=9CLearn=20more?= =?UTF-8?q?=E2=80=9D=20button=20in=20FB=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I didn’t realize there was already a “Learn more” link in the page. ┻━┻ ︵ヽ(`Д´)ノ︵ ┻━┻ --- .../ui/publicize/PublicizeActions.java | 15 +++++---- .../android/ui/publicize/PublicizeEvents.java | 31 +++---------------- .../ui/publicize/PublicizeListActivity.java | 11 +++---- WordPress/src/main/res/values/strings.xml | 1 - 4 files changed, 16 insertions(+), 42 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeActions.java b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeActions.java index 6040f95b1a70..fc46188284dd 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeActions.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeActions.java @@ -18,7 +18,6 @@ import org.wordpress.android.models.PublicizeService; import org.wordpress.android.ui.publicize.PublicizeConstants.ConnectAction; import org.wordpress.android.ui.publicize.PublicizeEvents.ActionCompleted; -import org.wordpress.android.ui.publicize.PublicizeEvents.ActionCompleted.Reason; import org.wordpress.android.util.AppLog; import org.wordpress.android.util.JSONUtils; @@ -39,10 +38,10 @@ public interface OnPublicizeActionListener { } private static class PublicizeConnectionValidationException extends Exception { - @NonNull private final Reason mReason; + private final int mReasonResId; - PublicizeConnectionValidationException(@NonNull Reason reason) { - mReason = reason; + PublicizeConnectionValidationException(int reasonResId) { + mReasonResId = reasonResId; } } @@ -128,7 +127,9 @@ public void onResponse(JSONObject jsonObject) { try { showChooserDialog = shouldShowChooserDialog(siteId, serviceId, jsonObject); } catch (PublicizeConnectionValidationException e) { - EventBus.getDefault().post(new ActionCompleted(false, ConnectAction.CONNECT, serviceId, e.mReason)); + final ActionCompleted event = + new ActionCompleted(false, ConnectAction.CONNECT, serviceId, e.mReasonResId); + EventBus.getDefault().post(event); return; } @@ -213,9 +214,7 @@ private static boolean shouldShowChooserDialog(long siteId, String serviceId, JS final boolean hasExternalAccounts = totalExternalAccounts > 0; if (PublicizeTable.onlyExternalConnections(serviceId)) { if (!hasExternalAccounts && serviceId.equals(PublicizeService.FACEBOOK_SERVICE_ID)) { - final Reason reason = new Reason(R.string.sharing_facebook_account_must_have_pages, - R.string.sharing_facebook_account_must_have_pages_explanation_url); - throw new PublicizeConnectionValidationException(reason); + throw new PublicizeConnectionValidationException(R.string.sharing_facebook_account_must_have_pages); } else { return hasExternalAccounts; } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeEvents.java b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeEvents.java index 5e18796d66c0..7bb69719dd85 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeEvents.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeEvents.java @@ -25,18 +25,18 @@ public static class ActionCompleted { /** * The reason for why {@link #mSucceeded} is false. */ - @Nullable private final Reason mReason; + @Nullable private final Integer mReasonResId; private String mService; public ActionCompleted(boolean succeeded, ConnectAction action, String service) { this(succeeded, action, service, null); } - ActionCompleted(boolean succeeded, ConnectAction action, String service, @Nullable Reason reason) { + ActionCompleted(boolean succeeded, ConnectAction action, String service, @Nullable Integer reasonResId) { mSucceeded = succeeded; mAction = action; mService = service; - mReason = reason; + mReasonResId = reasonResId; } public ConnectAction getAction() { @@ -51,29 +51,8 @@ public String getService() { return mService; } - @Nullable public Reason getReason() { - return mReason; - } - - public static class Reason { - private final int mMessageResId; - /** - * A resource Id containing a URL which points to a page, explaining more about {@link #mMessageResId}. - */ - private final int mExplanationURLResId; - - Reason(int messageResId, int explanationURLResId) { - mMessageResId = messageResId; - mExplanationURLResId = explanationURLResId; - } - - public int getMessageResId() { - return mMessageResId; - } - - public int getExplanationURLResId() { - return mExplanationURLResId; - } + @Nullable public Integer getReasonResId() { + return mReasonResId; } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeListActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeListActivity.java index 3e2028657dde..812db8d890cf 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeListActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeListActivity.java @@ -7,7 +7,6 @@ import android.view.ContextThemeWrapper; import android.view.MenuItem; -import androidx.annotation.NonNull; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; @@ -28,7 +27,6 @@ import org.wordpress.android.models.PublicizeConnection; import org.wordpress.android.models.PublicizeService; import org.wordpress.android.ui.publicize.PublicizeConstants.ConnectAction; -import org.wordpress.android.ui.publicize.PublicizeEvents.ActionCompleted; import org.wordpress.android.ui.publicize.adapters.PublicizeServiceAdapter; import org.wordpress.android.ui.publicize.services.PublicizeUpdateService; import org.wordpress.android.util.LocaleManager; @@ -324,8 +322,8 @@ public void onEventMainThread(PublicizeEvents.ActionCompleted event) { AnalyticsUtils.trackWithSiteDetails(Stat.PUBLICIZE_SERVICE_DISCONNECTED, mSite, analyticsProperties); } } else { - if (event.getReason() != null) { - showAlertForFailureReason(event.getReason()); + if (event.getReasonResId() != null) { + showAlertForFailureReason(event.getReasonResId()); } else { ToastUtils.showToast(this, R.string.error_generic); } @@ -379,10 +377,9 @@ public void onButtonPrefsClicked() { .commit(); } - private void showAlertForFailureReason(@NonNull ActionCompleted.Reason reason) { + private void showAlertForFailureReason(int reasonResId) { final AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setMessage(reason.getMessageResId()); - builder.setNeutralButton(R.string.learn_more, (dialog, which) -> dialog.dismiss()); + builder.setMessage(reasonResId); builder.setPositiveButton(R.string.ok, (dialog, which) -> dialog.dismiss()); builder.show(); } diff --git a/WordPress/src/main/res/values/strings.xml b/WordPress/src/main/res/values/strings.xml index a7d5228be089..9cc91904c4e0 100644 --- a/WordPress/src/main/res/values/strings.xml +++ b/WordPress/src/main/res/values/strings.xml @@ -1905,7 +1905,6 @@ Change the text of the sharing buttons\' label. This text won\'t appear until you add at least one sharing button. This will be included in tweets when people share using the Twitter button The Facebook connection could not be made because this account does not have access to any pages. Facebook supports sharing connections to Facebook Pages, but not to Facebook Profiles. - https://en.support.wordpress.com/publicize/#facebook-pages Current Theme From 4ebd8aaa82b7c36b88be96276b6362e4122e9f6c Mon Sep 17 00:00:00 2001 From: Shiki Date: Thu, 18 Jul 2019 17:46:25 -0600 Subject: [PATCH 6/8] PublicizeListActivity: Use Calypso style for Alert --- .../wordpress/android/ui/publicize/PublicizeListActivity.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeListActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeListActivity.java index 812db8d890cf..0b8cb5c93b08 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeListActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeListActivity.java @@ -378,7 +378,8 @@ public void onButtonPrefsClicked() { } private void showAlertForFailureReason(int reasonResId) { - final AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = + new AlertDialog.Builder(new ContextThemeWrapper(this, R.style.Calypso_Dialog)); builder.setMessage(reasonResId); builder.setPositiveButton(R.string.ok, (dialog, which) -> dialog.dismiss()); builder.show(); From 527c2056fbd2ceb1a97f15b94e313ea50c9fbdae Mon Sep 17 00:00:00 2001 From: Shiki Date: Thu, 18 Jul 2019 17:56:40 -0600 Subject: [PATCH 7/8] PublicizeEvents: Remove unused imports --- .../org/wordpress/android/ui/publicize/PublicizeEvents.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeEvents.java b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeEvents.java index 7bb69719dd85..9e0001a62b16 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeEvents.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeEvents.java @@ -1,13 +1,10 @@ package org.wordpress.android.ui.publicize; -import androidx.annotation.NonNull; import androidx.annotation.Nullable; import org.json.JSONObject; import org.wordpress.android.ui.publicize.PublicizeConstants.ConnectAction; -import java.net.URL; - /** * Publicize-related EventBus event classes */ From a60ad2958950ce18cdd5adee860cb9a1bfdea7e0 Mon Sep 17 00:00:00 2001 From: Shiki Date: Fri, 19 Jul 2019 12:19:10 -0600 Subject: [PATCH 8/8] Log Facebook link error to help debugging --- .../org/wordpress/android/ui/publicize/PublicizeActions.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeActions.java b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeActions.java index fc46188284dd..22e933c05af2 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeActions.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/publicize/PublicizeActions.java @@ -19,6 +19,7 @@ import org.wordpress.android.ui.publicize.PublicizeConstants.ConnectAction; import org.wordpress.android.ui.publicize.PublicizeEvents.ActionCompleted; import org.wordpress.android.util.AppLog; +import org.wordpress.android.util.AppLog.T; import org.wordpress.android.util.JSONUtils; import java.util.HashMap; @@ -214,6 +215,9 @@ private static boolean shouldShowChooserDialog(long siteId, String serviceId, JS final boolean hasExternalAccounts = totalExternalAccounts > 0; if (PublicizeTable.onlyExternalConnections(serviceId)) { if (!hasExternalAccounts && serviceId.equals(PublicizeService.FACEBOOK_SERVICE_ID)) { + AppLog.i(T.SHARING, + "The Facebook account cannot be linked because either there was no Page selected or the " + + "Page is set as not published."); throw new PublicizeConnectionValidationException(R.string.sharing_facebook_account_must_have_pages); } else { return hasExternalAccounts;