Skip to content
This repository has been archived by the owner on Oct 26, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'upstream/dev' into feat_reorganize_sett…
Browse files Browse the repository at this point in the history
…ings
  • Loading branch information
LisoUseInAIKyrios committed Feb 21, 2024
2 parents 2225fd1 + 9b23f77 commit 28bf153
Show file tree
Hide file tree
Showing 44 changed files with 245 additions and 300 deletions.
15 changes: 5 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
/.idea
/.vscode
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
/.idea
/.vscode
/*.log
node_modules
local.properties
node_modules
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [1.4.0-dev.4](https://github.com/ReVanced/revanced-integrations/compare/v1.4.0-dev.3...v1.4.0-dev.4) (2024-02-21)


### Features

* **X:** Add `Open links as query` patch ([#570](https://github.com/ReVanced/revanced-integrations/issues/570)) ([95ca632](https://github.com/ReVanced/revanced-integrations/commit/95ca632d40b90ea8160dbbf33fd5d7f2281cf711))

# [1.4.0-dev.3](https://github.com/ReVanced/revanced-integrations/compare/v1.4.0-dev.2...v1.4.0-dev.3) (2024-02-13)


Expand Down
2 changes: 1 addition & 1 deletion app/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/build
/build
51 changes: 32 additions & 19 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin)
}

android {
compileSdk = 33
namespace = "app.revanced.integrations"
compileSdk = 33

applicationVariants.all {
outputs.all {
this as com.android.build.gradle.internal.api.ApkVariantOutputImpl

outputFileName = "${rootProject.name}-$versionName.apk"
}
}

defaultConfig {
applicationId = "app.revanced.integrations"
Expand All @@ -20,32 +28,37 @@ android {
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
"proguard-rules.pro",
)
}
applicationVariants.all {
outputs.all {
this as com.android.build.gradle.internal.api.ApkVariantOutputImpl

outputFileName = "${rootProject.name}-$versionName.apk"
}
}
}

compileOptions {
sourceCompatibility(JavaVersion.VERSION_11)
targetCompatibility(JavaVersion.VERSION_11)
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}
}

dependencies {
compileOnly(project(mapOf("path" to ":dummy")))
compileOnly("androidx.annotation:annotation:1.7.0")
compileOnly("androidx.appcompat:appcompat:1.7.0-alpha03")
compileOnly("com.squareup.okhttp3:okhttp:5.0.0-alpha.11")
compileOnly("com.squareup.retrofit2:retrofit:2.9.0")
compileOnly(libs.appcompat)
compileOnly(libs.annotation)
compileOnly(libs.okhttp)
compileOnly(libs.retrofit)

compileOnly(project(":stub"))
}

tasks.register("publish") { dependsOn("build") }
tasks {
// Needed by gradle-semantic-release-plugin.
// Tracking: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435
register("publish") {
group = "publishing"
description = "Publishes all publications produced by this project."

dependsOn(build)
}
}
23 changes: 1 addition & 22 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,27 +1,6 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-dontobfuscate
-dontoptimize
-keepattributes * # https://www.guardsquare.com/manual/configuration/attributes
-keepattributes *
-keep class app.revanced.** {
*;
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class AppCompatActivityHook {
public static void startSettingsActivity() {
Logger.printDebug(() -> "Launching ReVanced settings");

final var context = app.revanced.integrations.shared.Utils.getContext();
final var context = Utils.getContext();

if (context != null) {
Intent intent = new Intent(context, SettingsActivity.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import org.json.JSONObject
// https://raw.githubusercontent.com/Dr-TSNG/TwiFucker/880cdf1c1622e54ab45561ffcb4f53d94ed97bae/app/src/main/java/icu/nullptr/twifucker/hook/JsonHook.kt
internal object TwiFucker {
// root
private fun JSONObject.jsonGetInstructions(): JSONArray? =
optJSONObject("timeline")?.optJSONArray("instructions")
private fun JSONObject.jsonGetInstructions(): JSONArray? = optJSONObject("timeline")?.optJSONArray("instructions")

private fun JSONObject.jsonGetData(): JSONObject? = optJSONObject("data")

Expand Down Expand Up @@ -42,10 +41,11 @@ internal object TwiFucker {

// data
private fun JSONObject.dataGetInstructions(): JSONArray? {
val timeline = optJSONObject("user_result")?.optJSONObject("result")
?.optJSONObject("timeline_response")?.optJSONObject("timeline")
?: optJSONObject("timeline_response")?.optJSONObject("timeline")
?: optJSONObject("timeline_response")
val timeline =
optJSONObject("user_result")?.optJSONObject("result")
?.optJSONObject("timeline_response")?.optJSONObject("timeline")
?: optJSONObject("timeline_response")?.optJSONObject("timeline")
?: optJSONObject("timeline_response")
return timeline?.optJSONArray("instructions")
}

Expand All @@ -64,7 +64,6 @@ internal object TwiFucker {
}
}?.optJSONObject("legacy")


// entry
private fun JSONObject.entryHasPromotedMetadata(): Boolean =
optJSONObject("content")?.optJSONObject("item")?.optJSONObject("content")
Expand All @@ -77,11 +76,9 @@ internal object TwiFucker {
optJSONObject("content")?.optJSONArray("items")
?: optJSONObject("content")?.optJSONObject("timelineModule")?.optJSONArray("items")

private fun JSONObject.entryIsTweetDetailRelatedTweets(): Boolean =
optString("entryId").startsWith("tweetdetailrelatedtweets-")
private fun JSONObject.entryIsTweetDetailRelatedTweets(): Boolean = optString("entryId").startsWith("tweetdetailrelatedtweets-")

private fun JSONObject.entryGetTrends(): JSONArray? =
optJSONObject("content")?.optJSONObject("timelineModule")?.optJSONArray("items")
private fun JSONObject.entryGetTrends(): JSONArray? = optJSONObject("content")?.optJSONObject("timelineModule")?.optJSONArray("items")

// trend
private fun JSONObject.trendHasPromotedMetadata(): Boolean =
Expand All @@ -104,8 +101,7 @@ internal object TwiFucker {
// instruction
private fun JSONObject.instructionTimelineAddEntries(): JSONArray? = optJSONArray("entries")

private fun JSONObject.instructionGetAddEntries(): JSONArray? =
optJSONObject("addEntries")?.optJSONArray("entries")
private fun JSONObject.instructionGetAddEntries(): JSONArray? = optJSONObject("addEntries")?.optJSONArray("entries")

private fun JSONObject.instructionCheckAndRemove(action: (JSONArray) -> Unit) {
instructionTimelineAddEntries()?.let(action)
Expand Down Expand Up @@ -164,9 +160,10 @@ internal object TwiFucker {
entriesRemoveTweetDetailRelatedTweets()
}

private fun JSONObject.entryIsWhoToFollow(): Boolean = optString("entryId").let {
it.startsWith("whoToFollow-") || it.startsWith("who-to-follow-") || it.startsWith("connect-module-")
}
private fun JSONObject.entryIsWhoToFollow(): Boolean =
optString("entryId").let {
it.startsWith("whoToFollow-") || it.startsWith("who-to-follow-") || it.startsWith("connect-module-")
}

private fun JSONObject.itemContainsPromotedUser(): Boolean =
optJSONObject("item")?.optJSONObject("content")
Expand Down Expand Up @@ -217,4 +214,4 @@ internal object TwiFucker {
instruction.instructionCheckAndRemove(action)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
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 intent) {
intent.setAction("android.intent.action.VIEW");

context.startActivity(Intent.createChooser(intent, null));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ private static class VerifiedQualities {
private static final int CACHE_LIMIT = 1000;

@Override
protected boolean removeEldestEntry(Map.Entry eldest) {
protected boolean removeEldestEntry(Entry eldest) {
return size() > CACHE_LIMIT; // Evict the oldest entry if over the cache limit.
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ private static boolean videoIdIsSame(@Nullable ReturnYouTubeDislike fetch, @Null
*
* Called when the user likes or dislikes.
*
* @param vote int that matches {@link ReturnYouTubeDislike.Vote#value}
* @param vote int that matches {@link Vote#value}
*/
public static void sendVote(int vote) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public final class ReturnYouTubeDislikeFilterPatch extends Filter {
private static final int NUMBER_OF_LAST_VIDEO_IDS_TO_TRACK = 5;

@Override
protected boolean removeEldestEntry(Map.Entry eldest) {
protected boolean removeEldestEntry(Entry eldest) {
return size() > NUMBER_OF_LAST_VIDEO_IDS_TO_TRACK;
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

public class Route {
private final String route;
private final Route.Method method;
private final Method method;
private final int paramCount;

public Route(Route.Method method, String route) {
public Route(Method method, String route) {
this.method = method;
this.route = route;
this.paramCount = countMatches(route, '{');
Expand All @@ -14,11 +14,11 @@ public Route(Route.Method method, String route) {
throw new IllegalArgumentException("Not enough parameters");
}

public Route.Method getMethod() {
public Method getMethod() {
return method;
}

public Route.CompiledRoute compile(String... params) {
public CompiledRoute compile(String... params) {
if (params.length != paramCount)
throw new IllegalArgumentException("Error compiling route [" + route + "], incorrect amount of parameters provided. " +
"Expected: " + paramCount + ", provided: " + params.length);
Expand All @@ -29,7 +29,7 @@ public Route.CompiledRoute compile(String... params) {
int paramEnd = compiledRoute.indexOf("}");
compiledRoute.replace(paramStart, paramEnd + 1, params[i]);
}
return new Route.CompiledRoute(this, compiledRoute.toString());
return new CompiledRoute(this, compiledRoute.toString());
}

public static class CompiledRoute {
Expand All @@ -45,7 +45,7 @@ public String getCompiledRoute() {
return compiledRoute;
}

public Route.Method getMethod() {
public Method getMethod() {
return baseRoute.method;
}
}
Expand Down
31 changes: 4 additions & 27 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,28 +1,5 @@
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:8.0.2")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20")
}
}

allprojects {
repositories {
google()
maven { url = uri("https://jitpack.io") }
mavenCentral()
}
}

// Tracking issue https://github.com/semantic-release/semantic-release/issues/963
tasks.register("publish", DefaultTask::class) {
group = "publish"
description = "Dummy publish to pass the verification phase of the gradle-semantic-release-plugin"
}

tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin) apply false
}
4 changes: 0 additions & 4 deletions dummy/src/main/AndroidManifest.xml

This file was deleted.

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.4.0-dev.3
version = 1.4.0-dev.4
18 changes: 18 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[versions]
agp = "8.2.2"
annotation = "1.7.1"
kotlin = "1.9.22"
appcompat = "1.7.0-alpha03"
okhttp = "5.0.0-alpha.12"
retrofit = "2.9.0"

[libraries]
annotation = { module = "androidx.annotation:annotation", version.ref = "annotation" }
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
kotlin = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionSha256Sum=9631d53cf3e74bfa726893aee1f8994fee4e060c401335946dba2156f440f24c
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dist
zipStorePath=wrapper/dists
Loading

0 comments on commit 28bf153

Please sign in to comment.