2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-17 15:26:23 +00:00

Bug 1847266 - Implement status message for incompatible add-ons in the manager

This commit is contained in:
William Durand 2023-10-02 11:55:16 +02:00 committed by mergify[bot]
parent 4b3afea56d
commit 92a1a0d3fe
2 changed files with 26 additions and 1 deletions

View File

@ -132,7 +132,11 @@ class InstalledAddonDetailsFragment : Fragment() {
switch.setState(addon.isEnabled()) switch.setState(addon.isEnabled())
// When the ad-on is blocklisted or not correctly signed, we do not want to enable the toggle switch // When the ad-on is blocklisted or not correctly signed, we do not want to enable the toggle switch
// because users shouldn't be able to re-enable an add-on in this state. // because users shouldn't be able to re-enable an add-on in this state.
if (addon.isDisabledAsBlocklisted() || addon.isDisabledAsNotCorrectlySigned()) { if (
addon.isDisabledAsBlocklisted() ||
addon.isDisabledAsNotCorrectlySigned() ||
addon.isDisabledAsIncompatible()
) {
switch.isEnabled = false switch.isEnabled = false
return return
} }
@ -321,6 +325,7 @@ class InstalledAddonDetailsFragment : Fragment() {
) )
} }
} }
private fun bindRemoveButton() { private fun bindRemoveButton() {
binding.removeAddOn.setOnClickListener { binding.removeAddOn.setOnClickListener {
setAllInteractiveViewsClickable(binding, false) setAllInteractiveViewsClickable(binding, false)

View File

@ -91,6 +91,7 @@ class InstalledAddonDetailsFragmentTest {
every { fragment.providePrivateBrowsingSwitch() } returns privateBrowsingSwitch every { fragment.providePrivateBrowsingSwitch() } returns privateBrowsingSwitch
every { addon.isDisabledAsBlocklisted() } returns false every { addon.isDisabledAsBlocklisted() } returns false
every { addon.isDisabledAsNotCorrectlySigned() } returns false every { addon.isDisabledAsNotCorrectlySigned() } returns false
every { addon.isDisabledAsIncompatible() } returns false
every { addon.isEnabled() } returns true every { addon.isEnabled() } returns true
every { fragment.addon } returns addon every { fragment.addon } returns addon
@ -116,4 +117,23 @@ class InstalledAddonDetailsFragmentTest {
verify { enableSwitch.isEnabled = false } verify { enableSwitch.isEnabled = false }
} }
@Test
fun `GIVEN incompatible addon WHEN biding the enable switch THEN disable the switch`() {
val addon = mockk<Addon>()
val enableSwitch = mockk<SwitchMaterial>(relaxed = true)
val privateBrowsingSwitch = mockk<SwitchMaterial>(relaxed = true)
every { fragment.provideEnableSwitch() } returns enableSwitch
every { fragment.providePrivateBrowsingSwitch() } returns privateBrowsingSwitch
every { addon.isEnabled() } returns true
every { addon.isDisabledAsBlocklisted() } returns false
every { addon.isDisabledAsNotCorrectlySigned() } returns false
every { addon.isDisabledAsIncompatible() } returns true
every { fragment.addon } returns addon
fragment.bindEnableSwitch()
verify { enableSwitch.isEnabled = false }
}
} }