This commit is contained in:
inotia00
2023-02-15 11:57:57 +09:00
parent ec8bf1c2bb
commit 79a808db5c
213 changed files with 1710 additions and 3027 deletions

View File

@ -10,9 +10,8 @@ import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch
import app.revanced.patches.youtube.misc.litho.patch.LithoFilterPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-button-container")
@ -31,18 +30,15 @@ class ButtonContainerPatch : ResourcePatch {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: BOTTOM_PLAYER",
"SETTINGS: BUTTON_CONTAINER"
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: BOTTOM_PLAYER",
"SETTINGS: BUTTON_CONTAINER"
)
)
ResourceHelper.patchSuccess(
context,
"hide-button-container"
)
SettingsPatch.updatePatchStatus("hide-button-container")
return PatchResultSuccess()
}

View File

@ -12,7 +12,6 @@ import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.ads.general.bytecode.patch.GeneralAdsBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-comment-component")
@ -31,18 +30,15 @@ class CommentComponentPatch : ResourcePatch {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: BOTTOM_PLAYER",
"SETTINGS: COMMENT_COMPONENT"
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: BOTTOM_PLAYER",
"SETTINGS: COMMENT_COMPONENT"
)
)
ResourceHelper.patchSuccess(
context,
"hide-comment-component"
)
SettingsPatch.updatePatchStatus("hide-comment-component")
return PatchResultSuccess()
}

View File

@ -0,0 +1,31 @@
package app.revanced.patches.youtube.layout.etc.branding.icon.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.IconHelper.customIcon
import app.revanced.util.resources.ResourceHelper.updatePatchStatusIcon
@Patch(false)
@Name("custom-branding-icon-afn-blue")
@Description("Changes the YouTube launcher icon (Afn / Blue).")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class CustomBrandingIconBluePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
context.customIcon("blue")
context.updatePatchStatusIcon("blue")
return PatchResultSuccess()
}
}

View File

@ -0,0 +1,31 @@
package app.revanced.patches.youtube.layout.etc.branding.icon.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.IconHelper.customIcon
import app.revanced.util.resources.ResourceHelper.updatePatchStatusIcon
@Patch
@Name("custom-branding-icon-afn-red")
@Description("Changes the YouTube launcher icon (Afn / Red).")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class CustomBrandingIconRedPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
context.customIcon("red")
context.updatePatchStatusIcon("red")
return PatchResultSuccess()
}
}

View File

@ -0,0 +1,31 @@
package app.revanced.patches.youtube.layout.etc.branding.icon.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.IconHelper.customIcon
import app.revanced.util.resources.ResourceHelper.updatePatchStatusIcon
@Patch(false)
@Name("custom-branding-icon-revancify")
@Description("Changes the YouTube launcher icon (Revancify).")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class CustomBrandingIconRevancifyPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
context.customIcon("revancify")
context.updatePatchStatusIcon("revancify")
return PatchResultSuccess()
}
}

View File

@ -0,0 +1,61 @@
package app.revanced.patches.youtube.layout.etc.branding.name.patch
import app.revanced.extensions.startsWithAny
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.options.PatchOptions
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper.updatePatchStatusLabel
import org.w3c.dom.Element
@Patch
@Name("custom-branding-name")
@DependsOn(
[
PatchOptions::class,
SettingsPatch::class
]
)
@Description("Changes the YouTube launcher name to your choice (defaults to ReVanced Extended).")
@YouTubeCompatibility
@Version("0.0.1")
class CustomBrandingNamePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
// App name
val resourceFileNames = arrayOf("strings.xml")
val appName = PatchOptions.YouTubeAppName
context.forEach {
if (!it.name.startsWithAny(*resourceFileNames)) return@forEach
// for each file in the "layouts" directory replace all necessary attributes content
context.xmlEditor[it.absolutePath].use { editor ->
val resourcesNode = editor.file.getElementsByTagName("resources").item(0) as Element
for (i in 0 until resourcesNode.childNodes.length) {
val node = resourcesNode.childNodes.item(i)
if (node !is Element) continue
val element = resourcesNode.childNodes.item(i) as Element
element.textContent = when (element.getAttribute("name")) {
"application_name" -> "$appName"
else -> continue
}
}
}
}
context.updatePatchStatusLabel("$appName")
return PatchResultSuccess()
}
}

View File

@ -0,0 +1,65 @@
package app.revanced.patches.youtube.layout.etc.forceheader.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import java.nio.file.Files
import java.nio.file.StandardCopyOption
import kotlin.io.path.exists
@Patch(false)
@Name("force-premium-heading")
@Description("Forces premium heading on the home screen.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class PremiumHeadingPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
val resDirectory = context["res"]
if (!resDirectory.isDirectory) return PatchResultError("The res folder can not be found.")
val (original, replacement) = "yt_premium_wordmark_header" to "yt_wordmark_header"
val modes = arrayOf("light", "dark")
arrayOf("xxxhdpi", "xxhdpi", "xhdpi", "hdpi", "mdpi").forEach { size ->
val headingDirectory = resDirectory.resolve("drawable-$size")
modes.forEach { mode ->
val fromPath = headingDirectory.resolve("${original}_$mode.png").toPath()
val toPath = headingDirectory.resolve("${replacement}_$mode.png").toPath()
if (!fromPath.exists())
return PatchResultError("The file $fromPath does not exist in the resources. Therefore, this patch can not succeed.")
Files.copy(
fromPath,
toPath,
StandardCopyOption.REPLACE_EXISTING
)
}
}
val prefs = context["res/xml/revanced_prefs.xml"]
prefs.writeText(
prefs.readText()
.replace(
"HEADER_SWITCH",
"FORCE_PREMIUM_HEADER"
).replace(
"header-switch",
"force-premium-heading"
)
)
SettingsPatch.updatePatchStatus("force-premium-heading")
return PatchResultSuccess()
}
}

View File

@ -0,0 +1,78 @@
package app.revanced.patches.youtube.layout.etc.materialyou.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.etc.theme.bytecode.patch.GeneralThemePatch
import app.revanced.patches.youtube.layout.etc.theme.bytecode.patch.GeneralThemePatch.Companion.isMonetPatchIncluded
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper.updatePatchStatusTheme
import app.revanced.util.resources.ResourceUtils.copyXmlNode
import java.nio.file.Files
import java.nio.file.StandardCopyOption
@Patch(false)
@Name("materialyou")
@Description("Enables MaterialYou theme for Android 12+")
@DependsOn(
[
GeneralThemePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class MaterialYouPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
val drawables1 = "drawable-night-v31" to arrayOf(
"new_content_dot_background.xml"
)
val drawables2 = "drawable-v31" to arrayOf(
"new_content_count_background.xml",
"new_content_dot_background.xml"
)
val layout1 = "layout-v31" to arrayOf(
"new_content_count.xml"
)
arrayOf(drawables1, drawables2, layout1).forEach { (path, resourceNames) ->
Files.createDirectory(context["res"].resolve(path).toPath())
resourceNames.forEach { name ->
val monetPath = "$path/$name"
Files.copy(
this.javaClass.classLoader.getResourceAsStream("youtube/materialyou/$monetPath")!!,
context["res"].resolve(monetPath).toPath(),
StandardCopyOption.REPLACE_EXISTING
)
}
}
val sourcePath = this.javaClass.classLoader.getResourceAsStream("youtube/materialyou/host/values-v31/colors.xml")!!
val relativePath = context.xmlEditor["res/values-v31/colors.xml"]
"resources".copyXmlNode(
context.xmlEditor[sourcePath],
relativePath
)
/*
add settings
*/
context.updatePatchStatusTheme("materialyou")
isMonetPatchIncluded = true
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.snackbar.resource.patch
package app.revanced.patches.youtube.layout.etc.optimize.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
@ -10,40 +10,24 @@ import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.snackbar.bytecode.patch.HideSnackbarBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-snackbar")
@Description("Hides the snackbar action popup.")
@Name("optimize-resource")
@DependsOn(
[
HideSnackbarBytecodePatch::class,
RedundantResourcePatch::class,
SettingsPatch::class
]
)
@Description("Removes duplicate resources from YouTube.")
@YouTubeCompatibility
@Version("0.0.1")
class HideSnackbarPatch : ResourcePatch {
class OptimizeResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_SNACKBAR"
)
ResourceHelper.patchSuccess(
context,
"hide-snackbar"
)
SettingsPatch.updatePatchStatus("optimize-resource")
return PatchResultSuccess()
}
}
}

