Skip to content

Commit

Permalink
Merge pull request #7 from crimera/dev
Browse files Browse the repository at this point in the history
chore: Merge branch `dev` to `main`
  • Loading branch information
crimera authored Mar 22, 2024
2 parents 7304e3f + fec065f commit 1285791
Show file tree
Hide file tree
Showing 19 changed files with 339 additions and 422 deletions.
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
# [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)


### 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)


### 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)


### 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)


### 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)


Expand Down
48 changes: 46 additions & 2 deletions app/src/main/java/app/revanced/integrations/twitter/Pref.java
Original file line number Diff line number Diff line change
@@ -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 {

Expand All @@ -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;
Expand All @@ -28,5 +32,45 @@ public static int hideForYou() {
return Utils.getBooleanPerf(Settings.TIMELINE_HIDE_FORYOU)?34:17;
}

public static boolean hideFAB() {
return Utils.getBooleanPerf(Settings.MISC_HIDE_FAB);
}

public static boolean hideCommNotes() {
return Utils.getBooleanPerf(Settings.MISC_HIDE_COMM_NOTES);
}

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
}
Original file line number Diff line number Diff line change
@@ -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
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 1285791

Please sign in to comment.