diff --git a/patches/src/main/kotlin/app/revanced/patches/solidexplorer2/functionality/filesize/RemoveFileSizeLimitPatch.kt b/patches/src/main/kotlin/app/revanced/patches/solidexplorer2/functionality/filesize/RemoveFileSizeLimitPatch.kt index fc13e7219..8fbf93254 100644 --- a/patches/src/main/kotlin/app/revanced/patches/solidexplorer2/functionality/filesize/RemoveFileSizeLimitPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/solidexplorer2/functionality/filesize/RemoveFileSizeLimitPatch.kt @@ -13,7 +13,7 @@ val `Remove file size limit` by creatingBytecodePatch( apply { onReadyMethod.apply { - val cmpIndex = onReadyMethod.instructionMatches.first().index + 1 // TODO + val cmpIndex = onReadyMethod.indices.first() + 1 // TODO val cmpResultRegister = getInstruction(cmpIndex).registerA replaceInstruction(cmpIndex, "const/4 v$cmpResultRegister, 0x0") diff --git a/patches/src/main/kotlin/app/revanced/patches/tumblr/featureflags/OverrideFeatureFlagsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/tumblr/featureflags/OverrideFeatureFlagsPatch.kt index 3bf34cd64..a60bcccde 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tumblr/featureflags/OverrideFeatureFlagsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tumblr/featureflags/OverrideFeatureFlagsPatch.kt @@ -69,7 +69,7 @@ val overrideFeatureFlagsPatch = bytecodePatch( // This is equivalent to // String forcedValue = getValueOverride(feature) // if (forcedValue != null) return forcedValue - val getFeatureIndex = getFeatureValueMethod.instructionMatches.first().index + val getFeatureIndex = getFeatureValueMethod.indices.first() getFeatureValueMethod.addInstructionsWithLabels( getFeatureIndex, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/tumblr/timelinefilter/FilterTimelineObjectsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/tumblr/timelinefilter/FilterTimelineObjectsPatch.kt index e5130eff2..793621056 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tumblr/timelinefilter/FilterTimelineObjectsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tumblr/timelinefilter/FilterTimelineObjectsPatch.kt @@ -24,7 +24,7 @@ val filterTimelineObjectsPatch = bytecodePatch( dependsOn(sharedExtensionPatch) apply { - val filterInsertIndex = timelineFilterExtensionMethod.instructionMatches.first().index + val filterInsertIndex = timelineFilterExtensionMethod.indices.first() timelineFilterExtensionMethod.apply { val addInstruction = getInstruction(filterInsertIndex + 1) diff --git a/patches/src/main/kotlin/app/revanced/patches/twitter/interaction/downloads/UnlockDownloadsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/twitter/interaction/downloads/UnlockDownloadsPatch.kt index f5eaeb65f..2b6b3ebd8 100644 --- a/patches/src/main/kotlin/app/revanced/patches/twitter/interaction/downloads/UnlockDownloadsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/twitter/interaction/downloads/UnlockDownloadsPatch.kt @@ -20,7 +20,7 @@ val `Unlock downloads` by creatingBytecodePatch( // Allow downloads for non-premium users. showDownloadVideoUpsellBottomSheetMethod.patch { - val checkIndex = instructionMatches.first().index + val checkIndex = indices.first() val register = method.getInstruction(checkIndex).registerA checkIndex to register @@ -37,7 +37,7 @@ val `Unlock downloads` by creatingBytecodePatch( // Make GIFs downloadable. buildMediaOptionsSheetMethod.let { it.method.apply { - val checkMediaTypeIndex = it.instructionMatches.first().index + val checkMediaTypeIndex = it.indices.first() val checkMediaTypeInstruction = getInstruction(checkMediaTypeIndex) // Treat GIFs as videos. diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/HideGetPremiumPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/HideGetPremiumPatch.kt index 39a5e3eee..e91ff83c3 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/HideGetPremiumPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/HideGetPremiumPatch.kt @@ -40,7 +40,7 @@ val hideGetPremiumPatch = bytecodePatch( ) getPremiumViewMethod.apply { - val startIndex = getPremiumViewMethod.instructionMatches.first().index + val startIndex = getPremiumViewMethod.indices.first() val measuredWidthRegister = getInstruction(startIndex).registerA val measuredHeightInstruction = getInstruction(startIndex + 1) diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingPatch.kt index 5851bd1a2..3b423d7c3 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingPatch.kt @@ -39,7 +39,7 @@ val enableSeekbarTappingPatch = bytecodePatch( .reference as MethodReference listOf( - getReference(it.instructionMatches.first().index), + getReference(it.indices.first()), getReference(it.indices.last()), ) } @@ -53,7 +53,7 @@ val enableSeekbarTappingPatch = bytecodePatch( ).registerC val xAxisRegister = this.getInstruction( - it.instructionMatches[2].index, + it.indices[2], ).registerD val freeRegister = findFreeRegister( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt index cf38e1c41..c516f8fec 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt @@ -42,7 +42,7 @@ val enableSlideToSeekPatch = bytecodePatch( // Restore the behaviour to slide to seek. - val checkIndex = slideToSeekMethod.instructionMatches.first().index + val checkIndex = slideToSeekMethod.indices.first() val checkReference = slideToSeekMethod.getInstruction(checkIndex) .getReference()!! diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/HideSeekbarPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/HideSeekbarPatch.kt index 63a6ae0d0..bd9af7f2c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/HideSeekbarPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/HideSeekbarPatch.kt @@ -54,7 +54,7 @@ val hideSeekbarPatch = bytecodePatch( if (is_20_28_or_greater) { fullscreenLargeSeekbarFeatureFlagMethodMatch.let { it.method.insertLiteralOverride( - it.instructionMatches.first().index, + it.indices.first(), "$EXTENSION_CLASS_DESCRIPTOR->useFullscreenLargeSeekbar(Z)Z", ) } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/Fingerprints.kt index 1587048de..03c2a9cdc 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/Fingerprints.kt @@ -1,14 +1,6 @@ package app.revanced.patches.youtube.layout.buttons.navigation -import app.revanced.patcher.accessFlags -import app.revanced.patcher.after -import app.revanced.patcher.firstMethodComposite -import app.revanced.patcher.gettingFirstMethodDeclaratively -import app.revanced.patcher.instructions -import app.revanced.patcher.invoke -import app.revanced.patcher.parameterTypes -import app.revanced.patcher.patch.BytecodePatchContext -import app.revanced.patcher.returnType +import app.revanced.patcher.* import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode @@ -20,7 +12,7 @@ internal val addCreateButtonViewMethodMatch = firstMethodComposite { ) } -internal val BytecodePatchContext.createPivotBarMethod by gettingFirstMethodDeclaratively { +internal val createPivotBarMethodMatch = firstMethodComposite { accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR) parameterTypes( "Lcom/google/android/libraries/youtube/rendering/ui/pivotbar/PivotBar;", @@ -28,12 +20,12 @@ internal val BytecodePatchContext.createPivotBarMethod by gettingFirstMethodDecl "Ljava/lang/CharSequence;", ) instructions( - methodCall(definingClass = "Landroid/widget/TextView;", name = "setText"), + method { name == "setText" && definingClass == "Landroid/widget/TextView;" }, Opcode.RETURN_VOID(), ) } -internal val BytecodePatchContext.animatedNavigationTabsFeatureFlagMethod by gettingFirstMethodDeclaratively { +internal val animatedNavigationTabsFeatureFlagMethodMatch = firstMethodComposite { accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL) returnType("Z") instructions( @@ -41,7 +33,7 @@ internal val BytecodePatchContext.animatedNavigationTabsFeatureFlagMethod by get ) } -internal val BytecodePatchContext.translucentNavigationStatusBarFeatureFlagMethod by gettingFirstMethodDeclaratively { +internal val translucentNavigationStatusBarFeatureFlagMethodMatch = firstMethodComposite { accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL) returnType("Z") instructions( @@ -52,7 +44,7 @@ internal val BytecodePatchContext.translucentNavigationStatusBarFeatureFlagMetho /** * YouTube nav buttons. */ -internal val BytecodePatchContext.translucentNavigationButtonsFeatureFlagMethod by gettingFirstMethodDeclaratively { +internal val translucentNavigationButtonsFeatureFlagMethodMatch = firstMethodComposite { accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL) returnType("V") instructions( @@ -63,7 +55,7 @@ internal val BytecodePatchContext.translucentNavigationButtonsFeatureFlagMethod /** * Device on screen back/home/recent buttons. */ -internal val BytecodePatchContext.translucentNavigationButtonsSystemFeatureFlagMethod by gettingFirstMethodDeclaratively { +internal val translucentNavigationButtonsSystemFeatureFlagMethodMatch = firstMethodComposite { accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL) returnType("Z") instructions( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/NavigationButtonsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/NavigationButtonsPatch.kt index 1b4e8bf46..83830c725 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/NavigationButtonsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/NavigationButtonsPatch.kt @@ -97,9 +97,9 @@ val `Navigation buttons` by creatingBytecodePatch( } // Hide navigation button labels. - createPivotBarMethod.let { + createPivotBarMethodMatch.let { it.method.apply { - val setTextIndex = it.instructionMatches.first().index + val setTextIndex = it.indices.first() val targetRegister = getInstruction(setTextIndex).registerC addInstruction( @@ -115,32 +115,32 @@ val `Navigation buttons` by creatingBytecodePatch( // Force on/off translucent effect on status bar and navigation buttons. if (is_19_25_or_greater) { - translucentNavigationStatusBarFeatureFlagMethod.let { + translucentNavigationStatusBarFeatureFlagMethodMatch.let { it.method.insertLiteralOverride( - it.instructionMatches.first().index, + it.indices.first(), "$EXTENSION_CLASS_DESCRIPTOR->useTranslucentNavigationStatusBar(Z)Z", ) } - translucentNavigationButtonsFeatureFlagMethod.let { + translucentNavigationButtonsFeatureFlagMethodMatch.let { it.method.insertLiteralOverride( - it.instructionMatches.first().index, + it.indices.first(), "$EXTENSION_CLASS_DESCRIPTOR->useTranslucentNavigationButtons(Z)Z", ) } - translucentNavigationButtonsSystemFeatureFlagMethod.let { + translucentNavigationButtonsSystemFeatureFlagMethodMatch.let { it.method.insertLiteralOverride( - it.instructionMatches.first().index, + it.indices.first(), "$EXTENSION_CLASS_DESCRIPTOR->useTranslucentNavigationButtons(Z)Z", ) } } if (is_20_15_or_greater) { - animatedNavigationTabsFeatureFlagMethod.let { + animatedNavigationTabsFeatureFlagMethodMatch.let { it.method.insertLiteralOverride( - it.instructionMatches.first().index, + it.indices.first(), "$EXTENSION_CLASS_DESCRIPTOR->useAnimatedNavigationButtons(Z)Z", ) } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt index 7895e5f0c..e2758c6d9 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt @@ -241,7 +241,7 @@ val `Hide layout components` by creatingBytecodePatch( // region Mix playlists parseElementFromBufferMethod.apply { - val startIndex = parseElementFromBufferMethod.instructionMatches.first().index + val startIndex = parseElementFromBufferMethod.indices.first() val insertIndex = startIndex + 1 val byteArrayParameter = "p3" diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/rollingnumber/DisableRollingNumberAnimationPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/rollingnumber/DisableRollingNumberAnimationPatch.kt index 5cac53d57..f976a4fb1 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/rollingnumber/DisableRollingNumberAnimationPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/rollingnumber/DisableRollingNumberAnimationPatch.kt @@ -46,7 +46,7 @@ val `Disable rolling number animations` by creatingBytecodePatch( // Animations are disabled by preventing an Image from being applied to the text span, // which prevents the animations from appearing. rollingNumberTextViewAnimationUpdateMethod.let { - val blockStartIndex = it.instructionMatches.first().index + val blockStartIndex = it.indices.first() val blockEndIndex = it.indices.last() + 1 it.method.apply { val freeRegister = getInstruction(blockStartIndex).registerA diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/miniplayer/MiniplayerPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/miniplayer/MiniplayerPatch.kt index 3845da80e..e1752f767 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/miniplayer/MiniplayerPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/miniplayer/MiniplayerPatch.kt @@ -326,7 +326,7 @@ val Miniplayer by creatingBytecodePatch( // Override a minimum size constant. miniplayerMinimumSizeMethod.let { it.method.apply { - val index = it.instructionMatches[1].index + val index = it.indices[1] val register = getInstruction(index).registerA // Smaller sizes can be used, but the miniplayer will always start in size 170 if set any smaller. diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/OpenVideosFullscreenHookPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/OpenVideosFullscreenHookPatch.kt index 2cc062dc9..e5c004233 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/OpenVideosFullscreenHookPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/OpenVideosFullscreenHookPatch.kt @@ -28,7 +28,7 @@ internal val openVideosFullscreenHookPatch = bytecodePatch { if (is_19_46_or_greater) { fingerprint = openVideosFullscreenPortraitMethod - insertIndex = fingerprint.instructionMatches.first().index + insertIndex = fingerprint.indices.first() openVideosFullscreenPortraitMethod.let { // Remove A/B feature call that forces what this patch already does. diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt index 68f9c32db..971c755f1 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt @@ -248,7 +248,7 @@ val `Return YouTube Dislike` by creatingBytecodePatch( // Modify the measure text calculation to include the left drawable separator if needed. rollingNumberMeasureAnimatedTextMethod.let { // Additional check to verify the opcodes are at the start of the method - if (it.instructionMatches.first().index != 0) throw PatchException("Unexpected opcode location") + if (it.indices.first() != 0) throw PatchException("Unexpected opcode location") val endIndex = it.indices.last() it.method.apply { @@ -269,7 +269,7 @@ val `Return YouTube Dislike` by creatingBytecodePatch( rollingNumberMeasureStaticLabelMethod.match( rollingNumberMeasureStaticLabelParentMethod.immutableClassDef, ).let { - val measureTextIndex = it.instructionMatches.first().index + 1 + val measureTextIndex = it.indices.first() + 1 it.method.apply { val freeRegister = getInstruction(0).registerA diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/SeekbarColorPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/SeekbarColorPatch.kt index 43ef8f4ca..587d89f33 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/SeekbarColorPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/SeekbarColorPatch.kt @@ -50,16 +50,16 @@ val seekbarColorPatch = bytecodePatch( playerSeekbarColorMethod.let { it.method.apply { addColorChangeInstructions(it.indices.last()) - addColorChangeInstructions(it.instructionMatches.first().index) + addColorChangeInstructions(it.indices.first()) } } shortsSeekbarColorMethod.let { - it.method.addColorChangeInstructions(it.instructionMatches.first().index) + it.method.addColorChangeInstructions(it.indices.first()) } setSeekbarClickedColorMethod.immutableMethod.let { - val setColorMethodIndex = setSeekbarClickedColorMethod.instructionMatches.first().index + 1 + val setColorMethodIndex = setSeekbarClickedColorMethod.indices.first() + 1 navigate(it).to(setColorMethodIndex).stop().apply { val colorRegister = getInstruction(0).registerA @@ -91,7 +91,7 @@ val seekbarColorPatch = bytecodePatch( if (is_19_34_or_greater) { watchHistoryMenuUseProgressDrawableMethod.let { it.method.apply { - val index = it.instructionMatches[1].index + val index = it.indices[1] val register = getInstruction(index).registerA addInstructions( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt index 3898396c5..191398139 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt @@ -82,7 +82,7 @@ val `Spoof app version` by creatingBytecodePatch( * toolbar when the enum name is UNKNOWN. */ toolBarButtonMethod.apply { - val imageResourceIndex = instructionMatches[2].index + val imageResourceIndex = indices[2] val register = method.getInstruction(imageResourceIndex).registerA val jumpIndex = indices.last() + 1 @@ -94,7 +94,7 @@ val `Spoof app version` by creatingBytecodePatch( } spoofAppVersionMethod.apply { - val index = instructionMatches.first().index + val index = indices.first() val register = method.getInstruction(index).registerA method.addInstructions( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/backgroundplayback/BackgroundPlaybackPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/backgroundplayback/BackgroundPlaybackPatch.kt index 65d8836d4..523298e24 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/backgroundplayback/BackgroundPlaybackPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/backgroundplayback/BackgroundPlaybackPatch.kt @@ -103,7 +103,7 @@ val `Remove background playback restrictions` by creatingBytecodePatch( if (is_19_34_or_greater) { pipInputConsumerFeatureFlagMethod.let { it.method.insertLiteralOverride( - it.instructionMatches.first().index, + it.indices.first(), false, ) } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/LithoFilterPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/LithoFilterPatch.kt index 968aa1edb..512ce3cf0 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/LithoFilterPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/LithoFilterPatch.kt @@ -200,7 +200,7 @@ val lithoFilterPatch = bytecodePatch( // 20.22 the flag is still enabled in one location, but what it does is not known. // Disable it anyway. it.method.insertLiteralOverride( - it.instructionMatches.first().index, + it.indices.first(), false, ) } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/PlayerControlsOverlayVisibilityPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/PlayerControlsOverlayVisibilityPatch.kt index cd7edebeb..13eb7689d 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/PlayerControlsOverlayVisibilityPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/PlayerControlsOverlayVisibilityPatch.kt @@ -18,7 +18,7 @@ val playerControlsOverlayVisibilityPatch = bytecodePatch { apply { playerControlsVisibilityEntityModelMethod.let { it.method.apply { - val startIndex = it.instructionMatches.first().index + val startIndex = it.indices.first() val iGetReference = getInstruction(startIndex).reference val staticReference = getInstruction(startIndex + 1).reference diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/recyclerviewtree/hook/RecyclerViewTreeHookPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/recyclerviewtree/hook/RecyclerViewTreeHookPatch.kt index c35be29b8..c26060aa6 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/recyclerviewtree/hook/RecyclerViewTreeHookPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/recyclerviewtree/hook/RecyclerViewTreeHookPatch.kt @@ -12,7 +12,7 @@ val recyclerViewTreeHookPatch = bytecodePatch { apply { recyclerViewTreeObserverMethod.apply { - val insertIndex = recyclerViewTreeObserverMethod.instructionMatches.first().index + 1 + val insertIndex = recyclerViewTreeObserverMethod.indices.first() + 1 val recyclerViewParameter = 2 addRecyclerViewTreeHook = { classDescriptor -> diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch.kt index 77e1971d2..a70ad87b3 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch.kt @@ -172,7 +172,7 @@ internal val customPlaybackSpeedPatch = bytecodePatch( if (is_19_47_or_greater) { customTapAndHoldMethodMatch.let { it.method.apply { - val index = it.instructionMatches.first().index + val index = it.indices.first() val register = getInstruction(index).registerA addInstructions(