Bug 1865067 - Send surface_reanalyze_clicked only when button tapped

The shopping.surface_reanalyze_clicked event was sent everytime
the review checker sheet was opened while a product was being
reanalyzed. This patch fixes it by sending a separate telemetry
action for the button.
fenix/121.0
DreVla 6 months ago committed by Ryan VanderMeulen
parent 981b102b5d
commit c036ccfbe2

@ -79,7 +79,10 @@ class ReviewQualityCheckNetworkMiddleware(
}
}
ReviewQualityCheckAction.ReanalyzeProduct, ReviewQualityCheckAction.AnalyzeProduct -> {
ReviewQualityCheckAction.ReanalyzeProduct,
ReviewQualityCheckAction.AnalyzeProduct,
ReviewQualityCheckAction.RestoreReanalysis,
-> {
val reanalysis = reviewQualityCheckService.reanalyzeProduct()
if (reanalysis == null) {
@ -157,7 +160,7 @@ class ReviewQualityCheckNetworkMiddleware(
productAnalysis?.needsAnalysis == true &&
appStore.state.shoppingState.productsInAnalysis.contains(productPageUrl)
) {
dispatch(ReviewQualityCheckAction.ReanalyzeProduct)
dispatch(ReviewQualityCheckAction.RestoreReanalysis)
}
}

@ -112,6 +112,12 @@ sealed interface ReviewQualityCheckAction : Action {
*/
object ReanalyzeProduct : NetworkAction, UpdateAction, TelemetryAction
/**
* Triggered when the product was previously known to be in reanalysis
* process when the sheet was closed and the state should be restored.
*/
object RestoreReanalysis : NetworkAction, UpdateAction
/**
* Triggered when the user clicks on the analyze button
*/

@ -121,7 +121,10 @@ private fun mapStateForUpdateAction(
}
}
ReviewQualityCheckAction.ReanalyzeProduct, ReviewQualityCheckAction.AnalyzeProduct -> {
ReviewQualityCheckAction.ReanalyzeProduct,
ReviewQualityCheckAction.AnalyzeProduct,
ReviewQualityCheckAction.RestoreReanalysis,
-> {
state.mapIfOptedIn {
when (it.productReviewState) {
is ProductReviewState.AnalysisPresent -> {

Loading…
Cancel
Save