mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-04-29 22:24:31 +02:00
fix(YouTube Music - Hide layout components): Hide sound search button
setting is not added to 8.05.51+
This commit is contained in:
parent
a4f9a182c1
commit
5706c08936
@ -79,6 +79,10 @@ public class GeneralPatch {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean hideSoundSearchButton() {
|
||||||
|
return Settings.HIDE_SOUND_SEARCH_BUTTON.get();
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean hideSoundSearchButton(boolean original) {
|
public static boolean hideSoundSearchButton(boolean original) {
|
||||||
if (!Settings.SETTINGS_INITIALIZED.get()) {
|
if (!Settings.SETTINGS_INITIALIZED.get()) {
|
||||||
return original;
|
return original;
|
||||||
|
@ -84,6 +84,9 @@ internal val mediaRouteButtonFingerprint = legacyFingerprint(
|
|||||||
strings = listOf("MediaRouteButton")
|
strings = listOf("MediaRouteButton")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This fingerprint is compatible with YouTube Music 6.39.50+.
|
||||||
|
*/
|
||||||
internal val parentToolMenuFingerprint = legacyFingerprint(
|
internal val parentToolMenuFingerprint = legacyFingerprint(
|
||||||
name = "parentToolMenuFingerprint",
|
name = "parentToolMenuFingerprint",
|
||||||
returnType = "V",
|
returnType = "V",
|
||||||
@ -135,10 +138,39 @@ internal val searchBarParentFingerprint = legacyFingerprint(
|
|||||||
strings = listOf("web_search")
|
strings = listOf("web_search")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
internal const val SOUND_SEARCH_BUTTON_FEATURE_FLAG = 45625491L
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This fingerprint is compatible with YouTube Music 6.48.52 ~ 8.04.53.
|
||||||
|
*/
|
||||||
|
internal val soundSearchLegacyFingerprint = legacyFingerprint(
|
||||||
|
name = "soundSearchLegacyFingerprint",
|
||||||
|
returnType = "V",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
parameters = emptyList(),
|
||||||
|
literals = listOf(SOUND_SEARCH_BUTTON_FEATURE_FLAG),
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This fingerprint is compatible with YouTube Music 6.48.52+.
|
||||||
|
*/
|
||||||
internal val soundSearchFingerprint = legacyFingerprint(
|
internal val soundSearchFingerprint = legacyFingerprint(
|
||||||
name = "soundSearchFingerprint",
|
name = "soundSearchFingerprint",
|
||||||
|
returnType = "V",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
parameters = emptyList(),
|
parameters = emptyList(),
|
||||||
literals = listOf(45625491L),
|
opcodes = listOf(Opcode.INVOKE_INTERFACE),
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This fingerprint is compatible with YouTube Music 6.48.52+.
|
||||||
|
*/
|
||||||
|
internal val soundSearchConstructorFingerprint = legacyFingerprint(
|
||||||
|
name = "soundSearchConstructorFingerprint",
|
||||||
|
returnType = "V",
|
||||||
|
accessFlags = AccessFlags.STATIC or AccessFlags.CONSTRUCTOR,
|
||||||
|
parameters = emptyList(),
|
||||||
|
literals = listOf(208485L),
|
||||||
)
|
)
|
||||||
|
|
||||||
internal val tasteBuilderConstructorFingerprint = legacyFingerprint(
|
internal val tasteBuilderConstructorFingerprint = legacyFingerprint(
|
||||||
|
@ -13,7 +13,10 @@ import app.revanced.patches.music.utils.extension.Constants.COMPONENTS_PATH
|
|||||||
import app.revanced.patches.music.utils.extension.Constants.GENERAL_CLASS_DESCRIPTOR
|
import app.revanced.patches.music.utils.extension.Constants.GENERAL_CLASS_DESCRIPTOR
|
||||||
import app.revanced.patches.music.utils.extension.Constants.GENERAL_PATH
|
import app.revanced.patches.music.utils.extension.Constants.GENERAL_PATH
|
||||||
import app.revanced.patches.music.utils.patch.PatchList.HIDE_LAYOUT_COMPONENTS
|
import app.revanced.patches.music.utils.patch.PatchList.HIDE_LAYOUT_COMPONENTS
|
||||||
|
import app.revanced.patches.music.utils.playservice.is_6_39_or_greater
|
||||||
import app.revanced.patches.music.utils.playservice.is_6_42_or_greater
|
import app.revanced.patches.music.utils.playservice.is_6_42_or_greater
|
||||||
|
import app.revanced.patches.music.utils.playservice.is_6_48_or_greater
|
||||||
|
import app.revanced.patches.music.utils.playservice.is_8_05_or_greater
|
||||||
import app.revanced.patches.music.utils.playservice.versionCheckPatch
|
import app.revanced.patches.music.utils.playservice.versionCheckPatch
|
||||||
import app.revanced.patches.music.utils.resourceid.musicTasteBuilderShelf
|
import app.revanced.patches.music.utils.resourceid.musicTasteBuilderShelf
|
||||||
import app.revanced.patches.music.utils.resourceid.playerOverlayChip
|
import app.revanced.patches.music.utils.resourceid.playerOverlayChip
|
||||||
@ -31,7 +34,6 @@ import app.revanced.util.fingerprint.injectLiteralInstructionBooleanCall
|
|||||||
import app.revanced.util.fingerprint.matchOrThrow
|
import app.revanced.util.fingerprint.matchOrThrow
|
||||||
import app.revanced.util.fingerprint.methodOrThrow
|
import app.revanced.util.fingerprint.methodOrThrow
|
||||||
import app.revanced.util.fingerprint.mutableClassOrThrow
|
import app.revanced.util.fingerprint.mutableClassOrThrow
|
||||||
import app.revanced.util.fingerprint.resolvable
|
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import app.revanced.util.indexOfFirstLiteralInstructionOrThrow
|
import app.revanced.util.indexOfFirstLiteralInstructionOrThrow
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
@ -61,8 +63,6 @@ val layoutComponentsPatch = bytecodePatch(
|
|||||||
)
|
)
|
||||||
|
|
||||||
execute {
|
execute {
|
||||||
var notificationButtonIncluded = false
|
|
||||||
var soundSearchButtonIncluded = false
|
|
||||||
|
|
||||||
// region patch for hide cast button
|
// region patch for hide cast button
|
||||||
|
|
||||||
@ -163,7 +163,6 @@ val layoutComponentsPatch = bytecodePatch(
|
|||||||
"invoke-static {v$targetRegister}, $GENERAL_CLASS_DESCRIPTOR->hideNotificationButton(Landroid/view/View;)V"
|
"invoke-static {v$targetRegister}, $GENERAL_CLASS_DESCRIPTOR->hideNotificationButton(Landroid/view/View;)V"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
notificationButtonIncluded = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
@ -181,7 +180,7 @@ val layoutComponentsPatch = bytecodePatch(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The lowest version supported by the patch does not have parent tool settings
|
// The lowest version supported by the patch does not have parent tool settings
|
||||||
if (parentToolMenuFingerprint.resolvable()) {
|
if (is_6_39_or_greater) {
|
||||||
parentToolMenuFingerprint.matchOrThrow().let {
|
parentToolMenuFingerprint.matchOrThrow().let {
|
||||||
it.method.apply {
|
it.method.apply {
|
||||||
val index = it.patternMatch!!.startIndex + 1
|
val index = it.patternMatch!!.startIndex + 1
|
||||||
@ -201,12 +200,25 @@ val layoutComponentsPatch = bytecodePatch(
|
|||||||
|
|
||||||
// region patch for hide sound search button
|
// region patch for hide sound search button
|
||||||
|
|
||||||
if (soundSearchFingerprint.resolvable()) {
|
if (is_6_48_or_greater) {
|
||||||
soundSearchFingerprint.injectLiteralInstructionBooleanCall(
|
if (is_8_05_or_greater) {
|
||||||
45625491L,
|
soundSearchFingerprint.methodOrThrow(soundSearchConstructorFingerprint)
|
||||||
|
.addInstructionsWithLabels(
|
||||||
|
0, """
|
||||||
|
invoke-static {}, $GENERAL_CLASS_DESCRIPTOR->hideSoundSearchButton()Z
|
||||||
|
move-result v0
|
||||||
|
if-eqz v0, :show
|
||||||
|
return-void
|
||||||
|
:show
|
||||||
|
nop
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
soundSearchLegacyFingerprint.injectLiteralInstructionBooleanCall(
|
||||||
|
SOUND_SEARCH_BUTTON_FEATURE_FLAG,
|
||||||
"$GENERAL_CLASS_DESCRIPTOR->hideSoundSearchButton(Z)Z"
|
"$GENERAL_CLASS_DESCRIPTOR->hideSoundSearchButton(Z)Z"
|
||||||
)
|
)
|
||||||
soundSearchButtonIncluded = true
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
@ -324,7 +336,7 @@ val layoutComponentsPatch = bytecodePatch(
|
|||||||
"revanced_hide_history_button",
|
"revanced_hide_history_button",
|
||||||
"false"
|
"false"
|
||||||
)
|
)
|
||||||
if (notificationButtonIncluded) {
|
if (is_6_42_or_greater) {
|
||||||
addSwitchPreference(
|
addSwitchPreference(
|
||||||
CategoryType.GENERAL,
|
CategoryType.GENERAL,
|
||||||
"revanced_hide_notification_button",
|
"revanced_hide_notification_button",
|
||||||
@ -341,7 +353,7 @@ val layoutComponentsPatch = bytecodePatch(
|
|||||||
"revanced_hide_samples_shelf",
|
"revanced_hide_samples_shelf",
|
||||||
"false"
|
"false"
|
||||||
)
|
)
|
||||||
if (soundSearchButtonIncluded) {
|
if (is_6_48_or_greater) {
|
||||||
addSwitchPreference(
|
addSwitchPreference(
|
||||||
CategoryType.GENERAL,
|
CategoryType.GENERAL,
|
||||||
"revanced_hide_sound_search_button",
|
"revanced_hide_sound_search_button",
|
||||||
@ -358,13 +370,14 @@ val layoutComponentsPatch = bytecodePatch(
|
|||||||
"revanced_hide_voice_search_button",
|
"revanced_hide_voice_search_button",
|
||||||
"false"
|
"false"
|
||||||
)
|
)
|
||||||
|
if (is_6_39_or_greater) {
|
||||||
addSwitchPreference(
|
addSwitchPreference(
|
||||||
CategoryType.SETTINGS,
|
CategoryType.SETTINGS,
|
||||||
"revanced_hide_settings_menu_parent_tools",
|
"revanced_hide_settings_menu_parent_tools",
|
||||||
"false",
|
"false",
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
|
}
|
||||||
addSwitchPreference(
|
addSwitchPreference(
|
||||||
CategoryType.SETTINGS,
|
CategoryType.SETTINGS,
|
||||||
"revanced_hide_settings_menu_general",
|
"revanced_hide_settings_menu_general",
|
||||||
|
@ -9,10 +9,14 @@ var is_6_27_or_greater = false
|
|||||||
private set
|
private set
|
||||||
var is_6_36_or_greater = false
|
var is_6_36_or_greater = false
|
||||||
private set
|
private set
|
||||||
|
var is_6_39_or_greater = false
|
||||||
|
private set
|
||||||
var is_6_42_or_greater = false
|
var is_6_42_or_greater = false
|
||||||
private set
|
private set
|
||||||
var is_6_43_or_greater = false
|
var is_6_43_or_greater = false
|
||||||
private set
|
private set
|
||||||
|
var is_6_48_or_greater = false
|
||||||
|
private set
|
||||||
var is_7_03_or_greater = false
|
var is_7_03_or_greater = false
|
||||||
private set
|
private set
|
||||||
var is_7_06_or_greater = false
|
var is_7_06_or_greater = false
|
||||||
@ -39,6 +43,8 @@ var is_7_33_or_greater = false
|
|||||||
private set
|
private set
|
||||||
var is_8_03_or_greater = false
|
var is_8_03_or_greater = false
|
||||||
private set
|
private set
|
||||||
|
var is_8_05_or_greater = false
|
||||||
|
private set
|
||||||
|
|
||||||
val versionCheckPatch = resourcePatch(
|
val versionCheckPatch = resourcePatch(
|
||||||
description = "versionCheckPatch",
|
description = "versionCheckPatch",
|
||||||
@ -56,8 +62,10 @@ val versionCheckPatch = resourcePatch(
|
|||||||
// All bug fix releases always seem to use the same play store version as the minor version.
|
// All bug fix releases always seem to use the same play store version as the minor version.
|
||||||
is_6_27_or_greater = 234412000 <= playStoreServicesVersion
|
is_6_27_or_greater = 234412000 <= playStoreServicesVersion
|
||||||
is_6_36_or_greater = 240399000 <= playStoreServicesVersion
|
is_6_36_or_greater = 240399000 <= playStoreServicesVersion
|
||||||
|
is_6_39_or_greater = 240699000 <= playStoreServicesVersion
|
||||||
is_6_42_or_greater = 240999000 <= playStoreServicesVersion
|
is_6_42_or_greater = 240999000 <= playStoreServicesVersion
|
||||||
is_6_43_or_greater = 241099000 <= playStoreServicesVersion
|
is_6_43_or_greater = 241099000 <= playStoreServicesVersion
|
||||||
|
is_6_48_or_greater = 241599000 <= playStoreServicesVersion
|
||||||
is_7_03_or_greater = 242199000 <= playStoreServicesVersion
|
is_7_03_or_greater = 242199000 <= playStoreServicesVersion
|
||||||
is_7_06_or_greater = 242499000 <= playStoreServicesVersion
|
is_7_06_or_greater = 242499000 <= playStoreServicesVersion
|
||||||
is_7_13_or_greater = 243199000 <= playStoreServicesVersion
|
is_7_13_or_greater = 243199000 <= playStoreServicesVersion
|
||||||
@ -71,5 +79,6 @@ val versionCheckPatch = resourcePatch(
|
|||||||
is_7_29_or_greater = 244799000 <= playStoreServicesVersion
|
is_7_29_or_greater = 244799000 <= playStoreServicesVersion
|
||||||
is_7_33_or_greater = 245199000 <= playStoreServicesVersion
|
is_7_33_or_greater = 245199000 <= playStoreServicesVersion
|
||||||
is_8_03_or_greater = 250399000 <= playStoreServicesVersion
|
is_8_03_or_greater = 250399000 <= playStoreServicesVersion
|
||||||
|
is_8_05_or_greater = 250599000 <= playStoreServicesVersion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user