Skip to content

Commit

Permalink
Merge pull request #21355 from wordpress-mobile/issue/21354-feedback-…
Browse files Browse the repository at this point in the history
…form-a8c

Warn A8C users when accessing Zendesk
  • Loading branch information
nbradbury authored Oct 25, 2024
2 parents 854ad77 + 6eded72 commit da5752d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
import org.wordpress.android.ui.posts.PostsListActivity;
import org.wordpress.android.ui.posts.RemotePreviewLogicHelper.RemotePreviewType;
import org.wordpress.android.ui.prefs.AccountSettingsActivity;
import org.wordpress.android.ui.prefs.AppPrefs;
import org.wordpress.android.ui.prefs.AppSettingsActivity;
import org.wordpress.android.ui.prefs.BlogPreferencesActivity;
import org.wordpress.android.ui.prefs.MyProfileActivity;
Expand Down Expand Up @@ -127,6 +128,7 @@
import org.wordpress.android.util.AppLog;
import org.wordpress.android.util.AppLog.T;
import org.wordpress.android.util.ToastUtils;
import org.wordpress.android.util.ToastUtils.Duration;
import org.wordpress.android.util.UriWrapper;
import org.wordpress.android.util.UrlUtils;
import org.wordpress.android.util.WPActivityUtils;
Expand Down Expand Up @@ -1311,6 +1313,7 @@ public static void viewHelp(@NonNull Context context, @NonNull Origin origin, @N
}

public static void viewFeedbackForm(@NonNull Context context) {
warnIfIdentityA8C(context);
// TODO verify tracks event with iOS
AnalyticsTracker.track(Stat.FEEDBACK_FORM_OPENED);
Intent intent = new Intent(context, FeedbackFormActivity.class);
Expand All @@ -1322,6 +1325,17 @@ public static void viewZendeskTickets(@NonNull Context context,
viewHelpInNewStack(context, Origin.ZENDESK_NOTIFICATION, selectedSite, null);
}

/**
* Warn A8C users that they can't create Zendesk tickets
*/
@NonNull
public static void warnIfIdentityA8C(@NonNull Context context) {
String supportEmail = AppPrefs.getSupportEmail();
if (supportEmail.contains("@automattic.com") || supportEmail.contains("@a8c.com")) {
ToastUtils.showToast(context, R.string.support_warn_if_user_a8c, Duration.LONG);
}
}

public static void viewSSLCerts(Context context, String certificateString) {
Intent intent = new Intent(context, SSLCertsViewActivity.class);
intent.putExtra(SSLCertsViewActivity.CERT_DETAILS_KEYS, certificateString.replaceAll("\n", "<br/>"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ class HelpActivity : LocaleAwareActivity() {
}

private fun launchSupportWidget() {
ActivityLauncher.warnIfIdentityA8C(this)
val intent = SupportWebViewActivity.createIntent(
this,
originFromExtras,
Expand All @@ -179,6 +180,7 @@ class HelpActivity : LocaleAwareActivity() {
}

private fun createNewZendeskTicket() {
ActivityLauncher.warnIfIdentityA8C(this)
zendeskHelper.createNewTicket(
this,
originFromExtras,
Expand All @@ -193,6 +195,7 @@ class HelpActivity : LocaleAwareActivity() {
}

private fun showZendeskTickets() {
ActivityLauncher.warnIfIdentityA8C(this)
zendeskHelper.showAllTickets(
this,
originFromExtras,
Expand Down
1 change: 1 addition & 0 deletions WordPress/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,7 @@
<string name="feedback_form_unable_to_create_tempfile">Unable to create temporary file</string>
<string name="feedback_form_add_attachments">Add attachments</string>
<string name="feedback_form_note">If you need support, please get in touch using the \"Help &amp; Support\" screen</string>
<string name="support_warn_if_user_a8c">Automattic email accounts can\'t submit or view support tickets</string>
<string name="media_pager_remove_item_content_description">Remove item %1$d</string>

<!-- activity log -->
Expand Down

0 comments on commit da5752d

Please sign in to comment.