2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

[fenix] For https://github.com/mozilla-mobile/fenix/issues/12157: Don't show two search widget dialogs

This commit is contained in:
Sawyer Blatz 2020-07-02 09:47:52 -07:00
parent 76702b4ae7
commit 32a8c99111

View File

@ -34,7 +34,11 @@ class SearchWidgetCFR(
fun displayIfNecessary() {
if (!context.settings().isInSearchWidgetExperiment ||
!context.settings().shouldDisplaySearchWidgetCFR()) { return }
!context.settings().shouldDisplaySearchWidgetCFR() ||
isShown
) { return }
isShown = true
showSearchWidgetCFR()
}
@ -85,14 +89,21 @@ class SearchWidgetCFR(
}
searchWidgetCFRDialog.setOnCancelListener {
isShown = false
context.components.analytics.metrics.track(Event.SearchWidgetCFRCanceled)
}
searchWidgetCFRDialog.setOnDismissListener {
isShown = false
context.settings().incrementSearchWidgetCFRDismissed()
}
searchWidgetCFRDialog.show()
context.components.analytics.metrics.track(Event.SearchWidgetCFRDisplayed)
}
companion object {
// Used to ensure multiple dialogs are not shown on top of each other
var isShown = false
}
}