From 2b86c0fdbb49602a2a954055876e48df6cfe8c18 Mon Sep 17 00:00:00 2001 From: Stefanos Togkoulidis Date: Mon, 11 Feb 2019 17:37:59 +0200 Subject: [PATCH 1/2] Append a Support tag if Gutenberg is default for new posts --- .../android/support/ZendeskHelper.kt | 1 + .../android/ui/accounts/HelpActivity.kt | 24 +++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/support/ZendeskHelper.kt b/WordPress/src/main/java/org/wordpress/android/support/ZendeskHelper.kt index 9025343e02c8..ac316f2a9e23 100644 --- a/WordPress/src/main/java/org/wordpress/android/support/ZendeskHelper.kt +++ b/WordPress/src/main/java/org/wordpress/android/support/ZendeskHelper.kt @@ -498,4 +498,5 @@ private object TicketFieldIds { object ZendeskExtraTags { const val connectingJetpack = "connecting_jetpack" + const val gutenbergIsDefault = "mobile_gutenberg_is_default" } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/accounts/HelpActivity.kt b/WordPress/src/main/java/org/wordpress/android/ui/accounts/HelpActivity.kt index f6ffafd4e15a..5c24bb90c4fb 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/accounts/HelpActivity.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/accounts/HelpActivity.kt @@ -14,12 +14,14 @@ import org.wordpress.android.fluxc.model.SiteModel import org.wordpress.android.fluxc.store.AccountStore import org.wordpress.android.fluxc.store.SiteStore import org.wordpress.android.support.SupportHelper +import org.wordpress.android.support.ZendeskExtraTags import org.wordpress.android.support.ZendeskHelper import org.wordpress.android.ui.ActivityId import org.wordpress.android.ui.AppLogViewerActivity import org.wordpress.android.ui.prefs.AppPrefs import org.wordpress.android.util.LocaleManager import java.util.ArrayList +import java.util.Collections import javax.inject.Inject class HelpActivity : AppCompatActivity() { @@ -177,9 +179,27 @@ class HelpActivity : AppCompatActivity() { if (selectedSite != null) { intent.putExtra(WordPress.SITE, selectedSite) } - if (extraSupportTags != null && !extraSupportTags.isEmpty()) { - intent.putStringArrayListExtra(HelpActivity.EXTRA_TAGS_KEY, extraSupportTags as ArrayList?) + + val tagsList: ArrayList? = if (AppPrefs.isGutenbergDefaultForNewPosts()) { + // construct a mutable list to add the Gutenberg related extra tag + val list = ArrayList() + + // add the provided list of tags if any + extraSupportTags?.let { + list.addAll(extraSupportTags) + } + + // Append the "mobile_gutenberg_is_default" tag if gutenberg is set to default for new posts + list.add(ZendeskExtraTags.gutenbergIsDefault) + list // "return" the list + } else { + extraSupportTags as ArrayList? } + + if (tagsList != null && !tagsList.isEmpty()) { + intent.putStringArrayListExtra(HelpActivity.EXTRA_TAGS_KEY, tagsList) + } + return intent } } From 8ed5012798b359b6fccdc423cca4cf297ff68baf Mon Sep 17 00:00:00 2001 From: Stefanos Togkoulidis Date: Mon, 11 Feb 2019 18:05:40 +0200 Subject: [PATCH 2/2] Remove unused import --- .../main/java/org/wordpress/android/ui/accounts/HelpActivity.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/accounts/HelpActivity.kt b/WordPress/src/main/java/org/wordpress/android/ui/accounts/HelpActivity.kt index 5c24bb90c4fb..fe6bc95328d9 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/accounts/HelpActivity.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/accounts/HelpActivity.kt @@ -21,7 +21,6 @@ import org.wordpress.android.ui.AppLogViewerActivity import org.wordpress.android.ui.prefs.AppPrefs import org.wordpress.android.util.LocaleManager import java.util.ArrayList -import java.util.Collections import javax.inject.Inject class HelpActivity : AppCompatActivity() {