2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-11 13:11:01 +00:00

Closes #1377: Fixed Doorhanger not shown when the toolbar padlock

is clicked.
This commit is contained in:
Arturo Mejia 2019-04-04 10:50:16 -04:00 committed by Colin Lee
parent fc84d3afdc
commit 04f8a25bce

View File

@ -27,6 +27,7 @@ import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Dispatchers.Main import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import mozilla.appservices.places.BookmarkRoot import mozilla.appservices.places.BookmarkRoot
import mozilla.components.browser.session.Session
import mozilla.components.browser.toolbar.behavior.BrowserToolbarBottomBehavior import mozilla.components.browser.toolbar.behavior.BrowserToolbarBottomBehavior
import mozilla.components.feature.contextmenu.ContextMenuCandidate import mozilla.components.feature.contextmenu.ContextMenuCandidate
import mozilla.components.feature.contextmenu.ContextMenuFeature import mozilla.components.feature.contextmenu.ContextMenuFeature
@ -69,6 +70,7 @@ import org.mozilla.fenix.utils.ItsNotBrokenSnack
import org.mozilla.fenix.utils.Settings import org.mozilla.fenix.utils.Settings
import org.mozilla.fenix.settings.quicksettings.QuickSettingsSheetDialogFragment import org.mozilla.fenix.settings.quicksettings.QuickSettingsSheetDialogFragment
@SuppressWarnings("TooManyFunctions", "LargeClass")
class BrowserFragment : Fragment(), BackHandler { class BrowserFragment : Fragment(), BackHandler {
private lateinit var toolbarComponent: ToolbarComponent private lateinit var toolbarComponent: ToolbarComponent
@ -257,15 +259,13 @@ class BrowserFragment : Fragment(), BackHandler {
) )
} }
toolbarComponent.getView().setOnSiteSecurityClickedListener { toolbarComponent.getView().setOnSiteSecurityClickedListener {
sessionId?.run { val session = getSessionByIdOrUseSelectedSession()
val session = requireNotNull(requireContext().components.core.sessionManager.findSessionById(this)) val quickSettingsSheet = QuickSettingsSheetDialogFragment.newInstance(
val quickSettingsSheet = QuickSettingsSheetDialogFragment.newInstance( url = session.url,
url = session.url, isSecured = session.securityInfo.secure,
isSecured = session.securityInfo.secure, isSiteInExceptionList = false
isSiteInExceptionList = false )
) quickSettingsSheet.show(requireFragmentManager(), QuickSettingsSheetDialogFragment.FRAGMENT_TAG)
quickSettingsSheet.show(requireFragmentManager(), QuickSettingsSheetDialogFragment.FRAGMENT_TAG)
}
} }
} }
@ -455,6 +455,14 @@ class BrowserFragment : Fragment(), BackHandler {
} }
} }
private fun getSessionByIdOrUseSelectedSession(): Session {
return if (sessionId != null) {
requireNotNull(requireContext().components.core.sessionManager.findSessionById(requireNotNull(sessionId)))
} else {
requireContext().components.core.sessionManager.selectedSessionOrThrow
}
}
object Do { object Do {
inline infix fun <reified T> exhaustive(any: T?) = any inline infix fun <reified T> exhaustive(any: T?) = any
} }