2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-05 21:20:45 +00:00

For #10718 - Finish activity after removing external session

This commit is contained in:
ekager 2020-05-18 15:02:50 -07:00 committed by Emily Kager
parent 28a6b1f9d5
commit d46369696f

View File

@ -131,9 +131,6 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
private var browserInitialized: Boolean = false
private var initUIJob: Job? = null
// We need this so we don't accidentally remove all external sessions on back press
private var sessionRemoved = false
private var enteredPip = false
private val sharedViewModel: SharedViewModel by activityViewModels()
@ -587,8 +584,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
@CallSuper
override fun onBackPressed(): Boolean {
return sessionRemoved ||
findInPageIntegration.onBackPressed() ||
return findInPageIntegration.onBackPressed() ||
fullScreenFeature.onBackPressed() ||
sessionFeature.onBackPressed() ||
removeSessionIfNeeded()
@ -647,8 +643,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
val sessionManager = requireComponents.core.sessionManager
if (session.source == Session.Source.ACTION_VIEW) {
sessionManager.remove(session)
sessionRemoved = true
activity?.onBackPressed()
activity?.finish()
} else {
val isLastSession =
sessionManager.sessionsOfType(private = session.private).count() == 1