feat: Use an extension property to create new exception when failing to resolve a fingerprint
This commit adds the extension property to the public API
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
||||
package app.revanced.patches.youtube.video.information.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.data.BytecodeContext
|
||||
@@ -133,7 +133,7 @@ class VideoInformationPatch : BytecodePatch(
|
||||
getReference(speedSelectionMethodInstructions, 1, Opcode.IGET)
|
||||
setPlaybackSpeedMethodReference =
|
||||
getReference(speedSelectionMethodInstructions, 2, Opcode.IGET)
|
||||
} ?: throw OnPlaybackSpeedItemClickFingerprint.toErrorResult()
|
||||
} ?: throw OnPlaybackSpeedItemClickFingerprint.exception
|
||||
|
||||
userSelectedPlaybackSpeedHook(INTEGRATIONS_CLASS_DESCRIPTOR, "userSelectedPlaybackSpeed")
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
package app.revanced.patches.youtube.video.quality.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.data.BytecodeContext
|
||||
@@ -158,7 +158,7 @@ class RememberVideoQualityPatch : BytecodePatch(
|
||||
move-result p2
|
||||
""",
|
||||
)
|
||||
} ?: throw VideoQualitySetterFingerprint.toErrorResult()
|
||||
} ?: throw VideoQualitySetterFingerprint.exception
|
||||
|
||||
|
||||
// Inject a call to remember the selected quality.
|
||||
@@ -173,7 +173,7 @@ class RememberVideoQualityPatch : BytecodePatch(
|
||||
"invoke-static {p$listItemIndexParameter}, $INTEGRATIONS_CLASS_DESCRIPTOR->userChangedQuality(I)V"
|
||||
)
|
||||
} ?: throw PatchException("Failed to find onItemClick method")
|
||||
} ?: throw VideoQualityItemOnClickParentFingerprint.toErrorResult()
|
||||
} ?: throw VideoQualityItemOnClickParentFingerprint.exception
|
||||
|
||||
|
||||
// Remember video quality if not using old layout menu.
|
||||
@@ -187,7 +187,7 @@ class RememberVideoQualityPatch : BytecodePatch(
|
||||
"invoke-static {v$qualityRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->userChangedQualityInNewFlyout(I)V"
|
||||
)
|
||||
}
|
||||
} ?: throw NewVideoQualityChangedFingerprint.toErrorResult()
|
||||
} ?: throw NewVideoQualityChangedFingerprint.exception
|
||||
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
package app.revanced.patches.youtube.video.speed.custom.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.data.BytecodeContext
|
||||
@@ -156,7 +156,7 @@ class CustomPlaybackSpeedPatch : BytecodePatch(
|
||||
// This is later called on the field INSTANCE.
|
||||
val showOldPlaybackSpeedMenuMethod = ShowOldPlaybackSpeedMenuFingerprint.also {
|
||||
if (!it.resolve(context, result.classDef))
|
||||
throw ShowOldPlaybackSpeedMenuFingerprint.toErrorResult()
|
||||
throw ShowOldPlaybackSpeedMenuFingerprint.exception
|
||||
}.result!!.method.toString()
|
||||
|
||||
// Insert the call to the "showOldPlaybackSpeedMenu" method on the field INSTANCE.
|
||||
@@ -171,8 +171,8 @@ class CustomPlaybackSpeedPatch : BytecodePatch(
|
||||
invoke-virtual { v0 }, $showOldPlaybackSpeedMenuMethod
|
||||
"""
|
||||
)
|
||||
} ?: throw ShowOldPlaybackSpeedMenuIntegrationsFingerprint.toErrorResult()
|
||||
} ?: throw GetOldPlaybackSpeedsFingerprint.toErrorResult()
|
||||
} ?: throw ShowOldPlaybackSpeedMenuIntegrationsFingerprint.exception
|
||||
} ?: throw GetOldPlaybackSpeedsFingerprint.exception
|
||||
|
||||
// endregion
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package app.revanced.patches.youtube.video.speed.remember.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.data.BytecodeContext
|
||||
@@ -103,7 +103,7 @@ class RememberPlaybackSpeedPatch : BytecodePatch(
|
||||
""".trimIndent(),
|
||||
ExternalLabel("do_not_override", mutableMethod.getInstruction(0))
|
||||
)
|
||||
} ?: throw InitializePlaybackSpeedValuesFingerprint.toErrorResult()
|
||||
} ?: throw InitializePlaybackSpeedValuesFingerprint.exception
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package app.revanced.patches.youtube.video.videoid.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.data.BytecodeContext
|
||||
@@ -38,7 +38,7 @@ class VideoIdPatch : BytecodePatch(
|
||||
consumer(it, insertIndex, videoIdRegister)
|
||||
|
||||
}
|
||||
} ?: throw VideoIdFingerprint.toErrorResult()
|
||||
} ?: throw VideoIdFingerprint.exception
|
||||
|
||||
VideoIdFingerprint.setFields { method, insertIndex, videoIdRegister ->
|
||||
insertMethod = method
|
||||
|
||||
Reference in New Issue
Block a user