From 015f492bfaf6fece4f3cb5e46707e283405e17d6 Mon Sep 17 00:00:00 2001 From: crimera <44558091+crimera@users.noreply.github.com> Date: Sun, 20 Oct 2024 11:32:46 +0800 Subject: [PATCH 1/4] fix(Twitter): Add support for version 10.64.0-beta.1 --- .../integrations/twitter/patches/NativeDownloader.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/app/revanced/integrations/twitter/patches/NativeDownloader.java b/app/src/main/java/app/revanced/integrations/twitter/patches/NativeDownloader.java index 3dde8722b6..86905fbf19 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/patches/NativeDownloader.java +++ b/app/src/main/java/app/revanced/integrations/twitter/patches/NativeDownloader.java @@ -182,10 +182,14 @@ public static void downloader(Context activity, Object tweet) throws NoSuchMetho Check how many versions this naive implementation lasts. checked until versions 10.48 and the method names were the same. */ - Method getUserNameMethod = tweetClass.getDeclaredMethod("q"); + Method getUserNameMethod = tweetClass.getDeclaredMethod("r"); Method getMediaMethod = tweetClass.getDeclaredMethod("b"); String username = (String) getUserNameMethod.invoke(tweet); + if (username == null) { + Utils.toast("username is not found"); + } + assert username != null; Object obj = getMediaMethod.invoke(tweet); ArrayList> media = getMediaData(obj); From 13f72a787b2e5996606f0c04fb40b7aa8b76e472 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 20 Oct 2024 03:38:02 +0000 Subject: [PATCH 2/4] chore(release): 1.31.2-dev.1 [skip ci] ## [1.31.2-dev.1](https://github.com/crimera/revanced-integrations/compare/v1.31.1...v1.31.2-dev.1) (2024-10-20) ### Bug Fixes * **Twitter:** Add support for version 10.64.0-beta.1 ([015f492](https://github.com/crimera/revanced-integrations/commit/015f492bfaf6fece4f3cb5e46707e283405e17d6)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8623aca51..d7846768ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [1.31.2-dev.1](https://github.com/crimera/revanced-integrations/compare/v1.31.1...v1.31.2-dev.1) (2024-10-20) + + +### Bug Fixes + +* **Twitter:** Add support for version 10.64.0-beta.1 ([015f492](https://github.com/crimera/revanced-integrations/commit/015f492bfaf6fece4f3cb5e46707e283405e17d6)) + ## [1.31.1](https://github.com/crimera/revanced-integrations/compare/v1.31.0...v1.31.1) (2024-10-15) diff --git a/gradle.properties b/gradle.properties index a6e0099ed8..5831116eb8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true android.useAndroidX = true -version = 1.31.1 +version = 1.31.2-dev.1 From a6ed0b2d3db2757d83d0c0606eccf14c6ca2a02e Mon Sep 17 00:00:00 2001 From: crimera <44558091+crimera@users.noreply.github.com> Date: Sun, 20 Oct 2024 14:33:03 +0800 Subject: [PATCH 3/4] refactor(Custom Downloader): Improve getting of tweet method declarations --- .../twitter/patches/NativeDownloader.java | 39 ++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/twitter/patches/NativeDownloader.java b/app/src/main/java/app/revanced/integrations/twitter/patches/NativeDownloader.java index 86905fbf19..971dfbdd4a 100644 --- a/app/src/main/java/app/revanced/integrations/twitter/patches/NativeDownloader.java +++ b/app/src/main/java/app/revanced/integrations/twitter/patches/NativeDownloader.java @@ -170,27 +170,40 @@ private static void alertBox(Context ctx, String filename, ArrayList tweetClass; + + public static Class getTweetClass() throws ClassNotFoundException { + if (tweetClass == null) tweetClass = Class.forName("tweetObjectClass"); + + return tweetClass; + } + + public static Long getTweetId(Object tweet) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException { + return (Long) getTweetClass().getDeclaredMethod("idMethod").invoke(tweet); + } + + public static String getTweetUsername(Object tweet) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException { + return (String) getTweetClass().getDeclaredMethod("getUserNamemethod").invoke(tweet); + } + + public static Object getTweetMedia(Object tweet) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException { + return getTweetClass().getDeclaredMethod("getTweetMediaMethod").invoke(tweet); + } + // downloader(Landroid/content/Context;Ljava/lang/Object;)V - public static void downloader(Context activity, Object tweet) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, NoSuchFieldException { - Class tweetClass = tweet.getClass(); + public static void downloader(Context activity, Object tweet) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, NoSuchFieldException, ClassNotFoundException { + // TODO: make this into a fingerprint, match https://x.com/%1$s/status/%2$d + Class tweetClass = getTweetClass(); - Method getIdMethod = tweetClass.getDeclaredMethod("getId"); - Long id = (Long) getIdMethod.invoke(tweet); + Long id = getTweetId(tweet); assert id != null; - /* - Check how many versions this naive implementation lasts. checked until - versions 10.48 and the method names were the same. - */ - Method getUserNameMethod = tweetClass.getDeclaredMethod("r"); - Method getMediaMethod = tweetClass.getDeclaredMethod("b"); - - String username = (String) getUserNameMethod.invoke(tweet); + String username = getTweetUsername(tweet); if (username == null) { Utils.toast("username is not found"); } assert username != null; - Object obj = getMediaMethod.invoke(tweet); + Object obj = getTweetMedia(tweet); ArrayList> media = getMediaData(obj); assert media != null; From 3a5a67d6d0051bc5b048ffc5d89009ca71aa968a Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 20 Oct 2024 06:39:21 +0000 Subject: [PATCH 4/4] chore(release): 1.31.2-dev.2 [skip ci] ## [1.31.2-dev.2](https://github.com/crimera/revanced-integrations/compare/v1.31.2-dev.1...v1.31.2-dev.2) (2024-10-20) ### Refactors * **Custom Downloader:** Improve getting of tweet method declarations ([a6ed0b2](https://github.com/crimera/revanced-integrations/commit/a6ed0b2d3db2757d83d0c0606eccf14c6ca2a02e)) --- CHANGELOG.md | 7 +++++++ gradle.properties | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d7846768ca..d6600cd25b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [1.31.2-dev.2](https://github.com/crimera/revanced-integrations/compare/v1.31.2-dev.1...v1.31.2-dev.2) (2024-10-20) + + +### Refactors + +* **Custom Downloader:** Improve getting of tweet method declarations ([a6ed0b2](https://github.com/crimera/revanced-integrations/commit/a6ed0b2d3db2757d83d0c0606eccf14c6ca2a02e)) + ## [1.31.2-dev.1](https://github.com/crimera/revanced-integrations/compare/v1.31.1...v1.31.2-dev.1) (2024-10-20) diff --git a/gradle.properties b/gradle.properties index 5831116eb8..afedf76058 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true android.useAndroidX = true -version = 1.31.2-dev.1 +version = 1.31.2-dev.2