feat(YouTube Music): Support version 8.10.52 (#5941)

This commit is contained in:
LisoUseInAIKyrios
2025-09-20 20:09:52 +04:00
committed by GitHub
parent 4178e8a64f
commit 01c0f1bd1a
15 changed files with 26 additions and 142 deletions

View File

@@ -1,14 +0,0 @@
package app.revanced.extension.music.patches;
import app.revanced.extension.music.settings.Settings;
@SuppressWarnings("unused")
public class HideUpgradeButtonPatch {
/**
* Injection point
*/
public static boolean hideUpgradeButton() {
return Settings.HIDE_UPGRADE_BUTTON.get();
}
}

View File

@@ -15,7 +15,6 @@ public class Settings extends BaseSettings {
// Ads
public static final BooleanSetting HIDE_VIDEO_ADS = new BooleanSetting("revanced_music_hide_video_ads", TRUE, true);
public static final BooleanSetting HIDE_GET_PREMIUM_LABEL = new BooleanSetting("revanced_music_hide_get_premium_label", TRUE, true);
public static final BooleanSetting HIDE_UPGRADE_BUTTON = new BooleanSetting("revanced_music_hide_upgrade_button", TRUE, true);
// General
public static final BooleanSetting HIDE_CAST_BUTTON = new BooleanSetting("revanced_music_hide_cast_button", TRUE, false);

View File

@@ -24,7 +24,8 @@ val hideVideoAdsPatch = bytecodePatch(
compatibleWith(
"com.google.android.apps.youtube.music"(
"7.29.52"
"7.29.52",
"8.10.52"
)
)

View File

@@ -17,7 +17,8 @@ val enableExclusiveAudioPlaybackPatch = bytecodePatch(
compatibleWith(
"com.google.android.apps.youtube.music"(
"7.29.52"
"7.29.52",
"8.10.52"
)
)

View File

@@ -27,7 +27,8 @@ val permanentRepeatPatch = bytecodePatch(
compatibleWith(
"com.google.android.apps.youtube.music"(
"7.29.52"
"7.29.52",
"8.10.52"
)
)

View File

@@ -11,7 +11,8 @@ val permanentShufflePatch = bytecodePatch(
) {
compatibleWith(
"com.google.android.apps.youtube.music"(
"7.29.52"
"7.29.52",
"8.10.52"
)
)

View File

@@ -33,7 +33,8 @@ val hideCastButton = bytecodePatch(
compatibleWith(
"com.google.android.apps.youtube.music"(
"7.29.52"
"7.29.52",
"8.10.52"
)
)

View File

@@ -1,6 +1,5 @@
package app.revanced.patches.music.layout.compactheader
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.bytecodePatch
@@ -10,7 +9,6 @@ import app.revanced.patches.music.misc.extension.sharedExtensionPatch
import app.revanced.patches.music.misc.settings.PreferenceScreen
import app.revanced.patches.music.misc.settings.settingsPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.util.addInstructionsAtControlFlowLabel
import app.revanced.util.findFreeRegister
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@@ -29,7 +27,8 @@ val hideCategoryBar = bytecodePatch(
compatibleWith(
"com.google.android.apps.youtube.music"(
"7.29.52"
"7.29.52",
"8.10.52"
)
)

View File

@@ -40,7 +40,8 @@ val navigationBarPatch = bytecodePatch(
compatibleWith(
"com.google.android.apps.youtube.music"(
"7.29.52"
"7.29.52",
"8.10.52"
)
)

View File

@@ -28,7 +28,8 @@ val hideGetPremiumPatch = bytecodePatch(
compatibleWith(
"com.google.android.apps.youtube.music"(
"7.29.52"
"7.29.52",
"8.10.52"
)
)

View File

@@ -1,18 +0,0 @@
package app.revanced.patches.music.layout.upgradebutton
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.AccessFlags
import app.revanced.patcher.fingerprint
internal val pivotBarConstructorFingerprint = fingerprint {
accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR)
returns("V")
parameters("L", "Z")
opcodes(
Opcode.CHECK_CAST,
Opcode.INVOKE_INTERFACE,
Opcode.GOTO,
Opcode.IPUT_OBJECT,
Opcode.RETURN_VOID
)
}

View File

@@ -1,104 +1,12 @@
package app.revanced.patches.music.layout.upgradebutton
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.extensions.newLabel
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.all.misc.resources.addResources
import app.revanced.patches.all.misc.resources.addResourcesPatch
import app.revanced.patches.music.misc.extension.sharedExtensionPatch
import app.revanced.patches.music.misc.settings.PreferenceScreen
import app.revanced.patches.music.misc.settings.settingsPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.util.getReference
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction22t
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
import app.revanced.patches.music.layout.navigationbar.navigationBarPatch
private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/music/patches/HideUpgradeButtonPatch;"
@Deprecated("This patch will be removed in the future.")
@Deprecated("Patch is obsolete and was replaced by navigation bar patch", ReplaceWith("navigationBarPatch"))
@Suppress("unused")
val hideUpgradeButton = bytecodePatch(
description = "Hides the upgrade tab from the pivot bar.",
) {
dependsOn(
sharedExtensionPatch,
settingsPatch,
addResourcesPatch,
)
compatibleWith(
"com.google.android.apps.youtube.music"(
"7.29.52"
)
)
execute {
addResources("music", "layout.upgradebutton.hideUpgradeButtonPatch")
// TODO: Add an extension patch to allow this to be enabled/disabled in app.
if (false) {
PreferenceScreen.ADS.addPreferences(
SwitchPreference("revanced_music_hide_upgrade_button")
)
}
pivotBarConstructorFingerprint.method.apply {
val pivotBarElementFieldReference =
getInstruction(pivotBarConstructorFingerprint.patternMatch!!.endIndex - 1)
.getReference<FieldReference>()
val register = getInstruction<FiveRegisterInstruction>(0).registerC
// First compile all the needed instructions.
val instructionList = """
invoke-interface { v0 }, Ljava/util/List;->size()I
move-result v1
const/4 v2, 0x4
invoke-interface {v0, v2}, Ljava/util/List;->remove(I)Ljava/lang/Object;
iput-object v0, v$register, $pivotBarElementFieldReference
""".toInstructions().toMutableList()
val endIndex = pivotBarConstructorFingerprint.patternMatch!!.endIndex
// Replace the instruction to retain the label at given index.
replaceInstruction(
endIndex - 1,
instructionList[0], // invoke-interface.
)
// Do not forget to remove this instruction since we added it already.
instructionList.removeFirst()
val exitInstruction = instructionList.last() // iput-object
addInstruction(
endIndex,
exitInstruction,
)
// Do not forget to remove this instruction since we added it already.
instructionList.removeLast()
// Add the necessary if statement to remove the upgrade tab button in case it exists.
instructionList.add(
2, // if-le.
BuilderInstruction22t(
Opcode.IF_LE,
1,
2,
newLabel(endIndex),
),
)
addInstructions(
endIndex,
instructionList,
)
}
}
val hideUpgradeButton = bytecodePatch{
dependsOn(navigationBarPatch)
}
@Deprecated("Patch was renamed", ReplaceWith("hideUpgradeButton"))

View File

@@ -17,7 +17,8 @@ val bypassCertificateChecksPatch = bytecodePatch(
compatibleWith(
"com.google.android.apps.youtube.music"(
"7.29.52"
"7.29.52",
"8.10.52"
)
)

View File

@@ -17,7 +17,8 @@ val backgroundPlaybackPatch = bytecodePatch(
compatibleWith(
"com.google.android.apps.youtube.music"(
"7.29.52"
"7.29.52",
"8.10.52"
)
)

View File

@@ -33,7 +33,8 @@ val spoofVideoStreamsPatch = spoofVideoStreamsPatch(
compatibleWith(
"com.google.android.apps.youtube.music"(
"7.29.52"
"7.29.52",
"8.10.52"
)
)
},