diff --git a/app/src/main/java/org/mozilla/fenix/settings/quicksettings/ext/PhoneFeatureExt.kt b/app/src/main/java/org/mozilla/fenix/settings/quicksettings/ext/PhoneFeatureExt.kt index 0958209f8d..4169e1eb63 100644 --- a/app/src/main/java/org/mozilla/fenix/settings/quicksettings/ext/PhoneFeatureExt.kt +++ b/app/src/main/java/org/mozilla/fenix/settings/quicksettings/ext/PhoneFeatureExt.kt @@ -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**. diff --git a/app/src/test/java/org/mozilla/fenix/settings/quicksettings/ext/PhoneFeatureExtKtTest.kt b/app/src/test/java/org/mozilla/fenix/settings/quicksettings/ext/PhoneFeatureExtKtTest.kt index 834b88431e..73d80f8ad9 100644 --- a/app/src/test/java/org/mozilla/fenix/settings/quicksettings/ext/PhoneFeatureExtKtTest.kt +++ b/app/src/test/java/org/mozilla/fenix/settings/quicksettings/ext/PhoneFeatureExtKtTest.kt @@ -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