chore(YouTube/PlayerType): supplement PlayerType limits under certain conditions

This commit is contained in:
inotia00 2024-10-18 21:46:14 +09:00
parent de5ddb903e
commit 3de0e75f3e

View File

@ -7,6 +7,8 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchException import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.shared.litho.LithoFilterPatch
import app.revanced.patches.youtube.utils.integrations.Constants.COMPONENTS_PATH
import app.revanced.patches.youtube.utils.integrations.Constants.SHARED_PATH import app.revanced.patches.youtube.utils.integrations.Constants.SHARED_PATH
import app.revanced.patches.youtube.utils.integrations.Constants.UTILS_PATH import app.revanced.patches.youtube.utils.integrations.Constants.UTILS_PATH
import app.revanced.patches.youtube.utils.playertype.fingerprint.ActionBarSearchResultsFingerprint import app.revanced.patches.youtube.utils.playertype.fingerprint.ActionBarSearchResultsFingerprint
@ -29,7 +31,12 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
import com.android.tools.smali.dexlib2.iface.reference.FieldReference import com.android.tools.smali.dexlib2.iface.reference.FieldReference
@Patch(dependencies = [SharedResourceIdPatch::class]) @Patch(
dependencies = [
SharedResourceIdPatch::class,
LithoFilterPatch::class
]
)
object PlayerTypeHookPatch : BytecodePatch( object PlayerTypeHookPatch : BytecodePatch(
setOf( setOf(
ActionBarSearchResultsFingerprint, ActionBarSearchResultsFingerprint,
@ -45,6 +52,9 @@ object PlayerTypeHookPatch : BytecodePatch(
private const val INTEGRATIONS_ROOT_VIEW_HOOK_CLASS_DESCRIPTOR = private const val INTEGRATIONS_ROOT_VIEW_HOOK_CLASS_DESCRIPTOR =
"$SHARED_PATH/RootView;" "$SHARED_PATH/RootView;"
private const val FILTER_CLASS_DESCRIPTOR =
"$COMPONENTS_PATH/RelatedVideoFilter;"
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
// region patch for set player type // region patch for set player type
@ -153,5 +163,7 @@ object PlayerTypeHookPatch : BytecodePatch(
// endregion // endregion
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
} }
} }