From 37b45c0cb2bba3f353a8d89567fa196ba4b7d53c Mon Sep 17 00:00:00 2001 From: dic1911 Date: Fri, 23 Feb 2024 14:11:39 +0800 Subject: [PATCH 01/11] feat: (Twitter/X) no t.co links --- .../patches/links/UnshortenUrlsPatch.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 app/src/main/java/app/revanced/integrations/twitter/patches/links/UnshortenUrlsPatch.java diff --git a/app/src/main/java/app/revanced/integrations/twitter/patches/links/UnshortenUrlsPatch.java b/app/src/main/java/app/revanced/integrations/twitter/patches/links/UnshortenUrlsPatch.java new file mode 100644 index 0000000000..fde5f8e997 --- /dev/null +++ b/app/src/main/java/app/revanced/integrations/twitter/patches/links/UnshortenUrlsPatch.java @@ -0,0 +1,30 @@ +package app.revanced.integrations.twitter.patches.links; + +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +import java.lang.reflect.Field; + +public final class UnshortenUrlsPatch { + private static final String TAG = "030-unshort"; + public static void unshort(Object entity) { + try { + String className = "com.twitter.model.json.core.JsonUrlEntity"; // Replace with your fully qualified class name + Class clazz = Class.forName(className); + + if (!clazz.isInstance(entity)) { + return; + } + + clazz.cast(entity); + Field c = clazz.getDeclaredField("c"); + Field e = clazz.getDeclaredField("e"); + + String cValue = (String) c.get(entity); + e.set(entity, cValue); + } catch (Exception ex) { + Log.e(TAG, ";-;", ex); + } + } +} \ No newline at end of file From e61bf338f0b16c818374d785ee5ac0b45adfa23f Mon Sep 17 00:00:00 2001 From: dic1911 Date: Thu, 15 Feb 2024 13:57:39 +0800 Subject: [PATCH 02/11] feat: add helper method for opening chooser --- .../patch/browserchooser/BrowserChooserHook.kt | 10 ++++++++++ .../twitter/patches/hook/twifucker/TwiFucker.kt | 14 ++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/browserchooser/BrowserChooserHook.kt 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 new file mode 100644 index 0000000000..b79d0ef42e --- /dev/null +++ b/app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/browserchooser/BrowserChooserHook.kt @@ -0,0 +1,10 @@ +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/twifucker/TwiFucker.kt b/app/src/main/java/app/revanced/integrations/twitter/patches/hook/twifucker/TwiFucker.kt index 3e0f7550b6..b21b16ca79 100644 --- 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 @@ -1,5 +1,8 @@ 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 @@ -210,6 +213,17 @@ internal object TwiFucker { 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) From 05db00f0a6eeb06b17928306effc3a833528c6b6 Mon Sep 17 00:00:00 2001 From: dic1911 Date: Fri, 23 Feb 2024 15:08:18 +0800 Subject: [PATCH 03/11] fix open chooser when opening links for twitter --- .../patches/links/OpenLinksWithAppChooserPatch.java | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 app/src/main/java/app/revanced/integrations/twitter/patches/links/OpenLinksWithAppChooserPatch.java diff --git a/app/src/main/java/app/revanced/integrations/twitter/patches/links/OpenLinksWithAppChooserPatch.java b/app/src/main/java/app/revanced/integrations/twitter/patches/links/OpenLinksWithAppChooserPatch.java new file mode 100644 index 0000000000..0c391c633d --- /dev/null +++ b/app/src/main/java/app/revanced/integrations/twitter/patches/links/OpenLinksWithAppChooserPatch.java @@ -0,0 +1,11 @@ +package app.revanced.integrations.twitter.patches.links; + +import android.content.Context; +import android.content.Intent; + +public final class OpenLinksWithAppChooserPatch { + public static void openWithChooser(final Context context, final Intent originalIntent) { + final Intent intent = new Intent("android.intent.action.VIEW", originalIntent.getData()); + context.startActivity(Intent.createChooser(intent, null)); + } +} From 85f852aea1b4d8bcc4efd96e16557c8e4d926d4b Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 3 Mar 2024 15:50:43 +0000 Subject: [PATCH 04/11] chore(release): 1.4.0-dev.1 [skip ci] # [1.4.0-dev.1](https://github.com/crimera/revanced-integrations/compare/v1.3.0...v1.4.0-dev.1) (2024-03-03) ### Features * (Twitter/X) no t.co links ([37b45c0](https://github.com/crimera/revanced-integrations/commit/37b45c0cb2bba3f353a8d89567fa196ba4b7d53c)) * add helper method for opening chooser ([e61bf33](https://github.com/crimera/revanced-integrations/commit/e61bf338f0b16c818374d785ee5ac0b45adfa23f)) --- CHANGELOG.md | 8 ++++++++ gradle.properties | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 415a83c4c6..0d1ce44b4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# [1.4.0-dev.1](https://github.com/crimera/revanced-integrations/compare/v1.3.0...v1.4.0-dev.1) (2024-03-03) + + +### Features + +* (Twitter/X) no t.co links ([37b45c0](https://github.com/crimera/revanced-integrations/commit/37b45c0cb2bba3f353a8d89567fa196ba4b7d53c)) +* add helper method for opening chooser ([e61bf33](https://github.com/crimera/revanced-integrations/commit/e61bf338f0b16c818374d785ee5ac0b45adfa23f)) + # [1.3.0](https://github.com/crimera/revanced-integrations/compare/v1.2.1...v1.3.0) (2024-03-03) diff --git a/gradle.properties b/gradle.properties index aa65a4e820..0c3983d029 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true android.useAndroidX = true -version = 1.3.0 +version = 1.4.0-dev.1 From ea83f3f9872320140260030fcee3b9347db001da Mon Sep 17 00:00:00 2001 From: crimera <44558091+crimera@users.noreply.github.com> Date: Mon, 4 Mar 2024 00:09:13 +0800 Subject: [PATCH 05/11] ci: Try disabling signing --- app/build.gradle.kts | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 69489b444e..48aba57149 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -55,21 +55,21 @@ dependencies { tasks { // Because the signing plugin doesn't support signing APKs, do it manually. - register("sign") { - group = "signing" - - dependsOn(build) - - doLast { - val outputDirectory = layout.buildDirectory.dir("outputs/apk/release").get().asFile - val integrationsApk = outputDirectory.resolve("${rootProject.name}-$version.apk") - - org.gradle.security.internal.gnupg.GnupgSignatoryFactory().createSignatory(project).sign( - integrationsApk.inputStream(), - outputDirectory.resolve("${integrationsApk.name}.asc").outputStream(), - ) - } - } +// register("sign") { +// group = "signing" +// +// dependsOn(build) +// +// doLast { +// val outputDirectory = layout.buildDirectory.dir("outputs/apk/release").get().asFile +// val integrationsApk = outputDirectory.resolve("${rootProject.name}-$version.apk") +// +// org.gradle.security.internal.gnupg.GnupgSignatoryFactory().createSignatory(project).sign( +// integrationsApk.inputStream(), +// outputDirectory.resolve("${integrationsApk.name}.asc").outputStream(), +// ) +// } +// } // Needed by gradle-semantic-release-plugin. // Tracking: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435 From cd1c1435d6782eea43c8b214fe8dfbcfa31678f9 Mon Sep 17 00:00:00 2001 From: dic1911 Date: Fri, 23 Feb 2024 14:11:39 +0800 Subject: [PATCH 06/11] feat: (Twitter/X) no t.co links --- .../patches/links/UnshortenUrlsPatch.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 app/src/main/java/app/revanced/integrations/twitter/patches/links/UnshortenUrlsPatch.java diff --git a/app/src/main/java/app/revanced/integrations/twitter/patches/links/UnshortenUrlsPatch.java b/app/src/main/java/app/revanced/integrations/twitter/patches/links/UnshortenUrlsPatch.java new file mode 100644 index 0000000000..fde5f8e997 --- /dev/null +++ b/app/src/main/java/app/revanced/integrations/twitter/patches/links/UnshortenUrlsPatch.java @@ -0,0 +1,30 @@ +package app.revanced.integrations.twitter.patches.links; + +import android.content.Context; +import android.content.Intent; +import android.util.Log; + +import java.lang.reflect.Field; + +public final class UnshortenUrlsPatch { + private static final String TAG = "030-unshort"; + public static void unshort(Object entity) { + try { + String className = "com.twitter.model.json.core.JsonUrlEntity"; // Replace with your fully qualified class name + Class clazz = Class.forName(className); + + if (!clazz.isInstance(entity)) { + return; + } + + clazz.cast(entity); + Field c = clazz.getDeclaredField("c"); + Field e = clazz.getDeclaredField("e"); + + String cValue = (String) c.get(entity); + e.set(entity, cValue); + } catch (Exception ex) { + Log.e(TAG, ";-;", ex); + } + } +} \ No newline at end of file From c2e6203d5237be3f6efc8e23a1e28fd05e1bb082 Mon Sep 17 00:00:00 2001 From: dic1911 Date: Thu, 15 Feb 2024 13:57:39 +0800 Subject: [PATCH 07/11] feat: add helper method for opening chooser --- .../patch/browserchooser/BrowserChooserHook.kt | 10 ++++++++++ .../twitter/patches/hook/twifucker/TwiFucker.kt | 14 ++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/browserchooser/BrowserChooserHook.kt 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 new file mode 100644 index 0000000000..b79d0ef42e --- /dev/null +++ b/app/src/main/java/app/revanced/integrations/twitter/patches/hook/patch/browserchooser/BrowserChooserHook.kt @@ -0,0 +1,10 @@ +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/twifucker/TwiFucker.kt b/app/src/main/java/app/revanced/integrations/twitter/patches/hook/twifucker/TwiFucker.kt index 3e0f7550b6..b21b16ca79 100644 --- 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 @@ -1,5 +1,8 @@ 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 @@ -210,6 +213,17 @@ internal object TwiFucker { 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) From 4ca14add9934c711a55e2294095afa7c2ff20d54 Mon Sep 17 00:00:00 2001 From: dic1911 Date: Fri, 23 Feb 2024 15:08:18 +0800 Subject: [PATCH 08/11] fix open chooser when opening links for twitter --- .../patches/links/OpenLinksWithAppChooserPatch.java | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 app/src/main/java/app/revanced/integrations/twitter/patches/links/OpenLinksWithAppChooserPatch.java diff --git a/app/src/main/java/app/revanced/integrations/twitter/patches/links/OpenLinksWithAppChooserPatch.java b/app/src/main/java/app/revanced/integrations/twitter/patches/links/OpenLinksWithAppChooserPatch.java new file mode 100644 index 0000000000..0c391c633d --- /dev/null +++ b/app/src/main/java/app/revanced/integrations/twitter/patches/links/OpenLinksWithAppChooserPatch.java @@ -0,0 +1,11 @@ +package app.revanced.integrations.twitter.patches.links; + +import android.content.Context; +import android.content.Intent; + +public final class OpenLinksWithAppChooserPatch { + public static void openWithChooser(final Context context, final Intent originalIntent) { + final Intent intent = new Intent("android.intent.action.VIEW", originalIntent.getData()); + context.startActivity(Intent.createChooser(intent, null)); + } +} From 5e300ba7cf60ac3dc5b6f1abfacc68bf5eed2fe6 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 3 Mar 2024 15:50:43 +0000 Subject: [PATCH 09/11] chore(release): 1.4.0-dev.1 [skip ci] # [1.4.0-dev.1](https://github.com/crimera/revanced-integrations/compare/v1.3.0...v1.4.0-dev.1) (2024-03-03) ### Features * (Twitter/X) no t.co links ([37b45c0](https://github.com/crimera/revanced-integrations/commit/37b45c0cb2bba3f353a8d89567fa196ba4b7d53c)) * add helper method for opening chooser ([e61bf33](https://github.com/crimera/revanced-integrations/commit/e61bf338f0b16c818374d785ee5ac0b45adfa23f)) --- CHANGELOG.md | 8 ++++++++ gradle.properties | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 415a83c4c6..0d1ce44b4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# [1.4.0-dev.1](https://github.com/crimera/revanced-integrations/compare/v1.3.0...v1.4.0-dev.1) (2024-03-03) + + +### Features + +* (Twitter/X) no t.co links ([37b45c0](https://github.com/crimera/revanced-integrations/commit/37b45c0cb2bba3f353a8d89567fa196ba4b7d53c)) +* add helper method for opening chooser ([e61bf33](https://github.com/crimera/revanced-integrations/commit/e61bf338f0b16c818374d785ee5ac0b45adfa23f)) + # [1.3.0](https://github.com/crimera/revanced-integrations/compare/v1.2.1...v1.3.0) (2024-03-03) diff --git a/gradle.properties b/gradle.properties index aa65a4e820..0c3983d029 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true android.useAndroidX = true -version = 1.3.0 +version = 1.4.0-dev.1 From acbe255de181eac9e5f0ba828e2f0826cf49aac9 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 3 Mar 2024 16:15:20 +0000 Subject: [PATCH 10/11] chore(release): 1.4.0-dev.2 [skip ci] # [1.4.0-dev.2](https://github.com/crimera/revanced-integrations/compare/v1.4.0-dev.1...v1.4.0-dev.2) (2024-03-03) ### Features * (Twitter/X) no t.co links ([cd1c143](https://github.com/crimera/revanced-integrations/commit/cd1c1435d6782eea43c8b214fe8dfbcfa31678f9)) * add helper method for opening chooser ([c2e6203](https://github.com/crimera/revanced-integrations/commit/c2e6203d5237be3f6efc8e23a1e28fd05e1bb082)) --- CHANGELOG.md | 8 ++++++++ gradle.properties | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d1ce44b4b..3750427b9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# [1.4.0-dev.2](https://github.com/crimera/revanced-integrations/compare/v1.4.0-dev.1...v1.4.0-dev.2) (2024-03-03) + + +### Features + +* (Twitter/X) no t.co links ([cd1c143](https://github.com/crimera/revanced-integrations/commit/cd1c1435d6782eea43c8b214fe8dfbcfa31678f9)) +* add helper method for opening chooser ([c2e6203](https://github.com/crimera/revanced-integrations/commit/c2e6203d5237be3f6efc8e23a1e28fd05e1bb082)) + # [1.4.0-dev.1](https://github.com/crimera/revanced-integrations/compare/v1.3.0...v1.4.0-dev.1) (2024-03-03) diff --git a/gradle.properties b/gradle.properties index 0c3983d029..ddfdc2adcd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.parallel = true org.gradle.caching = true android.useAndroidX = true -version = 1.4.0-dev.1 +version = 1.4.0-dev.2 From 10d1e2cce4d2604d75ca7dd683e48fcfa5d4c58e Mon Sep 17 00:00:00 2001 From: crimera <44558091+crimera@users.noreply.github.com> Date: Mon, 4 Mar 2024 00:17:25 +0800 Subject: [PATCH 11/11] ci: Remove sign task --- app/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 48aba57149..f180978d99 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -75,6 +75,6 @@ tasks { // Tracking: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435 publish { dependsOn(build) - dependsOn("sign") +// dependsOn("sign") } }