mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-06-12 05:07:45 +02:00
chore: Separate extensions by app (#3905)
This commit is contained in:
@ -543,6 +543,7 @@ public final class app/revanced/patches/shared/misc/extension/ExtensionHook {
|
||||
public final class app/revanced/patches/shared/misc/extension/SharedExtensionPatchKt {
|
||||
public static final fun extensionHook (Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Lapp/revanced/patches/shared/misc/extension/ExtensionHook;
|
||||
public static synthetic fun extensionHook$default (Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patches/shared/misc/extension/ExtensionHook;
|
||||
public static final fun sharedExtensionPatch (Ljava/lang/String;[Lapp/revanced/patches/shared/misc/extension/ExtensionHook;)Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
public static final fun sharedExtensionPatch ([Lapp/revanced/patches/shared/misc/extension/ExtensionHook;)Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,8 @@ import app.revanced.patches.all.misc.transformation.IMethodCall
|
||||
import app.revanced.patches.all.misc.transformation.filterMapInstruction35c
|
||||
import app.revanced.patches.all.misc.transformation.transformInstructionsPatch
|
||||
|
||||
internal const val EXTENSION_CLASS_DESCRIPTOR_PREFIX = "Lapp/revanced/extension/all/connectivity/wifi/spoof/SpoofWifiPatch"
|
||||
internal const val EXTENSION_CLASS_DESCRIPTOR_PREFIX =
|
||||
"Lapp/revanced/extension/all/connectivity/wifi/spoof/SpoofWifiPatch"
|
||||
|
||||
internal const val EXTENSION_CLASS_DESCRIPTOR = "$EXTENSION_CLASS_DESCRIPTOR_PREFIX;"
|
||||
|
||||
@ -15,7 +16,7 @@ val spoofWifiPatch = bytecodePatch(
|
||||
description = "Spoofs an existing Wi-Fi connection.",
|
||||
use = false,
|
||||
) {
|
||||
extendWith("extensions/all/connectivity/wifi/spoof/spoof-wifi.rve")
|
||||
extendWith("extensions/all/misc/connectivity/wifi/spoof/spoof-wifi.rve")
|
||||
|
||||
dependsOn(
|
||||
transformInstructionsPatch(
|
||||
|
@ -34,7 +34,7 @@ val removeScreenCaptureRestrictionPatch = bytecodePatch(
|
||||
description = "Removes the restriction of capturing audio from apps that normally wouldn't allow it.",
|
||||
use = false,
|
||||
) {
|
||||
extendWith("extensions/all/screencapture/remove-screen-capture-restriction.rve")
|
||||
extendWith("extensions/all/misc/screencapture/remove-screen-capture-restriction.rve")
|
||||
|
||||
dependsOn(
|
||||
removeCaptureRestrictionResourcePatch,
|
||||
|
@ -19,7 +19,7 @@ val removeScreenshotRestrictionPatch = bytecodePatch(
|
||||
description = "Removes the restriction of taking screenshots in apps that normally wouldn't allow it.",
|
||||
use = false,
|
||||
) {
|
||||
extendWith("extensions/all/screenshot/remove-screenshot-restriction.rve")
|
||||
extendWith("extensions/all/misc/screenshot/remove-screenshot-restriction.rve")
|
||||
|
||||
dependsOn(
|
||||
// Remove the restriction of taking screenshots.
|
||||
|
@ -3,4 +3,7 @@ package app.revanced.patches.music.misc.extension
|
||||
import app.revanced.patches.music.misc.extension.hooks.applicationInitHook
|
||||
import app.revanced.patches.shared.misc.extension.sharedExtensionPatch
|
||||
|
||||
val sharedExtensionPatch = sharedExtensionPatch(applicationInitHook)
|
||||
val sharedExtensionPatch = sharedExtensionPatch(
|
||||
"music",
|
||||
applicationInitHook,
|
||||
)
|
||||
|
@ -3,4 +3,4 @@ package app.revanced.patches.reddit.customclients.boostforreddit.misc.extension
|
||||
import app.revanced.patches.reddit.customclients.boostforreddit.misc.extension.hooks.initHook
|
||||
import app.revanced.patches.shared.misc.extension.sharedExtensionPatch
|
||||
|
||||
val sharedExtensionPatch = sharedExtensionPatch(initHook)
|
||||
val sharedExtensionPatch = sharedExtensionPatch("boostforreddit", initHook)
|
||||
|
@ -3,4 +3,4 @@ package app.revanced.patches.reddit.customclients.sync.syncforreddit.extension
|
||||
import app.revanced.patches.reddit.customclients.sync.syncforreddit.extension.hooks.initHook
|
||||
import app.revanced.patches.shared.misc.extension.sharedExtensionPatch
|
||||
|
||||
val sharedExtensionPatch = sharedExtensionPatch(initHook)
|
||||
val sharedExtensionPatch = sharedExtensionPatch("sync", initHook)
|
||||
|
@ -2,4 +2,4 @@ package app.revanced.patches.reddit.misc.extension
|
||||
|
||||
import app.revanced.patches.shared.misc.extension.sharedExtensionPatch
|
||||
|
||||
val sharedExtensionPatch = sharedExtensionPatch()
|
||||
val sharedExtensionPatch = sharedExtensionPatch("reddit")
|
||||
|
@ -14,6 +14,26 @@ import java.util.jar.JarFile
|
||||
|
||||
internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/shared/Utils;"
|
||||
|
||||
/**
|
||||
* A patch to extend with an extension shared with multiple patches.
|
||||
*
|
||||
* @param extensionName The name of the extension to extend with.
|
||||
*/
|
||||
fun sharedExtensionPatch(
|
||||
extensionName: String,
|
||||
vararg hooks: ExtensionHook,
|
||||
) = bytecodePatch {
|
||||
dependsOn(sharedExtensionPatch(*hooks))
|
||||
|
||||
extendWith("extensions/$extensionName.rve")
|
||||
}
|
||||
|
||||
/**
|
||||
* A patch to extend with the "shared" extension.
|
||||
*
|
||||
* @param hooks The hooks to get the application context for use in the extension,
|
||||
* commonly for the onCreate method of exported activities.
|
||||
*/
|
||||
fun sharedExtensionPatch(
|
||||
vararg hooks: ExtensionHook,
|
||||
) = bytecodePatch {
|
||||
|
@ -2,4 +2,4 @@ package app.revanced.patches.tiktok.misc.extension
|
||||
|
||||
import app.revanced.patches.shared.misc.extension.sharedExtensionPatch
|
||||
|
||||
val sharedExtensionPatch = sharedExtensionPatch(initHook)
|
||||
val sharedExtensionPatch = sharedExtensionPatch("tiktok", initHook)
|
||||
|
@ -2,4 +2,4 @@ package app.revanced.patches.tudortmund.misc.extension
|
||||
|
||||
import app.revanced.patches.shared.misc.extension.sharedExtensionPatch
|
||||
|
||||
val sharedExtensionPatch = sharedExtensionPatch()
|
||||
val sharedExtensionPatch = sharedExtensionPatch("tudortmund")
|
||||
|
@ -2,4 +2,4 @@ package app.revanced.patches.tumblr.misc.extension
|
||||
|
||||
import app.revanced.patches.shared.misc.extension.sharedExtensionPatch
|
||||
|
||||
val sharedExtensionPatch = sharedExtensionPatch()
|
||||
val sharedExtensionPatch = sharedExtensionPatch("tumblr")
|
||||
|
@ -2,4 +2,4 @@ package app.revanced.patches.twitch.misc.extension
|
||||
|
||||
import app.revanced.patches.shared.misc.extension.sharedExtensionPatch
|
||||
|
||||
val sharedExtensionPatch = sharedExtensionPatch(initHook)
|
||||
val sharedExtensionPatch = sharedExtensionPatch("twitch", initHook)
|
||||
|
@ -2,4 +2,4 @@ package app.revanced.patches.twitter.misc.extension
|
||||
|
||||
import app.revanced.patches.shared.misc.extension.sharedExtensionPatch
|
||||
|
||||
val sharedExtensionPatch = sharedExtensionPatch()
|
||||
val sharedExtensionPatch = sharedExtensionPatch("twitter")
|
||||
|
@ -3,7 +3,4 @@ package app.revanced.patches.youtube.misc.extension
|
||||
import app.revanced.patches.shared.misc.extension.sharedExtensionPatch
|
||||
import app.revanced.patches.youtube.misc.extension.hooks.*
|
||||
|
||||
// TODO: Move this to a "Hook.kt" file. Same for other extension hook patches.
|
||||
val sharedExtensionPatch = sharedExtensionPatch(
|
||||
applicationInitHook,
|
||||
)
|
||||
val sharedExtensionPatch = sharedExtensionPatch("youtube", applicationInitHook)
|
||||
|
@ -11,6 +11,7 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.shared.misc.mapping.get
|
||||
import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
|
||||
import app.revanced.patches.shared.misc.mapping.resourceMappings
|
||||
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
|
||||
import app.revanced.patches.youtube.misc.playservice.is_19_25_or_greater
|
||||
import app.revanced.patches.youtube.misc.playservice.is_19_35_or_greater
|
||||
import app.revanced.util.*
|
||||
@ -214,15 +215,17 @@ private var visibilityImmediateInsertIndex: Int = 0
|
||||
val playerControlsPatch = bytecodePatch(
|
||||
description = "Manages the code for the player controls of the YouTube player.",
|
||||
) {
|
||||
dependsOn(playerControlsResourcePatch)
|
||||
dependsOn(
|
||||
playerControlsResourcePatch,
|
||||
sharedExtensionPatch,
|
||||
)
|
||||
|
||||
execute {
|
||||
fun MutableMethod.indexOfFirstViewInflateOrThrow() =
|
||||
indexOfFirstInstructionOrThrow {
|
||||
val reference = getReference<MethodReference>()
|
||||
reference?.definingClass == "Landroid/view/ViewStub;" &&
|
||||
reference.name == "inflate"
|
||||
}
|
||||
fun MutableMethod.indexOfFirstViewInflateOrThrow() = indexOfFirstInstructionOrThrow {
|
||||
val reference = getReference<MethodReference>()
|
||||
reference?.definingClass == "Landroid/view/ViewStub;" &&
|
||||
reference.name == "inflate"
|
||||
}
|
||||
|
||||
playerBottomControlsInflateFingerprint.method.apply {
|
||||
inflateBottomControlMethod = this
|
||||
@ -292,7 +295,7 @@ val playerControlsPatch = bytecodePatch(
|
||||
"""
|
||||
invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->getPlayerTopControlsLayoutResourceName(Ljava/lang/String;)Ljava/lang/String;
|
||||
move-result-object v$register
|
||||
"""
|
||||
""",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user