mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-13 05:37:40 +02:00
build: bump patcher to 14.2.2
This commit is contained in:
@ -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()
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,8 @@ package app.revanced.patches.youtube.general.descriptions.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.youtube.utils.annotations.YouTubeCompatibility
|
||||
@ -25,9 +22,8 @@ import app.revanced.util.integrations.Constants.PATCHES_PATH
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class DescriptionComponentsPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
LithoFilterPatch.addFilter("$PATCHES_PATH/ads/DescriptionsFilter;")
|
||||
|
||||
/**
|
||||
@ -44,6 +40,5 @@ class DescriptionComponentsPatch : BytecodePatch() {
|
||||
|
||||
context.updatePatchStatus("DescriptionComponent")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.general.floatingmicrophone.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.youtube.general.floatingmicrophone.fingerprints.FloatingMicrophoneFingerprint
|
||||
@ -29,11 +26,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class FloatingMicrophonePatch : BytecodePatch(
|
||||
listOf(FloatingMicrophoneFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
FloatingMicrophoneFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -47,7 +43,7 @@ class FloatingMicrophonePatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return FloatingMicrophoneFingerprint.toErrorResult()
|
||||
} ?: throw FloatingMicrophoneFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -61,6 +57,5 @@ class FloatingMicrophonePatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-floating-microphone")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -3,13 +3,10 @@ package app.revanced.patches.youtube.general.headerswitch.patch
|
||||
import app.revanced.extensions.findMutableMethodOf
|
||||
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.youtube.utils.annotations.YouTubeCompatibility
|
||||
@ -31,10 +28,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
@Suppress("LABEL_NAME_CLASH")
|
||||
class HeaderSwitchPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
context.classes.forEach { classDef ->
|
||||
classDef.methods.forEach { method ->
|
||||
if (!method.isWideLiteralExists(WordMarkHeader))
|
||||
@ -70,6 +66,5 @@ class HeaderSwitchPatch : BytecodePatch() {
|
||||
|
||||
SettingsPatch.updatePatchStatus("header-switch")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.general.latestvideosbutton.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.latestvideosbutton.fingerprints.LatestVideosButtonFingerprint
|
||||
@ -29,11 +26,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class LatestVideosButtonPatch : BytecodePatch(
|
||||
listOf(LatestVideosButtonFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
LatestVideosButtonFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
@ -44,7 +40,7 @@ class LatestVideosButtonPatch : BytecodePatch(
|
||||
"invoke-static {v$targetRegister}, $GENERAL->hideLatestVideosButton(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
} ?: return LatestVideosButtonFingerprint.toErrorResult()
|
||||
} ?: throw LatestVideosButtonFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -58,6 +54,5 @@ class LatestVideosButtonPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-latest-videos-button")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,8 @@ package app.revanced.patches.youtube.general.layout.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.youtube.utils.annotations.YouTubeCompatibility
|
||||
@ -25,9 +22,8 @@ import app.revanced.util.integrations.Constants.PATCHES_PATH
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class LayoutComponentsPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
LithoFilterPatch.addFilter("$PATCHES_PATH/ads/CommunityPostFilter;")
|
||||
LithoFilterPatch.addFilter("$PATCHES_PATH/ads/LayoutComponentsFilter;")
|
||||
|
||||
@ -48,6 +44,5 @@ class LayoutComponentsPatch : BytecodePatch() {
|
||||
|
||||
context.updatePatchStatus("LayoutComponent")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.general.loadmorebutton.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.loadmorebutton.fingerprints.LoadMoreButtonFingerprint
|
||||
@ -29,11 +26,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class LoadMoreButtonPatch : BytecodePatch(
|
||||
listOf(LoadMoreButtonFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
LoadMoreButtonFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
@ -43,7 +39,7 @@ class LoadMoreButtonPatch : BytecodePatch(
|
||||
"invoke-static {v$targetRegister}, $GENERAL->hideLoadMoreButton(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
} ?: return LoadMoreButtonFingerprint.toErrorResult()
|
||||
} ?: throw LoadMoreButtonFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -57,6 +53,5 @@ class LoadMoreButtonPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-load-more-button")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,13 @@
|
||||
package app.revanced.patches.youtube.general.mixplaylists.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.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,7 +27,6 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
@Description("Hides mix playlists from home feed and video player.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class MixPlaylistsPatch : BytecodePatch(
|
||||
listOf(
|
||||
BottomPanelOverlayTextFingerprint,
|
||||
@ -38,7 +34,7 @@ class MixPlaylistsPatch : BytecodePatch(
|
||||
EmptyFlatBufferFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
/**
|
||||
* Hide MixPlaylists when tablet UI is turned on
|
||||
@ -54,7 +50,7 @@ class MixPlaylistsPatch : BytecodePatch(
|
||||
"invoke-static {v$insertRegister}, $GENERAL->hideMixPlaylists(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
} ?: return BottomPanelOverlayTextFingerprint.toErrorResult()
|
||||
} ?: throw BottomPanelOverlayTextFingerprint.exception
|
||||
|
||||
/**
|
||||
* Separated from bytebuffer patch
|
||||
@ -62,7 +58,7 @@ class MixPlaylistsPatch : BytecodePatch(
|
||||
*/
|
||||
ElementParserFingerprint.result
|
||||
?: EmptyFlatBufferFingerprint.result
|
||||
?: throw EmptyFlatBufferFingerprint.toErrorResult()
|
||||
?: throw EmptyFlatBufferFingerprint.exception
|
||||
|
||||
|
||||
/**
|
||||
@ -117,7 +113,6 @@ class MixPlaylistsPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-mix-playlists")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.general.personalinformation.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.youtube.general.personalinformation.fingerprints.AccountSwitcherAccessibilityLabelFingerprint
|
||||
@ -23,11 +20,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@Description("Hides the handle in the account switcher.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideEmailAddressPatch : BytecodePatch(
|
||||
listOf(AccountSwitcherAccessibilityLabelFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
AccountSwitcherAccessibilityLabelFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -41,7 +37,7 @@ class HideEmailAddressPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return AccountSwitcherAccessibilityLabelFingerprint.toErrorResult()
|
||||
} ?: throw AccountSwitcherAccessibilityLabelFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -55,6 +51,5 @@ class HideEmailAddressPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-email-address")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.general.snackbar.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("Hides the snack bar action popup.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideSnackBarPatch : BytecodePatch(
|
||||
listOf(HideSnackBarFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
HideSnackBarFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -40,7 +36,7 @@ class HideSnackBarPatch : BytecodePatch(
|
||||
""", ExternalLabel("default", getInstruction(0))
|
||||
)
|
||||
}
|
||||
} ?: return HideSnackBarFingerprint.toErrorResult()
|
||||
} ?: throw HideSnackBarFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -54,6 +50,5 @@ class HideSnackBarPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-snack-bar")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.general.suggestions.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.suggestions.fingerprints.BreakingNewsFingerprint
|
||||
@ -29,11 +26,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class SuggestionsShelfPatch : BytecodePatch(
|
||||
listOf(BreakingNewsFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
BreakingNewsFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -45,7 +41,7 @@ class SuggestionsShelfPatch : BytecodePatch(
|
||||
"invoke-static {v$targetRegister}, $GENERAL->hideBreakingNewsShelf(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
} ?: return BreakingNewsFingerprint.toErrorResult()
|
||||
} ?: throw BreakingNewsFingerprint.exception
|
||||
|
||||
/*
|
||||
SuggestionContentsBuilderFingerprint.result?.let {
|
||||
@ -58,7 +54,7 @@ class SuggestionsShelfPatch : BytecodePatch(
|
||||
""" + emptyComponentLabel, ExternalLabel("not_an_ad", getInstruction(2))
|
||||
)
|
||||
}
|
||||
} ?: return SuggestionContentsBuilderFingerprint.toErrorResult()
|
||||
} ?: throw SuggestionContentsBuilderFingerprint.exception
|
||||
*/
|
||||
|
||||
|
||||
@ -74,6 +70,5 @@ class SuggestionsShelfPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-suggestions-shelf")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,14 @@
|
||||
package app.revanced.patches.youtube.general.tabletminiplayer.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.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.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
@ -38,7 +34,6 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class TabletMiniPlayerPatch : BytecodePatch(
|
||||
listOf(
|
||||
MiniPlayerDimensionsCalculatorFingerprint,
|
||||
@ -46,7 +41,7 @@ class TabletMiniPlayerPatch : BytecodePatch(
|
||||
MiniPlayerOverrideFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
MiniPlayerDimensionsCalculatorFingerprint.result?.let { parentResult ->
|
||||
MiniPlayerOverrideNoContextFingerprint.also {
|
||||
@ -60,8 +55,8 @@ class TabletMiniPlayerPatch : BytecodePatch(
|
||||
method.implementation!!.instructions.size - 1,
|
||||
parameterRegister
|
||||
)
|
||||
} ?: return MiniPlayerOverrideNoContextFingerprint.toErrorResult()
|
||||
} ?: return MiniPlayerDimensionsCalculatorFingerprint.toErrorResult()
|
||||
} ?: throw MiniPlayerOverrideNoContextFingerprint.exception
|
||||
} ?: throw MiniPlayerDimensionsCalculatorFingerprint.exception
|
||||
|
||||
MiniPlayerOverrideFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -70,10 +65,10 @@ class TabletMiniPlayerPatch : BytecodePatch(
|
||||
.getMethod() as MutableMethod)
|
||||
.instructionProxyCall()
|
||||
}
|
||||
} ?: return MiniPlayerOverrideFingerprint.toErrorResult()
|
||||
} ?: throw MiniPlayerOverrideFingerprint.exception
|
||||
|
||||
MiniPlayerResponseModelSizeCheckFingerprint.result?.addProxyCall()
|
||||
?: return MiniPlayerResponseModelSizeCheckFingerprint.toErrorResult()
|
||||
?: throw MiniPlayerResponseModelSizeCheckFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -87,7 +82,6 @@ class TabletMiniPlayerPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("enable-tablet-mini-player")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
// helper methods
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.general.trendingsearches.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.youtube.general.trendingsearches.fingerprints.SearchBarEntryFingerprint
|
||||
@ -34,11 +31,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class TrendingSearchesPatch : BytecodePatch(
|
||||
listOf(SearchBarEntryFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SearchBarEntryFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -59,7 +55,7 @@ class TrendingSearchesPatch : BytecodePatch(
|
||||
)
|
||||
}
|
||||
}
|
||||
} ?: return SearchBarEntryFingerprint.toErrorResult()
|
||||
} ?: throw SearchBarEntryFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -73,7 +69,6 @@ class TrendingSearchesPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-trending-searches")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private enum class SearchTerm(val resourceId: Long, val value: Int) {
|
||||
|
@ -1,16 +1,12 @@
|
||||
package app.revanced.patches.youtube.general.widesearchbar.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.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.proxy.mutableTypes.MutableMethod
|
||||
@ -32,14 +28,13 @@ import app.revanced.util.integrations.Constants.GENERAL
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class WideSearchBarPatch : BytecodePatch(
|
||||
listOf(
|
||||
SetActionBarRingoFingerprint,
|
||||
SetToolBarPaddingFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
arrayOf(
|
||||
SetActionBarRingoFingerprint,
|
||||
@ -75,7 +70,6 @@ class WideSearchBarPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("enable-wide-search-bar")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
@ -95,7 +89,7 @@ class WideSearchBarPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: throw toErrorResult()
|
||||
} ?: throw exception
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ package app.revanced.patches.youtube.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,13 +16,11 @@ import app.revanced.util.resources.ResourceHelper.updatePatchStatusIcon
|
||||
@Description("Changes the YouTube launcher icon to MMT.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class CustomBrandingIconMMTPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
context.customIcon("mmt")
|
||||
context.updatePatchStatusIcon("mmt")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ package app.revanced.patches.youtube.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,13 +16,11 @@ import app.revanced.util.resources.ResourceHelper.updatePatchStatusIcon
|
||||
@Description("Changes the YouTube launcher icon to Revancify Blue.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class CustomBrandingIconRevancifyBluePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
context.customIcon("revancify-blue")
|
||||
context.updatePatchStatusIcon("revancify_blue")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ package app.revanced.patches.youtube.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,13 +16,11 @@ import app.revanced.util.resources.ResourceHelper.updatePatchStatusIcon
|
||||
@Description("Changes the YouTube launcher icon to Revancify Red.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class CustomBrandingIconRevancifyRedPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
context.customIcon("revancify-red")
|
||||
context.updatePatchStatusIcon("revancify_red")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -2,13 +2,10 @@ package app.revanced.patches.youtube.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
|
||||
@ -26,12 +23,11 @@ import app.revanced.util.resources.ResourceHelper.updatePatchStatusLabel
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class CustomBrandingNamePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
val appName = YouTubeAppName
|
||||
?: 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 {
|
||||
|
||||
context.updatePatchStatusLabel("$appName")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
companion object : OptionsContainer() {
|
||||
|
@ -1,13 +1,11 @@
|
||||
package app.revanced.patches.youtube.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"]
|
||||
@ -23,7 +21,6 @@ class RemoveElementsPatch : ResourcePatch {
|
||||
}
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
@ -2,10 +2,7 @@ package app.revanced.patches.youtube.layout.doubletapbackground.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.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
@Description("Hides the double tap dark filter layer.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class DoubleTapOverlayBackgroundPatch : 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")
|
||||
@ -48,7 +44,6 @@ class DoubleTapOverlayBackgroundPatch : ResourcePatch {
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-double-tap-overlay-filter")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -2,13 +2,10 @@ package app.revanced.patches.youtube.layout.doubletaplength.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
|
||||
@ -23,9 +20,8 @@ import app.revanced.util.resources.ResourceUtils.copyResources
|
||||
@Description("Add 'double-tap to seek' value.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class DoubleTapLengthPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
val arrayPath = "res/values-v21/arrays.xml"
|
||||
val entriesName = "double_tap_length_entries"
|
||||
val entryValueName = "double_tap_length_values"
|
||||
@ -42,7 +38,7 @@ class DoubleTapLengthPatch : ResourcePatch {
|
||||
)
|
||||
|
||||
val length = DoubleTapLengthArrays
|
||||
?: return PatchResultError("Invalid double-tap length array.")
|
||||
?: throw PatchException("Invalid double-tap length array.")
|
||||
|
||||
val splits = length.replace(" ", "").split(",")
|
||||
if (splits.isEmpty()) throw IllegalArgumentException("Invalid double-tap length elements")
|
||||
@ -54,7 +50,6 @@ class DoubleTapLengthPatch : ResourcePatch {
|
||||
|
||||
SettingsPatch.updatePatchStatus("custom-double-tap-length")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
companion object : OptionsContainer() {
|
||||
|
@ -3,10 +3,7 @@ package app.revanced.patches.youtube.layout.forcebackground.patch
|
||||
import app.revanced.extensions.doRecursively
|
||||
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,10 +16,9 @@ import org.w3c.dom.Element
|
||||
@Description("Force hides the background from the video player buttons.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class PlayerButtonBackgroundPatch : ResourcePatch {
|
||||
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
context.xmlEditor["res/drawable/player_button_circle_background.xml"].use { editor ->
|
||||
editor.file.doRecursively { node ->
|
||||
arrayOf("color").forEach replacement@{ replacement ->
|
||||
@ -44,6 +40,5 @@ class PlayerButtonBackgroundPatch : ResourcePatch {
|
||||
)
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -2,11 +2,8 @@ package app.revanced.patches.youtube.layout.forceheader.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
|
||||
@ -21,11 +18,11 @@ import kotlin.io.path.exists
|
||||
@Description("Forces premium heading on the homepage.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class PremiumHeadingPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
val resDirectory = context["res"]
|
||||
if (!resDirectory.isDirectory) return PatchResultError("The res folder can not be found.")
|
||||
if (!resDirectory.isDirectory)
|
||||
throw PatchException("The res folder can not be found.")
|
||||
|
||||
val (original, replacement) = "yt_premium_wordmark_header" to "yt_wordmark_header"
|
||||
val modes = arrayOf("light", "dark")
|
||||
@ -37,7 +34,7 @@ class PremiumHeadingPatch : ResourcePatch {
|
||||
val toPath = headingDirectory.resolve("${replacement}_$mode.png").toPath()
|
||||
|
||||
if (!fromPath.exists())
|
||||
return PatchResultError("The file $fromPath does not exist in the resources. Therefore, this patch can not succeed.")
|
||||
throw PatchException("The file $fromPath does not exist in the resources. Therefore, this patch can not succeed.")
|
||||
Files.copy(
|
||||
fromPath,
|
||||
toPath,
|
||||
@ -60,6 +57,5 @@ class PremiumHeadingPatch : ResourcePatch {
|
||||
|
||||
SettingsPatch.updatePatchStatus("force-premium-heading")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ package app.revanced.patches.youtube.layout.materialyou.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
|
||||
@ -28,9 +25,8 @@ import app.revanced.util.resources.ResourceUtils.copyXmlNode
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class MaterialYouPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
arrayOf(
|
||||
ResourceUtils.ResourceGroup(
|
||||
@ -60,6 +56,5 @@ class MaterialYouPatch : ResourcePatch {
|
||||
|
||||
isMonetPatchIncluded = true
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ package app.revanced.patches.youtube.layout.optimize.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
|
||||
@ -22,12 +19,10 @@ import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class OptimizeResourcePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
SettingsPatch.updatePatchStatus("optimize-resource")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
package app.revanced.patches.youtube.layout.optimize.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.util.resources.ResourceUtils
|
||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||
@ -12,7 +10,7 @@ import java.nio.file.Path
|
||||
import java.nio.file.StandardCopyOption
|
||||
|
||||
class RedundantResourcePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
// Convert universal APK to anti-split APK
|
||||
arrayOf(
|
||||
@ -55,7 +53,6 @@ class RedundantResourcePatch : ResourcePatch {
|
||||
)
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,14 +1,11 @@
|
||||
package app.revanced.patches.youtube.layout.pipnotification.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.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.layout.pipnotification.fingerprints.PrimaryPiPFingerprint
|
||||
@ -21,14 +18,13 @@ import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
@Description("Disable pip notification when you first launch pip mode.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class PiPNotificationPatch : BytecodePatch(
|
||||
listOf(
|
||||
PrimaryPiPFingerprint,
|
||||
SecondaryPiPFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
arrayOf(
|
||||
PrimaryPiPFingerprint,
|
||||
@ -41,7 +37,7 @@ class PiPNotificationPatch : BytecodePatch(
|
||||
"return-void"
|
||||
)
|
||||
}
|
||||
} ?: return fingerprint.toErrorResult()
|
||||
} ?: throw fingerprint.exception
|
||||
}
|
||||
|
||||
/**
|
||||
@ -49,6 +45,5 @@ class PiPNotificationPatch : BytecodePatch(
|
||||
*/
|
||||
SettingsPatch.updatePatchStatus("hide-pip-notification")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -2,10 +2,7 @@ package app.revanced.patches.youtube.layout.splashanimation.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.Patch
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
@ -18,9 +15,8 @@ import kotlin.io.path.exists
|
||||
@Name("Add splash animation")
|
||||
@Description("Adds splash animation, which was removed in YT v18.19.36+. This patch cannot be used with 'custom-branding-icon' patch")
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class AddSplashAnimationPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
val resDirectory = context["res"]
|
||||
val targetXml = resDirectory.resolve("drawable").resolve("avd_anim.xml").toPath()
|
||||
@ -61,6 +57,5 @@ class AddSplashAnimationPatch : ResourcePatch {
|
||||
context.copyXmlNode("youtube/splashscreen", "values-v31/styles.xml", "resources")
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,8 +1,6 @@
|
||||
package app.revanced.patches.youtube.layout.theme.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.youtube.utils.litho.patch.LithoThemePatch
|
||||
@ -11,7 +9,7 @@ import org.w3c.dom.Element
|
||||
|
||||
@DependsOn([LithoThemePatch::class])
|
||||
class GeneralThemePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
LithoThemePatch.injectCall("$UTILS_PATH/LithoThemePatch;->applyLithoTheme(I)I")
|
||||
|
||||
@ -88,7 +86,6 @@ class GeneralThemePatch : ResourcePatch {
|
||||
}
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
internal companion object {
|
||||
|
@ -2,13 +2,10 @@ package app.revanced.patches.youtube.layout.theme.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
|
||||
@ -28,9 +25,8 @@ import org.w3c.dom.Element
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class ThemePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
arrayOf("values", "values-v31").forEach { context.setTheme(it) }
|
||||
|
||||
@ -38,12 +34,11 @@ class ThemePatch : ResourcePatch {
|
||||
|
||||
context.updatePatchStatusTheme(currentTheme)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private fun ResourceContext.setTheme(valuesPath: String) {
|
||||
val darkThemeColor = darkThemeBackgroundColor
|
||||
?: throw PatchResultError("Invalid color.")
|
||||
?: throw PatchException("Invalid color.")
|
||||
|
||||
this.xmlEditor["res/$valuesPath/colors.xml"].use { editor ->
|
||||
val resourcesNode = editor.file.getElementsByTagName("resources").item(0) as Element
|
||||
|
@ -1,14 +1,11 @@
|
||||
package app.revanced.patches.youtube.layout.tooltip.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.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.layout.tooltip.fingerprints.TooltipContentViewFingerprint
|
||||
@ -26,22 +23,20 @@ import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class TooltipContentViewPatch : BytecodePatch(
|
||||
listOf(TooltipContentViewFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
TooltipContentViewFingerprint.result?.mutableMethod?.addInstruction(
|
||||
0,
|
||||
"return-void"
|
||||
) ?: return TooltipContentViewFingerprint.toErrorResult()
|
||||
) ?: throw TooltipContentViewFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
SettingsPatch.updatePatchStatus("hide-tooltip-content")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,13 @@
|
||||
package app.revanced.patches.youtube.misc.ambientmode.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.misc.ambientmode.fingerprints.PowerSaveModeFingerprint
|
||||
@ -27,11 +24,10 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
@Description("Bypass ambient mode restrictions in battery saver mode.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class PowerSaveModePatch : BytecodePatch(
|
||||
listOf(PowerSaveModeFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
PowerSaveModeFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -55,9 +51,9 @@ class PowerSaveModePatch : BytecodePatch(
|
||||
)
|
||||
}
|
||||
if (insertIndex == -1)
|
||||
return PatchResultError("Couldn't find PowerManager reference")
|
||||
throw PatchException("Couldn't find PowerManager reference")
|
||||
}
|
||||
} ?: return PowerSaveModeFingerprint.toErrorResult()
|
||||
} ?: throw PowerSaveModeFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -70,6 +66,5 @@ class PowerSaveModePatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("bypass-ambient-mode-restrictions")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ package app.revanced.patches.youtube.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
|
||||
@ -17,9 +14,8 @@ import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
@Description("Adds debugging options.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.2")
|
||||
class DebuggingPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -33,6 +29,5 @@ class DebuggingPatch : ResourcePatch {
|
||||
SettingsPatch.updatePatchStatus("enable-debug-logging")
|
||||
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.misc.externalbrowser.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.youtube.misc.externalbrowser.fingerprints.ExternalBrowserPrimaryFingerprint
|
||||
@ -26,7 +23,6 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@Description("Open url outside the app in an external browser.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class ExternalBrowserPatch : BytecodePatch(
|
||||
listOf(
|
||||
ExternalBrowserPrimaryFingerprint,
|
||||
@ -34,7 +30,7 @@ class ExternalBrowserPatch : BytecodePatch(
|
||||
ExternalBrowserTertiaryFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
arrayOf(
|
||||
ExternalBrowserPrimaryFingerprint,
|
||||
@ -54,7 +50,7 @@ class ExternalBrowserPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return fingerprint.toErrorResult()
|
||||
} ?: throw fingerprint.exception
|
||||
}
|
||||
|
||||
/**
|
||||
@ -68,6 +64,5 @@ class ExternalBrowserPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("enable-external-browser")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -2,10 +2,7 @@ package app.revanced.patches.youtube.misc.forceopus.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.opus.AbstractOpusCodecsPatch
|
||||
@ -18,11 +15,10 @@ import app.revanced.util.integrations.Constants.MISC_PATH
|
||||
@Description("Forces the OPUS codec for audios.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class ForceOpusCodecPatch : AbstractOpusCodecsPatch(
|
||||
"$MISC_PATH/CodecOverridePatch;->shouldForceOpus()Z"
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
super.execute(context)
|
||||
|
||||
/**
|
||||
@ -36,6 +32,5 @@ class ForceOpusCodecPatch : AbstractOpusCodecsPatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("force-opus-codec")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
package app.revanced.patches.youtube.misc.forcevp9.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
|
||||
@ -11,8 +10,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
|
||||
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.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
@ -36,7 +33,6 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
@Description("Forces the VP9 codec for videos.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class ForceVP9CodecPatch : BytecodePatch(
|
||||
listOf(
|
||||
LayoutSwitchFingerprint,
|
||||
@ -44,7 +40,7 @@ class ForceVP9CodecPatch : BytecodePatch(
|
||||
Vp9PropsParentFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
LayoutSwitchFingerprint.result?.classDef?.let { classDef ->
|
||||
arrayOf(
|
||||
@ -52,9 +48,9 @@ class ForceVP9CodecPatch : BytecodePatch(
|
||||
Vp9SecondaryFingerprint
|
||||
).forEach { fingerprint ->
|
||||
fingerprint.also { it.resolve(context, classDef) }.result?.injectOverride()
|
||||
?: return fingerprint.toErrorResult()
|
||||
?: throw fingerprint.exception
|
||||
}
|
||||
} ?: return LayoutSwitchFingerprint.toErrorResult()
|
||||
} ?: throw LayoutSwitchFingerprint.exception
|
||||
|
||||
Vp9PropsParentFingerprint.result?.let { parentResult ->
|
||||
Vp9PropsFingerprint.also {
|
||||
@ -70,8 +66,8 @@ class ForceVP9CodecPatch : BytecodePatch(
|
||||
).forEach { (fieldName, descriptor) ->
|
||||
it.hookProps(fieldName, descriptor)
|
||||
}
|
||||
} ?: return Vp9PropsFingerprint.toErrorResult()
|
||||
} ?: return Vp9PropsParentFingerprint.toErrorResult()
|
||||
} ?: throw Vp9PropsFingerprint.exception
|
||||
} ?: throw Vp9PropsParentFingerprint.exception
|
||||
|
||||
VideoCapabilitiesParentFingerprint.result?.let { parentResult ->
|
||||
VideoCapabilitiesFingerprint.also {
|
||||
@ -96,8 +92,8 @@ class ForceVP9CodecPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return VideoCapabilitiesFingerprint.toErrorResult()
|
||||
} ?: return VideoCapabilitiesParentFingerprint.toErrorResult()
|
||||
} ?: throw VideoCapabilitiesFingerprint.exception
|
||||
} ?: throw VideoCapabilitiesParentFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -110,7 +106,6 @@ class ForceVP9CodecPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("force-vp9-codec")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.misc.language.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.misc.language.fingerprints.GeneralPrefsFingerprint
|
||||
@ -22,11 +19,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@Description("Add language switch toggle.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class LanguageSelectorPatch : BytecodePatch(
|
||||
listOf(GeneralPrefsFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
GeneralPrefsFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -38,10 +34,9 @@ class LanguageSelectorPatch : BytecodePatch(
|
||||
"const/4 v$targetRegister, 0x1"
|
||||
)
|
||||
}
|
||||
} ?: return GeneralPrefsFingerprint.toErrorResult()
|
||||
} ?: throw GeneralPrefsFingerprint.exception
|
||||
|
||||
SettingsPatch.updatePatchStatus("language-switch")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,14 @@
|
||||
package app.revanced.patches.youtube.misc.layoutswitch.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.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.proxy.mutableTypes.MutableMethod
|
||||
@ -31,14 +27,13 @@ import com.android.tools.smali.dexlib2.Opcode
|
||||
@Description("Tricks the dpi to use some tablet/phone layouts.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class LayoutSwitchPatch : BytecodePatch(
|
||||
listOf(
|
||||
ClientFormFactorParentFingerprint,
|
||||
LayoutSwitchFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
fun MutableMethod.injectTabletLayout(jumpIndex: Int) {
|
||||
addInstructionsWithLabels(
|
||||
@ -73,16 +68,16 @@ class LayoutSwitchPatch : BytecodePatch(
|
||||
|
||||
injectTabletLayout(jumpIndex)
|
||||
}
|
||||
} ?: return ClientFormFactorWalkerFingerprint.toErrorResult()
|
||||
} ?: throw ClientFormFactorWalkerFingerprint.exception
|
||||
}
|
||||
} ?: return ClientFormFactorParentFingerprint.toErrorResult()
|
||||
} ?: throw ClientFormFactorParentFingerprint.exception
|
||||
|
||||
LayoutSwitchFingerprint.result?.mutableMethod?.addInstructions(
|
||||
4, """
|
||||
invoke-static {p0}, $MISC_PATH/LayoutOverridePatch;->getLayoutOverride(I)I
|
||||
move-result p0
|
||||
"""
|
||||
) ?: return LayoutSwitchFingerprint.toErrorResult()
|
||||
) ?: throw LayoutSwitchFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -95,6 +90,5 @@ class LayoutSwitchPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("layout-switch")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,12 @@
|
||||
package app.revanced.patches.youtube.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.data.toMethodWalker
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
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
|
||||
@ -36,7 +32,6 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class MinimizedPlaybackPatch : BytecodePatch(
|
||||
listOf(
|
||||
KidsMinimizedPlaybackPolicyControllerFingerprint,
|
||||
@ -44,20 +39,19 @@ class MinimizedPlaybackPatch : BytecodePatch(
|
||||
MinimizedPlaybackSettingsFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
val methods = arrayOf(
|
||||
KidsMinimizedPlaybackPolicyControllerFingerprint,
|
||||
MinimizedPlaybackManagerFingerprint,
|
||||
MinimizedPlaybackSettingsFingerprint
|
||||
).map {
|
||||
it.result?.mutableMethod ?: return it.toErrorResult()
|
||||
it.result?.mutableMethod ?: throw it.exception
|
||||
}
|
||||
|
||||
methods[0].hookKidsMiniPlayer()
|
||||
methods[1].hookMinimizedPlaybackManager()
|
||||
methods[2].hookMinimizedPlaybackSettings(context)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.misc.openlinksdirectly.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.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.youtube.misc.openlinksdirectly.fingerprints.OpenLinksDirectlyFingerprintPrimary
|
||||
@ -24,14 +21,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
||||
@Description("Skips over redirection URLs to external links.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class OpenLinksDirectlyPatch : BytecodePatch(
|
||||
listOf(
|
||||
OpenLinksDirectlyFingerprintPrimary,
|
||||
OpenLinksDirectlyFingerprintSecondary
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
arrayOf(
|
||||
OpenLinksDirectlyFingerprintPrimary,
|
||||
@ -47,7 +43,7 @@ class OpenLinksDirectlyPatch : BytecodePatch(
|
||||
"invoke-static {v$register}, $MISC_PATH/OpenLinksDirectlyPatch;->enableBypassRedirect(Ljava/lang/String;)Landroid/net/Uri;"
|
||||
)
|
||||
}
|
||||
} ?: return fingerprint.toErrorResult()
|
||||
} ?: throw fingerprint.exception
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,6 +57,5 @@ class OpenLinksDirectlyPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("enable-open-links-directly")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,11 @@
|
||||
package app.revanced.patches.youtube.misc.quic.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.youtube.misc.quic.fingerprints.CronetEngineBuilderFingerprint
|
||||
@ -22,14 +19,13 @@ import app.revanced.util.integrations.Constants.MISC_PATH
|
||||
@Description("Disable CronetEngine's QUIC protocol.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class QUICProtocolPatch : BytecodePatch(
|
||||
listOf(
|
||||
CronetEngineBuilderFingerprint,
|
||||
ExperimentalCronetEngineBuilderFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
arrayOf(
|
||||
CronetEngineBuilderFingerprint,
|
||||
@ -40,7 +36,7 @@ class QUICProtocolPatch : BytecodePatch(
|
||||
invoke-static {p1}, $MISC_PATH/QUICProtocolPatch;->disableQUICProtocol(Z)Z
|
||||
move-result p1
|
||||
"""
|
||||
) ?: return it.toErrorResult()
|
||||
) ?: throw it.exception
|
||||
}
|
||||
|
||||
/**
|
||||
@ -54,6 +50,5 @@ class QUICProtocolPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("disable-quic-protocol")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -2,14 +2,11 @@ package app.revanced.patches.youtube.misc.splashanimation.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.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.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
@ -36,18 +33,17 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class NewSplashAnimationPatch : BytecodePatch(
|
||||
listOf(
|
||||
WatchWhileActivityWithInFlagsFingerprint,
|
||||
WatchWhileActivityWithOutFlagsFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
WatchWhileActivityWithInFlagsFingerprint.result
|
||||
?: WatchWhileActivityWithOutFlagsFingerprint.result
|
||||
?: throw PatchResultError("Failed to resolve fingerprints")
|
||||
?: throw PatchException("Failed to resolve fingerprints")
|
||||
|
||||
/**
|
||||
* ~YouTube v18.27.36
|
||||
@ -93,7 +89,6 @@ class NewSplashAnimationPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("enable-new-splash-animation")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
@ -2,10 +2,7 @@ package app.revanced.patches.youtube.misc.spoofappversion.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.versionspoof.AbstractVersionSpoofPatch
|
||||
@ -20,11 +17,10 @@ import app.revanced.util.resources.ResourceUtils.copyXmlNode
|
||||
@Description("Tricks YouTube into thinking, you are running an older version of the app. One of the side effects also includes restoring the old UI.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class SpoofAppVersionPatch : AbstractVersionSpoofPatch(
|
||||
"$MISC_PATH/VersionOverridePatch;->getVersionOverride(Ljava/lang/String;)Ljava/lang/String;"
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
super.execute(context)
|
||||
|
||||
/**
|
||||
@ -43,6 +39,5 @@ class SpoofAppVersionPatch : AbstractVersionSpoofPatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("spoof-app-version")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -2,10 +2,7 @@ package app.revanced.patches.youtube.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,15 +15,13 @@ import app.revanced.util.resources.ResourceHelper.addTranslations
|
||||
@Description("Add Crowdin translations for YouTube.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class TranslationsPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
context.addTranslations("youtube", LANGUAGE_LIST)
|
||||
|
||||
SettingsPatch.updatePatchStatus("translations")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,16 +1,13 @@
|
||||
package app.revanced.patches.youtube.navigation.homepage.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.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
@ -25,14 +22,13 @@ import app.revanced.util.integrations.Constants.NAVIGATION
|
||||
@Description("Change home page to subscription feed.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class ChangeHomePagePatch : BytecodePatch(
|
||||
listOf(
|
||||
IntentExceptionFingerprint,
|
||||
LauncherActivityFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
LauncherActivityFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -43,7 +39,7 @@ class ChangeHomePagePatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return LauncherActivityFingerprint.toErrorResult()
|
||||
} ?: throw LauncherActivityFingerprint.exception
|
||||
|
||||
IntentExceptionFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -58,7 +54,7 @@ class ChangeHomePagePatch : BytecodePatch(
|
||||
""", ExternalLabel("default", getInstruction(index))
|
||||
)
|
||||
}
|
||||
} ?: return IntentExceptionFingerprint.toErrorResult()
|
||||
} ?: throw IntentExceptionFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -72,6 +68,5 @@ class ChangeHomePagePatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("change-homepage")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.navigation.label.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.navigation.label.fingerprints.PivotBarSetTextFingerprint
|
||||
@ -24,11 +21,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
@Description("Hide navigation bar labels.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class NavigationLabelPatch : BytecodePatch(
|
||||
listOf(PivotBarSetTextFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
PivotBarSetTextFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -38,14 +34,14 @@ class NavigationLabelPatch : BytecodePatch(
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
if (targetReference != "Landroid/widget/TextView;")
|
||||
return PivotBarSetTextFingerprint.toErrorResult()
|
||||
throw PivotBarSetTextFingerprint.exception
|
||||
|
||||
addInstruction(
|
||||
targetIndex + 1,
|
||||
"invoke-static {v$targetRegister}, $NAVIGATION->hideNavigationLabel(Landroid/widget/TextView;)V"
|
||||
)
|
||||
}
|
||||
} ?: return PivotBarSetTextFingerprint.toErrorResult()
|
||||
} ?: throw PivotBarSetTextFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -59,6 +55,5 @@ class NavigationLabelPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-navigation-label")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,13 @@
|
||||
package app.revanced.patches.youtube.navigation.navigationbuttons.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.youtube.navigation.navigationbuttons.fingerprints.AutoMotiveFingerprint
|
||||
@ -36,14 +33,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class NavigationButtonsPatch : BytecodePatch(
|
||||
listOf(
|
||||
AutoMotiveFingerprint,
|
||||
PivotBarCreateButtonViewFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
PivotBarCreateButtonViewFingerprint.result?.let { parentResult ->
|
||||
|
||||
@ -61,7 +57,7 @@ class NavigationButtonsPatch : BytecodePatch(
|
||||
parentResult.mutableClass
|
||||
)
|
||||
}.map {
|
||||
it.result?.scanResult?.patternScanResult ?: return it.toErrorResult()
|
||||
it.result?.scanResult?.patternScanResult ?: throw it.exception
|
||||
}
|
||||
) {
|
||||
val enumScanResult = this[0]
|
||||
@ -92,7 +88,7 @@ class NavigationButtonsPatch : BytecodePatch(
|
||||
injectHook(createButtonHook, insertIndex)
|
||||
}
|
||||
|
||||
} ?: return PivotBarCreateButtonViewFingerprint.toErrorResult()
|
||||
} ?: throw PivotBarCreateButtonViewFingerprint.exception
|
||||
|
||||
/**
|
||||
* Switch create button with notifications button
|
||||
@ -109,7 +105,7 @@ class NavigationButtonsPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return AutoMotiveFingerprint.toErrorResult()
|
||||
} ?: throw AutoMotiveFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -123,7 +119,6 @@ class NavigationButtonsPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-navigation-buttons")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,16 +1,13 @@
|
||||
package app.revanced.patches.youtube.navigation.tabletnavbar.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.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.navigation.tabletnavbar.fingerprints.PivotBarChangedFingerprint
|
||||
@ -25,20 +22,19 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@Description("Enables the tablet navigation bar.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class TabletNavigationBarPatch : BytecodePatch(
|
||||
listOf(
|
||||
PivotBarChangedFingerprint,
|
||||
PivotBarStyleFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
arrayOf(
|
||||
PivotBarChangedFingerprint,
|
||||
PivotBarStyleFingerprint
|
||||
).forEach {
|
||||
it.result?.insertHook() ?: return it.toErrorResult()
|
||||
it.result?.insertHook() ?: throw it.exception
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,7 +49,6 @@ class TabletNavigationBarPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("enable-tablet-navigation-bar")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.overlaybutton.alwaysrepeat.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.addInstructions
|
||||
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.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.youtube.overlaybutton.alwaysrepeat.fingerprints.AutoNavInformerFingerprint
|
||||
@ -25,7 +22,7 @@ class AlwaysRepeatPatch : BytecodePatch(
|
||||
VideoEndParentFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
VideoEndParentFingerprint.result?.classDef?.let { classDef ->
|
||||
VideoEndFingerprint.also { it.resolve(context, classDef) }.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -38,8 +35,8 @@ class AlwaysRepeatPatch : BytecodePatch(
|
||||
""", ExternalLabel("end", getInstruction(0))
|
||||
)
|
||||
}
|
||||
} ?: return VideoEndFingerprint.toErrorResult()
|
||||
} ?: return VideoEndParentFingerprint.toErrorResult()
|
||||
} ?: throw VideoEndFingerprint.exception
|
||||
} ?: throw VideoEndParentFingerprint.exception
|
||||
|
||||
AutoNavInformerFingerprint.result?.let {
|
||||
with(
|
||||
@ -58,8 +55,7 @@ class AlwaysRepeatPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return AutoNavInformerFingerprint.toErrorResult()
|
||||
} ?: throw AutoNavInformerFingerprint.exception
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,10 @@
|
||||
package app.revanced.patches.youtube.overlaybutton.downloadbuttonhook.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.overlaybutton.downloadbuttonhook.fingerprints.DownloadActionsFingerprint
|
||||
import app.revanced.util.integrations.Constants.UTILS_PATH
|
||||
@ -14,7 +12,7 @@ import app.revanced.util.integrations.Constants.UTILS_PATH
|
||||
class DownloadButtonHookPatch : BytecodePatch(
|
||||
listOf(DownloadActionsFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
DownloadActionsFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = it.scanResult.patternScanResult!!.startIndex
|
||||
@ -29,8 +27,7 @@ class DownloadButtonHookPatch : BytecodePatch(
|
||||
""", ExternalLabel("default", getInstruction(targetIndex))
|
||||
)
|
||||
}
|
||||
} ?: return DownloadActionsFingerprint.toErrorResult()
|
||||
} ?: throw DownloadActionsFingerprint.exception
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -3,10 +3,7 @@ package app.revanced.patches.youtube.overlaybutton.general.patch
|
||||
import app.revanced.extensions.doRecursively
|
||||
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
|
||||
@ -41,9 +38,8 @@ import org.w3c.dom.Element
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class OverlayButtonsPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
/**
|
||||
* Inject hook
|
||||
@ -161,6 +157,5 @@ class OverlayButtonsPatch : ResourcePatch {
|
||||
|
||||
SettingsPatch.updatePatchStatus("overlay-buttons")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.player.autoplaybutton.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 HideAutoplayButtonPatch : BytecodePatch(
|
||||
listOf(LayoutConstructorFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
LayoutConstructorFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -55,7 +51,7 @@ class HideAutoplayButtonPatch : BytecodePatch(
|
||||
""", ExternalLabel("hidden", getInstruction(jumpIndex))
|
||||
)
|
||||
}
|
||||
} ?: return LayoutConstructorFingerprint.toErrorResult()
|
||||
} ?: throw LayoutConstructorFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -69,7 +65,6 @@ class HideAutoplayButtonPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-autoplay-button")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.player.captionsbutton.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.utils.annotations.YouTubeCompatibility
|
||||
@ -30,11 +27,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideCaptionsButtonBytecodePatch : BytecodePatch(
|
||||
listOf(SubtitleButtonControllerFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SubtitleButtonControllerFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -52,7 +48,7 @@ class HideCaptionsButtonBytecodePatch : BytecodePatch(
|
||||
"invoke-static {v$targetRegister}, $PLAYER->hideCaptionsButton(Landroid/widget/ImageView;)V"
|
||||
)
|
||||
}
|
||||
} ?: return SubtitleButtonControllerFingerprint.toErrorResult()
|
||||
} ?: throw SubtitleButtonControllerFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -66,6 +62,5 @@ class HideCaptionsButtonBytecodePatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-captions-button")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,14 +1,11 @@
|
||||
package app.revanced.patches.youtube.player.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.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.player.castbutton.fingerprints.CastButtonFingerprint
|
||||
@ -21,11 +18,10 @@ import app.revanced.util.integrations.Constants.PLAYER
|
||||
@Description("Hides the cast button in the video player.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideCastButtonPatch : BytecodePatch(
|
||||
listOf(CastButtonFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
CastButtonFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
addInstructions(
|
||||
@ -35,7 +31,7 @@ class HideCastButtonPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return CastButtonFingerprint.toErrorResult()
|
||||
} ?: throw CastButtonFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -49,6 +45,5 @@ class HideCastButtonPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-cast-button")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ package app.revanced.patches.youtube.player.collapsebutton.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
|
||||
@ -23,9 +20,8 @@ import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideCollapseButtonPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -39,6 +35,5 @@ class HideCollapseButtonPatch : ResourcePatch {
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-collapse-button")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,13 @@
|
||||
package app.revanced.patches.youtube.player.endscreencards.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.extensions.injectHideCall
|
||||
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.getInstruction
|
||||
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.player.endscreencards.fingerprints.LayoutCircleFingerprint
|
||||
@ -31,7 +28,6 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideEndScreenCardsPatch : BytecodePatch(
|
||||
listOf(
|
||||
LayoutCircleFingerprint,
|
||||
@ -39,7 +35,7 @@ class HideEndScreenCardsPatch : BytecodePatch(
|
||||
LayoutVideoFingerprint,
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
fun MethodFingerprintResult.injectHideCalls() {
|
||||
val index = scanResult.patternScanResult!!.endIndex
|
||||
@ -59,7 +55,7 @@ class HideEndScreenCardsPatch : BytecodePatch(
|
||||
LayoutIconFingerprint,
|
||||
LayoutVideoFingerprint
|
||||
).forEach {
|
||||
it.result?.injectHideCalls() ?: return it.toErrorResult()
|
||||
it.result?.injectHideCalls() ?: throw it.exception
|
||||
}
|
||||
|
||||
/**
|
||||
@ -74,6 +70,5 @@ class HideEndScreenCardsPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-endscreen-cards")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,13 @@
|
||||
package app.revanced.patches.youtube.player.filmstripoverlay.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.proxy.mutableTypes.MutableMethod
|
||||
@ -42,14 +39,13 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideFilmstripOverlayPatch : BytecodePatch(
|
||||
listOf(
|
||||
FilmStripOverlayParentFingerprint,
|
||||
YouTubeControlsOverlayFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
FilmStripOverlayParentFingerprint.result?.classDef?.let { classDef ->
|
||||
arrayOf(
|
||||
@ -63,9 +59,9 @@ class HideFilmstripOverlayPatch : BytecodePatch(
|
||||
classDef
|
||||
)
|
||||
}.result?.mutableMethod?.injectHook()
|
||||
?: return fingerprint.toErrorResult()
|
||||
?: throw fingerprint.exception
|
||||
}
|
||||
} ?: return FilmStripOverlayParentFingerprint.toErrorResult()
|
||||
} ?: throw FilmStripOverlayParentFingerprint.exception
|
||||
|
||||
YouTubeControlsOverlayFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -137,7 +133,7 @@ class HideFilmstripOverlayPatch : BytecodePatch(
|
||||
""", ExternalLabel("hidden", getInstruction(jumpIndex))
|
||||
)
|
||||
}
|
||||
} ?: return YouTubeControlsOverlayFingerprint.toErrorResult()
|
||||
} ?: throw YouTubeControlsOverlayFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -152,7 +148,6 @@ class HideFilmstripOverlayPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-filmstrip-overlay")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,16 +1,13 @@
|
||||
package app.revanced.patches.youtube.player.hapticfeedback.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
|
||||
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
|
||||
@ -29,7 +26,6 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@Description("Disable haptic feedback when swiping.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HapticFeedBackPatch : BytecodePatch(
|
||||
listOf(
|
||||
MarkerHapticsFingerprint,
|
||||
@ -38,7 +34,7 @@ class HapticFeedBackPatch : BytecodePatch(
|
||||
ZoomHapticsFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
arrayOf(
|
||||
SeekHapticsFingerprint to "disableSeekVibrate",
|
||||
@ -59,7 +55,6 @@ class HapticFeedBackPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("disable-haptic-feedback")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
@ -76,7 +71,7 @@ class HapticFeedBackPatch : BytecodePatch(
|
||||
|
||||
injectHook(index, register, methodName)
|
||||
}
|
||||
} ?: throw toErrorResult()
|
||||
} ?: throw exception
|
||||
}
|
||||
|
||||
fun MutableMethod.injectHook(
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.player.infocards.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.youtube.player.infocards.fingerprints.InfoCardsIncognitoFingerprint
|
||||
@ -23,11 +20,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
@Description("Hides info-cards in videos.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideInfoCardsPatch : BytecodePatch(
|
||||
listOf(InfoCardsIncognitoFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
InfoCardsIncognitoFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = it.scanResult.patternScanResult!!.startIndex
|
||||
@ -41,7 +37,7 @@ class HideInfoCardsPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return InfoCardsIncognitoFingerprint.toErrorResult()
|
||||
} ?: throw InfoCardsIncognitoFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -55,6 +51,5 @@ class HideInfoCardsPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-info-cards")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.player.musicbutton.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.PLAYER
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideMusicButtonPatch : BytecodePatch(
|
||||
listOf(MusicAppDeeplinkButtonFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
MusicAppDeeplinkButtonFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -47,7 +43,7 @@ class HideMusicButtonPatch : BytecodePatch(
|
||||
ExternalLabel("hidden", getInstruction(implementation!!.instructions.size - 1))
|
||||
)
|
||||
}
|
||||
} ?: return MusicAppDeeplinkButtonFingerprint.toErrorResult()
|
||||
} ?: throw MusicAppDeeplinkButtonFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -61,6 +57,5 @@ class HideMusicButtonPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-music-button")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,11 @@
|
||||
package app.revanced.patches.youtube.player.playerbuttonbg.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.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.player.playerbuttonbg.fingerprints.PlayerPatchFingerprint
|
||||
@ -27,18 +24,17 @@ import app.revanced.util.integrations.Constants.INTEGRATIONS_PATH
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HidePlayerButtonBackgroundPatch : BytecodePatch(
|
||||
listOf(PlayerPatchFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
PlayerPatchFingerprint.result?.mutableMethod?.addInstruction(
|
||||
0,
|
||||
"invoke-static {p0}, " +
|
||||
"$INTEGRATIONS_PATH/utils/ResourceHelper;->" +
|
||||
"hidePlayerButtonBackground(Landroid/view/View;)V"
|
||||
) ?: return PlayerPatchFingerprint.toErrorResult()
|
||||
) ?: throw PlayerPatchFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -52,6 +48,5 @@ class HidePlayerButtonBackgroundPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-player-button-background")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,13 @@
|
||||
package app.revanced.patches.youtube.player.playeroverlayfilter.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.youtube.utils.annotations.YouTubeCompatibility
|
||||
@ -33,11 +30,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class PlayerOverlayFilterPatch : BytecodePatch(
|
||||
listOf(YouTubeControlsOverlayFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
YouTubeControlsOverlayFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -46,14 +42,14 @@ class PlayerOverlayFilterPatch : BytecodePatch(
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
if (!targetParameter.toString().endsWith("Landroid/widget/ImageView;"))
|
||||
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}, $PLAYER->hidePlayerOverlayFilter(Landroid/widget/ImageView;)V"
|
||||
)
|
||||
}
|
||||
} ?: return YouTubeControlsOverlayFingerprint.toErrorResult()
|
||||
} ?: throw YouTubeControlsOverlayFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -67,6 +63,5 @@ class PlayerOverlayFilterPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-player-overlay-filter")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -2,11 +2,8 @@ package app.revanced.patches.youtube.player.previousnextbutton.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.youtube.utils.annotations.YouTubeCompatibility
|
||||
@ -23,9 +20,8 @@ import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HidePreviousNextButtonPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -39,6 +35,5 @@ class HidePreviousNextButtonPatch : BytecodePatch() {
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-previous-next-button")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.player.seekmessage.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.PLAYER
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class SeekMessagePatch : BytecodePatch(
|
||||
listOf(SeekEduContainerFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SeekEduContainerFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -46,7 +42,7 @@ class SeekMessagePatch : BytecodePatch(
|
||||
""", ExternalLabel("default", getInstruction(0))
|
||||
)
|
||||
}
|
||||
} ?: return SeekEduContainerFingerprint.toErrorResult()
|
||||
} ?: throw SeekEduContainerFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -60,6 +56,5 @@ class SeekMessagePatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-seek-message")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.player.speedoverlay.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.youtube.player.speedoverlay.fingerprints.SpeedOverlayConfigFingerprint
|
||||
@ -23,11 +20,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@Description("Hide speed overlay in player.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideSpeedOverlayPatch : BytecodePatch(
|
||||
listOf(SpeedOverlayConfigFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SpeedOverlayConfigFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -41,7 +37,7 @@ class HideSpeedOverlayPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return SpeedOverlayConfigFingerprint.toErrorResult()
|
||||
} ?: throw SpeedOverlayConfigFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -55,6 +51,5 @@ class HideSpeedOverlayPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-speed-overlay")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.player.suggestactions.patch
|
||||
|
||||
import app.revanced.extensions.exception
|
||||
import app.revanced.extensions.injectHideCall
|
||||
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.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.player.suggestactions.fingerprints.SuggestedActionsFingerprint
|
||||
@ -31,11 +28,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class SuggestedActionsPatch : BytecodePatch(
|
||||
listOf(SuggestedActionsFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SuggestedActionsFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
@ -48,7 +44,7 @@ class SuggestedActionsPatch : BytecodePatch(
|
||||
"hideSuggestedActions"
|
||||
)
|
||||
}
|
||||
} ?: return SuggestedActionsFingerprint.toErrorResult()
|
||||
} ?: throw SuggestedActionsFingerprint.exception
|
||||
|
||||
context.updatePatchStatus("SuggestedActions")
|
||||
|
||||
@ -64,6 +60,5 @@ class SuggestedActionsPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-suggested-actions")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,14 @@
|
||||
package app.revanced.patches.youtube.player.suggestedvideooverlay.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.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.player.suggestedvideooverlay.fingerprints.CoreConatinerBuilderFingerprint
|
||||
@ -36,14 +33,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class SuggestedVideoOverlayPatch : BytecodePatch(
|
||||
listOf(
|
||||
CoreConatinerBuilderFingerprint,
|
||||
VideoEndParentFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
CoreConatinerBuilderFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -52,7 +48,7 @@ class SuggestedVideoOverlayPatch : BytecodePatch(
|
||||
getInstruction<ReferenceInstruction>(targetIndex).reference
|
||||
|
||||
if (!targetReference.toString().endsWith("Landroid/view/ViewGroup;"))
|
||||
return PatchResultError("Reference did not match: $targetReference")
|
||||
throw PatchException("Reference did not match: $targetReference")
|
||||
|
||||
val targetRegister =
|
||||
getInstruction<TwoRegisterInstruction>(targetIndex).registerA
|
||||
@ -62,7 +58,7 @@ class SuggestedVideoOverlayPatch : BytecodePatch(
|
||||
"invoke-static {v$targetRegister}, $PLAYER->hideSuggestedVideoOverlay(Landroid/view/ViewGroup;)V"
|
||||
)
|
||||
}
|
||||
} ?: return CoreConatinerBuilderFingerprint.toErrorResult()
|
||||
} ?: throw CoreConatinerBuilderFingerprint.exception
|
||||
|
||||
VideoEndParentFingerprint.result?.classDef?.let { classDef ->
|
||||
VideoEndFingerprint.also { it.resolve(context, classDef) }.result?.let {
|
||||
@ -72,8 +68,8 @@ class SuggestedVideoOverlayPatch : BytecodePatch(
|
||||
"invoke-static {},$PLAYER->hideSuggestedVideoOverlay()V"
|
||||
)
|
||||
}
|
||||
} ?: return VideoEndFingerprint.toErrorResult()
|
||||
} ?: return VideoEndParentFingerprint.toErrorResult()
|
||||
} ?: throw VideoEndFingerprint.exception
|
||||
} ?: throw VideoEndParentFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -88,7 +84,6 @@ class SuggestedVideoOverlayPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-suggested-video-overlay")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,17 +1,14 @@
|
||||
package app.revanced.patches.youtube.player.watermark.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.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.youtube.player.watermark.fingerprints.HideWatermarkFingerprint
|
||||
@ -26,11 +23,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
@Description("Hides creator's watermarks on videos.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideChannelWatermarkBytecodePatch : BytecodePatch(
|
||||
listOf(HideWatermarkParentFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
HideWatermarkParentFingerprint.result?.let { parentResult ->
|
||||
HideWatermarkFingerprint.also {
|
||||
@ -51,8 +47,8 @@ class HideChannelWatermarkBytecodePatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return HideWatermarkFingerprint.toErrorResult()
|
||||
} ?: return HideWatermarkParentFingerprint.toErrorResult()
|
||||
} ?: throw HideWatermarkFingerprint.exception
|
||||
} ?: throw HideWatermarkParentFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -66,6 +62,5 @@ class HideChannelWatermarkBytecodePatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-channel-watermark")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,13 @@
|
||||
package app.revanced.patches.youtube.seekbar.seekbar.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
|
||||
@ -31,11 +28,10 @@ import app.revanced.util.integrations.Constants.SEEKBAR
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideSeekbarPatch : BytecodePatch(
|
||||
listOf(SeekbarFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
SeekbarFingerprint.result?.mutableClass?.let { mutableClass ->
|
||||
SeekbarOnDrawFingerprint.also { it.resolve(context, mutableClass) }.result?.let {
|
||||
@ -49,8 +45,8 @@ class HideSeekbarPatch : BytecodePatch(
|
||||
""", ExternalLabel("show_seekbar", getInstruction(0))
|
||||
)
|
||||
}
|
||||
} ?: return SeekbarOnDrawFingerprint.toErrorResult()
|
||||
} ?: return SeekbarFingerprint.toErrorResult()
|
||||
} ?: throw SeekbarOnDrawFingerprint.exception
|
||||
} ?: throw SeekbarFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -65,6 +61,5 @@ class HideSeekbarPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-seekbar")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,13 @@
|
||||
package app.revanced.patches.youtube.seekbar.seekbarcolor.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.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.util.proxy.mutableTypes.MutableMethod
|
||||
@ -43,7 +39,6 @@ import org.w3c.dom.Element
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class SeekbarColorPatch : BytecodePatch(
|
||||
listOf(
|
||||
ControlsOverlayStyleFingerprint,
|
||||
@ -51,15 +46,15 @@ class SeekbarColorPatch : BytecodePatch(
|
||||
ShortsSeekbarColorFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
PlayerSeekbarColorFingerprint.result?.mutableMethod?.apply {
|
||||
hook(getWideLiteralIndex(InlineTimeBarColorizedBarPlayedColorDark) + 2)
|
||||
hook(getWideLiteralIndex(InlineTimeBarPlayedNotHighlightedColor) + 2)
|
||||
} ?: return PlayerSeekbarColorFingerprint.toErrorResult()
|
||||
} ?: throw PlayerSeekbarColorFingerprint.exception
|
||||
|
||||
ShortsSeekbarColorFingerprint.result?.mutableMethod?.apply {
|
||||
hook(getWideLiteralIndex(ReelTimeBarPlayedColor) + 2)
|
||||
} ?: return ShortsSeekbarColorFingerprint.toErrorResult()
|
||||
} ?: throw ShortsSeekbarColorFingerprint.exception
|
||||
|
||||
ControlsOverlayStyleFingerprint.result?.let {
|
||||
with(
|
||||
@ -77,7 +72,7 @@ class SeekbarColorPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return ControlsOverlayStyleFingerprint.toErrorResult()
|
||||
} ?: throw ControlsOverlayStyleFingerprint.exception
|
||||
|
||||
LithoThemePatch.injectCall("$SEEKBAR->getLithoColor(I)I")
|
||||
|
||||
@ -85,7 +80,7 @@ class SeekbarColorPatch : BytecodePatch(
|
||||
val layerList = it.file.getElementsByTagName("layer-list").item(0) as Element
|
||||
val progressNode = layerList.getElementsByTagName("item").item(1) as Element
|
||||
if (!progressNode.getAttributeNode("android:id").value.endsWith("progress")) {
|
||||
return PatchResultError("Could not find progress bar")
|
||||
throw PatchException("Could not find progress bar")
|
||||
}
|
||||
val scaleNode = progressNode.getElementsByTagName("scale").item(0) as Element
|
||||
val shapeNode = scaleNode.getElementsByTagName("shape").item(0) as Element
|
||||
@ -107,7 +102,6 @@ class SeekbarColorPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("custom-seekbar-color")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,16 +1,13 @@
|
||||
package app.revanced.patches.youtube.seekbar.speed.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.utils.annotations.YouTubeCompatibility
|
||||
@ -34,11 +31,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class AppendSpeedPatch : BytecodePatch(
|
||||
listOf(TotalTimeFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
TotalTimeFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
var insertIndex = -1
|
||||
@ -62,9 +58,9 @@ class AppendSpeedPatch : BytecodePatch(
|
||||
}
|
||||
}
|
||||
if (insertIndex == -1)
|
||||
return PatchResultError("target Instruction not found!")
|
||||
throw PatchException("target Instruction not found!")
|
||||
}
|
||||
} ?: return TotalTimeFingerprint.toErrorResult()
|
||||
} ?: throw TotalTimeFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -78,6 +74,5 @@ class AppendSpeedPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("enable-timestamps-speed")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.seekbar.tapping.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
|
||||
@ -25,14 +22,13 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
@Description("Enables tap-to-seek on the seekbar of the video player.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class SeekbarTappingPatch : BytecodePatch(
|
||||
listOf(
|
||||
SeekbarTappingReferenceFingerprint,
|
||||
SeekbarTappingFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SeekbarTappingReferenceFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
TappingLabel = """
|
||||
@ -43,7 +39,7 @@ class SeekbarTappingPatch : BytecodePatch(
|
||||
invoke-virtual { p0, v2 }, ${getInstruction<ReferenceInstruction>(it.scanResult.patternScanResult!!.endIndex - 1).reference}
|
||||
"""
|
||||
}
|
||||
} ?: return SeekbarTappingReferenceFingerprint.toErrorResult()
|
||||
} ?: throw SeekbarTappingReferenceFingerprint.exception
|
||||
|
||||
SeekbarTappingFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -55,7 +51,7 @@ class SeekbarTappingPatch : BytecodePatch(
|
||||
ExternalLabel("disabled", getInstruction(insertIndex))
|
||||
)
|
||||
}
|
||||
} ?: return SeekbarTappingFingerprint.toErrorResult()
|
||||
} ?: throw SeekbarTappingFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -69,7 +65,6 @@ class SeekbarTappingPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("enable-seekbar-tapping")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.seekbar.thumbnailpreview.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.youtube.seekbar.thumbnailpreview.fingerprints.ThumbnailPreviewConfigFingerprint
|
||||
@ -23,11 +20,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@Description("Enables a new type of thumbnail preview.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class NewThumbnailPreviewPatch : BytecodePatch(
|
||||
listOf(ThumbnailPreviewConfigFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
ThumbnailPreviewConfigFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -41,7 +37,7 @@ class NewThumbnailPreviewPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return ThumbnailPreviewConfigFingerprint.toErrorResult()
|
||||
} ?: throw ThumbnailPreviewConfigFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -55,6 +51,5 @@ class NewThumbnailPreviewPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("enable-new-thumbnail-preview")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.seekbar.timestamps.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.SEEKBAR
|
||||
@Description("Hides timestamp in video player.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideTimeStampPatch : BytecodePatch(
|
||||
listOf(TimeCounterFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
TimeCounterFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -40,7 +36,7 @@ class HideTimeStampPatch : BytecodePatch(
|
||||
""", ExternalLabel("show_time_stamp", getInstruction(0))
|
||||
)
|
||||
}
|
||||
} ?: return TimeCounterFingerprint.toErrorResult()
|
||||
} ?: throw TimeCounterFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -54,6 +50,5 @@ class HideTimeStampPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-time-stamp")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
package app.revanced.patches.youtube.shorts.commentpopuppanels.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.youtube.shorts.commentpopuppanels.fingerprints.ReelWatchFragmentBuilderFingerprint
|
||||
@ -24,11 +21,10 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@Description("Enables a new type of comment popup panel in the shorts player.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class NewCommentPopupPanelsPatch : BytecodePatch(
|
||||
listOf(ReelWatchFragmentBuilderFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
ReelWatchFragmentBuilderFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -42,7 +38,7 @@ class NewCommentPopupPanelsPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return ReelWatchFragmentBuilderFingerprint.toErrorResult()
|
||||
} ?: throw ReelWatchFragmentBuilderFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
@ -55,6 +51,5 @@ class NewCommentPopupPanelsPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus("enable-new-comment-popup-panels")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,10 @@
|
||||
package app.revanced.patches.youtube.shorts.shortscomponent.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.youtube.shorts.shortscomponent.fingerprints.ShortsCommentFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.RightComment
|
||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||
@ -16,7 +14,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
class ShortsCommentButtonPatch : BytecodePatch(
|
||||
listOf(ShortsCommentFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
ShortsCommentFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = getWideLiteralIndex(RightComment) + 3
|
||||
@ -27,8 +25,7 @@ class ShortsCommentButtonPatch : BytecodePatch(
|
||||
"invoke-static {v$insertRegister}, $SHORTS->hideShortsPlayerCommentsButton(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
} ?: return ShortsCommentFingerprint.toErrorResult()
|
||||
} ?: throw ShortsCommentFingerprint.exception
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,8 @@ package app.revanced.patches.youtube.shorts.shortscomponent.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.youtube.shorts.shortsnavigationbar.patch.ShortsNavigationBarPatch
|
||||
@ -39,9 +36,8 @@ import app.revanced.util.integrations.Constants.PATCHES_PATH
|
||||
]
|
||||
)
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class ShortsComponentPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
LithoFilterPatch.addFilter("$PATCHES_PATH/ads/ShortsFilter;")
|
||||
LithoFilterPatch.addFilter("$PATCHES_PATH/ads/ShortsHeaderFilter;")
|
||||
@ -60,6 +56,5 @@ class ShortsComponentPatch : BytecodePatch() {
|
||||
|
||||
SettingsPatch.updatePatchStatus("hide-shorts-component")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,10 @@
|
||||
package app.revanced.patches.youtube.shorts.shortscomponent.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.shorts.shortscomponent.fingerprints.ShortsDislikeFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ReelRightDislikeIcon
|
||||
@ -18,7 +16,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
class ShortsDislikeButtonPatch : BytecodePatch(
|
||||
listOf(ShortsDislikeFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
ShortsDislikeFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = getWideLiteralIndex(ReelRightDislikeIcon)
|
||||
@ -38,8 +36,7 @@ class ShortsDislikeButtonPatch : BytecodePatch(
|
||||
break
|
||||
}
|
||||
}
|
||||
} ?: return ShortsDislikeFingerprint.toErrorResult()
|
||||
} ?: throw ShortsDislikeFingerprint.exception
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,10 @@
|
||||
package app.revanced.patches.youtube.shorts.shortscomponent.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.patches.youtube.shorts.shortscomponent.fingerprints.ShortsInfoPanelFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.ReelPlayerInfoPanel
|
||||
import app.revanced.util.bytecode.getWideLiteralIndex
|
||||
@ -16,7 +14,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
class ShortsInfoPanelPatch : BytecodePatch(
|
||||
listOf(ShortsInfoPanelFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
ShortsInfoPanelFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = getWideLiteralIndex(ReelPlayerInfoPanel) + 3
|
||||
@ -29,8 +27,7 @@ class ShortsInfoPanelPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return ShortsInfoPanelFingerprint.toErrorResult()
|
||||
} ?: throw ShortsInfoPanelFingerprint.exception
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user