diff --git a/CHANGELOG.md b/CHANGELOG.md index 415a83c4c6..3750427b9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,19 @@ +# [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) + + +### 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/app/build.gradle.kts b/app/build.gradle.kts index 69489b444e..f180978d99 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -55,26 +55,26 @@ 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 publish { dependsOn(build) - dependsOn("sign") +// dependsOn("sign") } } 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) 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)); + } +} 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 diff --git a/gradle.properties b/gradle.properties index aa65a4e820..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.3.0 +version = 1.4.0-dev.2