Bug 1858997 - Ensures we remove the Popup when destroying the fragment

(cherry picked from commit 081a2219515fe5947f39d28fee1d4aa2e64c243e)
fenix/119.1.1
Jeff Boek 7 months ago committed by mergify[bot]
parent 172cf0aa9b
commit 2f5cafeae4

@ -735,6 +735,11 @@ class HomeFragment : Fragment() {
lastAppliedWallpaperName = Wallpaper.defaultName lastAppliedWallpaperName = Wallpaper.defaultName
} }
override fun onStop() {
dismissRecommendPrivateBrowsingShortcut()
super.onStop()
}
override fun onStart() { override fun onStart() {
super.onStart() super.onStart()
@ -863,7 +868,7 @@ class HomeFragment : Fragment() {
PrivateBrowsingShortcutCfr.cancel.record() PrivateBrowsingShortcutCfr.cancel.record()
context.settings().showedPrivateModeContextualFeatureRecommender = true context.settings().showedPrivateModeContextualFeatureRecommender = true
context.settings().lastCfrShownTimeInMillis = System.currentTimeMillis() context.settings().lastCfrShownTimeInMillis = System.currentTimeMillis()
recommendPrivateBrowsingCFR?.dismiss() dismissRecommendPrivateBrowsingShortcut()
}, },
text = { text = {
FirefoxTheme { FirefoxTheme {
@ -887,7 +892,7 @@ class HomeFragment : Fragment() {
PrivateShortcutCreateManager.createPrivateShortcut(context) PrivateShortcutCreateManager.createPrivateShortcut(context)
context.settings().showedPrivateModeContextualFeatureRecommender = true context.settings().showedPrivateModeContextualFeatureRecommender = true
context.settings().lastCfrShownTimeInMillis = System.currentTimeMillis() context.settings().lastCfrShownTimeInMillis = System.currentTimeMillis()
recommendPrivateBrowsingCFR?.dismiss() dismissRecommendPrivateBrowsingShortcut()
}, },
colors = ButtonDefaults.buttonColors(backgroundColor = PhotonColors.LightGrey30), colors = ButtonDefaults.buttonColors(backgroundColor = PhotonColors.LightGrey30),
shape = RoundedCornerShape(8.dp), shape = RoundedCornerShape(8.dp),
@ -912,7 +917,7 @@ class HomeFragment : Fragment() {
PrivateBrowsingShortcutCfr.cancel.record() PrivateBrowsingShortcutCfr.cancel.record()
context.settings().showedPrivateModeContextualFeatureRecommender = true context.settings().showedPrivateModeContextualFeatureRecommender = true
context.settings().lastCfrShownTimeInMillis = System.currentTimeMillis() context.settings().lastCfrShownTimeInMillis = System.currentTimeMillis()
recommendPrivateBrowsingCFR?.dismiss() dismissRecommendPrivateBrowsingShortcut()
}, },
modifier = Modifier modifier = Modifier
.heightIn(36.dp) .heightIn(36.dp)
@ -938,6 +943,11 @@ class HomeFragment : Fragment() {
} }
} }
private fun dismissRecommendPrivateBrowsingShortcut() {
recommendPrivateBrowsingCFR?.dismiss()
recommendPrivateBrowsingCFR = null
}
private fun subscribeToTabCollections(): Observer<List<TabCollection>> { private fun subscribeToTabCollections(): Observer<List<TabCollection>> {
return Observer<List<TabCollection>> { return Observer<List<TabCollection>> {
requireComponents.core.tabCollectionStorage.cachedTabCollections = it requireComponents.core.tabCollectionStorage.cachedTabCollections = it

Loading…
Cancel
Save