Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wp support forum card on help screen #17820

Merged
merged 3 commits into from
Jan 30, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,41 +99,17 @@ class HelpActivity : LocaleAwareActivity() {
actionBar.elevation = 0f // remove shadow
}

contactUsButton.setOnClickListener {
if (wpSupportForumFeatureConfig.isEnabled() && !BuildConfig.IS_JETPACK_APP) {
openWpSupportForum()
} else {
createNewZendeskTicket()
}
if (wpSupportForumFeatureConfig.isEnabled() && !BuildConfig.IS_JETPACK_APP) {
showSupportForum()
} else {
showContactUs()
}
faqButton.setOnClickListener { showFaq() }
myTicketsButton.setOnClickListener { showZendeskTickets() }

applicationVersion.text = getString(R.string.version_with_name_param, WordPress.versionName)
applicationLogButton.setOnClickListener { v ->
startActivity(Intent(v.context, AppLogViewerActivity::class.java))
}

contactEmailContainer.setOnClickListener {
var emailSuggestion = AppPrefs.getSupportEmail()
if (emailSuggestion.isNullOrEmpty()) {
emailSuggestion = supportHelper
.getSupportEmailAndNameSuggestion(
accountStore.account,
selectedSiteFromExtras
).first
}

supportHelper.showSupportIdentityInputDialog(
this@HelpActivity,
emailSuggestion,
isNameInputHidden = true
) { email, _ ->
zendeskHelper.setSupportEmail(email)
refreshContactEmailText()
AnalyticsTracker.track(Stat.SUPPORT_IDENTITY_SET)
}
AnalyticsTracker.track(Stat.SUPPORT_IDENTITY_FORM_VIEWED)
}
if (originFromExtras == Origin.JETPACK_MIGRATION_HELP) {
configureForJetpackMigrationHelp()
}
Expand Down Expand Up @@ -202,6 +178,51 @@ class HelpActivity : LocaleAwareActivity() {
AnalyticsTracker.track(Stat.SUPPORT_HELP_CENTER_VIEWED)
}

private fun HelpActivityBinding.showContactUs() {
contactUsButton.setOnClickListener { createNewZendeskTicket() }

faqButton.setOnClickListener { showFaq() }

myTicketsButton.setOnClickListener { showZendeskTickets() }

contactEmailContainer.setOnClickListener {
var emailSuggestion = AppPrefs.getSupportEmail()
if (emailSuggestion.isNullOrEmpty()) {
emailSuggestion = supportHelper
.getSupportEmailAndNameSuggestion(
accountStore.account,
selectedSiteFromExtras
).first
}

supportHelper.showSupportIdentityInputDialog(
this@HelpActivity,
emailSuggestion,
isNameInputHidden = true
) { email, _ ->
zendeskHelper.setSupportEmail(email)
refreshContactEmailText()
AnalyticsTracker.track(Stat.SUPPORT_IDENTITY_SET)
}
AnalyticsTracker.track(Stat.SUPPORT_IDENTITY_FORM_VIEWED)
}
}

private fun HelpActivityBinding.showSupportForum() {
contactUsButton.isVisible = false
faqButton.isVisible = false
myTicketsButton.isVisible = false
emailContainerTopDivider.isVisible = false
contactEmailContainer.isVisible = false
emailContainerBottomDivider.isVisible = false

forumContainer.run {
isVisible = true
setOnClickListener { openWpSupportForum() }
}
forumContainerBottomDivider.isVisible = true
}

private fun HelpActivityBinding.refreshContactEmailText() {
val supportEmail = AppPrefs.getSupportEmail()
contactEmailAddress.text = if (!supportEmail.isNullOrEmpty()) {
Expand Down
33 changes: 33 additions & 0 deletions WordPress/src/main/res/layout/help_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,37 @@
style="@style/HelpActivitySingleText"
android:text="@string/my_tickets" />

<LinearLayout
android:id="@+id/forumContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:orientation="vertical"
android:padding="@dimen/margin_extra_large"
android:visibility="gone"
tools:visibility="visible">

<com.google.android.material.textview.MaterialTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/support_forum_title"
android:textAppearance="?attr/textAppearanceSubtitle1" />

<com.google.android.material.textview.MaterialTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/support_forum_caption"
android:textAppearance="?attr/textAppearanceCaption" />
</LinearLayout>

<View
android:id="@+id/forumContainerBottomDivider"
android:layout_width="match_parent"
android:layout_height="@dimen/divider_size"
android:background="?android:attr/listDivider"
android:visibility="gone"
tools:visibility="visible"/>

<com.google.android.material.textview.MaterialTextView
android:id="@+id/application_log_button"
style="@style/HelpActivitySingleText"
Expand All @@ -114,6 +145,7 @@
tools:text="Version NN.1" />

<View
android:id="@+id/emailContainerTopDivider"
android:layout_width="match_parent"
android:layout_height="@dimen/divider_size"
android:background="?android:attr/listDivider" />
Expand Down Expand Up @@ -141,6 +173,7 @@
</LinearLayout>

<View
android:id="@+id/emailContainerBottomDivider"
android:layout_width="match_parent"
android:layout_height="@dimen/divider_size"
android:background="?android:attr/listDivider" />
Expand Down
2 changes: 2 additions & 0 deletions WordPress/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2234,6 +2234,8 @@
<string name="support_push_notification_title">WordPress</string>
<string name="support_push_notification_message">New message from \'Help &amp; Support\'</string>
<string name="contact_fragment_title" translatable="false" tools:ignore="UnusedResources">@string/contact_support</string>
<string name="support_forum_title">Community forums</string>
<string name="support_forum_caption">Get help from our group of volunteers</string>
ravishanker marked this conversation as resolved.
Show resolved Hide resolved

<!-- Contact us -->
<string name="support_ticket_subject">WordPress for Android Support</string>
Expand Down