From a353a48aa3fbfcb7e44d3bc5d72e5c34d4e36b40 Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Sat, 21 Dec 2024 14:55:46 +0900 Subject: [PATCH] chore: Lint code --- .../utils/sponsorblock/SponsorBlockPatch.kt | 6 +++-- .../revanced/patches/reddit/ad/AdsPatch.kt | 3 ++- .../RecommendedCommunitiesPatch.kt | 4 ++- .../navigation/NavigationButtonsPatch.kt | 26 ++++++++++--------- .../RecentlyVisitedShelfPatch.kt | 17 +++++++----- .../reddit/misc/openlink/Fingerprints.kt | 3 ++- .../misc/openlink/OpenLinksExternallyPatch.kt | 1 - .../ScreenNavigatorMethodResolverPatch.kt | 6 ++--- .../reddit/utils/settings/SettingsPatch.kt | 4 ++- .../BaseSpoofStreamingDataPatch.kt | 2 +- .../actionbuttons/ShortsActionButtonsPatch.kt | 6 +++-- .../branding/icon/CustomBrandingIconPatch.kt | 14 +++++++--- .../youtube/layout/theme/SharedThemePatch.kt | 4 ++- .../player/buttons/PlayerButtonsPatch.kt | 3 ++- .../DescriptionComponentsPatch.kt | 2 +- .../shorts/components/ShortsComponentPatch.kt | 2 +- .../swipe/controls/SwipeControlsPatch.kt | 16 ++++++++++-- .../patches/youtube/utils/Fingerprints.kt | 7 ++++- .../utils/fix/cairo/CairoSettingsPatch.kt | 1 - .../PlaybackSpeedWhilePlayingPatch.kt | 3 ++- .../video/playback/VideoPlaybackPatch.kt | 2 +- .../kotlin/app/revanced/util/ResourceUtils.kt | 3 ++- 22 files changed, 88 insertions(+), 47 deletions(-) diff --git a/patches/src/main/kotlin/app/revanced/patches/music/utils/sponsorblock/SponsorBlockPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/utils/sponsorblock/SponsorBlockPatch.kt index 032389165..269378cfc 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/utils/sponsorblock/SponsorBlockPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/utils/sponsorblock/SponsorBlockPatch.kt @@ -179,7 +179,8 @@ val sponsorBlockPatch = resourcePatch( val tags = document.getElementsByTagName(PREFERENCE_SCREEN_TAG_NAME) List(tags.length) { tags.item(it) as Element } .filter { - it.getAttribute("android:key").contains("revanced_preference_screen_$category") + it.getAttribute("android:key") + .contains("revanced_preference_screen_$category") } .forEach { it.adoptChild(SWITCH_PREFERENCE_TAG_NAME) { @@ -210,7 +211,8 @@ val sponsorBlockPatch = resourcePatch( val tags = document.getElementsByTagName(PREFERENCE_SCREEN_TAG_NAME) List(tags.length) { tags.item(it) as Element } .filter { - it.getAttribute("android:key").contains("revanced_preference_screen_$category") + it.getAttribute("android:key") + .contains("revanced_preference_screen_$category") } .forEach { it.adoptChild("Preference") { diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/ad/AdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/ad/AdsPatch.kt index 4f43b2fe4..aff6e4335 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/ad/AdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/ad/AdsPatch.kt @@ -114,7 +114,8 @@ val adsPatch = bytecodePatch( // AdElementConverter is conveniently responsible for inserting all feed ads. // By removing the appending instruction no ad posts gets appended to the feed. newAdPostFingerprint.methodOrThrow().apply { - val stringIndex = indexOfFirstStringInstructionOrThrow("android_feed_freeform_render_variant") + val stringIndex = + indexOfFirstStringInstructionOrThrow("android_feed_freeform_render_variant") val targetIndex = indexOfFirstInstructionOrThrow(stringIndex) { opcode == Opcode.INVOKE_VIRTUAL && getReference()?.toString() == "Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z" diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/layout/communities/RecommendedCommunitiesPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/layout/communities/RecommendedCommunitiesPatch.kt index e56d6b747..d4241956d 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/layout/communities/RecommendedCommunitiesPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/layout/communities/RecommendedCommunitiesPatch.kt @@ -24,7 +24,9 @@ val recommendedCommunitiesPatch = bytecodePatch( dependsOn(settingsPatch) execute { - communityRecommendationSectionFingerprint.methodOrThrow(communityRecommendationSectionParentFingerprint).apply { + communityRecommendationSectionFingerprint.methodOrThrow( + communityRecommendationSectionParentFingerprint + ).apply { addInstructionsWithLabels( 0, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/layout/navigation/NavigationButtonsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/layout/navigation/NavigationButtonsPatch.kt index ddae37c21..0a084d6b4 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/layout/navigation/NavigationButtonsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/layout/navigation/NavigationButtonsPatch.kt @@ -39,28 +39,30 @@ val navigationButtonsPatch = bytecodePatch( } if (bottomNavScreenFingerprint.resolvable()) { - val bottomNavScreenMutableClass = with (bottomNavScreenFingerprint.methodOrThrow()) { + val bottomNavScreenMutableClass = with(bottomNavScreenFingerprint.methodOrThrow()) { val startIndex = indexOfGetDimensionPixelSizeInstruction(this) val targetIndex = indexOfFirstInstructionOrThrow(startIndex, Opcode.NEW_INSTANCE) - val targetReference = getInstruction(targetIndex).reference.toString() + val targetReference = + getInstruction(targetIndex).reference.toString() classBy { it.type == targetReference } ?.mutableClass ?: throw ClassNotFoundException("Failed to find class $targetReference") } - bottomNavScreenOnGlobalLayoutFingerprint.second.matchOrNull(bottomNavScreenMutableClass)?.let { - it.method.apply { - val startIndex = it.patternMatch!!.startIndex - val targetRegister = - getInstruction(startIndex).registerC + bottomNavScreenOnGlobalLayoutFingerprint.second.matchOrNull(bottomNavScreenMutableClass) + ?.let { + it.method.apply { + val startIndex = it.patternMatch!!.startIndex + val targetRegister = + getInstruction(startIndex).registerC - addInstruction( - startIndex + 1, - "invoke-static {v$targetRegister}, $EXTENSION_CLASS_DESCRIPTOR->hideNavigationButtons(Landroid/view/ViewGroup;)V" - ) + addInstruction( + startIndex + 1, + "invoke-static {v$targetRegister}, $EXTENSION_CLASS_DESCRIPTOR->hideNavigationButtons(Landroid/view/ViewGroup;)V" + ) + } } - } } else { // Legacy method. bottomNavScreenHandlerFingerprint.methodOrThrow().apply { diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/layout/recentlyvisited/RecentlyVisitedShelfPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/layout/recentlyvisited/RecentlyVisitedShelfPatch.kt index 2c23ae2ef..f4b221a14 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/layout/recentlyvisited/RecentlyVisitedShelfPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/layout/recentlyvisited/RecentlyVisitedShelfPatch.kt @@ -31,15 +31,18 @@ val recentlyVisitedShelfPatch = bytecodePatch( execute { - val recentlyVisitedReference = with (communityDrawerPresenterConstructorFingerprint.methodOrThrow()) { - val recentlyVisitedFieldIndex = indexOfHeaderItemInstruction(this) - val recentlyVisitedObjectIndex = - indexOfFirstInstructionOrThrow(recentlyVisitedFieldIndex, Opcode.IPUT_OBJECT) + val recentlyVisitedReference = + with(communityDrawerPresenterConstructorFingerprint.methodOrThrow()) { + val recentlyVisitedFieldIndex = indexOfHeaderItemInstruction(this) + val recentlyVisitedObjectIndex = + indexOfFirstInstructionOrThrow(recentlyVisitedFieldIndex, Opcode.IPUT_OBJECT) - getInstruction(recentlyVisitedObjectIndex).reference.toString() - } + getInstruction(recentlyVisitedObjectIndex).reference.toString() + } - communityDrawerPresenterFingerprint.methodOrThrow(communityDrawerPresenterConstructorFingerprint).apply { + communityDrawerPresenterFingerprint.methodOrThrow( + communityDrawerPresenterConstructorFingerprint + ).apply { val recentlyVisitedObjectIndex = indexOfFirstInstructionOrThrow { (this as? ReferenceInstruction)?.reference?.toString() == recentlyVisitedReference diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/misc/openlink/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/misc/openlink/Fingerprints.kt index 9779c5f99..12fe68511 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/misc/openlink/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/misc/openlink/Fingerprints.kt @@ -19,7 +19,8 @@ internal val customReportsFingerprint = legacyFingerprint( fun indexOfScreenNavigatorInstruction(method: Method) = method.indexOfFirstInstruction { - (this as? ReferenceInstruction)?.reference?.toString()?.contains("Landroid/app/Activity;Landroid/net/Uri;") == true + (this as? ReferenceInstruction)?.reference?.toString() + ?.contains("Landroid/app/Activity;Landroid/net/Uri;") == true } internal val screenNavigatorFingerprint = legacyFingerprint( diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/misc/openlink/OpenLinksExternallyPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/misc/openlink/OpenLinksExternallyPatch.kt index 81e3f8e29..0d74acc0a 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/misc/openlink/OpenLinksExternallyPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/misc/openlink/OpenLinksExternallyPatch.kt @@ -9,7 +9,6 @@ import app.revanced.patches.reddit.utils.extension.Constants.PATCHES_PATH import app.revanced.patches.reddit.utils.patch.PatchList.OPEN_LINKS_EXTERNALLY import app.revanced.patches.reddit.utils.settings.settingsPatch import app.revanced.patches.reddit.utils.settings.updatePatchStatus -import app.revanced.util.fingerprint.methodOrThrow import app.revanced.util.indexOfFirstStringInstructionOrThrow private const val EXTENSION_METHOD_DESCRIPTOR = diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/misc/openlink/ScreenNavigatorMethodResolverPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/misc/openlink/ScreenNavigatorMethodResolverPatch.kt index b764fcfee..7a0c3f190 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/misc/openlink/ScreenNavigatorMethodResolverPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/misc/openlink/ScreenNavigatorMethodResolverPatch.kt @@ -12,10 +12,10 @@ val screenNavigatorMethodResolverPatch = bytecodePatch( ) { execute { screenNavigatorMethod = - // ~ Reddit 2024.25.3 + // ~ Reddit 2024.25.3 screenNavigatorFingerprint.second.methodOrNull - // Reddit 2024.26.1 ~ - ?: with (customReportsFingerprint.methodOrThrow()) { + // Reddit 2024.26.1 ~ + ?: with(customReportsFingerprint.methodOrThrow()) { getWalkerMethod(indexOfScreenNavigatorInstruction(this)) } } diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/utils/settings/SettingsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/utils/settings/SettingsPatch.kt index b01c71a1d..65ca353e8 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/utils/settings/SettingsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/utils/settings/SettingsPatch.kt @@ -51,7 +51,9 @@ private val settingsBytecodePatch = bytecodePatch( && (this as? BuilderInstruction21c)?.reference.toString().startsWith("202") } - val versionNumber = getInstruction(versionIndex).reference.toString().replace(".", "").toInt() + val versionNumber = + getInstruction(versionIndex).reference.toString() + .replace(".", "").toInt() is_2024_18_or_greater = 2024180 <= versionNumber } diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/spoof/streamingdata/BaseSpoofStreamingDataPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/spoof/streamingdata/BaseSpoofStreamingDataPatch.kt index 81da85344..811e1c9b6 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/spoof/streamingdata/BaseSpoofStreamingDataPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/spoof/streamingdata/BaseSpoofStreamingDataPatch.kt @@ -85,7 +85,7 @@ fun baseSpoofStreamingDataPatch( // region Replace the streaming data. val approxDurationMsFieldName = formatStreamModelConstructorFingerprint.matchOrThrow().let { - with (it.method) { + with(it.method) { val approxDurationMsFieldIndex = it.patternMatch!!.startIndex (getInstruction(approxDurationMsFieldIndex).reference as FieldReference).name } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/actionbuttons/ShortsActionButtonsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/actionbuttons/ShortsActionButtonsPatch.kt index eea71b603..561eecab5 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/actionbuttons/ShortsActionButtonsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/actionbuttons/ShortsActionButtonsPatch.kt @@ -80,8 +80,10 @@ val shortsActionButtonsPatch = resourcePatch( val fromPath = res.resolve(fromFile).toPath() val toFile = "$drawableDirectory/$toFileName.webp" val toPath = res.resolve(toFile).toPath() - val inputStreamForLegacy = inputStreamFromBundledResourceOrThrow(sourceResourceDirectory, fromFile) - val inputStreamForNew = inputStreamFromBundledResourceOrThrow(sourceResourceDirectory, fromFile) + val inputStreamForLegacy = + inputStreamFromBundledResourceOrThrow(sourceResourceDirectory, fromFile) + val inputStreamForNew = + inputStreamFromBundledResourceOrThrow(sourceResourceDirectory, fromFile) Files.copy(inputStreamForLegacy, fromPath, StandardCopyOption.REPLACE_EXISTING) diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/branding/icon/CustomBrandingIconPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/branding/icon/CustomBrandingIconPatch.kt index 7b1861043..4abecb1a7 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/branding/icon/CustomBrandingIconPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/branding/icon/CustomBrandingIconPatch.kt @@ -178,7 +178,8 @@ val customBrandingIconPatch = resourcePatch( } document("res/values/styles.xml").use { document -> - val resourcesNode = document.getElementsByTagName("resources").item(0) as Element + val resourcesNode = + document.getElementsByTagName("resources").item(0) as Element val childNodes = resourcesNode.childNodes for (i in 0 until childNodes.length) { @@ -205,7 +206,8 @@ val customBrandingIconPatch = resourcePatch( } val styleMap = mutableMapOf() - styleMap["Base.Theme.YouTube.Launcher"] = "@style/Theme.AppCompat.DayNight.NoActionBar" + styleMap["Base.Theme.YouTube.Launcher"] = + "@style/Theme.AppCompat.DayNight.NoActionBar" if (is_19_32_or_greater) { styleMap["Theme.YouTube.Home"] = "@style/Base.V27.Theme.YouTube.Home" @@ -213,7 +215,8 @@ val customBrandingIconPatch = resourcePatch( styleMap.forEach { (nodeAttributeName, nodeAttributeParent) -> document("res/values-v31/styles.xml").use { document -> - val resourcesNode = document.getElementsByTagName("resources").item(0) as Element + val resourcesNode = + document.getElementsByTagName("resources").item(0) as Element val style = document.createElement("style") style.setAttribute("name", nodeAttributeName) @@ -223,7 +226,10 @@ val customBrandingIconPatch = resourcePatch( primaryItem.setAttribute("name", "android:windowSplashScreenAnimatedIcon") primaryItem.textContent = "@drawable/avd_anim" val secondaryItem = document.createElement("item") - secondaryItem.setAttribute("name", "android:windowSplashScreenAnimationDuration") + secondaryItem.setAttribute( + "name", + "android:windowSplashScreenAnimationDuration" + ) secondaryItem.textContent = if (appIcon.startsWith("revancify")) "1500" else diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/theme/SharedThemePatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/theme/SharedThemePatch.kt index 24fc61f35..d95f7c786 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/theme/SharedThemePatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/theme/SharedThemePatch.kt @@ -67,6 +67,7 @@ val sharedThemePatch = resourcePatch( 1 -> when (nodeAttributeName) { "Base.Theme.YouTube.Launcher", "Base.Theme.YouTube.Launcher.Cairo" -> SPLASH_SCREEN_COLOR_ATTRIBUTE + else -> "null" } @@ -115,7 +116,8 @@ val sharedThemePatch = resourcePatch( return@editSplashScreen } document("res/$drawable/$fileName.xml").use { document -> - val layerList = document.getElementsByTagName("layer-list").item(0) as Element + val layerList = + document.getElementsByTagName("layer-list").item(0) as Element val childNodes = layerList.childNodes for (i in 0 until childNodes.length) { diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/player/buttons/PlayerButtonsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/player/buttons/PlayerButtonsPatch.kt index 2cc40618e..979950f6c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/player/buttons/PlayerButtonsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/player/buttons/PlayerButtonsPatch.kt @@ -169,7 +169,8 @@ val playerButtonsPatch = bytecodePatch( if (is_19_34_or_greater) { layoutConstructorFingerprint.methodOrThrow().apply { - val resourceIndex = indexOfFirstLiteralInstructionOrThrow(playerControlPreviousButtonTouchArea) + val resourceIndex = + indexOfFirstLiteralInstructionOrThrow(playerControlPreviousButtonTouchArea) val insertIndex = indexOfFirstInstructionOrThrow(resourceIndex) { opcode == Opcode.INVOKE_STATIC && diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/player/descriptions/DescriptionComponentsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/player/descriptions/DescriptionComponentsPatch.kt index e391590f9..7cfda01cf 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/player/descriptions/DescriptionComponentsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/player/descriptions/DescriptionComponentsPatch.kt @@ -16,8 +16,8 @@ import app.revanced.patches.youtube.utils.playertype.playerTypeHookPatch import app.revanced.patches.youtube.utils.playservice.is_18_49_or_greater import app.revanced.patches.youtube.utils.playservice.is_19_02_or_greater import app.revanced.patches.youtube.utils.playservice.versionCheckPatch -import app.revanced.patches.youtube.utils.recyclerview.recyclerViewTreeObserverPatch import app.revanced.patches.youtube.utils.recyclerview.recyclerViewTreeObserverHook +import app.revanced.patches.youtube.utils.recyclerview.recyclerViewTreeObserverPatch import app.revanced.patches.youtube.utils.resourceid.sharedResourceIdPatch import app.revanced.patches.youtube.utils.rollingNumberTextViewAnimationUpdateFingerprint import app.revanced.patches.youtube.utils.rollingNumberTextViewFingerprint diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/shorts/components/ShortsComponentPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/shorts/components/ShortsComponentPatch.kt index 18953b2ea..34402150f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/shorts/components/ShortsComponentPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/shorts/components/ShortsComponentPatch.kt @@ -37,8 +37,8 @@ import app.revanced.patches.youtube.utils.playservice.is_19_25_or_greater import app.revanced.patches.youtube.utils.playservice.is_19_28_or_greater import app.revanced.patches.youtube.utils.playservice.is_19_34_or_greater import app.revanced.patches.youtube.utils.playservice.versionCheckPatch -import app.revanced.patches.youtube.utils.recyclerview.recyclerViewTreeObserverPatch import app.revanced.patches.youtube.utils.recyclerview.recyclerViewTreeObserverHook +import app.revanced.patches.youtube.utils.recyclerview.recyclerViewTreeObserverPatch import app.revanced.patches.youtube.utils.resourceid.bottomBarContainer import app.revanced.patches.youtube.utils.resourceid.metaPanel import app.revanced.patches.youtube.utils.resourceid.reelDynRemix diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/swipe/controls/SwipeControlsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/swipe/controls/SwipeControlsPatch.kt index 2d1a3ca0b..3d404f4b7 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/swipe/controls/SwipeControlsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/swipe/controls/SwipeControlsPatch.kt @@ -165,10 +165,22 @@ val swipeControlsPatch = bytecodePatch( reference.parameterTypes.size == 0 } if (getInstruction(targetIndex - 1).opcode != Opcode.IGET_OBJECT) { - throw PatchException("Previous Opcode pattern does not match: ${getInstruction(targetIndex - 1).opcode}") + throw PatchException( + "Previous Opcode pattern does not match: ${ + getInstruction( + targetIndex - 1 + ).opcode + }" + ) } if (getInstruction(targetIndex + 1).opcode != Opcode.IF_EQZ) { - throw PatchException("Next Opcode pattern does not match: ${getInstruction(targetIndex + 1).opcode}") + throw PatchException( + "Next Opcode pattern does not match: ${ + getInstruction( + targetIndex + 1 + ).opcode + }" + ) } val fieldReference = getInstruction(targetIndex - 1).reference val fieldInstruction = getInstruction(targetIndex - 1) diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/Fingerprints.kt index 98f0cef66..d55486456 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/Fingerprints.kt @@ -67,7 +67,12 @@ internal val layoutConstructorFingerprint = legacyFingerprint( accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, parameters = emptyList(), strings = listOf("1.0x"), - literals = listOf(autoNavToggle, autoNavPreviewStub, playerControlPreviousButtonTouchArea, playerControlNextButtonTouchArea), + literals = listOf( + autoNavToggle, + autoNavPreviewStub, + playerControlPreviousButtonTouchArea, + playerControlNextButtonTouchArea + ), ) internal val playbackRateBottomSheetBuilderFingerprint = legacyFingerprint( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/cairo/CairoSettingsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/cairo/CairoSettingsPatch.kt index e0791fcdd..c4474b53f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/cairo/CairoSettingsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/cairo/CairoSettingsPatch.kt @@ -5,7 +5,6 @@ import app.revanced.patches.youtube.misc.backgroundplayback.backgroundPlaybackPa import app.revanced.patches.youtube.utils.playservice.is_19_04_or_greater import app.revanced.patches.youtube.utils.playservice.versionCheckPatch import app.revanced.util.fingerprint.injectLiteralInstructionBooleanCall -import app.revanced.util.fingerprint.resolvable val cairoSettingsPatch = bytecodePatch( description = "cairoSettingsPatch" diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/playbackspeed/PlaybackSpeedWhilePlayingPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/playbackspeed/PlaybackSpeedWhilePlayingPatch.kt index 241f724d7..26e4b110e 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/playbackspeed/PlaybackSpeedWhilePlayingPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/playbackspeed/PlaybackSpeedWhilePlayingPatch.kt @@ -45,7 +45,8 @@ val playbackSpeedWhilePlayingPatch = bytecodePatch( playbackSpeedInFeedsFingerprint.methodOrThrow().apply { val freeRegister = implementation!!.registerCount - parameters.size - 2 val playbackSpeedIndex = indexOfGetPlaybackSpeedInstruction(this) - val playbackSpeedRegister = getInstruction(playbackSpeedIndex).registerA + val playbackSpeedRegister = + getInstruction(playbackSpeedIndex).registerA val jumpIndex = indexOfFirstInstructionOrThrow(playbackSpeedIndex, Opcode.RETURN_VOID) addInstructionsWithLabels( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/playback/VideoPlaybackPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/playback/VideoPlaybackPatch.kt index 2b770a3fb..ccebc248a 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/playback/VideoPlaybackPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/playback/VideoPlaybackPatch.kt @@ -19,8 +19,8 @@ import app.revanced.patches.youtube.utils.flyoutmenu.flyoutMenuHookPatch import app.revanced.patches.youtube.utils.patch.PatchList.VIDEO_PLAYBACK import app.revanced.patches.youtube.utils.playertype.playerTypeHookPatch import app.revanced.patches.youtube.utils.qualityMenuViewInflateFingerprint -import app.revanced.patches.youtube.utils.recyclerview.recyclerViewTreeObserverPatch import app.revanced.patches.youtube.utils.recyclerview.recyclerViewTreeObserverHook +import app.revanced.patches.youtube.utils.recyclerview.recyclerViewTreeObserverPatch import app.revanced.patches.youtube.utils.resourceid.sharedResourceIdPatch import app.revanced.patches.youtube.utils.settings.ResourceUtils.addPreference import app.revanced.patches.youtube.utils.settings.settingsPatch diff --git a/patches/src/main/kotlin/app/revanced/util/ResourceUtils.kt b/patches/src/main/kotlin/app/revanced/util/ResourceUtils.kt index 095e11b71..89cef3780 100644 --- a/patches/src/main/kotlin/app/revanced/util/ResourceUtils.kt +++ b/patches/src/main/kotlin/app/revanced/util/ResourceUtils.kt @@ -123,7 +123,8 @@ fun ResourcePatchContext.copyAdaptiveIcon( } if (adaptiveIconMonoChromeFileName != null && - adaptiveIconMonoChromeFileName != getAdaptiveIconMonoChromeResourceFile()) { + adaptiveIconMonoChromeFileName != getAdaptiveIconMonoChromeResourceFile() + ) { val drawableDirectory = get("res").resolve("drawable") Files.copy( drawableDirectory