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:
parent
fc84d3afdc
commit
04f8a25bce
@ -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,8 +259,7 @@ class BrowserFragment : Fragment(), BackHandler {
|
||||
)
|
||||
}
|
||||
toolbarComponent.getView().setOnSiteSecurityClickedListener {
|
||||
sessionId?.run {
|
||||
val session = requireNotNull(requireContext().components.core.sessionManager.findSessionById(this))
|
||||
val session = getSessionByIdOrUseSelectedSession()
|
||||
val quickSettingsSheet = QuickSettingsSheetDialogFragment.newInstance(
|
||||
url = session.url,
|
||||
isSecured = session.securityInfo.secure,
|
||||
@ -267,7 +268,6 @@ class BrowserFragment : Fragment(), BackHandler {
|
||||
quickSettingsSheet.show(requireFragmentManager(), QuickSettingsSheetDialogFragment.FRAGMENT_TAG)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user