2019-09-10 22:29:21 +02:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
package org.mozilla.fenix.trackingprotection
|
|
|
|
|
|
|
|
import android.os.Bundle
|
|
|
|
import android.view.View
|
2019-10-06 19:57:41 +02:00
|
|
|
import androidx.core.view.isVisible
|
2019-09-10 22:29:21 +02:00
|
|
|
import androidx.fragment.app.Fragment
|
2019-10-06 19:57:41 +02:00
|
|
|
import androidx.navigation.fragment.navArgs
|
2019-09-10 22:29:21 +02:00
|
|
|
import kotlinx.android.synthetic.main.fragment_tracking_protection_blocking.*
|
|
|
|
import org.mozilla.fenix.R
|
2020-02-04 10:39:01 +01:00
|
|
|
import org.mozilla.fenix.ext.settings
|
2019-11-25 21:36:47 +01:00
|
|
|
import org.mozilla.fenix.ext.showToolbar
|
2019-09-10 22:29:21 +02:00
|
|
|
|
2019-10-21 18:58:47 +02:00
|
|
|
class TrackingProtectionBlockingFragment :
|
|
|
|
Fragment(R.layout.fragment_tracking_protection_blocking) {
|
2019-09-10 22:29:21 +02:00
|
|
|
|
2019-10-06 19:57:41 +02:00
|
|
|
private val args: TrackingProtectionBlockingFragmentArgs by navArgs()
|
2020-06-01 17:55:43 +02:00
|
|
|
private val settings by lazy { requireContext().settings() }
|
2019-09-10 22:29:21 +02:00
|
|
|
|
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
|
|
super.onViewCreated(view, savedInstanceState)
|
2020-02-04 10:39:01 +01:00
|
|
|
|
|
|
|
when (args.protectionMode) {
|
2020-06-01 17:55:43 +02:00
|
|
|
TrackingProtectionMode.STANDARD -> {
|
2020-02-25 18:18:27 +01:00
|
|
|
category_tracking_content.isVisible = false
|
2020-02-04 10:39:01 +01:00
|
|
|
}
|
|
|
|
|
2020-06-01 17:55:43 +02:00
|
|
|
TrackingProtectionMode.STRICT -> {}
|
2020-02-25 18:18:27 +01:00
|
|
|
|
2020-06-01 17:55:43 +02:00
|
|
|
TrackingProtectionMode.CUSTOM -> {
|
2020-02-04 10:39:01 +01:00
|
|
|
category_fingerprinters.isVisible =
|
2020-06-01 17:55:43 +02:00
|
|
|
settings.blockFingerprintersInCustomTrackingProtection
|
2020-02-04 10:39:01 +01:00
|
|
|
category_cryptominers.isVisible =
|
2020-06-01 17:55:43 +02:00
|
|
|
settings.blockCryptominersInCustomTrackingProtection
|
2020-02-04 10:39:01 +01:00
|
|
|
category_cookies.isVisible =
|
2020-06-01 17:55:43 +02:00
|
|
|
settings.blockCookiesInCustomTrackingProtection
|
2020-02-25 18:18:27 +01:00
|
|
|
category_tracking_content.isVisible =
|
2020-06-01 17:55:43 +02:00
|
|
|
settings.blockTrackingContentInCustomTrackingProtection
|
2020-02-04 10:39:01 +01:00
|
|
|
}
|
|
|
|
}
|
2019-09-10 22:29:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
override fun onResume() {
|
|
|
|
super.onResume()
|
2020-06-01 17:55:43 +02:00
|
|
|
showToolbar(getString(args.protectionMode.titleRes))
|
2019-10-21 18:58:47 +02:00
|
|
|
}
|
2019-09-10 22:29:21 +02:00
|
|
|
}
|