From 3020c826edc4abc767fc24e71c198054a677c3bc Mon Sep 17 00:00:00 2001 From: FineFindus Date: Fri, 19 Jul 2024 18:48:32 +0200 Subject: [PATCH] feat(Settings): allow disabling removing tracking params --- .../fragments/settings/SettingsPrivacyFragment.java | 6 ++++-- .../java/org/joinmastodon/android/utils/Tracking.java | 5 ----- .../drawable/ic_fluent_eye_tracking_off_24_filled.xml | 9 +++++++++ mastodon/src/main/res/values/strings_mo.xml | 2 ++ 4 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 mastodon/src/main/res/drawable/ic_fluent_eye_tracking_off_24_filled.xml diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/settings/SettingsPrivacyFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/settings/SettingsPrivacyFragment.java index e4e097057..fab0e373c 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/settings/SettingsPrivacyFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/settings/SettingsPrivacyFragment.java @@ -25,7 +25,7 @@ public class SettingsPrivacyFragment extends BaseSettingsFragment{ private Instance instance; //MOSHIDON - private CheckableListItem unlistedRepliesItem; + private CheckableListItem unlistedRepliesItem, removeTrackingParams; @Override @@ -38,7 +38,8 @@ public class SettingsPrivacyFragment extends BaseSettingsFragment{ privacy=self.source.privacy; onDataLoaded(List.of( privacyItem=new ListItem<>(R.string.sk_settings_default_visibility, getPrivacyString(privacy), R.drawable.ic_fluent_eye_24_regular, this::onPrivacyClick, 0, false), - unlistedRepliesItem=new CheckableListItem<>(R.string.mo_change_default_reply_visibility_to_unlisted, R.string.mo_setting_default_reply_privacy_summary, CheckableListItem.Style.SWITCH, GlobalUserPreferences.defaultToUnlistedReplies, R.drawable.ic_fluent_lock_open_24_regular, i->toggleCheckableItem(unlistedRepliesItem), true), + unlistedRepliesItem=new CheckableListItem<>(R.string.mo_change_default_reply_visibility_to_unlisted, R.string.mo_setting_default_reply_privacy_summary, CheckableListItem.Style.SWITCH, GlobalUserPreferences.defaultToUnlistedReplies, R.drawable.ic_fluent_lock_open_24_regular, i->toggleCheckableItem(unlistedRepliesItem)), + removeTrackingParams=new CheckableListItem<>(R.string.mo_settings_remove_tracking_params, R.string.mo_settings_remove_tracking_params_summary, CheckableListItem.Style.SWITCH, GlobalUserPreferences.removeTrackingParams, R.drawable.ic_fluent_eye_tracking_off_24_filled, i->toggleCheckableItem(removeTrackingParams), true), lockedItem=new CheckableListItem<>(R.string.sk_settings_lock_account, 0, CheckableListItem.Style.SWITCH, self.locked, R.drawable.ic_fluent_person_available_24_regular, i->toggleCheckableItem(lockedItem)) )); @@ -89,6 +90,7 @@ public class SettingsPrivacyFragment extends BaseSettingsFragment{ public void onPause(){ super.onPause(); GlobalUserPreferences.defaultToUnlistedReplies=unlistedRepliesItem.checked; + GlobalUserPreferences.removeTrackingParams=removeTrackingParams.checked; GlobalUserPreferences.save(); AccountSession s=AccountSessionManager.get(accountID); Account self=s.self; diff --git a/mastodon/src/main/java/org/joinmastodon/android/utils/Tracking.java b/mastodon/src/main/java/org/joinmastodon/android/utils/Tracking.java index 9d01d0f45..354aba967 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/utils/Tracking.java +++ b/mastodon/src/main/java/org/joinmastodon/android/utils/Tracking.java @@ -1,12 +1,9 @@ package org.joinmastodon.android.utils; import android.net.Uri; -import android.util.Log; -import android.util.Patterns; import androidx.annotation.NonNull; import java.util.Arrays; -import java.util.regex.Matcher; // Inspired by https://github.com/GeopJr/Tuba/blob/91a036edff9ab1ffb38d5b54a33023e5db551051/src/Utils/Tracking.vala @@ -72,8 +69,6 @@ public class Tracking{ for (String paramValue : uri.getQueryParameters(paramName)) { uriBuilder.appendQueryParameter(paramName, paramValue); } - } else { - Log.e("Tacking", "removeTrackingParameters: removing: " + paramName); } } diff --git a/mastodon/src/main/res/drawable/ic_fluent_eye_tracking_off_24_filled.xml b/mastodon/src/main/res/drawable/ic_fluent_eye_tracking_off_24_filled.xml new file mode 100644 index 000000000..06e3a0b90 --- /dev/null +++ b/mastodon/src/main/res/drawable/ic_fluent_eye_tracking_off_24_filled.xml @@ -0,0 +1,9 @@ + + + diff --git a/mastodon/src/main/res/values/strings_mo.xml b/mastodon/src/main/res/values/strings_mo.xml index 3276df793..4131bf125 100644 --- a/mastodon/src/main/res/values/strings_mo.xml +++ b/mastodon/src/main/res/values/strings_mo.xml @@ -97,6 +97,7 @@ Vibrate when interacting with posts Bookmark or reblog posts from the notification Posts will be hidden in all timelines, but can be revealed in threads and notifications + Strip tracking information from links Notification Audience @@ -117,6 +118,7 @@ No UnifiedPush Distributors installed. You will not receive any notifications. UnifiedPush is not enabled. You will not receive any notifications. Enable + Private Links Muted accounts