build(Needs bump): Bump dependencies
This commit is contained in:
+1
-5
@@ -6,8 +6,6 @@ import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
@@ -29,7 +27,7 @@ class AutoCaptionsPatch : BytecodePatch(
|
||||
StartVideoInformerFingerprint, SubtitleButtonControllerFingerprint, SubtitleTrackFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_auto_captions",
|
||||
@@ -72,7 +70,5 @@ class AutoCaptionsPatch : BytecodePatch(
|
||||
nop
|
||||
"""
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
||||
+4
-8
@@ -3,9 +3,7 @@ package app.revanced.patches.youtube.layout.branding.header.patch
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.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.Patch
|
||||
import app.revanced.patches.youtube.layout.branding.header.annotations.PremiumHeadingCompatibility
|
||||
@@ -18,9 +16,9 @@ import kotlin.io.path.exists
|
||||
@Description("Shows premium branding on the home screen.")
|
||||
@PremiumHeadingCompatibility
|
||||
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")
|
||||
@@ -32,7 +30,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,
|
||||
@@ -40,7 +38,5 @@ class PremiumHeadingPatch : ResourcePatch {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
||||
+1
-3
@@ -16,7 +16,7 @@ import java.nio.file.Files
|
||||
@Description("Changes the YouTube launcher icon and name to your choice (defaults to ReVanced).")
|
||||
@CustomBrandingCompatibility
|
||||
class CustomBrandingPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
fun copyResources(resourceGroups: List<ResourceUtils.ResourceGroup>) {
|
||||
iconPath?.let { iconPathString ->
|
||||
val iconPath = File(iconPathString)
|
||||
@@ -62,8 +62,6 @@ class CustomBrandingPatch : ResourcePatch {
|
||||
"android:label=\"$appName"
|
||||
)
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
companion object : OptionsContainer() {
|
||||
|
||||
+1
-5
@@ -3,8 +3,6 @@ package app.revanced.patches.youtube.layout.buttons.action.patch
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
@@ -22,7 +20,7 @@ import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
@Description("Adds the options to hide action buttons under a video.")
|
||||
@HideButtonsCompatibility
|
||||
class HideButtonsPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
PreferenceScreen(
|
||||
"revanced_hide_buttons_preference_screen",
|
||||
@@ -94,8 +92,6 @@ class HideButtonsPatch : ResourcePatch {
|
||||
)
|
||||
|
||||
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
||||
+2
-6
@@ -8,8 +8,6 @@ import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
@@ -33,7 +31,7 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
class HideAutoplayButtonPatch : BytecodePatch(
|
||||
listOf(LayoutConstructorFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_hide_autoplay_button",
|
||||
@@ -70,8 +68,6 @@ class HideAutoplayButtonPatch : BytecodePatch(
|
||||
""",
|
||||
ExternalLabel("hidden", jumpInstruction)
|
||||
)
|
||||
} ?: return LayoutConstructorFingerprint.toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
} ?: throw LayoutConstructorFingerprint.toErrorResult()
|
||||
}
|
||||
}
|
||||
+1
-5
@@ -5,8 +5,6 @@ import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
@@ -25,7 +23,7 @@ import com.android.tools.smali.dexlib2.Opcode
|
||||
class HideCaptionsButtonPatch : BytecodePatch(listOf(
|
||||
SubtitleButtonControllerFingerprint,
|
||||
)) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_hide_captions_button",
|
||||
@@ -48,7 +46,5 @@ class HideCaptionsButtonPatch : BytecodePatch(listOf(
|
||||
invoke-static {v0}, Lapp/revanced/integrations/patches/HideCaptionsButtonPatch;->hideCaptionsButton(Landroid/widget/ImageView;)V
|
||||
"""
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
||||
+4
-8
@@ -5,9 +5,7 @@ import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
@@ -22,7 +20,7 @@ import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
@Description("Hides the cast button in the video player.")
|
||||
@CastButtonCompatibility
|
||||
class HideCastButtonPatch : BytecodePatch() {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_hide_cast_button",
|
||||
@@ -33,7 +31,7 @@ class HideCastButtonPatch : BytecodePatch() {
|
||||
)
|
||||
|
||||
val buttonClass = context.findClass("MediaRouteButton")
|
||||
?: return PatchResultError("MediaRouteButton class not found.")
|
||||
?: throw PatchException("MediaRouteButton class not found.")
|
||||
|
||||
buttonClass.mutableClass.methods.find { it.name == "setVisibility" }?.apply {
|
||||
addInstructions(
|
||||
@@ -43,8 +41,6 @@ class HideCastButtonPatch : BytecodePatch() {
|
||||
move-result p1
|
||||
"""
|
||||
)
|
||||
} ?: return PatchResultError("setVisibility method not found.")
|
||||
|
||||
return PatchResultSuccess()
|
||||
} ?: throw PatchException("setVisibility method not found.")
|
||||
}
|
||||
}
|
||||
|
||||
+4
-7
@@ -8,8 +8,6 @@ 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.shared.settings.preference.impl.PreferenceScreen
|
||||
@@ -36,7 +34,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@Description("Adds options to hide or change navigation buttons.")
|
||||
@NavigationButtonsCompatibility
|
||||
class NavigationButtonsPatch : BytecodePatch(listOf(AddCreateButtonViewFingerprint)) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
PreferenceScreen(
|
||||
"revanced_navigation_buttons_preference_screen",
|
||||
@@ -103,7 +101,7 @@ class NavigationButtonsPatch : BytecodePatch(listOf(AddCreateButtonViewFingerpri
|
||||
initializeButtonsResult.mutableClass
|
||||
)
|
||||
)
|
||||
return it.toErrorResult()
|
||||
throw it.toErrorResult()
|
||||
}
|
||||
.map { it.result!!.scanResult.patternScanResult!! }
|
||||
|
||||
@@ -152,7 +150,7 @@ class NavigationButtonsPatch : BytecodePatch(listOf(AddCreateButtonViewFingerpri
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return AddCreateButtonViewFingerprint.toErrorResult()
|
||||
} ?: throw AddCreateButtonViewFingerprint.toErrorResult()
|
||||
|
||||
/*
|
||||
* Resolve fingerprints
|
||||
@@ -160,7 +158,7 @@ class NavigationButtonsPatch : BytecodePatch(listOf(AddCreateButtonViewFingerpri
|
||||
|
||||
InitializeButtonsFingerprint.result!!.let {
|
||||
if (!PivotBarCreateButtonViewFingerprint.resolve(context, it.mutableMethod, it.mutableClass))
|
||||
return PivotBarCreateButtonViewFingerprint.toErrorResult()
|
||||
throw PivotBarCreateButtonViewFingerprint.toErrorResult()
|
||||
}
|
||||
|
||||
PivotBarCreateButtonViewFingerprint.result!!.apply {
|
||||
@@ -180,7 +178,6 @@ class NavigationButtonsPatch : BytecodePatch(listOf(AddCreateButtonViewFingerpri
|
||||
|
||||
mutableMethod.injectHook(hook, insertIndex)
|
||||
}
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
||||
+5
-8
@@ -5,9 +5,7 @@ import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
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.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
import app.revanced.patches.youtube.layout.buttons.navigation.fingerprints.InitializeButtonsFingerprint
|
||||
@@ -18,10 +16,10 @@ import app.revanced.patches.youtube.layout.buttons.navigation.fingerprints.Pivot
|
||||
class ResolvePivotBarFingerprintsPatch : BytecodePatch(
|
||||
listOf(PivotBarConstructorFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// imageOnlyTabResourceId is used in InitializeButtonsFingerprint fingerprint
|
||||
ResourceMappingPatch.resourceMappings.find { it.type == "layout" && it.name == "image_only_tab" }
|
||||
?.let { imageOnlyTabResourceId = it.id } ?: return PatchResultError("Failed to find resource")
|
||||
?.let { imageOnlyTabResourceId = it.id } ?: throw PatchException("Failed to find resource")
|
||||
|
||||
PivotBarConstructorFingerprint.result?.let {
|
||||
// Resolve InitializeButtonsFingerprint on the class of the method
|
||||
@@ -30,9 +28,8 @@ class ResolvePivotBarFingerprintsPatch : BytecodePatch(
|
||||
context,
|
||||
it.classDef
|
||||
)
|
||||
) return InitializeButtonsFingerprint.toErrorResult()
|
||||
} ?: return PivotBarConstructorFingerprint.toErrorResult()
|
||||
return PatchResultSuccess()
|
||||
) throw InitializeButtonsFingerprint.toErrorResult()
|
||||
} ?: throw PivotBarConstructorFingerprint.toErrorResult()
|
||||
}
|
||||
|
||||
internal companion object {
|
||||
|
||||
+2
-5
@@ -7,8 +7,6 @@ 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.shared.settings.preference.impl.StringResource
|
||||
@@ -32,7 +30,7 @@ class HidePlayerButtonsPatch : BytecodePatch(
|
||||
const val HAS_PREVIOUS = 6
|
||||
}
|
||||
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_hide_player_buttons",
|
||||
@@ -69,7 +67,6 @@ class HidePlayerButtonsPatch : BytecodePatch(
|
||||
move-result v$hasPreviousParameterRegister
|
||||
"""
|
||||
)
|
||||
} ?: return PlayerControlsVisibilityModelFingerprint.toErrorResult()
|
||||
return PatchResultSuccess()
|
||||
} ?: throw PlayerControlsVisibilityModelFingerprint.toErrorResult()
|
||||
}
|
||||
}
|
||||
|
||||
+2
-6
@@ -7,8 +7,6 @@ import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.layout.hide.albumcards.annotations.AlbumCardsCompatibility
|
||||
@@ -27,7 +25,7 @@ class AlbumCardsPatch : BytecodePatch(
|
||||
AlbumCardsFingerprint,
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
AlbumCardsFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val checkCastAnchorIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
@@ -43,8 +41,6 @@ class AlbumCardsPatch : BytecodePatch(
|
||||
"hideAlbumCard(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
} ?: return AlbumCardsFingerprint.toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
} ?: throw AlbumCardsFingerprint.toErrorResult()
|
||||
}
|
||||
}
|
||||
|
||||
+1
-5
@@ -1,8 +1,6 @@
|
||||
package app.revanced.patches.youtube.layout.hide.albumcards.resource.patch
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
@@ -16,7 +14,7 @@ class AlbumCardsResourcePatch : ResourcePatch {
|
||||
internal var albumCardId: Long = -1
|
||||
}
|
||||
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_hide_album_cards",
|
||||
@@ -29,7 +27,5 @@ class AlbumCardsResourcePatch : ResourcePatch {
|
||||
albumCardId = ResourceMappingPatch.resourceMappings.single {
|
||||
it.type == "layout" && it.name == "album_card"
|
||||
}.id
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
+2
-6
@@ -7,8 +7,6 @@ import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.layout.hide.breakingnews.annotations.BreakingNewsCompatibility
|
||||
@@ -25,7 +23,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
class BreakingNewsPatch : BytecodePatch(
|
||||
listOf(BreakingNewsFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
BreakingNewsFingerprint.result?.let {
|
||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex - 1
|
||||
val moveResultIndex = insertIndex - 1
|
||||
@@ -44,9 +42,7 @@ class BreakingNewsPatch : BytecodePatch(
|
||||
)
|
||||
}
|
||||
|
||||
} ?: return BreakingNewsFingerprint.toErrorResult()
|
||||
} ?: throw BreakingNewsFingerprint.toErrorResult()
|
||||
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
||||
+1
-5
@@ -1,8 +1,6 @@
|
||||
package app.revanced.patches.youtube.layout.hide.breakingnews.resource.patch
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
@@ -16,7 +14,7 @@ class BreakingNewsResourcePatch : ResourcePatch {
|
||||
internal var horizontalCardListId: Long = -1
|
||||
}
|
||||
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_hide_breaking_news",
|
||||
@@ -29,7 +27,5 @@ class BreakingNewsResourcePatch : ResourcePatch {
|
||||
horizontalCardListId = ResourceMappingPatch.resourceMappings.single {
|
||||
it.type == "layout" && it.name == "horizontal_card_list"
|
||||
}.id
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
+1
-5
@@ -3,8 +3,6 @@ package app.revanced.patches.youtube.layout.hide.comments.patch
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
@@ -21,7 +19,7 @@ import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
@HideCommentsCompatibility
|
||||
@DependsOn([SettingsPatch::class, LithoFilterPatch::class])
|
||||
class CommentsPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
@@ -45,8 +43,6 @@ class CommentsPatch : ResourcePatch {
|
||||
StringResource("revanced_comments_preference_screen_summary", "Manage the visibility of comments section components")
|
||||
)
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
||||
+2
-6
@@ -7,8 +7,6 @@ import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.layout.hide.crowdfundingbox.annotations.CrowdfundingBoxCompatibility
|
||||
@@ -27,7 +25,7 @@ class CrowdfundingBoxPatch : BytecodePatch(
|
||||
CrowdfundingBoxFingerprint,
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
CrowdfundingBoxFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
@@ -35,9 +33,7 @@ class CrowdfundingBoxPatch : BytecodePatch(
|
||||
|
||||
addInstruction(insertIndex, "invoke-static {v$objectRegister}, $INTEGRATIONS_METHOD_DESCRIPTOR")
|
||||
}
|
||||
} ?: return CrowdfundingBoxFingerprint.toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
} ?: throw CrowdfundingBoxFingerprint.toErrorResult()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
||||
+1
-5
@@ -1,8 +1,6 @@
|
||||
package app.revanced.patches.youtube.layout.hide.crowdfundingbox.resource.patch
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
@@ -16,7 +14,7 @@ class CrowdfundingBoxResourcePatch : ResourcePatch {
|
||||
internal var crowdfundingBoxId: Long = -1
|
||||
}
|
||||
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_hide_crowdfunding_box",
|
||||
@@ -29,7 +27,5 @@ class CrowdfundingBoxResourcePatch : ResourcePatch {
|
||||
crowdfundingBoxId = ResourceMappingPatch.resourceMappings.single {
|
||||
it.type == "layout" && it.name == "donation_companion"
|
||||
}.id
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
+1
-5
@@ -8,8 +8,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
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.layout.hide.endscreencards.annotations.HideEndscreenCardsCompatibility
|
||||
@@ -32,7 +30,7 @@ class HideEndscreenCardsPatch : BytecodePatch(
|
||||
LayoutVideoFingerprint,
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
fun MethodFingerprint.injectHideCall() {
|
||||
val layoutResult = result ?: throw toErrorResult()
|
||||
layoutResult.mutableMethod.apply {
|
||||
@@ -51,7 +49,5 @@ class HideEndscreenCardsPatch : BytecodePatch(
|
||||
LayoutIconFingerprint,
|
||||
LayoutVideoFingerprint
|
||||
).forEach(MethodFingerprint::injectHideCall)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
||||
+1
-5
@@ -1,8 +1,6 @@
|
||||
package app.revanced.patches.youtube.layout.hide.endscreencards.resource.patch
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
@@ -18,7 +16,7 @@ class HideEndscreenCardsResourcePatch : ResourcePatch {
|
||||
var layoutVideo: Long = -1
|
||||
}
|
||||
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_hide_endscreen_cards",
|
||||
@@ -35,7 +33,5 @@ class HideEndscreenCardsResourcePatch : ResourcePatch {
|
||||
layoutCircle = findEndscreenResourceId("circle")
|
||||
layoutIcon = findEndscreenResourceId("icon")
|
||||
layoutVideo = findEndscreenResourceId("video")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
+1
-5
@@ -8,8 +8,6 @@ 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.layout.hide.filterbar.annotations.HideFilterBar
|
||||
@@ -31,7 +29,7 @@ class HideFilterBarPatch : BytecodePatch(
|
||||
FilterBarHeightFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
FilterBarHeightFingerprint.patch<TwoRegisterInstruction> { register ->
|
||||
"""
|
||||
invoke-static { v$register }, $INTEGRATIONS_CLASS_DESCRIPTOR->hideInFeed(I)I
|
||||
@@ -50,8 +48,6 @@ class HideFilterBarPatch : BytecodePatch(
|
||||
move-result v$register
|
||||
"""
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
||||
+1
-5
@@ -1,8 +1,6 @@
|
||||
package app.revanced.patches.youtube.layout.hide.filterbar.patch
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
@@ -13,7 +11,7 @@ import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
|
||||
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||
class HideFilterBarResourcePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
PreferenceScreen(
|
||||
"revanced_hide_filter_bar_preference",
|
||||
@@ -78,8 +76,6 @@ class HideFilterBarResourcePatch : ResourcePatch {
|
||||
relatedChipCloudMarginId = "related_chip_cloud_reduced_margins".layoutResourceId("layout")
|
||||
filterBarHeightId = "filter_bar_height".layoutResourceId()
|
||||
barContainerHeightId = "bar_container_height".layoutResourceId()
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
internal companion object {
|
||||
|
||||
+2
-6
@@ -7,8 +7,6 @@ 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.layout.hide.floatingmicrophone.annotations.HideFloatingMicrophoneButtonCompatibility
|
||||
@@ -23,7 +21,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
class HideFloatingMicrophoneButtonPatch : BytecodePatch(
|
||||
listOf(ShowFloatingMicrophoneButtonFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
ShowFloatingMicrophoneButtonFingerprint.result?.let { result ->
|
||||
with(result.mutableMethod) {
|
||||
val insertIndex = result.scanResult.patternScanResult!!.startIndex + 1
|
||||
@@ -37,9 +35,7 @@ class HideFloatingMicrophoneButtonPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return ShowFloatingMicrophoneButtonFingerprint.toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
} ?: throw ShowFloatingMicrophoneButtonFingerprint.toErrorResult()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
||||
+3
-6
@@ -1,9 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.hide.floatingmicrophone.patch
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
@@ -15,7 +13,7 @@ import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||
@HideFloatingMicrophoneButtonCompatibility
|
||||
class HideFloatingMicrophoneButtonResourcePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_hide_floating_microphone_button",
|
||||
@@ -29,8 +27,7 @@ class HideFloatingMicrophoneButtonResourcePatch : ResourcePatch {
|
||||
)
|
||||
|
||||
fabButtonId = ResourceMappingPatch.resourceMappings.find { it.type == "id" && it.name == "fab" }?.id
|
||||
?: return PatchResultError("Can not find required fab button resource id")
|
||||
return PatchResultSuccess()
|
||||
?: throw PatchException("Can not find required fab button resource id")
|
||||
}
|
||||
|
||||
internal companion object {
|
||||
|
||||
+2
-6
@@ -8,8 +8,6 @@ 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.smali.ExternalLabel
|
||||
@@ -30,7 +28,7 @@ import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch.P
|
||||
class HideLayoutComponentsPatch : BytecodePatch(
|
||||
listOf(ConvertElementToFlatBufferFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_hide_gray_separator",
|
||||
@@ -274,11 +272,9 @@ class HideLayoutComponentsPatch : BytecodePatch(
|
||||
addInstruction(0, "move-object/from16 v$freeRegister, p3")
|
||||
}
|
||||
|
||||
} ?: return ConvertElementToFlatBufferFingerprint.toErrorResult()
|
||||
} ?: throw ConvertElementToFlatBufferFingerprint.toErrorResult()
|
||||
|
||||
// endregion
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
internal companion object {
|
||||
|
||||
+1
-5
@@ -8,8 +8,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWith
|
||||
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
|
||||
@@ -34,7 +32,7 @@ class HideInfoCardsPatch : BytecodePatch(
|
||||
InfocardsMethodCallFingerprint,
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
InfocardsIncognitoFingerprint.also {
|
||||
it.resolve(context, InfocardsIncognitoParentFingerprint.result!!.classDef)
|
||||
}.result!!.mutableMethod.apply {
|
||||
@@ -68,7 +66,5 @@ class HideInfoCardsPatch : BytecodePatch(
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
+1
-5
@@ -1,8 +1,6 @@
|
||||
package app.revanced.patches.youtube.layout.hide.infocards.resource.patch
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
@@ -18,7 +16,7 @@ class HideInfocardsResourcePatch : ResourcePatch {
|
||||
var drawerResourceId: Long = -1
|
||||
}
|
||||
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_hide_info_cards",
|
||||
@@ -31,7 +29,5 @@ class HideInfocardsResourcePatch : ResourcePatch {
|
||||
drawerResourceId = ResourceMappingPatch.resourceMappings.single {
|
||||
it.type == "id" && it.name == "info_cards_drawer_header"
|
||||
}.id
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
+2
-6
@@ -7,8 +7,6 @@ import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.layout.hide.loadmorebutton.bytecode.fingerprints.HideLoadMoreButtonFingerprint
|
||||
@@ -22,7 +20,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@DependsOn([HideLoadMoreButtonResourcePatch::class])
|
||||
@HideLoadMoreButtonCompatibility
|
||||
class HideLoadMoreButtonPatch : BytecodePatch(listOf(HideLoadMoreButtonFingerprint)) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
HideLoadMoreButtonFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val moveRegisterIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
@@ -35,9 +33,7 @@ class HideLoadMoreButtonPatch : BytecodePatch(listOf(HideLoadMoreButtonFingerpri
|
||||
"$INTEGRATIONS_CLASS_DESCRIPTOR->hideLoadMoreButton(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
} ?: return HideLoadMoreButtonFingerprint.toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
} ?: throw HideLoadMoreButtonFingerprint.toErrorResult()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
||||
+1
-5
@@ -1,8 +1,6 @@
|
||||
package app.revanced.patches.youtube.layout.hide.loadmorebutton.resource.patch
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
@@ -12,7 +10,7 @@ import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
|
||||
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||
class HideLoadMoreButtonResourcePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_hide_load_more_button",
|
||||
@@ -25,8 +23,6 @@ class HideLoadMoreButtonResourcePatch : ResourcePatch {
|
||||
expandButtonDownId = ResourceMappingPatch.resourceMappings.single {
|
||||
it.type == "layout" && it.name == "expand_button_down"
|
||||
}.id
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
internal companion object {
|
||||
|
||||
+2
-6
@@ -7,8 +7,6 @@ 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.layout.hide.personalinformation.annotations.HideEmailAddressCompatibility
|
||||
@@ -27,7 +25,7 @@ class HideEmailAddressPatch : BytecodePatch(
|
||||
AccountSwitcherAccessibilityLabelFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
AccountSwitcherAccessibilityLabelFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val setVisibilityConstIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
@@ -43,8 +41,6 @@ class HideEmailAddressPatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return AccountSwitcherAccessibilityLabelFingerprint.toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
} ?: throw AccountSwitcherAccessibilityLabelFingerprint.toErrorResult()
|
||||
}
|
||||
}
|
||||
|
||||
+1
-5
@@ -1,8 +1,6 @@
|
||||
package app.revanced.patches.youtube.layout.hide.personalinformation.resource.patch
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
@@ -16,7 +14,7 @@ class HideEmailAddressResourcePatch : ResourcePatch {
|
||||
internal var accountSwitcherAccessibilityLabelId: Long = -1
|
||||
}
|
||||
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_hide_email_address",
|
||||
@@ -29,7 +27,5 @@ class HideEmailAddressResourcePatch : ResourcePatch {
|
||||
accountSwitcherAccessibilityLabelId = ResourceMappingPatch.resourceMappings.single {
|
||||
it.type == "string" && it.name == "account_switcher_accessibility_label"
|
||||
}.id
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
+1
-5
@@ -3,8 +3,6 @@ package app.revanced.patches.youtube.layout.hide.player.flyoutmenupanel.patch
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
@@ -21,7 +19,7 @@ import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
@DependsOn([LithoFilterPatch::class, SettingsPatch::class])
|
||||
@HidePlayerFlyoutMenuItemsCompatibility
|
||||
class HidePlayerFlyoutMenuPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
PreferenceScreen(
|
||||
KEY,
|
||||
@@ -93,8 +91,6 @@ class HidePlayerFlyoutMenuPatch : ResourcePatch {
|
||||
)
|
||||
|
||||
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
||||
+2
-6
@@ -8,8 +8,6 @@ import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.layout.hide.player.overlay.annotations.HidePlayerOverlayPatchCompatibility
|
||||
@@ -23,7 +21,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@DependsOn([HidePlayerOverlayResourcePatch::class])
|
||||
@HidePlayerOverlayPatchCompatibility
|
||||
class HidePlayerOverlayPatch : BytecodePatch(listOf(CreatePlayerOverviewFingerprint)) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
CreatePlayerOverviewFingerprint.result?.let { result ->
|
||||
result.mutableMethod.apply {
|
||||
val viewRegisterIndex =
|
||||
@@ -37,9 +35,7 @@ class HidePlayerOverlayPatch : BytecodePatch(listOf(CreatePlayerOverviewFingerpr
|
||||
"$INTEGRATIONS_CLASS_DESCRIPTOR->hidePlayerOverlay(Landroid/widget/ImageView;)V"
|
||||
)
|
||||
}
|
||||
} ?: return CreatePlayerOverviewFingerprint.toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
} ?: throw CreatePlayerOverviewFingerprint.toErrorResult()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
||||
+1
-5
@@ -1,8 +1,6 @@
|
||||
package app.revanced.patches.youtube.layout.hide.player.overlay.resource.patch
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
@@ -12,7 +10,7 @@ import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
|
||||
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||
class HidePlayerOverlayResourcePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_hide_player_overlay",
|
||||
@@ -25,8 +23,6 @@ class HidePlayerOverlayResourcePatch : ResourcePatch {
|
||||
scrimOverlayId = ResourceMappingPatch.resourceMappings.single {
|
||||
it.type == "id" && it.name == "scrim_overlay"
|
||||
}.id
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
internal companion object {
|
||||
|
||||
+1
-5
@@ -6,8 +6,6 @@ import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
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.shared.fingerprints.SeekbarFingerprint
|
||||
@@ -35,7 +33,7 @@ import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
class HideSeekbarPatch : BytecodePatch(
|
||||
listOf(SeekbarFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SeekbarPreferencesPatch.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_hide_seekbar",
|
||||
@@ -65,7 +63,5 @@ class HideSeekbarPatch : BytecodePatch(
|
||||
nop
|
||||
"""
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
||||
+6
-10
@@ -10,8 +10,6 @@ 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.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
@@ -46,7 +44,7 @@ class HideShortsComponentsPatch : BytecodePatch(
|
||||
SetPivotBarVisibilityParentFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
|
||||
// region Hide the Shorts shelf.
|
||||
@@ -63,7 +61,7 @@ class HideShortsComponentsPatch : BytecodePatch(
|
||||
"hideShortsShelf"
|
||||
)
|
||||
}
|
||||
} ?: return ReelConstructorFingerprint.toErrorResult()
|
||||
} ?: throw ReelConstructorFingerprint.toErrorResult()
|
||||
|
||||
// endregion
|
||||
|
||||
@@ -72,7 +70,7 @@ class HideShortsComponentsPatch : BytecodePatch(
|
||||
// Some Shorts buttons are views, hide them by setting their visibility to GONE.
|
||||
CreateShortsButtonsFingerprint.result?.let {
|
||||
ShortsButtons.values().forEach { button -> button.injectHideCall(it.mutableMethod) }
|
||||
} ?: return CreateShortsButtonsFingerprint.toErrorResult()
|
||||
} ?: throw CreateShortsButtonsFingerprint.toErrorResult()
|
||||
|
||||
// endregion
|
||||
|
||||
@@ -94,7 +92,7 @@ class HideShortsComponentsPatch : BytecodePatch(
|
||||
)
|
||||
}
|
||||
}
|
||||
} ?: return SetPivotBarVisibilityParentFingerprint.toErrorResult()
|
||||
} ?: throw SetPivotBarVisibilityParentFingerprint.toErrorResult()
|
||||
|
||||
// Hook to hide the navigation bar when Shorts are being played.
|
||||
RenderBottomNavigationBarParentFingerprint.result?.let {
|
||||
@@ -104,7 +102,7 @@ class HideShortsComponentsPatch : BytecodePatch(
|
||||
RenderBottomNavigationBarFingerprint.result!!.mutableMethod.apply {
|
||||
addInstruction(0, "invoke-static { }, $FILTER_CLASS_DESCRIPTOR->hideNavigationBar()V")
|
||||
}
|
||||
} ?: return RenderBottomNavigationBarParentFingerprint.toErrorResult()
|
||||
} ?: throw RenderBottomNavigationBarParentFingerprint.toErrorResult()
|
||||
|
||||
// Required to prevent a black bar from appearing at the bottom of the screen.
|
||||
BottomNavigationBarFingerprint.result?.let {
|
||||
@@ -119,11 +117,9 @@ class HideShortsComponentsPatch : BytecodePatch(
|
||||
"hideNavigationBar(Landroid/view/View;)Landroid/view/View;"
|
||||
)
|
||||
}
|
||||
} ?: return BottomNavigationBarFingerprint.toErrorResult()
|
||||
} ?: throw BottomNavigationBarFingerprint.toErrorResult()
|
||||
|
||||
// endregion
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
||||
+1
-5
@@ -1,8 +1,6 @@
|
||||
package app.revanced.patches.youtube.layout.hide.shorts.resource.patch
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
@@ -13,7 +11,7 @@ import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
|
||||
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||
class HideShortsComponentsResourcePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
PreferenceScreen(
|
||||
"revanced_shorts_preference_screen",
|
||||
@@ -94,8 +92,6 @@ class HideShortsComponentsResourcePatch : ResourcePatch {
|
||||
|
||||
reelMultipleItemShelfId = "reel_multiple_items_shelf".getId()
|
||||
reelPlayerRightLargeIconSize = "reel_player_right_large_icon_size".getId()
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
+2
-6
@@ -6,8 +6,6 @@ import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
@@ -27,7 +25,7 @@ class HideTimestampPatch : BytecodePatch(
|
||||
TimeCounterFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_hide_timestamp",
|
||||
@@ -49,8 +47,6 @@ class HideTimestampPatch : BytecodePatch(
|
||||
nop
|
||||
"""
|
||||
)
|
||||
} ?: return TimeCounterFingerprint.toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
} ?: throw TimeCounterFingerprint.toErrorResult()
|
||||
}
|
||||
}
|
||||
|
||||
+3
-7
@@ -7,9 +7,7 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
@@ -30,7 +28,7 @@ class HideWatermarkPatch : BytecodePatch(
|
||||
HideWatermarkParentFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_hide_video_watermark",
|
||||
@@ -42,7 +40,7 @@ class HideWatermarkPatch : BytecodePatch(
|
||||
|
||||
HideWatermarkFingerprint.resolve(context, HideWatermarkParentFingerprint.result!!.classDef)
|
||||
val result = HideWatermarkFingerprint.result
|
||||
?: return PatchResultError("Required parent method could not be found.")
|
||||
?: throw PatchException("Required parent method could not be found.")
|
||||
|
||||
val method = result.mutableMethod
|
||||
val line = method.implementation!!.instructions.size - 5
|
||||
@@ -55,7 +53,5 @@ class HideWatermarkPatch : BytecodePatch(
|
||||
move-result p2
|
||||
"""
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
||||
+2
-6
@@ -6,8 +6,6 @@ import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
@@ -27,7 +25,7 @@ class PlayerPopupPanelsPatch : BytecodePatch(
|
||||
EngagementPanelControllerFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_hide_player_popup_panels",
|
||||
@@ -38,7 +36,7 @@ class PlayerPopupPanelsPatch : BytecodePatch(
|
||||
)
|
||||
|
||||
val engagementPanelControllerMethod = EngagementPanelControllerFingerprint
|
||||
.result?.mutableMethod ?: return EngagementPanelControllerFingerprint.toErrorResult()
|
||||
.result?.mutableMethod ?: throw EngagementPanelControllerFingerprint.toErrorResult()
|
||||
|
||||
engagementPanelControllerMethod.addInstructionsWithLabels(
|
||||
0,
|
||||
@@ -53,7 +51,5 @@ class PlayerPopupPanelsPatch : BytecodePatch(
|
||||
nop
|
||||
"""
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
||||
+1
-5
@@ -4,8 +4,6 @@ import app.revanced.extensions.doRecursively
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.layout.player.background.annotations.PlayerControlsBackgroundCompatibility
|
||||
@@ -16,7 +14,7 @@ import org.w3c.dom.Element
|
||||
@Description("Removes the background from the video player controls.")
|
||||
@PlayerControlsBackgroundCompatibility
|
||||
class PlayerControlsBackgroundPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
context.xmlEditor[RESOURCE_FILE_PATH].use { editor ->
|
||||
editor.file.doRecursively node@{ node ->
|
||||
if (node !is Element) return@node
|
||||
@@ -26,8 +24,6 @@ class PlayerControlsBackgroundPatch : ResourcePatch {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
||||
+6
-10
@@ -13,9 +13,7 @@ import app.revanced.patcher.extensions.MethodFingerprintExtensions.name
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.layout.returnyoutubedislike.annotations.ReturnYouTubeDislikeCompatibility
|
||||
@@ -51,7 +49,7 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
|
||||
RemoveLikeFingerprint,
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// region Inject newVideoLoaded event handler to update dislikes when a new video is loaded.
|
||||
|
||||
VideoIdPatch.injectCall("$INTEGRATIONS_CLASS_DESCRIPTOR->newVideoLoaded(Ljava/lang/String;)V")
|
||||
@@ -73,7 +71,7 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
|
||||
invoke-static {v0}, $INTEGRATIONS_CLASS_DESCRIPTOR->sendVote(I)V
|
||||
"""
|
||||
)
|
||||
} ?: return PatchResultError("Failed to find ${fingerprint.name} method.")
|
||||
} ?: throw PatchException("Failed to find ${fingerprint.name} method.")
|
||||
}
|
||||
|
||||
// endregion
|
||||
@@ -128,7 +126,7 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return TextComponentContextFingerprint.toErrorResult()
|
||||
} ?: throw TextComponentContextFingerprint.toErrorResult()
|
||||
|
||||
// endregion
|
||||
|
||||
@@ -168,7 +166,7 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return ShortsTextViewFingerprint.toErrorResult()
|
||||
} ?: throw ShortsTextViewFingerprint.toErrorResult()
|
||||
|
||||
// endregion
|
||||
|
||||
@@ -186,11 +184,9 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
|
||||
"invoke-static {v$resourceIdentifierRegister, v$textViewRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->setOldUILayoutDislikes(ILandroid/widget/TextView;)V"
|
||||
)
|
||||
}
|
||||
} ?: return DislikesOldLayoutTextViewFingerprint.toErrorResult()
|
||||
} ?: throw DislikesOldLayoutTextViewFingerprint.toErrorResult()
|
||||
|
||||
// endregion
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
||||
+1
-5
@@ -1,8 +1,6 @@
|
||||
package app.revanced.patches.youtube.layout.returnyoutubedislike.resource.patch
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
@@ -17,7 +15,7 @@ class ReturnYouTubeDislikeResourcePatch : ResourcePatch {
|
||||
internal var oldUIDislikeId: Long = -1
|
||||
}
|
||||
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.addPreference(
|
||||
Preference(
|
||||
StringResource("revanced_ryd_settings_title", "Return YouTube Dislike"),
|
||||
@@ -31,7 +29,5 @@ class ReturnYouTubeDislikeResourcePatch : ResourcePatch {
|
||||
oldUIDislikeId = ResourceMappingPatch.resourceMappings.single {
|
||||
it.type == "id" && it.name == "dislike_button"
|
||||
}.id
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
+2
-7
@@ -4,12 +4,9 @@ import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.data.toMethodWalker
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.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
|
||||
@@ -31,7 +28,7 @@ class WideSearchbarPatch : BytecodePatch(
|
||||
SetWordmarkHeaderFingerprint, CreateSearchSuggestionsFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_wide_searchbar",
|
||||
@@ -41,7 +38,7 @@ class WideSearchbarPatch : BytecodePatch(
|
||||
)
|
||||
)
|
||||
|
||||
val result = CreateSearchSuggestionsFingerprint.result ?: return CreateSearchSuggestionsFingerprint.toErrorResult()
|
||||
val result = CreateSearchSuggestionsFingerprint.result ?: throw CreateSearchSuggestionsFingerprint.toErrorResult()
|
||||
|
||||
// patch methods
|
||||
mapOf(
|
||||
@@ -50,8 +47,6 @@ class WideSearchbarPatch : BytecodePatch(
|
||||
).forEach { (fingerprint, callIndex) ->
|
||||
context.walkMutable(callIndex, fingerprint).injectSearchBarHook()
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
||||
+4
-9
@@ -4,12 +4,9 @@ import app.revanced.extensions.indexOfFirstConstantInstructionValue
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
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.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.youtube.layout.seekbar.annotations.SeekbarColorCompatibility
|
||||
@@ -29,7 +26,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
class SeekbarColorBytecodePatch : BytecodePatch(
|
||||
listOf(PlayerSeekbarColorFingerprint, ShortsSeekbarColorFingerprint, SetSeekbarClickedColorFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
fun MutableMethod.addColorChangeInstructions(resourceId: Long) {
|
||||
var registerIndex = indexOfFirstConstantInstructionValue(resourceId) + 2
|
||||
var colorRegister = getInstruction<OneRegisterInstruction>(registerIndex).registerA
|
||||
@@ -45,11 +42,11 @@ class SeekbarColorBytecodePatch : BytecodePatch(
|
||||
PlayerSeekbarColorFingerprint.result?.mutableMethod?.apply {
|
||||
addColorChangeInstructions(SeekbarColorResourcePatch.inlineTimeBarColorizedBarPlayedColorDarkId)
|
||||
addColorChangeInstructions(SeekbarColorResourcePatch.inlineTimeBarPlayedNotHighlightedColorId)
|
||||
} ?: return PlayerSeekbarColorFingerprint.toErrorResult()
|
||||
} ?: throw PlayerSeekbarColorFingerprint.toErrorResult()
|
||||
|
||||
ShortsSeekbarColorFingerprint.result?.mutableMethod?.apply {
|
||||
addColorChangeInstructions(SeekbarColorResourcePatch.reelTimeBarPlayedColorId)
|
||||
} ?: return ShortsSeekbarColorFingerprint.toErrorResult()
|
||||
} ?: throw ShortsSeekbarColorFingerprint.toErrorResult()
|
||||
|
||||
SetSeekbarClickedColorFingerprint.result?.let { result ->
|
||||
result.mutableMethod.let {
|
||||
@@ -70,11 +67,9 @@ class SeekbarColorBytecodePatch : BytecodePatch(
|
||||
)
|
||||
}
|
||||
}
|
||||
} ?: return SetSeekbarClickedColorFingerprint.toErrorResult()
|
||||
} ?: throw SetSeekbarClickedColorFingerprint.toErrorResult()
|
||||
|
||||
lithoColorOverrideHook(INTEGRATIONS_CLASS_DESCRIPTOR, "getLithoColor")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
||||
+5
-6
@@ -1,7 +1,8 @@
|
||||
package app.revanced.patches.youtube.layout.seekbar.resource
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.*
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
@@ -10,11 +11,11 @@ import org.w3c.dom.Element
|
||||
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||
class SeekbarColorResourcePatch : ResourcePatch {
|
||||
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
fun findColorResource(resourceName: String): Long {
|
||||
return ResourceMappingPatch.resourceMappings
|
||||
.find { it.type == "color" && it.name == resourceName }?.id
|
||||
?: throw PatchResultError("Could not find color resource: $resourceName")
|
||||
?: throw PatchException("Could not find color resource: $resourceName")
|
||||
}
|
||||
|
||||
reelTimeBarPlayedColorId =
|
||||
@@ -29,7 +30,7 @@ class SeekbarColorResourcePatch : ResourcePatch {
|
||||
val layerList = editor.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
|
||||
@@ -37,8 +38,6 @@ class SeekbarColorResourcePatch : ResourcePatch {
|
||||
"app.revanced.integrations.patches.theme.ProgressBarDrawable")
|
||||
scaleNode.replaceChild(replacementNode, shapeNode)
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
+1
-3
@@ -12,11 +12,9 @@ import java.io.Closeable
|
||||
|
||||
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||
class SeekbarPreferencesPatch : ResourcePatch, Closeable {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
// Nothing to do here. All work is done in close method.
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
override fun close() {
|
||||
|
||||
+7
-12
@@ -4,16 +4,13 @@ import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.data.toMethodWalker
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.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
|
||||
@@ -64,11 +61,11 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
||||
AutoRepeatParentFingerprint,
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
LayoutConstructorFingerprint.result?.let {
|
||||
if (!ControlsOverlayFingerprint.resolve(context, it.classDef))
|
||||
throw ControlsOverlayFingerprint.toErrorResult()
|
||||
} ?: return LayoutConstructorFingerprint.toErrorResult()
|
||||
} ?: throw LayoutConstructorFingerprint.toErrorResult()
|
||||
|
||||
/*
|
||||
* Hook the video time methods
|
||||
@@ -222,7 +219,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
||||
"invoke-static {v$frameLayoutRegister}, $INTEGRATIONS_SPONSORBLOCK_VIEW_CONTROLLER_CLASS_DESCRIPTOR->initialize(Landroid/view/ViewGroup;)V"
|
||||
)
|
||||
}
|
||||
} ?: return ControlsOverlayFingerprint.toErrorResult()
|
||||
} ?: throw ControlsOverlayFingerprint.toErrorResult()
|
||||
|
||||
// get rectangle field name
|
||||
RectangleFieldInvalidatorFingerprint.resolve(context, seekbarSignatureResult.classDef)
|
||||
@@ -255,23 +252,21 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
||||
)
|
||||
}
|
||||
}
|
||||
} ?: return PatchResultError("Could not find the method which contains the replaceMeWith* strings")
|
||||
} ?: throw PatchException("Could not find the method which contains the replaceMeWith* strings")
|
||||
|
||||
|
||||
// The vote and create segment buttons automatically change their visibility when appropriate,
|
||||
// but if buttons are showing when the end of the video is reached then they will not automatically hide.
|
||||
// Add a hook to forcefully hide when the end of the video is reached.
|
||||
AutoRepeatParentFingerprint.result ?: return AutoRepeatParentFingerprint.toErrorResult()
|
||||
AutoRepeatParentFingerprint.result ?: throw AutoRepeatParentFingerprint.toErrorResult()
|
||||
AutoRepeatFingerprint.also {
|
||||
it.resolve(context, AutoRepeatParentFingerprint.result!!.classDef)
|
||||
}.result?.mutableMethod?.addInstruction(
|
||||
0,
|
||||
"invoke-static {}, $INTEGRATIONS_SPONSORBLOCK_VIEW_CONTROLLER_CLASS_DESCRIPTOR->endOfVideoReached()V"
|
||||
) ?: return AutoRepeatFingerprint.toErrorResult()
|
||||
) ?: throw AutoRepeatFingerprint.toErrorResult()
|
||||
|
||||
// TODO: isSBChannelWhitelisting implementation
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
||||
+1
-5
@@ -1,8 +1,6 @@
|
||||
package app.revanced.patches.youtube.layout.sponsorblock.resource.patch
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
@@ -17,7 +15,7 @@ import app.revanced.util.resources.ResourceUtils.mergeStrings
|
||||
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||
class SponsorBlockResourcePatch : ResourcePatch {
|
||||
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.addPreference(
|
||||
Preference(
|
||||
StringResource("revanced_sponsorblock_settings_title", "SponsorBlock"),
|
||||
@@ -91,7 +89,5 @@ class SponsorBlockResourcePatch : ResourcePatch {
|
||||
break
|
||||
}
|
||||
}.close() // close afterwards
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
+2
-6
@@ -6,8 +6,6 @@ import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.settings.preference.impl.ArrayResource
|
||||
@@ -30,7 +28,7 @@ class SpoofAppVersionPatch : BytecodePatch(
|
||||
SpoofAppVersionFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_spoof_app_version",
|
||||
@@ -79,9 +77,7 @@ class SpoofAppVersionPatch : BytecodePatch(
|
||||
move-result-object v$buildOverrideNameRegister
|
||||
"""
|
||||
)
|
||||
} ?: return SpoofAppVersionFingerprint.toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
} ?: throw SpoofAppVersionFingerprint.toErrorResult()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
||||
+1
-5
@@ -5,8 +5,6 @@ import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
@@ -26,7 +24,7 @@ class DisableShortsOnStartupPatch : BytecodePatch(
|
||||
UserWasInShortsFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_disable_resuming_shorts_player",
|
||||
@@ -51,7 +49,5 @@ class DisableShortsOnStartupPatch : BytecodePatch(
|
||||
nop
|
||||
"""
|
||||
)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
|
||||
+5
-10
@@ -4,14 +4,11 @@ import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.data.toMethodWalker
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.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
|
||||
@@ -39,7 +36,7 @@ class TabletMiniPlayerPatch : BytecodePatch(
|
||||
MiniPlayerOverrideFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_tablet_miniplayer",
|
||||
@@ -50,7 +47,7 @@ class TabletMiniPlayerPatch : BytecodePatch(
|
||||
)
|
||||
|
||||
// First resolve the fingerprints via the parent fingerprint.
|
||||
MiniPlayerDimensionsCalculatorParentFingerprint.result ?: return MiniPlayerDimensionsCalculatorParentFingerprint.toErrorResult()
|
||||
MiniPlayerDimensionsCalculatorParentFingerprint.result ?: throw MiniPlayerDimensionsCalculatorParentFingerprint.toErrorResult()
|
||||
val miniPlayerClass = MiniPlayerDimensionsCalculatorParentFingerprint.result!!.classDef
|
||||
|
||||
/*
|
||||
@@ -81,7 +78,7 @@ class TabletMiniPlayerPatch : BytecodePatch(
|
||||
.filter { (_, instruction) -> instruction.opcode == Opcode.RETURN }
|
||||
.map { (index, _) -> index }
|
||||
|
||||
if (returnIndices.isEmpty()) throw PatchResultError("No return instructions found.")
|
||||
if (returnIndices.isEmpty()) throw PatchException("No return instructions found.")
|
||||
|
||||
// This method clobbers register p0 to return the value, calculate to override.
|
||||
val returnedRegister = implementation.registerCount - parameters.size
|
||||
@@ -92,14 +89,12 @@ class TabletMiniPlayerPatch : BytecodePatch(
|
||||
}
|
||||
|
||||
return@let
|
||||
} ?: return MiniPlayerOverrideFingerprint.toErrorResult()
|
||||
} ?: throw MiniPlayerOverrideFingerprint.toErrorResult()
|
||||
|
||||
/*
|
||||
* Size check return value override.
|
||||
*/
|
||||
MiniPlayerResponseModelSizeCheckFingerprint.addProxyCall()
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
// Helper methods.
|
||||
|
||||
+2
-6
@@ -6,8 +6,6 @@ import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility
|
||||
import app.revanced.patches.youtube.layout.theme.bytecode.fingerprints.LithoThemeFingerprint
|
||||
@@ -16,14 +14,12 @@ import app.revanced.patches.youtube.layout.theme.bytecode.fingerprints.LithoThem
|
||||
@Description("Adds a hook to set color of Litho components.")
|
||||
@ThemeCompatibility
|
||||
class LithoColorHookPatch : BytecodePatch(listOf(LithoThemeFingerprint)) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
LithoThemeFingerprint.result?.let {
|
||||
insertionIndex = it.scanResult.patternScanResult!!.endIndex - 1
|
||||
colorRegister = "p1"
|
||||
insertionMethod = it.mutableMethod
|
||||
} ?: return LithoThemeFingerprint.toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
} ?: throw LithoThemeFingerprint.toErrorResult()
|
||||
}
|
||||
companion object {
|
||||
private var insertionIndex : Int = -1
|
||||
|
||||
+1
-3
@@ -17,10 +17,8 @@ import app.revanced.patches.youtube.layout.theme.resource.ThemeResourcePatch
|
||||
@ThemeCompatibility
|
||||
class ThemeBytecodePatch : BytecodePatch() {
|
||||
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
LithoColorHookPatch.lithoColorOverrideHook(INTEGRATIONS_CLASS_DESCRIPTOR, "getValue")
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
companion object : OptionsContainer() {
|
||||
|
||||
+3
-7
@@ -1,9 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.theme.resource
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultError
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
@@ -19,7 +17,7 @@ import org.w3c.dom.Element
|
||||
|
||||
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class, SeekbarPreferencesPatch::class])
|
||||
class ThemeResourcePatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SeekbarPreferencesPatch.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_seekbar_custom_color",
|
||||
@@ -85,13 +83,11 @@ class ThemeResourcePatch : ResourcePatch {
|
||||
return@editSplashScreen
|
||||
}
|
||||
}
|
||||
return PatchResultError("Failed to modify launch screen")
|
||||
throw PatchException("Failed to modify launch screen")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private fun addColorResource(
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.alternativethumbnails.annotations
|
||||
package app.revanced.patches.youtube.layout.thumbnails.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.alternativethumbnails.bytecode.fingerprints
|
||||
package app.revanced.patches.youtube.layout.thumbnails.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.alternativethumbnails.bytecode.fingerprints
|
||||
package app.revanced.patches.youtube.layout.thumbnails.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.alternativethumbnails.bytecode.fingerprints
|
||||
package app.revanced.patches.youtube.layout.thumbnails.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.alternativethumbnails.bytecode.fingerprints
|
||||
package app.revanced.patches.youtube.layout.thumbnails.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.alternativethumbnails.bytecode.fingerprints
|
||||
package app.revanced.patches.youtube.layout.thumbnails.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
+11
-25
@@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.layout.alternativethumbnails.bytecode.patch
|
||||
package app.revanced.patches.youtube.layout.thumbnails.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@@ -8,23 +8,12 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.shared.settings.preference.impl.ArrayResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.ListPreference
|
||||
import app.revanced.patches.shared.settings.preference.impl.NonInteractivePreference
|
||||
import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.youtube.layout.alternativethumbnails.annotations.AlternativeThumbnailsCompatibility
|
||||
import app.revanced.patches.youtube.layout.alternativethumbnails.bytecode.fingerprints.CronetURLRequestCallbackOnFailureFingerprint
|
||||
import app.revanced.patches.youtube.layout.alternativethumbnails.bytecode.fingerprints.CronetURLRequestCallbackOnResponseStartedFingerprint
|
||||
import app.revanced.patches.youtube.layout.alternativethumbnails.bytecode.fingerprints.CronetURLRequestCallbackOnSucceededFingerprint
|
||||
import app.revanced.patches.youtube.layout.alternativethumbnails.bytecode.fingerprints.MessageDigestImageUrlFingerprint
|
||||
import app.revanced.patches.youtube.layout.alternativethumbnails.bytecode.fingerprints.MessageDigestImageUrlParentFingerprint
|
||||
import app.revanced.patches.shared.settings.preference.impl.*
|
||||
import app.revanced.patches.youtube.layout.thumbnails.annotations.AlternativeThumbnailsCompatibility
|
||||
import app.revanced.patches.youtube.layout.thumbnails.fingerprints.*
|
||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
|
||||
@@ -32,11 +21,11 @@ import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||
@Name("Alternative thumbnails")
|
||||
@AlternativeThumbnailsCompatibility
|
||||
@Description("Adds an option to replace video thumbnails with still image captures of the video.")
|
||||
@Description("Adds options to replace video thumbnails with still image captures of the video.")
|
||||
class AlternativeThumbnailsPatch : BytecodePatch(
|
||||
listOf(MessageDigestImageUrlParentFingerprint, CronetURLRequestCallbackOnResponseStartedFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
PreferenceScreen(
|
||||
"revanced_alt_thumbnails_preference_screen",
|
||||
@@ -84,23 +73,23 @@ class AlternativeThumbnailsPatch : BytecodePatch(
|
||||
)
|
||||
|
||||
MessageDigestImageUrlParentFingerprint.result
|
||||
?: return MessageDigestImageUrlParentFingerprint.toErrorResult()
|
||||
?: throw MessageDigestImageUrlParentFingerprint.toErrorResult()
|
||||
MessageDigestImageUrlFingerprint.resolve(context, MessageDigestImageUrlParentFingerprint.result!!.classDef)
|
||||
MessageDigestImageUrlFingerprint.result?.apply {
|
||||
loadImageUrlMethod = mutableMethod
|
||||
} ?: return MessageDigestImageUrlFingerprint.toErrorResult()
|
||||
} ?: throw MessageDigestImageUrlFingerprint.toErrorResult()
|
||||
addImageUrlHook(INTEGRATIONS_CLASS_DESCRIPTOR, true)
|
||||
|
||||
|
||||
CronetURLRequestCallbackOnResponseStartedFingerprint.result
|
||||
?: return CronetURLRequestCallbackOnResponseStartedFingerprint.toErrorResult()
|
||||
?: throw CronetURLRequestCallbackOnResponseStartedFingerprint.toErrorResult()
|
||||
CronetURLRequestCallbackOnSucceededFingerprint.resolve(
|
||||
context,
|
||||
CronetURLRequestCallbackOnResponseStartedFingerprint.result!!.classDef
|
||||
)
|
||||
CronetURLRequestCallbackOnSucceededFingerprint.result?.apply {
|
||||
loadImageSuccessCallbackMethod = mutableMethod
|
||||
} ?: return CronetURLRequestCallbackOnSucceededFingerprint.toErrorResult()
|
||||
} ?: throw CronetURLRequestCallbackOnSucceededFingerprint.toErrorResult()
|
||||
addImageUrlSuccessCallbackHook(INTEGRATIONS_CLASS_DESCRIPTOR)
|
||||
|
||||
|
||||
@@ -110,10 +99,7 @@ class AlternativeThumbnailsPatch : BytecodePatch(
|
||||
)
|
||||
CronetURLRequestCallbackOnFailureFingerprint.result?.apply {
|
||||
loadImageErrorCallbackMethod = mutableMethod
|
||||
} ?: return CronetURLRequestCallbackOnFailureFingerprint.toErrorResult()
|
||||
|
||||
|
||||
return PatchResultSuccess()
|
||||
} ?: throw CronetURLRequestCallbackOnFailureFingerprint.toErrorResult()
|
||||
}
|
||||
|
||||
internal companion object {
|
||||
Reference in New Issue
Block a user