[fenix] For https://github.com/mozilla-mobile/fenix/issues/22784: Show collection snackbar only if fragment is still attached.

pull/600/head
mcarare 3 years ago committed by mergify[bot]
parent 01c4bf049a
commit 7b2460a2e5

@ -42,6 +42,7 @@ import org.mozilla.fenix.databinding.TabstrayMultiselectItemsBinding
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.metrics
import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.ext.runIfFragmentIsAttached
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.home.HomeScreenViewModel
import org.mozilla.fenix.share.ShareFragment
@ -485,18 +486,20 @@ class TabsTrayFragment : AppCompatDialogFragment() {
isNewCollection: Boolean = false,
collectionToSelect: Long?
) {
FenixSnackbar
.make(requireView())
.collectionMessage(tabSize, isNewCollection)
.anchorWithAction(getSnackbarAnchor()) {
findNavController().navigate(
TabsTrayFragmentDirections.actionGlobalHome(
focusOnAddressBar = false,
focusOnCollection = collectionToSelect.orDefault()
runIfFragmentIsAttached {
FenixSnackbar
.make(requireView())
.collectionMessage(tabSize, isNewCollection)
.anchorWithAction(getSnackbarAnchor()) {
findNavController().navigate(
TabsTrayFragmentDirections.actionGlobalHome(
focusOnAddressBar = false,
focusOnCollection = collectionToSelect.orDefault()
)
)
)
dismissTabsTray()
}.show()
dismissTabsTray()
}.show()
}
}
@VisibleForTesting

Loading…
Cancel
Save