Skip to content

Commit

Permalink
For mozilla-mobile#10718 - Finish activity after removing external se…
Browse files Browse the repository at this point in the history
…ssion
  • Loading branch information
ekager committed May 18, 2020
1 parent dc92ddb commit f00b591
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f00b591

Please sign in to comment.