Skip to content

Commit

Permalink
Merge pull request #2 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 3, 2024
2 parents 2e9797c + 10d1e2c commit 74175f7
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 17 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)


Expand Down
32 changes: 16 additions & 16 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
Original file line number Diff line number Diff line change
@@ -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)
}
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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));
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 74175f7

Please sign in to comment.