Skip to content

Commit e6154f2

Browse files
authored
Merge pull request #14727 from woocommerce/woomob-1452-woo-possurveys-implement-a-click-on-the-notifications-to
[WOOMOB-1452][Woo POS][Surveys] Implement click action on notifications to show surveys
2 parents b5f743a + 164c823 commit e6154f2

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

WooCommerce/src/main/kotlin/com/woocommerce/android/AppUrls.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ object AppUrls {
3535

3636
const val CROWDSIGNAL_MAIN_SURVEY = "https://automattic.survey.fm/woo-app-general-feedback-user-survey"
3737
const val CROWDSIGNAL_PRODUCT_SURVEY = "https://automattic.survey.fm/woo-app-feature-feedback-products"
38+
const val CROWDSIGNAL_WOO_POS_SURVEY_POTENTIAL_USER = "https://automattic.survey.fm/woo-pos-potential-user-survey"
39+
const val CROWDSIGNAL_WOO_POS_SURVEY_CURRENT_USER = "https://automattic.survey.fm/woo-pos-current-user-survey"
3840

3941
const val CROWDSIGNAL_ANALYTICS_HUB_SURVEY = "https://automattic.survey.fm/woo-app-analytics-hub-production"
4042

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/main/MainActivity.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,8 @@ class MainActivity :
877877
// Propagate it to the DashboardBlazeCard
878878
event.isHandled = false
879879
}
880+
881+
is MainActivityViewModel.ViewSurvey -> showSurvey(event.surveyUrl)
880882
}
881883
}
882884

@@ -1286,6 +1288,15 @@ class MainActivity :
12861288
}
12871289
}
12881290

1291+
private fun showSurvey(surveyUrl: String) {
1292+
NavGraphMainDirections.actionGlobalFeedbackSurveyFragment(
1293+
surveyType = SurveyType.MAIN,
1294+
customUrl = surveyUrl
1295+
).apply {
1296+
navController.navigateSafely(this)
1297+
}
1298+
}
1299+
12891300
override fun updateOfflineStatusBar(isConnected: Boolean) {
12901301
if (isConnected) binding.offlineBar.hide() else binding.offlineBar.show()
12911302
}

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/main/MainActivityViewModel.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import android.os.Build.VERSION_CODES
66
import androidx.lifecycle.SavedStateHandle
77
import androidx.lifecycle.asLiveData
88
import com.woocommerce.android.AppPrefs
9+
import com.woocommerce.android.AppUrls
910
import com.woocommerce.android.R
1011
import com.woocommerce.android.analytics.AnalyticsEvent
1112
import com.woocommerce.android.analytics.AnalyticsEvent.REVIEW_OPEN
@@ -289,8 +290,13 @@ class MainActivityViewModel @Inject constructor(
289290
BLAZE_NO_CAMPAIGN_REMINDER,
290291
BLAZE_ABANDONED_CAMPAIGN_REMINDER -> triggerEvent(LaunchBlazeCampaignCreation)
291292

292-
WOO_POS_SURVEY_POTENTIAL_USER_REMINDER,
293-
WOO_POS_SURVEY_CURRENT_USER_REMINDER -> error("POS Survey notifications are not implemented yet")
293+
WOO_POS_SURVEY_POTENTIAL_USER_REMINDER -> triggerEvent(
294+
ViewSurvey(AppUrls.CROWDSIGNAL_WOO_POS_SURVEY_POTENTIAL_USER)
295+
)
296+
297+
WOO_POS_SURVEY_CURRENT_USER_REMINDER -> triggerEvent(
298+
ViewSurvey(AppUrls.CROWDSIGNAL_WOO_POS_SURVEY_CURRENT_USER)
299+
)
294300
}
295301
}
296302
}
@@ -338,6 +344,7 @@ class MainActivityViewModel @Inject constructor(
338344
data class ViewUrlInWebView(
339345
val url: String,
340346
) : Event()
347+
data class ViewSurvey(val surveyUrl: String) : Event()
341348

342349
object ShortcutOpenPayments : Event()
343350
object ShortcutOpenOrderCreation : Event()

WooCommerce/src/main/res/values/strings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3212,9 +3212,9 @@
32123212
<string name="local_notification_blaze_abandoned_campaign_reminder_title">Thinking about boosting your sales?</string>
32133213
<string name="local_notification_blaze_abandoned_campaign_reminder_description">Get your products seen by millions with Blaze and boost your sales</string>
32143214
<string name="local_notification_woo_pos_survey_potential_user_title">Thinking about in-person sales?</string>
3215-
<string name="local_notification_woo_pos_survey_potential_user_description">Help us build tools you\'d actually use. 2-minute survey to build tools you\'ll love.</string>
3215+
<string name="local_notification_woo_pos_survey_potential_user_description">Take a quick 2-minute survey to help us shape features you\'ll love.</string>
32163216
<string name="local_notification_woo_pos_survey_current_user_title">How\'s POS working for you?</string>
3217-
<string name="local_notification_woo_pos_survey_current_user_description">Share your experience in 2 minutes and help us improve.</string>
3217+
<string name="local_notification_woo_pos_survey_current_user_description">Share your experience in a quick 2-minute survey and help us improve.</string>
32183218

32193219
<!--
32203220
First product published congratulatory feature

0 commit comments

Comments
 (0)