1
0
Fork 0

For issue #11676: Features phone that doesn't a site permission exception shouldn't be shown (#12855)

exception shouldn't be shown
master
Arturo Mejia 2020-07-23 12:12:22 -04:00 committed by GitHub
parent 7f829e1752
commit 6530a45eb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -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**.

View File

@ -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