View File

@ -0,0 +1,195 @@
package app.revanced.patches.youtube.layout.etc.optimize.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.util.resources.ResourceUtils
import app.revanced.util.resources.ResourceUtils.copyResources
import java.io.File
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.StandardCopyOption
@Name("remove-duplicate-resource-patch")
@Description("Removes duplicate resources from YouTube.")
@YouTubeCompatibility
@Version("0.0.1")
class RedundantResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
// Convert universal APK to anti-split APK
arrayOf(
WHITELIST_MDPI,
WHITELIST_HDPI,
WHITELIST_XHDPI,
WHITELIST_XXXHDPI
).forEach { (path, array) ->
val tmpDirectory = path + "-v21"
Files.createDirectory(context["res"].resolve(tmpDirectory).toPath())
(WHITELIST_GENERAL + array).forEach { name ->
try {
Files.copy(
context["res"].resolve("$path/$name").toPath(),
context["res"].resolve("$tmpDirectory/$name").toPath(),
StandardCopyOption.REPLACE_EXISTING
)
} catch (_: Exception) {}
}
val directoryPath = context["res"].resolve(path)
Files.walk(directoryPath.toPath())
.map(Path::toFile)
.sorted(Comparator.reverseOrder())
.forEach(File::delete)
Files.move(
context["res"].resolve(tmpDirectory).toPath(),
context["res"].resolve(path).toPath()
)
}
context.copyResources(
"youtube/resource",
ResourceUtils.ResourceGroup(
"raw",
"third_party_licenses",
"third_party_license_metadata"
)
)
return PatchResultSuccess()
}
private companion object {
val WHITELIST_GENERAL = arrayOf(
"product_logo_youtube_color_24.png",
"product_logo_youtube_color_36.png",
"product_logo_youtube_color_144.png",
"product_logo_youtube_color_192.png",
"yt_outline_audio_black_24.png",
"yt_outline_bag_black_24.png",
"yt_outline_fashion_black_24.png",
"yt_outline_film_strip_black_24.png",
"yt_outline_fire_black_24.png",
"yt_outline_gaming_black_24.png",
"yt_outline_lightbulb_black_24.png",
"yt_outline_news_black_24.png",
"yt_outline_radar_live_black_24.png",
"yt_outline_trophy_black_24.png",
"yt_premium_wordmark_header_dark.png",
"yt_premium_wordmark_header_light.png"
)
val WHITELIST_MDPI = "drawable-mdpi" to arrayOf(
"ic_searchable.webp",
"generic_dark_x1.png",
"generic_light_x1.png"
)
val WHITELIST_HDPI = "drawable-hdpi" to arrayOf(
"transition.png"
)
val WHITELIST_XHDPI = "drawable-xhdpi" to arrayOf(
"action_bar_logo_release.png",
"ad_feed_call_to_action_arrow.webp",
"ad_skip.png",
"alert_error.png",
"api_btn_cc_off.png",
"api_btn_cc_on.png",
"api_btn_hd_off.png",
"api_btn_hd_on.png",
"api_btn_hq_off.png",
"api_btn_hq_on.png",
"api_btn_next.png",
"api_btn_pause.png",
"api_btn_play.png",
"api_btn_prev.png",
"api_btn_replay.png",
"api_btn_unavailable.png",
"api_ic_full_screen.png",
"api_ic_full_screen_selected.png",
"api_ic_live.9.png",
"api_ic_options.png",
"api_ic_options_selected.png",
"api_ic_small_screen.png",
"api_ic_small_screen_selected.png",
"api_player_bar.9.png",
"api_player_buffered.9.png",
"api_player_menu_bar.9.png",
"api_player_track.9.png",
"api_play_on_you_tube.png",
"api_scrubber.png",
"api_scrubber_selected.png",
"box_shadow.9.png",
"btn_play_all.9.png",
"card_frame_bottom.9.png",
"card_frame_middle.9.png",
"circle_shadow.9.png",
"common_full_open_on_phone.png",
"compat_selector_disabled.9.png",
"compat_selector_focused.9.png",
"compat_selector_longpressed.9.png",
"compat_selector_pressed.9.png",
"ic_account_switcher_alert.png",
"ic_annotation_close.png",
"ic_api_youtube_logo.png",
"ic_api_youtube_logo_pressed.png",
"ic_api_youtube_watermark.png",
"ic_notification_error.png",
"ic_notification_error_small.webp",
"ic_playlist_icon.png",
"ic_unavailable_common.webp",
"ic_youtube_logo.png",
"lc_editbox_dropdown_background_dark.9.png",
"star_empty.webp",
"star_filled.webp",
"survey_checked.png",
"survey_unchecked.png",
"textfield_default_mtrl_alpha.9.png",
"youtube_lozenge_logo.png",
"youtube_lozenge_logo_dni.png"
)
val WHITELIST_XXXHDPI = "drawable-xxxhdpi" to arrayOf(
"ic_group_collapse_00.png",
"ic_group_collapse_01.png",
"ic_group_collapse_02.png",
"ic_group_collapse_03.png",
"ic_group_collapse_04.png",
"ic_group_collapse_05.png",
"ic_group_collapse_06.png",
"ic_group_collapse_07.png",
"ic_group_collapse_08.png",
"ic_group_collapse_09.png",
"ic_group_collapse_10.png",
"ic_group_collapse_11.png",
"ic_group_collapse_12.png",
"ic_group_collapse_13.png",
"ic_group_collapse_14.png",
"ic_group_collapse_15.png",
"ic_group_expand_00.png",
"ic_group_expand_01.png",
"ic_group_expand_02.png",
"ic_group_expand_03.png",
"ic_group_expand_04.png",
"ic_group_expand_05.png",
"ic_group_expand_06.png",
"ic_group_expand_07.png",
"ic_group_expand_08.png",
"ic_group_expand_09.png",
"ic_group_expand_10.png",
"ic_group_expand_11.png",
"ic_group_expand_12.png",
"ic_group_expand_13.png",
"ic_group_expand_14.png",
"ic_group_expand_15.png"
)
}
}

View File

@ -0,0 +1,21 @@
package app.revanced.patches.youtube.layout.etc.pipnotification.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
object PrimaryPiPFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("L"),
opcodes = listOf(
Opcode.IGET_OBJECT,
Opcode.CHECK_CAST,
Opcode.INVOKE_VIRTUAL,
Opcode.CHECK_CAST,
Opcode.INVOKE_VIRTUAL,
Opcode.IPUT_BOOLEAN
),
strings = listOf("honeycomb.Shell\$HomeActivity")
)

View File

@ -0,0 +1,20 @@
package app.revanced.patches.youtube.layout.etc.pipnotification.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
object SecondaryPiPFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("L"),
opcodes = listOf(
Opcode.IGET_OBJECT,
Opcode.CHECK_CAST,
Opcode.INVOKE_VIRTUAL,
Opcode.CHECK_CAST,
Opcode.IGET_OBJECT
),
strings = listOf("honeycomb.Shell\$HomeActivity")
)

View File

@ -0,0 +1,49 @@
package app.revanced.patches.youtube.layout.etc.pipnotification.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.etc.pipnotification.fingerprints.*
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
@Patch
@Name("hide-pip-notification")
@Description("Disable pip notification when you first launch pip mode.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class PiPNotificationPatch : BytecodePatch(
listOf(
PrimaryPiPFingerprint,
SecondaryPiPFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
arrayOf(
PrimaryPiPFingerprint,
SecondaryPiPFingerprint
).map {
it.result ?: return it.toErrorResult()
}.forEach {
val index = it.scanResult.patternScanResult!!.startIndex + 1
it.mutableMethod.addInstruction(index, "return-void")
}
/*
add settings
*/
SettingsPatch.updatePatchStatus("hide-pip-notification")
return PatchResultSuccess()
}
}

View File

@ -0,0 +1,19 @@
package app.revanced.patches.youtube.layout.etc.theme.bytecode.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
object LithoThemeFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PROTECTED or AccessFlags.FINAL,
parameters = listOf("L"),
opcodes = listOf(
Opcode.IF_NEZ,
Opcode.IGET_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.RETURN_VOID
),
customFingerprint = { it.name == "onBoundsChange" }
)

View File

