mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-12-07 01:51:27 +01:00
Move patch warnings to individual patches if user turns off version constrains and patches anyway
This commit is contained in:
@@ -11,6 +11,7 @@ import app.revanced.patches.youtube.misc.litho.filter.lithoFilterPatch
|
||||
import app.revanced.patches.youtube.misc.playservice.is_20_22_or_greater
|
||||
import app.revanced.patches.youtube.misc.playservice.versionCheckPatch
|
||||
import app.revanced.patches.youtube.misc.settings.PreferenceScreen
|
||||
import java.util.logging.Logger
|
||||
|
||||
val hideButtonsPatch = resourcePatch(
|
||||
name = "Hide video action buttons",
|
||||
@@ -44,20 +45,30 @@ val hideButtonsPatch = resourcePatch(
|
||||
SwitchPreference("revanced_hide_save_button"),
|
||||
)
|
||||
|
||||
if (!is_20_22_or_greater) {
|
||||
if (is_20_22_or_greater) {
|
||||
// FIXME: 20.22+ filtering of the action buttons doesn't work because
|
||||
// the buffer is the same for all buttons.
|
||||
preferences.addAll(listOf(
|
||||
SwitchPreference("revanced_hide_hype_button"),
|
||||
Logger.getLogger(this::class.java.name).warning(
|
||||
"\n!!!" +
|
||||
"\n!!! Not all player action buttons can be set hidden when patching 20.22+" +
|
||||
"\n!!! Patch 20.21.37 or lower if you want to hide player action buttons" +
|
||||
"\n!!!"
|
||||
)
|
||||
} else {
|
||||
preferences.addAll(
|
||||
listOf(
|
||||
SwitchPreference("revanced_hide_hype_button"),
|
||||
SwitchPreference("revanced_hide_ask_button"),
|
||||
SwitchPreference("revanced_hide_clip_button"),
|
||||
SwitchPreference("revanced_hide_clip_button"),
|
||||
SwitchPreference("revanced_hide_promote_button"),
|
||||
SwitchPreference("revanced_hide_remix_button"),
|
||||
SwitchPreference("revanced_hide_report_button"),
|
||||
SwitchPreference("revanced_hide_share_button"),
|
||||
SwitchPreference("revanced_hide_shop_button"),SwitchPreference("revanced_hide_stop_ads_button"),
|
||||
SwitchPreference("revanced_hide_thanks_button"),
|
||||
))
|
||||
SwitchPreference("revanced_hide_remix_button"),
|
||||
SwitchPreference("revanced_hide_report_button"),
|
||||
SwitchPreference("revanced_hide_share_button"),
|
||||
SwitchPreference("revanced_hide_shop_button"),
|
||||
SwitchPreference("revanced_hide_stop_ads_button"),
|
||||
SwitchPreference("revanced_hide_thanks_button"),
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
PreferenceScreen.PLAYER.addPreferences(
|
||||
|
||||
@@ -32,6 +32,7 @@ import app.revanced.util.removeFromParent
|
||||
import app.revanced.util.returnLate
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
import java.util.logging.Logger
|
||||
|
||||
internal val hideShortsAppShortcutOption = booleanOption(
|
||||
key = "hideShortsAppShortcut",
|
||||
@@ -71,8 +72,15 @@ private val hideShortsComponentsResourcePatch = resourcePatch {
|
||||
SwitchPreference("revanced_hide_shorts_dislike_button"),
|
||||
)
|
||||
|
||||
if (!is_20_22_or_greater) {
|
||||
if (is_20_22_or_greater) {
|
||||
// FIXME: The buffer is very different for 20.22+ and these current cannot be hidden.
|
||||
Logger.getLogger(this::class.java.name).warning(
|
||||
"\n!!!" +
|
||||
"\n!!! Shorts action buttons currently cannot be set hidden when patching 20.22+" +
|
||||
"\n!!! Patch 20.21.37 or lower if you want to hide Shorts action buttons" +
|
||||
"\n!!!"
|
||||
)
|
||||
} else {
|
||||
preferences.addAll(
|
||||
listOf(
|
||||
SwitchPreference("revanced_hide_shorts_comments_button"),
|
||||
|
||||
@@ -207,6 +207,13 @@ val returnYouTubeDislikePatch = bytecodePatch(
|
||||
if (is_20_41_or_greater) {
|
||||
// TODO: Support the new non litho Shorts layout.
|
||||
// Turning off this flag on later versions can break the Shorts overlay and nothing is shown.
|
||||
Logger.getLogger(this::class.java.name).warning(
|
||||
"\n!!!" +
|
||||
"\n!!! Dislikes are not yet fully supported when patching YouTube 20.40+" +
|
||||
"\n!!! Patch 20.21.37 or lower if you want to see dislikes" +
|
||||
"\n!!!"
|
||||
)
|
||||
|
||||
Logger.getLogger(this::class.java.name).warning(
|
||||
"20.40+ Shorts player is not fully supported yet. Shorts Dislikes may not show."
|
||||
)
|
||||
|
||||
@@ -22,7 +22,6 @@ import app.revanced.util.insertLiteralOverride
|
||||
import app.revanced.util.returnLate
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import java.util.logging.Logger
|
||||
|
||||
lateinit var addLithoFilter: (String) -> Unit
|
||||
private set
|
||||
@@ -208,16 +207,6 @@ val lithoFilterPatch = bytecodePatch(
|
||||
|
||||
// Turn off a feature flag that enables native code of protobuf parsing (Upb protobuf).
|
||||
lithoConverterBufferUpbFeatureFlagFingerprint.let {
|
||||
// Procool buffer has changed in 20.22, and UPB native code is now always enabled.
|
||||
if (is_20_22_or_greater) {
|
||||
Logger.getLogger(this::class.java.name).warning(
|
||||
"\n!!!" +
|
||||
"\n!!! Litho filtering is not yet fully supported when patching 20.22+" +
|
||||
"\n!!! Action buttons, Shorts shelves, and possibly other components cannot be set hidden." +
|
||||
"\n!!!"
|
||||
)
|
||||
}
|
||||
|
||||
// 20.22 the flag is still enabled in one location, but what it does is not known.
|
||||
// Disable it anyway.
|
||||
it.method.insertLiteralOverride(
|
||||
|
||||
Reference in New Issue
Block a user