diff --git a/extensions/shared/src/main/java/app/revanced/extension/shared/patches/spoof/requests/StreamingDataRequest.kt b/extensions/shared/src/main/java/app/revanced/extension/shared/patches/spoof/requests/StreamingDataRequest.kt index 3c992b00b..cd8f717cb 100644 --- a/extensions/shared/src/main/java/app/revanced/extension/shared/patches/spoof/requests/StreamingDataRequest.kt +++ b/extensions/shared/src/main/java/app/revanced/extension/shared/patches/spoof/requests/StreamingDataRequest.kt @@ -240,7 +240,11 @@ class StreamingDataRequest private constructor( } handleConnectionError(str("revanced_spoof_streaming_data_failed_forbidden"), null, true) - handleConnectionError(str("revanced_spoof_streaming_data_failed_forbidden_suggestion"), null, true) + handleConnectionError( + str("revanced_spoof_streaming_data_failed_forbidden_suggestion"), + null, + true + ) return null } } diff --git a/extensions/shared/src/main/java/app/revanced/extension/youtube/patches/video/PlaybackSpeedPatch.java b/extensions/shared/src/main/java/app/revanced/extension/youtube/patches/video/PlaybackSpeedPatch.java index e731c0b75..58897b35d 100644 --- a/extensions/shared/src/main/java/app/revanced/extension/youtube/patches/video/PlaybackSpeedPatch.java +++ b/extensions/shared/src/main/java/app/revanced/extension/youtube/patches/video/PlaybackSpeedPatch.java @@ -178,7 +178,7 @@ public class PlaybackSpeedPatch { } }, TOAST_DELAY_MILLISECONDS); } - } else if (!isShorts){ + } else if (!isShorts) { lastSelectedPlaybackSpeed = playbackSpeed; } } catch (Exception ex) { diff --git a/extensions/shared/src/main/java/app/revanced/extension/youtube/settings/Settings.java b/extensions/shared/src/main/java/app/revanced/extension/youtube/settings/Settings.java index da959b002..1b0bed356 100644 --- a/extensions/shared/src/main/java/app/revanced/extension/youtube/settings/Settings.java +++ b/extensions/shared/src/main/java/app/revanced/extension/youtube/settings/Settings.java @@ -637,31 +637,31 @@ public class Settings extends BaseSettings { public static final FloatSetting SB_CATEGORY_SPONSOR_OPACITY = new FloatSetting("sb_sponsor_opacity", 0.8f); public static final StringSetting SB_CATEGORY_SELF_PROMO = new StringSetting("sb_selfpromo", SKIP_AUTOMATICALLY.reVancedKeyValue); public static final StringSetting SB_CATEGORY_SELF_PROMO_COLOR = new StringSetting("sb_selfpromo_color", "#FFFF00"); - public static final FloatSetting SB_CATEGORY_SELF_PROMO_OPACITY = new FloatSetting("sb_selfpromo_opacity", 0.8f); + public static final FloatSetting SB_CATEGORY_SELF_PROMO_OPACITY = new FloatSetting("sb_selfpromo_opacity", 0.8f); public static final StringSetting SB_CATEGORY_INTERACTION = new StringSetting("sb_interaction", SKIP_AUTOMATICALLY_ONCE.reVancedKeyValue); public static final StringSetting SB_CATEGORY_INTERACTION_COLOR = new StringSetting("sb_interaction_color", "#CC00FF"); - public static final FloatSetting SB_CATEGORY_INTERACTION_OPACITY = new FloatSetting("sb_interaction_opacity", 0.8f); + public static final FloatSetting SB_CATEGORY_INTERACTION_OPACITY = new FloatSetting("sb_interaction_opacity", 0.8f); public static final StringSetting SB_CATEGORY_HIGHLIGHT = new StringSetting("sb_highlight", MANUAL_SKIP.reVancedKeyValue); public static final StringSetting SB_CATEGORY_HIGHLIGHT_COLOR = new StringSetting("sb_highlight_color", "#FF1684"); - public static final FloatSetting SB_CATEGORY_HIGHLIGHT_OPACITY = new FloatSetting("sb_highlight_opacity", 0.8f); + public static final FloatSetting SB_CATEGORY_HIGHLIGHT_OPACITY = new FloatSetting("sb_highlight_opacity", 0.8f); public static final StringSetting SB_CATEGORY_INTRO = new StringSetting("sb_intro", SKIP_AUTOMATICALLY_ONCE.reVancedKeyValue); public static final StringSetting SB_CATEGORY_INTRO_COLOR = new StringSetting("sb_intro_color", "#00FFFF"); - public static final FloatSetting SB_CATEGORY_INTRO_OPACITY = new FloatSetting("sb_intro_opacity", 0.8f); + public static final FloatSetting SB_CATEGORY_INTRO_OPACITY = new FloatSetting("sb_intro_opacity", 0.8f); public static final StringSetting SB_CATEGORY_OUTRO = new StringSetting("sb_outro", SKIP_AUTOMATICALLY_ONCE.reVancedKeyValue); public static final StringSetting SB_CATEGORY_OUTRO_COLOR = new StringSetting("sb_outro_color", "#0202ED"); - public static final FloatSetting SB_CATEGORY_OUTRO_OPACITY = new FloatSetting("sb_outro_opacity", 0.8f); + public static final FloatSetting SB_CATEGORY_OUTRO_OPACITY = new FloatSetting("sb_outro_opacity", 0.8f); public static final StringSetting SB_CATEGORY_PREVIEW = new StringSetting("sb_preview", SKIP_AUTOMATICALLY_ONCE.reVancedKeyValue); public static final StringSetting SB_CATEGORY_PREVIEW_COLOR = new StringSetting("sb_preview_color", "#008FD6"); - public static final FloatSetting SB_CATEGORY_PREVIEW_OPACITY = new FloatSetting("sb_preview_opacity", 0.8f); + public static final FloatSetting SB_CATEGORY_PREVIEW_OPACITY = new FloatSetting("sb_preview_opacity", 0.8f); public static final StringSetting SB_CATEGORY_FILLER = new StringSetting("sb_filler", SKIP_AUTOMATICALLY_ONCE.reVancedKeyValue); public static final StringSetting SB_CATEGORY_FILLER_COLOR = new StringSetting("sb_filler_color", "#7300FF"); - public static final FloatSetting SB_CATEGORY_FILLER_OPACITY = new FloatSetting("sb_filler_opacity", 0.8f); + public static final FloatSetting SB_CATEGORY_FILLER_OPACITY = new FloatSetting("sb_filler_opacity", 0.8f); public static final StringSetting SB_CATEGORY_MUSIC_OFFTOPIC = new StringSetting("sb_music_offtopic", MANUAL_SKIP.reVancedKeyValue); public static final StringSetting SB_CATEGORY_MUSIC_OFFTOPIC_COLOR = new StringSetting("sb_music_offtopic_color", "#FF9900"); - public static final FloatSetting SB_CATEGORY_MUSIC_OFFTOPIC_OPACITY = new FloatSetting("sb_music_offtopic_opacity", 0.8f); + public static final FloatSetting SB_CATEGORY_MUSIC_OFFTOPIC_OPACITY = new FloatSetting("sb_music_offtopic_opacity", 0.8f); public static final StringSetting SB_CATEGORY_UNSUBMITTED = new StringSetting("sb_unsubmitted", SKIP_AUTOMATICALLY.reVancedKeyValue); public static final StringSetting SB_CATEGORY_UNSUBMITTED_COLOR = new StringSetting("sb_unsubmitted_color", "#FFFFFF"); - public static final FloatSetting SB_CATEGORY_UNSUBMITTED_OPACITY = new FloatSetting("sb_unsubmitted_opacity", 1.0f); + public static final FloatSetting SB_CATEGORY_UNSUBMITTED_OPACITY = new FloatSetting("sb_unsubmitted_opacity", 1.0f); // SB Setting not exported public static final LongSetting SB_LAST_VIP_CHECK = new LongSetting("sb_last_vip_check", 0L, false, false); diff --git a/extensions/shared/src/main/java/app/revanced/extension/youtube/sponsorblock/SponsorBlockUtils.java b/extensions/shared/src/main/java/app/revanced/extension/youtube/sponsorblock/SponsorBlockUtils.java index 3d4da44e9..bee1d6a98 100644 --- a/extensions/shared/src/main/java/app/revanced/extension/youtube/sponsorblock/SponsorBlockUtils.java +++ b/extensions/shared/src/main/java/app/revanced/extension/youtube/sponsorblock/SponsorBlockUtils.java @@ -37,7 +37,6 @@ import app.revanced.extension.youtube.sponsorblock.ui.SponsorBlockViewController /** * Not thread safe. All fields/methods must be accessed from the main thread. - * */ public class SponsorBlockUtils { private static final int LOCKED_COLOR = Color.parseColor("#FFC83D"); diff --git a/extensions/shared/src/main/java/app/revanced/extension/youtube/sponsorblock/objects/SegmentCategory.java b/extensions/shared/src/main/java/app/revanced/extension/youtube/sponsorblock/objects/SegmentCategory.java index fd8360a95..c16fbe3d2 100644 --- a/extensions/shared/src/main/java/app/revanced/extension/youtube/sponsorblock/objects/SegmentCategory.java +++ b/extensions/shared/src/main/java/app/revanced/extension/youtube/sponsorblock/objects/SegmentCategory.java @@ -1,7 +1,36 @@ package app.revanced.extension.youtube.sponsorblock.objects; import static app.revanced.extension.shared.utils.StringRef.sf; -import static app.revanced.extension.youtube.settings.Settings.*; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_FILLER; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_FILLER_COLOR; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_FILLER_OPACITY; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_HIGHLIGHT; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_HIGHLIGHT_COLOR; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_HIGHLIGHT_OPACITY; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_INTERACTION; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_INTERACTION_COLOR; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_INTERACTION_OPACITY; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_INTRO; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_INTRO_COLOR; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_INTRO_OPACITY; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_MUSIC_OFFTOPIC; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_MUSIC_OFFTOPIC_COLOR; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_MUSIC_OFFTOPIC_OPACITY; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_OUTRO; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_OUTRO_COLOR; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_OUTRO_OPACITY; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_PREVIEW; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_PREVIEW_COLOR; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_PREVIEW_OPACITY; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_SELF_PROMO; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_SELF_PROMO_COLOR; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_SELF_PROMO_OPACITY; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_SPONSOR; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_SPONSOR_COLOR; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_SPONSOR_OPACITY; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_UNSUBMITTED; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_UNSUBMITTED_COLOR; +import static app.revanced.extension.youtube.settings.Settings.SB_CATEGORY_UNSUBMITTED_OPACITY; import android.graphics.Color; import android.graphics.Paint; @@ -56,7 +85,6 @@ public enum SegmentCategory { SB_CATEGORY_MUSIC_OFFTOPIC, SB_CATEGORY_MUSIC_OFFTOPIC_COLOR, SB_CATEGORY_MUSIC_OFFTOPIC_OPACITY), UNSUBMITTED("unsubmitted", StringRef.empty, sf("revanced_sb_skip_button_unsubmitted"), sf("revanced_sb_skipped_unsubmitted"), SB_CATEGORY_UNSUBMITTED, SB_CATEGORY_UNSUBMITTED_COLOR, SB_CATEGORY_UNSUBMITTED_OPACITY); - ; private static final StringRef skipSponsorTextCompact = sf("revanced_sb_skip_button_compact"); private static final StringRef skipSponsorTextCompactHighlight = sf("revanced_sb_skip_button_compact_highlight"); diff --git a/extensions/shared/src/main/java/app/revanced/extension/youtube/swipecontrols/views/SwipeControlsOverlayLayout.kt b/extensions/shared/src/main/java/app/revanced/extension/youtube/swipecontrols/views/SwipeControlsOverlayLayout.kt index edc936b75..f3ba568b5 100644 --- a/extensions/shared/src/main/java/app/revanced/extension/youtube/swipecontrols/views/SwipeControlsOverlayLayout.kt +++ b/extensions/shared/src/main/java/app/revanced/extension/youtube/swipecontrols/views/SwipeControlsOverlayLayout.kt @@ -145,8 +145,10 @@ class SwipeControlsOverlayLayout( addView(feedbackTextView) // get icons scaled, assuming square icons val iconHeight = round(feedbackTextView.lineHeight * .8).toInt() - autoBrightnessIcon = getDrawable("revanced_ic_sc_brightness_auto", iconHeight, iconHeight) - manualBrightnessIcon = getDrawable("revanced_ic_sc_brightness_manual", iconHeight, iconHeight) + autoBrightnessIcon = + getDrawable("revanced_ic_sc_brightness_auto", iconHeight, iconHeight) + manualBrightnessIcon = + getDrawable("revanced_ic_sc_brightness_manual", iconHeight, iconHeight) mutedVolumeIcon = getDrawable("revanced_ic_sc_volume_mute", iconHeight, iconHeight) normalVolumeIcon = getDrawable("revanced_ic_sc_volume_normal", iconHeight, iconHeight) } @@ -186,11 +188,18 @@ class SwipeControlsOverlayLayout( /** * Displays the progress bar with the appropriate value, icon, and type (brightness or volume). */ - private fun showFeedbackView(value: String, progress: Int, max: Int, icon: Drawable, isBrightness: Boolean) { + private fun showFeedbackView( + value: String, + progress: Int, + max: Int, + icon: Drawable, + isBrightness: Boolean + ) { feedbackHideHandler.removeCallbacks(feedbackHideCallback) feedbackHideHandler.postDelayed(feedbackHideCallback, config.overlayShowTimeoutMillis) - val viewToShow = if (config.isCircularProgressBar) circularProgressView else horizontalProgressView + val viewToShow = + if (config.isCircularProgressBar) circularProgressView else horizontalProgressView viewToShow.apply { setProgress(progress, max, value, isBrightness) this.icon = icon @@ -241,7 +250,13 @@ class SwipeControlsOverlayLayout( brightnessValue < 75 -> highBrightnessIcon else -> fullBrightnessIcon } - showFeedbackView("$brightnessValue%", brightnessValue, 100, icon, isBrightness = true) + showFeedbackView( + "$brightnessValue%", + brightnessValue, + 100, + icon, + isBrightness = true + ) } else { showFeedbackView("${round(brightness).toInt()}%", manualBrightnessIcon) } @@ -274,7 +289,12 @@ abstract class AbstractProgressView( ) : View(context, attrs, defStyleAttr) { // Combined paint creation function for both fill and stroke styles - private fun createPaint(color: Int, style: Paint.Style = Paint.Style.FILL, strokeCap: Paint.Cap = Paint.Cap.BUTT, strokeWidth: Float = 0f) = Paint(Paint.ANTI_ALIAS_FLAG).apply { + private fun createPaint( + color: Int, + style: Paint.Style = Paint.Style.FILL, + strokeCap: Paint.Cap = Paint.Cap.BUTT, + strokeWidth: Float = 0f + ) = Paint(Paint.ANTI_ALIAS_FLAG).apply { this.style = style this.color = color this.strokeCap = strokeCap @@ -282,13 +302,18 @@ abstract class AbstractProgressView( } // Initialize paints - val backgroundPaint = createPaint(overlayBackgroundOpacity, style = Paint.Style.FILL) - val progressPaint = createPaint(overlayProgressColor, style = Paint.Style.STROKE, strokeCap = Paint.Cap.ROUND, strokeWidth = 20f) + val backgroundPaint = createPaint(overlayBackgroundOpacity, style = Paint.Style.FILL) + val progressPaint = createPaint( + overlayProgressColor, + style = Paint.Style.STROKE, + strokeCap = Paint.Cap.ROUND, + strokeWidth = 20f + ) val fillBackgroundPaint = createPaint(overlayFillBackgroundPaint, style = Paint.Style.FILL) - val textPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply { - color = overlayTextColor + val textPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply { + color = overlayTextColor textAlign = Paint.Align.CENTER - textSize = 40f // Can adjust based on need + textSize = 40f // Can adjust based on need } protected var progress = 0 @@ -337,11 +362,11 @@ class CircularProgressView( init { textPaint.textSize = 40f // Override default text size for circular view - progressPaint.strokeWidth = 20f + progressPaint.strokeWidth = 20f fillBackgroundPaint.strokeWidth = 20f - progressPaint.strokeCap = Paint.Cap.ROUND + progressPaint.strokeCap = Paint.Cap.ROUND fillBackgroundPaint.strokeCap = Paint.Cap.BUTT - progressPaint.style = Paint.Style.STROKE + progressPaint.style = Paint.Style.STROKE fillBackgroundPaint.style = Paint.Style.STROKE } @@ -352,7 +377,12 @@ class CircularProgressView( rectF.set(20f, 20f, size - 20f, size - 20f) canvas.drawOval(rectF, fillBackgroundPaint) // Draw the outer ring. - canvas.drawCircle(width / 2f, height / 2f, size / 3, backgroundPaint) // Draw the inner circle. + canvas.drawCircle( + width / 2f, + height / 2f, + size / 3, + backgroundPaint + ) // Draw the inner circle. // Select the paint for drawing based on whether it's brightness or volume. val sweepAngle = (progress.toFloat() / maxProgress) * 360 @@ -399,13 +429,13 @@ class HorizontalProgressView( ) { private val iconSize = 60f - private val padding = 40f + private val padding = 40f init { - textPaint.textSize = 36f // Override default text size for horizontal view + textPaint.textSize = 36f // Override default text size for horizontal view progressPaint.strokeWidth = 0f - progressPaint.strokeCap = Paint.Cap.BUTT - progressPaint.style = Paint.Style.FILL + progressPaint.strokeCap = Paint.Cap.BUTT + progressPaint.style = Paint.Style.FILL fillBackgroundPaint.style = Paint.Style.FILL } @@ -428,7 +458,15 @@ class HorizontalProgressView( if (!overlayShowOverlayMinimalStyle) { canvas.drawRoundRect(0f, 0f, width, height, cornerRadius, cornerRadius, backgroundPaint) } else { - canvas.drawRoundRect(minimalStartX, 0f, minimalStartX + minimalElementWidth, height, cornerRadius, cornerRadius, backgroundPaint) + canvas.drawRoundRect( + minimalStartX, + 0f, + minimalStartX + minimalElementWidth, + height, + cornerRadius, + cornerRadius, + backgroundPaint + ) } if (!overlayShowOverlayMinimalStyle) { @@ -466,7 +504,12 @@ class HorizontalProgressView( padding + minimalStartX } val iconY = height / 2 - iconSize / 2 - it.setBounds(iconX.toInt(), iconY.toInt(), (iconX + iconSize).toInt(), (iconY + iconSize).toInt()) + it.setBounds( + iconX.toInt(), + iconY.toInt(), + (iconX + iconSize).toInt(), + (iconY + iconSize).toInt() + ) it.draw(canvas) } diff --git a/patches/src/main/kotlin/app/revanced/patches/all/misc/connectivity/wifi/spoof/SpoofWifiPatch.kt b/patches/src/main/kotlin/app/revanced/patches/all/misc/connectivity/wifi/spoof/SpoofWifiPatch.kt index 3758030cd..354e91f3e 100644 --- a/patches/src/main/kotlin/app/revanced/patches/all/misc/connectivity/wifi/spoof/SpoofWifiPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/all/misc/connectivity/wifi/spoof/SpoofWifiPatch.kt @@ -152,7 +152,10 @@ private enum class MethodCall( RegisterNetworkCallback1( "Landroid/net/ConnectivityManager;", "registerNetworkCallback", - arrayOf("Landroid/net/NetworkRequest;", "Landroid/net/ConnectivityManager\$NetworkCallback;"), + arrayOf( + "Landroid/net/NetworkRequest;", + "Landroid/net/ConnectivityManager\$NetworkCallback;" + ), "V", ), RegisterNetworkCallback2( @@ -174,13 +177,20 @@ private enum class MethodCall( RequestNetwork1( "Landroid/net/ConnectivityManager;", "requestNetwork", - arrayOf("Landroid/net/NetworkRequest;", "Landroid/net/ConnectivityManager\$NetworkCallback;"), + arrayOf( + "Landroid/net/NetworkRequest;", + "Landroid/net/ConnectivityManager\$NetworkCallback;" + ), "V", ), RequestNetwork2( "Landroid/net/ConnectivityManager;", "requestNetwork", - arrayOf("Landroid/net/NetworkRequest;", "Landroid/net/ConnectivityManager\$NetworkCallback;", "I"), + arrayOf( + "Landroid/net/NetworkRequest;", + "Landroid/net/ConnectivityManager\$NetworkCallback;", + "I" + ), "V", ), RequestNetwork3( diff --git a/patches/src/main/kotlin/app/revanced/patches/all/misc/display/edgetoedge/EdgeToEdgeDisplayPatch.kt b/patches/src/main/kotlin/app/revanced/patches/all/misc/display/edgetoedge/EdgeToEdgeDisplayPatch.kt index a3ae247a1..9fdb3fd84 100644 --- a/patches/src/main/kotlin/app/revanced/patches/all/misc/display/edgetoedge/EdgeToEdgeDisplayPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/all/misc/display/edgetoedge/EdgeToEdgeDisplayPatch.kt @@ -19,7 +19,8 @@ val edgeToEdgeDisplayPatch = resourcePatch( // Instead, it checks compileSdkVersion and prints a warning. try { val manifestElement = document.getNode("manifest") as Element - val compileSdkVersion = Integer.parseInt(manifestElement.getAttribute("android:compileSdkVersion")) + val compileSdkVersion = + Integer.parseInt(manifestElement.getAttribute("android:compileSdkVersion")) if (compileSdkVersion < 35) { printWarn("This app may not be forcing edge to edge display (compileSdkVersion: $compileSdkVersion)") } diff --git a/patches/src/main/kotlin/app/revanced/patches/music/account/components/AccountComponentsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/account/components/AccountComponentsPatch.kt index 2ac49689b..f5a9970cd 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/account/components/AccountComponentsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/account/components/AccountComponentsPatch.kt @@ -88,7 +88,7 @@ val accountComponentsPatch = bytecodePatch( } // account switcher - val textViewField = with ( + val textViewField = with( channelHandleFingerprint .methodOrThrow(namesInactiveAccountThumbnailSizeFingerprint) ) { @@ -117,7 +117,8 @@ val accountComponentsPatch = bytecodePatch( .forEach { index -> val insertIndex = index - 1 if (!hook && getInstruction(insertIndex).opcode == Opcode.IF_NEZ) { - val insertRegister = getInstruction(insertIndex).registerA + val insertRegister = + getInstruction(insertIndex).registerA addInstructions( insertIndex, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/music/ads/general/AdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/ads/general/AdsPatch.kt index 23df8ddbd..84381b787 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/ads/general/AdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/ads/general/AdsPatch.kt @@ -115,7 +115,8 @@ val adsPatch = bytecodePatch( .methodOrThrow(getPremiumDialogParentFingerprint) .apply { val setContentViewIndex = indexOfSetContentViewInstruction(this) - val dialogInstruction = getInstruction(setContentViewIndex) + val dialogInstruction = + getInstruction(setContentViewIndex) val dialogRegister = dialogInstruction.registerC val viewRegister = dialogInstruction.registerD diff --git a/patches/src/main/kotlin/app/revanced/patches/music/layout/header/ChangeHeaderPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/layout/header/ChangeHeaderPatch.kt index 7d0b38f5a..3ae23745c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/layout/header/ChangeHeaderPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/layout/header/ChangeHeaderPatch.kt @@ -206,7 +206,8 @@ val changeHeaderPatch = resourcePatch( printWarn(warnings) } - val isLegacyLogoExists = get("res").resolve("drawable-xxhdpi").resolve("ytm_logo.png").exists() + val isLegacyLogoExists = + get("res").resolve("drawable-xxhdpi").resolve("ytm_logo.png").exists() if (is_7_27_or_greater && isLegacyLogoExists) { document("res/layout/signin_fragment.xml").use { document -> document.doRecursively node@{ node -> diff --git a/patches/src/main/kotlin/app/revanced/patches/music/misc/watchhistory/WatchHistoryPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/misc/watchhistory/WatchHistoryPatch.kt index fdc321bca..9eb30851d 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/misc/watchhistory/WatchHistoryPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/misc/watchhistory/WatchHistoryPatch.kt @@ -1,13 +1,13 @@ package app.revanced.patches.music.misc.watchhistory import app.revanced.patcher.patch.bytecodePatch -import app.revanced.patches.shared.trackingurlhook.hookWatchHistory -import app.revanced.patches.shared.trackingurlhook.trackingUrlHookPatch import app.revanced.patches.music.utils.compatibility.Constants.COMPATIBLE_PACKAGE import app.revanced.patches.music.utils.patch.PatchList.WATCH_HISTORY import app.revanced.patches.music.utils.settings.CategoryType import app.revanced.patches.music.utils.settings.addPreferenceWithIntent import app.revanced.patches.music.utils.settings.settingsPatch +import app.revanced.patches.shared.trackingurlhook.hookWatchHistory +import app.revanced.patches.shared.trackingurlhook.trackingUrlHookPatch @Suppress("unused") val watchHistoryPatch = bytecodePatch( diff --git a/patches/src/main/kotlin/app/revanced/patches/music/navigation/components/NavigationBarComponentsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/navigation/components/NavigationBarComponentsPatch.kt index e4b459e25..8cc05af21 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/navigation/components/NavigationBarComponentsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/navigation/components/NavigationBarComponentsPatch.kt @@ -124,14 +124,17 @@ val navigationBarComponentsPatch = bytecodePatch( opcode == Opcode.IGET_OBJECT && getReference()?.type == "Ljava/lang/String;" } - val browseIdReference = getInstruction(browseIdIndex).reference as FieldReference + val browseIdReference = + getInstruction(browseIdIndex).reference as FieldReference val fieldName = browseIdReference.name val componentIndex = indexOfFirstInstructionOrThrow(stringIndex) { opcode == Opcode.IGET_OBJECT && getReference()?.toString() == browseIdReference.toString() } - val browseIdRegister = getInstruction(componentIndex).registerA - val componentRegister = getInstruction(componentIndex).registerB + val browseIdRegister = + getInstruction(componentIndex).registerA + val componentRegister = + getInstruction(componentIndex).registerB val enumIndex = it.patternMatch!!.startIndex + 3 val enumRegister = getInstruction(enumIndex).registerA diff --git a/patches/src/main/kotlin/app/revanced/patches/music/player/components/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/music/player/components/Fingerprints.kt index 20921e3c4..be66489ad 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/player/components/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/player/components/Fingerprints.kt @@ -54,7 +54,7 @@ internal val engagementPanelHeightFingerprint = legacyFingerprint( parameters = emptyList(), customFingerprint = { method, _ -> AccessFlags.FINAL.isSet(method.accessFlags) && - method.containsLiteralInstruction(1) && + method.containsLiteralInstruction(1) && method.indexOfFirstInstruction { opcode == Opcode.INVOKE_VIRTUAL && getReference()?.name == "booleanValue" diff --git a/patches/src/main/kotlin/app/revanced/patches/music/player/components/PlayerComponentsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/player/components/PlayerComponentsPatch.kt index a14bb20e7..cbc3ceffe 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/player/components/PlayerComponentsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/player/components/PlayerComponentsPatch.kt @@ -747,7 +747,8 @@ val playerComponentsPatch = bytecodePatch( getInstruction(bottomSheetBehaviorIndex).registerD val getFieldIndex = bottomSheetBehaviorIndex - 2 - val getFieldReference = getInstruction(getFieldIndex).reference + val getFieldReference = + getInstruction(getFieldIndex).reference val getFieldInstruction = getInstruction(getFieldIndex) addInstructionsWithLabels( diff --git a/patches/src/main/kotlin/app/revanced/patches/music/utils/fix/client/SpoofClientPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/utils/fix/client/SpoofClientPatch.kt index 1cc9eb807..2a77ff5d3 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/utils/fix/client/SpoofClientPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/utils/fix/client/SpoofClientPatch.kt @@ -22,7 +22,6 @@ import app.revanced.patches.music.utils.settings.ResourceUtils.updatePatchStatus import app.revanced.patches.music.utils.settings.addPreferenceWithIntent import app.revanced.patches.music.utils.settings.addSwitchPreference import app.revanced.patches.music.utils.settings.settingsPatch -import app.revanced.patches.shared.spoof.blockrequest.blockRequestPatch import app.revanced.patches.shared.createPlayerRequestBodyWithModelFingerprint import app.revanced.patches.shared.customspeed.customPlaybackSpeedPatch import app.revanced.patches.shared.extension.Constants.PATCHES_PATH @@ -31,6 +30,7 @@ import app.revanced.patches.shared.indexOfBrandInstruction import app.revanced.patches.shared.indexOfManufacturerInstruction import app.revanced.patches.shared.indexOfModelInstruction import app.revanced.patches.shared.indexOfReleaseInstruction +import app.revanced.patches.shared.spoof.blockrequest.blockRequestPatch import app.revanced.util.findMethodOrThrow import app.revanced.util.fingerprint.injectLiteralInstructionBooleanCall import app.revanced.util.fingerprint.matchOrThrow diff --git a/patches/src/main/kotlin/app/revanced/patches/music/utils/resourceid/SharedResourceIdPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/utils/resourceid/SharedResourceIdPatch.kt index 3e7d4187b..7d0682188 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/utils/resourceid/SharedResourceIdPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/utils/resourceid/SharedResourceIdPatch.kt @@ -142,7 +142,8 @@ internal val sharedResourceIdPatch = resourcePatch( endButtonsContainer = getResourceId(ID, "end_buttons_container") floatingLayout = getResourceId(ID, "floating_layout") historyMenuItem = getResourceId(ID, "history_menu_item") - inlineTimeBarAdBreakMarkerColor = getResourceId(COLOR, "inline_time_bar_ad_break_marker_color") + inlineTimeBarAdBreakMarkerColor = + getResourceId(COLOR, "inline_time_bar_ad_break_marker_color") inlineTimeBarProgressColor = getResourceId(COLOR, "inline_time_bar_progress_color") interstitialsContainer = getResourceId(ID, "interstitials_container") isTablet = getResourceId(BOOL, "is_tablet") @@ -156,7 +157,8 @@ internal val sharedResourceIdPatch = resourcePatch( modernDialogBackground = getResourceId(DRAWABLE, "modern_dialog_background") musicNotifierShelf = getResourceId(LAYOUT, "music_notifier_shelf") musicTasteBuilderShelf = getResourceId(LAYOUT, "music_tastebuilder_shelf") - namesInactiveAccountThumbnailSize = getResourceId(DIMEN, "names_inactive_account_thumbnail_size") + namesInactiveAccountThumbnailSize = + getResourceId(DIMEN, "names_inactive_account_thumbnail_size") offlineSettingsMenuItem = getResourceId(ID, "offline_settings_menu_item") playerOverlayChip = getResourceId(ID, "player_overlay_chip") playerViewPager = getResourceId(ID, "player_view_pager") diff --git a/patches/src/main/kotlin/app/revanced/patches/music/utils/videotype/VideoTypeHookPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/utils/videotype/VideoTypeHookPatch.kt index bc0ec4167..dc4643d26 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/utils/videotype/VideoTypeHookPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/utils/videotype/VideoTypeHookPatch.kt @@ -25,7 +25,8 @@ val videoTypeHookPatch = bytecodePatch( videoTypeFingerprint.methodOrThrow(videoTypeParentFingerprint).apply { val getEnumIndex = indexOfGetEnumInstruction(this) - val enumClass = (getInstruction(getEnumIndex).reference as MethodReference).definingClass + val enumClass = + (getInstruction(getEnumIndex).reference as MethodReference).definingClass val referenceIndex = indexOfFirstInstructionOrThrow(getEnumIndex) { opcode == Opcode.SGET_OBJECT && getReference()?.type == enumClass diff --git a/patches/src/main/kotlin/app/revanced/patches/music/video/playerresponse/PlayerResponseMethodHookPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/video/playerresponse/PlayerResponseMethodHookPatch.kt index 85e51a62b..647b9cc2b 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/video/playerresponse/PlayerResponseMethodHookPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/video/playerresponse/PlayerResponseMethodHookPatch.kt @@ -71,7 +71,8 @@ val playerResponseMethodHookPatch = bytecodePatch( val beforeVideoIdHooks = hooks.filterIsInstance().asReversed() val videoIdHooks = hooks.filterIsInstance().asReversed() - val videoIdAndPlaylistIdHooks = hooks.filterIsInstance().asReversed() + val videoIdAndPlaylistIdHooks = + hooks.filterIsInstance().asReversed() val afterVideoIdHooks = hooks.filterIsInstance().asReversed() // Add the hooks in this specific order as they insert instructions at the beginning of the method. 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 473e2498d..4ab992ec7 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 @@ -56,7 +56,8 @@ val navigationButtonsPatch = bytecodePatch( if (bottomNavScreenFingerprint.resolvable()) { val bottomNavScreenMutableClass = with(bottomNavScreenFingerprint.methodOrThrow()) { val startIndex = indexOfGetDimensionPixelSizeInstruction(this) - val targetIndex = indexOfFirstInstructionOrThrow(startIndex, Opcode.NEW_INSTANCE) + val targetIndex = + indexOfFirstInstructionOrThrow(startIndex, Opcode.NEW_INSTANCE) val targetReference = getInstruction(targetIndex).reference.toString() @@ -65,7 +66,9 @@ val navigationButtonsPatch = bytecodePatch( ?: throw ClassNotFoundException("Failed to find class $targetReference") } - bottomNavScreenOnGlobalLayoutFingerprint.second.matchOrNull(bottomNavScreenMutableClass) + bottomNavScreenOnGlobalLayoutFingerprint.second.matchOrNull( + bottomNavScreenMutableClass + ) ?.let { it.method.apply { val startIndex = it.patternMatch!!.startIndex @@ -82,7 +85,8 @@ val navigationButtonsPatch = bytecodePatch( // Legacy method. bottomNavScreenHandlerFingerprint.methodOrThrow().apply { val targetIndex = indexOfGetItemsInstruction(this) + 1 - val targetRegister = getInstruction(targetIndex).registerA + val targetRegister = + getInstruction(targetIndex).registerA addInstructions( targetIndex + 1, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/layout/subredditdialog/SubRedditDialogPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/layout/subredditdialog/SubRedditDialogPatch.kt index 7d51cb4a0..ccd7e4064 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/layout/subredditdialog/SubRedditDialogPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/layout/subredditdialog/SubRedditDialogPatch.kt @@ -42,7 +42,8 @@ val subRedditDialogPatch = bytecodePatch( .apply { listOfIsLoggedInInstruction(this) .forEach { index -> - val register = getInstruction(index + 1).registerA + val register = + getInstruction(index + 1).registerA addInstructions( index + 2, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/ads/BaseAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/ads/BaseAdsPatch.kt index 55f2354d3..16c749ce0 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/ads/BaseAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/ads/BaseAdsPatch.kt @@ -62,7 +62,7 @@ fun baseAdsPatch( ) } - val getAdvertisingIdMethod = with (advertisingIdFingerprint.methodOrThrow()) { + val getAdvertisingIdMethod = with(advertisingIdFingerprint.methodOrThrow()) { val getAdvertisingIdIndex = indexOfGetAdvertisingIdInstruction(this) getWalkerMethod(getAdvertisingIdIndex) } diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/gms/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/shared/gms/Fingerprints.kt index 952b0c350..1e79c58e2 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/gms/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/gms/Fingerprints.kt @@ -6,8 +6,6 @@ import app.revanced.util.indexOfFirstInstruction import app.revanced.util.or import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode -import com.android.tools.smali.dexlib2.iface.Method -import com.android.tools.smali.dexlib2.iface.reference.MethodReference import com.android.tools.smali.dexlib2.iface.reference.StringReference import com.android.tools.smali.dexlib2.util.MethodUtil diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/gms/GmsCoreSupportPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/gms/GmsCoreSupportPatch.kt index 0a5d12a9a..9fb601010 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/gms/GmsCoreSupportPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/gms/GmsCoreSupportPatch.kt @@ -83,9 +83,9 @@ fun gmsCoreSupportPatch( key = "gmsCoreVendorGroupId", default = "app.revanced", values = - mapOf( - "ReVanced" to "app.revanced", - ), + mapOf( + "ReVanced" to "app.revanced", + ), title = "GmsCore vendor group ID", description = "The vendor's group ID for GmsCore.", required = true, diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/mapping/ResourceMappingPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/mapping/ResourceMappingPatch.kt index 4e881a0e8..03c4b24af 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/mapping/ResourceMappingPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/mapping/ResourceMappingPatch.kt @@ -1,6 +1,5 @@ package app.revanced.patches.shared.mapping -import app.revanced.patcher.patch.PatchException import app.revanced.patcher.patch.resourcePatch import org.w3c.dom.Element diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/translations/BaseTranslationsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/translations/BaseTranslationsPatch.kt index 82ca978e6..39e251e22 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/translations/BaseTranslationsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/translations/BaseTranslationsPatch.kt @@ -147,7 +147,8 @@ fun ResourcePatchContext.baseTranslationsPatch( val length = text.length if (!text.endsWith("DEFAULT") && length >= 2 && - text.subSequence(length - 2, length) !in filteredAppLanguages) { + text.subSequence(length - 2, length) !in filteredAppLanguages + ) { nodesToRemove.add(item) } } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/feed/components/FeedComponentsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/feed/components/FeedComponentsPatch.kt index 655606d54..736e1d580 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/feed/components/FeedComponentsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/feed/components/FeedComponentsPatch.kt @@ -262,8 +262,10 @@ val feedComponentsPatch = bytecodePatch( val insertIndex = indexOfBufferParserInstruction(this) if (is_19_46_or_greater) { - val objectIndex = indexOfFirstInstructionReversedOrThrow(insertIndex, Opcode.IGET_OBJECT) - val objectRegister = getInstruction(objectIndex).registerA + val objectIndex = + indexOfFirstInstructionReversedOrThrow(insertIndex, Opcode.IGET_OBJECT) + val objectRegister = + getInstruction(objectIndex).registerA addInstructionsWithLabels( insertIndex, """ @@ -275,7 +277,8 @@ val feedComponentsPatch = bytecodePatch( ) } else { val objectIndex = indexOfFirstInstructionOrThrow(Opcode.MOVE_OBJECT) - val objectRegister = getInstruction(objectIndex).registerA + val objectRegister = + getInstruction(objectIndex).registerA val jumpIndex = it.patternMatch!!.startIndex addInstructionsWithLabels( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/general/livering/OpenChannelOfLiveAvatarPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/general/livering/OpenChannelOfLiveAvatarPatch.kt index cb105e27d..fa987061f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/general/livering/OpenChannelOfLiveAvatarPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/general/livering/OpenChannelOfLiveAvatarPatch.kt @@ -90,7 +90,8 @@ val openChannelOfLiveAvatarPatch = bytecodePatch( ) val playbackStartIndex = indexOfPlaybackStartDescriptorInstruction(this) + 1 - val playbackStartRegister = getInstruction(playbackStartIndex).registerA + val playbackStartRegister = + getInstruction(playbackStartIndex).registerA val mapIndex = indexOfFirstInstructionOrThrow(playbackStartIndex) { val reference = getReference() @@ -169,15 +170,24 @@ val openChannelOfLiveAvatarPatch = bytecodePatch( val playbackStartIndex = indexOfFirstInstructionOrThrow { getReference()?.returnType == PLAYBACK_START_DESCRIPTOR_CLASS_DESCRIPTOR } - val mapIndex = indexOfFirstInstructionReversedOrThrow(playbackStartIndex, Opcode.IPUT) + val mapIndex = + indexOfFirstInstructionReversedOrThrow(playbackStartIndex, Opcode.IPUT) val mapRegister = getInstruction(mapIndex).registerA - val playbackStartRegister = getInstruction(playbackStartIndex + 1).registerA - val videoIdRegister = getInstruction(playbackStartIndex).registerC + val playbackStartRegister = + getInstruction(playbackStartIndex + 1).registerA + val videoIdRegister = + getInstruction(playbackStartIndex).registerC addInstructionsWithLabels( playbackStartIndex + 2, """ move-object/from16 v$mapRegister, p2 - ${fetchChannelIdInstructions(playbackStartRegister, mapRegister, videoIdRegister)} + ${ + fetchChannelIdInstructions( + playbackStartRegister, + mapRegister, + videoIdRegister + ) + } """ ) } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/general/snackbar/SnackBarComponentsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/general/snackbar/SnackBarComponentsPatch.kt index 83821d0e9..1ae0ee983 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/general/snackbar/SnackBarComponentsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/general/snackbar/SnackBarComponentsPatch.kt @@ -80,7 +80,8 @@ private val snackBarComponentsBytecodePatch = bytecodePatch( bottomUiContainerThemeFingerprint.matchOrThrow().let { it.method.apply { val darkThemeIndex = it.patternMatch!!.startIndex + 2 - val darkThemeReference = getInstruction(darkThemeIndex).reference.toString() + val darkThemeReference = + getInstruction(darkThemeIndex).reference.toString() implementation!!.instructions .withIndex() @@ -91,7 +92,8 @@ private val snackBarComponentsBytecodePatch = bytecodePatch( .map { (index, _) -> index } .reversed() .forEach { index -> - val appThemeIndex = indexOfFirstInstructionReversedOrThrow(index, Opcode.MOVE_RESULT_OBJECT) + val appThemeIndex = + indexOfFirstInstructionReversedOrThrow(index, Opcode.MOVE_RESULT_OBJECT) val appThemeRegister = getInstruction(appThemeIndex).registerA val darkThemeRegister = 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 af1a960b9..6cb122b1d 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 @@ -86,7 +86,11 @@ val shortsActionButtonsPatch = resourcePatch( // Some directory is missing in the bundles. if (inputStreamForLegacy != null && fromFileResolved.exists()) { - Files.copy(inputStreamForLegacy, fromFileResolved.toPath(), StandardCopyOption.REPLACE_EXISTING) + Files.copy( + inputStreamForLegacy, + fromFileResolved.toPath(), + StandardCopyOption.REPLACE_EXISTING + ) } if (is_19_36_or_greater) { @@ -95,7 +99,11 @@ val shortsActionButtonsPatch = resourcePatch( // Some directory is missing in the bundles. if (inputStreamForNew != null && toFileResolved.exists()) { - Files.copy(inputStreamForNew, toFileResolved.toPath(), StandardCopyOption.REPLACE_EXISTING) + Files.copy( + inputStreamForNew, + toFileResolved.toPath(), + 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 d9d8d93b8..1ccc3e575 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 @@ -249,7 +249,10 @@ val customBrandingIconPatch = resourcePatch( style.setAttribute("parent", nodeAttributeParent) val splashScreenAnimatedIcon = document.createElement("item") - splashScreenAnimatedIcon.setAttribute("name", "android:windowSplashScreenAnimatedIcon") + splashScreenAnimatedIcon.setAttribute( + "name", + "android:windowSplashScreenAnimatedIcon" + ) splashScreenAnimatedIcon.textContent = "@drawable/avd_anim" // Deprecated in Android 13+ @@ -258,10 +261,11 @@ val customBrandingIconPatch = resourcePatch( "name", "android:windowSplashScreenAnimationDuration" ) - splashScreenAnimationDuration.textContent = if (appIcon.startsWith("revancify")) - "1500" - else - "1000" + splashScreenAnimationDuration.textContent = + if (appIcon.startsWith("revancify")) + "1500" + else + "1000" style.appendChild(splashScreenAnimatedIcon) style.appendChild(splashScreenAnimationDuration) 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 a27467bcd..cdee030cd 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 @@ -61,8 +61,10 @@ val sharedThemePatch = resourcePatch( 0 -> when (nodeAttributeName) { "Base.Theme.YouTube.Launcher.Dark", "Base.Theme.YouTube.Launcher.Cairo.Dark" -> "@color/yt_black1" + "Base.Theme.YouTube.Launcher.Light", "Base.Theme.YouTube.Launcher.Cairo.Light" -> "@color/yt_white1" + else -> "null" } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/accessibility/AccessibilityPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/accessibility/AccessibilityPatch.kt index cf0098362..8a2fd8dde 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/accessibility/AccessibilityPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/accessibility/AccessibilityPatch.kt @@ -32,8 +32,10 @@ val accessibilityPatch = bytecodePatch( .methods .first { method -> method.name == "" } .apply { - val lifecycleObserverIndex = indexOfFirstInstructionReversedOrThrow(Opcode.NEW_INSTANCE) - val lifecycleObserverClass = getInstruction(lifecycleObserverIndex).reference.toString() + val lifecycleObserverIndex = + indexOfFirstInstructionReversedOrThrow(Opcode.NEW_INSTANCE) + val lifecycleObserverClass = + getInstruction(lifecycleObserverIndex).reference.toString() findMethodOrThrow(lifecycleObserverClass) { accessFlags == AccessFlags.PUBLIC or AccessFlags.FINAL && 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 c6380be34..4865bfbc1 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 @@ -85,17 +85,19 @@ val backgroundPlaybackPatch = bytecodePatch( backgroundPlaybackManagerCairoFragmentPrimaryFingerprint, backgroundPlaybackManagerCairoFragmentSecondaryFingerprint ).forEach { fingerprint -> - fingerprint.matchOrThrow(backgroundPlaybackManagerCairoFragmentParentFingerprint).let { - it.method.apply { - val insertIndex = it.patternMatch!!.startIndex + 4 - val insertRegister = getInstruction(insertIndex).registerA + fingerprint.matchOrThrow(backgroundPlaybackManagerCairoFragmentParentFingerprint) + .let { + it.method.apply { + val insertIndex = it.patternMatch!!.startIndex + 4 + val insertRegister = + getInstruction(insertIndex).registerA - addInstruction( - insertIndex, - "const/4 v$insertRegister, 0x0" - ) + addInstruction( + insertIndex, + "const/4 v$insertRegister, 0x0" + ) + } } - } } pipInputConsumerFeatureFlagFingerprint.injectLiteralInstructionBooleanCall( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/player/action/ActionButtonsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/player/action/ActionButtonsPatch.kt index ce57443ec..692b78489 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/player/action/ActionButtonsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/player/action/ActionButtonsPatch.kt @@ -57,20 +57,26 @@ val actionButtonsPatch = bytecodePatch( findMethodOrThrow(parameters[1].type) { name == "toString" } - val identifierReference = with (conversionContextToStringMethod) { + val identifierReference = with(conversionContextToStringMethod) { val identifierStringIndex = indexOfFirstStringInstructionOrThrow(", identifierProperty=") val identifierStringAppendIndex = indexOfFirstInstructionOrThrow(identifierStringIndex, Opcode.INVOKE_VIRTUAL) - val identifierStringAppendIndexRegister = getInstruction(identifierStringAppendIndex).registerD + val identifierStringAppendIndexRegister = + getInstruction(identifierStringAppendIndex).registerD val identifierAppendIndex = - indexOfFirstInstructionOrThrow(identifierStringAppendIndex + 1, Opcode.INVOKE_VIRTUAL) - val identifierRegister = getInstruction(identifierAppendIndex).registerD - val identifierIndex = indexOfFirstInstructionReversedOrThrow(identifierAppendIndex) { - opcode == Opcode.IGET_OBJECT && - getReference()?.type == "Ljava/lang/String;" && - (this as? TwoRegisterInstruction)?.registerA == identifierRegister - } + indexOfFirstInstructionOrThrow( + identifierStringAppendIndex + 1, + Opcode.INVOKE_VIRTUAL + ) + val identifierRegister = + getInstruction(identifierAppendIndex).registerD + val identifierIndex = + indexOfFirstInstructionReversedOrThrow(identifierAppendIndex) { + opcode == Opcode.IGET_OBJECT && + getReference()?.type == "Ljava/lang/String;" && + (this as? TwoRegisterInstruction)?.registerA == identifierRegister + } getInstruction(identifierIndex).reference } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/player/components/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/player/components/Fingerprints.kt index cd274c9dc..ebfab4be0 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/player/components/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/player/components/Fingerprints.kt @@ -10,11 +10,11 @@ import app.revanced.patches.youtube.utils.resourceid.endScreenElementLayoutCircl import app.revanced.patches.youtube.utils.resourceid.endScreenElementLayoutIcon import app.revanced.patches.youtube.utils.resourceid.endScreenElementLayoutVideo import app.revanced.patches.youtube.utils.resourceid.offlineActionsVideoDeletedUndoSnackbarText -import app.revanced.patches.youtube.utils.resourceid.verticalTouchOffsetToEnterFineScrubbing import app.revanced.patches.youtube.utils.resourceid.seekEasyHorizontalTouchOffsetToStartScrubbing import app.revanced.patches.youtube.utils.resourceid.suggestedAction import app.revanced.patches.youtube.utils.resourceid.tapBloomView import app.revanced.patches.youtube.utils.resourceid.touchArea +import app.revanced.patches.youtube.utils.resourceid.verticalTouchOffsetToEnterFineScrubbing import app.revanced.patches.youtube.utils.resourceid.verticalTouchOffsetToStartFineScrubbing import app.revanced.patches.youtube.utils.resourceid.videoZoomSnapIndicator import app.revanced.util.fingerprint.legacyFingerprint diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/player/components/PlayerComponentsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/player/components/PlayerComponentsPatch.kt index c6be90e33..2886c7063 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/player/components/PlayerComponentsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/player/components/PlayerComponentsPatch.kt @@ -129,9 +129,11 @@ private val speedOverlayPatch = bytecodePatch( // region patch for Custom speed overlay float value - val speedFieldReference = with (speedOverlayFloatValueFingerprint.methodOrThrow()) { - val literalIndex = indexOfFirstLiteralInstructionOrThrow(SPEED_OVERLAY_LEGACY_FEATURE_FLAG) - val floatIndex = indexOfFirstInstructionOrThrow(literalIndex, Opcode.DOUBLE_TO_FLOAT) + val speedFieldReference = with(speedOverlayFloatValueFingerprint.methodOrThrow()) { + val literalIndex = + indexOfFirstLiteralInstructionOrThrow(SPEED_OVERLAY_LEGACY_FEATURE_FLAG) + val floatIndex = + indexOfFirstInstructionOrThrow(literalIndex, Opcode.DOUBLE_TO_FLOAT) val floatRegister = getInstruction(floatIndex).registerA addInstructions( @@ -604,7 +606,9 @@ val playerComponentsPatch = bytecodePatch( ) if (is_20_12_or_greater) { - filmStripOverlayMotionEventPrimaryFingerprint.matchOrThrow(filmStripOverlayStartParentFingerprint).let { + filmStripOverlayMotionEventPrimaryFingerprint.matchOrThrow( + filmStripOverlayStartParentFingerprint + ).let { it.method.apply { val index = it.patternMatch!!.startIndex val register = getInstruction(index).registerA @@ -613,7 +617,9 @@ val playerComponentsPatch = bytecodePatch( } } - filmStripOverlayMotionEventSecondaryFingerprint.matchOrThrow(filmStripOverlayStartParentFingerprint).let { + filmStripOverlayMotionEventSecondaryFingerprint.matchOrThrow( + filmStripOverlayStartParentFingerprint + ).let { it.method.apply { val index = it.patternMatch!!.startIndex + 2 val register = getInstruction(index).registerA diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/player/fullscreen/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/player/fullscreen/Fingerprints.kt index bda5fdde7..cec249b45 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/player/fullscreen/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/player/fullscreen/Fingerprints.kt @@ -7,7 +7,6 @@ import app.revanced.patches.youtube.utils.resourceid.quickActionsElementContaine import app.revanced.util.fingerprint.legacyFingerprint import app.revanced.util.or import com.android.tools.smali.dexlib2.AccessFlags -import com.android.tools.smali.dexlib2.util.MethodUtil internal val broadcastReceiverFingerprint = legacyFingerprint( name = "broadcastReceiverFingerprint", diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/player/miniplayer/general/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/player/miniplayer/general/Fingerprints.kt index df9835b17..219f4cd15 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/player/miniplayer/general/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/player/miniplayer/general/Fingerprints.kt @@ -63,6 +63,7 @@ internal val miniplayerResponseModelSizeCheckFingerprint = legacyFingerprint( // region modern miniplayer internal const val MINIPLAYER_MODERN_FEATURE_KEY = 45622882L + // In later targets this feature flag does nothing and is dead code. internal const val MINIPLAYER_MODERN_FEATURE_LEGACY_KEY = 45630429L internal const val MINIPLAYER_DOUBLE_TAP_FEATURE_KEY = 45628823L diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/player/miniplayer/general/MiniplayerPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/player/miniplayer/general/MiniplayerPatch.kt index a5d331118..18ab867db 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/player/miniplayer/general/MiniplayerPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/player/miniplayer/general/MiniplayerPatch.kt @@ -239,7 +239,8 @@ val miniplayerPatch = bytecodePatch( val register = getInstruction(targetIndex).registerA addInstructions( - targetIndex + 1, """ + targetIndex + 1, + """ invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->getMiniplayerDefaultSize(I)I move-result v$register """, diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/player/overlaybuttons/OverlayButtonsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/player/overlaybuttons/OverlayButtonsPatch.kt index b2134cfc3..0dc46c49b 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/player/overlaybuttons/OverlayButtonsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/player/overlaybuttons/OverlayButtonsPatch.kt @@ -256,7 +256,8 @@ val overlayButtonsPatch = resourcePatch( width != "0.0dip", ) - val isButton = id.endsWith("_button") && id != "@id/multiview_button" || id == "@id/youtube_controls_fullscreen_button_stub" + val isButton = + id.endsWith("_button") && id != "@id/multiview_button" || id == "@id/youtube_controls_fullscreen_button_stub" // Adjust TimeBar and Chapter bottom padding val timBarItem = mutableMapOf( @@ -286,7 +287,10 @@ val overlayButtonsPatch = resourcePatch( if (id.equals("@+id/bottom_margin")) { node.setAttribute("android:layout_height", marginBottom) } else if (id.equals("@id/time_bar_reference_view")) { - node.setAttribute("yt:layout_constraintBottom_toTopOf", "@id/quick_actions_container") + node.setAttribute( + "yt:layout_constraintBottom_toTopOf", + "@id/quick_actions_container" + ) } } } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/player/seekbar/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/player/seekbar/Fingerprints.kt index d0e9eac5c..aba912974 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/player/seekbar/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/player/seekbar/Fingerprints.kt @@ -14,7 +14,6 @@ import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.Method import com.android.tools.smali.dexlib2.iface.reference.MethodReference -import kotlin.collections.listOf internal val shortsSeekbarColorFingerprint = legacyFingerprint( name = "shortsSeekbarColorFingerprint", diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/player/seekbar/SeekbarComponentsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/player/seekbar/SeekbarComponentsPatch.kt index f549f9d0e..9654b5956 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/player/seekbar/SeekbarComponentsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/player/seekbar/SeekbarComponentsPatch.kt @@ -139,7 +139,8 @@ val seekbarComponentsPatch = bytecodePatch( reference?.returnType == "V" && reference.parameterTypes.isEmpty() } - val thisInstanceRegister = getInstruction(tapSeekIndex).registerC + val thisInstanceRegister = + getInstruction(tapSeekIndex).registerC val tapSeekClass = getInstruction(tapSeekIndex) .getReference()!! @@ -274,7 +275,10 @@ val seekbarComponentsPatch = bytecodePatch( playerSeekbarHandleColorPrimaryFingerprint, playerSeekbarHandleColorSecondaryFingerprint ).forEach { - it.methodOrThrow().addColorChangeInstructions(ytStaticBrandRed, "getVideoPlayerSeekbarColorAccent") + it.methodOrThrow().addColorChangeInstructions( + ytStaticBrandRed, + "getVideoPlayerSeekbarColorAccent" + ) } // If hiding feed seekbar thumbnails, then turn off the cairo gradient // of the watch history menu items as they use the same gradient as the diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/shorts/components/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/shorts/components/Fingerprints.kt index 639a2c4c3..92d882cd9 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/shorts/components/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/shorts/components/Fingerprints.kt @@ -22,7 +22,6 @@ import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.Method import com.android.tools.smali.dexlib2.iface.reference.FieldReference import com.android.tools.smali.dexlib2.iface.reference.MethodReference -import kotlin.collections.listOf internal val bottomSheetMenuDismissFingerprint = legacyFingerprint( name = "bottomSheetMenuDismissFingerprint", 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 fc0b76a03..e124d373a 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 @@ -344,7 +344,11 @@ private val shortsCustomActionsPatch = bytecodePatch( recyclerViewTreeObserverHook("$EXTENSION_CUSTOM_ACTIONS_CLASS_DESCRIPTOR->onFlyoutMenuCreate(Landroid/support/v7/widget/RecyclerView;)V") } else { // The type of the Shorts flyout menu is ListView. - val dismissReference = with (bottomSheetMenuDismissFingerprint.methodOrThrow(bottomSheetMenuListBuilderFingerprint)) { + val dismissReference = with( + bottomSheetMenuDismissFingerprint.methodOrThrow( + bottomSheetMenuListBuilderFingerprint + ) + ) { val dismissIndex = indexOfDismissInstruction(this) getInstruction(dismissIndex).reference } @@ -352,7 +356,8 @@ private val shortsCustomActionsPatch = bytecodePatch( bottomSheetMenuItemClickFingerprint .methodOrThrow(bottomSheetMenuListBuilderFingerprint) .addInstructionsWithLabels( - 0, """ + 0, + """ invoke-static/range {p2 .. p2}, $EXTENSION_CUSTOM_ACTIONS_CLASS_DESCRIPTOR->onBottomSheetMenuItemClick(Landroid/view/View;)Z move-result v0 if-eqz v0, :ignore @@ -430,7 +435,7 @@ private val shortsRepeatPatch = bytecodePatch( "setMainActivity" ) - val endScreenReference = with (reelEnumConstructorFingerprint.methodOrThrow()) { + val endScreenReference = with(reelEnumConstructorFingerprint.methodOrThrow()) { val insertIndex = indexOfFirstInstructionOrThrow(Opcode.RETURN_VOID) addInstructions( @@ -510,7 +515,11 @@ private val shortsRepeatPatch = bytecodePatch( // Manually add the 'Autoplay' code that Google removed. // Tested on YouTube 20.10. if (is_20_09_or_greater) { - val (directReference, virtualReference) = with (reelPlaybackFingerprint.methodOrThrow(videoIdFingerprintShorts)) { + val (directReference, virtualReference) = with( + reelPlaybackFingerprint.methodOrThrow( + videoIdFingerprintShorts + ) + ) { val directIndex = indexOfInitializationInstruction(this) val virtualIndex = indexOfFirstInstructionOrThrow(directIndex) { opcode == Opcode.INVOKE_VIRTUAL && @@ -528,7 +537,8 @@ private val shortsRepeatPatch = bytecodePatch( opcode == Opcode.INVOKE_STATIC && getReference()?.definingClass == EXTENSION_REPEAT_STATE_CLASS_DESCRIPTOR } - val enumRegister = getInstruction(extensionIndex + 1).registerA + val enumRegister = + getInstruction(extensionIndex + 1).registerA val freeIndex = indexOfFirstInstructionOrThrow(extensionIndex) { opcode == Opcode.SGET_OBJECT && getReference()?.name != "a" @@ -1014,7 +1024,8 @@ val shortsComponentPatch = bytecodePatch( getReference()?.returnType == PLAYBACK_START_DESCRIPTOR_CLASS_DESCRIPTOR } val freeRegister = getInstruction(index).registerC - val playbackStartRegister = getInstruction(index + 1).registerA + val playbackStartRegister = + getInstruction(index + 1).registerA addInstructionsWithLabels( index + 2, diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/cairo/CairoFragmentPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/cairo/CairoFragmentPatch.kt index ae2d3c8cf..223de2ee9 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/cairo/CairoFragmentPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/cairo/CairoFragmentPatch.kt @@ -116,7 +116,7 @@ val cairoFragmentPatch = resourcePatch( ?.let { node -> node.insertNode("Preference", node) { for (index in 0 until node.attributes.length) { - with (node.attributes.item(index)) { + with(node.attributes.item(index)) { setAttribute(nodeName, nodeValue) } } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/cairo/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/cairo/Fingerprints.kt index d96edd681..b4f56f4fe 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/cairo/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fix/cairo/Fingerprints.kt @@ -1,10 +1,10 @@ package app.revanced.patches.youtube.utils.fix.cairo +import app.revanced.patches.youtube.utils.resourceid.settingsFragment +import app.revanced.patches.youtube.utils.resourceid.settingsFragmentCairo import app.revanced.util.fingerprint.legacyFingerprint import app.revanced.util.or import com.android.tools.smali.dexlib2.AccessFlags -import app.revanced.patches.youtube.utils.resourceid.settingsFragment -import app.revanced.patches.youtube.utils.resourceid.settingsFragmentCairo import com.android.tools.smali.dexlib2.Opcode /** diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fullscreen/FullscreenButtonHookPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fullscreen/FullscreenButtonHookPatch.kt index b40668b3f..97a12da54 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fullscreen/FullscreenButtonHookPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/fullscreen/FullscreenButtonHookPatch.kt @@ -22,7 +22,6 @@ 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.MethodReference import com.android.tools.smali.dexlib2.iface.reference.TypeReference -import kotlin.collections.mutableListOf private const val EXTENSION_VIDEO_UTILS_CLASS_DESCRIPTOR = "$EXTENSION_PATH/utils/VideoUtils;" @@ -59,7 +58,10 @@ val fullscreenButtonHookPatch = bytecodePatch( getReference()?.name == "addListener" } val animatorListenerAdapterClass = getInstruction( - indexOfFirstInstructionReversedOrThrow(addListenerIndex, Opcode.NEW_INSTANCE) + indexOfFirstInstructionReversedOrThrow( + addListenerIndex, + Opcode.NEW_INSTANCE + ) ).reference.toString() return Pair( findMethodOrThrow(animatorListenerAdapterClass) { parameters.isEmpty() }, diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/playertype/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/playertype/Fingerprints.kt index 3a1f528b5..0446b0376 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/playertype/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/playertype/Fingerprints.kt @@ -86,7 +86,7 @@ internal val appCompatToolbarBackButtonFingerprint = legacyFingerprint( accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, returnType = "Landroid/graphics/drawable/Drawable;", parameters = emptyList(), - customFingerprint = { _, classDef -> + customFingerprint = { _, classDef -> classDef.type == "Landroid/support/v7/widget/Toolbar;" }, ) diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/playlist/PlaylistPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/playlist/PlaylistPatch.kt index ac0f91aa2..c0327377b 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/playlist/PlaylistPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/playlist/PlaylistPatch.kt @@ -56,7 +56,7 @@ val playlistPatch = bytecodePatch( """ ) - val setVideoIdReference = with (playlistEndpointFingerprint.methodOrThrow()) { + val setVideoIdReference = with(playlistEndpointFingerprint.methodOrThrow()) { val setVideoIdIndex = indexOfSetVideoIdInstruction(this) getInstruction(setVideoIdIndex).reference as FieldReference } @@ -67,14 +67,16 @@ val playlistPatch = bytecodePatch( .let { it.method.apply { val castIndex = it.patternMatch!!.startIndex - val castClass = getInstruction(castIndex).reference.toString() + val castClass = + getInstruction(castIndex).reference.toString() if (castClass != setVideoIdReference.definingClass) { throw PatchException("Method signature parameter did not match: $castClass") } val castRegister = getInstruction(castIndex).registerA val insertIndex = castIndex + 1 - val insertRegister = getInstruction(insertIndex).registerA + val insertRegister = + getInstruction(insertIndex).registerA addInstructions( insertIndex, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/resourceid/SharedResourceIdPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/resourceid/SharedResourceIdPatch.kt index 08816a3d8..edce5c86e 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/utils/resourceid/SharedResourceIdPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/utils/resourceid/SharedResourceIdPatch.kt @@ -316,9 +316,11 @@ internal val sharedResourceIdPatch = resourcePatch( fullScreenEngagementPanel = getResourceId(ID, "fullscreen_engagement_panel_holder") horizontalCardList = getResourceId(LAYOUT, "horizontal_card_list") imageOnlyTab = getResourceId(LAYOUT, "image_only_tab") - inlineTimeBarColorizedBarPlayedColorDark = getResourceId(COLOR, "inline_time_bar_colorized_bar_played_color_dark") + inlineTimeBarColorizedBarPlayedColorDark = + getResourceId(COLOR, "inline_time_bar_colorized_bar_played_color_dark") inlineTimeBarLiveSeekAbleRange = getResourceId(COLOR, "inline_time_bar_live_seekable_range") - inlineTimeBarPlayedNotHighlightedColor = getResourceId(COLOR, "inline_time_bar_played_not_highlighted_color") + inlineTimeBarPlayedNotHighlightedColor = + getResourceId(COLOR, "inline_time_bar_played_not_highlighted_color") insetOverlayViewLayout = getResourceId(ID, "inset_overlay_view_layout") interstitialsContainer = getResourceId(ID, "interstitials_container") insetElementsWrapper = getResourceId(LAYOUT, "inset_elements_wrapper") @@ -328,14 +330,19 @@ internal val sharedResourceIdPatch = resourcePatch( modernMiniPlayerClose = getResourceId(ID, "modern_miniplayer_close") modernMiniPlayerExpand = getResourceId(ID, "modern_miniplayer_expand") modernMiniPlayerForwardButton = getResourceId(ID, "modern_miniplayer_forward_button") - modernMiniPlayerOverlayActionButton = getResourceId(ID, "modern_miniplayer_overlay_action_button") + modernMiniPlayerOverlayActionButton = + getResourceId(ID, "modern_miniplayer_overlay_action_button") modernMiniPlayerRewindButton = getResourceId(ID, "modern_miniplayer_rewind_button") musicAppDeeplinkButtonView = getResourceId(ID, "music_app_deeplink_button_view") - notificationBigPictureIconWidth = getResourceId(DIMEN, "notification_big_picture_icon_width") - offlineActionsVideoDeletedUndoSnackbarText = getResourceId(STRING, "offline_actions_video_deleted_undo_snackbar_text") + notificationBigPictureIconWidth = + getResourceId(DIMEN, "notification_big_picture_icon_width") + offlineActionsVideoDeletedUndoSnackbarText = + getResourceId(STRING, "offline_actions_video_deleted_undo_snackbar_text") playerCollapseButton = getResourceId(ID, "player_collapse_button") - playerControlPreviousButtonTouchArea = getResourceId(ID, "player_control_previous_button_touch_area") - playerControlNextButtonTouchArea = getResourceId(ID, "player_control_next_button_touch_area") + playerControlPreviousButtonTouchArea = + getResourceId(ID, "player_control_previous_button_touch_area") + playerControlNextButtonTouchArea = + getResourceId(ID, "player_control_next_button_touch_area") playerVideoTitleView = getResourceId(ID, "player_video_title_view") posterArtWidthDefault = getResourceId(DIMEN, "poster_art_width_default") qualityAuto = getResourceId(STRING, "quality_auto") @@ -356,7 +363,8 @@ internal val sharedResourceIdPatch = resourcePatch( relatedChipCloudMargin = getResourceId(LAYOUT, "related_chip_cloud_reduced_margins") rightComment = getResourceId(DRAWABLE, "ic_right_comment_32c") scrimOverlay = getResourceId(ID, "scrim_overlay") - seekEasyHorizontalTouchOffsetToStartScrubbing = getResourceId(DIMEN, "seek_easy_horizontal_touch_offset_to_start_scrubbing") + seekEasyHorizontalTouchOffsetToStartScrubbing = + getResourceId(DIMEN, "seek_easy_horizontal_touch_offset_to_start_scrubbing") seekUndoEduOverlayStub = getResourceId(ID, "seek_undo_edu_overlay_stub") settingsFragment = getResourceId(XML, "settings_fragment") settingsFragmentCairo = getResourceId(XML, "settings_fragment_cairo") @@ -369,20 +377,26 @@ internal val sharedResourceIdPatch = resourcePatch( toolTipContentView = getResourceId(LAYOUT, "tooltip_content_view") totalTime = getResourceId(STRING, "total_time") touchArea = getResourceId(ID, "touch_area") - videoQualityBottomSheet = getResourceId(LAYOUT, "video_quality_bottom_sheet_list_fragment_title") + videoQualityBottomSheet = + getResourceId(LAYOUT, "video_quality_bottom_sheet_list_fragment_title") varispeedUnavailableTitle = getResourceId(STRING, "varispeed_unavailable_title") - verticalTouchOffsetToEnterFineScrubbing = getResourceId(DIMEN, "vertical_touch_offset_to_enter_fine_scrubbing") - verticalTouchOffsetToStartFineScrubbing = getResourceId(DIMEN, "vertical_touch_offset_to_start_fine_scrubbing") - videoQualityUnavailableAnnouncement = getResourceId(STRING, "video_quality_unavailable_announcement") + verticalTouchOffsetToEnterFineScrubbing = + getResourceId(DIMEN, "vertical_touch_offset_to_enter_fine_scrubbing") + verticalTouchOffsetToStartFineScrubbing = + getResourceId(DIMEN, "vertical_touch_offset_to_start_fine_scrubbing") + videoQualityUnavailableAnnouncement = + getResourceId(STRING, "video_quality_unavailable_announcement") videoZoomSnapIndicator = getResourceId(ID, "video_zoom_snap_indicator") voiceSearch = getResourceId(ID, "voice_search") - youTubeControlsOverlaySubtitleButton = getResourceId(LAYOUT, "youtube_controls_overlay_subtitle_button") + youTubeControlsOverlaySubtitleButton = + getResourceId(LAYOUT, "youtube_controls_overlay_subtitle_button") youTubeLogo = getResourceId(ID, "youtube_logo") ytCallToAction = getResourceId(ATTR, "ytCallToAction") ytFillBell = getResourceId(DRAWABLE, "yt_fill_bell_black_24") ytOutlineLibrary = getResourceId(DRAWABLE, "yt_outline_library_black_24") ytOutlineMoonZ = getResourceId(DRAWABLE, "yt_outline_moon_z_vd_theme_24") - ytOutlinePictureInPictureWhite = getResourceId(DRAWABLE, "yt_outline_picture_in_picture_white_24") + ytOutlinePictureInPictureWhite = + getResourceId(DRAWABLE, "yt_outline_picture_in_picture_white_24") ytOutlineVideoCamera = getResourceId(DRAWABLE, "yt_outline_video_camera_black_24") ytOutlineXWhite = getResourceId(DRAWABLE, "yt_outline_x_white_24") ytPremiumWordMarkHeader = getResourceId(ATTR, "ytPremiumWordmarkHeader") 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 41ed6bdcd..8052b44fd 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 @@ -162,13 +162,15 @@ val videoPlaybackPatch = bytecodePatch( loadVideoParamsFingerprint.matchOrThrow(loadVideoParamsParentFingerprint).let { it.method.apply { val targetIndex = it.patternMatch!!.endIndex - val targetReference = getInstruction(targetIndex).reference as MethodReference + val targetReference = + getInstruction(targetIndex).reference as MethodReference findMethodOrThrow(definingClass) { name == targetReference.name }.apply { val insertIndex = implementation!!.instructions.lastIndex - val insertRegister = getInstruction(insertIndex).registerA + val insertRegister = + getInstruction(insertIndex).registerA addInstructions( insertIndex, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/playbackstart/PlaybackStartDescriptorPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/playbackstart/PlaybackStartDescriptorPatch.kt index 1b4e38b32..39b967dee 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/playbackstart/PlaybackStartDescriptorPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/playbackstart/PlaybackStartDescriptorPatch.kt @@ -26,7 +26,8 @@ val playbackStartDescriptorPatch = bytecodePatch( && reference.returnType == "Ljava/lang/String;" } - playbackStartVideoIdReference = getInstruction(stringMethodIndex).reference + playbackStartVideoIdReference = + getInstruction(stringMethodIndex).reference } } } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/PlayerResponseMethodHookPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/PlayerResponseMethodHookPatch.kt index 9e8d23aeb..ba1505fe9 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/PlayerResponseMethodHookPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/PlayerResponseMethodHookPatch.kt @@ -39,7 +39,8 @@ val playerResponseMethodHookPatch = bytecodePatch( playerResponseMethod.apply { val setIndex = parameterTypes.indexOfFirst { it == "Ljava/util/Set;" } val parameterSize = parameterTypes.size - val relativeIndex = parameterTypes.subList(setIndex, parameterSize - 1).indexOfFirst { it == "Z" } + val relativeIndex = + parameterTypes.subList(setIndex, parameterSize - 1).indexOfFirst { it == "Z" } // YouTube 18.29 ~ 19.22 : p11 // YouTube 19.23 ~ 20.09 : p12 diff --git a/patches/src/main/kotlin/app/revanced/util/FilesCompat.kt b/patches/src/main/kotlin/app/revanced/util/FilesCompat.kt index 6bd4a93ed..1e54ba551 100644 --- a/patches/src/main/kotlin/app/revanced/util/FilesCompat.kt +++ b/patches/src/main/kotlin/app/revanced/util/FilesCompat.kt @@ -16,7 +16,7 @@ internal object FilesCompat { // Check for the existence of java.nio.file.Files class Class.forName("java.nio.file.Files") false - } catch (_ : ClassNotFoundException) { + } catch (_: ClassNotFoundException) { // Under Android 8.0 true }