mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-27 20:30:19 +02:00
build: bump patcher to 14.2.2
This commit is contained in:
parent
357c5593f9
commit
994c5d197d
@ -2,30 +2,31 @@ plugins {
|
||||
kotlin("jvm") version "1.9.0"
|
||||
}
|
||||
|
||||
group = "io.github.inotia00"
|
||||
group = "app.revanced"
|
||||
|
||||
val githubUsername: String = project.findProperty("gpr.user") as? String ?: System.getenv("GITHUB_ACTOR")
|
||||
val githubPassword: String = project.findProperty("gpr.key") as? String ?: System.getenv("GITHUB_TOKEN")
|
||||
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
maven { url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots") }
|
||||
maven {
|
||||
url = uri("https://repo.sleeping.town")
|
||||
content {
|
||||
includeGroup("com.unascribed")
|
||||
url = uri("https://maven.pkg.github.com/revanced/revanced-patcher")
|
||||
credentials {
|
||||
username = githubUsername
|
||||
password = githubPassword
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("io.github.inotia00:revanced-patcher:11.0.6-SNAPSHOT")
|
||||
implementation("app.revanced:revanced-patcher:14.2.2")
|
||||
implementation("com.android.tools.smali:smali:3.0.3")
|
||||
implementation("com.android.tools.smali:smali-dexlib2:3.0.3")
|
||||
|
||||
// Required for meta
|
||||
implementation("com.google.code.gson:gson:2.10.1")
|
||||
// Required for FlexVer-Java
|
||||
implementation("com.unascribed:flexver-java:1.1.0")
|
||||
}
|
||||
|
||||
tasks {
|
||||
|
@ -1,8 +1,9 @@
|
||||
package app.revanced.extensions
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.MethodFingerprintExtensions.name
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableClass
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableField
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
@ -25,13 +26,13 @@ internal fun MutableMethodImplementation.injectHideCall(
|
||||
)
|
||||
}
|
||||
|
||||
// TODO: populate this to all patches
|
||||
/**
|
||||
* Convert a [MethodFingerprint] to a [PatchResultError].
|
||||
* Return [PatchException] from a [MethodFingerprint].
|
||||
*
|
||||
* @return A [PatchResultError] for the [MethodFingerprint].
|
||||
* @return The [PatchException] for the [MethodFingerprint].
|
||||
*/
|
||||
fun MethodFingerprint.toErrorResult() = PatchResultError("Failed to resolve $name")
|
||||
val MethodFingerprint.exception
|
||||
get() = PatchException("Failed to resolve $name")
|
||||
|
||||
/**
|
||||
* Find the [MutableMethod] from a given [Method] in a [MutableClass].
|
||||
@ -65,6 +66,22 @@ fun MutableClass.transformFields(transform: MutableField.() -> MutableField) {
|
||||
fields.addAll(transformedFields)
|
||||
}
|
||||
|
||||
/**
|
||||
* traverse the class hierarchy starting from the given root class
|
||||
*
|
||||
* @param targetClass the class to start traversing the class hierarchy from
|
||||
* @param callback function that is called for every class in the hierarchy
|
||||
*/
|
||||
fun BytecodeContext.traverseClassHierarchy(
|
||||
targetClass: MutableClass,
|
||||
callback: MutableClass.() -> Unit
|
||||
) {
|
||||
callback(targetClass)
|
||||
this.findClass(targetClass.superclass ?: return)?.mutableClass?.let {
|
||||
traverseClassHierarchy(it, callback)
|
||||
}
|
||||
}
|
||||
|
||||
internal fun Node.doRecursively(action: (Node) -> Unit) {
|
||||
action(this)
|
||||
for (i in 0 until this.childNodes.length) this.childNodes.item(i).doRecursively(action)
|
||||
|
@ -6,7 +6,6 @@ import app.revanced.patcher.extensions.PatchExtensions.description
|
||||
import app.revanced.patcher.extensions.PatchExtensions.include
|
||||
import app.revanced.patcher.extensions.PatchExtensions.options
|
||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||
import app.revanced.patcher.extensions.PatchExtensions.version
|
||||
import app.revanced.patcher.patch.PatchOption
|
||||
import com.google.gson.GsonBuilder
|
||||
import java.io.File
|
||||
@ -17,7 +16,6 @@ internal class JsonGenerator : PatchesFileGenerator {
|
||||
JsonPatch(
|
||||
it.patchName,
|
||||
it.description ?: "This patch has no description.",
|
||||
it.version ?: "0.0.0",
|
||||
!it.include,
|
||||
it.options?.map { option ->
|
||||
JsonPatch.Option(
|
||||
@ -48,7 +46,6 @@ internal class JsonGenerator : PatchesFileGenerator {
|
||||
private class JsonPatch(
|
||||
val name: String,
|
||||
val description: String,
|
||||
val version: String,
|
||||
val excluded: Boolean,
|
||||
val options: Array<Option>,
|
||||
val dependencies: Array<String>,
|
||||
|
@ -1,25 +1,22 @@
|
||||
package app.revanced.meta
|
||||
|
||||
import app.revanced.patcher.data.Context
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patcher.util.patch.PatchBundle
|
||||
import app.revanced.patcher.PatchBundleLoader
|
||||
import app.revanced.patcher.patch.PatchClass
|
||||
import java.io.File
|
||||
|
||||
internal typealias PatchBundlePatches = List<Class<out Patch<Context>>>
|
||||
internal typealias PatchBundlePatches = List<PatchClass>
|
||||
|
||||
internal interface PatchesFileGenerator {
|
||||
fun generate(bundle: PatchBundlePatches)
|
||||
|
||||
private companion object {
|
||||
@JvmStatic
|
||||
fun main(args: Array<String>) = PatchBundle.Jar(
|
||||
File("build/libs/").listFiles()!!.first {
|
||||
it.name.startsWith("revanced-patches-") && it.name.endsWith(".jar")
|
||||
}.absolutePath
|
||||
).loadPatches().also {
|
||||
if (it.isEmpty()) throw IllegalStateException("No patches found")
|
||||
fun main(args: Array<String>) = PatchBundleLoader.Jar(
|
||||
File("build/libs/").listFiles { it -> it.name.endsWith(".jar") }!!.first()
|
||||
).also { loader ->
|
||||
if (loader.isEmpty()) throw IllegalStateException("No patches found")
|
||||
}.let { bundle ->
|
||||
arrayOf(JsonGenerator(), ReadmeGenerator()).forEach { it.generate(bundle) }
|
||||
arrayOf(JsonGenerator()).forEach { generator -> generator.generate(bundle) }
|
||||
}
|
||||
}
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
package app.revanced.meta
|
||||
|
||||
import app.revanced.patcher.data.Context
|
||||
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
||||
import app.revanced.patcher.extensions.PatchExtensions.description
|
||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import com.unascribed.flexver.FlexVerComparator
|
||||
import java.io.File
|
||||
|
||||
internal class ReadmeGenerator : PatchesFileGenerator {
|
||||
private companion object {
|
||||
private const val TABLE_HEADER =
|
||||
"| \uD83D\uDC8A Patch | \uD83D\uDCDC Description | \uD83C\uDFF9 Target Version |\n" +
|
||||
"|:--------:|:--------------:|:-----------------:|"
|
||||
}
|
||||
|
||||
override fun generate(bundle: PatchBundlePatches) {
|
||||
val output = StringBuilder()
|
||||
|
||||
mutableMapOf<String, MutableList<Class<out Patch<Context>>>>()
|
||||
.apply {
|
||||
for (patch in bundle) {
|
||||
patch.compatiblePackages?.forEach { pkg ->
|
||||
if (!contains(pkg.name)) put(pkg.name, mutableListOf())
|
||||
this[pkg.name]!!.add(patch)
|
||||
}
|
||||
}
|
||||
}
|
||||
.entries
|
||||
.sortedByDescending { it.value.size }
|
||||
.forEach { (`package`, patches) ->
|
||||
val mostCommonVersion = buildMap {
|
||||
patches.forEach { patch ->
|
||||
patch.compatiblePackages?.single { compatiblePackage -> compatiblePackage.name == `package` }?.versions?.let {
|
||||
it.forEach { version -> merge(version, 1, Integer::sum) }
|
||||
}
|
||||
}
|
||||
}.let { commonMap ->
|
||||
commonMap.maxByOrNull { it.value }?.value?.let {
|
||||
commonMap.entries.filter { mostCommon -> mostCommon.value == it }
|
||||
.maxOfWith(FlexVerComparator::compare, Map.Entry<String, Int>::key)
|
||||
} ?: "all"
|
||||
}
|
||||
|
||||
output.apply {
|
||||
appendLine("### [\uD83D\uDCE6 `${`package`}`](https://play.google.com/store/apps/details?id=${`package`})")
|
||||
appendLine("<details>\n")
|
||||
appendLine(TABLE_HEADER)
|
||||
patches.forEach { patch ->
|
||||
val recommendedPatchVersion = if (
|
||||
patch.compatiblePackages?.single { it.name == `package` }?.versions?.isNotEmpty() == true
|
||||
) mostCommonVersion else "all"
|
||||
|
||||
appendLine(
|
||||
"| `${patch.patchName.lowercase().replace(" ", "-")}` " +
|
||||
"| ${patch.description} " +
|
||||
"| $recommendedPatchVersion |"
|
||||
)
|
||||
}
|
||||
appendLine("</details>\n")
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder(File("README-template.md").readText())
|
||||
.replace(Regex("\\{\\{\\s?table\\s?}}"), output.toString())
|
||||
.let(File("README.md")::writeText)
|
||||
}
|
||||
}
|
@ -2,10 +2,7 @@ package app.revanced.patches.music.ads.music.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
@ -25,18 +22,16 @@ import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
|
||||
]
|
||||
)
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class MusicAdsPatch : AbstractAdsPatch(
|
||||
"$MUSIC_ADS_PATH/HideMusicAdsPatch;->hideMusicAds()Z"
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
super.execute(context)
|
||||
|
||||
SettingsPatch.addMusicPreference(CategoryType.ADS, "revanced_hide_music_ads", "true")
|
||||
|
||||
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -2,10 +2,7 @@ package app.revanced.patches.music.layout.amoled.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
@ -18,9 +15,8 @@ import org.w3c.dom.Element
|
||||
@Description("Applies pure black theme in flyout panels.")
|
||||
@DependsOn([DecodingPatch::class])
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class AmoledPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
context.xmlEditor["res/values/colors.xml"].use { editor ->
|
||||
val resourcesNode = editor.file.getElementsByTagName("resources").item(0) as Element
|
||||
@ -37,6 +33,5 @@ class AmoledPatch : ResourcePatch {
|
||||
}
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.music.layout.autocaptions.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
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.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
@ -24,11 +21,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@Description("Disables forced auto captions.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class DisableAutoCaptionsPatch : BytecodePatch(
|
||||
listOf(SubtitleTrackFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SubtitleTrackFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -42,7 +38,7 @@ class DisableAutoCaptionsPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return SubtitleTrackFingerprint.toErrorResult()
|
||||
} ?: throw SubtitleTrackFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
@ -50,6 +46,5 @@ class DisableAutoCaptionsPatch : BytecodePatch(
|
||||
"false"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.music.layout.blacknavigationbar.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
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.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.layout.blacknavbar.fingerprints.TabLayoutFingerprint
|
||||
@ -30,11 +27,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
]
|
||||
)
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class BlackNavigationBarPatch : BytecodePatch(
|
||||
listOf(TabLayoutFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
TabLayoutFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -48,7 +44,7 @@ class BlackNavigationBarPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return TabLayoutFingerprint.toErrorResult()
|
||||
} ?: throw TabLayoutFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
@ -56,6 +52,5 @@ class BlackNavigationBarPatch : BytecodePatch(
|
||||
"true"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ package app.revanced.patches.music.layout.branding.icon.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
@ -19,14 +16,12 @@ import app.revanced.util.resources.IconHelper.customIconMusicAdditional
|
||||
@Description("Changes the YouTube Music launcher icon to MMT.")
|
||||
@DependsOn([DecodingPatch::class])
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class CustomBrandingIconMMTPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
context.customIconMusic("mmt")
|
||||
context.customIconMusicAdditional("mmt")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ package app.revanced.patches.music.layout.branding.icon.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
@ -18,13 +15,11 @@ import app.revanced.util.resources.IconHelper.customIconMusic
|
||||
@Description("Changes the YouTube Music launcher icon to Revancify Blue.")
|
||||
@DependsOn([DecodingPatch::class])
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class CustomBrandingIconRevancifyBluePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
context.customIconMusic("revancify-blue")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ package app.revanced.patches.music.layout.branding.icon.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
@ -18,13 +15,11 @@ import app.revanced.util.resources.IconHelper.customIconMusic
|
||||
@Description("Changes the YouTube Music launcher icon to Revancify Red.")
|
||||
@DependsOn([DecodingPatch::class])
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class CustomBrandingIconRevancifyRedPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
context.customIconMusic("revancify-red")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,13 +2,10 @@ package app.revanced.patches.music.layout.branding.name.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.OptionsContainer
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.PatchOption
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
@ -25,15 +22,14 @@ import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch
|
||||
]
|
||||
)
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class CustomBrandingNamePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
val longName = MusicLongName
|
||||
?: throw PatchResultError("Invalid app name.")
|
||||
?: throw PatchException("Invalid app name.")
|
||||
|
||||
val shortName = MusicShortName
|
||||
?: throw PatchResultError("Invalid app name.")
|
||||
?: throw PatchException("Invalid app name.")
|
||||
|
||||
context.xmlEditor["res/values/strings.xml"].use { editor ->
|
||||
val document = editor.file
|
||||
@ -51,7 +47,6 @@ class CustomBrandingNamePatch : ResourcePatch {
|
||||
}
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
companion object : OptionsContainer() {
|
||||
|
@ -1,13 +1,11 @@
|
||||
package app.revanced.patches.music.layout.branding.name.patch
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import kotlin.io.path.exists
|
||||
|
||||
class RemoveElementsPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
LANGUAGE_LIST.forEach { path ->
|
||||
val resDirectory = context["res"]
|
||||
@ -24,7 +22,6 @@ class RemoveElementsPatch : ResourcePatch {
|
||||
}
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
@ -2,11 +2,8 @@ package app.revanced.patches.music.layout.buttonshelf.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
@ -25,9 +22,8 @@ import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
|
||||
]
|
||||
)
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideButtonShelfPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
@ -37,7 +33,6 @@ class HideButtonShelfPatch : BytecodePatch() {
|
||||
|
||||
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -2,11 +2,8 @@ package app.revanced.patches.music.layout.carouselshelf.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
@ -25,9 +22,8 @@ import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
|
||||
]
|
||||
)
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideCarouselShelfPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
@ -37,7 +33,6 @@ class HideCarouselShelfPatch : BytecodePatch() {
|
||||
|
||||
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.music.layout.castbutton.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.layout.castbutton.fingerprints.HideCastButtonFingerprint
|
||||
@ -24,11 +21,10 @@ import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
@Description("Hides the cast button in the video player and header.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideCastButtonPatch : BytecodePatch(
|
||||
listOf(HideCastButtonParentFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
HideCastButtonParentFingerprint.result?.let { parentResult ->
|
||||
HideCastButtonFingerprint.also {
|
||||
@ -41,8 +37,8 @@ class HideCastButtonPatch : BytecodePatch(
|
||||
invoke-static {p1}, $MUSIC_LAYOUT->hideCastButton(I)I
|
||||
move-result p1
|
||||
"""
|
||||
) ?: return HideCastButtonFingerprint.toErrorResult()
|
||||
} ?: return HideCastButtonParentFingerprint.toErrorResult()
|
||||
) ?: throw HideCastButtonFingerprint.exception
|
||||
} ?: throw HideCastButtonParentFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
@ -50,6 +46,5 @@ class HideCastButtonPatch : BytecodePatch(
|
||||
"true"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.music.layout.categorybar.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.layout.categorybar.fingerprints.ChipCloudFingerprint
|
||||
@ -30,11 +27,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
]
|
||||
)
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class CategoryBarPatch : BytecodePatch(
|
||||
listOf(ChipCloudFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
ChipCloudFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
@ -45,7 +41,7 @@ class CategoryBarPatch : BytecodePatch(
|
||||
"invoke-static { v$targetRegister }, $MUSIC_LAYOUT->hideCategoryBar(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
} ?: return ChipCloudFingerprint.toErrorResult()
|
||||
} ?: throw ChipCloudFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
@ -53,6 +49,5 @@ class CategoryBarPatch : BytecodePatch(
|
||||
"true"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,8 @@ package app.revanced.patches.music.layout.carouselshelf.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
@ -25,9 +22,8 @@ import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
|
||||
]
|
||||
)
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideChannelGuidelinesPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
@ -37,7 +33,6 @@ class HideChannelGuidelinesPatch : BytecodePatch() {
|
||||
|
||||
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,17 +1,14 @@
|
||||
package app.revanced.patches.music.layout.colormatchplayer.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
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.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
@ -30,11 +27,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
@Description("Matches the color of the mini player and the fullscreen player.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class ColorMatchPlayerPatch : BytecodePatch(
|
||||
listOf(ColorMatchPlayerParentFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
ColorMatchPlayerParentFingerprint.result?.let { parentResult ->
|
||||
ColorMatchPlayerFingerprint.also {
|
||||
@ -74,8 +70,8 @@ class ColorMatchPlayerPatch : BytecodePatch(
|
||||
)
|
||||
removeInstruction(insertIndex - 1)
|
||||
}
|
||||
} ?: return ColorMatchPlayerFingerprint.toErrorResult()
|
||||
} ?: return ColorMatchPlayerParentFingerprint.toErrorResult()
|
||||
} ?: throw ColorMatchPlayerFingerprint.exception
|
||||
} ?: throw ColorMatchPlayerParentFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
@ -83,7 +79,6 @@ class ColorMatchPlayerPatch : BytecodePatch(
|
||||
"true"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,15 +1,11 @@
|
||||
package app.revanced.patches.music.layout.compactdialog.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.data.toMethodWalker
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
@ -30,11 +26,10 @@ import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
]
|
||||
)
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class CompactDialogPatch : BytecodePatch(
|
||||
listOf(DialogSolidFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
DialogSolidFingerprint.result?.let {
|
||||
with(
|
||||
context
|
||||
@ -49,7 +44,7 @@ class CompactDialogPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return DialogSolidFingerprint.toErrorResult()
|
||||
} ?: throw DialogSolidFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
@ -57,6 +52,5 @@ class CompactDialogPatch : BytecodePatch(
|
||||
"true"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ package app.revanced.patches.music.layout.customfilter.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
@ -25,9 +22,8 @@ import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
|
||||
]
|
||||
)
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class CustomFilterPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
@ -42,7 +38,6 @@ class CustomFilterPatch : ResourcePatch {
|
||||
|
||||
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,16 +1,13 @@
|
||||
package app.revanced.patches.music.layout.floatingbutton.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
@ -32,11 +29,10 @@ import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
]
|
||||
)
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class NewPlaylistButtonPatch : BytecodePatch(
|
||||
listOf(FloatingButtonParentFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
FloatingButtonParentFingerprint.result?.let { parentResult ->
|
||||
FloatingButtonFingerprint.also {
|
||||
@ -55,8 +51,8 @@ class NewPlaylistButtonPatch : BytecodePatch(
|
||||
""", ExternalLabel("show", getInstruction(1))
|
||||
)
|
||||
}
|
||||
} ?: return FloatingButtonFingerprint.toErrorResult()
|
||||
} ?: return FloatingButtonParentFingerprint.toErrorResult()
|
||||
} ?: throw FloatingButtonFingerprint.exception
|
||||
} ?: throw FloatingButtonParentFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
@ -64,6 +60,5 @@ class NewPlaylistButtonPatch : BytecodePatch(
|
||||
"false"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,11 @@
|
||||
package app.revanced.patches.music.layout.landscapemode.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.layout.landscapemode.fingerprints.TabletIdentifierFingerprint
|
||||
@ -28,11 +25,10 @@ import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
]
|
||||
)
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class LandScapeModePatch : BytecodePatch(
|
||||
listOf(TabletIdentifierFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
TabletIdentifierFingerprint.result?.let {
|
||||
it.mutableMethod.addInstructions(
|
||||
it.scanResult.patternScanResult!!.endIndex + 1, """
|
||||
@ -40,7 +36,7 @@ class LandScapeModePatch : BytecodePatch(
|
||||
move-result p0
|
||||
"""
|
||||
)
|
||||
} ?: return TabletIdentifierFingerprint.toErrorResult()
|
||||
} ?: throw TabletIdentifierFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
@ -48,6 +44,5 @@ class LandScapeModePatch : BytecodePatch(
|
||||
"true"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,11 @@
|
||||
package app.revanced.patches.music.layout.minimizedplayer.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.layout.minimizedplayer.fingerprints.MinimizedPlayerFingerprint
|
||||
@ -23,11 +20,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@Description("Permanently keep player minimized even if another track is played.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class MinimizedPlayerPatch : BytecodePatch(
|
||||
listOf(MinimizedPlayerFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
MinimizedPlayerFingerprint.result?.let {
|
||||
with(it.mutableMethod) {
|
||||
@ -42,7 +38,7 @@ class MinimizedPlayerPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return MinimizedPlayerFingerprint.toErrorResult()
|
||||
} ?: throw MinimizedPlayerFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
@ -50,6 +46,5 @@ class MinimizedPlayerPatch : BytecodePatch(
|
||||
"true"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,16 +1,13 @@
|
||||
package app.revanced.patches.music.layout.navigationlabel.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.layout.navigationlabel.fingerprints.TabLayoutTextFingerprint
|
||||
@ -35,11 +32,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
]
|
||||
)
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class NavigationLabelPatch : BytecodePatch(
|
||||
listOf(TabLayoutTextFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
TabLayoutTextFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = getWideLiteralIndex(Text1) + 3
|
||||
@ -47,14 +43,14 @@ class NavigationLabelPatch : BytecodePatch(
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
if (!targetParameter.toString().endsWith("Landroid/widget/TextView;"))
|
||||
return PatchResultError("Method signature parameter did not match: $targetParameter")
|
||||
throw PatchException("Method signature parameter did not match: $targetParameter")
|
||||
|
||||
addInstruction(
|
||||
targetIndex + 1,
|
||||
"invoke-static {v$targetRegister}, $MUSIC_LAYOUT->hideNavigationLabel(Landroid/widget/TextView;)V"
|
||||
)
|
||||
}
|
||||
} ?: return TabLayoutTextFingerprint.toErrorResult()
|
||||
} ?: throw TabLayoutTextFingerprint.exception
|
||||
|
||||
contexts.xmlEditor[RESOURCE_FILE_PATH].use { editor ->
|
||||
val document = editor.file
|
||||
@ -74,7 +70,6 @@ class NavigationLabelPatch : BytecodePatch(
|
||||
"false"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.music.layout.newlayout.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
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.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.layout.newlayout.fingerprints.NewLayoutFingerprint
|
||||
@ -24,11 +21,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@Description("Enable new player layouts. (YT Music v5.47.51+)")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class NewLayoutPatch : BytecodePatch(
|
||||
listOf(NewLayoutFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
NewLayoutFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -42,7 +38,7 @@ class NewLayoutPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return NewLayoutFingerprint.toErrorResult()
|
||||
} ?: throw NewLayoutFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
@ -50,6 +46,5 @@ class NewLayoutPatch : BytecodePatch(
|
||||
"true"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,16 +1,13 @@
|
||||
package app.revanced.patches.music.layout.oldstyleminiplayer.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.layout.oldstyleminiplayer.fingerprints.NextButtonVisibilityFingerprint
|
||||
@ -27,14 +24,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@Description("Return the miniplayers to old style. (for YT Music v5.55.53+)")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class OldStyleMiniPlayerPatch : BytecodePatch(
|
||||
listOf(
|
||||
ColorMatchPlayerParentFingerprint,
|
||||
SwipeToCloseFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
ColorMatchPlayerParentFingerprint.result?.let { parentResult ->
|
||||
NextButtonVisibilityFingerprint.also {
|
||||
@ -55,8 +51,8 @@ class OldStyleMiniPlayerPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return NextButtonVisibilityFingerprint.toErrorResult()
|
||||
} ?: return ColorMatchPlayerParentFingerprint.toErrorResult()
|
||||
} ?: throw NextButtonVisibilityFingerprint.exception
|
||||
} ?: throw ColorMatchPlayerParentFingerprint.exception
|
||||
|
||||
SwipeToCloseFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -70,7 +66,7 @@ class OldStyleMiniPlayerPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return SwipeToCloseFingerprint.toErrorResult()
|
||||
} ?: throw SwipeToCloseFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
@ -78,6 +74,5 @@ class OldStyleMiniPlayerPatch : BytecodePatch(
|
||||
"false"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -2,11 +2,8 @@ package app.revanced.patches.music.layout.playlistcard.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
@ -25,9 +22,8 @@ import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
|
||||
]
|
||||
)
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class HidePlaylistCardPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
@ -37,7 +33,6 @@ class HidePlaylistCardPatch : BytecodePatch() {
|
||||
|
||||
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.music.layout.sleeptimer.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
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.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.layout.sleeptimer.fingerprints.SleepTimerFingerprint
|
||||
@ -24,11 +21,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@Description("Add sleep timer to flyout menu.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class SleepTimerPatch : BytecodePatch(
|
||||
listOf(SleepTimerFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SleepTimerFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -42,7 +38,7 @@ class SleepTimerPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return SleepTimerFingerprint.toErrorResult()
|
||||
} ?: throw SleepTimerFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
@ -50,6 +46,5 @@ class SleepTimerPatch : BytecodePatch(
|
||||
"true"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,17 +1,14 @@
|
||||
package app.revanced.patches.music.layout.zenmode.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
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.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.layout.zenmode.fingerprints.ZenModeFingerprint
|
||||
@ -28,11 +25,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
@Description("Adds a grey tint to the video player to reduce eye strain.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class ZenModePatch : BytecodePatch(
|
||||
listOf(ColorMatchPlayerParentFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
ColorMatchPlayerParentFingerprint.result?.let { parentResult ->
|
||||
ZenModeFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
|
||||
@ -65,8 +61,8 @@ class ZenModePatch : BytecodePatch(
|
||||
)
|
||||
removeInstruction(referenceIndex)
|
||||
}
|
||||
} ?: return ZenModeFingerprint.toErrorResult()
|
||||
} ?: return ColorMatchPlayerParentFingerprint.toErrorResult()
|
||||
} ?: throw ZenModeFingerprint.exception
|
||||
} ?: throw ColorMatchPlayerParentFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
@ -74,6 +70,5 @@ class ZenModePatch : BytecodePatch(
|
||||
"false"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,15 +1,11 @@
|
||||
package app.revanced.patches.music.misc.backgroundplay.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.data.toMethodWalker
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
@ -22,11 +18,10 @@ import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch
|
||||
@Description("Enables playing music in the background.")
|
||||
@DependsOn([DecodingPatch::class])
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class BackgroundPlayPatch : BytecodePatch(
|
||||
listOf(BackgroundPlaybackParentFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
BackgroundPlaybackParentFingerprint.result?.let {
|
||||
with(
|
||||
@ -42,8 +37,7 @@ class BackgroundPlayPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return BackgroundPlaybackParentFingerprint.toErrorResult()
|
||||
} ?: throw BackgroundPlaybackParentFingerprint.exception
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -2,10 +2,7 @@ package app.revanced.patches.music.misc.bitrate.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
@ -17,9 +14,8 @@ import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch
|
||||
@Description("Set the audio quality to \"Always High\" when you first install the app.")
|
||||
@DependsOn([DecodingPatch::class])
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class BitrateDefaultValuePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
context.xmlEditor[RESOURCE_FILE_PATH].use { editor ->
|
||||
editor.file.getElementsByTagName("com.google.android.apps.youtube.music.ui.preference.PreferenceCategoryCompat")
|
||||
.item(0).childNodes.apply {
|
||||
@ -39,7 +35,6 @@ class BitrateDefaultValuePatch : ResourcePatch {
|
||||
}
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -2,10 +2,7 @@ package app.revanced.patches.music.misc.codecs.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
@ -19,11 +16,10 @@ import app.revanced.util.integrations.Constants.MUSIC_MISC_PATH
|
||||
@Description("Enable opus codec when playing audio.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class CodecsUnlockPatch : AbstractOpusCodecsPatch(
|
||||
"$MUSIC_MISC_PATH/OpusCodecPatch;->enableOpusCodec()Z"
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
super.execute(context)
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
@ -32,6 +28,5 @@ class CodecsUnlockPatch : AbstractOpusCodecsPatch(
|
||||
"true"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ package app.revanced.patches.music.misc.debugging.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
@ -18,9 +15,8 @@ import app.revanced.util.enum.CategoryType
|
||||
@Description("Adds debugging options.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class DebuggingPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.MISC,
|
||||
@ -28,6 +24,5 @@ class DebuggingPatch : ResourcePatch {
|
||||
"false"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.music.misc.exclusiveaudio.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.misc.exclusiveaudio.fingerprints.AudioOnlyEnablerFingerprint
|
||||
@ -21,17 +18,15 @@ import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch
|
||||
@Description("Enables the option to play music without video.")
|
||||
@DependsOn([DecodingPatch::class])
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class ExclusiveAudioPatch : BytecodePatch(
|
||||
listOf(AudioOnlyEnablerFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
AudioOnlyEnablerFingerprint.result?.mutableMethod?.let {
|
||||
it.replaceInstruction(it.implementation!!.instructions.count() - 1, "const/4 v0, 0x1")
|
||||
it.addInstruction("return v0")
|
||||
} ?: return AudioOnlyEnablerFingerprint.toErrorResult()
|
||||
} ?: throw AudioOnlyEnablerFingerprint.exception
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,11 @@
|
||||
package app.revanced.patches.music.misc.minimizedplayback.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.misc.minimizedplayback.fingerprints.MinimizedPlaybackManagerFingerprint
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
@ -17,16 +14,14 @@ import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
@Name("Enable minimized playback")
|
||||
@Description("Enables minimized playback on Kids music.")
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class MinimizedPlaybackPatch : BytecodePatch(
|
||||
listOf(MinimizedPlaybackManagerFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
MinimizedPlaybackManagerFingerprint.result?.mutableMethod?.addInstruction(
|
||||
0, "return-void"
|
||||
) ?: return MinimizedPlaybackManagerFingerprint.toErrorResult()
|
||||
) ?: throw MinimizedPlaybackManagerFingerprint.exception
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ package app.revanced.patches.music.misc.optimizeresource.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
@ -19,9 +16,8 @@ import java.nio.file.StandardCopyOption
|
||||
@Description("Remove unnecessary resources.")
|
||||
@DependsOn([DecodingPatch::class])
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class OptimizeResourcePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
val relativePath = "raw/third_party_licenses"
|
||||
|
||||
@ -31,6 +27,5 @@ class OptimizeResourcePatch : ResourcePatch {
|
||||
StandardCopyOption.REPLACE_EXISTING
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,12 @@
|
||||
package app.revanced.patches.music.misc.premium.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.data.toMethodWalker
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
@ -37,14 +33,13 @@ import com.android.tools.smali.dexlib2.iface.reference.Reference
|
||||
]
|
||||
)
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideGetPremiumPatch : BytecodePatch(
|
||||
listOf(
|
||||
AccountMenuFooterFingerprint,
|
||||
HideGetPremiumFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
HideGetPremiumFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -56,7 +51,7 @@ class HideGetPremiumPatch : BytecodePatch(
|
||||
"const/4 v$register, 0x0"
|
||||
)
|
||||
}
|
||||
} ?: return HideGetPremiumFingerprint.toErrorResult()
|
||||
} ?: throw HideGetPremiumFingerprint.exception
|
||||
|
||||
|
||||
AccountMenuFooterFingerprint.result?.let {
|
||||
@ -89,9 +84,8 @@ class HideGetPremiumPatch : BytecodePatch(
|
||||
}
|
||||
}
|
||||
}
|
||||
} ?: return AccountMenuFooterFingerprint.toErrorResult()
|
||||
} ?: throw AccountMenuFooterFingerprint.exception
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,18 +1,15 @@
|
||||
package app.revanced.patches.music.misc.quality.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.extensions.findMutableMethodOf
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.misc.quality.fingerprints.MusicVideoQualitySettingsFingerprint
|
||||
@ -42,14 +39,13 @@ import com.android.tools.smali.dexlib2.iface.reference.Reference
|
||||
]
|
||||
)
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class VideoQualityPatch : BytecodePatch(
|
||||
listOf(
|
||||
MusicVideoQualitySettingsParentFingerprint,
|
||||
UserQualityChangeFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
UserQualityChangeFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -82,7 +78,7 @@ class VideoQualityPatch : BytecodePatch(
|
||||
}
|
||||
}
|
||||
}
|
||||
} ?: return UserQualityChangeFingerprint.toErrorResult()
|
||||
} ?: throw UserQualityChangeFingerprint.exception
|
||||
|
||||
MusicVideoQualitySettingsParentFingerprint.result?.let { parentResult ->
|
||||
MusicVideoQualitySettingsFingerprint.also {
|
||||
@ -98,8 +94,8 @@ class VideoQualityPatch : BytecodePatch(
|
||||
invoke-static {p1, p2, v0}, $INTEGRATIONS_VIDEO_QUALITY_CLASS_DESCRIPTOR->setVideoQuality([Ljava/lang/Object;ILjava/lang/Object;)I
|
||||
move-result p2
|
||||
"""
|
||||
) ?: return MusicVideoQualitySettingsFingerprint.toErrorResult()
|
||||
} ?: return MusicVideoQualitySettingsParentFingerprint.toErrorResult()
|
||||
) ?: throw MusicVideoQualitySettingsFingerprint.exception
|
||||
} ?: throw MusicVideoQualitySettingsParentFingerprint.exception
|
||||
|
||||
VideoIdPatch.injectCall("$INTEGRATIONS_VIDEO_QUALITY_CLASS_DESCRIPTOR->newVideoStarted(Ljava/lang/String;)V")
|
||||
SettingsPatch.addMusicPreference(
|
||||
@ -108,7 +104,6 @@ class VideoQualityPatch : BytecodePatch(
|
||||
"true"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,17 +1,14 @@
|
||||
package app.revanced.patches.music.misc.sharebuttonhook.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
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.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
@ -36,7 +33,6 @@ import app.revanced.util.integrations.Constants.MUSIC_MISC_PATH
|
||||
]
|
||||
)
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class ShareButtonHookPatch : BytecodePatch(
|
||||
listOf(
|
||||
ConnectionTrackerFingerprint,
|
||||
@ -45,7 +41,7 @@ class ShareButtonHookPatch : BytecodePatch(
|
||||
ShowToastFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SharePanelFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = it.scanResult.patternScanResult!!.startIndex
|
||||
@ -60,26 +56,26 @@ class ShareButtonHookPatch : BytecodePatch(
|
||||
""", ExternalLabel("default", getInstruction(targetIndex))
|
||||
)
|
||||
}
|
||||
} ?: return SharePanelFingerprint.toErrorResult()
|
||||
} ?: throw SharePanelFingerprint.exception
|
||||
|
||||
ConnectionTrackerFingerprint.result?.mutableMethod?.addInstruction(
|
||||
0,
|
||||
"sput-object p1, $INTEGRATIONS_CLASS_DESCRIPTOR->context:Landroid/content/Context;"
|
||||
) ?: return ConnectionTrackerFingerprint.toErrorResult()
|
||||
) ?: throw ConnectionTrackerFingerprint.exception
|
||||
|
||||
ShowToastFingerprint.result?.mutableMethod?.addInstructions(
|
||||
0, """
|
||||
invoke-static {p0}, $INTEGRATIONS_CLASS_DESCRIPTOR->dismissContext(Landroid/content/Context;)Landroid/content/Context;
|
||||
move-result-object p0
|
||||
"""
|
||||
) ?: return ShowToastFingerprint.toErrorResult()
|
||||
) ?: throw ShowToastFingerprint.exception
|
||||
|
||||
FullStackTraceActivityFingerprint.result?.mutableMethod?.addInstructions(
|
||||
1, """
|
||||
invoke-static {p0}, $MUSIC_INTEGRATIONS_PATH/settingsmenu/SharedPreferenceChangeListener;->initializeSettings(Landroid/app/Activity;)V
|
||||
return-void
|
||||
"""
|
||||
) ?: return FullStackTraceActivityFingerprint.toErrorResult()
|
||||
) ?: throw FullStackTraceActivityFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.MISC,
|
||||
@ -92,7 +88,6 @@ class ShareButtonHookPatch : BytecodePatch(
|
||||
"revanced_hook_share_button"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,21 +1,18 @@
|
||||
package app.revanced.patches.music.misc.shuffle.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.extensions.transformFields
|
||||
import app.revanced.extensions.traverseClassHierarchy
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.TypeUtil.traverseClassHierarchy
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||
import app.revanced.patcher.util.smali.toInstructions
|
||||
@ -47,7 +44,6 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter
|
||||
]
|
||||
)
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class EnforceShufflePatch : BytecodePatch(
|
||||
listOf(
|
||||
MusicPlaybackControlsFingerprint,
|
||||
@ -55,7 +51,7 @@ class EnforceShufflePatch : BytecodePatch(
|
||||
ShuffleClassReferenceFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
ShuffleClassReferenceFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -72,7 +68,7 @@ class EnforceShufflePatch : BytecodePatch(
|
||||
shuffleReference3 = getInstruction(endIndex).descriptor
|
||||
shuffleReference4 = getInstruction(imageViewIndex).descriptor
|
||||
}
|
||||
} ?: return ShuffleClassReferenceFingerprint.toErrorResult()
|
||||
} ?: throw ShuffleClassReferenceFingerprint.exception
|
||||
|
||||
|
||||
ShuffleClassFingerprint.result?.let {
|
||||
@ -97,7 +93,7 @@ class EnforceShufflePatch : BytecodePatch(
|
||||
).toMutable()
|
||||
}
|
||||
}
|
||||
} ?: return ShuffleClassFingerprint.toErrorResult()
|
||||
} ?: throw ShuffleClassFingerprint.exception
|
||||
|
||||
MusicPlaybackControlsFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -163,7 +159,7 @@ class EnforceShufflePatch : BytecodePatch(
|
||||
).toMutable()
|
||||
)
|
||||
}
|
||||
} ?: return MusicPlaybackControlsFingerprint.toErrorResult()
|
||||
} ?: throw MusicPlaybackControlsFingerprint.exception
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.MISC,
|
||||
@ -171,7 +167,6 @@ class EnforceShufflePatch : BytecodePatch(
|
||||
"true"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.music.misc.tastebuilder.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
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.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.misc.tastebuilder.fingerprints.TasteBuilderConstructorFingerprint
|
||||
@ -22,11 +19,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
@Description("Hides the \"Tell us which artists you like\" card from homepage.")
|
||||
@DependsOn([DecodingPatch::class])
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class TasteBuilderPatch : BytecodePatch(
|
||||
listOf(TasteBuilderConstructorFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
TasteBuilderConstructorFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex - 8
|
||||
@ -39,8 +35,7 @@ class TasteBuilderPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return TasteBuilderConstructorFingerprint.toErrorResult()
|
||||
} ?: throw TasteBuilderConstructorFingerprint.exception
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ package app.revanced.patches.music.misc.translations.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
@ -18,13 +15,11 @@ import app.revanced.util.resources.ResourceHelper.addTranslations
|
||||
@Description("Add Crowdin translations for YouTube Music.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class TranslationsPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
context.addTranslations("music", LANGUAGE_LIST)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,17 +1,14 @@
|
||||
package app.revanced.patches.music.misc.upgradebutton.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.misc.upgradebutton.fingerprints.NotifierShelfFingerprint
|
||||
@ -35,14 +32,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
]
|
||||
)
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class UpgradeButtonPatch : BytecodePatch(
|
||||
listOf(
|
||||
PivotBarConstructorFingerprint,
|
||||
NotifierShelfFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
PivotBarConstructorFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = it.scanResult.patternScanResult!!.startIndex
|
||||
@ -67,7 +63,7 @@ class UpgradeButtonPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return PivotBarConstructorFingerprint.toErrorResult()
|
||||
} ?: throw PivotBarConstructorFingerprint.exception
|
||||
|
||||
NotifierShelfFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -78,8 +74,7 @@ class UpgradeButtonPatch : BytecodePatch(
|
||||
"invoke-static {v$targetRegister}, Lapp/revanced/music/utils/ReVancedUtils;->hideViewByLayoutParams(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
} ?: return NotifierShelfFingerprint.toErrorResult()
|
||||
} ?: throw NotifierShelfFingerprint.exception
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ package app.revanced.patches.music.misc.versionspoof.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
@ -19,11 +16,10 @@ import app.revanced.util.integrations.Constants.MUSIC_MISC_PATH
|
||||
@Description("Spoof the YouTube Music client version.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class SpoofAppVersionPatch : AbstractVersionSpoofPatch(
|
||||
"$MUSIC_MISC_PATH/SpoofAppVersionPatch;->getVersionOverride(Ljava/lang/String;)Ljava/lang/String;"
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
super.execute(context)
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
@ -32,6 +28,5 @@ class SpoofAppVersionPatch : AbstractVersionSpoofPatch(
|
||||
"false"
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,14 +1,11 @@
|
||||
package app.revanced.patches.music.utils.fix.androidauto.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
@ -20,19 +17,17 @@ import app.revanced.patches.music.utils.fix.decoding.patch.DecodingPatch
|
||||
@Description("Spoofs the YouTube Music certificate for Android Auto.")
|
||||
@DependsOn([DecodingPatch::class])
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class AndroidAutoCertificatePatch : BytecodePatch(
|
||||
listOf(CertificateCheckFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
CertificateCheckFingerprint.result?.mutableMethod?.addInstructions(
|
||||
0, """
|
||||
const/4 v0, 0x1
|
||||
return v0
|
||||
"""
|
||||
) ?: return CertificateCheckFingerprint.toErrorResult()
|
||||
) ?: throw CertificateCheckFingerprint.exception
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,10 @@
|
||||
package app.revanced.patches.music.utils.fix.clientspoof.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patches.music.utils.fix.clientspoof.fingerprints.UserAgentHeaderBuilderFingerprint
|
||||
import app.revanced.patches.music.utils.microg.shared.Constants.MUSIC_PACKAGE_NAME
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
@ -14,7 +12,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
class ClientSpoofMusicPatch : BytecodePatch(
|
||||
listOf(UserAgentHeaderBuilderFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
UserAgentHeaderBuilderFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -27,8 +25,7 @@ class ClientSpoofMusicPatch : BytecodePatch(
|
||||
"const-string v$packageNameRegister, \"$MUSIC_PACKAGE_NAME\""
|
||||
)
|
||||
}
|
||||
} ?: return UserAgentHeaderBuilderFingerprint.toErrorResult()
|
||||
} ?: throw UserAgentHeaderBuilderFingerprint.exception
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,10 @@
|
||||
package app.revanced.patches.music.utils.fix.decoding.patch
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
|
||||
class DecodingPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
/**
|
||||
* For some reason, Androlib is incorrectly decoding some resources of YT Music
|
||||
@ -29,6 +27,5 @@ class DecodingPatch : ResourcePatch {
|
||||
}
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,14 +1,11 @@
|
||||
package app.revanced.patches.music.utils.litho.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.utils.litho.fingerprints.LithoFilterFingerprint
|
||||
@ -19,11 +16,10 @@ import java.io.Closeable
|
||||
|
||||
@DependsOn([ComponentParserPatch::class])
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class LithoFilterPatch : BytecodePatch(
|
||||
listOf(LithoFilterFingerprint)
|
||||
), Closeable {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
identifierHook("$MUSIC_ADS_PATH/LithoFilterPatch;->filter")
|
||||
|
||||
LithoFilterFingerprint.result?.mutableMethod?.apply {
|
||||
@ -40,9 +36,8 @@ class LithoFilterPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return LithoFilterFingerprint.toErrorResult()
|
||||
} ?: throw LithoFilterFingerprint.exception
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
override fun close() = LithoFilterFingerprint.result!!
|
||||
|
@ -2,12 +2,9 @@ package app.revanced.patches.music.utils.microg.bytecode.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
@ -37,7 +34,6 @@ import app.revanced.util.microg.MicroGBytecodeHelper
|
||||
@Name("MicroG support")
|
||||
@Description("Allows ReVanced Music to run without root and under a different package name with MicroG.")
|
||||
@MusicCompatibility
|
||||
@Version("0.0.2")
|
||||
class MicroGPatch : BytecodePatch(
|
||||
listOf(
|
||||
ServiceCheckFingerprint,
|
||||
@ -55,15 +51,15 @@ class MicroGPatch : BytecodePatch(
|
||||
// - "com.google.android.gms.phenotype.PACKAGE_NAME",
|
||||
// - "com.google.android.gms.phenotype.UPDATE",
|
||||
// - "com.google.android.gms.phenotype",
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
val youtubePackageName = PackageNamePatch.YouTubePackageName
|
||||
?: throw PatchResultError("Invalid package name.")
|
||||
?: throw PatchException("Invalid package name.")
|
||||
|
||||
val musicPackageName = PackageNamePatch.MusicPackageName
|
||||
?: throw PatchResultError("Invalid package name.")
|
||||
?: throw PatchException("Invalid package name.")
|
||||
|
||||
if (youtubePackageName == YOUTUBE_PACKAGE_NAME || musicPackageName == MUSIC_PACKAGE_NAME)
|
||||
throw PatchResultError("Original package name is not available as package name for MicroG build.")
|
||||
throw PatchException("Original package name is not available as package name for MicroG build.")
|
||||
|
||||
// apply common microG patch
|
||||
MicroGBytecodeHelper.patchBytecode(
|
||||
@ -88,6 +84,5 @@ class MicroGPatch : BytecodePatch(
|
||||
)
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
package app.revanced.patches.music.utils.microg.resource.patch
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.music.utils.microg.shared.Constants.MUSIC_PACKAGE_NAME
|
||||
@ -16,12 +14,12 @@ import app.revanced.util.resources.MusicResourceHelper.setMicroG
|
||||
|
||||
@DependsOn([PackageNamePatch::class])
|
||||
class MicroGResourcePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
val packageName = PackageNamePatch.MusicPackageName
|
||||
?: throw PatchResultError("Invalid package name.")
|
||||
?: throw PatchException("Invalid package name.")
|
||||
|
||||
if (packageName == MUSIC_PACKAGE_NAME)
|
||||
throw PatchResultError("Original package name is not available as package name for MicroG build.")
|
||||
throw PatchException("Original package name is not available as package name for MicroG build.")
|
||||
|
||||
// update manifest
|
||||
context.patchManifest(
|
||||
@ -37,6 +35,5 @@ class MicroGResourcePatch : ResourcePatch {
|
||||
|
||||
context.setMicroG(packageName)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,9 +1,7 @@
|
||||
package app.revanced.patches.music.utils.resourceid.patch
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
|
||||
@ -30,12 +28,12 @@ class SharedResourceIdPatch : ResourcePatch {
|
||||
var Text1: Long = -1
|
||||
}
|
||||
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
fun find(resourceType: ResourceType, resourceName: String) = ResourceMappingPatch
|
||||
.resourceMappings
|
||||
.find { it.type == resourceType.value && it.name == resourceName }?.id
|
||||
?: throw PatchResultError("Failed to find resource id : $resourceName")
|
||||
?: throw PatchException("Failed to find resource id : $resourceName")
|
||||
|
||||
ChipCloud = find(LAYOUT, "chip_cloud")
|
||||
ColorGrey = find(COLOR, "ytm_color_grey_12")
|
||||
@ -47,6 +45,5 @@ class SharedResourceIdPatch : ResourcePatch {
|
||||
QualityTitle = find(STRING, "quality_title")
|
||||
Text1 = find(ID, "text1")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,12 +1,10 @@
|
||||
package app.revanced.patches.music.utils.settings.bytecode.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.music.utils.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.music.utils.settings.bytecode.fingerprints.PreferenceFingerprint
|
||||
@ -22,7 +20,7 @@ class SettingsBytecodePatch : BytecodePatch(
|
||||
SettingsHeadersFragmentFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SettingsHeadersFragmentFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -34,7 +32,7 @@ class SettingsBytecodePatch : BytecodePatch(
|
||||
"invoke-static {v$targetRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->setActivity(Ljava/lang/Object;)V"
|
||||
)
|
||||
}
|
||||
} ?: return SettingsHeadersFragmentFingerprint.toErrorResult()
|
||||
} ?: throw SettingsHeadersFragmentFingerprint.exception
|
||||
|
||||
PreferenceFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -47,9 +45,8 @@ class SettingsBytecodePatch : BytecodePatch(
|
||||
"invoke-static {v$keyRegister, v$valueRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->onPreferenceChanged(Ljava/lang/String;Z)V"
|
||||
)
|
||||
}
|
||||
} ?: return PreferenceFingerprint.toErrorResult()
|
||||
} ?: throw PreferenceFingerprint.exception
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
@ -2,10 +2,7 @@ package app.revanced.patches.music.utils.settings.resource.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
@ -37,13 +34,12 @@ import java.nio.file.Paths
|
||||
]
|
||||
)
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class SettingsPatch : AbstractSettingsResourcePatch(
|
||||
"music/settings",
|
||||
"music/settings/host",
|
||||
false
|
||||
) {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
super.execute(context)
|
||||
contexts = context
|
||||
|
||||
@ -110,7 +106,6 @@ class SettingsPatch : AbstractSettingsResourcePatch(
|
||||
.let(::copyResources)
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
@ -1,12 +1,10 @@
|
||||
package app.revanced.patches.music.utils.videoid.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
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.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.music.utils.videoid.fingerprint.VideoIdParentFingerprint
|
||||
import app.revanced.util.integrations.Constants.MUSIC_UTILS_PATH
|
||||
@ -18,7 +16,7 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||
class VideoIdPatch : BytecodePatch(
|
||||
listOf(VideoIdParentFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
VideoIdParentFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -33,7 +31,7 @@ class VideoIdPatch : BytecodePatch(
|
||||
method.name == "handleVideoStageEvent"
|
||||
}
|
||||
}
|
||||
} ?: return VideoIdParentFingerprint.toErrorResult()
|
||||
} ?: throw VideoIdParentFingerprint.exception
|
||||
|
||||
insertMethod.apply {
|
||||
for (index in implementation!!.instructions.size - 1 downTo 0) {
|
||||
@ -53,7 +51,6 @@ class VideoIdPatch : BytecodePatch(
|
||||
|
||||
injectCall("$INTEGRATIONS_CLASS_DESCRIPTOR->setVideoId(Ljava/lang/String;)V")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
@ -1,12 +1,10 @@
|
||||
package app.revanced.patches.reddit.ad.banner.patch
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
|
||||
class HideBannerPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
context.xmlEditor[RESOURCE_FILE_PATH].use {
|
||||
it.file.getElementsByTagName("merge").item(0).childNodes.apply {
|
||||
val attributes = arrayOf("height", "width")
|
||||
@ -28,7 +26,6 @@ class HideBannerPatch : ResourcePatch {
|
||||
}
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,13 +1,10 @@
|
||||
package app.revanced.patches.reddit.ad.comments.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.data.toMethodWalker
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.reddit.ad.comments.fingerprints.HideCommentAdsFingerprint
|
||||
@ -15,7 +12,7 @@ import app.revanced.patches.reddit.ad.comments.fingerprints.HideCommentAdsFinger
|
||||
class HideCommentAdsPatch : BytecodePatch(
|
||||
listOf(HideCommentAdsFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
HideCommentAdsFingerprint.result?.let {
|
||||
with(
|
||||
context
|
||||
@ -34,9 +31,8 @@ class HideCommentAdsPatch : BytecodePatch(
|
||||
""", ExternalLabel("show", getInstruction(0))
|
||||
)
|
||||
}
|
||||
} ?: return HideCommentAdsFingerprint.toErrorResult()
|
||||
} ?: throw HideCommentAdsFingerprint.exception
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,17 +1,14 @@
|
||||
package app.revanced.patches.reddit.ad.general.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
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.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.patch.annotations.RequiresIntegrations
|
||||
@ -40,14 +37,13 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||
)
|
||||
@RedditCompatibility
|
||||
@RequiresIntegrations
|
||||
@Version("0.0.2")
|
||||
class HideAdsPatch : BytecodePatch(
|
||||
listOf(
|
||||
AdPostFingerprint,
|
||||
NewAdPostFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// region Filter promoted ads (does not work in popular or latest feed)
|
||||
|
||||
AdPostFingerprint.result?.let {
|
||||
@ -57,7 +53,7 @@ class HideAdsPatch : BytecodePatch(
|
||||
val targetReferenceName = (targetReference as FieldReference).name
|
||||
|
||||
if (targetReferenceName != "children")
|
||||
throw PatchResultError("Method signature reference name did not match: $targetReferenceName")
|
||||
throw PatchException("Method signature reference name did not match: $targetReferenceName")
|
||||
|
||||
val targetRegister = getInstruction<Instruction22c>(targetIndex).registerA
|
||||
|
||||
@ -68,7 +64,7 @@ class HideAdsPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return AdPostFingerprint.toErrorResult()
|
||||
} ?: throw AdPostFingerprint.exception
|
||||
|
||||
// The new feeds work by inserting posts into lists.
|
||||
// AdElementConverter is conveniently responsible for inserting all feed ads.
|
||||
@ -80,7 +76,7 @@ class HideAdsPatch : BytecodePatch(
|
||||
getInstruction<ReferenceInstruction>(targetIndex).reference.toString()
|
||||
|
||||
if (!targetParameter.endsWith("Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z"))
|
||||
throw PatchResultError("Method signature parameter did not match: $targetParameter")
|
||||
throw PatchException("Method signature parameter did not match: $targetParameter")
|
||||
|
||||
val targetRegister =
|
||||
getInstruction<FiveRegisterInstruction>(targetIndex).registerD + 1
|
||||
@ -93,11 +89,10 @@ class HideAdsPatch : BytecodePatch(
|
||||
""", ExternalLabel("show", getInstruction(targetIndex + 1))
|
||||
)
|
||||
}
|
||||
} ?: return NewAdPostFingerprint.toErrorResult()
|
||||
} ?: throw NewAdPostFingerprint.exception
|
||||
|
||||
updateSettingsStatus("GeneralAds")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.reddit.layout.navigation.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.reddit.layout.navigation.fingerprints.BottomNavScreenFingerprint
|
||||
@ -23,11 +20,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
@Description("Hide buttons at navigation bar.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@RedditCompatibility
|
||||
@Version("0.0.1")
|
||||
class NavigationButtonsPatch : BytecodePatch(
|
||||
listOf(BottomNavScreenFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
BottomNavScreenFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -40,11 +36,10 @@ class NavigationButtonsPatch : BytecodePatch(
|
||||
"invoke-static {v$targetRegister}, $INTEGRATIONS_METHOD_DESCRIPTOR"
|
||||
)
|
||||
}
|
||||
} ?: return BottomNavScreenFingerprint.toErrorResult()
|
||||
} ?: throw BottomNavScreenFingerprint.exception
|
||||
|
||||
updateSettingsStatus("NavigationButtons")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.reddit.layout.place.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.reddit.layout.place.fingerprints.HomePagerScreenFingerprint
|
||||
@ -24,11 +21,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@Description("Hide r/place button in toolbar.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@RedditCompatibility
|
||||
@Version("0.0.1")
|
||||
class PlaceButtonPatch : BytecodePatch(
|
||||
listOf(HomePagerScreenFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
HomePagerScreenFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -42,11 +38,10 @@ class PlaceButtonPatch : BytecodePatch(
|
||||
"invoke-static {v$targetRegister}, $INTEGRATIONS_METHOD_DESCRIPTOR"
|
||||
)
|
||||
}
|
||||
} ?: return HomePagerScreenFingerprint.toErrorResult()
|
||||
} ?: throw HomePagerScreenFingerprint.exception
|
||||
|
||||
updateSettingsStatus("PlaceButton")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
@ -1,14 +1,11 @@
|
||||
package app.revanced.patches.reddit.layout.premiumicon.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.reddit.layout.premiumicon.fingerprints.PremiumIconFingerprint
|
||||
import app.revanced.patches.reddit.utils.annotations.RedditCompatibility
|
||||
@ -17,11 +14,10 @@ import app.revanced.patches.reddit.utils.annotations.RedditCompatibility
|
||||
@Name("Premium icon")
|
||||
@Description("Unlocks premium icons.")
|
||||
@RedditCompatibility
|
||||
@Version("0.0.1")
|
||||
class PremiumIconPatch : BytecodePatch(
|
||||
listOf(PremiumIconFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
PremiumIconFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -32,8 +28,7 @@ class PremiumIconPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return PremiumIconFingerprint.toErrorResult()
|
||||
} ?: throw PremiumIconFingerprint.exception
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.reddit.layout.screenshotpopup.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
@ -29,11 +26,10 @@ import app.revanced.patches.reddit.utils.settings.resource.patch.SettingsPatch
|
||||
]
|
||||
)
|
||||
@RedditCompatibility
|
||||
@Version("0.0.1")
|
||||
class ScreenshotPopupPatch : BytecodePatch(
|
||||
listOf(ScreenshotTakenBannerFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
ScreenshotTakenBannerFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -46,11 +42,10 @@ class ScreenshotPopupPatch : BytecodePatch(
|
||||
""", ExternalLabel("dismiss", getInstruction(0))
|
||||
)
|
||||
}
|
||||
} ?: return ScreenshotTakenBannerFingerprint.toErrorResult()
|
||||
} ?: throw ScreenshotTakenBannerFingerprint.exception
|
||||
|
||||
updateSettingsStatus("ScreenshotPopup")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,14 +1,11 @@
|
||||
package app.revanced.patches.reddit.misc.openlink.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.reddit.misc.openlink.fingerprints.ScreenNavigatorFingerprint
|
||||
@ -21,11 +18,10 @@ import app.revanced.patches.reddit.utils.settings.resource.patch.SettingsPatch
|
||||
@Description("Skips over redirection URLs to external links.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@RedditCompatibility
|
||||
@Version("0.0.1")
|
||||
class OpenLinksDirectlyPatch : BytecodePatch(
|
||||
listOf(ScreenNavigatorFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
ScreenNavigatorFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
addInstructions(
|
||||
@ -35,11 +31,10 @@ class OpenLinksDirectlyPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return ScreenNavigatorFingerprint.toErrorResult()
|
||||
} ?: throw ScreenNavigatorFingerprint.exception
|
||||
|
||||
updateSettingsStatus("OpenLinksDirectly")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.reddit.misc.openlink.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
@ -24,11 +21,10 @@ import app.revanced.util.bytecode.getStringIndex
|
||||
@Description("Open links outside of the app directly in your browser.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@RedditCompatibility
|
||||
@Version("0.0.1")
|
||||
class OpenLinksExternallyPatch : BytecodePatch(
|
||||
listOf(ScreenNavigatorFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
ScreenNavigatorFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = getStringIndex("uri") + 2
|
||||
@ -42,11 +38,10 @@ class OpenLinksExternallyPatch : BytecodePatch(
|
||||
""", ExternalLabel("dismiss", getInstruction(insertIndex))
|
||||
)
|
||||
}
|
||||
} ?: return ScreenNavigatorFingerprint.toErrorResult()
|
||||
} ?: throw ScreenNavigatorFingerprint.exception
|
||||
|
||||
updateSettingsStatus("OpenLinksExternally")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.reddit.misc.tracking.url.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
@ -23,11 +20,10 @@ import app.revanced.patches.reddit.utils.settings.resource.patch.SettingsPatch
|
||||
@Description("Removes (tracking) query parameters from the URLs when sharing links.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@RedditCompatibility
|
||||
@Version("0.0.1")
|
||||
class SanitizeUrlQueryPatch : BytecodePatch(
|
||||
listOf(ShareLinkFormatterFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
ShareLinkFormatterFingerprint.result?.let { result ->
|
||||
result.mutableMethod.apply {
|
||||
|
||||
@ -41,11 +37,10 @@ class SanitizeUrlQueryPatch : BytecodePatch(
|
||||
""", ExternalLabel("off", getInstruction(0))
|
||||
)
|
||||
}
|
||||
} ?: return ShareLinkFormatterFingerprint.toErrorResult()
|
||||
} ?: throw ShareLinkFormatterFingerprint.exception
|
||||
|
||||
updateSettingsStatus("SanitizeUrlQuery")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,12 +1,10 @@
|
||||
package app.revanced.patches.reddit.utils.fix.decoding.patch
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
|
||||
class DecodingPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
arrayOf(
|
||||
"res/layout/notification_media_cancel_action.xml",
|
||||
@ -26,6 +24,5 @@ class DecodingPatch : ResourcePatch {
|
||||
}
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,9 +1,7 @@
|
||||
package app.revanced.patches.reddit.utils.resourceid.patch
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
|
||||
@ -16,15 +14,14 @@ class SharedResourceIdPatch : ResourcePatch {
|
||||
var ScreenShotShareBanner: Long = -1
|
||||
}
|
||||
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
fun find(resourceType: ResourceType, resourceName: String) = ResourceMappingPatch
|
||||
.resourceMappings
|
||||
.find { it.type == resourceType.value && it.name == resourceName }?.id
|
||||
?: throw PatchResultError("Failed to find resource id : $resourceName")
|
||||
?: throw PatchException("Failed to find resource id : $resourceName")
|
||||
|
||||
ScreenShotShareBanner = find(STRING, "screenshot_share_banner_title")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,13 +1,11 @@
|
||||
package app.revanced.patches.reddit.utils.settings.bytecode.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
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.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.reddit.utils.settings.bytecode.fingerprints.AcknowledgementsLabelBuilderFingerprint
|
||||
import app.revanced.patches.reddit.utils.settings.bytecode.fingerprints.OssLicensesMenuActivityOnCreateFingerprint
|
||||
@ -22,7 +20,7 @@ class SettingsBytecodePatch : BytecodePatch(
|
||||
SettingsStatusLoadFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
/**
|
||||
* Replace settings label
|
||||
@ -39,7 +37,7 @@ class SettingsBytecodePatch : BytecodePatch(
|
||||
"const-string v$insertRegister, \"ReVanced Extended\""
|
||||
)
|
||||
}
|
||||
} ?: return AcknowledgementsLabelBuilderFingerprint.toErrorResult()
|
||||
} ?: throw AcknowledgementsLabelBuilderFingerprint.exception
|
||||
|
||||
/**
|
||||
* Initialize settings activity
|
||||
@ -55,12 +53,11 @@ class SettingsBytecodePatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return OssLicensesMenuActivityOnCreateFingerprint.toErrorResult()
|
||||
} ?: throw OssLicensesMenuActivityOnCreateFingerprint.exception
|
||||
|
||||
settingsMethod = SettingsStatusLoadFingerprint.result?.mutableMethod
|
||||
?: return SettingsStatusLoadFingerprint.toErrorResult()
|
||||
?: throw SettingsStatusLoadFingerprint.exception
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
internal companion object {
|
||||
|
@ -2,11 +2,8 @@ package app.revanced.patches.reddit.utils.settings.resource.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
@ -27,9 +24,8 @@ import kotlin.io.path.exists
|
||||
]
|
||||
)
|
||||
@RedditCompatibility
|
||||
@Version("0.0.1")
|
||||
class SettingsPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
/**
|
||||
* Replace settings icon and label
|
||||
@ -39,7 +35,7 @@ class SettingsPatch : ResourcePatch {
|
||||
val targetXml = resDirectory.resolve("xml").resolve("$targetXML.xml").toPath()
|
||||
|
||||
if (!targetXml.exists())
|
||||
return PatchResultError("The preferences can not be found.")
|
||||
throw PatchException("The preferences can not be found.")
|
||||
|
||||
val preference = context["res/xml/$targetXML.xml"]
|
||||
|
||||
@ -52,6 +48,5 @@ class SettingsPatch : ResourcePatch {
|
||||
)
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,14 +1,11 @@
|
||||
package app.revanced.patches.shared.patch.ads
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.data.toMethodWalker
|
||||
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.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.fingerprints.ads.LegacyAdsFingerprint
|
||||
@ -22,7 +19,7 @@ abstract class AbstractAdsPatch(
|
||||
MainstreamAdsFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
LegacyAdsFingerprint.result?.let {
|
||||
(context.toMethodWalker(it.method)
|
||||
.nextMethod(13, true)
|
||||
@ -34,7 +31,7 @@ abstract class AbstractAdsPatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return LegacyAdsFingerprint.toErrorResult()
|
||||
} ?: throw LegacyAdsFingerprint.exception
|
||||
|
||||
MainstreamAdsFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -49,6 +46,5 @@ abstract class AbstractAdsPatch(
|
||||
}
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,22 +1,17 @@
|
||||
package app.revanced.patches.shared.patch.integrations
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patches.shared.patch.integrations.AbstractIntegrationsPatch.IntegrationsFingerprint.RegisterResolver
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.ClassDef
|
||||
import com.android.tools.smali.dexlib2.iface.Method
|
||||
|
||||
@Description("Applies mandatory patches to implement the ReVanced integrations into the application.")
|
||||
@Version("0.0.1")
|
||||
abstract class AbstractIntegrationsPatch(
|
||||
private val integrationsDescriptor: String,
|
||||
private val hooks: Iterable<IntegrationsFingerprint>
|
||||
@ -43,7 +38,7 @@ abstract class AbstractIntegrationsPatch(
|
||||
strings,
|
||||
customFingerprint
|
||||
) {
|
||||
fun invoke(integrationsDescriptor: String): PatchResult {
|
||||
fun invoke(integrationsDescriptor: String) {
|
||||
result?.mutableMethod?.let { method ->
|
||||
val contextRegister = contextRegisterResolver(method)
|
||||
|
||||
@ -52,9 +47,7 @@ abstract class AbstractIntegrationsPatch(
|
||||
"sput-object v$contextRegister, " +
|
||||
"$integrationsDescriptor->context:Landroid/content/Context;"
|
||||
)
|
||||
} ?: return toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
} ?: throw PatchException("Could not find target fingerprint.")
|
||||
}
|
||||
|
||||
interface RegisterResolver : (Method) -> Int {
|
||||
@ -62,20 +55,11 @@ abstract class AbstractIntegrationsPatch(
|
||||
}
|
||||
}
|
||||
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
if (context.findClass(integrationsDescriptor) == null) return MISSING_INTEGRATIONS
|
||||
|
||||
for (hook in hooks) hook.invoke(integrationsDescriptor).let {
|
||||
if (it is PatchResultError) return it
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
val MISSING_INTEGRATIONS = PatchResultError(
|
||||
"Integrations have not been merged yet. " +
|
||||
"This patch can not succeed without merging the integrations."
|
||||
override fun execute(context: BytecodeContext) {
|
||||
if (context.findClass(integrationsDescriptor) == null) throw PatchException(
|
||||
"Integrations have not been merged yet. This patch can not succeed without merging the integrations."
|
||||
)
|
||||
|
||||
for (hook in hooks) hook.invoke(integrationsDescriptor)
|
||||
}
|
||||
}
|
@ -1,13 +1,11 @@
|
||||
package app.revanced.patches.shared.patch.litho
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.fingerprints.litho.EmptyComponentBuilderFingerprint
|
||||
@ -27,7 +25,7 @@ class ComponentParserPatch : BytecodePatch(
|
||||
IdentifierFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
EmptyComponentBuilderFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -52,9 +50,9 @@ class ComponentParserPatch : BytecodePatch(
|
||||
}
|
||||
|
||||
if (emptyComponentLabel.isEmpty())
|
||||
throw PatchResultError("could not find Empty Component Label in method")
|
||||
throw PatchException("could not find Empty Component Label in method")
|
||||
}
|
||||
} ?: return EmptyComponentBuilderFingerprint.toErrorResult()
|
||||
} ?: throw EmptyComponentBuilderFingerprint.exception
|
||||
|
||||
IdentifierFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -89,9 +87,8 @@ class ComponentParserPatch : BytecodePatch(
|
||||
|
||||
insertIndex = stringBuilderIndex + 1
|
||||
}
|
||||
} ?: return IdentifierFingerprint.toErrorResult()
|
||||
} ?: throw IdentifierFingerprint.exception
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
internal companion object {
|
||||
|
@ -1,8 +1,6 @@
|
||||
package app.revanced.patches.shared.patch.mapping
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import org.w3c.dom.Element
|
||||
import java.util.Collections
|
||||
@ -18,7 +16,7 @@ class ResourceMappingPatch : ResourcePatch {
|
||||
private val threadPoolExecutor = Executors.newFixedThreadPool(THREAD_COUNT)
|
||||
}
|
||||
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
// save the file in memory to concurrently read from
|
||||
val resourceXmlFile = context["res/values/public.xml"].readBytes()
|
||||
|
||||
@ -59,7 +57,6 @@ class ResourceMappingPatch : ResourcePatch {
|
||||
|
||||
resourceMappings = mappings
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,13 +1,11 @@
|
||||
package app.revanced.patches.shared.patch.opus
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.fingerprints.opus.CodecReferenceFingerprint
|
||||
import app.revanced.patches.shared.fingerprints.opus.CodecSelectorFingerprint
|
||||
@ -24,7 +22,7 @@ abstract class AbstractOpusCodecsPatch(
|
||||
CodecSelectorFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
CodecReferenceFingerprint.result?.mutableMethod?.let {
|
||||
it.implementation!!.instructions.apply {
|
||||
@ -41,9 +39,9 @@ abstract class AbstractOpusCodecsPatch(
|
||||
}
|
||||
}
|
||||
if (targetIndex == 0)
|
||||
throw PatchResultError("Target method not found!")
|
||||
throw PatchException("Target method not found!")
|
||||
}
|
||||
} ?: return CodecReferenceFingerprint.toErrorResult()
|
||||
} ?: throw CodecReferenceFingerprint.exception
|
||||
|
||||
CodecSelectorFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -60,9 +58,8 @@ abstract class AbstractOpusCodecsPatch(
|
||||
""", ExternalLabel("mp4a", getInstruction(targetIndex + 1))
|
||||
)
|
||||
}
|
||||
} ?: return CodecSelectorFingerprint.toErrorResult()
|
||||
} ?: throw CodecSelectorFingerprint.exception
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
@ -2,12 +2,9 @@ package app.revanced.patches.shared.patch.packagename
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.OptionsContainer
|
||||
import app.revanced.patcher.patch.PatchOption
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.RVXCompatibility
|
||||
@ -16,10 +13,8 @@ import app.revanced.patches.shared.annotation.RVXCompatibility
|
||||
@Name("Custom package name")
|
||||
@Description("Specifies the package name for YouTube and YT Music in the MicroG build.")
|
||||
@RVXCompatibility
|
||||
@Version("0.0.1")
|
||||
class PackageNamePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
return PatchResultSuccess()
|
||||
override fun execute(context: ResourceContext) {
|
||||
}
|
||||
|
||||
companion object : OptionsContainer() {
|
||||
|
@ -1,8 +1,6 @@
|
||||
package app.revanced.patches.shared.patch.settings
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.util.resources.ResourceUtils
|
||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||
@ -19,7 +17,7 @@ abstract class AbstractSettingsResourcePatch(
|
||||
private val sourceHostDirectory: String,
|
||||
private val isYouTube: Boolean,
|
||||
) : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
/**
|
||||
* Copy strings
|
||||
*/
|
||||
@ -34,6 +32,5 @@ abstract class AbstractSettingsResourcePatch(
|
||||
ResourceUtils.ResourceGroup("xml", "revanced_prefs.xml")
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,12 +1,10 @@
|
||||
package app.revanced.patches.shared.patch.versionspoof
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patches.shared.fingerprints.versionspoof.ClientInfoFingerprint
|
||||
import app.revanced.patches.shared.fingerprints.versionspoof.ClientInfoParentFingerprint
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
@ -19,7 +17,7 @@ abstract class AbstractVersionSpoofPatch(
|
||||
) : BytecodePatch(
|
||||
listOf(ClientInfoParentFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
ClientInfoParentFingerprint.result?.let { parentResult ->
|
||||
ClientInfoFingerprint.also {
|
||||
@ -52,11 +50,10 @@ abstract class AbstractVersionSpoofPatch(
|
||||
)
|
||||
break
|
||||
}
|
||||
if (insertIndex <= 0) return ClientInfoFingerprint.toErrorResult()
|
||||
if (insertIndex <= 0) throw ClientInfoFingerprint.exception
|
||||
}
|
||||
} ?: return ClientInfoFingerprint.toErrorResult()
|
||||
} ?: return ClientInfoParentFingerprint.toErrorResult()
|
||||
} ?: throw ClientInfoFingerprint.exception
|
||||
} ?: throw ClientInfoParentFingerprint.exception
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -5,8 +5,6 @@ import app.revanced.extensions.injectHideCall
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.AdAttribution
|
||||
@ -18,7 +16,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
||||
@DependsOn([SharedResourceIdPatch::class])
|
||||
@Suppress("LABEL_NAME_CLASH")
|
||||
class GeneralAdsBytecodePatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
context.classes.forEach { classDef ->
|
||||
classDef.methods.forEach { method ->
|
||||
if (!method.isWideLiteralExists(AdAttribution))
|
||||
@ -44,6 +42,5 @@ class GeneralAdsBytecodePatch : BytecodePatch() {
|
||||
}
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,7 @@ import app.revanced.extensions.doRecursively
|
||||
import app.revanced.extensions.startsWithAny
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
@ -36,7 +33,6 @@ import org.w3c.dom.Element
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class GeneralAdsPatch : ResourcePatch {
|
||||
private val resourceFileNames = arrayOf(
|
||||
"promoted_",
|
||||
@ -59,7 +55,7 @@ class GeneralAdsPatch : ResourcePatch {
|
||||
"Top"
|
||||
)
|
||||
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
LithoFilterPatch.addFilter("$PATCHES_PATH/ads/AdsFilter;")
|
||||
|
||||
context.forEach {
|
||||
@ -111,6 +107,5 @@ class GeneralAdsPatch : ResourcePatch {
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-general-ads")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,12 +1,10 @@
|
||||
package app.revanced.patches.youtube.ads.getpremium.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.youtube.ads.getpremium.fingerprints.CompactYpcOfferModuleViewFingerprint
|
||||
import app.revanced.util.integrations.Constants.PATCHES_PATH
|
||||
@ -15,7 +13,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
class HideGetPremiumPatch : BytecodePatch(
|
||||
listOf(CompactYpcOfferModuleViewFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
CompactYpcOfferModuleViewFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -37,8 +35,7 @@ class HideGetPremiumPatch : BytecodePatch(
|
||||
""", ExternalLabel("show", getInstruction(startIndex + 2))
|
||||
)
|
||||
}
|
||||
} ?: return CompactYpcOfferModuleViewFingerprint.toErrorResult()
|
||||
} ?: throw CompactYpcOfferModuleViewFingerprint.exception
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ package app.revanced.patches.youtube.ads.video.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.patch.ads.AbstractAdsPatch
|
||||
@ -18,11 +15,10 @@ import app.revanced.util.integrations.Constants.ADS_PATH
|
||||
@Description("Hides ads in the video player.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class VideoAdsPatch : AbstractAdsPatch(
|
||||
"$ADS_PATH/HideVideoAdsPatch;->hideVideoAds()Z"
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
super.execute(context)
|
||||
|
||||
/**
|
||||
@ -37,6 +33,5 @@ class VideoAdsPatch : AbstractAdsPatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-video-ads")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ package app.revanced.patches.youtube.buttomplayer.buttoncontainer.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
@ -24,9 +21,8 @@ import app.revanced.util.integrations.Constants.PATCHES_PATH
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class ButtonContainerPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
LithoFilterPatch.addFilter("$PATCHES_PATH/ads/ButtonsFilter;")
|
||||
|
||||
@ -42,6 +38,5 @@ class ButtonContainerPatch : ResourcePatch {
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-button-container")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ package app.revanced.patches.youtube.buttomplayer.comment.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
@ -26,9 +23,8 @@ import app.revanced.util.integrations.Constants.PATCHES_PATH
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class CommentComponentPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
LithoFilterPatch.addFilter("$PATCHES_PATH/ads/CommentsFilter;")
|
||||
LithoFilterPatch.addFilter("$PATCHES_PATH/ads/CommentsPreviewDotsFilter;")
|
||||
|
||||
@ -44,6 +40,5 @@ class CommentComponentPatch : ResourcePatch {
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-comment-component")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,13 @@
|
||||
package app.revanced.patches.youtube.flyoutpanel.feed.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
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.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.flyoutpanel.feed.fingerprints.BottomSheetMenuItemBuilderFingerprint
|
||||
@ -25,11 +22,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
@Description("Hides feed flyout panel components.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class FeedFlyoutPanelPatch : BytecodePatch(
|
||||
listOf(BottomSheetMenuItemBuilderFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
BottomSheetMenuItemBuilderFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -39,7 +35,7 @@ class FeedFlyoutPanelPatch : BytecodePatch(
|
||||
val targetParameter =
|
||||
getInstruction<ReferenceInstruction>(targetIndex - 1).reference
|
||||
if (!targetParameter.toString().endsWith("Ljava/lang/CharSequence;"))
|
||||
return PatchResultError("Method signature parameter did not match: $targetParameter")
|
||||
throw PatchException("Method signature parameter did not match: $targetParameter")
|
||||
|
||||
addInstructions(
|
||||
targetIndex + 1, """
|
||||
@ -48,7 +44,7 @@ class FeedFlyoutPanelPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return BottomSheetMenuItemBuilderFingerprint.toErrorResult()
|
||||
} ?: throw BottomSheetMenuItemBuilderFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -62,6 +58,5 @@ class FeedFlyoutPanelPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-feed-flyout-panel")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.flyoutpanel.oldqualitylayout.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.flyoutpanel.oldqualitylayout.fingerprints.QualityMenuViewInflateFingerprint
|
||||
@ -33,14 +30,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class OldQualityLayoutPatch : BytecodePatch(
|
||||
listOf(
|
||||
NewFlyoutPanelBuilderFingerprint,
|
||||
QualityMenuViewInflateFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
/**
|
||||
* Old method
|
||||
@ -55,7 +51,7 @@ class OldQualityLayoutPatch : BytecodePatch(
|
||||
"invoke-static { v$insertRegister }, $FLYOUT_PANEL->enableOldQualityMenu(Landroid/widget/ListView;)V"
|
||||
)
|
||||
}
|
||||
} ?: return QualityMenuViewInflateFingerprint.toErrorResult()
|
||||
} ?: throw QualityMenuViewInflateFingerprint.exception
|
||||
|
||||
/**
|
||||
* New method
|
||||
@ -70,7 +66,7 @@ class OldQualityLayoutPatch : BytecodePatch(
|
||||
"invoke-static { v$insertRegister }, $FLYOUT_PANEL->onFlyoutMenuCreate(Landroid/widget/LinearLayout;)V"
|
||||
)
|
||||
}
|
||||
} ?: return NewFlyoutPanelBuilderFingerprint.toErrorResult()
|
||||
} ?: throw NewFlyoutPanelBuilderFingerprint.exception
|
||||
|
||||
LithoFilterPatch.addFilter("$PATCHES_PATH/ads/VideoQualityMenuFilter;")
|
||||
|
||||
@ -87,6 +83,5 @@ class OldQualityLayoutPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("enable-old-quality-layout")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package app.revanced.patches.youtube.flyoutpanel.oldspeedlayout.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
@ -8,8 +8,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable
|
||||
import app.revanced.patches.youtube.flyoutpanel.oldspeedlayout.fingerprints.CustomPlaybackSpeedIntegrationsFingerprint
|
||||
@ -32,7 +30,7 @@ class OldSpeedLayoutPatch : BytecodePatch(
|
||||
PlaybackRateBottomSheetBuilderFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
/**
|
||||
* Find the values we need
|
||||
@ -42,7 +40,7 @@ class OldSpeedLayoutPatch : BytecodePatch(
|
||||
PLAYBACK_RATE_BOTTOM_SHEET_CLASS = definingClass
|
||||
PLAYBACK_RATE_BOTTOM_SHEET_BUILDER_METHOD = name
|
||||
}
|
||||
} ?: return PlaybackRateBottomSheetClassFingerprint.toErrorResult()
|
||||
} ?: throw PlaybackRateBottomSheetClassFingerprint.exception
|
||||
|
||||
/**
|
||||
* Create a static field in the patch
|
||||
@ -76,7 +74,7 @@ class OldSpeedLayoutPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return CustomPlaybackSpeedIntegrationsFingerprint.toErrorResult()
|
||||
} ?: throw CustomPlaybackSpeedIntegrationsFingerprint.exception
|
||||
|
||||
/**
|
||||
* Input 'playbackRateBottomSheetClass' in FlyoutPanelPatch.
|
||||
@ -88,7 +86,7 @@ class OldSpeedLayoutPatch : BytecodePatch(
|
||||
"sput-object p0, $INTEGRATIONS_CLASS_DESCRIPTOR->playbackRateBottomSheetClass:$PLAYBACK_RATE_BOTTOM_SHEET_CLASS"
|
||||
)
|
||||
}
|
||||
} ?: return PlaybackRateBottomSheetClassFingerprint.toErrorResult()
|
||||
} ?: throw PlaybackRateBottomSheetClassFingerprint.exception
|
||||
|
||||
/**
|
||||
* New method
|
||||
@ -103,11 +101,10 @@ class OldSpeedLayoutPatch : BytecodePatch(
|
||||
"invoke-static { v$insertRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->onFlyoutMenuCreate(Landroid/widget/LinearLayout;)V"
|
||||
)
|
||||
}
|
||||
} ?: return NewFlyoutPanelBuilderFingerprint.toErrorResult()
|
||||
} ?: throw NewFlyoutPanelBuilderFingerprint.exception
|
||||
|
||||
LithoFilterPatch.addFilter("$PATCHES_PATH/ads/PlaybackSpeedMenuFilter;")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -2,10 +2,7 @@ package app.revanced.patches.youtube.flyoutpanel.player.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
@ -24,9 +21,8 @@ import app.revanced.util.integrations.Constants.PATCHES_PATH
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class PlayerFlyoutPanelPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
LithoFilterPatch.addFilter("$PATCHES_PATH/ads/PlayerFlyoutPanelsFilter;")
|
||||
|
||||
/**
|
||||
@ -42,6 +38,5 @@ class PlayerFlyoutPanelPatch : ResourcePatch {
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-player-flyout-panel")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.fullscreen.autoplaypreview.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
@ -34,11 +31,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideAutoplayPreviewPatch : BytecodePatch(
|
||||
listOf(LayoutConstructorFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
LayoutConstructorFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val dummyRegister =
|
||||
@ -54,7 +50,7 @@ class HideAutoplayPreviewPatch : BytecodePatch(
|
||||
""", ExternalLabel("hidden", getInstruction(jumpIndex))
|
||||
)
|
||||
}
|
||||
} ?: return LayoutConstructorFingerprint.toErrorResult()
|
||||
} ?: throw LayoutConstructorFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -68,7 +64,6 @@ class HideAutoplayPreviewPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-autoplay-preview")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,16 +1,12 @@
|
||||
package app.revanced.patches.youtube.fullscreen.compactcontrolsoverlay.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.data.toMethodWalker
|
||||
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.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
@ -31,11 +27,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class CompactControlsOverlayPatch : BytecodePatch(
|
||||
listOf(YouTubeControlsOverlayFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
YouTubeControlsOverlayFingerprint.result?.let {
|
||||
with(
|
||||
@ -55,7 +50,7 @@ class CompactControlsOverlayPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return YouTubeControlsOverlayFingerprint.toErrorResult()
|
||||
} ?: throw YouTubeControlsOverlayFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -69,6 +64,5 @@ class CompactControlsOverlayPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("enable-compact-controls-overlay")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.fullscreen.endscreenoverlay.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
@ -29,11 +26,10 @@ import app.revanced.util.integrations.Constants.FULLSCREEN
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideEndScreenOverlayPatch : BytecodePatch(
|
||||
listOf(EndScreenResultsFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
EndScreenResultsFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
addInstructionsWithLabels(
|
||||
@ -45,7 +41,7 @@ class HideEndScreenOverlayPatch : BytecodePatch(
|
||||
""", ExternalLabel("show", getInstruction(0))
|
||||
)
|
||||
}
|
||||
} ?: return EndScreenResultsFingerprint.toErrorResult()
|
||||
} ?: throw EndScreenResultsFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -59,6 +55,5 @@ class HideEndScreenOverlayPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-endscreen-overlay")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
package app.revanced.patches.youtube.fullscreen.fullscreenpanels.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
@ -11,8 +10,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWith
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
@ -43,7 +40,6 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideFullscreenPanelsPatch : BytecodePatch(
|
||||
listOf(
|
||||
FullscreenEngagementPanelFingerprint,
|
||||
@ -51,7 +47,7 @@ class HideFullscreenPanelsPatch : BytecodePatch(
|
||||
LayoutConstructorFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
FullscreenEngagementPanelFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -63,7 +59,7 @@ class HideFullscreenPanelsPatch : BytecodePatch(
|
||||
"invoke-static {v$targetRegister}, $FULLSCREEN->hideFullscreenPanels(Landroidx/coordinatorlayout/widget/CoordinatorLayout;)V"
|
||||
)
|
||||
}
|
||||
} ?: return FullscreenEngagementPanelFingerprint.toErrorResult()
|
||||
} ?: throw FullscreenEngagementPanelFingerprint.exception
|
||||
|
||||
FullscreenViewAdderFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -100,7 +96,7 @@ class HideFullscreenPanelsPatch : BytecodePatch(
|
||||
""", ExternalLabel("hidden", getInstruction(invokeIndex + 1))
|
||||
)
|
||||
}
|
||||
} ?: return LayoutConstructorFingerprint.toErrorResult()
|
||||
} ?: throw LayoutConstructorFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -114,6 +110,5 @@ class HideFullscreenPanelsPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-fullscreen-panels")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,14 @@
|
||||
package app.revanced.patches.youtube.fullscreen.landscapemode.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.fullscreen.landscapemode.fingerprints.OrientationParentFingerprint
|
||||
@ -27,20 +24,19 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@Description("Disable landscape mode when entering fullscreen.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class LandScapeModePatch : BytecodePatch(
|
||||
listOf(OrientationParentFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
OrientationParentFingerprint.result?.classDef?.let { classDef ->
|
||||
arrayOf(
|
||||
OrientationPrimaryFingerprint,
|
||||
OrientationSecondaryFingerprint
|
||||
).forEach {
|
||||
it.also { it.resolve(context, classDef) }.result?.injectOverride()
|
||||
?: return it.toErrorResult()
|
||||
?: throw it.exception
|
||||
}
|
||||
} ?: return OrientationParentFingerprint.toErrorResult()
|
||||
} ?: throw OrientationParentFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -54,7 +50,6 @@ class LandScapeModePatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("disable-landscape-mode")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -2,10 +2,7 @@ package app.revanced.patches.youtube.fullscreen.quickactions.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
@ -26,9 +23,8 @@ import app.revanced.util.integrations.Constants.PATCHES_PATH
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class QuickActionsPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
LithoFilterPatch.addFilter("$PATCHES_PATH/ads/QuickActionFilter;")
|
||||
|
||||
/**
|
||||
@ -43,6 +39,5 @@ class QuickActionsPatch : ResourcePatch {
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-quick-actions")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,13 @@
|
||||
package app.revanced.patches.youtube.general.accountmenu.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.general.accountmenu.fingerprints.AccountMenuFingerprint
|
||||
@ -31,11 +28,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class AccountMenuPatch : BytecodePatch(
|
||||
listOf(AccountMenuParentFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
AccountMenuParentFingerprint.result?.let { parentResult ->
|
||||
AccountMenuFingerprint.also { it.resolve(context, parentResult.classDef) }.result?.let {
|
||||
@ -48,7 +44,7 @@ class AccountMenuPatch : BytecodePatch(
|
||||
"invoke-static {v$register}, $GENERAL->hideAccountMenu(Landroid/text/Spanned;)V"
|
||||
)
|
||||
}
|
||||
} ?: return AccountMenuFingerprint.toErrorResult()
|
||||
} ?: throw AccountMenuFingerprint.exception
|
||||
|
||||
parentResult.mutableMethod.apply {
|
||||
val endIndex = parentResult.scanResult.patternScanResult!!.endIndex
|
||||
@ -59,7 +55,7 @@ class AccountMenuPatch : BytecodePatch(
|
||||
"sput-object v$register, $GENERAL->compactLink:Landroid/view/View;"
|
||||
)
|
||||
}
|
||||
} ?: return AccountMenuParentFingerprint.toErrorResult()
|
||||
} ?: throw AccountMenuParentFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -73,6 +69,5 @@ class AccountMenuPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-account-menu")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,17 +1,14 @@
|
||||
package app.revanced.patches.youtube.general.autocaptions.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
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.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
@ -35,7 +32,6 @@ import app.revanced.util.integrations.Constants.GENERAL
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class AutoCaptionsPatch : BytecodePatch(
|
||||
listOf(
|
||||
StartVideoInformerFingerprint,
|
||||
@ -43,7 +39,7 @@ class AutoCaptionsPatch : BytecodePatch(
|
||||
SubtitleTrackFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
listOf(
|
||||
StartVideoInformerFingerprint.toPatch(Status.DISABLED),
|
||||
SubtitleButtonControllerFingerprint.toPatch(Status.ENABLED)
|
||||
@ -53,7 +49,7 @@ class AutoCaptionsPatch : BytecodePatch(
|
||||
const/4 v0, ${status.value}
|
||||
sput-boolean v0, $GENERAL->captionsButtonStatus:Z
|
||||
"""
|
||||
) ?: return fingerprint.toErrorResult()
|
||||
) ?: throw fingerprint.exception
|
||||
}
|
||||
|
||||
SubtitleTrackFingerprint.result?.let {
|
||||
@ -70,7 +66,7 @@ class AutoCaptionsPatch : BytecodePatch(
|
||||
""", ExternalLabel("auto_captions_shown", getInstruction(0))
|
||||
)
|
||||
}
|
||||
} ?: return SubtitleTrackFingerprint.toErrorResult()
|
||||
} ?: throw SubtitleTrackFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -84,7 +80,6 @@ class AutoCaptionsPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("disable-auto-captions")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private fun MethodFingerprint.toPatch(visibility: Status) = SetStatus(this, visibility)
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.general.autopopuppanels.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
@ -23,11 +20,10 @@ import app.revanced.util.integrations.Constants.GENERAL
|
||||
@Description("Hide automatic popup panels (playlist or live chat) on video player.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class PlayerPopupPanelsPatch : BytecodePatch(
|
||||
listOf(EngagementPanelControllerFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
EngagementPanelControllerFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -42,7 +38,7 @@ class PlayerPopupPanelsPatch : BytecodePatch(
|
||||
""", ExternalLabel("player_popup_panels_shown", getInstruction(0))
|
||||
)
|
||||
}
|
||||
} ?: return EngagementPanelControllerFingerprint.toErrorResult()
|
||||
} ?: throw EngagementPanelControllerFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -56,6 +52,5 @@ class PlayerPopupPanelsPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-auto-player-popup-panels")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,13 @@
|
||||
package app.revanced.patches.youtube.general.categorybar.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.general.categorybar.fingerprints.FilterBarHeightFingerprint
|
||||
@ -33,7 +30,6 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class CategoryBarPatch : BytecodePatch(
|
||||
listOf(
|
||||
FilterBarHeightFingerprint,
|
||||
@ -41,7 +37,7 @@ class CategoryBarPatch : BytecodePatch(
|
||||
SearchResultsChipBarFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
FilterBarHeightFingerprint.patch<TwoRegisterInstruction> { register ->
|
||||
"""
|
||||
@ -74,7 +70,6 @@ class CategoryBarPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-category-bar")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
@ -93,6 +88,6 @@ class CategoryBarPatch : BytecodePatch(
|
||||
|
||||
addInstructions(insertIndex, instructions(register))
|
||||
}
|
||||
} ?: throw toErrorResult()
|
||||
} ?: throw exception
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.general.channellistsubmenu.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.general.channellistsubmenu.fingerprints.ChannelListSubMenuFingerprint
|
||||
@ -29,11 +26,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class ChannelListSubMenuPatch : BytecodePatch(
|
||||
listOf(ChannelListSubMenuFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
ChannelListSubMenuFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -45,7 +41,7 @@ class ChannelListSubMenuPatch : BytecodePatch(
|
||||
"invoke-static {v$register}, $GENERAL->hideChannelListSubMenu(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
} ?: return ChannelListSubMenuFingerprint.toErrorResult()
|
||||
} ?: throw ChannelListSubMenuFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -59,6 +55,5 @@ class ChannelListSubMenuPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-channel-avatar-section")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.general.crowdfundingbox.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.general.crowdfundingbox.fingerprints.CrowdfundingBoxFingerprint
|
||||
@ -29,11 +26,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class CrowdfundingBoxPatch : BytecodePatch(
|
||||
listOf(CrowdfundingBoxFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
CrowdfundingBoxFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -45,7 +41,7 @@ class CrowdfundingBoxPatch : BytecodePatch(
|
||||
"invoke-static {v$register}, $GENERAL->hideCrowdfundingBox(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
} ?: return CrowdfundingBoxFingerprint.toErrorResult()
|
||||
} ?: throw CrowdfundingBoxFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -59,6 +55,5 @@ class CrowdfundingBoxPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-crowdfunding-box")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user