@ -0,0 +1,48 @@
package app.revanced.patches.youtube.layout.etc.theme.bytecode.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.etc.theme.bytecode.fingerprints.LithoThemeFingerprint
import app.revanced.patches.youtube.layout.etc.theme.resource.patch.GeneralThemeResourcePatch
import app.revanced.util.integrations.Constants.UTILS_PATH
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
@Name("general-theme")
@DependsOn([GeneralThemeResourcePatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class GeneralThemePatch : BytecodePatch(
listOf(
LithoThemeFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
LithoThemeFingerprint.result?.let {
with (it.mutableMethod) {
val insertIndex = it.scanResult.patternScanResult!!.endIndex - 1
val register = (implementation!!.instructions[insertIndex] as Instruction35c).registerD
addInstructions(
insertIndex, """
invoke-static { v$register }, $UTILS_PATH/LithoThemePatch;->applyLithoTheme(I)I
move-result v$register
"""
)
}
} ?: return LithoThemeFingerprint.toErrorResult()
return PatchResultSuccess()
}
internal companion object {
var isMonetPatchIncluded: Boolean = false
}
}

View File

@ -0,0 +1,88 @@
package app.revanced.patches.youtube.layout.etc.theme.resource.patch
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import org.w3c.dom.Element
@Name("general-theme-resource-patch")
@Version("0.0.1")
class GeneralThemeResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
// edit the resource files to change the splash screen color
val attrsPath = "res/values/attrs.xml"
val stylesPaths: List<String> = listOf(
"res/values/styles.xml", // Android 11 (and below)
"res/values-v31/styles.xml", // Android 12 (and above)
)
context.xmlEditor[attrsPath].use { editor ->
val file = editor.file
(file.getElementsByTagName("resources").item(0) as Element).appendChild(
file.createElement("attr").apply {
setAttribute("format", "reference")
setAttribute("name", "splashScreenColor")
}
)
}
stylesPaths.forEachIndexed { pathIndex, stylesPath ->
context.xmlEditor[stylesPath].use { editor ->
val file = editor.file
val childNodes = (file.getElementsByTagName("resources").item(0) as Element).childNodes
for (i in 0 until childNodes.length) {
val node = childNodes.item(i) as? Element ?: continue
val nodeAttributeName = node.getAttribute("name")
file.createElement("item").apply {
setAttribute(
"name",
when (pathIndex) {
0 -> "splashScreenColor"
1 -> "android:windowSplashScreenBackground"
else -> "null"
}
)
appendChild(
file.createTextNode(
when (pathIndex) {
0 -> when (nodeAttributeName) {
"Base.Theme.YouTube.Launcher.Dark" -> "@color/yt_black1"
"Base.Theme.YouTube.Launcher.Light" -> "@color/yt_white1"
else -> "null"
}
1 -> when (nodeAttributeName) {
"Base.Theme.YouTube.Launcher" -> "?attr/splashScreenColor"
else -> "null"
}
else -> "null"
}
)
)
if (this.textContent != "null")
node.appendChild(this)
}
}
}
}
arrayOf("drawable", "drawable-sw600dp").forEach { quantumLaunchscreenPath ->
context.xmlEditor["res/$quantumLaunchscreenPath/quantum_launchscreen_youtube.xml"].use { editor ->
val resourcesNode = editor.file.getElementsByTagName("item").item(0) as Element
if (resourcesNode.attributes.getNamedItem("android:drawable") != null)
resourcesNode.setAttribute("android:drawable", "?attr/splashScreenColor")
}
}
return PatchResultSuccess()
}
}

View File

@ -0,0 +1,63 @@
package app.revanced.patches.youtube.layout.etc.theme.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.options.PatchOptions
import app.revanced.patches.youtube.layout.etc.theme.bytecode.patch.GeneralThemePatch
import app.revanced.patches.youtube.layout.etc.theme.bytecode.patch.GeneralThemePatch.Companion.isMonetPatchIncluded
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper.updatePatchStatusTheme
import org.w3c.dom.Element
@Patch
@Name("theme")
@Description("Applies a custom theme (default: amoled).")
@DependsOn(
[
GeneralThemePatch::class,
PatchOptions::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class ThemePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
arrayOf("values", "values-v31").forEach {
context.setTheme(it)
}
val currentTheme = if (isMonetPatchIncluded) "mix" else "amoled"
context.updatePatchStatusTheme(currentTheme)
return PatchResultSuccess()
}
private companion object {
private fun ResourceContext.setTheme(valuesPath: String) {
this.xmlEditor["res/$valuesPath/colors.xml"].use { editor ->
val resourcesNode = editor.file.getElementsByTagName("resources").item(0) as Element
for (i in 0 until resourcesNode.childNodes.length) {
val node = resourcesNode.childNodes.item(i) as? Element ?: continue
node.textContent = when (node.getAttribute("name")) {
"yt_black0", "yt_black1", "yt_black1_opacity95", "yt_black1_opacity98", "yt_black2", "yt_black3",
"yt_black4", "yt_status_bar_background_dark", "material_grey_850" -> PatchOptions.darkThemeBackgroundColor!!
else -> continue
}
}
}
}
}
}

View File

@ -0,0 +1,20 @@
package app.revanced.patches.youtube.layout.etc.tooltip.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
object TooltipContentViewFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("L"),
customFingerprint = { methodDef ->
methodDef.implementation?.instructions?.any {
it.opcode.ordinal == Opcode.CONST.ordinal &&
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.tooltipLabelId
} == true
}
)

View File

@ -0,0 +1,49 @@
package app.revanced.patches.youtube.layout.etc.tooltip.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.etc.tooltip.fingerprints.TooltipContentViewFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
@Patch
@Name("hide-tooltip-content")
@Description("Hides the tooltip box that appears on first install.")
@DependsOn(
[
SettingsPatch::class,
SharedResourcdIdPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class TooltipContentViewBytecodePatch : BytecodePatch(
listOf(
TooltipContentViewFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
TooltipContentViewFingerprint.result?.mutableMethod?.addInstruction(
0,
"return-void"
) ?: return TooltipContentViewFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.updatePatchStatus("hide-tooltip-content")
return PatchResultSuccess()
}
}

View File

@ -10,9 +10,8 @@ import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch
import app.revanced.patches.youtube.misc.litho.patch.LithoFilterPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-flyout-panel")
@ -31,18 +30,15 @@ class FlyoutPanelPatch : ResourcePatch {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: FLYOUT_PANEL",
"SETTINGS: FLYOUT_PANEL_COMPONENT"
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: FLYOUT_PANEL",
"SETTINGS: FLYOUT_PANEL_COMPONENT"
)
)
ResourceHelper.patchSuccess(
context,
"hide-flyout-panel"
)
SettingsPatch.updatePatchStatus("hide-flyout-panel")
return PatchResultSuccess()
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.flyoutpanel.oldqualitylayout.bytecode.fingerprints
package app.revanced.patches.youtube.layout.flyoutpanel.oldqualitylayout.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.flyoutpanel.oldqualitylayout.bytecode.patch
package app.revanced.patches.youtube.layout.flyoutpanel.oldqualitylayout.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
@ -8,15 +9,21 @@ import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.flyoutpanel.oldqualitylayout.bytecode.fingerprints.QualityMenuViewInflateFingerprint
import app.revanced.patches.youtube.layout.flyoutpanel.oldqualitylayout.fingerprints.QualityMenuViewInflateFingerprint
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.FLYOUTPANEL_LAYOUT
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
@Name("enable-old-quality-layout-bytecode-patch")
@Patch
@Name("enable-old-quality-layout")
@Description("Enables the original quality flyout menu.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class OldQualityLayoutBytecodePatch : BytecodePatch(
class OldQualityLayoutPatch : BytecodePatch(
listOf(QualityMenuViewInflateFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
@ -33,6 +40,19 @@ class OldQualityLayoutBytecodePatch : BytecodePatch(
}
} ?: return QualityMenuViewInflateFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: FLYOUT_PANEL",
"SETTINGS: ENABLE_OLD_QUALITY_LAYOUT"
)
)
SettingsPatch.updatePatchStatus("enable-old-quality-layout")
return PatchResultSuccess()
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.flyoutpanel.oldqualitylayout.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.flyoutpanel.oldqualitylayout.bytecode.patch.OldQualityLayoutBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("enable-old-quality-layout")
@Description("Enables the original quality flyout menu.")
@DependsOn(
[
OldQualityLayoutBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class OldQualityLayoutPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: FLYOUT_PANEL",
"SETTINGS: ENABLE_OLD_QUALITY_LAYOUT"
)
ResourceHelper.patchSuccess(
context,
"enable-old-quality-layout"
)
return PatchResultSuccess()
}
}

