diff --git a/app/src/main/java/org/mozilla/fenix/addons/InstalledAddonDetailsFragment.kt b/app/src/main/java/org/mozilla/fenix/addons/InstalledAddonDetailsFragment.kt
index 73294ec9cf..df5a40e80c 100644
--- a/app/src/main/java/org/mozilla/fenix/addons/InstalledAddonDetailsFragment.kt
+++ b/app/src/main/java/org/mozilla/fenix/addons/InstalledAddonDetailsFragment.kt
@@ -81,6 +81,7 @@ class InstalledAddonDetailsFragment : Fragment() {
bindSettings(view)
bindDetails(view)
bindPermissions(view)
+ bindAllowInPrivateBrowsingSwitch(view)
bindRemoveButton(view)
}
@@ -211,6 +212,32 @@ class InstalledAddonDetailsFragment : Fragment() {
}
}
+ private fun bindAllowInPrivateBrowsingSwitch(view: View) {
+ val switch = view.allow_in_private_browsing_switch
+ switch.isChecked = addon.isAllowedInPrivateBrowsing()
+ switch.setOnCheckedChangeListener { v, isChecked ->
+ val addonManager = v.context.components.addonManager
+ switch.isClickable = false
+ view.remove_add_on.isEnabled = false
+ addonManager.setAddonAllowedInPrivateBrowsing(
+ addon,
+ isChecked,
+ onSuccess = {
+ runIfFragmentIsAttached {
+ this.addon = it
+ switch.isClickable = true
+ view.remove_add_on.isEnabled = true
+ }
+ },
+ onError = {
+ runIfFragmentIsAttached {
+ switch.isClickable = true
+ view.remove_add_on.isEnabled = true
+ }
+ }
+ )
+ }
+ }
private fun bindRemoveButton(view: View) {
view.remove_add_on.setOnClickListener {
setAllInteractiveViewsClickable(view, false)
diff --git a/app/src/main/res/layout/fragment_installed_add_on_details.xml b/app/src/main/res/layout/fragment_installed_add_on_details.xml
index feb38dfd82..813bcd5960 100644
--- a/app/src/main/res/layout/fragment_installed_add_on_details.xml
+++ b/app/src/main/res/layout/fragment_installed_add_on_details.xml
@@ -32,11 +32,29 @@
android:textColor="?primaryText"
android:textSize="16sp" />
+
+