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

[fenix] For issue https://github.com/mozilla-mobile/fenix/issues/9930 Do not assume all add-ons have a settings page

This commit is contained in:
Arturo Mejia 2020-04-14 16:55:54 -04:00
parent d96a6b206c
commit bda6aa50f3

View File

@ -99,7 +99,7 @@ class InstalledAddonDetailsFragment : Fragment() {
runIfFragmentIsAttached {
switch.isClickable = true
switch.setText(R.string.mozac_feature_addons_enabled)
view.settings.isVisible = true
view.settings.isVisible = shouldSettingsBeVisible()
view.remove_add_on.isEnabled = true
this.addon = it
showSnackBar(
@ -164,8 +164,7 @@ class InstalledAddonDetailsFragment : Fragment() {
private fun bindSettings(view: View) {
view.settings.apply {
val optionsPageUrl = addon.installedState?.optionsPageUrl
isVisible = !optionsPageUrl.isNullOrEmpty()
isVisible = shouldSettingsBeVisible()
setOnClickListener {
val settingUrl = addon.installedState?.optionsPageUrl ?: return@setOnClickListener
val directions = if (addon.installedState?.openOptionsPageInTab == true) {
@ -263,4 +262,6 @@ class InstalledAddonDetailsFragment : Fragment() {
setText(text)
isChecked = checked
}
private fun shouldSettingsBeVisible() = !addon.installedState?.optionsPageUrl.isNullOrEmpty()
}