mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-03 23:15:31 +00:00
Bug 1847266 - Implement status message for incompatible add-ons in the manager
This commit is contained in:
parent
4b3afea56d
commit
92a1a0d3fe
@ -132,7 +132,11 @@ class InstalledAddonDetailsFragment : Fragment() {
|
||||
switch.setState(addon.isEnabled())
|
||||
// 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.
|
||||
if (addon.isDisabledAsBlocklisted() || addon.isDisabledAsNotCorrectlySigned()) {
|
||||
if (
|
||||
addon.isDisabledAsBlocklisted() ||
|
||||
addon.isDisabledAsNotCorrectlySigned() ||
|
||||
addon.isDisabledAsIncompatible()
|
||||
) {
|
||||
switch.isEnabled = false
|
||||
return
|
||||
}
|
||||
@ -321,6 +325,7 @@ class InstalledAddonDetailsFragment : Fragment() {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun bindRemoveButton() {
|
||||
binding.removeAddOn.setOnClickListener {
|
||||
setAllInteractiveViewsClickable(binding, false)
|
||||
|
@ -91,6 +91,7 @@ class InstalledAddonDetailsFragmentTest {
|
||||
every { fragment.providePrivateBrowsingSwitch() } returns privateBrowsingSwitch
|
||||
every { addon.isDisabledAsBlocklisted() } returns false
|
||||
every { addon.isDisabledAsNotCorrectlySigned() } returns false
|
||||
every { addon.isDisabledAsIncompatible() } returns false
|
||||
every { addon.isEnabled() } returns true
|
||||
every { fragment.addon } returns addon
|
||||
|
||||
@ -116,4 +117,23 @@ class InstalledAddonDetailsFragmentTest {
|
||||
|
||||
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 }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user