mozilla-mobile / reference-browser

A full-featured browser reference implementation using Mozilla Android Components.
Mozilla Public License 2.0
581 stars 166 forks source link

Remove session removal code for Custom Tabs #748

Open jonalmeida opened 5 years ago

jonalmeida commented 5 years ago

With the fix for https://github.com/mozilla-mobile/android-components/issues/2874 this might no longer be needed.

private fun removeSessionIfNeeded() {
    val sessionManager = components.core.sessionManager
    val sessionId = sessionId

    val session = (if (sessionId != null) {
        sessionManager.findSessionById(sessionId)
    } else {
        sessionManager.selectedSession
    }) ?: return

    if (session.source == Session.Source.ACTION_VIEW || session.source == Session.Source.CUSTOM_TAB) {
        sessionManager.remove(session)
    }
}

https://github.com/mozilla-mobile/reference-browser/blob/master/app/src/main/java/org/mozilla/reference/browser/BrowserActivity.kt#L77-L90

pocmo commented 5 years ago

The code above is also for non custom tabs (and the back button!)

jonalmeida commented 5 years ago

The code above is also for non custom tabs (and the back button!)

Doesn't the session-feature handle this back button behaviour already?

pocmo commented 5 years ago

It doesn't remove Source.ACTION_VIEW sessions after going back.

jonalmeida commented 5 years ago

Shall I put that in the feature then? :)