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.launch
import mozilla.appservices.places.BookmarkRoot
import mozilla.components.browser.session.Session
import mozilla.components.browser.toolbar.behavior.BrowserToolbarBottomBehavior
import mozilla.components.feature.contextmenu.ContextMenuCandidate
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.settings.quicksettings.QuickSettingsSheetDialogFragment
@SuppressWarnings("TooManyFunctions", "LargeClass")
class BrowserFragment : Fragment(), BackHandler {
private lateinit var toolbarComponent: ToolbarComponent
@ -257,15 +259,13 @@ class BrowserFragment : Fragment(), BackHandler {
)
}
toolbarComponent.getView().setOnSiteSecurityClickedListener {
sessionId?.run {
val session = requireNotNull(requireContext().components.core.sessionManager.findSessionById(this))
val quickSettingsSheet = QuickSettingsSheetDialogFragment.newInstance(
url = session.url,
isSecured = session.securityInfo.secure,
isSiteInExceptionList = false
)
quickSettingsSheet.show(requireFragmentManager(), QuickSettingsSheetDialogFragment.FRAGMENT_TAG)
}
val session = getSessionByIdOrUseSelectedSession()
val quickSettingsSheet = QuickSettingsSheetDialogFragment.newInstance(
url = session.url,
isSecured = session.securityInfo.secure,
isSiteInExceptionList = false
)
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 {
inline infix fun <reified T> exhaustive(any: T?) = any
}