forked from ReVanced/revanced-integrations
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from crimera/dev
chore: Merge branch `dev` to `main`
- Loading branch information
Showing
19 changed files
with
339 additions
and
422 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
app/src/main/java/app/revanced/integrations/twitter/patches/TimelineEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
9 changes: 0 additions & 9 deletions
9
app/src/main/java/app/revanced/integrations/twitter/patches/hook/json/BaseJsonHook.kt
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
app/src/main/java/app/revanced/integrations/twitter/patches/hook/json/JsonHook.kt
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
app/src/main/java/app/revanced/integrations/twitter/patches/hook/json/JsonHookPatch.kt
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/Hook.kt
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/ads/AdsHook.kt
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
...app/revanced/integrations/twitter/patches/hook/patch/browserchooser/BrowserChooserHook.kt
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/dummy/DummyHook.kt
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
...p/revanced/integrations/twitter/patches/hook/patch/recommendation/RecommendedUsersHook.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.