Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
firefox-android
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Applications
firefox-android
Commits
44c271d8
Verified
Commit
44c271d8
authored
May 8, 2024
by
ma1
Browse files
Options
Downloads
Patches
Plain Diff
Bug 1871217: Improve permission handling in Fullscreen - BP,
tor-browser#42656
parent
43756a25
No related branches found
No related tags found
1 merge request
!93
Bug 42565 - Fenix 126 backports
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
android-components/components/feature/sitepermissions/src/main/java/mozilla/components/feature/sitepermissions/SitePermissionsFeature.kt
+10
-13
10 additions, 13 deletions
...ponents/feature/sitepermissions/SitePermissionsFeature.kt
with
10 additions
and
13 deletions
android-components/components/feature/sitepermissions/src/main/java/mozilla/components/feature/sitepermissions/SitePermissionsFeature.kt
+
10
−
13
View file @
44c271d8
...
...
@@ -56,6 +56,7 @@ import mozilla.components.concept.engine.permission.SitePermissions
import
mozilla.components.concept.engine.permission.SitePermissions.Status.ALLOWED
import
mozilla.components.concept.engine.permission.SitePermissions.Status.BLOCKED
import
mozilla.components.concept.engine.permission.SitePermissionsStorage
import
mozilla.components.feature.session.SessionUseCases
import
mozilla.components.feature.sitepermissions.SitePermissionsFeature.DialogConfig
import
mozilla.components.feature.tabs.TabsUseCases.SelectOrAddUseCase
import
mozilla.components.lib.state.ext.flowScoped
...
...
@@ -73,8 +74,6 @@ import mozilla.components.ui.icons.R as iconsR
internal
const
val
PROMPT_FRAGMENT_TAG
=
"mozac_feature_sitepermissions_prompt_dialog"
private
const
val
FULL_SCREEN_NOTIFICATION_TAG
=
"mozac_feature_prompts_full_screen_notification_dialog"
@VisibleForTesting
internal
const
val
STORAGE_ACCESS_DOCUMENTATION_URL
=
"https://developer.mozilla.org/en-US/docs/Web/API/Storage_Access_API"
...
...
@@ -95,6 +94,7 @@ internal const val STORAGE_ACCESS_DOCUMENTATION_URL =
* need to be requested. Once the request is completed, [onPermissionsResult] needs to be invoked.
* @property onShouldShowRequestPermissionRationale a callback that allows the feature to query
* the ActivityCompat.shouldShowRequestPermissionRationale or the Fragment.shouldShowRequestPermissionRationale values.
* @property exitFullscreenUseCase optional the use case in charge of exiting fullscreen
* @property shouldShowDoNotAskAgainCheckBox optional Visibility for Do not ask again Checkbox
**/
...
...
@@ -111,6 +111,7 @@ class SitePermissionsFeature(
override
val
onNeedToRequestPermissions
:
OnNeedToRequestPermissions
,
val
onShouldShowRequestPermissionRationale
:
(
permission
:
String
)
->
Boolean
,
private
val
store
:
BrowserStore
,
private
val
exitFullscreenUseCase
:
SessionUseCases
.
ExitFullScreenUseCase
=
SessionUseCases
(
store
).
exitFullscreen
,
private
val
shouldShowDoNotAskAgainCheckBox
:
Boolean
=
true
,
)
:
LifecycleAwareFeature
,
PermissionsFeature
{
@VisibleForTesting
...
...
@@ -432,11 +433,8 @@ class SitePermissionsFeature(
consumePermissionRequest
(
permissionRequest
)
return
null
}
val
private
:
Boolean
?
=
store
.
state
.
findTabOrCustomTabOrSelectedTab
(
sessionId
)
?.
content
?.
private
if
(
private
==
null
)
{
val
tab
=
store
.
state
.
findTabOrCustomTabOrSelectedTab
(
sessionId
)
if
(
tab
==
null
)
{
logger
.
error
(
"Unable to find a tab for $sessionId rejecting the prompt request"
)
permissionRequest
.
reject
()
consumePermissionRequest
(
permissionRequest
)
...
...
@@ -444,21 +442,20 @@ class SitePermissionsFeature(
}
val
permissionFromStorage
=
withContext
(
coroutineScope
.
coroutineContext
)
{
storage
.
findSitePermissionsBy
(
origin
,
private
=
private
)
storage
.
findSitePermissionsBy
(
origin
,
private
=
tab
.
content
.
private
)
}
val
prompt
=
if
(
shouldApplyRules
(
permissionFromStorage
))
{
handleRuledFlow
(
permissionRequest
,
origin
)
}
else
{
handleNoRuledFlow
(
permissionFromStorage
,
permissionRequest
,
origin
)
}
val
fullScreenNotificationDisplayed
=
fragmentManager
.
fragments
.
any
{
fragment
->
fragment
.
tag
==
FULL_SCREEN_NOTIFICATION_TAG
}
return
if
(
fullScreenNotificationDisplayed
||
prompt
==
null
)
{
return
if
(
prompt
==
null
)
{
null
}
else
{
// If we are in fullscreen, then exit to show the permission prompt.
// This won't have any effect if we are not in fullscreen.
exitFullscreenUseCase
.
invoke
(
tab
.
id
)
prompt
.
show
(
fragmentManager
,
PROMPT_FRAGMENT_TAG
)
prompt
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment