Compare commits

...

33 Commits

Author SHA1 Message Date
semantic-release-bot
fb3cd9a3ad chore(release): 2.195.0 [skip ci]
# [2.195.0](https://github.com/ReVanced/revanced-patches/compare/v2.194.0...v2.195.0) (2023-10-20)

### Bug Fixes

* Indent option description correctly ([0dc0676](0dc06768d9))
* **Reddit - Sanitize sharing links:** Restore compatibility with newer versions of the app ([c14642a](c14642a34b))
* **YouTube - Hide layout components:** Hide new channel watermark component ([5184422](51844222c8))

### Features

* **YouTube - Theme:** Disable gradient loading screen ([daf125a](daf125a863))
* **YouTube:** Add `Announcements` patch ([#3166](https://github.com/ReVanced/revanced-patches/issues/3166)) ([8718517](87185171da))
* **YouTube:** Add `Spoof device dimensions` patch ([b5a7258](b5a7258f74))
2023-10-20 01:26:08 +00:00
oSumAtrIX
2a047ed1b6 chore: Merge branch dev to main (#3140) 2023-10-20 03:22:27 +02:00
semantic-release-bot
0d1ab25cb5 chore(release): 2.195.0-dev.5 [skip ci]
# [2.195.0-dev.5](https://github.com/ReVanced/revanced-patches/compare/v2.195.0-dev.4...v2.195.0-dev.5) (2023-10-20)

### Features

* **YouTube:** Add `Announcements` patch ([#3166](https://github.com/ReVanced/revanced-patches/issues/3166)) ([8718517](87185171da))
2023-10-20 01:17:24 +00:00
oSumAtrIX
87185171da feat(YouTube): Add Announcements patch (#3166) 2023-10-20 03:13:52 +02:00
semantic-release-bot
d9c3748314 chore(release): 2.195.0-dev.4 [skip ci]
# [2.195.0-dev.4](https://github.com/ReVanced/revanced-patches/compare/v2.195.0-dev.3...v2.195.0-dev.4) (2023-10-19)

### Bug Fixes

* **Reddit - Sanitize sharing links:** Restore compatibility with newer versions of the app ([c14642a](c14642a34b))
2023-10-19 15:07:41 +00:00
oSumAtrIX
c14642a34b fix(Reddit - Sanitize sharing links): Restore compatibility with newer versions of the app 2023-10-19 17:04:53 +02:00
semantic-release-bot
af2df3edd9 chore(release): 2.195.0-dev.3 [skip ci]
# [2.195.0-dev.3](https://github.com/ReVanced/revanced-patches/compare/v2.195.0-dev.2...v2.195.0-dev.3) (2023-10-19)

### Features

* **YouTube:** Add `Spoof device dimensions` patch ([b5a7258](b5a7258f74))
2023-10-19 01:10:15 +00:00
oSumAtrIX
b5a7258f74 feat(YouTube): Add Spoof device dimensions patch 2023-10-19 03:06:58 +02:00
LisoUseInAIKyrios
28fa499974 chore: fix typo 2023-10-14 14:27:27 +03:00
semantic-release-bot
5fa89b6846 chore(release): 2.195.0-dev.2 [skip ci]
# [2.195.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v2.195.0-dev.1...v2.195.0-dev.2) (2023-10-14)

### Bug Fixes

* Indent option description correctly ([0dc0676](0dc06768d9))
2023-10-14 10:18:19 +00:00
LisoUseInAIKyrios
9588a47880 chore: fix build 2023-10-14 13:14:46 +03:00
oSumAtrIX
0dc06768d9 fix: Indent option description correctly 2023-10-14 05:46:24 +02:00
oSumAtrIX
a04232ea91 build: Publish artifacts on Jitpack 2023-10-14 04:50:43 +02:00
semantic-release-bot
49b47fa772 chore(release): 2.195.0-dev.1 [skip ci]
# [2.195.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v2.194.1-dev.1...v2.195.0-dev.1) (2023-10-13)

### Features

* **YouTube - Theme:** Disable gradient loading screen ([daf125a](daf125a863))
2023-10-13 23:03:12 +00:00
oSumAtrIX
daf125a863 feat(YouTube - Theme): Disable gradient loading screen 2023-10-14 01:00:26 +02:00
oSumAtrIX
9121e0519b refactor: Only check literal instead of additionally the opcode 2023-10-14 00:59:58 +02:00
semantic-release-bot
b352f48cb1 chore(release): 2.194.1-dev.1 [skip ci]
## [2.194.1-dev.1](https://github.com/ReVanced/revanced-patches/compare/v2.194.0...v2.194.1-dev.1) (2023-10-13)

### Bug Fixes

* **YouTube - Hide layout components:** Hide new channel watermark component ([5184422](51844222c8))
2023-10-13 15:16:58 +00:00
oSumAtrIX
51844222c8 fix(YouTube - Hide layout components): Hide new channel watermark component 2023-10-13 17:14:05 +02:00
semantic-release-bot
87877a8f2f chore(release): 2.194.0 [skip ci]
# [2.194.0](https://github.com/ReVanced/revanced-patches/compare/v2.193.0...v2.194.0) (2023-10-12)

### Bug Fixes

* Fix builds ([8c53a6a](8c53a6ab82))
* **YouTube - ReturnYouTubeDislike:** Fix dislikes not showing on Shorts ([#3133](https://github.com/ReVanced/revanced-patches/issues/3133)) ([44e35bf](44e35bf8aa))
* **YouTube - Spoof app version:** Recommend clearing the app data after turning off spoofing ([#3134](https://github.com/ReVanced/revanced-patches/issues/3134)) ([99cf7ca](99cf7ca173))

### Features

* **CieID:** Add `bypass root check` patch ([#3011](https://github.com/ReVanced/revanced-patches/issues/3011)) ([c1df94a](c1df94ae0b))
* Do not support reading options from a properties file ([ab84dc7](ab84dc78b9))
* Improve option descriptions and titles ([be5df4d](be5df4d076))
2023-10-12 21:27:33 +00:00
oSumAtrIX
bff07aa5b8 chore: Merge branch dev to main (#3123) 2023-10-12 23:24:21 +02:00
semantic-release-bot
c575751dd4 chore(release): 2.194.0-dev.3 [skip ci]
# [2.194.0-dev.3](https://github.com/ReVanced/revanced-patches/compare/v2.194.0-dev.2...v2.194.0-dev.3) (2023-10-12)

### Bug Fixes

* Fix builds ([8c53a6a](8c53a6ab82))

### Features

* **CieID:** Add `bypass root check` patch ([#3011](https://github.com/ReVanced/revanced-patches/issues/3011)) ([c1df94a](c1df94ae0b))
2023-10-12 19:52:02 +00:00
oSumAtrIX
8c53a6ab82 fix: Fix builds 2023-10-12 21:49:13 +02:00
Gioele Pannetto
c1df94ae0b feat(CieID): Add bypass root check patch (#3011)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-10-12 20:05:27 +02:00
LisoUseInAIKyrios
f8c0286b15 chore(YouTube - ReturnYouTubeDislike): Adjust UI disclaimer from 'will' to 'may' 2023-10-12 14:10:39 +03:00
semantic-release-bot
d59431ed74 chore(release): 2.194.0-dev.2 [skip ci]
# [2.194.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v2.194.0-dev.1...v2.194.0-dev.2) (2023-10-12)

### Bug Fixes

* **YouTube - ReturnYouTubeDislike:** Fix dislikes not showing on Shorts ([#3133](https://github.com/ReVanced/revanced-patches/issues/3133)) ([44e35bf](44e35bf8aa))
2023-10-12 09:30:40 +00:00
LisoUseInAIKyrios
44e35bf8aa fix(YouTube - ReturnYouTubeDislike): Fix dislikes not showing on Shorts (#3133) 2023-10-12 12:27:49 +03:00
semantic-release-bot
1d90346f19 chore(release): 2.194.0-dev.1 [skip ci]
# [2.194.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v2.193.1-dev.2...v2.194.0-dev.1) (2023-10-12)

### Features

* Do not support reading options from a properties file ([ab84dc7](ab84dc78b9))
* Improve option descriptions and titles ([be5df4d](be5df4d076))
2023-10-12 00:20:18 +00:00
oSumAtrIX
ab84dc78b9 feat: Do not support reading options from a properties file
Previously needed because patch options could not be used comfortably in ReVanced Manager.
2023-10-12 02:16:34 +02:00
oSumAtrIX
be5df4d076 feat: Improve option descriptions and titles 2023-10-12 02:16:34 +02:00
semantic-release-bot
f73594c7e2 chore(release): 2.193.1-dev.2 [skip ci]
## [2.193.1-dev.2](https://github.com/ReVanced/revanced-patches/compare/v2.193.1-dev.1...v2.193.1-dev.2) (2023-10-11)

### Bug Fixes

* **YouTube - Spoof app version:** Recommend clearing the app data after turning off spoofing ([#3134](https://github.com/ReVanced/revanced-patches/issues/3134)) ([99cf7ca](99cf7ca173))
2023-10-11 20:19:31 +00:00
LisoUseInAIKyrios
99cf7ca173 fix(YouTube - Spoof app version): Recommend clearing the app data after turning off spoofing (#3134) 2023-10-11 23:16:13 +03:00
semantic-release-bot
6ad9225f3e chore(release): 2.193.1-dev.1 [skip ci]
## [2.193.1-dev.1](https://github.com/ReVanced/revanced-patches/compare/v2.193.0...v2.193.1-dev.1) (2023-10-09)
2023-10-09 16:58:22 +00:00
oSumAtrIX
540e6d63d1 build(Needs bump): Use artifacts from Jitpack 2023-10-09 18:54:59 +02:00
29 changed files with 519 additions and 223 deletions

View File

@@ -1,3 +1,113 @@
# [2.195.0](https://github.com/ReVanced/revanced-patches/compare/v2.194.0...v2.195.0) (2023-10-20)
### Bug Fixes
* Indent option description correctly ([d4a9ea1](https://github.com/ReVanced/revanced-patches/commit/d4a9ea1f6c7ab9d25fd60695cce0965c7b5269a4))
* **Reddit - Sanitize sharing links:** Restore compatibility with newer versions of the app ([1671d8d](https://github.com/ReVanced/revanced-patches/commit/1671d8d826a08273fae5ccffc4a4ebfef9648fe2))
* **YouTube - Hide layout components:** Hide new channel watermark component ([cbfd569](https://github.com/ReVanced/revanced-patches/commit/cbfd5691d31ed144eac1d23de918ab5a6a905dfa))
### Features
* **YouTube - Theme:** Disable gradient loading screen ([90d5877](https://github.com/ReVanced/revanced-patches/commit/90d5877950095b7abacdca979bc7ad709192eee2))
* **YouTube:** Add `Announcements` patch ([#3166](https://github.com/ReVanced/revanced-patches/issues/3166)) ([f977983](https://github.com/ReVanced/revanced-patches/commit/f97798391ffc3477f781d43817664d31cfcd209a))
* **YouTube:** Add `Spoof device dimensions` patch ([c8d409e](https://github.com/ReVanced/revanced-patches/commit/c8d409e1dbda6ac45fef01912ce7afad1022b4b7))
# [2.195.0-dev.5](https://github.com/ReVanced/revanced-patches/compare/v2.195.0-dev.4...v2.195.0-dev.5) (2023-10-20)
### Features
* **YouTube:** Add `Announcements` patch ([#3166](https://github.com/ReVanced/revanced-patches/issues/3166)) ([f977983](https://github.com/ReVanced/revanced-patches/commit/f97798391ffc3477f781d43817664d31cfcd209a))
# [2.195.0-dev.4](https://github.com/ReVanced/revanced-patches/compare/v2.195.0-dev.3...v2.195.0-dev.4) (2023-10-19)
### Bug Fixes
* **Reddit - Sanitize sharing links:** Restore compatibility with newer versions of the app ([1671d8d](https://github.com/ReVanced/revanced-patches/commit/1671d8d826a08273fae5ccffc4a4ebfef9648fe2))
# [2.195.0-dev.3](https://github.com/ReVanced/revanced-patches/compare/v2.195.0-dev.2...v2.195.0-dev.3) (2023-10-19)
### Features
* **YouTube:** Add `Spoof device dimensions` patch ([c8d409e](https://github.com/ReVanced/revanced-patches/commit/c8d409e1dbda6ac45fef01912ce7afad1022b4b7))
# [2.195.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v2.195.0-dev.1...v2.195.0-dev.2) (2023-10-14)
### Bug Fixes
* Indent option description correctly ([d4a9ea1](https://github.com/ReVanced/revanced-patches/commit/d4a9ea1f6c7ab9d25fd60695cce0965c7b5269a4))
# [2.195.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v2.194.1-dev.1...v2.195.0-dev.1) (2023-10-13)
### Features
* **YouTube - Theme:** Disable gradient loading screen ([90d5877](https://github.com/ReVanced/revanced-patches/commit/90d5877950095b7abacdca979bc7ad709192eee2))
## [2.194.1-dev.1](https://github.com/ReVanced/revanced-patches/compare/v2.194.0...v2.194.1-dev.1) (2023-10-13)
### Bug Fixes
* **YouTube - Hide layout components:** Hide new channel watermark component ([cbfd569](https://github.com/ReVanced/revanced-patches/commit/cbfd5691d31ed144eac1d23de918ab5a6a905dfa))
# [2.194.0](https://github.com/ReVanced/revanced-patches/compare/v2.193.0...v2.194.0) (2023-10-12)
### Bug Fixes
* Fix builds ([d7b8149](https://github.com/ReVanced/revanced-patches/commit/d7b8149b0a8dad4e2c201b2f514d298bc6b97f54))
* **YouTube - ReturnYouTubeDislike:** Fix dislikes not showing on Shorts ([#3133](https://github.com/ReVanced/revanced-patches/issues/3133)) ([0e8a286](https://github.com/ReVanced/revanced-patches/commit/0e8a2868e8e4328a6f02fa31537abc5e5ed220eb))
* **YouTube - Spoof app version:** Recommend clearing the app data after turning off spoofing ([#3134](https://github.com/ReVanced/revanced-patches/issues/3134)) ([166bf5b](https://github.com/ReVanced/revanced-patches/commit/166bf5b1aec5f8868b3895f7e24d2abc9037a7de))
### Features
* **CieID:** Add `bypass root check` patch ([#3011](https://github.com/ReVanced/revanced-patches/issues/3011)) ([20cfa8a](https://github.com/ReVanced/revanced-patches/commit/20cfa8a5cdebc7e81128c820a2aa01415a068320))
* Do not support reading options from a properties file ([3d1c0c1](https://github.com/ReVanced/revanced-patches/commit/3d1c0c1a958271c358755220b97b9dd92eb81d54))
* Improve option descriptions and titles ([9f86daa](https://github.com/ReVanced/revanced-patches/commit/9f86daa82271591bcaa9144d300a4810458fdd28))
# [2.194.0-dev.3](https://github.com/ReVanced/revanced-patches/compare/v2.194.0-dev.2...v2.194.0-dev.3) (2023-10-12)
### Bug Fixes
* Fix builds ([d7b8149](https://github.com/ReVanced/revanced-patches/commit/d7b8149b0a8dad4e2c201b2f514d298bc6b97f54))
### Features
* **CieID:** Add `bypass root check` patch ([#3011](https://github.com/ReVanced/revanced-patches/issues/3011)) ([20cfa8a](https://github.com/ReVanced/revanced-patches/commit/20cfa8a5cdebc7e81128c820a2aa01415a068320))
# [2.194.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v2.194.0-dev.1...v2.194.0-dev.2) (2023-10-12)
### Bug Fixes
* **YouTube - ReturnYouTubeDislike:** Fix dislikes not showing on Shorts ([#3133](https://github.com/ReVanced/revanced-patches/issues/3133)) ([0e8a286](https://github.com/ReVanced/revanced-patches/commit/0e8a2868e8e4328a6f02fa31537abc5e5ed220eb))
# [2.194.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v2.193.1-dev.2...v2.194.0-dev.1) (2023-10-12)
### Features
* Do not support reading options from a properties file ([3d1c0c1](https://github.com/ReVanced/revanced-patches/commit/3d1c0c1a958271c358755220b97b9dd92eb81d54))
* Improve option descriptions and titles ([9f86daa](https://github.com/ReVanced/revanced-patches/commit/9f86daa82271591bcaa9144d300a4810458fdd28))
## [2.193.1-dev.2](https://github.com/ReVanced/revanced-patches/compare/v2.193.1-dev.1...v2.193.1-dev.2) (2023-10-11)
### Bug Fixes
* **YouTube - Spoof app version:** Recommend clearing the app data after turning off spoofing ([#3134](https://github.com/ReVanced/revanced-patches/issues/3134)) ([166bf5b](https://github.com/ReVanced/revanced-patches/commit/166bf5b1aec5f8868b3895f7e24d2abc9037a7de))
## [2.193.1-dev.1](https://github.com/ReVanced/revanced-patches/compare/v2.193.0...v2.193.1-dev.1) (2023-10-09)
# [2.193.0](https://github.com/ReVanced/revanced-patches/compare/v2.192.0...v2.193.0) (2023-10-08)

View File

@@ -1,6 +1,9 @@
import org.gradle.kotlin.dsl.support.listFilesOrdered
plugins {
kotlin("jvm") version "1.8.20"
alias(libs.plugins.ksp)
`maven-publish`
}
group = "app.revanced"
@@ -9,13 +12,7 @@ repositories {
mavenCentral()
mavenLocal()
google()
maven {
url = uri("https://maven.pkg.github.com/revanced/revanced-patcher")
credentials {
username = project.findProperty("gpr.user") as? String ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.key") as? String ?: System.getenv("GITHUB_TOKEN")
}
}
maven { url = uri("https://jitpack.io") }
// Required for FlexVer-Java
maven {
url = uri("https://repo.sleeping.town")
@@ -33,6 +30,7 @@ dependencies {
implementation(libs.guava)
// Used in JsonGenerator.
implementation(libs.gson)
// A dependency to the Android library unfortunately fails the build, which is why this is required.
compileOnly(project("dummy"))
@@ -46,40 +44,74 @@ kotlin {
tasks {
register<DefaultTask>("generateBundle") {
description = "Generate dex files from build and bundle them in the jar file"
dependsOn(build)
doLast {
val androidHome = System.getenv("ANDROID_HOME") ?: throw GradleException("ANDROID_HOME not found")
val d8 = "${androidHome}/build-tools/33.0.1/d8"
val input = configurations.archives.get().allArtifacts.files.files.first().absolutePath
val work = layout.buildDirectory.dir("libs").get().asFile
val d8 = File(System.getenv("ANDROID_HOME")).resolve("build-tools")
.listFilesOrdered().last().resolve("d8").absolutePath
val artifacts = configurations.archives.get().allArtifacts.files.files.first().absolutePath
val workingDirectory = layout.buildDirectory.dir("libs").get().asFile
exec {
workingDir = work
commandLine = listOf(d8, input)
workingDir = workingDirectory
commandLine = listOf(d8, artifacts)
}
exec {
workingDir = work
commandLine = listOf("zip", "-u", input, "classes.dex")
workingDir = workingDirectory
commandLine = listOf("zip", "-u", artifacts, "classes.dex")
}
}
}
register<JavaExec>("generateMeta") {
description = "Generate metadata for this bundle"
dependsOn(build)
classpath = sourceSets["main"].runtimeClasspath
mainClass.set("app.revanced.meta.PatchesFileGenerator")
}
// Dummy task to fix the Gradle semantic-release plugin.
// Remove this if you forked it to support building only.
// Tracking issue: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435
register<DefaultTask>("publish") {
group = "publish"
description = "Dummy task"
dependsOn(named("generateBundle"), named("generateMeta"))
// Required to run tasks because Gradle semantic-release plugin runs the publish task.
// Tracking: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435
named("publish") {
dependsOn("generateBundle")
dependsOn("generateMeta")
}
}
publishing {
publications {
create<MavenPublication>("revanced-patches-publication") {
from(components["java"])
pom {
name = "ReVanced Patches"
description = "Patches for ReVanced."
url = "https://revanced.app"
licenses {
license {
name = "GNU General Public License v3.0"
url = "https://www.gnu.org/licenses/gpl-3.0.en.html"
}
}
developers {
developer {
id = "ReVanced"
name = "ReVanced"
email = "contact@revanced.app"
}
}
scm {
connection = "scm:git:git://github.com/revanced/revanced-patches.git"
developerConnection = "scm:git:git@github.com:revanced/revanced-patches.git"
url = "https://github.com/revanced/revanced-patches"
}
}
}
}
}

View File

@@ -1,4 +1,4 @@
org.gradle.parallel = true
org.gradle.caching = true
kotlin.code.style = official
version = 2.193.0
version = 2.195.0

View File

@@ -1,14 +1,14 @@
[versions]
revanced-patcher = "16.0.1"
revanced-patch-annotation-processor = "16.0.1"
revanced-patcher = "17.0.0"
revanced-patch-annotation-processor = "17.0.0"
ksp = "1.9.0-1.0.11"
smali = "3.0.3"
guava = "32.1.2-jre"
gson = "2.10.1"
[libraries]
revanced-patcher = { module = "app.revanced:revanced-patcher", version.ref = "revanced-patcher" }
revanced-patch-annotation-processor = { module = "app.revanced:revanced-patch-annotation-processor", version.ref = "revanced-patch-annotation-processor" }
revanced-patcher = { module = "app.revanced.revanced-patcher:revanced-patcher", version.ref = "revanced-patcher" }
revanced-patch-annotation-processor = { module = "app.revanced.revanced-patcher:revanced-patch-annotation-processor", version.ref = "revanced-patch-annotation-processor" }
smali = { module = "com.android.tools.smali:smali", version.ref = "smali" }
guava = { module = "com.google.guava:guava", version.ref = "guava" }
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }

File diff suppressed because one or more lines are too long

View File

@@ -7,7 +7,6 @@ import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.util.proxy.mutableTypes.MutableClass
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.Method
import com.android.tools.smali.dexlib2.iface.instruction.WideLiteralInstruction
import com.android.tools.smali.dexlib2.util.MethodUtil
@@ -58,38 +57,38 @@ fun MutableMethod.injectHideViewCall(
)
/**
* Find the index of the first constant instruction with the id of the given resource name.
* Find the index of the first instruction with the id of the given resource name.
*
* @param resourceName the name of the resource to find the id for.
* @return the index of the first constant instruction with the id of the given resource name, or -1 if not found.
* @return the index of the first instruction with the id of the given resource name, or -1 if not found.
*/
fun Method.findIndexForIdResource(resourceName: String): Int {
fun getIdResourceId(resourceName: String) = ResourceMappingPatch.resourceMappings.single {
it.type == "id" && it.name == resourceName
}.id
return indexOfFirstConstantInstructionValue(getIdResourceId(resourceName))
return indexOfFirstWideLiteralInstructionValue(getIdResourceId(resourceName))
}
/**
* Find the index of the first constant instruction with the given value.
* Find the index of the first wide literal instruction with the given value.
*
* @return the first constant instruction with the value, or -1 if not found.
* @return the first literal instruction with the value, or -1 if not found.
*/
fun Method.indexOfFirstConstantInstructionValue(constantValue: Long) = implementation?.let {
fun Method.indexOfFirstWideLiteralInstructionValue(literal: Long) = implementation?.let {
it.instructions.indexOfFirst { instruction ->
instruction.opcode == Opcode.CONST && (instruction as WideLiteralInstruction).wideLiteral == constantValue
(instruction as? WideLiteralInstruction)?.wideLiteral == literal
}
} ?: -1
/**
* Check if the method contains a constant with the given value.
* Check if the method contains a literal with the given value.
*
* @return if the method contains a constant with the given value.
* @return if the method contains a literal with the given value.
*/
fun Method.containsConstantInstructionValue(constantValue: Long) =
indexOfFirstConstantInstructionValue(constantValue) >= 0
fun Method.containsWideLiteralInstructionValue(literal: Long) =
indexOfFirstWideLiteralInstructionValue(literal) >= 0
/**

View File

@@ -0,0 +1,24 @@
package app.revanced.patches.cieid.restrictions.root
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.cieid.restrictions.root.fingerprints.CheckRootFingerprint
@Patch(
name = "Bypass root checks",
description = "Removes the restriction to use the app with root permissions or on a custom ROM.",
compatiblePackages = [CompatiblePackage("it.ipzs.cieid")]
)
@Suppress("unused")
object BypassRootChecksPatch : BytecodePatch(
setOf(CheckRootFingerprint)
) {
override fun execute(context: BytecodeContext) {
CheckRootFingerprint.result?.mutableMethod?.addInstruction(1, "return-void")
?: throw CheckRootFingerprint.exception
}
}

View File

@@ -0,0 +1,9 @@
package app.revanced.patches.cieid.restrictions.root.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object CheckRootFingerprint : MethodFingerprint(
customFingerprint = { methodDef, _ ->
methodDef.definingClass == "Lit/ipzs/cieid/BaseActivity;" && methodDef.name == "onResume"
}
)

View File

@@ -1,19 +1,14 @@
package app.revanced.patches.reddit.customclients
import android.os.Environment
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.options.PatchOptionException
import app.revanced.patcher.patch.options.types.StringPatchOption.Companion.stringPatchOption
import java.io.File
import java.util.*
abstract class AbstractSpoofClientPatch(
private val redirectUri: String,
redirectUri: String,
private val clientIdFingerprints: List<MethodFingerprint>,
private val userAgentFingerprints: List<MethodFingerprint>? = null,
private val miscellaneousFingerprints: List<MethodFingerprint>? = null
@@ -34,59 +29,6 @@ abstract class AbstractSpoofClientPatch(
)
override fun execute(context: BytecodeContext) {
val requiredOptions = options.values.filter { it.required }
val isAndroidButRequiredOptionsUnset = try {
Class.forName("android.os.Environment")
requiredOptions.any { it.value == null }
} catch (_: ClassNotFoundException) {
false
}
if (isAndroidButRequiredOptionsUnset) {
val properties = Properties()
val propertiesFile = File(
Environment.getExternalStorageDirectory(),
"revanced_client_spoof_${redirectUri.hashCode()}.properties"
)
if (propertiesFile.exists()) {
properties.load(propertiesFile.inputStream())
// Set options from properties file.
properties.forEach { (name, value) ->
try {
options[name.toString()] = value.toString().trim()
} catch (_: PatchOptionException.PatchOptionNotFoundException) {
// Ignore unknown options.
}
}
} else {
options.keys.forEach { properties.setProperty(it, "") }
properties.store(
propertiesFile.outputStream(),
"Options for the ReVanced \"Client Spoof\" patch. Required options: " +
requiredOptions.joinToString { it.key }
)
}
requiredOptions.filter { it.value == null }.let { requiredUnsetOptions ->
if (requiredUnsetOptions.isEmpty()) return@let
val error = """
In order to use this patch, you need to provide the following options:
${requiredUnsetOptions.joinToString("\n") { "${it.key}: ${it.description}" }}
A properties file has been created at ${propertiesFile.absolutePath}.
Please fill in the required options before using this patch.
""".trimIndent()
throw PatchException(error)
}
}
fun List<MethodFingerprint>?.executePatch(
patch: List<MethodFingerprintResult>.(BytecodeContext) -> Unit
) = this?.map { it.result ?: throw it.exception }?.patch(context)

View File

@@ -3,7 +3,7 @@ package app.revanced.patches.reddit.misc.tracking.url.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object ShareLinkFormatterFingerprint : MethodFingerprint(
returnType = "Ljava/lang/String;",
parameters = listOf("Ljava/lang/String;", "Ljava/util/Map;"),
strings = listOf("uri.getQueryParameters(name)", "uri.queryParameterNames", "newUriBuilder.build().toString()"),
customFingerprint = { methodDef, classDef ->
methodDef.definingClass.startsWith("Lcom/reddit/sharing/") && classDef.sourceFile == "UrlUtil.kt"
}
)

View File

@@ -12,7 +12,7 @@ import java.nio.file.Files
@Patch(
name = "Custom branding",
description = "Changes the YouTube launcher icon and name to your choice (defaults to ReVanced).",
description = "Changes the app icon and name to your choice (defaults to YouTube ReVanced and the ReVanced logo).",
compatiblePackages = [
CompatiblePackage("com.google.android.youtube")
],
@@ -20,19 +20,45 @@ import java.nio.file.Files
)
@Suppress("unused")
object CustomBrandingPatch : ResourcePatch() {
private val iconResourceFileNames = arrayOf(
"adaptiveproduct_youtube_background_color_108",
"adaptiveproduct_youtube_foreground_color_108",
"ic_launcher",
"ic_launcher_round"
).map { "$it.png" }.toTypedArray()
private val mipmapDirectories = arrayOf(
"xxxhdpi",
"xxhdpi",
"xhdpi",
"hdpi",
"mdpi"
).map { "mipmap-$it" }
private var appName by stringPatchOption(
key = "appName",
default = "YouTube ReVanced",
title = "Application Name",
description = "The name of the application it will show on your home screen.",
title = "App name",
description = "The name of the app.",
required = true
)
private var iconPath by stringPatchOption(
key = "iconPath",
default = null,
title = "App Icon Path",
description = "A path containing mipmap resource folders with icons."
title = "App icon path",
description = """
The path to a folder containing the following folders:
${mipmapDirectories.joinToString("\n") { "- $it" }}
Each of these folders has to have the following files:
${iconResourceFileNames.joinToString("\n") { "- $it" }}
"""
.split("\n")
.joinToString("\n") { it.trimIndent() } // Remove the leading whitespace from each line.
.trimIndent(), // Remove the leading newline.
)
override fun execute(context: ResourceContext) {
@@ -55,24 +81,14 @@ object CustomBrandingPatch : ResourcePatch() {
} ?: resourceGroups.forEach { context.copyResources("branding", it) }
}
val iconResourceFileNames = arrayOf(
"adaptiveproduct_youtube_background_color_108",
"adaptiveproduct_youtube_foreground_color_108",
"ic_launcher",
"ic_launcher_round"
).map { "$it.png" }.toTypedArray()
fun createGroup(directory: String) = ResourceUtils.ResourceGroup(
directory, *iconResourceFileNames
)
// change the app icon
arrayOf("xxxhdpi", "xxhdpi", "xhdpi", "hdpi", "mdpi")
.map { "mipmap-$it" }
.map(::createGroup)
.let(::copyResources)
// Change the app icon.
mipmapDirectories.map(::createGroup).let(::copyResources)
// change the name of the app
// Change the app name.
val manifest = context["AndroidManifest.xml"]
manifest.writeText(
manifest.readText()

View File

@@ -2,9 +2,12 @@ package app.revanced.patches.youtube.layout.hide.general
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
@@ -14,6 +17,8 @@ import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.shared.settings.preference.impl.TextPreference
import app.revanced.patches.youtube.layout.hide.general.fingerprints.ParseElementFromBufferFingerprint
import app.revanced.patches.youtube.layout.hide.general.fingerprints.PlayerOverlayFingerprint
import app.revanced.patches.youtube.layout.hide.general.fingerprints.ShowWatermarkFingerprint
import app.revanced.patches.youtube.misc.litho.filter.LithoFilterPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch.PreferenceScreen
@@ -39,7 +44,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
)
@Suppress("unused")
object HideLayoutComponentsPatch : BytecodePatch(
setOf(ParseElementFromBufferFingerprint)
setOf(ParseElementFromBufferFingerprint, PlayerOverlayFingerprint)
) {
private const val FILTER_CLASS_DESCRIPTOR =
"Lapp/revanced/integrations/patches/components/LayoutComponentsFilter;"
@@ -58,7 +63,15 @@ object HideLayoutComponentsPatch : BytecodePatch(
StringResource("revanced_hide_join_membership_button_summary_on", "Button is hidden"),
StringResource("revanced_hide_join_membership_button_summary_off", "Button is shown")
),
SwitchPreference(
"revanced_hide_channel_watermark_title",
StringResource(
"revanced_hide_channel_watermark_title",
"Hide channel watermark in video player"
),
StringResource("revanced_hide_channel_watermark_title_summary_on", "Watermark is hidden"),
StringResource("revanced_hide_channel_watermark_title_summary_off", "Watermark is shown")
),
SwitchPreference(
"revanced_hide_notify_me_button",
StringResource("revanced_hide_notify_me_button_title", "Hide \\\'Notify me\\\' button"),
@@ -316,5 +329,24 @@ object HideLayoutComponentsPatch : BytecodePatch(
} ?: throw ParseElementFromBufferFingerprint.exception
// endregion
// region Watermark (legacy code for old versions of YouTube)
ShowWatermarkFingerprint.also {
it.resolve(context, PlayerOverlayFingerprint.result?.classDef ?: throw PlayerOverlayFingerprint.exception)
}.result?.mutableMethod?.apply {
val index = implementation!!.instructions.size - 5
removeInstruction(index)
addInstructions(
index,
"""
invoke-static {}, $FILTER_CLASS_DESCRIPTOR->showWatermark()Z
move-result p2
"""
)
} ?: throw ShowWatermarkFingerprint.exception
// endregion
}
}

View File

@@ -1,9 +1,9 @@
package app.revanced.patches.youtube.layout.hide.watermark.fingerprints
package app.revanced.patches.youtube.layout.hide.general.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
object HideWatermarkParentFingerprint : MethodFingerprint (
object PlayerOverlayFingerprint : MethodFingerprint (
"L", AccessFlags.PUBLIC or AccessFlags.FINAL, strings = listOf("player_overlay_in_video_programming")
)

View File

@@ -1,9 +1,9 @@
package app.revanced.patches.youtube.layout.hide.watermark.fingerprints
package app.revanced.patches.youtube.layout.hide.general.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
object HideWatermarkFingerprint : MethodFingerprint (
object ShowWatermarkFingerprint : MethodFingerprint (
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L", "L")
)

View File

@@ -1,68 +0,0 @@
package app.revanced.patches.youtube.layout.hide.watermark
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.layout.hide.watermark.fingerprints.HideWatermarkFingerprint
import app.revanced.patches.youtube.layout.hide.watermark.fingerprints.HideWatermarkParentFingerprint
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
@Patch(
name = "Hide watermark",
description = "Hides creator's watermarks on videos.",
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.youtube",
[
"18.16.37",
"18.19.35",
"18.20.39",
"18.23.35",
"18.29.38",
"18.32.39",
"18.37.36",
"18.38.44"
]
)
]
)
@Suppress("unused")
object HideWatermarkPatch : BytecodePatch(
setOf(HideWatermarkParentFingerprint)
) {
override fun execute(context: BytecodeContext) {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
"revanced_hide_video_watermark",
StringResource("revanced_hide_video_watermark_title", "Hide creator watermark on videos"),
StringResource("revanced_hide_video_watermark_summary_on", "Watermark is hidden"),
StringResource("revanced_hide_video_watermark_summary_off", "Watermark is shown")
)
)
HideWatermarkFingerprint.resolve(context, HideWatermarkParentFingerprint.result!!.classDef)
val result = HideWatermarkFingerprint.result
?: throw PatchException("Required parent method could not be found.")
val method = result.mutableMethod
val line = method.implementation!!.instructions.size - 5
method.removeInstruction(line)
method.addInstructions(
line,
"""
invoke-static {}, Lapp/revanced/integrations/patches/BrandingWaterMarkPatch;->isBrandingWatermarkShown()Z
move-result p2
"""
)
}
}

View File

@@ -1,7 +1,7 @@
package app.revanced.patches.youtube.layout.player.overlay
import app.revanced.extensions.exception
import app.revanced.extensions.indexOfFirstConstantInstructionValue
import app.revanced.extensions.indexOfFirstWideLiteralInstructionValue
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
@@ -27,7 +27,7 @@ object CustomPlayerOverlayOpacityPatch : BytecodePatch(setOf(CreatePlayerOvervie
CreatePlayerOverviewFingerprint.result?.let { result ->
result.mutableMethod.apply {
val viewRegisterIndex =
indexOfFirstConstantInstructionValue(CustomPlayerOverlayOpacityResourcePatch.scrimOverlayId) + 3
indexOfFirstWideLiteralInstructionValue(CustomPlayerOverlayOpacityResourcePatch.scrimOverlayId) + 3
val viewRegister =
getInstruction<OneRegisterInstruction>(viewRegisterIndex).registerA

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.youtube.layout.player.overlay.fingerprints
import app.revanced.extensions.containsConstantInstructionValue
import app.revanced.extensions.containsWideLiteralInstructionValue
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.player.overlay.CustomPlayerOverlayOpacityResourcePatch
@@ -17,6 +17,6 @@ object CreatePlayerOverviewFingerprint : MethodFingerprint(
Opcode.CHECK_CAST
),
customFingerprint = { methodDef, _ ->
methodDef.containsConstantInstructionValue(CustomPlayerOverlayOpacityResourcePatch.scrimOverlayId)
methodDef.containsWideLiteralInstructionValue(CustomPlayerOverlayOpacityResourcePatch.scrimOverlayId)
}
)

View File

@@ -184,6 +184,9 @@ object ReturnYouTubeDislikePatch : BytecodePatch(
// Filter that parses the video id from the UI
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
// Player response video id is needed to search for the video ids in Shorts litho components.
VideoIdPatch.hookPlayerResponseVideoId("$FILTER_CLASS_DESCRIPTOR->newPlayerResponseVideoId(Ljava/lang/String;)V")
// endregion
// region Hook old UI layout dislikes, for the older app spoofs used with spoof-app-version.

View File

@@ -1,7 +1,7 @@
package app.revanced.patches.youtube.layout.seekbar
import app.revanced.extensions.exception
import app.revanced.extensions.indexOfFirstConstantInstructionValue
import app.revanced.extensions.indexOfFirstWideLiteralInstructionValue
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
@@ -30,7 +30,7 @@ object SeekbarColorBytecodePatch : BytecodePatch(
override fun execute(context: BytecodeContext) {
fun MutableMethod.addColorChangeInstructions(resourceId: Long) {
val registerIndex = indexOfFirstConstantInstructionValue(resourceId) + 2
val registerIndex = indexOfFirstWideLiteralInstructionValue(resourceId) + 2
val colorRegister = getInstruction<OneRegisterInstruction>(registerIndex).registerA
addInstructions(
registerIndex + 1,

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.youtube.layout.seekbar.fingerprints
import app.revanced.extensions.containsConstantInstructionValue
import app.revanced.extensions.containsWideLiteralInstructionValue
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.seekbar.SeekbarColorResourcePatch
@@ -9,7 +9,7 @@ import com.android.tools.smali.dexlib2.AccessFlags
object PlayerSeekbarColorFingerprint : MethodFingerprint(
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
customFingerprint = { method, _ ->
method.containsConstantInstructionValue(SeekbarColorResourcePatch.inlineTimeBarColorizedBarPlayedColorDarkId)
&& method.containsConstantInstructionValue(SeekbarColorResourcePatch.inlineTimeBarPlayedNotHighlightedColorId)
method.containsWideLiteralInstructionValue(SeekbarColorResourcePatch.inlineTimeBarColorizedBarPlayedColorDarkId)
&& method.containsWideLiteralInstructionValue(SeekbarColorResourcePatch.inlineTimeBarPlayedNotHighlightedColorId)
}
)

View File

@@ -51,7 +51,7 @@ object SpoofAppVersionPatch : BytecodePatch(
StringResource("revanced_spoof_app_version_user_dialog_message",
"App version will be spoofed to an older version of YouTube."
+ "\\n\\nThis will change the appearance and features of the app, but unknown side effects may occur."
+ "\\n\\nIf later turned off, the old UI may remain until the app data is cleared.")
+ "\\n\\nIf later turned off, it is recommended to clear the app data to prevent UI bugs.")
),
ListPreference(
"revanced_spoof_app_version_target",
@@ -62,19 +62,21 @@ object SpoofAppVersionPatch : BytecodePatch(
ArrayResource(
"revanced_spoof_app_version_target_entries",
listOf(
StringResource("revanced_spoof_app_version_target_entry_1", "18.20.39 - Restore wide video speed & quality menu"),
StringResource("revanced_spoof_app_version_target_entry_2", "17.08.35 - Restore old UI layout"),
StringResource("revanced_spoof_app_version_target_entry_3", "16.08.35 - Restore explore tab"),
StringResource("revanced_spoof_app_version_target_entry_4", "16.01.35 - Restore old Shorts player"),
StringResource("revanced_spoof_app_version_target_entry_1", "18.33.40 - Restore RYD Shorts incognito mode"),
StringResource("revanced_spoof_app_version_target_entry_2", "18.20.39 - Restore wide video speed & quality menu"),
StringResource("revanced_spoof_app_version_target_entry_3", "17.08.35 - Restore old UI layout"),
StringResource("revanced_spoof_app_version_target_entry_4", "16.08.35 - Restore explore tab"),
StringResource("revanced_spoof_app_version_target_entry_5", "16.01.35 - Restore old Shorts player"),
)
),
ArrayResource(
"revanced_spoof_app_version_target_entry_values",
listOf(
StringResource("revanced_spoof_app_version_target_entry_value_1", "18.20.39"),
StringResource("revanced_spoof_app_version_target_entry_value_2", "17.08.35"),
StringResource("revanced_spoof_app_version_target_entry_value_3", "16.08.35"),
StringResource("revanced_spoof_app_version_target_entry_value_4", "16.01.35"),
StringResource("revanced_spoof_app_version_target_entry_value_1", "18.33.40"),
StringResource("revanced_spoof_app_version_target_entry_value_2", "18.20.39"),
StringResource("revanced_spoof_app_version_target_entry_value_3", "17.08.35"),
StringResource("revanced_spoof_app_version_target_entry_value_4", "16.08.35"),
StringResource("revanced_spoof_app_version_target_entry_value_5", "16.01.35"),
)
)
)

View File

@@ -1,40 +1,94 @@
package app.revanced.patches.youtube.layout.theme
import app.revanced.extensions.exception
import app.revanced.extensions.indexOfFirstWideLiteralInstructionValue
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.patch.options.types.StringPatchOption.Companion.stringPatchOption
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.layout.seekbar.SeekbarColorBytecodePatch
import app.revanced.patches.youtube.layout.theme.fingerprints.UseGradientLoadingScreenFingerprint
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Patch(
name = "Theme",
description = "Applies a custom theme.",
dependencies = [LithoColorHookPatch::class, SeekbarColorBytecodePatch::class, ThemeResourcePatch::class],
dependencies = [
LithoColorHookPatch::class,
SeekbarColorBytecodePatch::class,
ThemeResourcePatch::class,
IntegrationsPatch::class,
SettingsPatch::class
],
compatiblePackages = [
CompatiblePackage("com.google.android.youtube")
CompatiblePackage(
"com.google.android.youtube",
[
"18.37.36",
"18.38.44"
]
)
]
)
@Suppress("unused")
object ThemeBytecodePatch : BytecodePatch() {
object ThemeBytecodePatch : BytecodePatch(
setOf(UseGradientLoadingScreenFingerprint)
) {
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
"Lapp/revanced/integrations/patches/theme/ThemeLithoComponentsPatch;"
"Lapp/revanced/integrations/patches/theme/ThemePatch;"
internal const val GRADIENT_LOADING_SCREEN_AB_CONSTANT = 45412406L
internal val darkThemeBackgroundColor by stringPatchOption(
key = "darkThemeBackgroundColor",
default = "@android:color/black",
title = "Background color for the dark theme",
title = "Dark theme background color",
description = "The background color of the dark theme. Can be a hex color or a resource reference.",
)
internal val lightThemeBackgroundColor by stringPatchOption(
key = "lightThemeBackgroundColor",
default = "@android:color/white",
title = "Background color for the light theme",
title = "Light theme background color",
description = "The background color of the light theme. Can be a hex color or a resource reference.",
)
override fun execute(context: BytecodeContext) {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
"revanced_gradient_loading_screen",
StringResource("revanced_gradient_loading_screen_title", "Enable gradient loading screen"),
StringResource(
"revanced_gradient_loading_screen_summary_on",
"Loading screen will have a gradient background"
),
StringResource(
"revanced_gradient_loading_screen_summary_off",
"Loading screen will have a solid background"
),
)
)
UseGradientLoadingScreenFingerprint.result?.mutableMethod?.apply {
val isEnabledIndex = indexOfFirstWideLiteralInstructionValue(GRADIENT_LOADING_SCREEN_AB_CONSTANT) + 3
val isEnabledRegister = getInstruction<OneRegisterInstruction>(isEnabledIndex - 1).registerA
addInstructions(
isEnabledIndex,
"""
invoke-static { }, $INTEGRATIONS_CLASS_DESCRIPTOR->gradientLoadingScreenEnabled()Z
move-result v$isEnabledRegister
"""
)
} ?: throw UseGradientLoadingScreenFingerprint.exception
LithoColorHookPatch.lithoColorOverrideHook(INTEGRATIONS_CLASS_DESCRIPTOR, "getValue")
}
}

View File

@@ -0,0 +1,8 @@
package app.revanced.patches.youtube.layout.theme.fingerprints
import app.revanced.patches.youtube.layout.theme.ThemeBytecodePatch.GRADIENT_LOADING_SCREEN_AB_CONSTANT
import app.revanced.util.patch.LiteralValueFingerprint
object UseGradientLoadingScreenFingerprint : LiteralValueFingerprint(
literalSupplier = { GRADIENT_LOADING_SCREEN_AB_CONSTANT }
)

View File

@@ -0,0 +1,61 @@
package app.revanced.patches.youtube.misc.announcements
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.shared.fingerprints.WatchWhileActivityFingerprint
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.misc.settings.SettingsPatch
import com.android.tools.smali.dexlib2.Opcode
@Patch(
name = "Announcements",
description = "Shows announcements on startup.",
compatiblePackages = [CompatiblePackage("com.google.android.youtube")],
dependencies = [SettingsPatch::class]
)
@Suppress("unused")
object AnnouncementsPatch : BytecodePatch(
setOf(WatchWhileActivityFingerprint)
) {
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
"Lapp/revanced/integrations/patches/announcements/AnnouncementsPatch;"
override fun execute(context: BytecodeContext) {
val onCreateMethod = WatchWhileActivityFingerprint.result?.let {
it.mutableClass.methods.find { method -> method.name == "onCreate" }
} ?: throw WatchWhileActivityFingerprint.exception
val superCallIndex = onCreateMethod.getInstructions().indexOfFirst { it.opcode == Opcode.INVOKE_SUPER_RANGE }
onCreateMethod.addInstructions(
superCallIndex + 1,
"invoke-static { v1 }, $INTEGRATIONS_CLASS_DESCRIPTOR->showAnnouncement(Landroid/app/Activity;)V"
)
SettingsPatch.PreferenceScreen.MISC.addPreferences(
SwitchPreference(
"revanced_announcements",
StringResource(
"revanced_announcements_title",
"Show announcements"
),
StringResource(
"revanced_announcements_summary_on",
"Announcements are shown on startup."
), StringResource(
"revanced_announcements_summary_off",
"Announcements are not shown on startup."
), StringResource(
"revanced_announcements_enabled_summary",
"Show announcements on startup."
),
)
)
}
}

View File

@@ -0,0 +1,63 @@
package app.revanced.patches.youtube.misc.dimensions.spoof
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.misc.dimensions.spoof.fingerprints.DeviceDimensionsModelToStringFingerprint
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
@Patch(
name = "Spoof device dimensions",
description = "Spoofs the device dimensions in order to unlock higher video qualities " +
"that may not be available on your device.",
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.youtube",
[
"18.38.44"
]
)
]
)
object SpoofDeviceDimensionsPatch : BytecodePatch(
setOf(DeviceDimensionsModelToStringFingerprint)
) {
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
"Lapp/revanced/integrations/patches/spoof/SpoofDeviceDimensionsPatch;"
override fun execute(context: BytecodeContext) {
SettingsPatch.PreferenceScreen.MISC.addPreferences(
SwitchPreference(
"revanced_spoof_device_dimensions",
StringResource("revanced_spoof_device_dimensions_title", "Spoof device dimensions"),
StringResource("revanced_spoof_device_dimensions_summary_on", "Device dimensions spoofed"),
StringResource("revanced_spoof_device_dimensions_summary_off", "Device dimensions not spoofed"),
)
)
DeviceDimensionsModelToStringFingerprint.result
?.mutableClass?.methods?.find { method -> method.name == "<init>" }
// Override the parameters containing the dimensions.
?.addInstructions(
1, // Add after super call.
mapOf(
1 to "MinHeightOrWidth", // p1 = min height
2 to "MaxHeightOrWidth", // p2 = max height
3 to "MinHeightOrWidth", // p3 = min width
4 to "MaxHeightOrWidth" // p4 = max width
).map { (parameter, method) ->
"""
invoke-static { p$parameter }, $INTEGRATIONS_CLASS_DESCRIPTOR->get$method(I)I
move-result p$parameter
"""
}.joinToString("\n") { it }
) ?: throw DeviceDimensionsModelToStringFingerprint.exception
}
}

View File

@@ -0,0 +1,8 @@
package app.revanced.patches.youtube.misc.dimensions.spoof.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object DeviceDimensionsModelToStringFingerprint : MethodFingerprint(
returnType = "L",
strings = listOf("minh.", ";maxh.")
)

View File

@@ -1,6 +1,6 @@
package app.revanced.patches.youtube.misc.fix.playback.fingerprints
import app.revanced.extensions.containsConstantInstructionValue
import app.revanced.extensions.containsWideLiteralInstructionValue
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
@@ -18,6 +18,6 @@ object PlayerResponseModelImplFingerprint : MethodFingerprint(
customFingerprint = handler@{ methodDef, _ ->
if (!methodDef.definingClass.endsWith("/PlayerResponseModelImpl;")) return@handler false
methodDef.containsConstantInstructionValue(55735497)
methodDef.containsWideLiteralInstructionValue(55735497)
}
)

View File

@@ -1,6 +1,6 @@
package app.revanced.util.patch
import app.revanced.extensions.containsConstantInstructionValue
import app.revanced.extensions.containsWideLiteralInstructionValue
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.Opcode
@@ -19,6 +19,6 @@ abstract class LiteralValueFingerprint(
opcodes = opcodes,
strings = strings,
customFingerprint = { methodDef, _ ->
methodDef.containsConstantInstructionValue(literalSupplier())
methodDef.containsWideLiteralInstructionValue(literalSupplier())
}
)

View File

@@ -14,8 +14,9 @@
<string name="revanced_ryd_enable_summary_off">Dislikes are not shown</string>
<string name="revanced_ryd_shorts_title">Show dislikes on Shorts</string>
<string name="revanced_ryd_shorts_summary_on">Dislikes shown on Shorts</string>
<string name="revanced_ryd_shorts_summary_on">Dislikes shown on Shorts %s</string>
<string name="revanced_ryd_shorts_summary_off">Dislikes hidden on Shorts</string>
<string name="revanced_ryd_shorts_summary_disclaimer">Limitation: Dislikes may not appear in incognito mode</string>
<string name="revanced_ryd_dislike_percentage_title">Dislikes as percentage</string>
<string name="revanced_ryd_dislike_percentage_summary_on">Dislikes shown as percentage</string>