Skip to content

Commit

Permalink
Merge pull request #13423 from woocommerce/13421-order-list-remove-cr…
Browse files Browse the repository at this point in the history
…eation-survey

[Order list] Remove order creation survey
  • Loading branch information
samiuelson authored Jan 30, 2025
2 parents 5558af5 + a907f3a commit fe7f276
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 156 deletions.
2 changes: 1 addition & 1 deletion RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
21.6
-----
- [*] Updated tablet detection logic to consider both width and height dimensions, enhancing compatibility with larger phones and tablets, particularly in landscape mode [https://github.com/woocommerce/woocommerce-android/pull/13228]

- [**] The UK customers have access to the POS now [https://github.com/woocommerce/woocommerce-android/pull/13386]
- [Internal] [*] Fixed a bug that could lead to a crash when formatting dates and times [https://github.com/woocommerce/woocommerce-android/pull/13393]
- [Internal] [*] Removed order creation survey from the order's list [https://github.com/woocommerce/woocommerce-android/pull/13423]

21.5
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ object AppUrls {

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

const val ORDER_CREATION_SURVEY = "https://automattic.survey.fm/woo-app-order-creation-production"

const val ADDONS_SURVEY = "https://automattic.survey.fm/woo-app-addons-production"

const val CROWDSIGNAL_STORE_SETUP_SURVEY =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ class AnalyticsTracker private constructor(
const val VALUE_STATE_OFF = "off"

const val VALUE_SIMPLE_PAYMENTS_FLOW = "simple_payment"
const val VALUE_SIMPLE_PAYMENTS_FEEDBACK = "simple_payments"
const val VALUE_SIMPLE_PAYMENTS_COLLECT_CARD = "card"
const val VALUE_SIMPLE_PAYMENTS_COLLECT_CASH = "cash"
const val VALUE_SIMPLE_PAYMENTS_COLLECT_LINK = "payment_link"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,9 @@ data class FeatureFeedbackSettings(

enum class Feature {
PRODUCT_ADDONS,
SIMPLE_PAYMENTS_AND_ORDER_CREATION,
ANALYTICS_HUB,
ORDER_SHIPPING_LINES
}

fun isFeedbackMoreThanDaysAgo(days: Int) = Date(settingChangeDate).pastTimeDeltaFromNowInDays greaterThan days

fun isFeedbackGivenMoreThanDaysAgo(days: Int) =
feedbackState == FeedbackState.GIVEN &&
Date(settingChangeDate).pastTimeDeltaFromNowInDays greaterThan days
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import com.woocommerce.android.analytics.AnalyticsTracker.Companion.VALUE_FEEDBA
import com.woocommerce.android.analytics.AnalyticsTracker.Companion.VALUE_FEEDBACK_STORE_SETUP_CONTEXT
import com.woocommerce.android.analytics.AnalyticsTracker.Companion.VALUE_ORDER_SHIPPING_LINES_FEEDBACK
import com.woocommerce.android.analytics.AnalyticsTracker.Companion.VALUE_PRODUCT_ADDONS_FEEDBACK
import com.woocommerce.android.analytics.AnalyticsTracker.Companion.VALUE_SIMPLE_PAYMENTS_FEEDBACK
import com.woocommerce.android.databinding.FragmentFeedbackSurveyBinding
import com.woocommerce.android.extensions.navigateSafely
import com.woocommerce.android.ui.base.BaseFragment
Expand All @@ -50,7 +49,6 @@ class FeedbackSurveyFragment : BaseFragment(R.layout.fragment_feedback_survey) {
SurveyType.MAIN -> VALUE_FEEDBACK_GENERAL_CONTEXT
SurveyType.PRODUCT -> VALUE_FEEDBACK_PRODUCT_M3_CONTEXT
SurveyType.STORE_ONBOARDING -> VALUE_FEEDBACK_STORE_SETUP_CONTEXT
SurveyType.ORDER_CREATION -> VALUE_SIMPLE_PAYMENTS_FEEDBACK
SurveyType.ADDONS -> VALUE_PRODUCT_ADDONS_FEEDBACK
SurveyType.ANALYTICS_HUB -> VALUE_ANALYTICS_HUB_FEEDBACK
SurveyType.ORDER_SHIPPING_LINES -> VALUE_ORDER_SHIPPING_LINES_FEEDBACK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import com.woocommerce.android.BuildConfig
@Suppress("MagicNumber")
enum class SurveyType(private val untaggedUrl: String, private val milestone: Int? = null) {
PRODUCT(AppUrls.CROWDSIGNAL_PRODUCT_SURVEY, 4),
ORDER_CREATION(AppUrls.ORDER_CREATION_SURVEY, 1),
MAIN(AppUrls.CROWDSIGNAL_MAIN_SURVEY),
ADDONS(AppUrls.ADDONS_SURVEY),
STORE_ONBOARDING(AppUrls.CROWDSIGNAL_STORE_SETUP_SURVEY),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ import com.woocommerce.android.extensions.isTwoPanesShouldBeUsed
import com.woocommerce.android.extensions.navigateSafely
import com.woocommerce.android.extensions.pinFabAboveBottomNavigationBar
import com.woocommerce.android.extensions.takeIfNotEqualTo
import com.woocommerce.android.model.FeatureFeedbackSettings
import com.woocommerce.android.model.FeatureFeedbackSettings.Feature.SIMPLE_PAYMENTS_AND_ORDER_CREATION
import com.woocommerce.android.model.FeatureFeedbackSettings.FeedbackState
import com.woocommerce.android.model.Order
import com.woocommerce.android.support.help.HelpOrigin
import com.woocommerce.android.support.requests.SupportRequestFormActivity
Expand All @@ -57,7 +54,6 @@ import com.woocommerce.android.tracker.OrderDurationRecorder
import com.woocommerce.android.ui.barcodescanner.BarcodeScanningFragment.Companion.KEY_BARCODE_SCANNING_SCAN_STATUS
import com.woocommerce.android.ui.base.TopLevelFragment
import com.woocommerce.android.ui.base.UIMessageResolver
import com.woocommerce.android.ui.feedback.SurveyType
import com.woocommerce.android.ui.jitm.JitmFragment
import com.woocommerce.android.ui.jitm.JitmMessagePathsProvider
import com.woocommerce.android.ui.main.AppBarStatus
Expand Down Expand Up @@ -720,11 +716,6 @@ class OrderListFragment :
new.jitmEnabled.takeIfNotEqualTo(old?.jitmEnabled) { jitmEnabled ->
initJitm(jitmEnabled)
}
new.isSimplePaymentsAndOrderCreationFeedbackVisible.takeIfNotEqualTo(
old?.isSimplePaymentsAndOrderCreationFeedbackVisible
) {
displaySimplePaymentsWIPCard(it)
}
new.isErrorFetchingDataBannerVisible.takeIfNotEqualTo(old?.isErrorFetchingDataBannerVisible) {
displayErrorParsingOrdersCard(it)
}
Expand Down Expand Up @@ -1122,45 +1113,6 @@ class OrderListFragment :
return binding.orderListView.ordersList.computeVerticalScrollOffset() == 0 && !viewModel.isSearching
}

private fun displaySimplePaymentsWIPCard(show: Boolean) {
if (!show) {
binding.simplePaymentsWIPcard.isVisible = false
return
}

binding.simplePaymentsWIPcard.isVisible = true
binding.simplePaymentsWIPcard.initView(
getString(R.string.orderlist_simple_payments_wip_title),
getString(R.string.orderlist_simple_payments_wip_message_enabled),
onGiveFeedbackClick = { onGiveFeedbackClicked() },
onDismissClick = {
FeatureFeedbackSettings(
FeatureFeedbackSettings.Feature.SIMPLE_PAYMENTS_AND_ORDER_CREATION,
FeedbackState.DISMISSED
).registerItself(feedbackPrefs)
viewModel.onDismissOrderCreationSimplePaymentsFeedback()
},
showFeedbackButton = true
)
}

private fun onGiveFeedbackClicked() {
AnalyticsTracker.track(
AnalyticsEvent.FEATURE_FEEDBACK_BANNER,
mapOf(
AnalyticsTracker.KEY_FEEDBACK_CONTEXT to AnalyticsTracker.VALUE_SIMPLE_PAYMENTS_FEEDBACK,
AnalyticsTracker.KEY_FEEDBACK_ACTION to AnalyticsTracker.VALUE_FEEDBACK_GIVEN
)
)
FeatureFeedbackSettings(
SIMPLE_PAYMENTS_AND_ORDER_CREATION,
FeedbackState.GIVEN
).registerItself(feedbackPrefs)
NavGraphMainDirections
.actionGlobalFeedbackSurveyFragment(SurveyType.ORDER_CREATION)
.apply { findNavController().navigateSafely(this) }
}

override fun onSwiped(gestureSource: OrderStatusUpdateSource.SwipeToCompleteGesture) {
viewModel.onSwipeStatusUpdate(gestureSource)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import androidx.paging.PagedList
import com.google.android.material.snackbar.Snackbar
import com.woocommerce.android.AppPrefsWrapper
import com.woocommerce.android.BuildConfig
import com.woocommerce.android.FeedbackPrefs
import com.woocommerce.android.R
import com.woocommerce.android.analytics.AnalyticsEvent
import com.woocommerce.android.analytics.AnalyticsEvent.ORDERS_LIST_AUTOMATIC_TIMEOUT_RETRY
Expand All @@ -35,7 +34,6 @@ import com.woocommerce.android.extensions.drop
import com.woocommerce.android.extensions.filter
import com.woocommerce.android.extensions.filterNotNull
import com.woocommerce.android.extensions.runWithContext
import com.woocommerce.android.model.FeatureFeedbackSettings
import com.woocommerce.android.model.Order
import com.woocommerce.android.model.RequestResult.SUCCESS
import com.woocommerce.android.network.ConnectionChangeReceiver.ConnectionChangeEvent
Expand Down Expand Up @@ -116,7 +114,6 @@ class OrderListViewModel @Inject constructor(
private val orderListTransactionLauncher: OrderListTransactionLauncher,
private val shouldShowCreateTestOrderScreen: ShouldShowCreateTestOrderScreen,
private val analyticsTracker: AnalyticsTrackerWrapper,
private val feedbackPrefs: FeedbackPrefs,
private val barcodeScanningTracker: BarcodeScanningTracker,
private val notificationChannelsHandler: NotificationChannelsHandler,
private val appPrefs: AppPrefsWrapper,
Expand All @@ -138,11 +135,6 @@ class OrderListViewModel @Inject constructor(
override val lifecycle: Lifecycle
get() = lifecycleRegistry

private val simplePaymentsAndOrderCreationFeedbackState
get() = feedbackPrefs.getFeatureFeedbackSettings(
FeatureFeedbackSettings.Feature.SIMPLE_PAYMENTS_AND_ORDER_CREATION
)?.feedbackState ?: FeatureFeedbackSettings.FeedbackState.UNANSWERED

val performanceObserver: LifecycleObserver = orderListTransactionLauncher

internal var ordersPagedListWrapper: PagedListWrapper<OrderListItemUIType>? = null
Expand Down Expand Up @@ -208,14 +200,6 @@ class OrderListViewModel @Inject constructor(
private var dismissListErrors = false
var searchQuery = ""

private val isSimplePaymentsAndOrderCreationFeedbackVisible: Boolean
get() {
val simplePaymentsAndOrderFeedbackDismissed =
simplePaymentsAndOrderCreationFeedbackState == FeatureFeedbackSettings.FeedbackState.DISMISSED
val isTroubleshootingBannerVisible = viewState.shouldDisplayTroubleshootingBanner
return !simplePaymentsAndOrderFeedbackDismissed && !isTroubleshootingBannerVisible
}

private var _lastUpdateOrdersList = MutableStateFlow<Long?>(null)
val lastUpdateOrdersList: LiveData<String?> = _lastUpdateOrdersList
.map { lastUpdateMillis ->
Expand Down Expand Up @@ -313,7 +297,6 @@ class OrderListViewModel @Inject constructor(
fun changeTroubleshootingBannerVisibility(show: Boolean) {
viewState = viewState.copy(
shouldDisplayTroubleshootingBanner = show,
isSimplePaymentsAndOrderCreationFeedbackVisible = !show
)
}

Expand Down Expand Up @@ -486,7 +469,6 @@ class OrderListViewModel @Inject constructor(
PARSE_ERROR -> {
viewState = viewState.copy(
isErrorFetchingDataBannerVisible = true,
isSimplePaymentsAndOrderCreationFeedbackVisible = false
)
}

Expand Down Expand Up @@ -517,13 +499,12 @@ class OrderListViewModel @Inject constructor(
private fun displayOrdersBannerOrJitm() {
viewModelScope.launch {
when {
!isSimplePaymentsAndOrderCreationFeedbackVisible -> {
!viewState.shouldDisplayTroubleshootingBanner -> {
viewState = viewState.copy(
jitmEnabled = true
)
}
}
refreshOrdersBannerVisibility()
}
}

Expand Down Expand Up @@ -796,23 +777,6 @@ class OrderListViewModel @Inject constructor(
}
}

private fun refreshOrdersBannerVisibility() {
viewState = viewState.copy(
isSimplePaymentsAndOrderCreationFeedbackVisible = isSimplePaymentsAndOrderCreationFeedbackVisible
)
}

fun onDismissOrderCreationSimplePaymentsFeedback() {
analyticsTracker.track(
AnalyticsEvent.FEATURE_FEEDBACK_BANNER,
mapOf(
AnalyticsTracker.KEY_FEEDBACK_CONTEXT to AnalyticsTracker.VALUE_SIMPLE_PAYMENTS_FEEDBACK,
AnalyticsTracker.KEY_FEEDBACK_ACTION to AnalyticsTracker.VALUE_FEEDBACK_DISMISSED
)
)
refreshOrdersBannerVisibility()
}

private fun checkChaChingSoundSettings() {
fun recreateNotificationChannel() {
notificationChannelsHandler.recreateNotificationChannel(NotificationChannelType.NEW_ORDER)
Expand Down Expand Up @@ -1137,7 +1101,6 @@ class OrderListViewModel @Inject constructor(
val isRefreshPending: Boolean = false,
val arePaymentGatewaysFetched: Boolean = false,
val filterCount: Int = 0,
val isSimplePaymentsAndOrderCreationFeedbackVisible: Boolean = false,
val jitmEnabled: Boolean = false,
val isErrorFetchingDataBannerVisible: Boolean = false,
val shouldDisplayTroubleshootingBanner: Boolean = false,
Expand Down
13 changes: 1 addition & 12 deletions WooCommerce/src/main/res/layout/fragment_order_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,14 @@
app:layout_constraintTop_toBottomOf="@id/toolbar"
tools:visibility="visible" />

<com.woocommerce.android.ui.products.FeatureWIPNoticeCard
android:id="@+id/simplePaymentsWIPcard"
style="@style/Woo.Card.Expandable"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/error_troubleshooting_card"
tools:visibility="visible" />

<com.woocommerce.android.ui.orders.filters.OrderFiltersCard
android:id="@+id/order_filters_card"
style="@style/Woo.Card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/simplePaymentsWIPcard" />
app:layout_constraintTop_toBottomOf="@+id/error_troubleshooting_card" />

<androidx.fragment.app.FragmentContainerView
android:id="@+id/jitmOrdersFragment"
Expand Down
2 changes: 0 additions & 2 deletions WooCommerce/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,6 @@
<string name="orderlist_loading">Looking up your orders…</string>
<string name="orderlist_no_filters_title">All Orders</string>
<string name="orderlist_filters_title">Filtered Orders</string>
<string name="orderlist_simple_payments_wip_title">Create orders from your device!</string>
<string name="orderlist_simple_payments_wip_message_enabled">We\'ve been working on making it possible to create orders from your device! You can try this feature out by tapping on the "+" button</string>
<string name="orderlist_simple_payments_menu">Simple payment</string>
<string name="order_card_transition_name">order_card_%1$s</string>
<string name="order_card_detail_transition_name">order_card_detail</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ import androidx.lifecycle.MutableLiveData
import androidx.paging.PagedList
import com.google.android.material.snackbar.Snackbar
import com.woocommerce.android.AppPrefsWrapper
import com.woocommerce.android.FeedbackPrefs
import com.woocommerce.android.R
import com.woocommerce.android.analytics.AnalyticsEvent
import com.woocommerce.android.analytics.AnalyticsTracker
import com.woocommerce.android.analytics.AnalyticsTrackerWrapper
import com.woocommerce.android.extensions.NotificationReceivedEvent
import com.woocommerce.android.extensions.takeIfNotEqualTo
import com.woocommerce.android.model.FeatureFeedbackSettings
import com.woocommerce.android.model.Order
import com.woocommerce.android.model.RequestResult
import com.woocommerce.android.notifications.NotificationChannelType
Expand Down Expand Up @@ -118,7 +115,6 @@ class OrderListViewModelTest : BaseUnitTest() {
private val getSelectedOrderFiltersCount: GetSelectedOrderFiltersCount = mock()
private val shouldShowCreateTestOrderScreen: ShouldShowCreateTestOrderScreen = mock()
private val analyticsTracker: AnalyticsTrackerWrapper = mock()
private val feedbackPrefs = mock<FeedbackPrefs>()
private val barcodeScanningTracker = mock<BarcodeScanningTracker>()
private val notificationChannelsHandler = mock<NotificationChannelsHandler>()
private val appPrefs = mock<AppPrefsWrapper>()
Expand Down Expand Up @@ -172,7 +168,6 @@ class OrderListViewModelTest : BaseUnitTest() {
orderListTransactionLauncher = mock(),
shouldShowCreateTestOrderScreen = shouldShowCreateTestOrderScreen,
analyticsTracker = analyticsTracker,
feedbackPrefs = feedbackPrefs,
barcodeScanningTracker = barcodeScanningTracker,
notificationChannelsHandler = notificationChannelsHandler,
appPrefs = appPrefs,
Expand Down Expand Up @@ -560,7 +555,7 @@ class OrderListViewModelTest : BaseUnitTest() {

// Then the order status is changed optimistically
val optimisticChangeEvent = viewModel.event.getOrAwaitValue()
assertTrue(optimisticChangeEvent is Event.ShowUndoSnackbar)
assertTrue(optimisticChangeEvent is ShowUndoSnackbar)

advanceTimeBy(1_001)

Expand Down Expand Up @@ -595,7 +590,7 @@ class OrderListViewModelTest : BaseUnitTest() {

// Then the order status is changed optimistically
val optimisticChangeEvent = viewModel.event.getOrAwaitValue()
assertTrue(optimisticChangeEvent is Event.ShowUndoSnackbar)
assertTrue(optimisticChangeEvent is ShowUndoSnackbar)

advanceTimeBy(1_001)

Expand All @@ -604,42 +599,6 @@ class OrderListViewModelTest : BaseUnitTest() {
assertTrue(resultEvent is OrderListEvent.ShowRetryErrorSnack)
}

@Test
fun `when onDismissOrderCreationSimplePaymentsFeedback called, then FEATURE_FEEDBACK_BANNER tracked`() =
testBlocking {
// when
viewModel.onDismissOrderCreationSimplePaymentsFeedback()

// then
verify(analyticsTracker).track(
AnalyticsEvent.FEATURE_FEEDBACK_BANNER,
mapOf(
AnalyticsTracker.KEY_FEEDBACK_CONTEXT to AnalyticsTracker.VALUE_SIMPLE_PAYMENTS_FEEDBACK,
AnalyticsTracker.KEY_FEEDBACK_ACTION to AnalyticsTracker.VALUE_FEEDBACK_DISMISSED
)
)
}

@Test
fun `when onDismissOrderCreationSimplePaymentsFeedback called, then order banner visibility changed`() =
testBlocking {
// given
val featureFeedbackSettings = mock<FeatureFeedbackSettings> {
on { feedbackState }.thenReturn(FeatureFeedbackSettings.FeedbackState.DISMISSED)
}
whenever(
feedbackPrefs.getFeatureFeedbackSettings(
FeatureFeedbackSettings.Feature.SIMPLE_PAYMENTS_AND_ORDER_CREATION
)
).thenReturn(featureFeedbackSettings)

// when
viewModel.onDismissOrderCreationSimplePaymentsFeedback()

// then
assertThat(viewModel.viewState.isSimplePaymentsAndOrderCreationFeedbackVisible).isEqualTo(false)
}

@Test
fun `when fetching orders for the first time fails with timeout, then trigger a retry event`() = testBlocking {
// given
Expand Down Expand Up @@ -997,7 +956,7 @@ class OrderListViewModelTest : BaseUnitTest() {
assertNotNull(isFetchingFirstPage)

// Check that isFetchingFirstPage is reset to default value (false) on clearLiveDataSources
assertFalse(isFetchingFirstPage!!)
assertFalse(isFetchingFirstPage)
}

@Test
Expand Down

0 comments on commit fe7f276

Please sign in to comment.