Dan Ballard pushed to branch firefox-android-115.2.1-13.0-1 at The Tor Project / Applications / firefox-android
Commits:
- 
533daef0
by clairehurst at 2023-09-26T17:59:27+00:00
 
3 changed files:
- fenix/app/src/main/java/org/mozilla/fenix/settings/quicksettings/QuickSettingsSheetDialogFragment.kt
 - fenix/app/src/main/java/org/mozilla/fenix/settings/quicksettings/protections/ProtectionsView.kt
 - fenix/app/src/main/res/layout/quicksettings_protections_panel.xml
 
Changes:
| ... | ... | @@ -132,7 +132,8 @@ class QuickSettingsSheetDialogFragment : FenixDialogFragment() { | 
| 132 | 132 | |
| 133 | 133 |      override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
 | 
| 134 | 134 |          super.onViewCreated(view, savedInstanceState)
 | 
| 135 | -        observeTrackersChange(requireComponents.core.store)
 | 
|
| 135 | +//        Removed as part of Bug_42115: Enhanced Tracking Protection can still be enabled
 | 
|
| 136 | +//        observeTrackersChange(requireComponents.core.store)
 | 
|
| 136 | 137 |          consumeFrom(quickSettingsStore) {
 | 
| 137 | 138 |              websiteInfoView.update(it.webInfoState)
 | 
| 138 | 139 |              websitePermissionsView.update(it.websitePermissionsState)
 | 
| ... | ... | @@ -190,34 +191,36 @@ class QuickSettingsSheetDialogFragment : FenixDialogFragment() { | 
| 190 | 191 |      @VisibleForTesting
 | 
| 191 | 192 |      internal fun provideTabId(): String = args.sessionId
 | 
| 192 | 193 | |
| 193 | -    @VisibleForTesting
 | 
|
| 194 | -    internal fun observeTrackersChange(store: BrowserStore) {
 | 
|
| 195 | -        consumeFlow(store) { flow ->
 | 
|
| 196 | -            flow.mapNotNull { state ->
 | 
|
| 197 | -                state.findTabOrCustomTab(provideTabId())
 | 
|
| 198 | -            }.ifAnyChanged { tab ->
 | 
|
| 199 | -                arrayOf(
 | 
|
| 200 | -                    tab.trackingProtection.blockedTrackers,
 | 
|
| 201 | -                    tab.trackingProtection.loadedTrackers,
 | 
|
| 202 | -                )
 | 
|
| 203 | -            }.collect {
 | 
|
| 204 | -                updateTrackers(it)
 | 
|
| 205 | -            }
 | 
|
| 206 | -        }
 | 
|
| 207 | -    }
 | 
|
| 208 | -  | 
|
| 209 | -    @VisibleForTesting
 | 
|
| 210 | -    internal fun updateTrackers(tab: SessionState) {
 | 
|
| 211 | -        provideTrackingProtectionUseCases().fetchTrackingLogs(
 | 
|
| 212 | -            tab.id,
 | 
|
| 213 | -            onSuccess = { trackers ->
 | 
|
| 214 | -                protectionsView.updateDetailsSection(trackers.isNotEmpty())
 | 
|
| 215 | -            },
 | 
|
| 216 | -            onError = {
 | 
|
| 217 | -                Logger.error("QuickSettingsSheetDialogFragment - fetchTrackingLogs onError", it)
 | 
|
| 218 | -            },
 | 
|
| 219 | -        )
 | 
|
| 220 | -    }
 | 
|
| 194 | +//        Removed as part of Bug_42115: Enhanced Tracking Protection can still be enabled
 | 
|
| 195 | +//    @VisibleForTesting
 | 
|
| 196 | +//    internal fun observeTrackersChange(store: BrowserStore) {
 | 
|
| 197 | +//        consumeFlow(store) { flow ->
 | 
|
| 198 | +//            flow.mapNotNull { state ->
 | 
|
| 199 | +//                state.findTabOrCustomTab(provideTabId())
 | 
|
| 200 | +//            }.ifAnyChanged { tab ->
 | 
|
| 201 | +//                arrayOf(
 | 
|
| 202 | +//                    tab.trackingProtection.blockedTrackers,
 | 
|
| 203 | +//                    tab.trackingProtection.loadedTrackers,
 | 
|
| 204 | +//                )
 | 
|
| 205 | +//            }.collect {
 | 
|
| 206 | +//                updateTrackers(it)
 | 
|
| 207 | +//            }
 | 
|
| 208 | +//        }
 | 
|
| 209 | +//    }
 | 
|
| 210 | +  | 
|
| 211 | +//        Removed as part of Bug_42115: Enhanced Tracking Protection can still be enabled
 | 
|
| 212 | +//    @VisibleForTesting
 | 
|
| 213 | +//    internal fun updateTrackers(tab: SessionState) {
 | 
|
| 214 | +//        provideTrackingProtectionUseCases().fetchTrackingLogs(
 | 
|
| 215 | +//            tab.id,
 | 
|
| 216 | +//            onSuccess = { trackers ->
 | 
|
| 217 | +//                protectionsView.updateDetailsSection(trackers.isNotEmpty())
 | 
|
| 218 | +//            },
 | 
|
| 219 | +//            onError = {
 | 
|
| 220 | +//                Logger.error("QuickSettingsSheetDialogFragment - fetchTrackingLogs onError", it)
 | 
|
| 221 | +//            },
 | 
|
| 222 | +//        )
 | 
|
| 223 | +//    }
 | 
|
| 221 | 224 | |
| 222 | 225 |      @VisibleForTesting
 | 
| 223 | 226 |      internal fun provideTrackingProtectionUseCases() = requireComponents.useCases.trackingProtectionUseCases
 | 
| ... | ... | @@ -54,28 +54,32 @@ class ProtectionsView( | 
| 54 | 54 |       * Allows changing what this View displays.
 | 
| 55 | 55 |       */
 | 
| 56 | 56 |      fun update(state: ProtectionsState) {
 | 
| 57 | -        bindTrackingProtectionInfo(state.isTrackingProtectionEnabled)
 | 
|
| 57 | +//        Removed as part of Bug_42115: Enhanced Tracking Protection can still be enabled
 | 
|
| 58 | +//        bindTrackingProtectionInfo(state.isTrackingProtectionEnabled)
 | 
|
| 58 | 59 |          bindCookieBannerProtection(state.cookieBannerUIMode)
 | 
| 59 | -        binding.trackingProtectionSwitch.isVisible = settings.shouldUseTrackingProtection
 | 
|
| 60 | +//        Removed as part of Bug_42115: Enhanced Tracking Protection can still be enabled
 | 
|
| 61 | +//        binding.trackingProtectionSwitch.isVisible = settings.shouldUseTrackingProtection
 | 
|
| 60 | 62 |          binding.cookieBannerItem.isVisible = shouldShowCookieBanner &&
 | 
| 61 | 63 |              state.cookieBannerUIMode != CookieBannerUIMode.HIDE
 | 
| 62 | -  | 
|
| 63 | -        binding.trackingProtectionDetails.setOnClickListener {
 | 
|
| 64 | -            interactor.onTrackingProtectionDetailsClicked()
 | 
|
| 65 | -        }
 | 
|
| 64 | +//        Removed as part of Bug_42115: Enhanced Tracking Protection can still be enabled
 | 
|
| 65 | +//        binding.trackingProtectionDetails.setOnClickListener {
 | 
|
| 66 | +//            interactor.onTrackingProtectionDetailsClicked()
 | 
|
| 67 | +//        }
 | 
|
| 66 | 68 |      }
 | 
| 67 | 69 | |
| 68 | -    @VisibleForTesting
 | 
|
| 69 | -    internal fun updateDetailsSection(show: Boolean) {
 | 
|
| 70 | -        binding.trackingProtectionDetails.isVisible = show
 | 
|
| 71 | -    }
 | 
|
| 72 | -  | 
|
| 73 | -    private fun bindTrackingProtectionInfo(isTrackingProtectionEnabled: Boolean) {
 | 
|
| 74 | -        binding.trackingProtectionSwitch.isChecked = isTrackingProtectionEnabled
 | 
|
| 75 | -        binding.trackingProtectionSwitch.setOnCheckedChangeListener { _, isChecked ->
 | 
|
| 76 | -            interactor.onTrackingProtectionToggled(isChecked)
 | 
|
| 77 | -        }
 | 
|
| 78 | -    }
 | 
|
| 70 | +//        Removed as part of Bug_42115: Enhanced Tracking Protection can still be enabled
 | 
|
| 71 | +//    @VisibleForTesting
 | 
|
| 72 | +//    internal fun updateDetailsSection(show: Boolean) {
 | 
|
| 73 | +//        binding.trackingProtectionDetails.isVisible = show
 | 
|
| 74 | +//    }
 | 
|
| 75 | +  | 
|
| 76 | +//        Removed as part of Bug_42115: Enhanced Tracking Protection can still be enabled
 | 
|
| 77 | +//    private fun bindTrackingProtectionInfo(isTrackingProtectionEnabled: Boolean) {
 | 
|
| 78 | +//        binding.trackingProtectionSwitch.isChecked = isTrackingProtectionEnabled
 | 
|
| 79 | +//        binding.trackingProtectionSwitch.setOnCheckedChangeListener { _, isChecked ->
 | 
|
| 80 | +//            interactor.onTrackingProtectionToggled(isChecked)
 | 
|
| 81 | +//        }
 | 
|
| 82 | +//    }
 | 
|
| 79 | 83 | |
| 80 | 84 |      @VisibleForTesting
 | 
| 81 | 85 |      internal val binding = QuicksettingsProtectionsPanelBinding.inflate(
 | 
| ... | ... | @@ -12,36 +12,38 @@ | 
| 12 | 12 |          android:layout_width="match_parent"
 | 
| 13 | 13 |          android:layout_height="wrap_content"
 | 
| 14 | 14 |          android:minHeight="@dimen/tracking_protection_item_height"
 | 
| 15 | -        app:layout_constraintBottom_toTopOf="@id/trackingProtectionSwitch"
 | 
|
| 15 | +        app:layout_constraintBottom_toBottomOf="parent"
 | 
|
| 16 | 16 |          app:layout_constraintTop_toTopOf="parent" />
 | 
| 17 | 17 | |
| 18 | -    <org.mozilla.fenix.trackingprotection.SwitchWithDescription
 | 
|
| 19 | -        android:id="@+id/trackingProtectionSwitch"
 | 
|
| 20 | -        android:layout_width="match_parent"
 | 
|
| 21 | -        android:layout_height="wrap_content"
 | 
|
| 22 | -        android:layout_marginTop="16dp"
 | 
|
| 23 | -        android:minHeight="@dimen/tracking_protection_item_height"
 | 
|
| 24 | -        android:text="@string/preference_enhanced_tracking_protection"
 | 
|
| 25 | -        app:layout_constraintBottom_toTopOf="@id/trackingProtectionDetails"
 | 
|
| 26 | -        app:layout_constraintTop_toBottomOf="@id/cookieBannerItem"
 | 
|
| 27 | -        app:switchDescriptionOff="@string/etp_panel_off"
 | 
|
| 28 | -        app:switchDescriptionOn="@string/etp_panel_on"
 | 
|
| 29 | -        app:switchIconOff="@drawable/ic_tracking_protection_disabled"
 | 
|
| 30 | -        app:switchIconOn="@drawable/ic_tracking_protection_enabled"
 | 
|
| 31 | -        app:switchTitle="@string/preference_enhanced_tracking_protection" />
 | 
|
| 18 | +<!-- Removed as part of Bug_42115: Enhanced Tracking Protection can still be enabled-->
 | 
|
| 19 | +<!--    <org.mozilla.fenix.trackingprotection.SwitchWithDescription-->
 | 
|
| 20 | +<!--        android:id="@+id/trackingProtectionSwitch"-->
 | 
|
| 21 | +<!--        android:layout_width="match_parent"-->
 | 
|
| 22 | +<!--        android:layout_height="wrap_content"-->
 | 
|
| 23 | +<!--        android:layout_marginTop="16dp"-->
 | 
|
| 24 | +<!--        android:minHeight="@dimen/tracking_protection_item_height"-->
 | 
|
| 25 | +<!--        android:text="@string/preference_enhanced_tracking_protection"-->
 | 
|
| 26 | +<!--        app:layout_constraintBottom_toTopOf="@id/trackingProtectionDetails"-->
 | 
|
| 27 | +<!--        app:layout_constraintTop_toBottomOf="@id/cookieBannerItem"-->
 | 
|
| 28 | +<!--        app:switchDescriptionOff="@string/etp_panel_off"-->
 | 
|
| 29 | +<!--        app:switchDescriptionOn="@string/etp_panel_on"-->
 | 
|
| 30 | +<!--        app:switchIconOff="@drawable/ic_tracking_protection_disabled"-->
 | 
|
| 31 | +<!--        app:switchIconOn="@drawable/ic_tracking_protection_enabled"-->
 | 
|
| 32 | +<!--        app:switchTitle="@string/preference_enhanced_tracking_protection" />-->
 | 
|
| 32 | 33 | |
| 33 | -    <TextView
 | 
|
| 34 | -        android:id="@+id/trackingProtectionDetails"
 | 
|
| 35 | -        style="@style/QuickSettingsText.Icon"
 | 
|
| 36 | -        android:layout_width="0dp"
 | 
|
| 37 | -        android:layout_height="@dimen/quicksettings_item_height"
 | 
|
| 38 | -        android:layout_alignParentEnd="true"
 | 
|
| 39 | -        android:gravity="end|center_vertical"
 | 
|
| 40 | -        android:text="@string/enhanced_tracking_protection_details"
 | 
|
| 41 | -        android:visibility="gone"
 | 
|
| 42 | -        app:drawableEndCompat="@drawable/ic_arrowhead_right"
 | 
|
| 43 | -        app:layout_constraintBottom_toBottomOf="parent"
 | 
|
| 44 | -        app:layout_constraintEnd_toEndOf="parent"
 | 
|
| 45 | -        app:layout_constraintStart_toStartOf="parent" />
 | 
|
| 34 | +    <!-- Removed as part of Bug_42115: Enhanced Tracking Protection can still be enabled-->
 | 
|
| 35 | +<!--    <TextView-->
 | 
|
| 36 | +<!--        android:id="@+id/trackingProtectionDetails"-->
 | 
|
| 37 | +<!--        style="@style/QuickSettingsText.Icon"-->
 | 
|
| 38 | +<!--        android:layout_width="0dp"-->
 | 
|
| 39 | +<!--        android:layout_height="@dimen/quicksettings_item_height"-->
 | 
|
| 40 | +<!--        android:layout_alignParentEnd="true"-->
 | 
|
| 41 | +<!--        android:gravity="end|center_vertical"-->
 | 
|
| 42 | +<!--        android:text="@string/enhanced_tracking_protection_details"-->
 | 
|
| 43 | +<!--        android:visibility="gone"-->
 | 
|
| 44 | +<!--        app:drawableEndCompat="@drawable/ic_arrowhead_right"-->
 | 
|
| 45 | +<!--        app:layout_constraintBottom_toBottomOf="parent"-->
 | 
|
| 46 | +<!--        app:layout_constraintEnd_toEndOf="parent"-->
 | 
|
| 47 | +<!--        app:layout_constraintStart_toStartOf="parent" />-->
 | 
|
| 46 | 48 | |
| 47 | 49 |  </androidx.constraintlayout.widget.ConstraintLayout> |