Skip to content

Commit

Permalink
feat(YouTube): Support version 19.45.38 (ReVanced#3938)
Browse files Browse the repository at this point in the history
  • Loading branch information
LisoUseInAIKyrios authored Nov 20, 2024
1 parent 3691fe6 commit 7c4e3fe
Show file tree
Hide file tree
Showing 82 changed files with 96 additions and 77 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package app.revanced.extension.shared.checks;

// Fields are set by the patch. Do not modify.
// Fields are not final, because the compiler is inlining them.
/**
* Fields are set by the patch. Do not modify.
* Fields are not final, because the compiler is inlining them.
*
* @noinspection CanBeFinal
*/
final class PatchInfo {
static long PATCH_TIME = 0L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;

public class ShowOnLockscreenPatch {
/**
* @noinspection deprecation
*/
public static Window getWindow(AppCompatActivity activity, float brightness) {
Window window = activity.getWindow();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ private ReturnYouTubeDislikeApi() {
*/
private static void randomlyWaitIfLocallyDebugging() {
final boolean DEBUG_RANDOMLY_DELAY_NETWORK_CALLS = false; // set true to debug UI
//noinspection ConstantValue
if (DEBUG_RANDOMLY_DELAY_NETWORK_CALLS) {
final long amountOfTimeToWaste = (long) (Math.random()
* (API_GET_VOTES_TCP_TIMEOUT_MILLISECONDS + API_GET_VOTES_HTTP_TIMEOUT_MILLISECONDS));
Expand Down Expand Up @@ -187,6 +188,7 @@ private static boolean checkIfRateLimitInEffect(String apiEndPointName) {
*/
private static boolean checkIfRateLimitWasHit(int httpResponseCode) {
final boolean DEBUG_RATE_LIMIT = false; // set to true, to verify rate limit works
//noinspection ConstantValue
if (DEBUG_RATE_LIMIT) {
final double RANDOM_RATE_LIMIT_PERCENTAGE = 0.2; // 20% chance of a triggering a rate limit
if (Math.random() < RANDOM_RATE_LIMIT_PERCENTAGE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ enum class PlayerType {

companion object {

private val nameToPlayerType = values().associateBy { it.name }
private val nameToPlayerType = PlayerType.entries.associateBy { it.name }

@JvmStatic
fun setFromString(enumName: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ enum class VideoState {

companion object {

private val nameToVideoState = values().associateBy { it.name }
private val nameToVideoState = VideoState.entries.associateBy { it.name }

@JvmStatic
fun setFromString(enumName: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,6 @@ public static String getNumberOfSkipsString(int viewCount) {
return statsNumberFormatter.format(viewCount);
}

@SuppressWarnings("ConstantConditions")
private static long parseSegmentTime(@NonNull String time) {
Matcher matcher = manualEditTimePattern.matcher(time);
if (!matcher.matches()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public static SponsorSegment[] getSegments(@NonNull String videoId) {
// Could benefit from:
// 1) collection of YouTube videos with test segment times (verify client skip timing matches the video, verify seekbar draws correctly)
// 2) unit tests (verify everything else)
//noinspection ConstantValue
if (false) {
segments.clear();
// Test auto-hide skip button:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package app.revanced.extension.youtube.sponsorblock.ui;

import static app.revanced.extension.shared.Utils.getResourceIdentifier;

import android.view.View;
import android.widget.ImageView;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package app.revanced.extension.youtube.sponsorblock.ui;

import static app.revanced.extension.shared.Utils.getResourceIdentifier;

import android.view.View;
import android.widget.ImageView;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import android.os.Handler
import android.os.Looper
import android.util.TypedValue
import android.view.HapticFeedbackConstants
import android.view.View
import android.view.ViewGroup
import android.widget.RelativeLayout
import android.widget.TextView
import app.revanced.extension.shared.StringRef.str
Expand Down Expand Up @@ -59,8 +57,8 @@ class SwipeControlsOverlayLayout(
val compoundIconPadding = 4.applyDimension(context, TypedValue.COMPLEX_UNIT_DIP)
feedbackTextView = TextView(context).apply {
layoutParams = LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT,
).apply {
addRule(CENTER_IN_PARENT, TRUE)
setPadding(
Expand Down Expand Up @@ -91,7 +89,7 @@ class SwipeControlsOverlayLayout(

private val feedbackHideHandler = Handler(Looper.getMainLooper())
private val feedbackHideCallback = Runnable {
feedbackTextView.visibility = View.GONE
feedbackTextView.visibility = GONE
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package app.revanced.patches.facebook.ads.mainfeed

import app.revanced.patcher.fingerprint
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
import baseModelMapperFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction31i
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter
import getSponsoredDataModelTemplateFingerprint
import getStoryVisibilityFingerprint

@Suppress("unused")
val hideSponsoredStoriesPatch = bytecodePatch(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.bytecodePatch
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import com.sun.org.apache.bcel.internal.generic.InstructionConst.getInstruction

@Suppress("unused")
val enableCustomTabsPatch = bytecodePatch(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.bytecodePatch
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import com.sun.org.apache.bcel.internal.generic.InstructionConst.getInstruction

@Suppress("unused")
val restoreHiddenBackUpWhileChargingTogglePatch = bytecodePatch(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions
import app.revanced.patcher.patch.bytecodePatch
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import com.sun.org.apache.bcel.internal.generic.InstructionConst.getInstruction

@Suppress("unused")
val removeDeviceRestrictionsPatch = bytecodePatch(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.bytecodePatch
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import com.sun.org.apache.bcel.internal.generic.InstructionConst.getInstruction

@Suppress("unused")
val disableSwitchingEmojiToStickerPatch = bytecodePatch(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.bytecodePatch
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction

@Suppress("unused")
val hideGetPremiumPatch = bytecodePatch(
name = "Hide 'Get Music Premium' label",
description = "Hides the \"Get Music Premium\" label from the account menu and settings.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.bytecodePatch

@Suppress("unused")
val backgroundPlaybackPatch = bytecodePatch(
name = "Remove background playback restrictions",
description = "Removes restrictions on background playback, including playing kids videos in the background.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ internal val createTabsFingerprint = fingerprint {
if (reference.definingClass != ACTIVITY_TAB_DESCRIPTOR) return@any false
if (reference.returnType != "[${ACTIVITY_TAB_DESCRIPTOR}") return@any false
true
} ?: false
} == true
}
}

Expand All @@ -42,7 +42,7 @@ internal val showNotificationFingerprint = fingerprint {
}
}
true
} ?: false
} == true
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import app.revanced.patches.twitch.misc.extension.sharedExtensionPatch
import app.revanced.patches.twitch.misc.settings.PreferenceScreen
import app.revanced.patches.twitch.misc.settings.settingsPatch

@Suppress("unused")
val audioAdsPatch = bytecodePatch(
name = "Block audio ads",
description = "Blocks audio ads in streams and VODs.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import app.revanced.patches.twitch.misc.extension.sharedExtensionPatch
import app.revanced.patches.twitch.misc.settings.PreferenceScreen
import app.revanced.patches.twitch.misc.settings.settingsPatch

@Suppress("unused")
val embeddedAdsPatch = bytecodePatch(
name = "Block embedded ads",
description = "Blocks embedded stream ads using services like Luminous or PurpleAdBlocker.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import app.revanced.patches.twitch.misc.extension.sharedExtensionPatch
import app.revanced.patches.twitch.misc.settings.PreferenceScreen
import app.revanced.patches.twitch.misc.settings.settingsPatch

@Suppress("unused")
val showDeletedMessagesPatch = bytecodePatch(
name = "Show deleted messages",
description = "Shows deleted chat messages behind a clickable spoiler.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.twitch.misc.settings.PreferenceScreen
import app.revanced.patches.twitch.misc.settings.settingsPatch

@Suppress("unused")
val autoClaimChannelPointsPatch = bytecodePatch(
name = "Auto claim channel points",
description = "Automatically claim Channel Points.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import app.revanced.patches.twitch.misc.extension.sharedExtensionPatch
import app.revanced.patches.twitch.misc.settings.PreferenceScreen
import app.revanced.patches.twitch.misc.settings.settingsPatch

@Suppress("unused")
val debugModePatch = bytecodePatch(
name = "Debug mode",
description = "Enables Twitch's internal debugging mode.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ val hideAdsPatch = bytecodePatch(
"19.25.37",
"19.34.42",
"19.43.41",
"19.45.38",
),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ val hideGetPremiumPatch = bytecodePatch(
"19.25.37",
"19.34.42",
"19.43.41",
"19.45.38",
),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
import app.revanced.patches.youtube.misc.settings.PreferenceScreen
import app.revanced.patches.youtube.misc.settings.settingsPatch

@Suppress("unused")
val videoAdsPatch = bytecodePatch(
name = "Video ads",
description = "Adds an option to remove ads in the video player.",
Expand All @@ -30,6 +29,7 @@ val videoAdsPatch = bytecodePatch(
"19.25.37",
"19.34.42",
"19.43.41",
"19.45.38",
),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ val copyVideoUrlPatch = bytecodePatch(
"19.25.37",
"19.34.42",
"19.43.41",
"19.45.38",
),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import app.revanced.patches.youtube.misc.settings.PreferenceScreen
import app.revanced.patches.youtube.misc.settings.settingsPatch
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction

@Suppress("unused")
val removeViewerDiscretionDialogPatch = bytecodePatch(
name = "Remove viewer discretion dialog",
description = "Adds an option to remove the dialog that appears when opening a video that has been age-restricted " +
Expand All @@ -31,6 +30,7 @@ val removeViewerDiscretionDialogPatch = bytecodePatch(
"19.25.37",
"19.34.42",
"19.43.41",
"19.45.38",
),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ val downloadsPatch = bytecodePatch(
"19.25.37",
"19.34.42",
"19.43.41",
"19.45.38",
),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
import app.revanced.patches.youtube.misc.settings.PreferenceScreen
import app.revanced.patches.youtube.misc.settings.settingsPatch

@Suppress("unused")
val disablePreciseSeekingGesturePatch = bytecodePatch(
name = "Disable precise seeking gesture",
description = "Adds an option to disable precise seeking when swiping up on the seekbar.",
Expand All @@ -30,6 +29,7 @@ val disablePreciseSeekingGesturePatch = bytecodePatch(
"19.25.37",
"19.34.42",
"19.43.41",
"19.45.38",
),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
import com.android.tools.smali.dexlib2.iface.reference.MethodReference

@Suppress("unused")
val enableSeekbarTappingPatch = bytecodePatch(
name = "Seekbar tapping",
description = "Adds an option to enable tap-to-seek on the seekbar of the video player.",
Expand All @@ -33,6 +32,7 @@ val enableSeekbarTappingPatch = bytecodePatch(
"19.25.37",
"19.34.42",
"19.43.41",
"19.45.38",
),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ import app.revanced.util.getReference
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
import com.sun.org.apache.bcel.internal.generic.InstructionConst.getInstruction

internal const val EXTENSION_METHOD_DESCRIPTOR =
"Lapp/revanced/extension/youtube/patches/SlideToSeekPatch;->isSlideToSeekDisabled(Z)Z"

@Suppress("unused")
val enableSlideToSeekPatch = bytecodePatch(
name = "Enable slide to seek",
description = "Adds an option to enable slide to seek " +
Expand All @@ -44,6 +42,7 @@ val enableSlideToSeekPatch = bytecodePatch(
"19.25.37",
"19.34.42",
"19.43.41",
"19.45.38",
),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import app.revanced.patches.youtube.misc.settings.PreferenceScreen
private const val EXTENSION_CLASS_DESCRIPTOR =
"Lapp/revanced/extension/youtube/patches/SeekbarThumbnailsPatch;"

@Suppress("unused")
val seekbarThumbnailsPatch = bytecodePatch(
name = "Seekbar thumbnails",
description = "Adds an option to use high quality fullscreen seekbar thumbnails. " +
Expand All @@ -36,6 +35,7 @@ val seekbarThumbnailsPatch = bytecodePatch(
"19.25.37",
"19.34.42",
"19.43.41",
"19.45.38",
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ val swipeControlsPatch = bytecodePatch(
"19.25.37",
"19.34.42",
"19.43.41",
"19.45.38",
),
)

Expand Down
Loading

0 comments on commit 7c4e3fe

Please sign in to comment.