build(Needs bump): Bump dependencies

This commit is contained in:
oSumAtrIX
2023-08-23 05:01:09 +02:00
parent 3072412c79
commit 1817dbd10c
214 changed files with 473 additions and 1271 deletions
@@ -7,9 +7,7 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWith
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.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.shared.settings.preference.impl.StringResource
@@ -30,7 +28,7 @@ class AutoRepeatPatch : BytecodePatch(
AutoRepeatParentFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
override fun execute(context: BytecodeContext) {
SettingsPatch.PreferenceScreen.MISC.addPreferences(
SwitchPreference(
"revanced_auto_repeat",
@@ -42,7 +40,7 @@ class AutoRepeatPatch : BytecodePatch(
//Get Result from the ParentFingerprint which is the playMethod we need to get.
val parentResult = AutoRepeatParentFingerprint.result
?: return PatchResultError("ParentFingerprint did not resolve.")
?: throw PatchException("ParentFingerprint did not resolve.")
//this one needs to be called when app/revanced/integrations/patches/AutoRepeatPatch;->shouldAutoRepeat() returns true
val playMethod = parentResult.mutableMethod
@@ -52,7 +50,7 @@ class AutoRepeatPatch : BytecodePatch(
//This is the method we search for
val result = AutoRepeatFingerprint.result
?: return PatchResultError("FingerPrint did not resolve.")
?: throw PatchException("FingerPrint did not resolve.")
val method = result.mutableMethod
//Instructions to add to the smali code
@@ -67,7 +65,7 @@ class AutoRepeatPatch : BytecodePatch(
//Get the implementation so we can do a check for null and get instructions size.
val implementation = method.implementation
?: return PatchResultError("No Method Implementation found!")
?: throw PatchException("No Method Implementation found!")
//Since addInstructions needs an index which starts counting at 0 and size starts counting at 1,
//we have to remove 1 to get the latest instruction
@@ -80,6 +78,5 @@ class AutoRepeatPatch : BytecodePatch(
method.addInstructionsWithLabels(index, instructions)
//Everything worked as expected, return Success
return PatchResultSuccess()
}
}
@@ -5,8 +5,6 @@ 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.youtube.misc.bottomsheet.hook.fingerprints.CreateBottomSheetFingerprint
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
@@ -16,7 +14,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
class BottomSheetHookPatch : BytecodePatch(
listOf(CreateBottomSheetFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
override fun execute(context: BytecodeContext) {
CreateBottomSheetFingerprint.result?.let {
it.mutableMethod.apply {
val returnLinearLayoutIndex = implementation!!.instructions.lastIndex
@@ -31,9 +29,7 @@ class BottomSheetHookPatch : BytecodePatch(
)
}
}
} ?: return CreateBottomSheetFingerprint.toErrorResult()
return PatchResultSuccess()
} ?: throw CreateBottomSheetFingerprint.toErrorResult()
}
internal companion object {
@@ -1,20 +1,16 @@
package app.revanced.patches.youtube.misc.bottomsheet.hook.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.mapping.misc.patch.ResourceMappingPatch
@DependsOn([ResourceMappingPatch::class])
class BottomSheetHookResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
override fun execute(context: ResourceContext) {
bottomSheetMargins = ResourceMappingPatch.resourceMappings.find { it.name == "bottom_sheet_margins" }?.id
?: return PatchResultError("Could not find resource")
return PatchResultSuccess()
?: throw PatchException("Could not find resource")
}
internal companion object {
@@ -3,8 +3,6 @@ package app.revanced.patches.youtube.misc.debugging.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
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
@@ -20,7 +18,7 @@ import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
@Description("Adds debugging options.")
@DebuggingCompatibility
class DebuggingPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
override fun execute(context: ResourceContext) {
SettingsPatch.PreferenceScreen.MISC.addPreferences(
app.revanced.patches.shared.settings.preference.impl.PreferenceScreen(
"revanced_debug_preference_screen",
@@ -67,7 +65,5 @@ class DebuggingPatch : ResourcePatch {
StringResource("revanced_debug_preference_screen_summary", "Enable or disable debugging options")
)
)
return PatchResultSuccess()
}
}
@@ -7,9 +7,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
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.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.youtube.misc.fix.backtoexitgesture.annotation.FixBackToExitGestureCompatibility
import app.revanced.patches.youtube.misc.fix.backtoexitgesture.fingerprints.OnBackPressedFingerprint
import app.revanced.patches.youtube.misc.fix.backtoexitgesture.fingerprints.RecyclerViewScrollingFingerprint
@@ -25,12 +22,12 @@ class FixBackToExitGesturePatch : BytecodePatch(
OnBackPressedFingerprint,
)
) {
override fun execute(context: BytecodeContext): PatchResult {
override fun execute(context: BytecodeContext) {
RecyclerViewTopScrollingFingerprint.apply {
resolve(
context,
RecyclerViewTopScrollingParentFingerprint.result?.classDef
?: return RecyclerViewTopScrollingParentFingerprint.toErrorResult()
?: throw RecyclerViewTopScrollingParentFingerprint.toErrorResult()
)
}
@@ -44,15 +41,7 @@ class FixBackToExitGesturePatch : BytecodePatch(
OnBackPressedFingerprint to IntegrationsMethod(
"p0", "onBackPressed", "Lcom/google/android/apps/youtube/app/watchwhile/WatchWhileActivity;"
)
).forEach { (fingerprint, target) ->
try {
fingerprint.injectCall(target)
} catch (error: PatchResultError) {
return error
}
}
return PatchResultSuccess()
).forEach { (fingerprint, target) -> fingerprint.injectCall(target) }
}
private companion object {
@@ -7,8 +7,6 @@ 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.misc.fix.playback.annotations.ClientSpoofCompatibility
@@ -23,7 +21,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
class ClientSpoofPatch : BytecodePatch(
listOf(UserAgentHeaderBuilderFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
override fun execute(context: BytecodeContext) {
UserAgentHeaderBuilderFingerprint.result?.let { result ->
val insertIndex = result.scanResult.patternScanResult!!.endIndex
result.mutableMethod.apply {
@@ -32,9 +30,7 @@ class ClientSpoofPatch : BytecodePatch(
addInstruction(insertIndex, "const-string v$packageNameRegister, \"$ORIGINAL_PACKAGE_NAME\"")
}
} ?: return UserAgentHeaderBuilderFingerprint.toErrorResult()
return PatchResultSuccess()
} ?: throw UserAgentHeaderBuilderFingerprint.toErrorResult()
}
private companion object {
@@ -4,14 +4,11 @@ import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
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.extensions.InstructionExtensions.replaceInstruction
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.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.youtube.misc.fix.playback.fingerprints.ProtobufParameterBuilderFingerprint
@@ -36,7 +33,7 @@ class SpoofSignatureVerificationPatch : BytecodePatch(
ScrubbedPreviewLayoutFingerprint,
)
) {
override fun execute(context: BytecodeContext): PatchResult {
override fun execute(context: BytecodeContext) {
// hook parameter
ProtobufParameterBuilderFingerprint.result?.let {
@@ -55,14 +52,14 @@ class SpoofSignatureVerificationPatch : BytecodePatch(
"""
)
}
} ?: return ProtobufParameterBuilderFingerprint.toErrorResult()
} ?: throw ProtobufParameterBuilderFingerprint.toErrorResult()
// When signature spoofing is enabled, the seekbar when tapped does not show
// the video time, chapter names, or the video thumbnail.
// Changing the value returned of this method forces all of these to show up,
// except the thumbnails are blank, which is handled with the patch below.
StoryboardThumbnailParentFingerprint.result ?: return StoryboardThumbnailParentFingerprint.toErrorResult()
StoryboardThumbnailParentFingerprint.result ?: throw StoryboardThumbnailParentFingerprint.toErrorResult()
StoryboardThumbnailFingerprint.resolve(context, StoryboardThumbnailParentFingerprint.result!!.classDef)
StoryboardThumbnailFingerprint.result?.apply {
val endIndex = scanResult.patternScanResult!!.endIndex
@@ -84,7 +81,7 @@ class SpoofSignatureVerificationPatch : BytecodePatch(
return v0
"""
)
} ?: return StoryboardThumbnailFingerprint.toErrorResult()
} ?: throw StoryboardThumbnailFingerprint.toErrorResult()
// Seekbar thumbnail now show up but are always a blank image.
@@ -102,9 +99,7 @@ class SpoofSignatureVerificationPatch : BytecodePatch(
"""
)
}
} ?: return ScrubbedPreviewLayoutFingerprint.toErrorResult()
return PatchResultSuccess()
} ?: throw ScrubbedPreviewLayoutFingerprint.toErrorResult()
}
private companion object {
@@ -1,8 +1,6 @@
package app.revanced.patches.youtube.misc.fix.playback.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 app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
@@ -13,7 +11,7 @@ import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
class SpoofSignatureVerificationResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
override fun execute(context: ResourceContext) {
SettingsPatch.PreferenceScreen.MISC.addPreferences(
SwitchPreference(
"revanced_spoof_signature_verification",
@@ -33,8 +31,6 @@ class SpoofSignatureVerificationResourcePatch : ResourcePatch {
scrubbedPreviewThumbnailResourceId = ResourceMappingPatch.resourceMappings.single {
it.type == "id" && it.name == "thumbnail"
}.id
return PatchResultSuccess()
}
companion object {
@@ -6,8 +6,6 @@ import app.revanced.patcher.annotation.Name
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.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
@@ -29,7 +27,7 @@ class OpenLinksExternallyPatch : BytecodePatch(
InitializeCustomTabSupportFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
override fun execute(context: BytecodeContext) {
SettingsPatch.PreferenceScreen.MISC.addPreferences(
SwitchPreference(
"revanced_external_browser",
@@ -44,7 +42,7 @@ class OpenLinksExternallyPatch : BytecodePatch(
BindSessionServiceFingerprint,
InitializeCustomTabSupportFingerprint
).forEach {
val result = it.result ?: return it.toErrorResult()
val result = it.result ?: throw it.toErrorResult()
val insertIndex = result.scanResult.patternScanResult!!.endIndex + 1
with(result.mutableMethod) {
val register = (implementation!!.instructions[insertIndex - 1] as Instruction21c).registerA
@@ -57,7 +55,5 @@ class OpenLinksExternallyPatch : BytecodePatch(
)
}
}
return PatchResultSuccess()
}
}
@@ -12,8 +12,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
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.util.smali.ExternalLabel
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
@@ -61,14 +59,14 @@ class LithoFilterPatch : BytecodePatch(
* }
* }
*/
override fun execute(context: BytecodeContext): PatchResult {
override fun execute(context: BytecodeContext) {
ComponentContextParserFingerprint.result?.also {
arrayOf(
EmptyComponentBuilderFingerprint,
ReadComponentIdentifierFingerprint
).forEach { fingerprint ->
if (fingerprint.resolve(context, it.mutableMethod, it.mutableClass)) return@forEach
return fingerprint.toErrorResult()
throw fingerprint.toErrorResult()
}
}?.let { bytesToComponentContextMethod ->
@@ -77,7 +75,7 @@ class LithoFilterPatch : BytecodePatch(
ProtobufBufferReferenceFingerprint.result
?.mutableMethod?.addInstruction(0,
" invoke-static { p2 }, $INTEGRATIONS_CLASS_DESCRIPTOR->setProtoBuffer(Ljava/nio/ByteBuffer;)V")
?: return ProtobufBufferReferenceFingerprint.toErrorResult()
?: throw ProtobufBufferReferenceFingerprint.toErrorResult()
// endregion
@@ -143,7 +141,7 @@ class LithoFilterPatch : BytecodePatch(
}
// endregion
} ?: return ComponentContextParserFingerprint.toErrorResult()
} ?: throw ComponentContextParserFingerprint.toErrorResult()
LithoFilterFingerprint.result?.mutableMethod?.apply {
removeInstructions(2, 4) // Remove dummy filter.
@@ -159,9 +157,7 @@ class LithoFilterPatch : BytecodePatch(
"""
)
}
} ?: return LithoFilterFingerprint.toErrorResult()
return PatchResultSuccess()
} ?: throw LithoFilterFingerprint.toErrorResult()
}
override fun close() = LithoFilterFingerprint.result!!
@@ -4,8 +4,6 @@ import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
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.shared.fingerprints.WatchWhileActivityFingerprint
@@ -40,7 +38,7 @@ class MicroGBytecodePatch : BytecodePatch(
WatchWhileActivityFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
override fun execute(context: BytecodeContext) {
// apply common microG patch
MicroGBytecodeHelper.patchBytecode(
context, arrayOf(
@@ -65,7 +63,5 @@ class MicroGBytecodePatch : BytecodePatch(
// inject the notice for MicroG
MicroGBytecodeHelper.injectNotice(WatchWhileActivityFingerprint)
return PatchResultSuccess()
}
}
@@ -1,8 +1,6 @@
package app.revanced.patches.youtube.misc.microg.patch.resource
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.patches.shared.settings.preference.impl.Preference
@@ -20,7 +18,7 @@ import app.revanced.util.microg.MicroGResourceHelper
@DependsOn([SettingsResourcePatch::class])
class MicroGResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
override fun execute(context: ResourceContext) {
SettingsPatch.addPreference(
Preference(
StringResource("microg_settings", "MicroG Settings"),
@@ -47,7 +45,5 @@ class MicroGResourcePatch : ResourcePatch {
// add strings
MicroGResourceHelper.addStrings(context)
return PatchResultSuccess()
}
}
@@ -4,13 +4,10 @@ import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
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.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.patcher.util.proxy.mutableTypes.MutableMethod
@@ -39,7 +36,7 @@ class MinimizedPlaybackPatch : BytecodePatch(
KidsMinimizedPlaybackPolicyControllerFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
override fun execute(context: BytecodeContext) {
// TODO: remove this empty preference sometime after mid 2023
SettingsPatch.PreferenceScreen.MISC.addPreferences(
NonInteractivePreference(
@@ -57,10 +54,10 @@ class MinimizedPlaybackPatch : BytecodePatch(
return v0
"""
)
} ?: return MinimizedPlaybackManagerFingerprint.toErrorResult()
} ?: throw MinimizedPlaybackManagerFingerprint.toErrorResult()
// Enable minimized playback option in YouTube settings
MinimizedPlaybackSettingsParentFingerprint.result ?: return MinimizedPlaybackSettingsParentFingerprint.toErrorResult()
MinimizedPlaybackSettingsParentFingerprint.result ?: throw MinimizedPlaybackSettingsParentFingerprint.toErrorResult()
MinimizedPlaybackSettingsFingerprint.resolve(context, MinimizedPlaybackSettingsParentFingerprint.result!!.classDef)
MinimizedPlaybackSettingsFingerprint.result?.apply {
val booleanCalls = method.implementation!!.instructions.withIndex()
@@ -78,7 +75,7 @@ class MinimizedPlaybackPatch : BytecodePatch(
return v0
"""
)
} ?: return MinimizedPlaybackSettingsFingerprint.toErrorResult()
} ?: throw MinimizedPlaybackSettingsFingerprint.toErrorResult()
// Force allowing background play for videos labeled for kids.
// Some regions and YouTube accounts do not require this patch.
@@ -87,9 +84,7 @@ class MinimizedPlaybackPatch : BytecodePatch(
0,
"return-void"
)
} ?: return KidsMinimizedPlaybackPolicyControllerFingerprint.toErrorResult()
return PatchResultSuccess()
} ?: throw KidsMinimizedPlaybackPolicyControllerFingerprint.toErrorResult()
}
private companion object {
@@ -8,8 +8,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
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.patches.shared.fingerprints.LayoutConstructorFingerprint
import app.revanced.patches.youtube.misc.playercontrols.annotation.PlayerControlsCompatibility
@@ -28,16 +26,14 @@ class PlayerControlsBytecodePatch : BytecodePatch(
BottomControlsInflateFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
override fun execute(context: BytecodeContext) {
LayoutConstructorFingerprint.result?.let {
if (!PlayerControlsVisibilityFingerprint.resolve(context, it.classDef))
throw LayoutConstructorFingerprint.toErrorResult()
} ?: return LayoutConstructorFingerprint.toErrorResult()
} ?: throw LayoutConstructorFingerprint.toErrorResult()
showPlayerControlsFingerprintResult = PlayerControlsVisibilityFingerprint.result!!
inflateFingerprintResult = BottomControlsInflateFingerprint.result!!
return PatchResultSuccess()
}
internal companion object {
@@ -1,9 +1,7 @@
package app.revanced.patches.youtube.misc.playercontrols.resource.patch
import app.revanced.patcher.data.DomFileEditor
import app.revanced.patcher.util.DomFileEditor
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.patches.shared.mapping.misc.patch.ResourceMappingPatch
@@ -11,14 +9,12 @@ import java.io.Closeable
@DependsOn([ResourceMappingPatch::class])
class BottomControlsResourcePatch : ResourcePatch, Closeable {
override fun execute(context: ResourceContext): PatchResult {
override fun execute(context: ResourceContext) {
resourceContext = context
targetXmlEditor = context.xmlEditor[TARGET_RESOURCE]
bottomUiContainerResourceId = ResourceMappingPatch.resourceMappings
.single { it.type == "id" && it.name == "bottom_ui_container_stub" }.id
return PatchResultSuccess()
}
companion object {
@@ -5,8 +5,6 @@ import app.revanced.patcher.annotation.Name
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.DependsOn
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.playeroverlay.annotation.PlayerOverlaysHookCompatibility
@@ -21,13 +19,12 @@ class PlayerOverlaysHookPatch : BytecodePatch(
PlayerOverlaysOnFinishInflateFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
override fun execute(context: BytecodeContext) {
// hook YouTubePlayerOverlaysLayout.onFinishInflate()
val method = PlayerOverlaysOnFinishInflateFingerprint.result!!.mutableMethod
method.addInstruction(
method.implementation!!.instructions.size - 2,
"invoke-static { p0 }, Lapp/revanced/integrations/patches/PlayerOverlaysHookPatch;->YouTubePlayerOverlaysLayout_onFinishInflateHook(Ljava/lang/Object;)V"
)
return PatchResultSuccess()
}
}
@@ -8,8 +8,6 @@ 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.patch.annotations.DependsOn
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.playertype.fingerprint.PlayerTypeFingerprint
@@ -22,11 +20,11 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
class PlayerTypeHookPatch : BytecodePatch(
listOf(PlayerTypeFingerprint, VideoStateFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
override fun execute(context: BytecodeContext) {
PlayerTypeFingerprint.result?.mutableMethod?.addInstruction(
0,
"invoke-static {p1}, $INTEGRATIONS_CLASS_DESCRIPTOR->setPlayerType(Ljava/lang/Enum;)V"
) ?: return PlayerTypeFingerprint.toErrorResult()
) ?: throw PlayerTypeFingerprint.toErrorResult()
VideoStateFingerprint.result?.let {
it.mutableMethod.apply {
@@ -41,9 +39,7 @@ class PlayerTypeHookPatch : BytecodePatch(
"""
)
}
} ?: return VideoStateFingerprint.toErrorResult()
return PatchResultSuccess()
} ?: throw VideoStateFingerprint.toErrorResult()
}
companion object {
@@ -9,8 +9,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
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.patches.shared.settings.preference.impl.Preference
import app.revanced.patches.shared.settings.util.AbstractPreferenceScreen
@@ -29,7 +27,7 @@ import java.io.Closeable
class SettingsPatch : BytecodePatch(
listOf(LicenseActivityFingerprint, SetThemeFingerprint)
), Closeable {
override fun execute(context: BytecodeContext): PatchResult {
override fun execute(context: BytecodeContext) {
// TODO: Remove this when it is only required at one place.
fun getSetThemeInstructionString(
registers: String = "v0",
@@ -57,7 +55,7 @@ class SettingsPatch : BytecodePatch(
addInstruction(returnIndex + 1, "return-object v0")
}
}
} ?: return SetThemeFingerprint.toErrorResult()
} ?: throw SetThemeFingerprint.toErrorResult()
// Modify the license activity and remove all existing layout code.
@@ -88,8 +86,6 @@ class SettingsPatch : BytecodePatch(
}
}
return PatchResultSuccess()
}
internal companion object {
@@ -1,10 +1,8 @@
package app.revanced.patches.youtube.misc.settings.resource.patch
import app.revanced.patcher.data.DomFileEditor
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.util.DomFileEditor
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
import app.revanced.patches.shared.settings.preference.addPreference
import app.revanced.patches.shared.settings.preference.impl.*
@@ -21,7 +19,7 @@ class SettingsResourcePatch : AbstractSettingsResourcePatch(
"revanced_prefs",
"settings"
) {
override fun execute(context: ResourceContext): PatchResult {
override fun execute(context: ResourceContext) {
super.execute(context)
// Used for a fingerprint from SettingsPatch.
@@ -88,8 +86,6 @@ class SettingsResourcePatch : AbstractSettingsResourcePatch(
)
context.mergeStrings("settings/host/values/strings.xml")
return PatchResultSuccess()
}
@@ -6,8 +6,6 @@ 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
@@ -25,7 +23,7 @@ import app.revanced.patches.youtube.misc.zoomhaptics.fingerprints.ZoomHapticsFin
class ZoomHapticsPatch : BytecodePatch(
listOf(ZoomHapticsFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
override fun execute(context: BytecodeContext) {
SettingsPatch.PreferenceScreen.MISC.addPreferences(
SwitchPreference(
"revanced_disable_zoom_haptics",
@@ -47,7 +45,5 @@ class ZoomHapticsPatch : BytecodePatch(
""",
ExternalLabel("vibrate", zoomHapticsFingerprintMethod.getInstruction(0))
)
return PatchResultSuccess()
}
}