mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-08 02:24:35 +02:00
rollback(YouTube/Player Type Hook): add view invalidate observer
- Since concurrency issue cannot be resolved, roll back to the previous commit.
This commit is contained in:
parent
8c6cabd583
commit
12e88259e2
@ -3,12 +3,10 @@ package app.revanced.patches.youtube.utils.fingerprints
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.youtube.player.components.PlayerComponentsPatch
|
||||
import app.revanced.patches.youtube.utils.playertype.PlayerTypeHookPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.FadeDurationFast
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.InsetOverlayViewLayout
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ScrimOverlay
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.SeekUndoEduOverlayStub
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.SizeAdjustableYouTubeControlsOverlay
|
||||
import app.revanced.patches.youtube.utils.sponsorblock.SponsorBlockBytecodePatch
|
||||
import app.revanced.util.containsWideLiteralInstructionIndex
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
@ -21,7 +19,6 @@ import com.android.tools.smali.dexlib2.Opcode
|
||||
*
|
||||
* The patches and resourceIds that use this fingerprint are as follows:
|
||||
* - [PlayerComponentsPatch] uses [FadeDurationFast], [ScrimOverlay] and [SeekUndoEduOverlayStub].
|
||||
* - [PlayerTypeHookPatch] uses [SizeAdjustableYouTubeControlsOverlay].
|
||||
* - [SponsorBlockBytecodePatch] uses [InsetOverlayViewLayout].
|
||||
*/
|
||||
internal object YouTubeControlsOverlayFingerprint : MethodFingerprint(
|
||||
@ -33,6 +30,5 @@ internal object YouTubeControlsOverlayFingerprint : MethodFingerprint(
|
||||
&& methodDef.containsWideLiteralInstructionIndex(InsetOverlayViewLayout)
|
||||
&& methodDef.containsWideLiteralInstructionIndex(ScrimOverlay)
|
||||
&& methodDef.containsWideLiteralInstructionIndex(SeekUndoEduOverlayStub)
|
||||
&& methodDef.containsWideLiteralInstructionIndex(SizeAdjustableYouTubeControlsOverlay)
|
||||
}
|
||||
)
|
@ -6,38 +6,23 @@ 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.annotation.Patch
|
||||
import app.revanced.patches.shared.litho.LithoFilterPatch
|
||||
import app.revanced.patches.youtube.utils.fingerprints.YouTubeControlsOverlayFingerprint
|
||||
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.UTILS_PATH
|
||||
import app.revanced.patches.youtube.utils.playertype.fingerprint.ActionBarSearchResultsFingerprint
|
||||
import app.revanced.patches.youtube.utils.playertype.fingerprint.PlayerTypeFingerprint
|
||||
import app.revanced.patches.youtube.utils.playertype.fingerprint.ReelWatchPagerFingerprint
|
||||
import app.revanced.patches.youtube.utils.playertype.fingerprint.VideoStateFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelWatchPlayer
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.SizeAdjustableYouTubeControlsOverlay
|
||||
import app.revanced.util.getTargetIndex
|
||||
import app.revanced.util.getTargetIndexWithMethodReferenceName
|
||||
import app.revanced.util.getWideLiteralInstructionIndex
|
||||
import app.revanced.util.resultOrThrow
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
|
||||
@Patch(
|
||||
dependencies = [
|
||||
LithoFilterPatch::class,
|
||||
SharedResourceIdPatch::class
|
||||
]
|
||||
)
|
||||
@Patch(dependencies = [SharedResourceIdPatch::class])
|
||||
object PlayerTypeHookPatch : BytecodePatch(
|
||||
setOf(
|
||||
ActionBarSearchResultsFingerprint,
|
||||
PlayerTypeFingerprint,
|
||||
ReelWatchPagerFingerprint,
|
||||
YouTubeControlsOverlayFingerprint
|
||||
)
|
||||
) {
|
||||
@ -47,9 +32,6 @@ object PlayerTypeHookPatch : BytecodePatch(
|
||||
private const val INTEGRATIONS_ROOT_VIEW_HOOK_CLASS_DESCRIPTOR =
|
||||
"$SHARED_PATH/RootView;"
|
||||
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"$COMPONENTS_PATH/InvalidateStateFilter;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
PlayerTypeFingerprint.resultOrThrow().let {
|
||||
@ -78,32 +60,6 @@ object PlayerTypeHookPatch : BytecodePatch(
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
parentResult.mutableMethod.apply {
|
||||
val constIndex = getWideLiteralInstructionIndex(SizeAdjustableYouTubeControlsOverlay)
|
||||
val targetIndex = getTargetIndex(constIndex, Opcode.MOVE_RESULT_OBJECT)
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
targetIndex + 1,
|
||||
"invoke-static {v$targetRegister}, " +
|
||||
"$INTEGRATIONS_ROOT_VIEW_HOOK_CLASS_DESCRIPTOR->onPlayerCreate(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
ReelWatchPagerFingerprint.resultOrThrow().let {
|
||||
it.mutableMethod.apply {
|
||||
val constIndex = getWideLiteralInstructionIndex(ReelWatchPlayer)
|
||||
val targetIndex = getTargetIndex(constIndex, Opcode.MOVE_RESULT_OBJECT)
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
targetIndex + 1,
|
||||
"invoke-static {v$targetRegister}, " +
|
||||
"$INTEGRATIONS_ROOT_VIEW_HOOK_CLASS_DESCRIPTOR->onShortsCreate(Landroid/view/View;)V"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Hook the search bar.
|
||||
@ -122,7 +78,6 @@ object PlayerTypeHookPatch : BytecodePatch(
|
||||
)
|
||||
}
|
||||
|
||||
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +0,0 @@
|
||||
package app.revanced.patches.youtube.utils.playertype.fingerprint
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelWatchPlayer
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
internal object ReelWatchPagerFingerprint : LiteralValueFingerprint(
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
returnType = "Landroid/view/View;",
|
||||
literalSupplier = { ReelWatchPlayer }
|
||||
)
|
@ -72,13 +72,11 @@ object SharedResourceIdPatch : ResourcePatch() {
|
||||
var ReelRightDislikeIcon = -1L
|
||||
var ReelRightLikeIcon = -1L
|
||||
var ReelTimeBarPlayedColor = -1L
|
||||
var ReelWatchPlayer = -1L
|
||||
var RelatedChipCloudMargin = -1L
|
||||
var RightComment = -1L
|
||||
var ScrimOverlay = -1L
|
||||
var Scrubbing = -1L
|
||||
var SeekUndoEduOverlayStub = -1L
|
||||
var SizeAdjustableYouTubeControlsOverlay = -1L
|
||||
var SlidingDialogAnimation = -1L
|
||||
var SubtitleMenuSettingsFooterInfo = -1L
|
||||
var SuggestedAction = -1L
|
||||
@ -147,14 +145,12 @@ object SharedResourceIdPatch : ResourcePatch() {
|
||||
ReelPlayerPausedStateButton = getId(ID, "reel_player_paused_state_buttons")
|
||||
ReelRightDislikeIcon = getId(DRAWABLE, "reel_right_dislike_icon")
|
||||
ReelRightLikeIcon = getId(DRAWABLE, "reel_right_like_icon")
|
||||
ReelWatchPlayer = getId(ID, "reel_watch_player")
|
||||
ReelTimeBarPlayedColor = getId(COLOR, "reel_time_bar_played_color")
|
||||
RelatedChipCloudMargin = getId(LAYOUT, "related_chip_cloud_reduced_margins")
|
||||
RightComment = getId(DRAWABLE, "ic_right_comment_32c")
|
||||
ScrimOverlay = getId(ID, "scrim_overlay")
|
||||
Scrubbing = getId(DIMEN, "vertical_touch_offset_to_enter_fine_scrubbing")
|
||||
SeekUndoEduOverlayStub = getId(ID, "seek_undo_edu_overlay_stub")
|
||||
SizeAdjustableYouTubeControlsOverlay = getId(LAYOUT, "size_adjustable_youtube_controls_overlay")
|
||||
SlidingDialogAnimation = getId(STYLE, "SlidingDialogAnimation")
|
||||
SubtitleMenuSettingsFooterInfo = getId(STRING, "subtitle_menu_settings_footer_info")
|
||||
SuggestedAction = getId(LAYOUT, "suggested_action")
|
||||
|
Loading…
x
Reference in New Issue
Block a user