mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-15 18:12:54 +00:00
[fenix] Adding support for Site Permissions.
This commit is contained in:
parent
ecccfb7a1d
commit
ade773f5d3
@ -191,6 +191,7 @@ dependencies {
|
||||
implementation Deps.mozilla_feature_tabs
|
||||
implementation Deps.mozilla_feature_findinpage
|
||||
implementation Deps.mozilla_feature_session_bundling
|
||||
implementation Deps.mozilla_feature_site_permissions
|
||||
|
||||
implementation Deps.mozilla_service_firefox_accounts
|
||||
implementation Deps.mozilla_service_fretboard
|
||||
|
@ -7,6 +7,8 @@
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
|
@ -26,6 +26,7 @@ import mozilla.components.feature.downloads.DownloadsFeature
|
||||
import mozilla.components.feature.prompts.PromptFeature
|
||||
import mozilla.components.feature.session.SessionFeature
|
||||
import mozilla.components.feature.session.SessionUseCases
|
||||
import mozilla.components.feature.sitepermissions.SitePermissionsFeature
|
||||
import mozilla.components.support.base.feature.BackHandler
|
||||
import mozilla.components.support.base.feature.ViewBoundFeatureWrapper
|
||||
import org.mozilla.fenix.BrowsingModeManager
|
||||
@ -54,6 +55,7 @@ class BrowserFragment : Fragment(), BackHandler {
|
||||
private val findInPageIntegration = ViewBoundFeatureWrapper<FindInPageIntegration>()
|
||||
private val customTabsToolbarFeature = ViewBoundFeatureWrapper<CustomTabsToolbarFeature>()
|
||||
private val toolbarIntegration = ViewBoundFeatureWrapper<ToolbarIntegration>()
|
||||
private val sitePermissionsFeature = ViewBoundFeatureWrapper<SitePermissionsFeature>()
|
||||
var sessionId: String? = null
|
||||
|
||||
override fun onCreateView(
|
||||
@ -165,6 +167,17 @@ class BrowserFragment : Fragment(), BackHandler {
|
||||
feature = (toolbarComponent.uiView as ToolbarUIView).toolbarIntegration,
|
||||
owner = this,
|
||||
view = view)
|
||||
|
||||
sitePermissionsFeature.set(
|
||||
feature = SitePermissionsFeature(
|
||||
anchorView = view.findInPageView,
|
||||
sessionManager = sessionManager
|
||||
) { permissions ->
|
||||
requestPermissions(permissions, REQUEST_CODE_APP_PERMISSIONS)
|
||||
},
|
||||
owner = this,
|
||||
view = view
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
@ -204,6 +217,9 @@ class BrowserFragment : Fragment(), BackHandler {
|
||||
REQUEST_CODE_PROMPT_PERMISSIONS -> promptsFeature.withFeature {
|
||||
it.onPermissionsResult(permissions, grantResults)
|
||||
}
|
||||
REQUEST_CODE_APP_PERMISSIONS -> sitePermissionsFeature.withFeature {
|
||||
it.onPermissionsResult(grantResults)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -257,6 +273,7 @@ class BrowserFragment : Fragment(), BackHandler {
|
||||
companion object {
|
||||
private const val REQUEST_CODE_DOWNLOAD_PERMISSIONS = 1
|
||||
private const val REQUEST_CODE_PROMPT_PERMISSIONS = 2
|
||||
private const val REQUEST_CODE_APP_PERMISSIONS = 3
|
||||
private const val TOOLBAR_HEIGHT = 56f
|
||||
private const val REPORT_SITE_ISSUE_URL = "https://webcompat.com/issues/new?url=%s&label=browser-fenix"
|
||||
}
|
||||
|
@ -90,6 +90,7 @@ object Deps {
|
||||
const val mozilla_feature_toolbar = "org.mozilla.components:feature-toolbar:${Versions.mozilla_android_components}"
|
||||
const val mozilla_feature_findinpage = "org.mozilla.components:feature-findinpage:${Versions.mozilla_android_components}"
|
||||
const val mozilla_feature_session_bundling = "org.mozilla.components:feature-session-bundling:${Versions.mozilla_android_components}"
|
||||
const val mozilla_feature_site_permissions = "org.mozilla.components:feature-sitepermissions:${Versions.mozilla_android_components}"
|
||||
|
||||
const val mozilla_service_firefox_accounts = "org.mozilla.components:service-firefox-accounts:${Versions.mozilla_android_components}"
|
||||
const val mozilla_service_fretboard = "org.mozilla.components:service-fretboard:${Versions.mozilla_android_components}"
|
||||
|
Loading…
Reference in New Issue
Block a user