diff --git a/patches/src/main/kotlin/app/revanced/patches/willhaben/ads/HideAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/willhaben/ads/HideAdsPatch.kt index 663debd83..0a95eb126 100644 --- a/patches/src/main/kotlin/app/revanced/patches/willhaben/ads/HideAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/willhaben/ads/HideAdsPatch.kt @@ -3,8 +3,8 @@ package app.revanced.patches.willhaben.ads import app.revanced.patcher.patch.creatingBytecodePatch import app.revanced.util.returnEarly -@Suppress("unused") -internal val `Hide ads` by creatingBytecodePatch( +@Suppress("unused", "ObjectPropertyName") +val `Hide ads` by creatingBytecodePatch( description = "Hides all in-app ads.", ) { compatibleWith("at.willhaben") 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 3f7535d00..a5c21edd9 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 @@ -17,7 +17,7 @@ import com.android.tools.smali.dexlib2.Opcode internal val BytecodePatchContext.addCreateButtonViewMethod by gettingFirstMethodDeclaratively { instructions( addString("Android Wear"), - opcode(Opcode.IF_EQZ), + Opcode.IF_EQZ(), addString("Android Automotive", location = MatchAfterImmediately()), ) } @@ -31,7 +31,7 @@ internal val BytecodePatchContext.createPivotBarMethod by gettingFirstMethodDecl ) instructions( methodCall(definingClass = "Landroid/widget/TextView;", name = "setText"), - opcode(Opcode.RETURN_VOID), + Opcode.RETURN_VOID(), ) } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/Fingerprints.kt index 980a5786b..2c29725fb 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/Fingerprints.kt @@ -37,14 +37,14 @@ internal val BytecodePatchContext.hideShowMoreLegacyButtonMethod by gettingFirst instructions( ResourceType.LAYOUT("expand_button_down"), methodCall(smali = "Landroid/view/View;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;"), - opcode(Opcode.MOVE_RESULT_OBJECT), + Opcode.MOVE_RESULT_OBJECT(), ) } internal val BytecodePatchContext.parseElementFromBufferMethod by gettingFirstMethodDeclaratively { parameterTypes("L", "L", "[B", "L", "L") instructions( - opcode(Opcode.IGET_OBJECT), + Opcode.IGET_OBJECT(), // IGET_BOOLEAN // 20.07+ opcode(Opcode.INVOKE_INTERFACE, location = MatchAfterWithin(1)), opcode(Opcode.MOVE_RESULT_OBJECT, location = MatchAfterImmediately()), diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/Fingerprints.kt index ffb21fc4f..773d95faf 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/Fingerprints.kt @@ -24,7 +24,7 @@ internal val BytecodePatchContext.shortsBottomBarContainerMethod by gettingFirst addString("r_pfvc"), ResourceType.ID("bottom_bar_container"), methodCall(name = "getHeight"), - opcode(Opcode.MOVE_RESULT), + Opcode.MOVE_RESULT(), ) } @@ -41,7 +41,7 @@ internal val BytecodePatchContext.renderBottomNavigationBarMethod by gettingFirs opcode(Opcode.IF_EQZ, MatchAfterImmediately()), opcode(Opcode.INVOKE_INTERFACE, MatchAfterImmediately()), - opcode(Opcode.MONITOR_EXIT), + Opcode.MONITOR_EXIT(), opcode(Opcode.RETURN_VOID, MatchAfterImmediately()), opcode(Opcode.MOVE_EXCEPTION, MatchAfterImmediately()), opcode(Opcode.MONITOR_EXIT, MatchAfterImmediately()), diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/Fingerprints.kt index 275a8945c..55c7c6b08 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/Fingerprints.kt @@ -18,7 +18,7 @@ internal val BytecodePatchContext.timeCounterMethod by gettingFirstMethodDeclara accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL) parameterTypes() instructions( - opcode(Opcode.SUB_LONG_2ADDR), + Opcode.SUB_LONG_2ADDR(), methodCall( opcode = Opcode.INVOKE_STATIC, returnType = "Ljava/lang/CharSequence;", diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/miniplayer/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/miniplayer/Fingerprints.kt index a3c798338..abe01a820 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/miniplayer/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/miniplayer/Fingerprints.kt @@ -176,8 +176,8 @@ internal val BytecodePatchContext.miniplayerOverrideMethod by gettingFirstMethod internal val BytecodePatchContext.miniplayerOverrideNoContextMethod by gettingFirstMethodDeclaratively { accessFlags(AccessFlags.PRIVATE, AccessFlags.FINAL) returnType("Z") - instructions( - opcode(Opcode.IGET_BOOLEAN), // Anchor to insert the instruction. + opcodes( + Opcode.IGET_BOOLEAN, // Anchor to insert the instruction. ) } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/ExitFullscreenPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/ExitFullscreenPatch.kt index f43024157..758f9515c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/ExitFullscreenPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/ExitFullscreenPatch.kt @@ -15,18 +15,17 @@ import app.revanced.util.addInstructionsAtControlFlowLabel import app.revanced.util.indexOfFirstInstructionReversedOrThrow import com.android.tools.smali.dexlib2.Opcode -@Suppress("unused") -internal val `Exit fullscreen mode` by creatingBytecodePatch( - description = "Adds options to automatically exit fullscreen mode when a video reaches the end." +@Suppress("unused", "ObjectPropertyName") +val `Exit fullscreen` by creatingBytecodePatch( + description = "Adds options to automatically exit fullscreen mode when a video reaches the end.", ) { - compatibleWith( "com.google.android.youtube"( "19.43.41", "20.14.43", "20.21.37", "20.31.40", - ) + ), ) dependsOn( @@ -35,7 +34,7 @@ internal val `Exit fullscreen mode` by creatingBytecodePatch( addResourcesPatch, playerTypeHookPatch, playerControlsPatch, - videoInformationPatch + videoInformationPatch, ) // Cannot declare as top level since this patch is in the same package as @@ -48,7 +47,7 @@ internal val `Exit fullscreen mode` by creatingBytecodePatch( addResources("youtube", "layout.player.fullscreen.exitFullscreenPatch") PreferenceScreen.PLAYER.addPreferences( - ListPreference("revanced_exit_fullscreen") + ListPreference("revanced_exit_fullscreen"), ) videoEndMethod.apply { diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/Fingerprints.kt index e5f47e407..394ea10f7 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/Fingerprints.kt @@ -20,7 +20,7 @@ internal val BytecodePatchContext.openVideosFullscreenPortraitMethod by gettingF returnType("V") parameterTypes("L", "Lj\$/util/Optional;") instructions( - opcode(Opcode.MOVE_RESULT), // Conditional check to modify. + Opcode.MOVE_RESULT(), // Conditional check to modify. // Open videos fullscreen portrait feature flag. literal(45666112L, location = MatchAfterWithin(5)), // Cannot be more than 5. opcode(Opcode.MOVE_RESULT, location = MatchAfterWithin(10)), diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/Fingerprints.kt index e1cc1d6d6..2a6ce3785 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/Fingerprints.kt @@ -72,7 +72,7 @@ internal val BytecodePatchContext.watchHistoryMenuUseProgressDrawableMethod by g parameterTypes("L") instructions( methodCall("Landroid/widget/ProgressBar;", "setMax"), - opcode(Opcode.MOVE_RESULT), + Opcode.MOVE_RESULT(), -1712394514(), ) } @@ -106,7 +106,7 @@ internal val BytecodePatchContext.playerLinearGradientLegacyMethod by gettingFir instructions( ResourceType.COLOR("yt_youtube_magenta"), - opcode(Opcode.FILLED_NEW_ARRAY), + Opcode.FILLED_NEW_ARRAY(), opcode(Opcode.MOVE_RESULT_OBJECT, MatchAfterImmediately()), ) } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/shortsautoplay/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/shortsautoplay/Fingerprints.kt index c60e6b003..d2f48c75f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/shortsautoplay/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/shortsautoplay/Fingerprints.kt @@ -21,7 +21,7 @@ internal val BytecodePatchContext.reelEnumConstructorMethod by gettingFirstMetho addString("REEL_LOOP_BEHAVIOR_SINGLE_PLAY"), addString("REEL_LOOP_BEHAVIOR_REPEAT"), addString("REEL_LOOP_BEHAVIOR_END_SCREEN"), - opcode(Opcode.RETURN_VOID), + Opcode.RETURN_VOID(), ) } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/Fingerprints.kt index 2f02c3b85..70fcd7a21 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/Fingerprints.kt @@ -49,7 +49,7 @@ internal val BytecodePatchContext.speedArrayGeneratorMethod by gettingFirstMetho newInstance("Ljava/text/DecimalFormat;"), addString("0.0#"), 7L(), - opcode(Opcode.NEW_ARRAY), + Opcode.NEW_ARRAY(), fieldAccess(definingClass = "/PlayerConfigModel;", type = "[F"), ) } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/videoid/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/videoid/Fingerprints.kt index bea3f3b37..72102cab8 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/videoid/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/videoid/Fingerprints.kt @@ -21,7 +21,7 @@ internal val BytecodePatchContext.videoIdMethod by gettingFirstMethodDeclarative definingClass = "Lcom/google/android/libraries/youtube/innertube/model/player/PlayerResponseModel;", returnType = "Ljava/lang/String;", ), - opcode(Opcode.MOVE_RESULT_OBJECT), + Opcode.MOVE_RESULT_OBJECT(), ) } @@ -34,12 +34,12 @@ internal val BytecodePatchContext.videoIdBackgroundPlayMethod by gettingFirstMet definingClass = "Lcom/google/android/libraries/youtube/innertube/model/player/PlayerResponseModel;", returnType = "Ljava/lang/String;", ), - opcode(Opcode.MOVE_RESULT_OBJECT), - opcode(Opcode.IPUT_OBJECT), - opcode(Opcode.MONITOR_EXIT), - opcode(Opcode.RETURN_VOID), - opcode(Opcode.MONITOR_EXIT), - opcode(Opcode.RETURN_VOID), + Opcode.MOVE_RESULT_OBJECT(), + Opcode.IPUT_OBJECT(), + Opcode.MONITOR_EXIT(), + Opcode.RETURN_VOID(), + Opcode.MONITOR_EXIT(), + Opcode.RETURN_VOID(), ) custom { method, classDef -> method.implementation != null &&