mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-21 18:03:56 +00:00
use new delegate api
This commit is contained in:
@@ -4,7 +4,7 @@ import app.revanced.patcher.patch.creatingResourcePatch
|
||||
|
||||
|
||||
@Suppress("unused", "ObjectPropertyName")
|
||||
val `"Export all activities"` by creatingResourcePatch(
|
||||
val `Export all activities` by creatingResourcePatch(
|
||||
description = "Makes all app activities exportable.",
|
||||
use = false,
|
||||
) {
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package app.revanced.patches.music.misc.extension.hooks
|
||||
|
||||
import app.revanced.patcher.*
|
||||
import app.revanced.patcher.name
|
||||
import app.revanced.patcher.parameterTypes
|
||||
import app.revanced.patcher.returnType
|
||||
import app.revanced.patcher.strings
|
||||
import app.revanced.patches.music.shared.YOUTUBE_MUSIC_MAIN_ACTIVITY_CLASS_TYPE
|
||||
import app.revanced.patches.shared.misc.extension.activityOnCreateExtensionHook
|
||||
import app.revanced.patches.shared.misc.extension.extensionHook
|
||||
@@ -9,7 +12,7 @@ internal val applicationInitHook = extensionHook {
|
||||
name("onCreate")
|
||||
returnType("V")
|
||||
parameterTypes()
|
||||
instructions("activity"())
|
||||
strings("activity")
|
||||
}
|
||||
|
||||
internal val applicationInitOnCreateHook = activityOnCreateExtensionHook(YOUTUBE_MUSIC_MAIN_ACTIVITY_CLASS_TYPE)
|
||||
|
||||
@@ -85,7 +85,7 @@ val downloadsPatch = bytecodePatch(
|
||||
injectVisibilityCheckCall(BUTTON_DESCRIPTOR)
|
||||
|
||||
// Main activity is used to launch downloader intent.
|
||||
mainActivityOnCreateMethod.method.addInstruction(
|
||||
mainActivityOnCreateMethod.addInstruction(
|
||||
0,
|
||||
"invoke-static/range { p0 .. p0 }, ${EXTENSION_CLASS_DESCRIPTOR}->setMainActivity(Landroid/app/Activity;)V"
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@ import app.revanced.patcher.Fingerprint
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.getInstruction
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patches.youtube.layout.shortsplayer.openShortsInRegularPlayerPatch
|
||||
import app.revanced.patches.youtube.layout.shortsplayer.`Open Shorts in regular player`
|
||||
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
|
||||
import app.revanced.patches.youtube.misc.playservice.is_19_46_or_greater
|
||||
import app.revanced.patches.youtube.misc.playservice.versionCheckPatch
|
||||
@@ -15,7 +15,7 @@ internal const val EXTENSION_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/extension/youtube/patches/OpenVideosFullscreenHookPatch;"
|
||||
|
||||
/**
|
||||
* Used by both [openVideosFullscreenPatch] and [openShortsInRegularPlayerPatch].
|
||||
* Used by both [openVideosFullscreenPatch] and [`Open Shorts in regular player`].
|
||||
*/
|
||||
internal val openVideosFullscreenHookPatch = bytecodePatch {
|
||||
dependsOn(
|
||||
|
||||
@@ -4,7 +4,7 @@ import app.revanced.patcher.extensions.addInstruction
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.getInstruction
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patcher.patch.creatingBytecodePatch
|
||||
import com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable
|
||||
import app.revanced.patches.all.misc.resources.addResources
|
||||
import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
|
||||
@@ -31,8 +31,8 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter
|
||||
|
||||
private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/youtube/patches/ShortsAutoplayPatch;"
|
||||
|
||||
val shortsAutoplayPatch = bytecodePatch(
|
||||
name = "Shorts autoplay",
|
||||
@Suppress("ObjectPropertyName")
|
||||
val `Shorts autoplay` by creatingBytecodePatch(
|
||||
description = "Adds options to automatically play the next Short.",
|
||||
) {
|
||||
dependsOn(
|
||||
@@ -65,12 +65,12 @@ val shortsAutoplayPatch = bytecodePatch(
|
||||
}
|
||||
|
||||
// Main activity is used to check if app is in pip mode.
|
||||
mainActivityOnCreateMethod.method.addInstruction(
|
||||
mainActivityOnCreateMethod.addInstruction(
|
||||
0,
|
||||
"invoke-static/range { p0 .. p0 }, $EXTENSION_CLASS_DESCRIPTOR->setMainActivity(Landroid/app/Activity;)V",
|
||||
)
|
||||
|
||||
var reelEnumClass : String
|
||||
var reelEnumClass: String
|
||||
|
||||
reelEnumConstructorFingerprint.let {
|
||||
reelEnumClass = it.originalClassDef.type
|
||||
@@ -85,7 +85,7 @@ val shortsAutoplayPatch = bytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
reelPlaybackRepeatFingerprint.match(
|
||||
reelPlaybackRepeatParentFingerprint.originalClassDef
|
||||
).method.apply {
|
||||
@@ -93,8 +93,8 @@ val shortsAutoplayPatch = bytecodePatch(
|
||||
findInstructionIndicesReversedOrThrow {
|
||||
val reference = getReference<MethodReference>()
|
||||
reference?.definingClass == reelEnumClass &&
|
||||
reference.parameterTypes.firstOrNull() == "I" &&
|
||||
reference.returnType == reelEnumClass
|
||||
reference.parameterTypes.firstOrNull() == "I" &&
|
||||
reference.returnType == reelEnumClass
|
||||
}.forEach { index ->
|
||||
val register = getInstruction<OneRegisterInstruction>(index + 1).registerA
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.getInstruction
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patcher.patch.creatingBytecodePatch
|
||||
import app.revanced.patches.all.misc.resources.addResources
|
||||
import app.revanced.patches.all.misc.resources.addResourcesPatch
|
||||
import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
|
||||
@@ -29,9 +30,8 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
private const val EXTENSION_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/extension/youtube/patches/OpenShortsInRegularPlayerPatch;"
|
||||
|
||||
@Suppress("unused")
|
||||
val openShortsInRegularPlayerPatch = bytecodePatch(
|
||||
name = "Open Shorts in regular player",
|
||||
@Suppress("unused", "ObjectPropertyName")
|
||||
val `Open Shorts in regular player` by creatingBytecodePatch(
|
||||
description = "Adds options to open Shorts in the regular video player.",
|
||||
) {
|
||||
dependsOn(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package app.revanced.patches.youtube.misc.announcements
|
||||
|
||||
import app.revanced.patcher.extensions.addInstruction
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patcher.patch.creatingBytecodePatch
|
||||
import app.revanced.patches.all.misc.resources.addResources
|
||||
import app.revanced.patches.all.misc.resources.addResourcesPatch
|
||||
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
|
||||
@@ -12,8 +12,8 @@ import app.revanced.patches.youtube.shared.mainActivityOnCreateMethod
|
||||
private const val EXTENSION_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/extension/youtube/patches/announcements/AnnouncementsPatch;"
|
||||
|
||||
val announcementsPatch = bytecodePatch(
|
||||
name = "Announcements",
|
||||
@Suppress("unused")
|
||||
val Announcements by creatingBytecodePatch(
|
||||
description = "Adds an option to show announcements from ReVanced on app startup.",
|
||||
) {
|
||||
dependsOn(
|
||||
@@ -37,7 +37,7 @@ val announcementsPatch = bytecodePatch(
|
||||
SwitchPreference("revanced_announcements"),
|
||||
)
|
||||
|
||||
mainActivityOnCreateMethod.method.addInstruction(
|
||||
mainActivityOnCreateMethod.addInstruction(
|
||||
0,
|
||||
"invoke-static/range { p0 .. p0 }, $EXTENSION_CLASS_DESCRIPTOR->showAnnouncement(Landroid/app/Activity;)V",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user