Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Hide ETP button in PB and force tracking protection for Private Sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo committed Apr 2, 2020
1 parent de88941 commit b04c1c8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ public void recreateSession() {
mState = mState.recreate();

TrackingProtectionPolicy policy = TrackingProtectionStore.getTrackingProtectionPolicy(mContext);
mState.mSettings.setTrackingProtectionEnabled(policy.shouldBlockContent());
mState.mSettings.setTrackingProtectionEnabled(mState.mSettings.isPrivateBrowsingEnabled() || policy.shouldBlockContent());

restore();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,13 @@ public Builder() {

public Builder withPrivateBrowsing(boolean enabled) {
isPrivateBrowsingEnabled = enabled;
isTrackingProtectionEnabled = isPrivateBrowsingEnabled || isTrackingProtectionEnabled;

return this;
}

public Builder withTrackingProtection(boolean isTrackingProtectionEnabled){
this.isTrackingProtectionEnabled = isTrackingProtectionEnabled;
this.isTrackingProtectionEnabled = isPrivateBrowsingEnabled || isTrackingProtectionEnabled;
return this;
}

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/navigation_url.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
android:src="@{viewmodel.isTrackingEnabled ? @drawable/ic_icon_tracking_enabled : @drawable/ic_icon_tracking_disabled}"
app:privateMode="@{viewmodel.isPrivateSession}"
android:tint="@color/fog"
app:visibleGone="@{settingsViewmodel.isTrackingProtectionEnabled && !UrlUtils.isContentFeed(context, viewmodel.url.toString())}"
app:visibleGone="@{!viewmodel.isPrivateSession && settingsViewmodel.isTrackingProtectionEnabled && !UrlUtils.isContentFeed(context, viewmodel.url.toString())}"
android:tooltipText="@{viewmodel.isTrackingEnabled ? @string/tracking_allowed_tooltip : @string/tracking_disabled_tooltip}" />

<LinearLayout
Expand Down Expand Up @@ -124,7 +124,7 @@
android:layout_width="15dp"
android:layout_height="match_parent"
android:layout_toEndOf="@id/startButtonsLayout"
app:visibleGone="@{(!settingsViewmodel.isTrackingProtectionEnabled &amp;&amp; !viewmodel.isPopUpAvailable &amp;&amp; !viewmodel.isWebXRUsed) || viewmodel.isLibraryVisible || UrlUtils.isHomeUri(context, viewmodel.url.toString())}"/>
app:visibleGone="@{((!settingsViewmodel.isTrackingProtectionEnabled || viewmodel.isPrivateSession) &amp;&amp; !viewmodel.isPopUpAvailable &amp;&amp; !viewmodel.isWebXRUsed) || viewmodel.isLibraryVisible || UrlUtils.isHomeUri(context, viewmodel.url.toString())}"/>

<LinearLayout
android:id="@+id/icons"
Expand Down

0 comments on commit b04c1c8

Please sign in to comment.