View File

@ -1,7 +1,7 @@
package app.revanced.patches.youtube.layout.fullscreen.endscreenoverlay.bytecode.patch
package app.revanced.patches.youtube.layout.fullscreen.endscreenoverlay.patch
import app.revanced.extensions.findMutableMethodOf
import app.revanced.extensions.toResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
@ -9,19 +9,30 @@ import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.FULLSCREEN_LAYOUT
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
@Name("hide-endscreen-overlay-bytecode-patch")
@DependsOn([ResourceMappingPatch::class])
@Patch
@Name("hide-endscreen-overlay")
@Description("Hide endscreen overlay on swipe controls.")
@DependsOn(
[
ResourceMappingPatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideEndscreenOverlayBytecodePatch : BytecodePatch() {
class HideEndscreenOverlayPatch : BytecodePatch() {
// list of resource names to get the id of
private val resourceIds = arrayOf(
"app_related_endscreen_results"
@ -65,6 +76,25 @@ class HideEndscreenOverlayBytecodePatch : BytecodePatch() {
}
}
}
return toResult(patchSuccessArray.indexOf(false))
val errorIndex: Int = patchSuccessArray.indexOf(false)
if (errorIndex == -1) {
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: FULLSCREEN",
"SETTINGS: HIDE_ENDSCREEN_OVERLAY"
)
)
SettingsPatch.updatePatchStatus("hide-endscreen-overlay")
return PatchResultSuccess()
} else
return PatchResultError("Instruction not found: $errorIndex")
}
}

View File

