mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-19 09:25:34 +00:00
[fenix] For issue https://github.com/mozilla-mobile/fenix/issues/11676: Features phone that doesn't a site permission exception shouldn't be shown (https://github.com/mozilla-mobile/fenix/pull/12855)
exception shouldn't be shown
This commit is contained in:
parent
69d6c450c5
commit
9f8851294b
@ -17,7 +17,15 @@ import org.mozilla.fenix.utils.Settings
|
||||
fun PhoneFeature.shouldBeVisible(
|
||||
sitePermissions: SitePermissions?,
|
||||
settings: Settings
|
||||
) = getStatus(sitePermissions, settings) != SitePermissions.Status.NO_DECISION
|
||||
): Boolean {
|
||||
// We have to check if the site have a site permission exception,
|
||||
// if it doesn't the feature shouldn't be visible
|
||||
return if (sitePermissions == null) {
|
||||
false
|
||||
} else {
|
||||
getStatus(sitePermissions, settings) != SitePermissions.Status.NO_DECISION
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Common [PhoneFeature] extensions used for **quicksettings**.
|
||||
|
@ -27,6 +27,8 @@ class PhoneFeatureExtKtTest {
|
||||
assertFalse(PhoneFeature.CAMERA.shouldBeVisible(noDecisionForPermission, mockk()))
|
||||
assertTrue(PhoneFeature.CAMERA.shouldBeVisible(userAllowedPermission, mockk()))
|
||||
assertTrue(PhoneFeature.CAMERA.shouldBeVisible(userBlockedPermission, mockk()))
|
||||
// The site doesn't have a site permission exception
|
||||
assertFalse(PhoneFeature.CAMERA.shouldBeVisible(null, mockk()))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user