mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 13:17:46 +02:00
chore: Reorder and update some strings (#118)
* ci: workflow to ping Discord users when patches are released (#72)
* init: Workflow to notify discord users of releases
* Rename workflow
* chore (Background playback): Shorten description
* Revert "chore (Background playback): Shorten description"
This reverts commit 10661b870f
.
* Change message contents
* chore(YouTube): Re-order settings
* chore: Re-order and rename some strings
* for consistency
* update strings again
* more updated strings
* change option location
* update settings location
* chore: update more strings
* chore: update and reorder even more strings
* fix typo
* improve description
* feat: Apply code review suggestions
* fix: Fix build errors
* feat: Apply code review suggestions
---------
Co-authored-by: KobeW50 <84587632+KobeW50@users.noreply.github.com>
Co-authored-by: inotia00 <108592928+inotia00@users.noreply.github.com>
This commit is contained in:

committed by
GitHub

parent
945a249523
commit
3604e92aa1
@ -241,11 +241,6 @@ val flyoutMenuComponentsPatch = bytecodePatch(
|
||||
|
||||
// endregion
|
||||
|
||||
addSwitchPreference(
|
||||
CategoryType.FLYOUT,
|
||||
"revanced_enable_compact_dialog",
|
||||
"true"
|
||||
)
|
||||
if (trimSilenceIncluded) {
|
||||
addSwitchPreference(
|
||||
CategoryType.FLYOUT,
|
||||
@ -253,6 +248,11 @@ val flyoutMenuComponentsPatch = bytecodePatch(
|
||||
"false"
|
||||
)
|
||||
}
|
||||
addSwitchPreference(
|
||||
CategoryType.FLYOUT,
|
||||
"revanced_enable_compact_dialog",
|
||||
"true"
|
||||
)
|
||||
addSwitchPreference(
|
||||
CategoryType.FLYOUT,
|
||||
"revanced_hide_flyout_menu_like_dislike",
|
||||
|
@ -2,7 +2,7 @@ package app.revanced.patches.music.general.autocaptions
|
||||
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patches.music.utils.compatibility.Constants.COMPATIBLE_PACKAGE
|
||||
import app.revanced.patches.music.utils.patch.PatchList.DISABLE_AUTO_CAPTIONS
|
||||
import app.revanced.patches.music.utils.patch.PatchList.DISABLE_FORCED_AUTO_CAPTIONS
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.ResourceUtils.updatePatchStatus
|
||||
import app.revanced.patches.music.utils.settings.addSwitchPreference
|
||||
@ -11,8 +11,8 @@ import app.revanced.patches.shared.captions.baseAutoCaptionsPatch
|
||||
|
||||
@Suppress("unused")
|
||||
val autoCaptionsPatch = bytecodePatch(
|
||||
DISABLE_AUTO_CAPTIONS.title,
|
||||
DISABLE_AUTO_CAPTIONS.summary,
|
||||
DISABLE_FORCED_AUTO_CAPTIONS.title,
|
||||
DISABLE_FORCED_AUTO_CAPTIONS.summary,
|
||||
) {
|
||||
compatibleWith(COMPATIBLE_PACKAGE)
|
||||
|
||||
@ -28,7 +28,7 @@ val autoCaptionsPatch = bytecodePatch(
|
||||
"false"
|
||||
)
|
||||
|
||||
updatePatchStatus(DISABLE_AUTO_CAPTIONS)
|
||||
updatePatchStatus(DISABLE_FORCED_AUTO_CAPTIONS)
|
||||
|
||||
}
|
||||
}
|
@ -304,16 +304,6 @@ val layoutComponentsPatch = bytecodePatch(
|
||||
"revanced_hide_carousel_shelf",
|
||||
"false"
|
||||
)
|
||||
addSwitchPreference(
|
||||
CategoryType.GENERAL,
|
||||
"revanced_hide_playlist_card_shelf",
|
||||
"false"
|
||||
)
|
||||
addSwitchPreference(
|
||||
CategoryType.GENERAL,
|
||||
"revanced_hide_samples_shelf",
|
||||
"false"
|
||||
)
|
||||
addSwitchPreference(
|
||||
CategoryType.GENERAL,
|
||||
"revanced_hide_cast_button",
|
||||
@ -329,11 +319,6 @@ val layoutComponentsPatch = bytecodePatch(
|
||||
"revanced_hide_floating_button",
|
||||
"false"
|
||||
)
|
||||
addSwitchPreference(
|
||||
CategoryType.GENERAL,
|
||||
"revanced_hide_tap_to_update_button",
|
||||
"false"
|
||||
)
|
||||
addSwitchPreference(
|
||||
CategoryType.GENERAL,
|
||||
"revanced_hide_history_button",
|
||||
@ -346,6 +331,16 @@ val layoutComponentsPatch = bytecodePatch(
|
||||
"false"
|
||||
)
|
||||
}
|
||||
addSwitchPreference(
|
||||
CategoryType.GENERAL,
|
||||
"revanced_hide_playlist_card_shelf",
|
||||
"false"
|
||||
)
|
||||
addSwitchPreference(
|
||||
CategoryType.GENERAL,
|
||||
"revanced_hide_samples_shelf",
|
||||
"false"
|
||||
)
|
||||
if (soundSearchButtonIncluded) {
|
||||
addSwitchPreference(
|
||||
CategoryType.GENERAL,
|
||||
@ -353,6 +348,11 @@ val layoutComponentsPatch = bytecodePatch(
|
||||
"false"
|
||||
)
|
||||
}
|
||||
addSwitchPreference(
|
||||
CategoryType.GENERAL,
|
||||
"revanced_hide_tap_to_update_button",
|
||||
"false"
|
||||
)
|
||||
addSwitchPreference(
|
||||
CategoryType.GENERAL,
|
||||
"revanced_hide_voice_search_button",
|
||||
|
@ -193,162 +193,6 @@ val playerComponentsPatch = bytecodePatch(
|
||||
)
|
||||
|
||||
execute {
|
||||
// region patch for disable gesture in player
|
||||
|
||||
val playerViewPagerConstructorMethod =
|
||||
playerViewPagerConstructorFingerprint.methodOrThrow()
|
||||
val mainActivityOnStartMethod =
|
||||
getMainActivityMethod("onStart")
|
||||
|
||||
mapOf(
|
||||
miniPlayerViewPager to "disableMiniPlayerGesture",
|
||||
playerViewPager to "disablePlayerGesture"
|
||||
).forEach { (literal, methodName) ->
|
||||
val viewPagerReference = with(playerViewPagerConstructorMethod) {
|
||||
val constIndex = indexOfFirstLiteralInstructionOrThrow(literal)
|
||||
val targetIndex = indexOfFirstInstructionOrThrow(constIndex, Opcode.IPUT_OBJECT)
|
||||
|
||||
getInstruction<ReferenceInstruction>(targetIndex).reference.toString()
|
||||
}
|
||||
mainActivityOnStartMethod.apply {
|
||||
val insertIndex = indexOfFirstInstructionOrThrow {
|
||||
opcode == Opcode.IGET_OBJECT &&
|
||||
getReference<FieldReference>()?.toString() == viewPagerReference
|
||||
}
|
||||
val insertRegister = getInstruction<TwoRegisterInstruction>(insertIndex).registerA
|
||||
val jumpIndex =
|
||||
indexOfFirstInstructionOrThrow(insertIndex, Opcode.INVOKE_VIRTUAL) + 1
|
||||
|
||||
addInstructionsWithLabels(
|
||||
insertIndex, """
|
||||
invoke-static {}, $PLAYER_CLASS_DESCRIPTOR->$methodName()Z
|
||||
move-result v$insertRegister
|
||||
if-nez v$insertRegister, :disable
|
||||
""", ExternalLabel("disable", getInstruction(jumpIndex))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
addSwitchPreference(
|
||||
CategoryType.PLAYER,
|
||||
"revanced_disable_mini_player_gesture",
|
||||
"false"
|
||||
)
|
||||
addSwitchPreference(
|
||||
CategoryType.PLAYER,
|
||||
"revanced_disable_player_gesture",
|
||||
"false"
|
||||
)
|
||||
|
||||
// endregion
|
||||
|
||||
// region patch for enable color match player and enable black player background
|
||||
|
||||
val (
|
||||
colorMathPlayerMethodParameter,
|
||||
colorMathPlayerInvokeVirtualReference,
|
||||
colorMathPlayerIGetReference
|
||||
) = switchToggleColorFingerprint.matchOrThrow(miniPlayerConstructorFingerprint).let {
|
||||
with(it.method) {
|
||||
val relativeIndex = it.patternMatch!!.endIndex + 1
|
||||
val invokeVirtualIndex =
|
||||
indexOfFirstInstructionOrThrow(relativeIndex, Opcode.INVOKE_VIRTUAL)
|
||||
val iGetIndex = indexOfFirstInstructionOrThrow(relativeIndex, Opcode.IGET)
|
||||
|
||||
// black player background
|
||||
val invokeDirectIndex = indexOfFirstInstructionOrThrow(Opcode.INVOKE_DIRECT)
|
||||
val targetMethod = getWalkerMethod(invokeDirectIndex)
|
||||
val insertIndex = targetMethod.indexOfFirstInstructionOrThrow(Opcode.IF_NE)
|
||||
|
||||
targetMethod.addInstructions(
|
||||
insertIndex, """
|
||||
invoke-static {p1}, $PLAYER_CLASS_DESCRIPTOR->enableBlackPlayerBackground(I)I
|
||||
move-result p1
|
||||
invoke-static {p2}, $PLAYER_CLASS_DESCRIPTOR->enableBlackPlayerBackground(I)I
|
||||
move-result p2
|
||||
"""
|
||||
)
|
||||
Triple(
|
||||
parameters,
|
||||
getInstruction<ReferenceInstruction>(invokeVirtualIndex).reference,
|
||||
getInstruction<ReferenceInstruction>(iGetIndex).reference
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
val colorMathPlayerIPutReference = with(miniPlayerConstructorFingerprint.methodOrThrow()) {
|
||||
val colorGreyIndex = indexOfFirstLiteralInstructionOrThrow(colorGrey)
|
||||
val iPutIndex = indexOfFirstInstructionOrThrow(colorGreyIndex, Opcode.IPUT)
|
||||
getInstruction<ReferenceInstruction>(iPutIndex).reference
|
||||
}
|
||||
|
||||
miniPlayerConstructorFingerprint.mutableClassOrThrow().methods.filter {
|
||||
it.accessFlags == AccessFlags.PUBLIC or AccessFlags.FINAL &&
|
||||
it.parameters == colorMathPlayerMethodParameter &&
|
||||
it.returnType == "V"
|
||||
}.forEach { method ->
|
||||
method.apply {
|
||||
val freeRegister = implementation!!.registerCount - parameters.size - 3
|
||||
|
||||
val invokeDirectIndex =
|
||||
indexOfFirstInstructionReversedOrThrow(Opcode.INVOKE_DIRECT)
|
||||
val invokeDirectReference =
|
||||
getInstruction<ReferenceInstruction>(invokeDirectIndex).reference
|
||||
|
||||
addInstructionsWithLabels(
|
||||
invokeDirectIndex + 1, """
|
||||
invoke-static {}, $PLAYER_CLASS_DESCRIPTOR->enableColorMatchPlayer()Z
|
||||
move-result v$freeRegister
|
||||
if-eqz v$freeRegister, :off
|
||||
invoke-virtual {p1}, $colorMathPlayerInvokeVirtualReference
|
||||
move-result-object v$freeRegister
|
||||
check-cast v$freeRegister, ${(colorMathPlayerIGetReference as FieldReference).definingClass}
|
||||
iget v$freeRegister, v$freeRegister, $colorMathPlayerIGetReference
|
||||
iput v$freeRegister, p0, $colorMathPlayerIPutReference
|
||||
:off
|
||||
invoke-direct {p0}, $invokeDirectReference
|
||||
"""
|
||||
)
|
||||
removeInstruction(invokeDirectIndex)
|
||||
}
|
||||
}
|
||||
|
||||
addSwitchPreference(
|
||||
CategoryType.PLAYER,
|
||||
"revanced_enable_black_player_background",
|
||||
"false"
|
||||
)
|
||||
addSwitchPreference(
|
||||
CategoryType.PLAYER,
|
||||
"revanced_enable_color_match_player",
|
||||
"true"
|
||||
)
|
||||
|
||||
// endregion
|
||||
|
||||
// region patch for enable force minimized player
|
||||
|
||||
minimizedPlayerFingerprint.matchOrThrow().let {
|
||||
it.method.apply {
|
||||
val insertIndex = it.patternMatch!!.endIndex
|
||||
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
insertIndex, """
|
||||
invoke-static {v$insertRegister}, $PLAYER_CLASS_DESCRIPTOR->enableForceMinimizedPlayer(Z)Z
|
||||
move-result v$insertRegister
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
addSwitchPreference(
|
||||
CategoryType.PLAYER,
|
||||
"revanced_enable_force_minimized_player",
|
||||
"true"
|
||||
)
|
||||
|
||||
// endregion
|
||||
|
||||
// region patch for enable next previous button
|
||||
|
||||
@ -402,9 +246,9 @@ val playerComponentsPatch = bytecodePatch(
|
||||
|
||||
addInstructions(
|
||||
invokeStaticIndex, """
|
||||
invoke-static {v$viewArrayRegister}, $PLAYER_CLASS_DESCRIPTOR->getViewArray([Landroid/view/View;)[Landroid/view/View;
|
||||
move-result-object v$viewArrayRegister
|
||||
"""
|
||||
invoke-static {v$viewArrayRegister}, $PLAYER_CLASS_DESCRIPTOR->getViewArray([Landroid/view/View;)[Landroid/view/View;
|
||||
move-result-object v$viewArrayRegister
|
||||
"""
|
||||
)
|
||||
}
|
||||
|
||||
@ -517,6 +361,163 @@ val playerComponentsPatch = bytecodePatch(
|
||||
|
||||
// endregion
|
||||
|
||||
// region patch for enable color match player and enable black player background
|
||||
|
||||
val (
|
||||
colorMathPlayerMethodParameter,
|
||||
colorMathPlayerInvokeVirtualReference,
|
||||
colorMathPlayerIGetReference
|
||||
) = switchToggleColorFingerprint.matchOrThrow(miniPlayerConstructorFingerprint).let {
|
||||
with(it.method) {
|
||||
val relativeIndex = it.patternMatch!!.endIndex + 1
|
||||
val invokeVirtualIndex =
|
||||
indexOfFirstInstructionOrThrow(relativeIndex, Opcode.INVOKE_VIRTUAL)
|
||||
val iGetIndex = indexOfFirstInstructionOrThrow(relativeIndex, Opcode.IGET)
|
||||
|
||||
// black player background
|
||||
val invokeDirectIndex = indexOfFirstInstructionOrThrow(Opcode.INVOKE_DIRECT)
|
||||
val targetMethod = getWalkerMethod(invokeDirectIndex)
|
||||
val insertIndex = targetMethod.indexOfFirstInstructionOrThrow(Opcode.IF_NE)
|
||||
|
||||
targetMethod.addInstructions(
|
||||
insertIndex, """
|
||||
invoke-static {p1}, $PLAYER_CLASS_DESCRIPTOR->enableBlackPlayerBackground(I)I
|
||||
move-result p1
|
||||
invoke-static {p2}, $PLAYER_CLASS_DESCRIPTOR->enableBlackPlayerBackground(I)I
|
||||
move-result p2
|
||||
"""
|
||||
)
|
||||
Triple(
|
||||
parameters,
|
||||
getInstruction<ReferenceInstruction>(invokeVirtualIndex).reference,
|
||||
getInstruction<ReferenceInstruction>(iGetIndex).reference
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
val colorMathPlayerIPutReference = with(miniPlayerConstructorFingerprint.methodOrThrow()) {
|
||||
val colorGreyIndex = indexOfFirstLiteralInstructionOrThrow(colorGrey)
|
||||
val iPutIndex = indexOfFirstInstructionOrThrow(colorGreyIndex, Opcode.IPUT)
|
||||
getInstruction<ReferenceInstruction>(iPutIndex).reference
|
||||
}
|
||||
|
||||
miniPlayerConstructorFingerprint.mutableClassOrThrow().methods.filter {
|
||||
it.accessFlags == AccessFlags.PUBLIC or AccessFlags.FINAL &&
|
||||
it.parameters == colorMathPlayerMethodParameter &&
|
||||
it.returnType == "V"
|
||||
}.forEach { method ->
|
||||
method.apply {
|
||||
val freeRegister = implementation!!.registerCount - parameters.size - 3
|
||||
|
||||
val invokeDirectIndex =
|
||||
indexOfFirstInstructionReversedOrThrow(Opcode.INVOKE_DIRECT)
|
||||
val invokeDirectReference =
|
||||
getInstruction<ReferenceInstruction>(invokeDirectIndex).reference
|
||||
|
||||
addInstructionsWithLabels(
|
||||
invokeDirectIndex + 1, """
|
||||
invoke-static {}, $PLAYER_CLASS_DESCRIPTOR->enableColorMatchPlayer()Z
|
||||
move-result v$freeRegister
|
||||
if-eqz v$freeRegister, :off
|
||||
invoke-virtual {p1}, $colorMathPlayerInvokeVirtualReference
|
||||
move-result-object v$freeRegister
|
||||
check-cast v$freeRegister, ${(colorMathPlayerIGetReference as FieldReference).definingClass}
|
||||
iget v$freeRegister, v$freeRegister, $colorMathPlayerIGetReference
|
||||
iput v$freeRegister, p0, $colorMathPlayerIPutReference
|
||||
:off
|
||||
invoke-direct {p0}, $invokeDirectReference
|
||||
"""
|
||||
)
|
||||
removeInstruction(invokeDirectIndex)
|
||||
}
|
||||
}
|
||||
|
||||
addSwitchPreference(
|
||||
CategoryType.PLAYER,
|
||||
"revanced_enable_color_match_player",
|
||||
"true"
|
||||
)
|
||||
addSwitchPreference(
|
||||
CategoryType.PLAYER,
|
||||
"revanced_enable_black_player_background",
|
||||
"false"
|
||||
)
|
||||
|
||||
// endregion
|
||||
|
||||
// region patch for disable gesture in player
|
||||
|
||||
val playerViewPagerConstructorMethod =
|
||||
playerViewPagerConstructorFingerprint.methodOrThrow()
|
||||
val mainActivityOnStartMethod =
|
||||
getMainActivityMethod("onStart")
|
||||
|
||||
mapOf(
|
||||
miniPlayerViewPager to "disableMiniPlayerGesture",
|
||||
playerViewPager to "disablePlayerGesture"
|
||||
).forEach { (literal, methodName) ->
|
||||
val viewPagerReference = with(playerViewPagerConstructorMethod) {
|
||||
val constIndex = indexOfFirstLiteralInstructionOrThrow(literal)
|
||||
val targetIndex = indexOfFirstInstructionOrThrow(constIndex, Opcode.IPUT_OBJECT)
|
||||
|
||||
getInstruction<ReferenceInstruction>(targetIndex).reference.toString()
|
||||
}
|
||||
mainActivityOnStartMethod.apply {
|
||||
val insertIndex = indexOfFirstInstructionOrThrow {
|
||||
opcode == Opcode.IGET_OBJECT &&
|
||||
getReference<FieldReference>()?.toString() == viewPagerReference
|
||||
}
|
||||
val insertRegister = getInstruction<TwoRegisterInstruction>(insertIndex).registerA
|
||||
val jumpIndex =
|
||||
indexOfFirstInstructionOrThrow(insertIndex, Opcode.INVOKE_VIRTUAL) + 1
|
||||
|
||||
addInstructionsWithLabels(
|
||||
insertIndex, """
|
||||
invoke-static {}, $PLAYER_CLASS_DESCRIPTOR->$methodName()Z
|
||||
move-result v$insertRegister
|
||||
if-nez v$insertRegister, :disable
|
||||
""", ExternalLabel("disable", getInstruction(jumpIndex))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
addSwitchPreference(
|
||||
CategoryType.PLAYER,
|
||||
"revanced_disable_mini_player_gesture",
|
||||
"false"
|
||||
)
|
||||
addSwitchPreference(
|
||||
CategoryType.PLAYER,
|
||||
"revanced_disable_player_gesture",
|
||||
"false"
|
||||
)
|
||||
|
||||
// endregion
|
||||
|
||||
// region patch for enable force minimized player
|
||||
|
||||
minimizedPlayerFingerprint.matchOrThrow().let {
|
||||
it.method.apply {
|
||||
val insertIndex = it.patternMatch!!.endIndex
|
||||
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
insertIndex, """
|
||||
invoke-static {v$insertRegister}, $PLAYER_CLASS_DESCRIPTOR->enableForceMinimizedPlayer(Z)Z
|
||||
move-result v$insertRegister
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
addSwitchPreference(
|
||||
CategoryType.PLAYER,
|
||||
"revanced_enable_force_minimized_player",
|
||||
"true"
|
||||
)
|
||||
|
||||
// endregion
|
||||
|
||||
// region patch for enable swipe to dismiss mini player
|
||||
|
||||
if (!is_6_42_or_greater) {
|
||||
@ -725,38 +726,6 @@ val playerComponentsPatch = bytecodePatch(
|
||||
|
||||
// endregion
|
||||
|
||||
// region patch for hide audio video switch toggle
|
||||
|
||||
audioVideoSwitchToggleFingerprint.methodOrThrow().apply {
|
||||
implementation!!.instructions
|
||||
.withIndex()
|
||||
.filter { (_, instruction) ->
|
||||
val reference = (instruction as? ReferenceInstruction)?.reference
|
||||
instruction.opcode == Opcode.INVOKE_VIRTUAL &&
|
||||
reference is MethodReference &&
|
||||
reference.toString() == AUDIO_VIDEO_SWITCH_TOGGLE_VISIBILITY
|
||||
}
|
||||
.map { (index, _) -> index }
|
||||
.reversed()
|
||||
.forEach { index ->
|
||||
val instruction = getInstruction<FiveRegisterInstruction>(index)
|
||||
|
||||
replaceInstruction(
|
||||
index,
|
||||
"invoke-static {v${instruction.registerC}, v${instruction.registerD}}," +
|
||||
"$PLAYER_CLASS_DESCRIPTOR->hideAudioVideoSwitchToggle(Landroid/view/View;I)V"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
addSwitchPreference(
|
||||
CategoryType.PLAYER,
|
||||
"revanced_hide_audio_video_switch_toggle",
|
||||
"false"
|
||||
)
|
||||
|
||||
// endregion
|
||||
|
||||
// region patch for hide channel guideline, timestamps & emoji picker buttons
|
||||
|
||||
addLithoFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
@ -766,11 +735,6 @@ val playerComponentsPatch = bytecodePatch(
|
||||
"revanced_hide_comment_channel_guidelines",
|
||||
"true"
|
||||
)
|
||||
addSwitchPreference(
|
||||
CategoryType.PLAYER,
|
||||
"revanced_hide_comment_timestamp_and_emoji_buttons",
|
||||
"false"
|
||||
)
|
||||
|
||||
// region patch for hide double-tap overlay filter
|
||||
|
||||
@ -796,6 +760,12 @@ val playerComponentsPatch = bytecodePatch(
|
||||
|
||||
// endregion
|
||||
|
||||
addSwitchPreference(
|
||||
CategoryType.PLAYER,
|
||||
"revanced_hide_comment_timestamp_and_emoji_buttons",
|
||||
"false"
|
||||
)
|
||||
|
||||
// region patch for hide fullscreen share button
|
||||
|
||||
remixGenericButtonFingerprint.matchOrThrow().let {
|
||||
@ -820,6 +790,38 @@ val playerComponentsPatch = bytecodePatch(
|
||||
|
||||
// endregion
|
||||
|
||||
// region patch for hide song video switch toggle
|
||||
|
||||
audioVideoSwitchToggleFingerprint.methodOrThrow().apply {
|
||||
implementation!!.instructions
|
||||
.withIndex()
|
||||
.filter { (_, instruction) ->
|
||||
val reference = (instruction as? ReferenceInstruction)?.reference
|
||||
instruction.opcode == Opcode.INVOKE_VIRTUAL &&
|
||||
reference is MethodReference &&
|
||||
reference.toString() == AUDIO_VIDEO_SWITCH_TOGGLE_VISIBILITY
|
||||
}
|
||||
.map { (index, _) -> index }
|
||||
.reversed()
|
||||
.forEach { index ->
|
||||
val instruction = getInstruction<FiveRegisterInstruction>(index)
|
||||
|
||||
replaceInstruction(
|
||||
index,
|
||||
"invoke-static {v${instruction.registerC}, v${instruction.registerD}}," +
|
||||
"$PLAYER_CLASS_DESCRIPTOR->hideAudioVideoSwitchToggle(Landroid/view/View;I)V"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
addSwitchPreference(
|
||||
CategoryType.PLAYER,
|
||||
"revanced_hide_audio_video_switch_toggle",
|
||||
"false"
|
||||
)
|
||||
|
||||
// endregion
|
||||
|
||||
// region patch for remember repeat state
|
||||
|
||||
val (repeatTrackMethod, repeatTrackIndex) = repeatTrackFingerprint.matchOrThrow().let {
|
||||
|
@ -7,8 +7,6 @@ import app.revanced.patches.music.utils.extension.sharedExtensionPatch
|
||||
import app.revanced.patches.music.utils.fix.fileprovider.fileProviderPatch
|
||||
import app.revanced.patches.music.utils.mainactivity.mainActivityFingerprint
|
||||
import app.revanced.patches.music.utils.patch.PatchList.GMSCORE_SUPPORT
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.ResourceUtils.addGmsCorePreference
|
||||
import app.revanced.patches.music.utils.settings.ResourceUtils.updatePackageName
|
||||
import app.revanced.patches.music.utils.settings.ResourceUtils.updatePatchStatus
|
||||
import app.revanced.patches.music.utils.settings.settingsPatch
|
||||
@ -37,13 +35,9 @@ private fun gmsCoreSupportResourcePatch(
|
||||
packageNameYouTubeOption = packageNameYouTubeOption,
|
||||
packageNameYouTubeMusicOption = packageNameYouTubeMusicOption,
|
||||
executeBlock = {
|
||||
updatePackageName(packageNameYouTubeMusicOption.valueOrThrow())
|
||||
|
||||
addGmsCorePreference(
|
||||
CategoryType.MISC.value,
|
||||
"gms_core_settings",
|
||||
updatePackageName(
|
||||
gmsCoreVendorGroupIdOption.valueOrThrow() + ".android.gms",
|
||||
"org.microg.gms.ui.SettingsActivity"
|
||||
packageNameYouTubeMusicOption.valueOrThrow()
|
||||
)
|
||||
|
||||
updatePatchStatus(GMSCORE_SUPPORT)
|
||||
|
@ -49,8 +49,8 @@ internal enum class PatchList(
|
||||
"Disable DRC audio",
|
||||
"Adds an option to disable DRC (Dynamic Range Compression) audio."
|
||||
),
|
||||
DISABLE_AUTO_CAPTIONS(
|
||||
"Disable auto captions",
|
||||
DISABLE_FORCED_AUTO_CAPTIONS(
|
||||
"Disable forced auto captions",
|
||||
"Adds an option to disable captions from being automatically enabled."
|
||||
),
|
||||
DISABLE_DISLIKE_REDIRECTION(
|
||||
|
@ -32,6 +32,7 @@ internal object ResourceUtils {
|
||||
const val ACTIVITY_HOOK_TARGET_CLASS =
|
||||
"com.google.android.gms.common.api.GoogleApiActivity"
|
||||
|
||||
var gmsCorePackageName = "app.revanced.android.gms"
|
||||
var musicPackageName = YOUTUBE_MUSIC_PACKAGE_NAME
|
||||
|
||||
private var iconType = "default"
|
||||
@ -68,8 +69,12 @@ internal object ResourceUtils {
|
||||
}
|
||||
}
|
||||
|
||||
fun updatePackageName(newPackage: String) {
|
||||
musicPackageName = newPackage
|
||||
fun updatePackageName(
|
||||
newGmsCorePackage: String,
|
||||
newMusicPackage: String,
|
||||
) {
|
||||
gmsCorePackageName = newGmsCorePackage
|
||||
musicPackageName = newMusicPackage
|
||||
replacePackageName()
|
||||
}
|
||||
|
||||
|
@ -13,8 +13,11 @@ import app.revanced.patches.music.utils.extension.Constants.EXTENSION_PATH
|
||||
import app.revanced.patches.music.utils.extension.Constants.UTILS_PATH
|
||||
import app.revanced.patches.music.utils.extension.sharedExtensionPatch
|
||||
import app.revanced.patches.music.utils.mainactivity.mainActivityResolvePatch
|
||||
import app.revanced.patches.music.utils.patch.PatchList.GMSCORE_SUPPORT
|
||||
import app.revanced.patches.music.utils.patch.PatchList.SETTINGS_FOR_YOUTUBE_MUSIC
|
||||
import app.revanced.patches.music.utils.playservice.versionCheckPatch
|
||||
import app.revanced.patches.music.utils.settings.ResourceUtils.addGmsCorePreference
|
||||
import app.revanced.patches.music.utils.settings.ResourceUtils.gmsCorePackageName
|
||||
import app.revanced.patches.shared.extension.Constants.EXTENSION_UTILS_CLASS_DESCRIPTOR
|
||||
import app.revanced.patches.shared.mainactivity.injectConstructorMethodCall
|
||||
import app.revanced.patches.shared.mainactivity.injectOnCreateMethodCall
|
||||
@ -202,6 +205,14 @@ val settingsPatch = resourcePatch(
|
||||
ResourceUtils.addRVXSettingsPreference()
|
||||
|
||||
ResourceUtils.updatePatchStatus(SETTINGS_FOR_YOUTUBE_MUSIC)
|
||||
|
||||
/**
|
||||
* add import export settings
|
||||
*/
|
||||
addPreferenceWithIntent(
|
||||
CategoryType.MISC,
|
||||
"revanced_extended_settings_import_export"
|
||||
)
|
||||
}
|
||||
|
||||
finalize {
|
||||
@ -236,13 +247,14 @@ val settingsPatch = resourcePatch(
|
||||
"revanced_default_app_settings"
|
||||
)
|
||||
|
||||
/**
|
||||
* add import export settings
|
||||
*/
|
||||
addPreferenceWithIntent(
|
||||
CategoryType.MISC,
|
||||
"revanced_extended_settings_import_export"
|
||||
)
|
||||
if (GMSCORE_SUPPORT.included == true) {
|
||||
addGmsCorePreference(
|
||||
CategoryType.MISC.value,
|
||||
"gms_core_settings",
|
||||
gmsCorePackageName,
|
||||
"org.microg.gms.ui.SettingsActivity"
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* sort preference
|
||||
|
@ -5,7 +5,7 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
|
||||
import app.revanced.patches.youtube.utils.extension.Constants.GENERAL_CLASS_DESCRIPTOR
|
||||
import app.revanced.patches.youtube.utils.patch.PatchList.DISABLE_AUTO_AUDIO_TRACKS
|
||||
import app.revanced.patches.youtube.utils.patch.PatchList.DISABLE_FORCED_AUTO_AUDIO_TRACKS
|
||||
import app.revanced.patches.youtube.utils.settings.ResourceUtils.addPreference
|
||||
import app.revanced.patches.youtube.utils.settings.settingsPatch
|
||||
import app.revanced.util.fingerprint.methodOrThrow
|
||||
@ -19,8 +19,8 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
|
||||
@Suppress("unused")
|
||||
val audioTracksPatch = bytecodePatch(
|
||||
DISABLE_AUTO_AUDIO_TRACKS.title,
|
||||
DISABLE_AUTO_AUDIO_TRACKS.summary,
|
||||
DISABLE_FORCED_AUTO_AUDIO_TRACKS.title,
|
||||
DISABLE_FORCED_AUTO_AUDIO_TRACKS.summary,
|
||||
) {
|
||||
compatibleWith(COMPATIBLE_PACKAGE)
|
||||
|
||||
@ -67,7 +67,7 @@ val audioTracksPatch = bytecodePatch(
|
||||
"PREFERENCE_SCREEN: GENERAL",
|
||||
"SETTINGS: DISABLE_AUTO_AUDIO_TRACKS"
|
||||
),
|
||||
DISABLE_AUTO_AUDIO_TRACKS
|
||||
DISABLE_FORCED_AUTO_AUDIO_TRACKS
|
||||
)
|
||||
|
||||
// endregion
|
||||
|
@ -3,14 +3,14 @@ package app.revanced.patches.youtube.general.autocaptions
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patches.shared.captions.baseAutoCaptionsPatch
|
||||
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
|
||||
import app.revanced.patches.youtube.utils.patch.PatchList.DISABLE_AUTO_CAPTIONS
|
||||
import app.revanced.patches.youtube.utils.patch.PatchList.DISABLE_FORCED_AUTO_CAPTIONS
|
||||
import app.revanced.patches.youtube.utils.settings.ResourceUtils.addPreference
|
||||
import app.revanced.patches.youtube.utils.settings.settingsPatch
|
||||
|
||||
@Suppress("unused")
|
||||
val autoCaptionsPatch = bytecodePatch(
|
||||
DISABLE_AUTO_CAPTIONS.title,
|
||||
DISABLE_AUTO_CAPTIONS.summary,
|
||||
DISABLE_FORCED_AUTO_CAPTIONS.title,
|
||||
DISABLE_FORCED_AUTO_CAPTIONS.summary,
|
||||
) {
|
||||
compatibleWith(COMPATIBLE_PACKAGE)
|
||||
|
||||
@ -28,7 +28,7 @@ val autoCaptionsPatch = bytecodePatch(
|
||||
"PREFERENCE_SCREEN: GENERAL",
|
||||
"SETTINGS: DISABLE_AUTO_CAPTIONS"
|
||||
),
|
||||
DISABLE_AUTO_CAPTIONS
|
||||
DISABLE_FORCED_AUTO_CAPTIONS
|
||||
)
|
||||
|
||||
// endregion
|
||||
|
@ -57,12 +57,12 @@ internal enum class PatchList(
|
||||
"Disable QUIC protocol",
|
||||
"Adds an option to disable CronetEngine's QUIC protocol."
|
||||
),
|
||||
DISABLE_AUTO_AUDIO_TRACKS(
|
||||
"Disable auto audio tracks",
|
||||
DISABLE_FORCED_AUTO_AUDIO_TRACKS(
|
||||
"Disable forced auto audio tracks",
|
||||
"Adds an option to disable audio tracks from being automatically enabled."
|
||||
),
|
||||
DISABLE_AUTO_CAPTIONS(
|
||||
"Disable auto captions",
|
||||
DISABLE_FORCED_AUTO_CAPTIONS(
|
||||
"Disable forced auto captions",
|
||||
"Adds an option to disable captions from being automatically enabled."
|
||||
),
|
||||
DISABLE_HAPTIC_FEEDBACK(
|
||||
|
Reference in New Issue
Block a user