For #5263 - Hide ETP Panel Settings for custom tab
parent
3fd44e8d83
commit
b83ae45c36
|
@ -88,6 +88,7 @@ class TrackingProtectionPanelDialogFragment : AppCompatDialogFragment(), BackHan
|
|||
trackingProtectionStore = StoreProvider.get(this) {
|
||||
TrackingProtectionStore(
|
||||
TrackingProtectionState(
|
||||
session,
|
||||
url,
|
||||
trackingProtectionEnabled,
|
||||
session?.trackersBlocked ?: listOf(),
|
||||
|
|
|
@ -110,6 +110,8 @@ class TrackingProtectionPanelView(
|
|||
private fun setUIForNormalMode(state: TrackingProtectionState) {
|
||||
details_mode.visibility = View.GONE
|
||||
normal_mode.visibility = View.VISIBLE
|
||||
protection_settings.visibility =
|
||||
if (state.session?.customTabConfig != null) View.GONE else View.VISIBLE
|
||||
|
||||
not_blocking_header.visibility =
|
||||
if (bucketedLoadedTrackers.size == 0) View.GONE else View.VISIBLE
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
package org.mozilla.fenix.trackingprotection
|
||||
|
||||
import mozilla.components.browser.session.Session
|
||||
import mozilla.components.concept.engine.content.blocking.Tracker
|
||||
import mozilla.components.lib.state.Action
|
||||
import mozilla.components.lib.state.State
|
||||
|
@ -56,6 +57,7 @@ sealed class TrackingProtectionAction : Action {
|
|||
* @property mode Current Mode of TrackingProtection
|
||||
*/
|
||||
data class TrackingProtectionState(
|
||||
val session: Session?,
|
||||
val url: String,
|
||||
val isTrackingProtectionEnabled: Boolean,
|
||||
val listTrackers: List<Tracker>,
|
||||
|
|
|
@ -4,13 +4,18 @@
|
|||
|
||||
package org.mozilla.fenix.trackingprotection
|
||||
|
||||
import io.mockk.mockk
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNotSame
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import mozilla.components.browser.session.Session
|
||||
import mozilla.components.concept.engine.content.blocking.Tracker
|
||||
import org.junit.Test
|
||||
|
||||
class TrackingProtectionStoreTest {
|
||||
|
||||
val session: Session = mockk(relaxed = true)
|
||||
|
||||
@Test
|
||||
fun enterDetailsMode() = runBlocking {
|
||||
val initialState = defaultState()
|
||||
|
@ -143,6 +148,7 @@ class TrackingProtectionStoreTest {
|
|||
}
|
||||
|
||||
private fun defaultState(): TrackingProtectionState = TrackingProtectionState(
|
||||
session = session,
|
||||
url = "www.mozilla.org",
|
||||
isTrackingProtectionEnabled = true,
|
||||
listTrackers = listOf(),
|
||||
|
@ -151,6 +157,7 @@ class TrackingProtectionStoreTest {
|
|||
)
|
||||
|
||||
private fun detailsState(): TrackingProtectionState = TrackingProtectionState(
|
||||
session = session,
|
||||
url = "www.mozilla.org",
|
||||
isTrackingProtectionEnabled = true,
|
||||
listTrackers = listOf(),
|
||||
|
|
Loading…
Reference in New Issue