From 6d518dcf4d016b15ce87831d517bd64a6c29c579 Mon Sep 17 00:00:00 2001 From: crimera <44558091+crimera@users.noreply.github.com> Date: Mon, 18 Mar 2024 08:54:57 +0800 Subject: [PATCH 01/14] feat(Twitter): Add Settings for `Hide Recommended Users` patch --- .../java/app/revanced/integrations/twitter/Pref.java | 8 ++++++-- .../integrations/twitter/settings/Settings.java | 1 + .../twitter/settings/SettingsActivity.java | 11 ++++++++++- .../integrations/twitter/settings/SettingsStatus.java | 4 ++++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/twitter/Pref.java b/app/src/main/java/app/revanced/integrations/twitter/Pref.java index 6ac5066274..9bc30fd542 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/Pref.java +++ b/app/src/main/java/app/revanced/integrations/twitter/Pref.java @@ -1,9 +1,8 @@ package app.revanced.integrations.twitter; -import app.revanced.integrations.twitter.Utils; import app.revanced.integrations.twitter.settings.Settings; + import java.util.ArrayList; -import java.util.Arrays; public class Pref { @@ -15,6 +14,11 @@ public static String getVideoFolder(String filename) { return Utils.getStringPref(Settings.VID_SUBFOLDER)+"/"+filename; } + public static ArrayList hideRecommendedUsers(ArrayList users) { + if (Utils.getBooleanPerf(Settings.MISC_HIDE_RECOMMENDED_USERS)) { return null; } + return users; + } + public static ArrayList liveThread(ArrayList fleets) { if (Utils.getBooleanPerf(Settings.TIMELINE_HIDE_LIVETHREADS)) { return null; } return fleets; diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java b/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java index a92ba63fcf..28830a4257 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java @@ -9,6 +9,7 @@ public class Settings extends BaseSettings { public static final StringSetting VID_SUBFOLDER = new StringSetting("vid_subfolder", "Twitter"); public static final BooleanSetting MISC_FONT = new BooleanSetting("misc_font", false); + public static final BooleanSetting MISC_HIDE_RECOMMENDED_USERS = new BooleanSetting("misc_hide_recommended_users", false); public static final BooleanSetting TIMELINE_HIDE_LIVETHREADS = new BooleanSetting("timeline_hide_livethreads", true); public static final BooleanSetting TIMELINE_HIDE_BANNER = new BooleanSetting("timeline_hide_banner", true); diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java index c8fcfc9fe7..304868e60d 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java @@ -53,7 +53,7 @@ public void onCreate(@Nullable Bundle savedInstanceState) { )); } - if (SettingsStatus.enableFontMod) { + if (SettingsStatus.enableMiscSection()) { LegacyTwitterPreferenceCategory miscPrefs = preferenceCategory("Misc", screen); if (SettingsStatus.enableFontMod) { miscPrefs.addPreference( @@ -64,6 +64,15 @@ public void onCreate(@Nullable Bundle savedInstanceState) { ) ); } + if (SettingsStatus.hideRecommendedUsers) { + miscPrefs.addPreference( + switchPreference( + "Hide Recommended Users", + "", + Settings.MISC_HIDE_RECOMMENDED_USERS + ) + ); + } } if (SettingsStatus.enableTimelineSection()) { diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java index a1d01b95a2..542d27e37d 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java @@ -3,6 +3,7 @@ public class SettingsStatus { public static boolean changeDownloadEnabled = false; public static boolean enableFontMod = false; + public static boolean hideRecommendedUsers = false; public static boolean hideLiveThreads = false; public static boolean hideBanner = false; public static boolean hideForyou = false; @@ -11,10 +12,13 @@ public class SettingsStatus { public static void enableDownloadFolder() { changeDownloadEnabled = true; } public static void enableFont() { enableFontMod = true; } + public static void hideRecommendedUsers() { hideRecommendedUsers = true; } + public static void hideLiveThreads() { hideLiveThreads = true; } public static void hideBanner() { hideBanner = true; } public static void hideForYou() { hideForyou = true; } public static boolean enableTimelineSection(){return (hideLiveThreads || hideBanner ||hideForyou);} + public static boolean enableMiscSection() {return (enableFontMod || hideRecommendedUsers); } public static void load() {} } From 0653731be724ac21d21db712207c5ec31f65decc Mon Sep 17 00:00:00 2001 From: crimera <44558091+crimera@users.noreply.github.com> Date: Mon, 18 Mar 2024 09:00:29 +0800 Subject: [PATCH 02/14] feat(fix): Enable `Hide Recommended Users` by default --- .../app/revanced/integrations/twitter/settings/Settings.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java b/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java index 28830a4257..d100879522 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java @@ -9,7 +9,7 @@ public class Settings extends BaseSettings { public static final StringSetting VID_SUBFOLDER = new StringSetting("vid_subfolder", "Twitter"); public static final BooleanSetting MISC_FONT = new BooleanSetting("misc_font", false); - public static final BooleanSetting MISC_HIDE_RECOMMENDED_USERS = new BooleanSetting("misc_hide_recommended_users", false); + public static final BooleanSetting MISC_HIDE_RECOMMENDED_USERS = new BooleanSetting("misc_hide_recommended_users", true); public static final BooleanSetting TIMELINE_HIDE_LIVETHREADS = new BooleanSetting("timeline_hide_livethreads", true); public static final BooleanSetting TIMELINE_HIDE_BANNER = new BooleanSetting("timeline_hide_banner", true); From a2168fbb7278a896b6de6b9afeb8d228d1e88dcb Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 18 Mar 2024 01:04:24 +0000 Subject: [PATCH 03/14] chore(release): 1.6.0-dev.1 [skip ci] # [1.6.0-dev.1](https://github.com/crimera/revanced-integrations/compare/v1.5.0...v1.6.0-dev.1) (2024-03-18) ### Features * **fix:** Enable `Hide Recommended Users` by default ([0653731](https://github.com/crimera/revanced-integrations/commit/0653731be724ac21d21db712207c5ec31f65decc)) * **Twitter:** Add Settings for `Hide Recommended Users` patch ([6d518dc](https://github.com/crimera/revanced-integrations/commit/6d518dcf4d016b15ce87831d517bd64a6c29c579)) --- CHANGELOG.md | 8 ++++++++ gradle.properties | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0645d365b9..e1b94ed5a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# [1.6.0-dev.1](https://github.com/crimera/revanced-integrations/compare/v1.5.0...v1.6.0-dev.1) (2024-03-18) + + +### Features + +* **fix:** Enable `Hide Recommended Users` by default ([0653731](https://github.com/crimera/revanced-integrations/commit/0653731be724ac21d21db712207c5ec31f65decc)) +* **Twitter:** Add Settings for `Hide Recommended Users` patch ([6d518dc](https://github.com/crimera/revanced-integrations/commit/6d518dcf4d016b15ce87831d517bd64a6c29c579)) + # [1.5.0](https://github.com/crimera/revanced-integrations/compare/v1.4.0...v1.5.0) (2024-03-17) diff --git a/gradle.properties b/gradle.properties index a7eb985628..68503a23aa 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true android.useAndroidX = true -version = 1.5.0 +version = 1.6.0-dev.1 From dfa58ce5a79f71c5bc0e17e39c3c456584fc1e22 Mon Sep 17 00:00:00 2001 From: crimera <44558091+crimera@users.noreply.github.com> Date: Mon, 18 Mar 2024 15:45:24 +0800 Subject: [PATCH 04/14] feat(Twitter): Add settings for `Hide FAB` patch --- .../java/app/revanced/integrations/twitter/Pref.java | 3 +++ .../revanced/integrations/twitter/settings/Settings.java | 1 + .../integrations/twitter/settings/SettingsActivity.java | 9 +++++++++ .../integrations/twitter/settings/SettingsStatus.java | 4 +++- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/app/revanced/integrations/twitter/Pref.java b/app/src/main/java/app/revanced/integrations/twitter/Pref.java index 9bc30fd542..d361baf84a 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/Pref.java +++ b/app/src/main/java/app/revanced/integrations/twitter/Pref.java @@ -32,5 +32,8 @@ public static int hideForYou() { return Utils.getBooleanPerf(Settings.TIMELINE_HIDE_FORYOU)?34:17; } + public static boolean hideFAB() { + return Utils.getBooleanPerf(Settings.MISC_HIDE_FAB); + } } \ No newline at end of file diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java b/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java index d100879522..0505912dd4 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java @@ -10,6 +10,7 @@ public class Settings extends BaseSettings { public static final BooleanSetting MISC_FONT = new BooleanSetting("misc_font", false); public static final BooleanSetting MISC_HIDE_RECOMMENDED_USERS = new BooleanSetting("misc_hide_recommended_users", true); + public static final BooleanSetting MISC_HIDE_FAB = new BooleanSetting("misc_hide_fab", true); public static final BooleanSetting TIMELINE_HIDE_LIVETHREADS = new BooleanSetting("timeline_hide_livethreads", true); public static final BooleanSetting TIMELINE_HIDE_BANNER = new BooleanSetting("timeline_hide_banner", true); diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java index 304868e60d..b604f704c6 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java @@ -73,6 +73,15 @@ public void onCreate(@Nullable Bundle savedInstanceState) { ) ); } + if (SettingsStatus.hideFAB) { + miscPrefs.addPreference( + switchPreference( + "Hide floating action button", + "", + Settings.MISC_HIDE_FAB + ) + ); + } } if (SettingsStatus.enableTimelineSection()) { diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java index 542d27e37d..9b21272359 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java @@ -4,6 +4,7 @@ public class SettingsStatus { public static boolean changeDownloadEnabled = false; public static boolean enableFontMod = false; public static boolean hideRecommendedUsers = false; + public static boolean hideFAB = false; public static boolean hideLiveThreads = false; public static boolean hideBanner = false; public static boolean hideForyou = false; @@ -13,12 +14,13 @@ public class SettingsStatus { public static void enableFont() { enableFontMod = true; } public static void hideRecommendedUsers() { hideRecommendedUsers = true; } + public static void hideFAB() { hideFAB = true; } public static void hideLiveThreads() { hideLiveThreads = true; } public static void hideBanner() { hideBanner = true; } public static void hideForYou() { hideForyou = true; } public static boolean enableTimelineSection(){return (hideLiveThreads || hideBanner ||hideForyou);} - public static boolean enableMiscSection() {return (enableFontMod || hideRecommendedUsers); } + public static boolean enableMiscSection() {return (enableFontMod || hideRecommendedUsers || hideFAB); } public static void load() {} } From 6d05c55d525ce3102ed1c1a9f5d8629a5ea29ca9 Mon Sep 17 00:00:00 2001 From: crimera <44558091+crimera@users.noreply.github.com> Date: Mon, 18 Mar 2024 15:50:06 +0800 Subject: [PATCH 05/14] fix(Twitter): Use sentence case in settings --- .../twitter/settings/SettingsActivity.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java index b604f704c6..521a89f1f4 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java @@ -42,12 +42,12 @@ public void onCreate(@Nullable Bundle savedInstanceState) { if (SettingsStatus.changeDownloadEnabled) { LegacyTwitterPreferenceCategory downloadPrefs = preferenceCategory("Download", screen); downloadPrefs.addPreference(listPreference( - "Public Folder", + "Public folder", "The public folder to use for video downloads", Settings.VID_PUBLIC_FOLDER )); downloadPrefs.addPreference(editTextPreference( - "Download Subfolder", + "Download subfolder", "The subfolder to download videos to ([PublicFolder]/[Subfolder])", Settings.VID_SUBFOLDER )); @@ -58,7 +58,7 @@ public void onCreate(@Nullable Bundle savedInstanceState) { if (SettingsStatus.enableFontMod) { miscPrefs.addPreference( switchPreference( - "Enable Chirp Font", + "Enable chirp font", "", Settings.MISC_FONT ) @@ -67,7 +67,7 @@ public void onCreate(@Nullable Bundle savedInstanceState) { if (SettingsStatus.hideRecommendedUsers) { miscPrefs.addPreference( switchPreference( - "Hide Recommended Users", + "Hide recommended users", "", Settings.MISC_HIDE_RECOMMENDED_USERS ) @@ -89,7 +89,7 @@ public void onCreate(@Nullable Bundle savedInstanceState) { if (SettingsStatus.hideForyou) { timelinePrefs.addPreference( switchPreference( - "Hide For You", + "Hide for you tab", "", Settings.TIMELINE_HIDE_FORYOU ) @@ -99,7 +99,7 @@ public void onCreate(@Nullable Bundle savedInstanceState) { if (SettingsStatus.hideLiveThreads) { timelinePrefs.addPreference( switchPreference( - "Hide Live Threads", + "Hide live threads", "", Settings.TIMELINE_HIDE_LIVETHREADS ) @@ -109,7 +109,7 @@ public void onCreate(@Nullable Bundle savedInstanceState) { if (SettingsStatus.hideBanner) { timelinePrefs.addPreference( switchPreference( - "Hide Banner", + "Hide banner", "", Settings.TIMELINE_HIDE_BANNER ) From 48cbaf6b16e6dad9c633677dc21a5f9ea275cc04 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 18 Mar 2024 07:51:50 +0000 Subject: [PATCH 06/14] chore(release): 1.6.0-dev.2 [skip ci] # [1.6.0-dev.2](https://github.com/crimera/revanced-integrations/compare/v1.6.0-dev.1...v1.6.0-dev.2) (2024-03-18) ### Bug Fixes * **Twitter:** Use sentence case in settings ([6d05c55](https://github.com/crimera/revanced-integrations/commit/6d05c55d525ce3102ed1c1a9f5d8629a5ea29ca9)) ### Features * **Twitter:** Add settings for `Hide FAB` patch ([dfa58ce](https://github.com/crimera/revanced-integrations/commit/dfa58ce5a79f71c5bc0e17e39c3c456584fc1e22)) --- CHANGELOG.md | 12 ++++++++++++ gradle.properties | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1b94ed5a0..27a20ffbc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +# [1.6.0-dev.2](https://github.com/crimera/revanced-integrations/compare/v1.6.0-dev.1...v1.6.0-dev.2) (2024-03-18) + + +### Bug Fixes + +* **Twitter:** Use sentence case in settings ([6d05c55](https://github.com/crimera/revanced-integrations/commit/6d05c55d525ce3102ed1c1a9f5d8629a5ea29ca9)) + + +### Features + +* **Twitter:** Add settings for `Hide FAB` patch ([dfa58ce](https://github.com/crimera/revanced-integrations/commit/dfa58ce5a79f71c5bc0e17e39c3c456584fc1e22)) + # [1.6.0-dev.1](https://github.com/crimera/revanced-integrations/compare/v1.5.0...v1.6.0-dev.1) (2024-03-18) diff --git a/gradle.properties b/gradle.properties index 68503a23aa..0d8d3f1356 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true android.useAndroidX = true -version = 1.6.0-dev.1 +version = 1.6.0-dev.2 From b61371941cd8371da9479b7b1f392e5b9a191600 Mon Sep 17 00:00:00 2001 From: Swakshan Date: Mon, 18 Mar 2024 16:33:43 +0530 Subject: [PATCH 07/14] feat(Twitter): Added `Hide Promoted Trends` to Mod Settings --- .../revanced/integrations/twitter/Pref.java | 7 +++++ .../twitter/settings/Settings.java | 4 ++- .../twitter/settings/SettingsActivity.java | 31 +++++++++++++------ .../twitter/settings/SettingsStatus.java | 6 +++- 4 files changed, 37 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/twitter/Pref.java b/app/src/main/java/app/revanced/integrations/twitter/Pref.java index d361baf84a..81e00afc9b 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/Pref.java +++ b/app/src/main/java/app/revanced/integrations/twitter/Pref.java @@ -36,4 +36,11 @@ public static boolean hideFAB() { return Utils.getBooleanPerf(Settings.MISC_HIDE_FAB); } + public static boolean hidePromotedTrend(Object data) { + if(data!=null && Utils.getBooleanPerf(Settings.NH_HIDE_PROMOTED_TRENDS)){ + return true; + } + return false; + } + } \ No newline at end of file diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java b/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java index 0505912dd4..4f32c5fef2 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java @@ -9,9 +9,11 @@ public class Settings extends BaseSettings { public static final StringSetting VID_SUBFOLDER = new StringSetting("vid_subfolder", "Twitter"); public static final BooleanSetting MISC_FONT = new BooleanSetting("misc_font", false); - public static final BooleanSetting MISC_HIDE_RECOMMENDED_USERS = new BooleanSetting("misc_hide_recommended_users", true); public static final BooleanSetting MISC_HIDE_FAB = new BooleanSetting("misc_hide_fab", true); + public static final BooleanSetting MISC_HIDE_RECOMMENDED_USERS = new BooleanSetting("misc_hide_recommended_users", true); + public static final BooleanSetting NH_HIDE_PROMOTED_TRENDS = new BooleanSetting("nh_hide_promoted_trends", true); + public static final BooleanSetting TIMELINE_HIDE_LIVETHREADS = new BooleanSetting("timeline_hide_livethreads", true); public static final BooleanSetting TIMELINE_HIDE_BANNER = new BooleanSetting("timeline_hide_banner", true); public static final BooleanSetting TIMELINE_HIDE_FORYOU = new BooleanSetting("timeline_hide_foryou", false); diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java index 521a89f1f4..b19b555b2d 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java @@ -53,23 +53,36 @@ public void onCreate(@Nullable Bundle savedInstanceState) { )); } - if (SettingsStatus.enableMiscSection()) { - LegacyTwitterPreferenceCategory miscPrefs = preferenceCategory("Misc", screen); - if (SettingsStatus.enableFontMod) { - miscPrefs.addPreference( + if(SettingsStatus.enableNetworkHookSection()){ + LegacyTwitterPreferenceCategory nhPrefs = preferenceCategory("Network hooks", screen); + if (SettingsStatus.hideRecommendedUsers) { + nhPrefs.addPreference( switchPreference( - "Enable chirp font", + "Hide recommended users", "", - Settings.MISC_FONT + Settings.MISC_HIDE_RECOMMENDED_USERS ) ); } - if (SettingsStatus.hideRecommendedUsers) { + if (SettingsStatus.hidePromotedTrend) { + nhPrefs.addPreference( + switchPreference( + "Hide promoted trends", + "", + Settings.NH_HIDE_PROMOTED_TRENDS + ) + ); + } + } + + if (SettingsStatus.enableMiscSection()) { + LegacyTwitterPreferenceCategory miscPrefs = preferenceCategory("Misc", screen); + if (SettingsStatus.enableFontMod) { miscPrefs.addPreference( switchPreference( - "Hide recommended users", + "Enable chirp font", "", - Settings.MISC_HIDE_RECOMMENDED_USERS + Settings.MISC_FONT ) ); } diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java index 9b21272359..ad9fa5c33a 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java @@ -4,6 +4,7 @@ public class SettingsStatus { public static boolean changeDownloadEnabled = false; public static boolean enableFontMod = false; public static boolean hideRecommendedUsers = false; + public static boolean hidePromotedTrend = false; public static boolean hideFAB = false; public static boolean hideLiveThreads = false; public static boolean hideBanner = false; @@ -14,6 +15,7 @@ public class SettingsStatus { public static void enableFont() { enableFontMod = true; } public static void hideRecommendedUsers() { hideRecommendedUsers = true; } + public static void hidePromotedTrends() { hidePromotedTrend = true; } public static void hideFAB() { hideFAB = true; } public static void hideLiveThreads() { hideLiveThreads = true; } @@ -21,6 +23,8 @@ public class SettingsStatus { public static void hideForYou() { hideForyou = true; } public static boolean enableTimelineSection(){return (hideLiveThreads || hideBanner ||hideForyou);} - public static boolean enableMiscSection() {return (enableFontMod || hideRecommendedUsers || hideFAB); } + public static boolean enableMiscSection() {return (enableFontMod || hideFAB); } + + public static boolean enableNetworkHookSection() {return (hidePromotedTrend || hideRecommendedUsers); } public static void load() {} } From 340bb62cad351a59922c6182a61476b211e212e0 Mon Sep 17 00:00:00 2001 From: Swakshan Date: Mon, 18 Mar 2024 18:13:54 +0530 Subject: [PATCH 08/14] feat(Twitter): Added `Hide Community Notes` to mod settings --- .../revanced/integrations/twitter/Pref.java | 5 ++- .../twitter/settings/Settings.java | 5 ++- .../twitter/settings/SettingsActivity.java | 42 +++++++++++++------ .../twitter/settings/SettingsStatus.java | 6 ++- 4 files changed, 40 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/twitter/Pref.java b/app/src/main/java/app/revanced/integrations/twitter/Pref.java index 81e00afc9b..5e74657a0b 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/Pref.java +++ b/app/src/main/java/app/revanced/integrations/twitter/Pref.java @@ -37,10 +37,13 @@ public static boolean hideFAB() { } public static boolean hidePromotedTrend(Object data) { - if(data!=null && Utils.getBooleanPerf(Settings.NH_HIDE_PROMOTED_TRENDS)){ + if(data!=null && Utils.getBooleanPerf(Settings.ADS_HIDE_PROMOTED_TRENDS)){ return true; } return false; } + public static boolean hideCommNotes() { + return Utils.getBooleanPerf(Settings.MISC_HIDE_COMM_NOTES); + } } \ No newline at end of file diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java b/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java index 4f32c5fef2..2d1721924f 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java @@ -10,9 +10,10 @@ public class Settings extends BaseSettings { public static final BooleanSetting MISC_FONT = new BooleanSetting("misc_font", false); public static final BooleanSetting MISC_HIDE_FAB = new BooleanSetting("misc_hide_fab", true); - public static final BooleanSetting MISC_HIDE_RECOMMENDED_USERS = new BooleanSetting("misc_hide_recommended_users", true); - public static final BooleanSetting NH_HIDE_PROMOTED_TRENDS = new BooleanSetting("nh_hide_promoted_trends", true); + public static final BooleanSetting MISC_HIDE_COMM_NOTES = new BooleanSetting("misc_hide_comm_notes", false); + + public static final BooleanSetting ADS_HIDE_PROMOTED_TRENDS = new BooleanSetting("ads_hide_promoted_trends", true); public static final BooleanSetting TIMELINE_HIDE_LIVETHREADS = new BooleanSetting("timeline_hide_livethreads", true); public static final BooleanSetting TIMELINE_HIDE_BANNER = new BooleanSetting("timeline_hide_banner", true); diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java index b19b555b2d..e0776f32c0 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java @@ -53,26 +53,22 @@ public void onCreate(@Nullable Bundle savedInstanceState) { )); } - if(SettingsStatus.enableNetworkHookSection()){ - LegacyTwitterPreferenceCategory nhPrefs = preferenceCategory("Network hooks", screen); - if (SettingsStatus.hideRecommendedUsers) { - nhPrefs.addPreference( - switchPreference( - "Hide recommended users", - "", - Settings.MISC_HIDE_RECOMMENDED_USERS - ) - ); - } + if(SettingsStatus.enableAdsSection()){ + LegacyTwitterPreferenceCategory adsPrefs = preferenceCategory("Ads", screen); + + if (SettingsStatus.hidePromotedTrend) { - nhPrefs.addPreference( + adsPrefs.addPreference( switchPreference( "Hide promoted trends", "", - Settings.NH_HIDE_PROMOTED_TRENDS + Settings.ADS_HIDE_PROMOTED_TRENDS ) ); } + + + } if (SettingsStatus.enableMiscSection()) { @@ -95,6 +91,26 @@ public void onCreate(@Nullable Bundle savedInstanceState) { ) ); } + + if (SettingsStatus.hideRecommendedUsers) { + miscPrefs.addPreference( + switchPreference( + "Hide recommended users", + "", + Settings.MISC_HIDE_RECOMMENDED_USERS + ) + ); + } + + if (SettingsStatus.hideCommunityNote) { + miscPrefs.addPreference( + switchPreference( + "Hide community notes", + "", + Settings.MISC_HIDE_COMM_NOTES + ) + ); + } } if (SettingsStatus.enableTimelineSection()) { diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java index ad9fa5c33a..3e22643d81 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java @@ -5,6 +5,7 @@ public class SettingsStatus { public static boolean enableFontMod = false; public static boolean hideRecommendedUsers = false; public static boolean hidePromotedTrend = false; + public static boolean hideCommunityNote = false; public static boolean hideFAB = false; public static boolean hideLiveThreads = false; public static boolean hideBanner = false; @@ -16,6 +17,7 @@ public class SettingsStatus { public static void hideRecommendedUsers() { hideRecommendedUsers = true; } public static void hidePromotedTrends() { hidePromotedTrend = true; } + public static void hideCommunityNotes() { hideCommunityNote = true; } public static void hideFAB() { hideFAB = true; } public static void hideLiveThreads() { hideLiveThreads = true; } @@ -23,8 +25,8 @@ public class SettingsStatus { public static void hideForYou() { hideForyou = true; } public static boolean enableTimelineSection(){return (hideLiveThreads || hideBanner ||hideForyou);} - public static boolean enableMiscSection() {return (enableFontMod || hideFAB); } + public static boolean enableMiscSection() {return (enableFontMod || hideFAB || hideRecommendedUsers || hideCommunityNote); } - public static boolean enableNetworkHookSection() {return (hidePromotedTrend || hideRecommendedUsers); } + public static boolean enableAdsSection() {return (hidePromotedTrend); } public static void load() {} } From 0a1469fdea4a8c90dd2f34ee9c40f64f5386ec1b Mon Sep 17 00:00:00 2001 From: crimera <44558091+crimera@users.noreply.github.com> Date: Mon, 18 Mar 2024 22:50:48 +0800 Subject: [PATCH 09/14] feat(Twitter): Add settings for `Remove view count` patch --- .../java/app/revanced/integrations/twitter/Pref.java | 3 +++ .../integrations/twitter/settings/Settings.java | 1 + .../twitter/settings/SettingsActivity.java | 11 +++++++++-- .../integrations/twitter/settings/SettingsStatus.java | 7 ++++--- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/twitter/Pref.java b/app/src/main/java/app/revanced/integrations/twitter/Pref.java index d361baf84a..dcb130dedd 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/Pref.java +++ b/app/src/main/java/app/revanced/integrations/twitter/Pref.java @@ -36,4 +36,7 @@ public static boolean hideFAB() { return Utils.getBooleanPerf(Settings.MISC_HIDE_FAB); } + public static boolean hideViewCount() { + return !Utils.getBooleanPerf(Settings.MISC_HIDE_VIEW_COUNT); + } } \ No newline at end of file diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java b/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java index 0505912dd4..e101232e8a 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java @@ -11,6 +11,7 @@ public class Settings extends BaseSettings { public static final BooleanSetting MISC_FONT = new BooleanSetting("misc_font", false); public static final BooleanSetting MISC_HIDE_RECOMMENDED_USERS = new BooleanSetting("misc_hide_recommended_users", true); public static final BooleanSetting MISC_HIDE_FAB = new BooleanSetting("misc_hide_fab", true); + public static final BooleanSetting MISC_HIDE_VIEW_COUNT = new BooleanSetting("misc_hide_view_count", true); public static final BooleanSetting TIMELINE_HIDE_LIVETHREADS = new BooleanSetting("timeline_hide_livethreads", true); public static final BooleanSetting TIMELINE_HIDE_BANNER = new BooleanSetting("timeline_hide_banner", true); diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java index 521a89f1f4..b01ecfc53e 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java @@ -82,6 +82,15 @@ public void onCreate(@Nullable Bundle savedInstanceState) { ) ); } + if (SettingsStatus.hideViewCount) { + miscPrefs.addPreference( + switchPreference( + "Hide view count", + "", + Settings.MISC_HIDE_VIEW_COUNT + ) + ); + } } if (SettingsStatus.enableTimelineSection()) { @@ -95,7 +104,6 @@ public void onCreate(@Nullable Bundle savedInstanceState) { ) ); } - if (SettingsStatus.hideLiveThreads) { timelinePrefs.addPreference( switchPreference( @@ -105,7 +113,6 @@ public void onCreate(@Nullable Bundle savedInstanceState) { ) ); } - if (SettingsStatus.hideBanner) { timelinePrefs.addPreference( switchPreference( diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java index 9b21272359..ff6f5afe7d 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java @@ -5,6 +5,7 @@ public class SettingsStatus { public static boolean enableFontMod = false; public static boolean hideRecommendedUsers = false; public static boolean hideFAB = false; + public static boolean hideViewCount = false; public static boolean hideLiveThreads = false; public static boolean hideBanner = false; public static boolean hideForyou = false; @@ -15,12 +16,12 @@ public class SettingsStatus { public static void hideRecommendedUsers() { hideRecommendedUsers = true; } public static void hideFAB() { hideFAB = true; } - + public static void hideViewCount() { hideViewCount = true; } public static void hideLiveThreads() { hideLiveThreads = true; } public static void hideBanner() { hideBanner = true; } public static void hideForYou() { hideForyou = true; } - public static boolean enableTimelineSection(){return (hideLiveThreads || hideBanner ||hideForyou);} - public static boolean enableMiscSection() {return (enableFontMod || hideRecommendedUsers || hideFAB); } + public static boolean enableTimelineSection(){ return (hideLiveThreads || hideBanner || hideForyou); } + public static boolean enableMiscSection() { return (enableFontMod || hideRecommendedUsers || hideFAB || hideViewCount); } public static void load() {} } From cbf64f15d044a13fb03d04f6925352e17a5af41e Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 18 Mar 2024 14:52:57 +0000 Subject: [PATCH 10/14] chore(release): 1.6.0-dev.3 [skip ci] # [1.6.0-dev.3](https://github.com/crimera/revanced-integrations/compare/v1.6.0-dev.2...v1.6.0-dev.3) (2024-03-18) ### Features * **Twitter:** Add settings for `Remove view count` patch ([0a1469f](https://github.com/crimera/revanced-integrations/commit/0a1469fdea4a8c90dd2f34ee9c40f64f5386ec1b)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27a20ffbc4..8791dd273c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [1.6.0-dev.3](https://github.com/crimera/revanced-integrations/compare/v1.6.0-dev.2...v1.6.0-dev.3) (2024-03-18) + + +### Features + +* **Twitter:** Add settings for `Remove view count` patch ([0a1469f](https://github.com/crimera/revanced-integrations/commit/0a1469fdea4a8c90dd2f34ee9c40f64f5386ec1b)) + # [1.6.0-dev.2](https://github.com/crimera/revanced-integrations/compare/v1.6.0-dev.1...v1.6.0-dev.2) (2024-03-18) diff --git a/gradle.properties b/gradle.properties index 0d8d3f1356..67189a8158 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true android.useAndroidX = true -version = 1.6.0-dev.2 +version = 1.6.0-dev.3 From a51135befab8624f0fe65bbd9b9a246b28c995a5 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 18 Mar 2024 15:02:32 +0000 Subject: [PATCH 11/14] chore(release): 1.6.0-dev.4 [skip ci] # [1.6.0-dev.4](https://github.com/crimera/revanced-integrations/compare/v1.6.0-dev.3...v1.6.0-dev.4) (2024-03-18) ### Features * **Twitter:** Added `Hide Community Notes` to mod settings ([340bb62](https://github.com/crimera/revanced-integrations/commit/340bb62cad351a59922c6182a61476b211e212e0)) * **Twitter:** Added `Hide Promoted Trends` to Mod Settings ([b613719](https://github.com/crimera/revanced-integrations/commit/b61371941cd8371da9479b7b1f392e5b9a191600)) --- CHANGELOG.md | 8 ++++++++ gradle.properties | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8791dd273c..3c0513cf7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# [1.6.0-dev.4](https://github.com/crimera/revanced-integrations/compare/v1.6.0-dev.3...v1.6.0-dev.4) (2024-03-18) + + +### Features + +* **Twitter:** Added `Hide Community Notes` to mod settings ([340bb62](https://github.com/crimera/revanced-integrations/commit/340bb62cad351a59922c6182a61476b211e212e0)) +* **Twitter:** Added `Hide Promoted Trends` to Mod Settings ([b613719](https://github.com/crimera/revanced-integrations/commit/b61371941cd8371da9479b7b1f392e5b9a191600)) + # [1.6.0-dev.3](https://github.com/crimera/revanced-integrations/compare/v1.6.0-dev.2...v1.6.0-dev.3) (2024-03-18) diff --git a/gradle.properties b/gradle.properties index 67189a8158..55849e130c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true android.useAndroidX = true -version = 1.6.0-dev.3 +version = 1.6.0-dev.4 From c69611571ccb6b1e4499cfac48e4a9a93f815db4 Mon Sep 17 00:00:00 2001 From: Swakshan Date: Mon, 18 Mar 2024 22:34:23 +0530 Subject: [PATCH 12/14] Removed unused codes --- .../twitter/patches/hook/json/BaseJsonHook.kt | 9 - .../twitter/patches/hook/json/JsonHook.kt | 15 -- .../patches/hook/json/JsonHookPatch.kt | 30 --- .../twitter/patches/hook/patch/Hook.kt | 9 - .../twitter/patches/hook/patch/ads/AdsHook.kt | 15 -- .../browserchooser/BrowserChooserHook.kt | 10 - .../patches/hook/patch/dummy/DummyHook.kt | 14 -- .../recommendation/RecommendedUsersHook.kt | 15 -- .../patches/hook/twifucker/TwiFucker.kt | 232 ------------------ .../patches/hook/twifucker/TwiFuckerUtils.kt | 22 -- .../twitter/utils/json/JsonUtils.kt | 13 - .../twitter/utils/stream/StreamUtils.kt | 24 -- 12 files changed, 408 deletions(-) delete mode 100644 app/src/main/java/app/revanced/integrations/twitter/patches/hook/json/BaseJsonHook.kt delete mode 100644 app/src/main/java/app/revanced/integrations/twitter/patches/hook/json/JsonHook.kt delete mode 100644 app/src/main/java/app/revanced/integrations/twitter/patches/hook/json/JsonHookPatch.kt delete mode 100644 app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/Hook.kt delete mode 100644 app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/ads/AdsHook.kt delete mode 100644 app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/browserchooser/BrowserChooserHook.kt delete mode 100644 app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/dummy/DummyHook.kt delete mode 100644 app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/recommendation/RecommendedUsersHook.kt delete mode 100644 app/src/main/java/app/revanced/integrations/twitter/patches/hook/twifucker/TwiFucker.kt delete mode 100644 app/src/main/java/app/revanced/integrations/twitter/patches/hook/twifucker/TwiFuckerUtils.kt delete mode 100644 app/src/main/java/app/revanced/integrations/twitter/utils/json/JsonUtils.kt delete mode 100644 app/src/main/java/app/revanced/integrations/twitter/utils/stream/StreamUtils.kt diff --git a/app/src/main/java/app/revanced/integrations/twitter/patches/hook/json/BaseJsonHook.kt b/app/src/main/java/app/revanced/integrations/twitter/patches/hook/json/BaseJsonHook.kt deleted file mode 100644 index 536a43e1f9..0000000000 --- a/app/src/main/java/app/revanced/integrations/twitter/patches/hook/json/BaseJsonHook.kt +++ /dev/null @@ -1,9 +0,0 @@ -package app.revanced.integrations.twitter.patches.hook.json - -import org.json.JSONObject - -abstract class BaseJsonHook : JsonHook { - abstract fun apply(json: JSONObject) - - override fun transform(json: JSONObject) = json.apply { apply(json) } -} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/integrations/twitter/patches/hook/json/JsonHook.kt b/app/src/main/java/app/revanced/integrations/twitter/patches/hook/json/JsonHook.kt deleted file mode 100644 index 3edfca4e6a..0000000000 --- a/app/src/main/java/app/revanced/integrations/twitter/patches/hook/json/JsonHook.kt +++ /dev/null @@ -1,15 +0,0 @@ -package app.revanced.integrations.twitter.patches.hook.json - -import app.revanced.integrations.twitter.patches.hook.patch.Hook -import org.json.JSONObject - -interface JsonHook : Hook { - /** - * Transform a JSONObject. - * - * @param json The JSONObject. - */ - fun transform(json: JSONObject): JSONObject - - override fun hook(type: JSONObject) = transform(type) -} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/integrations/twitter/patches/hook/json/JsonHookPatch.kt b/app/src/main/java/app/revanced/integrations/twitter/patches/hook/json/JsonHookPatch.kt deleted file mode 100644 index 6e4067b923..0000000000 --- a/app/src/main/java/app/revanced/integrations/twitter/patches/hook/json/JsonHookPatch.kt +++ /dev/null @@ -1,30 +0,0 @@ -package app.revanced.integrations.twitter.patches.hook.json - -import app.revanced.integrations.twitter.patches.hook.patch.dummy.DummyHook -import app.revanced.integrations.twitter.utils.json.JsonUtils.parseJson -import app.revanced.integrations.twitter.utils.stream.StreamUtils -import org.json.JSONException -import java.io.IOException -import java.io.InputStream - -object JsonHookPatch { - // Additional hooks added by corresponding patch. - private val hooks = buildList { - add(DummyHook) - } - - @JvmStatic - fun parseJsonHook(jsonInputStream: InputStream): InputStream { - var jsonObject = try { - parseJson(jsonInputStream) - } catch (ignored: IOException) { - return jsonInputStream // Unreachable. - } catch (ignored: JSONException) { - return jsonInputStream - } - - for (hook in hooks) jsonObject = hook.hook(jsonObject) - - return StreamUtils.fromString(jsonObject.toString()) - } -} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/Hook.kt b/app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/Hook.kt deleted file mode 100644 index d6d163ef97..0000000000 --- a/app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/Hook.kt +++ /dev/null @@ -1,9 +0,0 @@ -package app.revanced.integrations.twitter.patches.hook.patch - -interface Hook { - /** - * Hook the given type. - * @param type The type to hook - */ - fun hook(type: T): T -} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/ads/AdsHook.kt b/app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/ads/AdsHook.kt deleted file mode 100644 index 7c33a5b21a..0000000000 --- a/app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/ads/AdsHook.kt +++ /dev/null @@ -1,15 +0,0 @@ -package app.revanced.integrations.twitter.patches.hook.patch.ads - -import app.revanced.integrations.twitter.patches.hook.json.BaseJsonHook -import app.revanced.integrations.twitter.patches.hook.twifucker.TwiFucker -import org.json.JSONObject - - -object AdsHook : BaseJsonHook() { - /** - * Strips JSONObject from promoted ads. - * - * @param json The JSONObject. - */ - override fun apply(json: JSONObject) = TwiFucker.hidePromotedAds(json) -} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/browserchooser/BrowserChooserHook.kt b/app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/browserchooser/BrowserChooserHook.kt deleted file mode 100644 index b79d0ef42e..0000000000 --- a/app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/browserchooser/BrowserChooserHook.kt +++ /dev/null @@ -1,10 +0,0 @@ -package app.revanced.integrations.twitter.patches.hook.patch.browserchooser - -import android.content.Context -import android.content.Intent -import app.revanced.integrations.twitter.patches.hook.twifucker.TwiFucker - - -object BrowserChooserHook { - fun open(context: Context, intent: Intent) = TwiFucker.openWithChooser(context, intent) -} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/dummy/DummyHook.kt b/app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/dummy/DummyHook.kt deleted file mode 100644 index 1a4f583c7b..0000000000 --- a/app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/dummy/DummyHook.kt +++ /dev/null @@ -1,14 +0,0 @@ -package app.revanced.integrations.twitter.patches.hook.patch.dummy - -import app.revanced.integrations.twitter.patches.hook.json.BaseJsonHook -import app.revanced.integrations.twitter.patches.hook.json.JsonHookPatch -import org.json.JSONObject - -/** - * Dummy hook to reserve a register in [JsonHookPatch.hooks] list. - */ -object DummyHook : BaseJsonHook() { - override fun apply(json: JSONObject) { - // Do nothing. - } -} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/recommendation/RecommendedUsersHook.kt b/app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/recommendation/RecommendedUsersHook.kt deleted file mode 100644 index dfbb1ffb23..0000000000 --- a/app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/recommendation/RecommendedUsersHook.kt +++ /dev/null @@ -1,15 +0,0 @@ -package app.revanced.integrations.twitter.patches.hook.patch.recommendation - -import app.revanced.integrations.twitter.patches.hook.json.BaseJsonHook -import app.revanced.integrations.twitter.patches.hook.twifucker.TwiFucker -import org.json.JSONObject - - -object RecommendedUsersHook : BaseJsonHook() { - /** - * Strips JSONObject from recommended users. - * - * @param json The JSONObject. - */ - override fun apply(json: JSONObject) = TwiFucker.hideRecommendedUsers(json) -} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/integrations/twitter/patches/hook/twifucker/TwiFucker.kt b/app/src/main/java/app/revanced/integrations/twitter/patches/hook/twifucker/TwiFucker.kt deleted file mode 100644 index b21b16ca79..0000000000 --- a/app/src/main/java/app/revanced/integrations/twitter/patches/hook/twifucker/TwiFucker.kt +++ /dev/null @@ -1,232 +0,0 @@ -package app.revanced.integrations.twitter.patches.hook.twifucker - -import android.content.Context -import android.content.Intent -import android.net.Uri -import android.util.Log -import app.revanced.integrations.twitter.patches.hook.twifucker.TwiFuckerUtils.forEach -import app.revanced.integrations.twitter.patches.hook.twifucker.TwiFuckerUtils.forEachIndexed -import org.json.JSONArray -import org.json.JSONObject - -// https://raw.githubusercontent.com/Dr-TSNG/TwiFucker/880cdf1c1622e54ab45561ffcb4f53d94ed97bae/app/src/main/java/icu/nullptr/twifucker/hook/JsonHook.kt -internal object TwiFucker { - // root - private fun JSONObject.jsonGetInstructions(): JSONArray? = optJSONObject("timeline")?.optJSONArray("instructions") - - private fun JSONObject.jsonGetData(): JSONObject? = optJSONObject("data") - - private fun JSONObject.jsonHasRecommendedUsers(): Boolean = has("recommended_users") - - private fun JSONObject.jsonRemoveRecommendedUsers() { - remove("recommended_users") - } - - private fun JSONObject.jsonCheckAndRemoveRecommendedUsers() { - if (jsonHasRecommendedUsers()) { - Log.d("ReVanced", "Handle recommended users: $this") - jsonRemoveRecommendedUsers() - } - } - - private fun JSONObject.jsonHasThreads(): Boolean = has("threads") - - private fun JSONObject.jsonRemoveThreads() { - remove("threads") - } - - private fun JSONObject.jsonCheckAndRemoveThreads() { - if (jsonHasThreads()) { - Log.d("ReVanced", "Handle threads: $this") - jsonRemoveThreads() - } - } - - // data - private fun JSONObject.dataGetInstructions(): JSONArray? { - val timeline = - optJSONObject("user_result")?.optJSONObject("result") - ?.optJSONObject("timeline_response")?.optJSONObject("timeline") - ?: optJSONObject("timeline_response")?.optJSONObject("timeline") - ?: optJSONObject("search")?.optJSONObject("timeline_response")?.optJSONObject("timeline") - ?: optJSONObject("timeline_response") - return timeline?.optJSONArray("instructions") - } - - private fun JSONObject.dataCheckAndRemove() { - dataGetInstructions()?.forEach { instruction -> - instruction.instructionCheckAndRemove { it.entriesRemoveAnnoyance() } - } - } - - private fun JSONObject.dataGetLegacy(): JSONObject? = - optJSONObject("tweet_result")?.optJSONObject("result")?.let { - if (it.has("tweet")) { - it.optJSONObject("tweet") - } else { - it - } - }?.optJSONObject("legacy") - - // entry - private fun JSONObject.entryHasPromotedMetadata(): Boolean = - optJSONObject("content")?.optJSONObject("item")?.optJSONObject("content") - ?.optJSONObject("tweet") - ?.has("promotedMetadata") == true || optJSONObject("content")?.optJSONObject("content") - ?.has("tweetPromotedMetadata") == true || optJSONObject("item")?.optJSONObject("content") - ?.has("tweetPromotedMetadata") == true - - private fun JSONObject.entryGetContentItems(): JSONArray? = - optJSONObject("content")?.optJSONArray("items") - ?: optJSONObject("content")?.optJSONObject("timelineModule")?.optJSONArray("items") - - private fun JSONObject.entryIsTweetDetailRelatedTweets(): Boolean = optString("entryId").startsWith("tweetdetailrelatedtweets-") - - private fun JSONObject.entryGetTrends(): JSONArray? = optJSONObject("content")?.optJSONObject("timelineModule")?.optJSONArray("items") - - // trend - private fun JSONObject.trendHasPromotedMetadata(): Boolean = - optJSONObject("item")?.optJSONObject("content")?.optJSONObject("trend") - ?.has("promotedMetadata") == true - - private fun JSONArray.trendRemoveAds() { - val trendRemoveIndex = mutableListOf() - forEachIndexed { trendIndex, trend -> - if (trend.trendHasPromotedMetadata()) { - Log.d("ReVanced", "Handle trends ads $trendIndex $trend") - trendRemoveIndex.add(trendIndex) - } - } - for (i in trendRemoveIndex.asReversed()) { - remove(i) - } - } - - // instruction - private fun JSONObject.instructionTimelineAddEntries(): JSONArray? = optJSONArray("entries") - - private fun JSONObject.instructionGetAddEntries(): JSONArray? = optJSONObject("addEntries")?.optJSONArray("entries") - - private fun JSONObject.instructionCheckAndRemove(action: (JSONArray) -> Unit) { - instructionTimelineAddEntries()?.let(action) - instructionGetAddEntries()?.let(action) - } - - // entries - private fun JSONArray.entriesRemoveTimelineAds() { - val removeIndex = mutableListOf() - forEachIndexed { entryIndex, entry -> - entry.entryGetTrends()?.trendRemoveAds() - - if (entry.entryHasPromotedMetadata()) { - Log.d("ReVanced", "Handle timeline ads $entryIndex $entry") - removeIndex.add(entryIndex) - } - - val innerRemoveIndex = mutableListOf() - val contentItems = entry.entryGetContentItems() - contentItems?.forEachIndexed inner@{ itemIndex, item -> - if (item.entryHasPromotedMetadata()) { - Log.d("ReVanced", "Handle timeline replies ads $entryIndex $entry") - if (contentItems.length() == 1) { - removeIndex.add(entryIndex) - } else { - innerRemoveIndex.add(itemIndex) - } - return@inner - } - } - for (i in innerRemoveIndex.asReversed()) { - contentItems?.remove(i) - } - } - for (i in removeIndex.reversed()) { - remove(i) - } - } - - private fun JSONArray.entriesRemoveTweetDetailRelatedTweets() { - val removeIndex = mutableListOf() - forEachIndexed { entryIndex, entry -> - - if (entry.entryIsTweetDetailRelatedTweets()) { - Log.d("ReVanced", "Handle tweet detail related tweets $entryIndex $entry") - removeIndex.add(entryIndex) - } - } - for (i in removeIndex.reversed()) { - remove(i) - } - } - - private fun JSONArray.entriesRemoveAnnoyance() { - entriesRemoveTimelineAds() - entriesRemoveTweetDetailRelatedTweets() - } - - private fun JSONObject.entryIsWhoToFollow(): Boolean = - optString("entryId").let { - it.startsWith("whoToFollow-") || it.startsWith("who-to-follow-") || it.startsWith("connect-module-") - } - - private fun JSONObject.itemContainsPromotedUser(): Boolean = - optJSONObject("item")?.optJSONObject("content") - ?.has("userPromotedMetadata") == true || optJSONObject("item")?.optJSONObject("content") - ?.optJSONObject("user") - ?.has("userPromotedMetadata") == true || optJSONObject("item")?.optJSONObject("content") - ?.optJSONObject("user")?.has("promotedMetadata") == true - - fun JSONArray.entriesRemoveWhoToFollow() { - val entryRemoveIndex = mutableListOf() - forEachIndexed { entryIndex, entry -> - if (!entry.entryIsWhoToFollow()) return@forEachIndexed - - Log.d("ReVanced", "Handle whoToFollow $entryIndex $entry") - entryRemoveIndex.add(entryIndex) - - val items = entry.entryGetContentItems() - val userRemoveIndex = mutableListOf() - items?.forEachIndexed { index, item -> - item.itemContainsPromotedUser().let { - if (it) { - Log.d("ReVanced", "Handle whoToFollow promoted user $index $item") - userRemoveIndex.add(index) - } - } - } - for (i in userRemoveIndex.reversed()) { - items?.remove(i) - } - } - for (i in entryRemoveIndex.reversed()) { - remove(i) - } - } - - fun hideRecommendedUsers(json: JSONObject) { - json.filterInstructions { it.entriesRemoveWhoToFollow() } - json.jsonCheckAndRemoveRecommendedUsers() - } - - fun hidePromotedAds(json: JSONObject) { - json.filterInstructions { it.entriesRemoveAnnoyance() } - json.jsonGetData()?.dataCheckAndRemove() - } - - fun openWithChooser(context: Context, intent: Intent) { - context.startActivity( - Intent.createChooser( - Intent( - "android.intent.action.VIEW", - Uri.parse(intent.dataString) - ), "" - ) - ) - } - - private fun JSONObject.filterInstructions(action: (JSONArray) -> Unit) { - jsonGetInstructions()?.forEach { instruction -> - instruction.instructionCheckAndRemove(action) - } - } -} diff --git a/app/src/main/java/app/revanced/integrations/twitter/patches/hook/twifucker/TwiFuckerUtils.kt b/app/src/main/java/app/revanced/integrations/twitter/patches/hook/twifucker/TwiFuckerUtils.kt deleted file mode 100644 index f6c05e1fb4..0000000000 --- a/app/src/main/java/app/revanced/integrations/twitter/patches/hook/twifucker/TwiFuckerUtils.kt +++ /dev/null @@ -1,22 +0,0 @@ -package app.revanced.integrations.twitter.patches.hook.twifucker - -import org.json.JSONArray -import org.json.JSONObject - -internal object TwiFuckerUtils { - inline fun JSONArray.forEach(action: (JSONObject) -> Unit) { - (0 until this.length()).forEach { i -> - if (this[i] is JSONObject) { - action(this[i] as JSONObject) - } - } - } - - inline fun JSONArray.forEachIndexed(action: (index: Int, JSONObject) -> Unit) { - (0 until this.length()).forEach { i -> - if (this[i] is JSONObject) { - action(i, this[i] as JSONObject) - } - } - } -} diff --git a/app/src/main/java/app/revanced/integrations/twitter/utils/json/JsonUtils.kt b/app/src/main/java/app/revanced/integrations/twitter/utils/json/JsonUtils.kt deleted file mode 100644 index 4b7a5002a6..0000000000 --- a/app/src/main/java/app/revanced/integrations/twitter/utils/json/JsonUtils.kt +++ /dev/null @@ -1,13 +0,0 @@ -package app.revanced.integrations.twitter.utils.json - -import app.revanced.integrations.twitter.utils.stream.StreamUtils -import org.json.JSONException -import org.json.JSONObject -import java.io.IOException -import java.io.InputStream - -object JsonUtils { - @JvmStatic - @Throws(IOException::class, JSONException::class) - fun parseJson(jsonInputStream: InputStream) = JSONObject(StreamUtils.toString(jsonInputStream)) -} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/integrations/twitter/utils/stream/StreamUtils.kt b/app/src/main/java/app/revanced/integrations/twitter/utils/stream/StreamUtils.kt deleted file mode 100644 index 7e008eb849..0000000000 --- a/app/src/main/java/app/revanced/integrations/twitter/utils/stream/StreamUtils.kt +++ /dev/null @@ -1,24 +0,0 @@ -package app.revanced.integrations.twitter.utils.stream - -import java.io.ByteArrayInputStream -import java.io.ByteArrayOutputStream -import java.io.IOException -import java.io.InputStream - -object StreamUtils { - @Throws(IOException::class) - fun toString(inputStream: InputStream): String { - ByteArrayOutputStream().use { result -> - val buffer = ByteArray(1024) - var length: Int - while (inputStream.read(buffer).also { length = it } != -1) { - result.write(buffer, 0, length) - } - return result.toString() - } - } - - fun fromString(string: String): InputStream { - return ByteArrayInputStream(string.toByteArray()) - } -} \ No newline at end of file From 1d44f8d443da475e6a925716606d221d945b949c Mon Sep 17 00:00:00 2001 From: Swakshan Date: Thu, 21 Mar 2024 16:47:42 +0530 Subject: [PATCH 13/14] feat(Twitter): Added Ad block hooks --- .../revanced/integrations/twitter/Pref.java | 36 +++++++-- .../twitter/patches/TimelineEntry.java | 75 +++++++++++++++++++ .../twitter/settings/Settings.java | 7 ++ .../twitter/settings/SettingsActivity.java | 70 ++++++++++++++++- .../twitter/settings/SettingsStatus.java | 20 ++++- 5 files changed, 199 insertions(+), 9 deletions(-) create mode 100644 app/src/main/java/app/revanced/integrations/twitter/patches/TimelineEntry.java diff --git a/app/src/main/java/app/revanced/integrations/twitter/Pref.java b/app/src/main/java/app/revanced/integrations/twitter/Pref.java index a0572da7a4..21d9c37b3d 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/Pref.java +++ b/app/src/main/java/app/revanced/integrations/twitter/Pref.java @@ -36,12 +36,6 @@ public static boolean hideFAB() { return Utils.getBooleanPerf(Settings.MISC_HIDE_FAB); } - public static boolean hidePromotedTrend(Object data) { - if(data!=null && Utils.getBooleanPerf(Settings.ADS_HIDE_PROMOTED_TRENDS)){ - return true; - } - return false; - } public static boolean hideCommNotes() { return Utils.getBooleanPerf(Settings.MISC_HIDE_COMM_NOTES); } @@ -49,4 +43,34 @@ public static boolean hideCommNotes() { public static boolean hideViewCount() { return !Utils.getBooleanPerf(Settings.MISC_HIDE_VIEW_COUNT); } + + public static boolean hidePromotedTrend(Object data) { + if(data!=null && Utils.getBooleanPerf(Settings.ADS_HIDE_PROMOTED_TRENDS)){ + return true; + } + return false; + } + public static boolean hideAds() { + return Utils.getBooleanPerf(Settings.ADS_HIDE_PROMOTED_POSTS); + } + public static boolean hideGoogleAds() { + return Utils.getBooleanPerf(Settings.ADS_HIDE_GOOGLE_ADS); + } + public static boolean hideWTF() { + return Utils.getBooleanPerf(Settings.ADS_HIDE_WHO_TO_FOLLOW); + } + public static boolean hideCTS() { + return Utils.getBooleanPerf(Settings.ADS_HIDE_CREATORS_TO_SUB); + } + public static boolean hideCTJ() { + return Utils.getBooleanPerf(Settings.ADS_HIDE_COMM_TO_JOIN); + } + public static boolean hideRBMK() { + return Utils.getBooleanPerf(Settings.ADS_HIDE_REVISIT_BMK); + } + public static boolean hideDetailedPosts() { + return Utils.getBooleanPerf(Settings.ADS_HIDE_DETAILED_POSTS); + } + + //end } \ No newline at end of file diff --git a/app/src/main/java/app/revanced/integrations/twitter/patches/TimelineEntry.java b/app/src/main/java/app/revanced/integrations/twitter/patches/TimelineEntry.java new file mode 100644 index 0000000000..1196de791b --- /dev/null +++ b/app/src/main/java/app/revanced/integrations/twitter/patches/TimelineEntry.java @@ -0,0 +1,75 @@ +package app.revanced.integrations.twitter.patches; + +import app.revanced.integrations.twitter.Pref; +import app.revanced.integrations.twitter.Utils; +import app.revanced.integrations.twitter.settings.SettingsStatus; +import android.util.Log; +import java.lang.reflect.Field; + + +public class TimelineEntry { + private static boolean hideAds,hideGAds,hideWTF,hideCTS,hideCTJ,hideDetailedPosts,hideRBMK; + static { + SettingsStatus.load(); + hideAds = (Pref.hideAds() && SettingsStatus.hideAds); + hideGAds = (Pref.hideGoogleAds() && SettingsStatus.hideGAds); + hideWTF = (Pref.hideWTF() && SettingsStatus.hideWTF); + hideCTS = (Pref.hideCTS() && SettingsStatus.hideCTS); + hideCTJ = (Pref.hideCTJ() && SettingsStatus.hideCTJ); + hideDetailedPosts = (Pref.hideDetailedPosts() && SettingsStatus.hideDetailedPosts); + hideRBMK = (Pref.hideRBMK() && SettingsStatus.hideRBMK); + } + + + + private static boolean isEntryIdRemove(String entryId) { + String[] split = entryId.split("-"); + String entryId2 = split[0]; + if (!entryId2.equals("cursor") && !entryId2.equals("Guide") && !entryId2.startsWith("semantic_core")) { + if ((entryId2.equals("promoted") || ((entryId2.equals("conversationthread") && split.length == 3) || entryId2.equals("superhero"))) && hideAds) { + return true; + } + if (entryId2.equals("rtb") && hideGAds) { + return true; + } + + if (entryId2.equals("tweetdetailrelatedtweets") && hideDetailedPosts) { + return true; + } + if (entryId2.equals("bookmarked") && hideRBMK) { + return true; + } + if (entryId.startsWith("community-to-join") && hideCTJ) { + return true; + } + if (entryId.startsWith("who-to-follow") && hideWTF) { + return true; + } + if (entryId.startsWith("who-to-subscribe") && hideCTS) { + return true; + } + } + return false; + } + + public static boolean checkEntry(Object jsonTimelineEntry) { + try { + String className = "com.twitter.model.json.timeline.urt.JsonTimelineEntry"; // Replace with your fully qualified class name + Class clazz = Class.forName(className); + + if (!clazz.isInstance(jsonTimelineEntry)) { + return false; + } + + clazz.cast(jsonTimelineEntry); + Field a = clazz.getDeclaredField("a"); + String entryId = (String) a.get(jsonTimelineEntry); + return isEntryIdRemove(entryId); + } catch (Exception unused) { + + } + return false; + } + +//end +} \ No newline at end of file diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java b/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java index 8d8f1a4011..1b49fc49d5 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/Settings.java @@ -15,6 +15,13 @@ public class Settings extends BaseSettings { public static final BooleanSetting MISC_HIDE_VIEW_COUNT = new BooleanSetting("misc_hide_view_count", true); public static final BooleanSetting ADS_HIDE_PROMOTED_TRENDS = new BooleanSetting("ads_hide_promoted_trends", true); + public static final BooleanSetting ADS_HIDE_PROMOTED_POSTS = new BooleanSetting("ads_hide_promoted_posts", true); + public static final BooleanSetting ADS_HIDE_GOOGLE_ADS = new BooleanSetting("ads_hide_google_ads", true); + public static final BooleanSetting ADS_HIDE_WHO_TO_FOLLOW = new BooleanSetting("ads_hide_who_to_follow", true); + public static final BooleanSetting ADS_HIDE_CREATORS_TO_SUB = new BooleanSetting("ads_hide_creators_to_sub", true); + public static final BooleanSetting ADS_HIDE_COMM_TO_JOIN = new BooleanSetting("ads_hide_comm_to_join", true); + public static final BooleanSetting ADS_HIDE_REVISIT_BMK = new BooleanSetting("ads_hide_revisit_bookmark", true); + public static final BooleanSetting ADS_HIDE_DETAILED_POSTS = new BooleanSetting("ads_hide_detailed_posts", true); public static final BooleanSetting TIMELINE_HIDE_LIVETHREADS = new BooleanSetting("timeline_hide_livethreads", true); public static final BooleanSetting TIMELINE_HIDE_BANNER = new BooleanSetting("timeline_hide_banner", true); diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java index 5b31a5caab..1255ee379e 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsActivity.java @@ -37,7 +37,7 @@ public void onCreate(@Nullable Bundle savedInstanceState) { context = getContext(); PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(context); - SettingsStatus.load(); + // SettingsStatus.load(); if (SettingsStatus.changeDownloadEnabled) { LegacyTwitterPreferenceCategory downloadPrefs = preferenceCategory("Download", screen); @@ -56,6 +56,74 @@ public void onCreate(@Nullable Bundle savedInstanceState) { if(SettingsStatus.enableAdsSection()){ LegacyTwitterPreferenceCategory adsPrefs = preferenceCategory("Ads", screen); + if (SettingsStatus.hideAds) { + adsPrefs.addPreference( + switchPreference( + "Hide promoted posts", + "", + Settings.ADS_HIDE_PROMOTED_POSTS + ) + ); + } + + if (SettingsStatus.hideGAds) { + adsPrefs.addPreference( + switchPreference( + "Hide google ads", + "", + Settings.ADS_HIDE_GOOGLE_ADS + ) + ); + } + if (SettingsStatus.hideWTF) { + adsPrefs.addPreference( + switchPreference( + "Hide \"Who to follow\" section", + "", + Settings.ADS_HIDE_WHO_TO_FOLLOW + ) + ); + } + + if (SettingsStatus.hideCTS) { + adsPrefs.addPreference( + switchPreference( + "Hide \"Creators to subscribe\" section", + "", + Settings.ADS_HIDE_CREATORS_TO_SUB + ) + ); + } + + if (SettingsStatus.hideCTJ) { + adsPrefs.addPreference( + switchPreference( + "Hide \"Community to join\" section", + "", + Settings.ADS_HIDE_COMM_TO_JOIN + ) + ); + } + + if (SettingsStatus.hideRBMK) { + adsPrefs.addPreference( + switchPreference( + "Hide \"Revist your bookmark\" section", + "", + Settings.ADS_HIDE_REVISIT_BMK + ) + ); + } + + if (SettingsStatus.hideDetailedPosts) { + adsPrefs.addPreference( + switchPreference( + "Hide detailed posts (in replies)", + "", + Settings.ADS_HIDE_DETAILED_POSTS + ) + ); + } if (SettingsStatus.hidePromotedTrend) { adsPrefs.addPreference( diff --git a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java index 31455f83da..4abd1a0079 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java +++ b/app/src/main/java/app/revanced/integrations/twitter/settings/SettingsStatus.java @@ -12,12 +12,19 @@ public class SettingsStatus { public static boolean hideBanner = false; public static boolean hideForyou = false; + public static boolean hideAds = false; + public static boolean hideGAds = false; + public static boolean hideWTF = false; + public static boolean hideCTS = false; + public static boolean hideCTJ = false; + public static boolean hideDetailedPosts = false; + public static boolean hideRBMK = false; + public static void enableDownloadFolder() { changeDownloadEnabled = true; } public static void enableFont() { enableFontMod = true; } public static void hideRecommendedUsers() { hideRecommendedUsers = true; } - public static void hidePromotedTrends() { hidePromotedTrend = true; } public static void hideCommunityNotes() { hideCommunityNote = true; } public static void hideFAB() { hideFAB = true; } public static void hideViewCount() { hideViewCount = true; } @@ -25,9 +32,18 @@ public class SettingsStatus { public static void hideBanner() { hideBanner = true; } public static void hideForYou() { hideForyou = true; } + public static void hideAds() { hideAds = true; } + public static void hideGAds() { hideGAds = true; } + public static void hideWhoToFollow() { hideWTF = true; } + public static void hideCreatorsToSub() { hideCTS = true; } + public static void hideCommToJoin() { hideCTJ = true; } + public static void hideDetailedPost() { hideDetailedPosts = true; } + public static void hideRevistBookmark() { hideRBMK = true; } + public static void hidePromotedTrends() { hidePromotedTrend = true; } + public static boolean enableTimelineSection(){ return (hideLiveThreads || hideBanner || hideForyou); } public static boolean enableMiscSection() { return (enableFontMod || hideRecommendedUsers || hideFAB || hideViewCount || hideCommunityNote); } - public static boolean enableAdsSection() {return (hidePromotedTrend); } + public static boolean enableAdsSection() {return (hideAds|| hideGAds || hideWTF || hideCTS || hideCTJ || hideDetailedPosts || hideRBMK ||hidePromotedTrend); } public static void load() {} } From fec065f41de3622728c513900cf834d9ff8edc9d Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 22 Mar 2024 07:45:22 +0000 Subject: [PATCH 14/14] chore(release): 1.6.0-dev.5 [skip ci] # [1.6.0-dev.5](https://github.com/crimera/revanced-integrations/compare/v1.6.0-dev.4...v1.6.0-dev.5) (2024-03-22) ### Features * **Twitter:** Added Ad block hooks ([1d44f8d](https://github.com/crimera/revanced-integrations/commit/1d44f8d443da475e6a925716606d221d945b949c)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c0513cf7f..b1d5655eb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [1.6.0-dev.5](https://github.com/crimera/revanced-integrations/compare/v1.6.0-dev.4...v1.6.0-dev.5) (2024-03-22) + + +### Features + +* **Twitter:** Added Ad block hooks ([1d44f8d](https://github.com/crimera/revanced-integrations/commit/1d44f8d443da475e6a925716606d221d945b949c)) + # [1.6.0-dev.4](https://github.com/crimera/revanced-integrations/compare/v1.6.0-dev.3...v1.6.0-dev.4) (2024-03-18) diff --git a/gradle.properties b/gradle.properties index 55849e130c..1792043e00 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true android.useAndroidX = true -version = 1.6.0-dev.4 +version = 1.6.0-dev.5