@ -1,48 +0,0 @@
package app.revanced.patches.youtube.layout.fullscreen.endscreenoverlay.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.fullscreen.endscreenoverlay.bytecode.patch.HideEndscreenOverlayBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-endscreen-overlay")
@Description("Hide endscreen overlay on swipe controls.")
@DependsOn(
[
HideEndscreenOverlayBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideFilmStripPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: FULLSCREEN",
"SETTINGS: HIDE_ENDSCREEN_OVERLAY"
)
ResourceHelper.patchSuccess(
context,
"hide-endscreen-overlay"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.bytecode.fingerprints
package app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.bytecode.patch
package app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
@ -10,18 +11,24 @@ import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.bytecode.fingerprints.ScrubbingLabelFingerprint
import app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.fingerprints.ScrubbingLabelFingerprint
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.FULLSCREEN_LAYOUT
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
import org.jf.dexlib2.iface.reference.FieldReference
@Name("hide-filmstrip-overlay-bytecode-patch")
@Patch
@Name("hide-filmstrip-overlay")
@Description("Hide flimstrip overlay on swipe controls.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class HideFilmstripOverlayBytecodePatch : BytecodePatch(
class HideFilmstripOverlayPatch : BytecodePatch(
listOf(
ScrubbingLabelFingerprint
)
@ -49,6 +56,19 @@ class HideFilmstripOverlayBytecodePatch : BytecodePatch(
it.removeInstruction(index)
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: FULLSCREEN",
"SETTINGS: HIDE_FILMSTRIP_OVERLAY"
)
)
SettingsPatch.updatePatchStatus("hide-filmstrip-overlay")
return PatchResultSuccess()
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.fullscreen.flimstripoverlay.bytecode.patch.HideFilmstripOverlayBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-filmstrip-overlay")
@Description("Hide flimstrip overlay on swipe controls.")
@DependsOn(
[
HideFilmstripOverlayBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideFilmstripOverlayPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: FULLSCREEN",
"SETTINGS: HIDE_FILMSTRIP_OVERLAY"
)
ResourceHelper.patchSuccess(
context,
"hide-filmstrip-overlay"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.bytecode.fingerprints
package app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.bytecode.patch
package app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.patch
import app.revanced.extensions.findMutableMethodOf
import app.revanced.extensions.injectHideCall
@ -15,11 +15,11 @@ import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.formats.Instruction21c
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
@Name("hide-fullscreen-buttoncontainer-bytecode-patch")
@Name("hide-fullscreen-buttoncontainer")
@DependsOn([ResourceMappingPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class FullscreenButtonContainerBytecodePatch : BytecodePatch() {
class HideFullscreenButtonContainerPatch : BytecodePatch() {
private val resourceIds = arrayOf(
"quick_actions_element_container"
).map { name ->

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.bytecode.patch
package app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
@ -10,19 +11,30 @@ import app.revanced.patcher.extensions.removeInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.fingerprints.LayoutConstructorFingerprint
import app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.bytecode.fingerprints.FullscreenViewAdderFingerprint
import app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.fingerprints.FullscreenViewAdderFingerprint
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.FULLSCREEN_LAYOUT
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
@Name("hide-fullscreen-panels-bytecode-patch")
@Patch
@Name("hide-fullscreen-panels")
@Description("Hides video description and comments panel in fullscreen view.")
@DependsOn(
[
HideFullscreenButtonContainerPatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideFullscreenPanelsBytecodePatch : BytecodePatch(
class HideFullscreenPanelsPatch : BytecodePatch(
listOf(
FullscreenViewAdderFingerprint,
LayoutConstructorFingerprint
@ -45,6 +57,19 @@ class HideFullscreenPanelsBytecodePatch : BytecodePatch(
}
} ?: return FullscreenViewAdderFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: FULLSCREEN",
"SETTINGS: HIDE_FULLSCREEN_PANELS"
)
)
SettingsPatch.updatePatchStatus("hide-fullscreen-panels")
LayoutConstructorFingerprint.result?.mutableMethod?.let { method ->
val invokeIndex = method.implementation!!.instructions.indexOfFirst {
it.opcode.ordinal == Opcode.INVOKE_VIRTUAL.ordinal &&

View File

@ -1,51 +0,0 @@
package app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.bytecode.patch.FullscreenButtonContainerBytecodePatch
import app.revanced.patches.youtube.layout.fullscreen.fullscreenpanels.bytecode.patch.HideFullscreenPanelsBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-fullscreen-panels")
@Description("Hides video description and comments panel in fullscreen view.")
@DependsOn(
[
FullscreenButtonContainerBytecodePatch::class,
HideFullscreenPanelsBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideFullscreenPanelsPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: FULLSCREEN",
"SETTINGS: HIDE_FULLSCREEN_PANELS"
)
ResourceHelper.patchSuccess(
context,
"hide-fullscreen-panels"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.bytecode.fingerprints
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.bytecode.fingerprints
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.bytecode.fingerprints
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.bytecode.fingerprints
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.bytecode.patch
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
@ -11,16 +12,22 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.bytecode.fingerprints.*
import app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.fingerprints.*
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.FULLSCREEN_LAYOUT
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Name("disable-haptic-feedback-bytecode-patch")
@Patch
@Name("disable-haptic-feedback")
@Description("Disable haptic feedback when swiping.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class HapticFeedBackBytecodePatch : BytecodePatch(
class HapticFeedBackPatch : BytecodePatch(
listOf(
MarkerHapticsFingerprint,
SeekHapticsFingerprint,
@ -44,6 +51,19 @@ class HapticFeedBackBytecodePatch : BytecodePatch(
} ?: return fingerprint.toErrorResult()
}
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: FULLSCREEN",
"SETTINGS: DISABLE_HAPTIC_FEEDBACK"
)
)
SettingsPatch.updatePatchStatus("disable-haptic-feedback")
return PatchResultSuccess()
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.fullscreen.hapticfeedback.bytecode.patch.HapticFeedBackBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("disable-haptic-feedback")
@Description("Disable haptic feedback when swiping.")
@DependsOn(
[
HapticFeedBackBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HapticFeedBackPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: FULLSCREEN",
"SETTINGS: DISABLE_HAPTIC_FEEDBACK"
)
ResourceHelper.patchSuccess(
context,
"disable-haptic-feedback"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.autocaptions.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.autocaptions.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.autocaptions.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.autocaptions.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.general.autocaptions.bytecode.patch
package app.revanced.patches.youtube.layout.general.autocaptions.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
@ -10,16 +11,23 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.fingerprints.SubtitleButtonControllerFingerprint
import app.revanced.patches.youtube.layout.general.autocaptions.bytecode.fingerprints.*
import app.revanced.patches.youtube.layout.general.autocaptions.fingerprints.StartVideoInformerFingerprint
import app.revanced.patches.youtube.layout.general.autocaptions.fingerprints.SubtitleTrackFingerprint
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL_LAYOUT
@Name("hide-auto-captions-bytecode-patch")
@Patch
@Name("hide-auto-captions")
@Description("Hide captions from being automatically enabled.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class AutoCaptionsBytecodePatch : BytecodePatch(
class AutoCaptionsPatch : BytecodePatch(
listOf(
StartVideoInformerFingerprint,
SubtitleButtonControllerFingerprint,
@ -56,6 +64,19 @@ class AutoCaptionsBytecodePatch : BytecodePatch(
)
} ?: return SubtitleTrackFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_AUTO_CAPTIONS"
)
)
SettingsPatch.updatePatchStatus("hide-auto-captions")
return PatchResultSuccess()
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.general.autocaptions.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.autocaptions.bytecode.patch.AutoCaptionsBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-auto-captions")
@Description("Hide captions from being automatically enabled.")
@DependsOn(
[
AutoCaptionsBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class AutoCaptionsPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_AUTO_CAPTIONS"
)
ResourceHelper.patchSuccess(
context,
"hide-auto-captions"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.autopopuppanels.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.autopopuppanels.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.general.autopopuppanels.bytecode.patch
package app.revanced.patches.youtube.layout.general.autopopuppanels.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
@ -9,15 +10,21 @@ import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.autopopuppanels.bytecode.fingerprints.EngagementPanelControllerFingerprint
import app.revanced.patches.youtube.layout.general.autopopuppanels.fingerprints.EngagementPanelControllerFingerprint
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL_LAYOUT
@Name("hide-auto-player-popup-panels-bytecode-patch")
@Patch
@Name("hide-auto-player-popup-panels")
@Description("Hide automatic popup panels (playlist or live chat) on video player.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class PlayerPopupPanelsBytecodePatch : BytecodePatch(
class PlayerPopupPanelsPatch : BytecodePatch(
listOf(
EngagementPanelControllerFingerprint
)
@ -37,6 +44,19 @@ class PlayerPopupPanelsBytecodePatch : BytecodePatch(
)
} ?: return EngagementPanelControllerFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_AUTO_PLAYER_POPUP_PANELS"
)
)
SettingsPatch.updatePatchStatus("hide-auto-player-popup-panels")
return PatchResultSuccess()
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.general.autopopuppanels.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.autopopuppanels.bytecode.patch.PlayerPopupPanelsBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-auto-player-popup-panels")
@Description("Hide automatic popup panels (playlist or live chat) on video player.")
@DependsOn(
[
PlayerPopupPanelsBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class PlayerPopupPanelsPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_AUTO_PLAYER_POPUP_PANELS"
)
ResourceHelper.patchSuccess(
context,
"hide-auto-player-popup-panels"
)
return PatchResultSuccess()
}
}

View File

@ -1,25 +1,36 @@
package app.revanced.patches.youtube.layout.general.crowdfundingbox.bytecode.patch
package app.revanced.patches.youtube.layout.general.crowdfundingbox.patch
import app.revanced.extensions.findMutableMethodOf
import app.revanced.extensions.injectHideCall
import app.revanced.extensions.toResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.formats.Instruction22c
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
@Name("hide-crowdfunding-box-bytecode-patch")
@DependsOn([ResourceMappingPatch::class])
@Patch
@Name("hide-crowdfunding-box")
@Description("Hides the crowdfunding box between the player and video description.")
@DependsOn(
[
ResourceMappingPatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class CrowdfundingBoxBytecodePatch : BytecodePatch() {
class CrowdfundingBoxPatch : BytecodePatch() {
// list of resource names to get the id of
private val resourceIds = arrayOf(
@ -56,6 +67,25 @@ class CrowdfundingBoxBytecodePatch : BytecodePatch() {
}
}
}
return toResult(patchSuccessArray.indexOf(false))
val errorIndex: Int = patchSuccessArray.indexOf(false)
if (errorIndex == -1) {
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_CROWDFUNDING_BOX"
)
)
SettingsPatch.updatePatchStatus("hide-crowdfunding-box")
return PatchResultSuccess()
} else
return PatchResultError("Instruction not found: $errorIndex")
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.general.crowdfundingbox.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.crowdfundingbox.bytecode.patch.CrowdfundingBoxBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-crowdfunding-box")
@Description("Hides the crowdfunding box between the player and video description.")
@DependsOn(
[
CrowdfundingBoxBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class CrowdfundingBoxPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_CROWDFUNDING_BOX"
)
ResourceHelper.patchSuccess(
context,
"hide-crowdfunding-box"
)
return PatchResultSuccess()
}
}

View File

@ -1,24 +1,35 @@
package app.revanced.patches.youtube.layout.general.headerswitch.bytecode.patch
package app.revanced.patches.youtube.layout.general.headerswitch.patch
import app.revanced.extensions.findMutableMethodOf
import app.revanced.extensions.toResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
@DependsOn([ResourceMappingPatch::class])
@Name("header-switch-bytecode-patch")
@Patch
@Name("header-switch")
@Description("Add switch to change header.")
@DependsOn(
[
ResourceMappingPatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HeaderSwitchBytecodePatch : BytecodePatch() {
class HeaderSwitchPatch : BytecodePatch() {
// list of resource names to get the id of
private val resourceIds = arrayOf(
@ -60,6 +71,25 @@ class HeaderSwitchBytecodePatch : BytecodePatch() {
}
}
}
return toResult(patchSuccessArray.indexOf(false))
val errorIndex: Int = patchSuccessArray.indexOf(false)
if (errorIndex == -1) {
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HEADER_SWITCH"
)
)
SettingsPatch.updatePatchStatus("header-switch")
return PatchResultSuccess()
} else
return PatchResultError("Instruction not found: $errorIndex")
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.general.headerswitch.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.headerswitch.bytecode.patch.HeaderSwitchBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("header-switch")
@Description("Add switch to change header.")
@DependsOn(
[
HeaderSwitchBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HeaderSwitchPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HEADER_SWITCH"
)
ResourceHelper.patchSuccess(
context,
"header-switch"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.mixplaylists.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.mixplaylists.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.mixplaylists.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.mixplaylists.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.mixplaylists.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.mixplaylists.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.mixplaylists.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.mixplaylists.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch

View File

@ -1,7 +1,8 @@
package app.revanced.patches.youtube.layout.general.mixplaylists.bytecode.patch
package app.revanced.patches.youtube.layout.general.mixplaylists.patch
import app.revanced.extensions.injectHideCall
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
@ -10,17 +11,23 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.mixplaylists.bytecode.fingerprints.*
import app.revanced.patches.youtube.layout.general.mixplaylists.fingerprints.*
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import org.jf.dexlib2.iface.instruction.Instruction
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
import org.jf.dexlib2.iface.instruction.formats.Instruction21c
@Name("hide-mix-playlists-bytecode-patch")
@Patch
@Name("hide-mix-playlists")
@Description("Removes mix playlists from home feed and video player.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class MixPlaylistsBytecodePatch : BytecodePatch(
class MixPlaylistsPatch : BytecodePatch(
listOf(
CreateMixPlaylistFingerprint,
SecondCreateMixPlaylistFingerprint,
@ -44,6 +51,19 @@ class MixPlaylistsBytecodePatch : BytecodePatch(
fingerprint.result?.hookMixPlaylists(boolean) ?: return fingerprint.toErrorResult()
}
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_MIX_PLAYLISTS"
)
)
SettingsPatch.updatePatchStatus("hide-mix-playlists")
return PatchResultSuccess()
}

View File

@ -1,51 +0,0 @@
package app.revanced.patches.youtube.layout.general.mixplaylists.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.mixplaylists.bytecode.patch.MixPlaylistsBytecodePatch
import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-mix-playlists")
@Description("Removes mix playlists from home feed and video player.")
@DependsOn(
[
LithoFilterPatch::class,
MixPlaylistsBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class MixPlaylistsPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_MIX_PLAYLISTS"
)
ResourceHelper.patchSuccess(
context,
"hide-mix-playlists"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.personalinformation.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.personalinformation.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.personalinformation.bytecode.patch
package app.revanced.patches.youtube.layout.general.personalinformation.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Name
@ -9,15 +9,20 @@ import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.personalinformation.bytecode.fingerprints.AccountSwitcherAccessibilityLabelFingerprint
import app.revanced.patches.youtube.layout.general.personalinformation.fingerprints.AccountSwitcherAccessibilityLabelFingerprint
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL_LAYOUT
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Name("hide-email-address-bytecode-patch")
@Patch
@Name("hide-email-address")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class HideEmailAddressBytecodePatch : BytecodePatch(
class HideEmailAddressPatch : BytecodePatch(
listOf(
AccountSwitcherAccessibilityLabelFingerprint
)
@ -38,6 +43,19 @@ class HideEmailAddressBytecodePatch : BytecodePatch(
}
} ?: return AccountSwitcherAccessibilityLabelFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_EMAIL_ADDRESS"
)
)
SettingsPatch.updatePatchStatus("hide-email-address")
return PatchResultSuccess()
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.general.personalinformation.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.personalinformation.bytecode.patch.HideEmailAddressBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-email-address")
@Description("Hides the email address in the account switcher.")
@DependsOn(
[
HideEmailAddressBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideEmailAddressPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_EMAIL_ADDRESS"
)
ResourceHelper.patchSuccess(
context,
"hide-email-address"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.pivotbar.createbutton.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.pivotbar.createbutton.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
@ -15,11 +15,11 @@ object PivotBarFingerprint : MethodFingerprint(
Opcode.MOVE_RESULT_OBJECT,
Opcode.RETURN_OBJECT
),
customFingerprint = {
it.definingClass == "Lcom/google/android/apps/youtube/app/ui/pivotbar/PivotBar;" &&
it.implementation?.instructions?.any {
it.opcode.ordinal == Opcode.CONST.ordinal &&
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.imageWithTextTabId
} == true
customFingerprint = { methodDef ->
methodDef.definingClass == "Lcom/google/android/apps/youtube/app/ui/pivotbar/PivotBar;" &&
methodDef.implementation?.instructions?.any {
it.opcode.ordinal == Opcode.CONST.ordinal &&
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.imageWithTextTabId
} == true
}
)

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.general.pivotbar.createbutton.bytecode.patch
package app.revanced.patches.youtube.layout.general.pivotbar.createbutton.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
@ -8,21 +9,30 @@ import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.fingerprints.PivotBarCreateButtonViewFingerprint
import app.revanced.patches.youtube.layout.general.pivotbar.createbutton.bytecode.fingerprints.PivotBarFingerprint
import app.revanced.patches.youtube.layout.general.pivotbar.createbutton.fingerprints.PivotBarFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL_LAYOUT
import app.revanced.util.pivotbar.InjectionUtils.REGISTER_TEMPLATE_REPLACEMENT
import app.revanced.util.pivotbar.InjectionUtils.injectHook
import org.jf.dexlib2.dexbacked.reference.DexBackedMethodReference
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
@Name("hide-create-button-bytecode-patch")
@DependsOn([SharedResourcdIdPatch::class])
@Patch
@Name("hide-create-button")
@Description("Hides the create button in the navigation bar.")
@DependsOn(
[
SettingsPatch::class,
SharedResourcdIdPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class CreateButtonRemoverBytecodePatch : BytecodePatch(
class CreateButtonRemoverPatch : BytecodePatch(
listOf(
PivotBarCreateButtonViewFingerprint,
PivotBarFingerprint
@ -58,6 +68,19 @@ class CreateButtonRemoverBytecodePatch : BytecodePatch(
injectHook(hook, createButtonInstructions.indexOf(instruction) + 2)
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_CREATE_BUTTON"
)
)
SettingsPatch.updatePatchStatus("hide-create-button")
return PatchResultSuccess()
}
return PivotBarCreateButtonViewFingerprint.toErrorResult()

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.general.pivotbar.createbutton.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.pivotbar.createbutton.bytecode.patch.CreateButtonRemoverBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-create-button")
@Description("Hides the create button in the navigation bar.")
@DependsOn(
[
CreateButtonRemoverBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class CreateButtonRemoverPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_CREATE_BUTTON"
)
ResourceHelper.patchSuccess(
context,
"hide-create-button"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.bytecode.patch
package app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
@ -9,20 +10,29 @@ import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.fingerprints.PivotBarCreateButtonViewFingerprint
import app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.bytecode.fingerprints.PivotBarEnumFingerprint
import app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.bytecode.fingerprints.PivotBarShortsButtonViewFingerprint
import app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.fingerprints.PivotBarEnumFingerprint
import app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.fingerprints.PivotBarShortsButtonViewFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL_LAYOUT
import app.revanced.util.pivotbar.InjectionUtils.REGISTER_TEMPLATE_REPLACEMENT
import app.revanced.util.pivotbar.InjectionUtils.injectHook
@Patch
@Name("hide-shorts-button")
@DependsOn([SharedResourcdIdPatch::class])
@Description("Hides the shorts button in the navigation bar.")
@DependsOn(
[
SettingsPatch::class,
SharedResourcdIdPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class ShortsButtonRemoverBytecodePatch : BytecodePatch(
class ShortsButtonRemoverPatch : BytecodePatch(
listOf(PivotBarCreateButtonViewFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
@ -62,6 +72,22 @@ class ShortsButtonRemoverBytecodePatch : BytecodePatch(
} ?: return PivotBarCreateButtonViewFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: SHORTS_COMPONENT.PARENT",
"SETTINGS: SHORTS_COMPONENT_PARENT.A",
"SETTINGS: HIDE_SHORTS_BUTTON"
)
)
SettingsPatch.updatePatchStatus("hide-shorts-button")
return PatchResultSuccess()
}
private companion object {

View File

@ -1,51 +0,0 @@
package app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.bytecode.patch.ShortsButtonRemoverBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-shorts-button")
@Description("Hides the shorts button in the navigation bar.")
@DependsOn(
[
ShortsButtonRemoverBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class ShortsButtonRemoverPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings4(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: SHORTS_COMPONENT.PARENT",
"SETTINGS: SHORTS_COMPONENT_PARENT.A",
"SETTINGS: HIDE_SHORTS_BUTTON"
)
ResourceHelper.patchSuccess(
context,
"hide-shorts-button"
)
return PatchResultSuccess()
}
}

View File

@ -1,7 +1,8 @@
package app.revanced.patches.youtube.layout.general.shortscomponent.bytecode.patch
package app.revanced.patches.youtube.layout.general.shortscomponent.patch
import app.revanced.extensions.findMutableMethodOf
import app.revanced.extensions.injectHideCall
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
@ -10,19 +11,30 @@ import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
import app.revanced.util.bytecode.BytecodeHelper
import app.revanced.patches.youtube.misc.litho.patch.LithoFilterPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
import org.jf.dexlib2.iface.instruction.formats.Instruction21c
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
@Name("hide-shorts-component-bytecode-patch")
@DependsOn([ResourceMappingPatch::class])
@Patch
@Name("hide-shorts-component")
@Description("Hides other Shorts components.")
@DependsOn(
[
LithoFilterPatch::class,
ResourceMappingPatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class ShortsComponentBytecodePatch : BytecodePatch() {
class ShortsComponentPatch : BytecodePatch() {
// list of resource names to get the id of
private val resourceIds = arrayOf(
@ -88,11 +100,31 @@ class ShortsComponentBytecodePatch : BytecodePatch() {
}
}
}
val errorIndex = patchSuccessArray.indexOf(false)
return if (errorIndex == -1) {
BytecodeHelper.patchStatus(context, "ShortsComponent")
PatchResultSuccess()
val errorIndex: Int = patchSuccessArray.indexOf(false)
if (errorIndex == -1) {
context.updatePatchStatus("ShortsComponent")
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: SHORTS_COMPONENT.PARENT",
"SETTINGS: SHORTS_COMPONENT_PARENT.A",
"SETTINGS: SHORTS_COMPONENT_PARENT.B",
"SETTINGS: HIDE_SHORTS_COMPONENTS",
"SETTINGS: HIDE_SHORTS_SHELF"
)
)
SettingsPatch.updatePatchStatus("hide-shorts-component")
return PatchResultSuccess()
} else
PatchResultError("Instruction not found: $errorIndex")
return PatchResultError("Instruction not found: $errorIndex")
}
}

View File

@ -1,64 +0,0 @@
package app.revanced.patches.youtube.layout.general.shortscomponent.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.shortscomponent.bytecode.patch.ShortsComponentBytecodePatch
import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-shorts-component")
@Description("Hides other Shorts components.")
@DependsOn(
[
LithoFilterPatch::class,
ShortsComponentBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class ShortsComponentPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings5(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: SHORTS_COMPONENT.PARENT",
"SETTINGS: SHORTS_COMPONENT_PARENT.A",
"SETTINGS: SHORTS_COMPONENT_PARENT.B",
"SETTINGS: HIDE_SHORTS_COMPONENTS"
)
ResourceHelper.addSettings4(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: SHORTS_COMPONENT.PARENT",
"SETTINGS: SHORTS_COMPONENT_PARENT.A",
"SETTINGS: HIDE_SHORTS_SHELF"
)
ResourceHelper.patchSuccess(
context,
"hide-shorts-component"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.snackbar.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.snackbar.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.general.snackbar.bytecode.patch
package app.revanced.patches.youtube.layout.general.snackbar.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
@ -9,15 +10,21 @@ import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.snackbar.bytecode.fingerprints.HideSnackbarFingerprint
import app.revanced.patches.youtube.layout.general.snackbar.fingerprints.HideSnackbarFingerprint
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL_LAYOUT
@Name("hide-snackbar-bytecode-patch")
@Patch
@Name("hide-snackbar")
@Description("Hides the snackbar action popup.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class HideSnackbarBytecodePatch : BytecodePatch(
class HideSnackbarPatch : BytecodePatch(
listOf(
HideSnackbarFingerprint
)
@ -35,6 +42,19 @@ class HideSnackbarBytecodePatch : BytecodePatch(
)
} ?: return HideSnackbarFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_SNACKBAR"
)
)
SettingsPatch.updatePatchStatus("hide-snackbar")
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.startupshortsreset.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.startupshortsreset.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.general.startupshortsreset.bytecode.patch
package app.revanced.patches.youtube.layout.general.startupshortsreset.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
@ -9,16 +10,22 @@ import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.startupshortsreset.bytecode.fingerprints.UserWasInShortsFingerprint
import app.revanced.patches.youtube.layout.general.startupshortsreset.fingerprints.UserWasInShortsFingerprint
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL_LAYOUT
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Name("hide-startup-shorts-player-bytecode-patch")
@Patch
@Name("hide-startup-shorts-player")
@Description("Disables playing YouTube Shorts when launching YouTube.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class HideShortsOnStartupBytecodePatch : BytecodePatch(
class HideShortsOnStartupPatch : BytecodePatch(
listOf(
UserWasInShortsFingerprint
)
@ -41,6 +48,21 @@ class HideShortsOnStartupBytecodePatch : BytecodePatch(
}
} ?: return UserWasInShortsFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: SHORTS_COMPONENT.PARENT",
"SETTINGS: SHORTS_COMPONENT_PARENT.B",
"SETTINGS: HIDE_STARTUP_SHORTS_PLAYER"
)
)
SettingsPatch.updatePatchStatus("hide-startup-shorts-player")
return PatchResultSuccess()
}
}

View File

@ -1,51 +0,0 @@
package app.revanced.patches.youtube.layout.general.startupshortsreset.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.startupshortsreset.bytecode.patch.HideShortsOnStartupBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-startup-shorts-player")
@Description("Disables playing YouTube Shorts when launching YouTube.")
@DependsOn(
[
HideShortsOnStartupBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideShortsOnStartupPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings4(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: SHORTS_COMPONENT.PARENT",
"SETTINGS: SHORTS_COMPONENT_PARENT.B",
"SETTINGS: HIDE_STARTUP_SHORTS_PLAYER"
)
ResourceHelper.patchSuccess(
context,
"hide-startup-shorts-player"
)
return PatchResultSuccess()
}
}

View File

@ -1,25 +1,36 @@
package app.revanced.patches.youtube.layout.general.stories.bytecode.patch
package app.revanced.patches.youtube.layout.general.stories.patch
import app.revanced.extensions.findMutableMethodOf
import app.revanced.extensions.injectHideCall
import app.revanced.extensions.toResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.formats.Instruction22c
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
@Name("hide-stories-bytecode-patch")
@DependsOn([ResourceMappingPatch::class])
@Patch
@Name("hide-stories")
@Description("Hides YouTube Stories shelf on the feed.")
@DependsOn(
[
ResourceMappingPatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideStoriesBytecodePatch : BytecodePatch() {
class HideStoriesPatch : BytecodePatch() {
// list of resource names to get the id of
private val resourceIds = arrayOf(
@ -59,6 +70,25 @@ class HideStoriesBytecodePatch : BytecodePatch() {
}
}
}
return toResult(patchSuccessArray.indexOf(false))
val errorIndex: Int = patchSuccessArray.indexOf(false)
if (errorIndex == -1) {
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_STORIES_SHELF"
)
)
SettingsPatch.updatePatchStatus("hide-stories")
return PatchResultSuccess()
} else
return PatchResultError("Instruction not found: $errorIndex")
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.general.stories.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.stories.bytecode.patch.HideStoriesBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-stories")
@Description("Hides YouTube Stories shelf on the feed.")
@DependsOn(
[
HideStoriesBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideStoriesPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_STORIES_SHELF"
)
ResourceHelper.patchSuccess(
context,
"hide-stories"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.tabletminiplayer.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.tabletminiplayer.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
@ -11,9 +11,9 @@ object MiniPlayerDimensionsCalculatorFingerprint : MethodFingerprint(
"V",
AccessFlags.PUBLIC or AccessFlags.FINAL,
customFingerprint = { methodDef ->
methodDef.implementation?.instructions?.any { instruction ->
instruction.opcode.ordinal == Opcode.CONST.ordinal &&
(instruction as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.floatybarQueueLabelId
methodDef.implementation?.instructions?.any {
it.opcode.ordinal == Opcode.CONST.ordinal &&
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.floatybarQueueLabelId
} == true
}
)

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.tabletminiplayer.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.tabletminiplayer.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.tabletminiplayer.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.tabletminiplayer.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.tabletminiplayer.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.tabletminiplayer.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.general.tabletminiplayer.bytecode.patch
package app.revanced.patches.youtube.layout.general.tabletminiplayer.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
@ -11,18 +12,27 @@ import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.tabletminiplayer.bytecode.fingerprints.*
import app.revanced.patches.youtube.layout.general.tabletminiplayer.fingerprints.*
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL_LAYOUT
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Name("enable-tablet-miniplayer-bytecode-patch")
@DependsOn([SharedResourcdIdPatch::class])
@Patch
@Name("enable-tablet-miniplayer")
@Description("Enables the tablet mini player layout.")
@DependsOn(
[
SettingsPatch::class,
SharedResourcdIdPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class TabletMiniPlayerBytecodePatch : BytecodePatch(
class TabletMiniPlayerPatch : BytecodePatch(
listOf(
MiniPlayerDimensionsCalculatorFingerprint,
MiniPlayerResponseModelSizeCheckFingerprint
@ -50,6 +60,19 @@ class TabletMiniPlayerBytecodePatch : BytecodePatch(
}
} ?: return MiniPlayerDimensionsCalculatorFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: ENABLE_TABLET_MINIPLAYER"
)
)
SettingsPatch.updatePatchStatus("enable-tablet-miniplayer")
return PatchResultSuccess()
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.general.tabletminiplayer.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.tabletminiplayer.bytecode.patch.TabletMiniPlayerBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("enable-tablet-miniplayer")
@Description("Enables the tablet mini player layout.")
@DependsOn(
[
TabletMiniPlayerBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class TabletMiniPlayerPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: ENABLE_TABLET_MINIPLAYER"
)
ResourceHelper.patchSuccess(
context,
"enable-tablet-miniplayer"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.widesearchbar.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.widesearchbar.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.widesearchbar.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.widesearchbar.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.widesearchbar.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.widesearchbar.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.general.widesearchbar.bytecode.fingerprints
package app.revanced.patches.youtube.layout.general.widesearchbar.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.general.widesearchbar.bytecode.patch
package app.revanced.patches.youtube.layout.general.widesearchbar.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
@ -10,15 +11,21 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.widesearchbar.bytecode.fingerprints.*
import app.revanced.patches.youtube.layout.general.widesearchbar.fingerprints.*
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL_LAYOUT
@Name("enable-wide-searchbar-bytecode-patch")
@Patch
@Name("enable-wide-searchbar")
@Description("Replaces the search icon with a wide search bar. This will hide the YouTube logo when active.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class WideSearchbarBytecodePatch : BytecodePatch(
class WideSearchbarPatch : BytecodePatch(
listOf(
WideSearchbarOneParentFingerprint,
WideSearchbarTwoParentFingerprint
@ -46,6 +53,19 @@ class WideSearchbarBytecodePatch : BytecodePatch(
} ?: return parentFingerprint.toErrorResult()
}
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: ENABLE_WIDE_SEARCHBAR"
)
)
SettingsPatch.updatePatchStatus("enable-wide-searchbar")
return PatchResultSuccess()
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.general.widesearchbar.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.general.widesearchbar.bytecode.patch.WideSearchbarBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("enable-wide-searchbar")
@Description("Replaces the search icon with a wide search bar. This will hide the YouTube logo when active.")
@DependsOn(
[
WideSearchbarBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class WideSearchbarPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: ENABLE_WIDE_SEARCHBAR"
)
ResourceHelper.patchSuccess(
context,
"enable-wide-searchbar"
)
return PatchResultSuccess()
}
}

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.player.autoplaybutton.bytecode.patch
package app.revanced.patches.youtube.layout.player.autoplaybutton.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
@ -9,21 +10,30 @@ import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.fingerprints.LayoutConstructorFingerprint
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.PLAYER_LAYOUT
import org.jf.dexlib2.iface.instruction.Instruction
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
import org.jf.dexlib2.iface.reference.MethodReference
@Name("hide-autoplay-button-bytecode-patch")
@DependsOn([ResourceMappingPatch::class])
@Patch
@Name("hide-autoplay-button")
@Description("Hides the autoplay button in the video player.")
@DependsOn(
[
ResourceMappingPatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideAutoplayButtonBytecodePatch : BytecodePatch(
class HideAutoplayButtonPatch : BytecodePatch(
listOf(
LayoutConstructorFingerprint
)
@ -57,6 +67,19 @@ class HideAutoplayButtonBytecodePatch : BytecodePatch(
}
} ?: return LayoutConstructorFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_AUTOPLAY_BUTTON"
)
)
SettingsPatch.updatePatchStatus("hide-autoplay-button")
return PatchResultSuccess()
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.player.autoplaybutton.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.player.autoplaybutton.bytecode.patch.HideAutoplayButtonBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-autoplay-button")
@Description("Hides the autoplay button in the video player.")
@DependsOn(
[
HideAutoplayButtonBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideAutoplayButtonPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_AUTOPLAY_BUTTON"
)
ResourceHelper.patchSuccess(
context,
"hide-autoplay-button"
)
return PatchResultSuccess()
}
}

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.player.captionsbutton.bytecode.patch
package app.revanced.patches.youtube.layout.player.captionsbutton.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
@ -8,12 +9,18 @@ import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.fingerprints.SubtitleButtonControllerFingerprint
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.PLAYER_LAYOUT
import org.jf.dexlib2.Opcode
@Name("hide-captions-button-bytecode-patch")
@Patch
@Name("hide-captions-button")
@Description("Hides the captions button in the video player.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class HideCaptionsButtonBytecodePatch : BytecodePatch(
@ -38,6 +45,19 @@ class HideCaptionsButtonBytecodePatch : BytecodePatch(
}
} ?: return SubtitleButtonControllerFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_CAPTIONS_BUTTON"
)
)
SettingsPatch.updatePatchStatus("hide-captions-button")
return PatchResultSuccess()
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.player.captionsbutton.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.player.captionsbutton.bytecode.patch.HideCaptionsButtonBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-player-captions-button")
@Description("Hides the captions button in the video player.")
@DependsOn(
[
HideCaptionsButtonBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideCaptionsButtonPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_CAPTIONS_BUTTON"
)
ResourceHelper.patchSuccess(
context,
"hide-captions-button"
)
return PatchResultSuccess()
}
}

View File

@ -1,5 +1,6 @@
package app.revanced.patches.youtube.layout.player.castbutton.bytecode.patch
package app.revanced.patches.youtube.layout.player.castbutton.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
@ -7,13 +8,19 @@ import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.PLAYER_LAYOUT
@Name("hide-cast-button-bytecode-patch")
@Patch
@Name("hide-cast-button")
@Description("Hides the cast button in the video player.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class HideCastButtonBytecodePatch : BytecodePatch() {
class HideCastButtonPatch : BytecodePatch() {
override fun execute(context: BytecodeContext): PatchResult {
context.classes.forEach { classDef ->
classDef.methods.forEach { method ->
@ -31,6 +38,19 @@ class HideCastButtonBytecodePatch : BytecodePatch() {
}
}
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_CAST_BUTTON"
)
)
SettingsPatch.updatePatchStatus("hide-cast-button")
return PatchResultSuccess()
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.player.castbutton.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.player.castbutton.bytecode.patch.HideCastButtonBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-cast-button")
@Description("Hides the cast button in the video player.")
@DependsOn(
[
HideCastButtonBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideCastButtonPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_CAST_BUTTON"
)
ResourceHelper.patchSuccess(
context,
"hide-cast-button"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.player.endscreencards.bytecode.fingerprints
package app.revanced.patches.youtube.layout.player.endscreencards.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.player.endscreencards.bytecode.fingerprints
package app.revanced.patches.youtube.layout.player.endscreencards.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.player.endscreencards.bytecode.fingerprints
package app.revanced.patches.youtube.layout.player.endscreencards.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch

View File

@ -1,7 +1,8 @@
package app.revanced.patches.youtube.layout.player.endscreencards.bytecode.patch
package app.revanced.patches.youtube.layout.player.endscreencards.patch
import app.revanced.extensions.injectHideCall
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
@ -10,14 +11,26 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.player.endscreencards.bytecode.fingerprints.*
import app.revanced.patches.youtube.layout.player.endscreencards.fingerprints.*
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import org.jf.dexlib2.iface.instruction.formats.Instruction21c
@Name("hide-endscreen-cards-bytecode-patch")
@Patch
@Name("hide-endscreen-cards")
@Description("Hides the suggested video cards at the end of a video in fullscreen.")
@DependsOn(
[
SettingsPatch::class,
SharedResourcdIdPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideEndscreenCardsBytecodePatch : BytecodePatch(
class HideEndscreenCardsPatch : BytecodePatch(
listOf(
LayoutCircleFingerprint,
LayoutIconFingerprint,
@ -42,6 +55,19 @@ class HideEndscreenCardsBytecodePatch : BytecodePatch(
it.result?.injectHideCalls() ?: return it.toErrorResult()
}
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_ENDSCREEN_CARDS"
)
)
SettingsPatch.updatePatchStatus("hide-endscreen-cards")
return PatchResultSuccess()
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.player.endscreencards.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.player.endscreencards.bytecode.patch.HideEndscreenCardsBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-endscreen-cards")
@Description("Hides the suggested video cards at the end of a video in fullscreen.")
@DependsOn(
[
HideEndscreenCardsBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideEndscreenCardsPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_ENDSCREEN_CARDS"
)
ResourceHelper.patchSuccess(
context,
"hide-endscreen-cards"
)
return PatchResultSuccess()
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.player.infocards.bytecode.fingerprints
package app.revanced.patches.youtube.layout.player.infocards.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.player.infocards.bytecode.fingerprints
package app.revanced.patches.youtube.layout.player.infocards.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.layout.player.infocards.bytecode.patch
package app.revanced.patches.youtube.layout.player.infocards.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
@ -9,15 +10,21 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.layout.player.infocards.bytecode.fingerprints.InfocardsIncognitoFingerprint
import app.revanced.patches.youtube.layout.player.infocards.bytecode.fingerprints.InfocardsIncognitoParentFingerprint
import app.revanced.patches.youtube.layout.player.infocards.fingerprints.InfocardsIncognitoFingerprint
import app.revanced.patches.youtube.layout.player.infocards.fingerprints.InfocardsIncognitoParentFingerprint
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.PLAYER_LAYOUT
@Name("hide-info-cards-bytecode-patch")
@Patch
@Name("hide-info-cards")
@Description("Hides info-cards in videos.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility
@Version("0.0.1")
class HideInfoCardsBytecodePatch : BytecodePatch(
class HideInfocardsPatch : BytecodePatch(
listOf(InfocardsIncognitoParentFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
@ -33,6 +40,19 @@ class HideInfoCardsBytecodePatch : BytecodePatch(
) ?: return InfocardsIncognitoFingerprint.toErrorResult()
} ?: return InfocardsIncognitoParentFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_INFO_CARDS"
)
)
SettingsPatch.updatePatchStatus("hide-info-cards")
return PatchResultSuccess()
}
}

Some files were not shown because too many files have changed in this diff Show More