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

@ -93,9 +93,9 @@ internal fun String.startsWithAny(vararg prefixes: String): Boolean {
} }
internal fun toResult(errorIndex: Int): PatchResult { internal fun toResult(errorIndex: Int): PatchResult {
if (errorIndex == -1) return if (errorIndex == -1)
return PatchResultSuccess() PatchResultSuccess()
else else
return PatchResultError("Instruction not found: $errorIndex") PatchResultError("Instruction not found: $errorIndex")
} }

View File

@ -7,18 +7,19 @@ import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.* import app.revanced.patcher.patch.*
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.util.resources.IconHelper import app.revanced.util.resources.IconHelper.customIconMusic
import app.revanced.util.resources.IconHelper.customIconMusicAdditional
@Patch @Patch
@Name("custom-branding-music-afn-blue") @Name("custom-branding-music-afn-blue")
@Description("Changes the YouTube Music launcher icon (Afn / Blue).") @Description("Changes the YouTube Music launcher icon (Afn / Blue).")
@YouTubeMusicCompatibility @YouTubeMusicCompatibility
@Version("0.0.1") @Version("0.0.1")
class CustomBrandingMusicPatch_Blue : ResourcePatch { class CustomBrandingMusicIconBluePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext): PatchResult {
IconHelper.customIconMusic(context, "blue") context.customIconMusic("blue")
IconHelper.customIconMusicAdditional(context, "blue") context.customIconMusicAdditional("blue")
return PatchResultSuccess() return PatchResultSuccess()
} }

View File

@ -7,18 +7,19 @@ import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.* import app.revanced.patcher.patch.*
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.util.resources.IconHelper import app.revanced.util.resources.IconHelper.customIconMusic
import app.revanced.util.resources.IconHelper.customIconMusicAdditional
@Patch @Patch
@Name("custom-branding-music-afn-red") @Name("custom-branding-music-afn-red")
@Description("Changes the YouTube Music launcher icon (Afn / Red).") @Description("Changes the YouTube Music launcher icon (Afn / Red).")
@YouTubeMusicCompatibility @YouTubeMusicCompatibility
@Version("0.0.1") @Version("0.0.1")
class CustomBrandingMusicPatch_Red : ResourcePatch { class CustomBrandingMusicIconRedPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext): PatchResult {
IconHelper.customIconMusic(context, "red") context.customIconMusic("red")
IconHelper.customIconMusicAdditional(context, "red") context.customIconMusicAdditional("red")
return PatchResultSuccess() return PatchResultSuccess()
} }

View File

@ -7,17 +7,17 @@ import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.* import app.revanced.patcher.patch.*
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.util.resources.IconHelper import app.revanced.util.resources.IconHelper.customIconMusic
@Patch(false) @Patch(false)
@Name("custom-branding-music-revancify") @Name("custom-branding-music-revancify")
@Description("Changes the YouTube Music launcher icon to your choice (Revancify).") @Description("Changes the YouTube Music launcher icon to your choice (Revancify).")
@YouTubeMusicCompatibility @YouTubeMusicCompatibility
@Version("0.0.1") @Version("0.0.1")
class CustomBrandingMusicPatch_Revancify : ResourcePatch { class CustomBrandingMusicIconRevancifyPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext): PatchResult {
IconHelper.customIconMusic(context, "revancify") context.customIconMusic("revancify")
return PatchResultSuccess() return PatchResultSuccess()
} }

View File

@ -48,8 +48,8 @@ class MusicMicroGBytecodePatch : BytecodePatch(
// - "com.google.android.gms.phenotype.UPDATE", // - "com.google.android.gms.phenotype.UPDATE",
// - "com.google.android.gms.phenotype", // - "com.google.android.gms.phenotype",
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
val YouTubePackageName = PatchOptions.YouTube_PackageName val packageNameYouTube = PatchOptions.YouTubePackageName!!
val MusicPackageName = PatchOptions.Music_PackageName val packageNameMusic = PatchOptions.MusicPackageName!!
// apply common microG patch // apply common microG patch
MicroGBytecodeHelper.patchBytecode( MicroGBytecodeHelper.patchBytecode(
@ -57,13 +57,13 @@ class MusicMicroGBytecodePatch : BytecodePatch(
arrayOf( arrayOf(
MicroGBytecodeHelper.packageNameTransform( MicroGBytecodeHelper.packageNameTransform(
YOUTUBE_PACKAGE_NAME, YOUTUBE_PACKAGE_NAME,
"$YouTubePackageName" packageNameYouTube
) )
), ),
MicroGBytecodeHelper.PrimeMethodTransformationData( MicroGBytecodeHelper.PrimeMethodTransformationData(
PrimeFingerprint, PrimeFingerprint,
MUSIC_PACKAGE_NAME, MUSIC_PACKAGE_NAME,
"$MusicPackageName" packageNameMusic
), ),
listOf( listOf(
ServiceCheckFingerprint, ServiceCheckFingerprint,

View File

@ -13,8 +13,8 @@ import app.revanced.patches.music.misc.microg.shared.Constants.SPOOFED_PACKAGE_N
import app.revanced.patches.music.misc.microg.shared.Constants.SPOOFED_PACKAGE_SIGNATURE import app.revanced.patches.music.misc.microg.shared.Constants.SPOOFED_PACKAGE_SIGNATURE
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.patches.shared.patch.options.PatchOptions import app.revanced.patches.shared.patch.options.PatchOptions
import app.revanced.util.microg.MicroGManifestHelper import app.revanced.util.microg.MicroGManifestHelper.addSpoofingMetadata
import app.revanced.util.microg.MicroGResourceHelper import app.revanced.util.microg.MicroGResourceHelper.patchManifest
@Name("music-microg-resource-patch") @Name("music-microg-resource-patch")
@Description("Resource patch to allow YouTube Music ReVanced to run without root and under a different package name.") @Description("Resource patch to allow YouTube Music ReVanced to run without root and under a different package name.")
@ -27,18 +27,16 @@ import app.revanced.util.microg.MicroGResourceHelper
@Version("0.0.2") @Version("0.0.2")
class MusicMicroGResourcePatch : ResourcePatch { class MusicMicroGResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext): PatchResult {
val MusicPackageName = PatchOptions.Music_PackageName val packageNameMusic = PatchOptions.MusicPackageName!!
// update manifest // update manifest
MicroGResourceHelper.patchManifest( context.patchManifest(
context,
MUSIC_PACKAGE_NAME, MUSIC_PACKAGE_NAME,
"$MusicPackageName" packageNameMusic
) )
// add metadata to the manifest // add metadata to the manifest
MicroGManifestHelper.addSpoofingMetadata( context.addSpoofingMetadata(
context,
SPOOFED_PACKAGE_NAME, SPOOFED_PACKAGE_NAME,
SPOOFED_PACKAGE_SIGNATURE SPOOFED_PACKAGE_SIGNATURE
) )

View File

@ -11,18 +11,18 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.misc.settings.patch.MusicSettingsPatch import app.revanced.patches.music.misc.settings.patch.MusicSettingsPatch
import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility import app.revanced.patches.shared.annotation.YouTubeMusicCompatibility
import app.revanced.util.resources.ResourceHelper import app.revanced.util.resources.ResourceHelper.addTranslations
@Patch @Patch
@Name("translations-music") @Name("translations-music")
@Description("Add Crowdin Translations for YouTube Music") @Description("Add Crowdin translations for YouTube Music.")
@DependsOn([MusicSettingsPatch::class]) @DependsOn([MusicSettingsPatch::class])
@YouTubeMusicCompatibility @YouTubeMusicCompatibility
@Version("0.0.1") @Version("0.0.1")
class MusicTranslationsPatch : ResourcePatch { class MusicTranslationsPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext): PatchResult {
ResourceHelper.addTranslations(context, "music", LANGUAGE_LIST) context.addTranslations("music", LANGUAGE_LIST)
return PatchResultSuccess() return PatchResultSuccess()
} }

View File

@ -27,39 +27,36 @@ class PatchOptions : ResourcePatch {
/* /*
* Custom Branding Name * Custom Branding Name
*/ */
internal var YouTube_AppName: String? by option( internal var YouTubeAppName: String? by option(
PatchOption.StringOption( PatchOption.StringOption(
key = "YouTube_AppName", key = "YouTubeAppName",
default = "ReVanced Extended", default = "ReVanced Extended",
title = "Application Name of YouTube", title = "Application Name of YouTube",
description = "The name of the YouTube it will show on your home screen.", description = "The name of the YouTube it will show on your home screen."
required = true
) )
) )
/* /*
* Custom Package Name (YouTube) * Custom Package Name (YouTube)
*/ */
internal var YouTube_PackageName: String? by option( internal var YouTubePackageName: String? by option(
PatchOption.StringOption( PatchOption.StringOption(
key = "YouTube_PackageName", key = "YouTubePackageName",
default = "app.rvx.android.youtube", default = "app.rvx.android.youtube",
title = "Package Name of YouTube", title = "Package Name of YouTube",
description = "The package name of the YouTube. (NON-ROOT user only)", description = "The package name of the YouTube. (NON-ROOT user only)"
required = true
) )
) )
/* /*
* Custom Package Name (YouTube Music) * Custom Package Name (YouTube Music)
*/ */
internal var Music_PackageName: String? by option( internal var MusicPackageName: String? by option(
PatchOption.StringOption( PatchOption.StringOption(
key = "Music_PackageName", key = "MusicPackageName",
default = "app.rvx.android.apps.youtube.music", default = "app.rvx.android.apps.youtube.music",
title = "Package Name of YouTube Music", title = "Package Name of YouTube Music",
description = "The package name of the YouTube Music. (NON-ROOT user only)", description = "The package name of the YouTube Music. (NON-ROOT user only)"
required = true
) )
) )
@ -68,24 +65,22 @@ class PatchOptions : ResourcePatch {
*/ */
internal var CustomSpeedArrays: String? by option( internal var CustomSpeedArrays: String? by option(
PatchOption.StringOption( PatchOption.StringOption(
key = "Custom_Speed_Arrays", key = "CustomSpeedArrays",
default = "0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 3.0, 5.0", default = "0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 3.0, 5.0",
title = "Custom Speed Values", title = "Custom Speed Values",
description = "A list of custom video speeds. Be sure to separate them with commas (,).", description = "A list of custom video speeds. Be sure to separate them with commas (,)."
required = true
) )
) )
/* /*
* Overlay Buttons Icon * Overlay Buttons Icon
*/ */
internal var Overlay_Buttons_Icon: String? by option( internal var OverlayButtonsIcon: String? by option(
PatchOption.StringOption( PatchOption.StringOption(
key = "Overlay_Buttons_Icon", key = "OverlayButtonsIcon",
default = "new", default = "new",
title = "Overlay button icon selection", title = "Overlay button icon selection",
description = "Choose an overlay buttons icon (old/new)", description = "Choose an overlay buttons icon: old/new"
required = true
) )
) )
@ -97,8 +92,7 @@ class PatchOptions : ResourcePatch {
key = "darkThemeBackgroundColor", key = "darkThemeBackgroundColor",
default = "@android:color/black", default = "@android:color/black",
title = "Background color for the dark theme", title = "Background color for the dark theme",
description = "The background color of the dark theme. Can be a hex color or a resource reference.", description = "The background color of the dark theme. Can be a hex color or a resource reference."
required = true
) )
) )

View File

@ -40,7 +40,6 @@ abstract class AbstractSettingsResourcePatch(
/* initialize ReVanced Settings */ /* initialize ReVanced Settings */
if (isYouTube == true) { if (isYouTube == true) {
context.copyResources(sourceDirectory, ResourceUtils.ResourceGroup("xml", "revanced_prefs.xml")) context.copyResources(sourceDirectory, ResourceUtils.ResourceGroup("xml", "revanced_prefs.xml"))
ResourceHelper.initReVancedSettings(context)
} }
return PatchResultSuccess() return PatchResultSuccess()

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.misc.doublebacktoclose.fingerprint package app.revanced.patches.youtube.ads.doublebacktoclose.fingerprint
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.misc.doublebacktoclose.fingerprint package app.revanced.patches.youtube.ads.doublebacktoclose.fingerprint
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.misc.doublebacktoclose.fingerprint package app.revanced.patches.youtube.ads.doublebacktoclose.fingerprint
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.misc.doublebacktoclose.fingerprint package app.revanced.patches.youtube.ads.doublebacktoclose.fingerprint
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.misc.doublebacktoclose.patch package app.revanced.patches.youtube.ads.doublebacktoclose.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
@ -13,8 +13,8 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.gestures.PredictiveBackGesturePatch import app.revanced.patches.youtube.ads.gestures.PredictiveBackGesturePatch
import app.revanced.patches.youtube.misc.doublebacktoclose.fingerprint.* import app.revanced.patches.youtube.ads.doublebacktoclose.fingerprint.*
import app.revanced.util.integrations.Constants.UTILS_PATH import app.revanced.util.integrations.Constants.UTILS_PATH
@Name("double-back-to-close") @Name("double-back-to-close")

View File

@ -17,7 +17,7 @@ import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch
import app.revanced.patches.youtube.ads.general.bytecode.fingerprints.ComponentContextParserFingerprint import app.revanced.patches.youtube.ads.general.bytecode.fingerprints.ComponentContextParserFingerprint
import app.revanced.patches.youtube.ads.general.bytecode.fingerprints.EmptyComponentBuilderFingerprint import app.revanced.patches.youtube.ads.general.bytecode.fingerprints.EmptyComponentBuilderFingerprint
import app.revanced.util.bytecode.BytecodeHelper import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
import app.revanced.util.integrations.Constants.ADS_PATH import app.revanced.util.integrations.Constants.ADS_PATH
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
import org.jf.dexlib2.builder.instruction.BuilderInstruction21s import org.jf.dexlib2.builder.instruction.BuilderInstruction21s
@ -79,7 +79,7 @@ class GeneralAdsBytecodePatch : BytecodePatch(
} }
} ?: return ComponentContextParserFingerprint.toErrorResult() } ?: return ComponentContextParserFingerprint.toErrorResult()
BytecodeHelper.patchStatus(context, "GeneralAds") context.updatePatchStatus("GeneralAds")
return PatchResultSuccess() return PatchResultSuccess()
} }

View File

@ -14,9 +14,8 @@ import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.ads.general.bytecode.patch.GeneralAdsBytecodePatch import app.revanced.patches.youtube.ads.general.bytecode.patch.GeneralAdsBytecodePatch
import app.revanced.patches.youtube.ads.general.bytecode.patch.GeneralAdsSecondaryBytecodePatch import app.revanced.patches.youtube.ads.general.bytecode.patch.GeneralAdsSecondaryBytecodePatch
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.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
import org.w3c.dom.Element import org.w3c.dom.Element
@Patch @Patch
@ -88,33 +87,22 @@ class GeneralAdsPatch : ResourcePatch {
/* /*
add settings add settings
*/ */
ResourceHelper.addSettings( SettingsPatch.addPreference(
context, arrayOf(
"PREFERENCE_CATEGORY: REVANCED_SETTINGS", "PREFERENCE: ADS_SETTINGS",
"PREFERENCE: ADS_SETTINGS", "SETTINGS: HIDE_GENERAL_ADS",
"SETTINGS: HIDE_GENERAL_ADS"
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_GENERAL_LAYOUT_ADS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_VIEW_PRODUCT"
)
) )
ResourceHelper.addSettings2( SettingsPatch.updatePatchStatus("hide-general-ads")
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_GENERAL_LAYOUT_ADS"
)
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: PLAYER",
"SETTINGS: HIDE_VIEW_PRODUCT"
)
ResourceHelper.patchSuccess(
context,
"hide-general-ads"
)
return PatchResultSuccess() return PatchResultSuccess()
} }

View File

@ -1,4 +1,4 @@
package app.revanced.patches.shared.patch.gestures package app.revanced.patches.youtube.ads.gestures
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.misc.swiperefresh.fingerprint package app.revanced.patches.youtube.ads.swiperefresh.fingerprint
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.misc.swiperefresh.patch package app.revanced.patches.youtube.ads.swiperefresh.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
@ -9,7 +9,7 @@ import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.youtube.misc.swiperefresh.fingerprint.SwipeRefreshLayoutFingerprint import app.revanced.patches.youtube.ads.swiperefresh.fingerprint.SwipeRefreshLayoutFingerprint
import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.extensions.toErrorResult import app.revanced.extensions.toErrorResult
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction import org.jf.dexlib2.iface.instruction.OneRegisterInstruction

View File

@ -1,5 +1,6 @@
package app.revanced.patches.youtube.ads.video.bytecode.patch package app.revanced.patches.youtube.ads.video.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@ -7,26 +8,44 @@ import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn 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.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.videoads.GeneralVideoAdsPatch import app.revanced.patches.shared.patch.videoads.GeneralVideoAdsPatch
import app.revanced.util.bytecode.BytecodeHelper import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
import app.revanced.util.integrations.Constants.ADS_PATH import app.revanced.util.integrations.Constants.ADS_PATH
@Patch
@Name("hide-video-ads")
@Description("Removes ads in the video player.")
@DependsOn( @DependsOn(
[ [
GeneralVideoAdsPatch::class GeneralVideoAdsPatch::class,
SettingsPatch::class
] ]
) )
@Name("hide-video-ads-bytecode-patch")
@YouTubeCompatibility @YouTubeCompatibility
@Version("0.0.1") @Version("0.0.1")
class VideoAdsBytecodePatch : BytecodePatch() { class VideoAdsPatch : BytecodePatch() {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
GeneralVideoAdsPatch.injectLegacyAds(INTEGRATIONS_CLASS_DESCRIPTOR) GeneralVideoAdsPatch.injectLegacyAds(INTEGRATIONS_CLASS_DESCRIPTOR)
GeneralVideoAdsPatch.injectMainstreamAds(INTEGRATIONS_CLASS_DESCRIPTOR) GeneralVideoAdsPatch.injectMainstreamAds(INTEGRATIONS_CLASS_DESCRIPTOR)
BytecodeHelper.patchStatus(context, "VideoAds") context.updatePatchStatus("VideoAds")
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: ADS_SETTINGS",
"SETTINGS: HIDE_VIDEO_ADS"
)
)
SettingsPatch.updatePatchStatus("hide-video-ads")
return PatchResultSuccess() return PatchResultSuccess()
} }

View File

@ -1,48 +0,0 @@
package app.revanced.patches.youtube.ads.video.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.ads.video.bytecode.patch.VideoAdsBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("hide-video-ads")
@Description("Removes ads in the video player.")
@DependsOn(
[
VideoAdsBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class VideoAdsPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: ADS_SETTINGS",
"SETTINGS: HIDE_VIDEO_ADS"
)
ResourceHelper.patchSuccess(
context,
"hide-video-ads"
)
return PatchResultSuccess()
}
}

View File

@ -15,7 +15,6 @@ import app.revanced.patches.youtube.button.autorepeat.patch.AutoRepeatPatch
import app.revanced.patches.youtube.button.overlaybuttons.bytecode.patch.OverlayButtonsBytecodePatch import app.revanced.patches.youtube.button.overlaybuttons.bytecode.patch.OverlayButtonsBytecodePatch
import app.revanced.patches.youtube.button.whitelist.patch.WhitelistPatch import app.revanced.patches.youtube.button.whitelist.patch.WhitelistPatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
import app.revanced.util.resources.ResourceUtils import app.revanced.util.resources.ResourceUtils
import app.revanced.util.resources.ResourceUtils.copyResources import app.revanced.util.resources.ResourceUtils.copyResources
import app.revanced.util.resources.ResourceUtils.copyXmlNode import app.revanced.util.resources.ResourceUtils.copyXmlNode
@ -37,7 +36,14 @@ import app.revanced.util.resources.ResourceUtils.copyXmlNode
class OverlayButtonsResourcePatch : ResourcePatch { class OverlayButtonsResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext): PatchResult {
val icon = PatchOptions.Overlay_Buttons_Icon val icon = PatchOptions.OverlayButtonsIcon!!
/*
* Copy arrays
*/
context.copyXmlNode("youtube/overlaybuttons/host", "values/arrays.xml", "resources")
/* /*
* Copy resources * Copy resources
@ -105,17 +111,14 @@ class OverlayButtonsResourcePatch : ResourcePatch {
/* /*
add settings add settings
*/ */
ResourceHelper.addSettings( SettingsPatch.addPreference(
context, arrayOf(
"PREFERENCE_CATEGORY: REVANCED_EXTENDED_SETTINGS", "PREFERENCE: OVERLAY_BUTTONS",
"PREFERENCE: OVERLAY_BUTTONS", "SETTINGS: OVERLAY_BUTTONS"
"SETTINGS: OVERLAY_BUTTONS" )
) )
ResourceHelper.patchSuccess( SettingsPatch.updatePatchStatus("overlay-buttons")
context,
"overlay-buttons"
)
return PatchResultSuccess() return PatchResultSuccess()
} }

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.extended.forcevp9.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.extended.forcevp9.bytecode.patch.ForceVP9CodecBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("force-vp9-codec")
@Description("Forces the VP9 codec for videos.")
@DependsOn(
[
ForceVP9CodecBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class ForceVP9CodecPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_EXTENDED_SETTINGS",
"PREFERENCE: EXTENDED_SETTINGS",
"SETTINGS: EXPERIMENTAL_FLAGS",
"SETTINGS: ENABLE_VP9_CODEC"
)
ResourceHelper.patchSuccess(
context,
"force-vp9-codec"
)
return PatchResultSuccess()
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.extended.layoutswitch.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.extended.layoutswitch.bytecode.patch.LayoutSwitchBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("layout-switch")
@Description("Tricks the dpi to use some tablet/phone layouts.")
@DependsOn(
[
LayoutSwitchBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class LayoutSwitchPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_EXTENDED_SETTINGS",
"PREFERENCE: EXTENDED_SETTINGS",
"SETTINGS: EXPERIMENTAL_FLAGS",
"SETTINGS: LAYOUT_SWITCH"
)
ResourceHelper.patchSuccess(
context,
"layout-switch"
)
return PatchResultSuccess()
}
}

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.extended.oldlayout.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.extended.oldlayout.bytecode.patch.OldLayoutBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch
@Name("enable-old-layout")
@Description("Spoof the YouTube client version to use the old layout.")
@DependsOn(
[
OldLayoutBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class OldLayoutPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings2(
context,
"PREFERENCE_CATEGORY: REVANCED_EXTENDED_SETTINGS",
"PREFERENCE: EXTENDED_SETTINGS",
"SETTINGS: EXPERIMENTAL_FLAGS",
"SETTINGS: ENABLE_OLD_LAYOUT"
)
ResourceHelper.patchSuccess(
context,
"enable-old-layout"
)
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.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility 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.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch @Patch
@Name("hide-button-container") @Name("hide-button-container")
@ -31,18 +30,15 @@ class ButtonContainerPatch : ResourcePatch {
/* /*
add settings add settings
*/ */
ResourceHelper.addSettings2( SettingsPatch.addPreference(
context, arrayOf(
"PREFERENCE_CATEGORY: REVANCED_SETTINGS", "PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS", "PREFERENCE_HEADER: BOTTOM_PLAYER",
"PREFERENCE_HEADER: BOTTOM_PLAYER", "SETTINGS: BUTTON_CONTAINER"
"SETTINGS: BUTTON_CONTAINER" )
) )
ResourceHelper.patchSuccess( SettingsPatch.updatePatchStatus("hide-button-container")
context,
"hide-button-container"
)
return PatchResultSuccess() 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.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.ads.general.bytecode.patch.GeneralAdsBytecodePatch import app.revanced.patches.youtube.ads.general.bytecode.patch.GeneralAdsBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch @Patch
@Name("hide-comment-component") @Name("hide-comment-component")
@ -31,18 +30,15 @@ class CommentComponentPatch : ResourcePatch {
/* /*
add settings add settings
*/ */
ResourceHelper.addSettings2( SettingsPatch.addPreference(
context, arrayOf(
"PREFERENCE_CATEGORY: REVANCED_SETTINGS", "PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS", "PREFERENCE_HEADER: BOTTOM_PLAYER",
"PREFERENCE_HEADER: BOTTOM_PLAYER", "SETTINGS: COMMENT_COMPONENT"
"SETTINGS: COMMENT_COMPONENT" )
) )
ResourceHelper.patchSuccess( SettingsPatch.updatePatchStatus("hide-comment-component")
context,
"hide-comment-component"
)
return PatchResultSuccess() return PatchResultSuccess()
} }

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.misc.branding.icon.patch package app.revanced.patches.youtube.layout.etc.branding.icon.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
@ -11,8 +11,8 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.IconHelper import app.revanced.util.resources.IconHelper.customIcon
import app.revanced.util.resources.ResourceHelper import app.revanced.util.resources.ResourceHelper.updatePatchStatusIcon
@Patch(false) @Patch(false)
@Name("custom-branding-icon-afn-blue") @Name("custom-branding-icon-afn-blue")
@ -20,18 +20,11 @@ import app.revanced.util.resources.ResourceHelper
@DependsOn([SettingsPatch::class]) @DependsOn([SettingsPatch::class])
@YouTubeCompatibility @YouTubeCompatibility
@Version("0.0.1") @Version("0.0.1")
class CustomBrandingPatch_Blue : ResourcePatch { class CustomBrandingIconBluePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext): PatchResult {
IconHelper.customIcon( context.customIcon("blue")
context, context.updatePatchStatusIcon("blue")
"blue"
)
ResourceHelper.iconPatchSuccess(
context,
"blue"
)
return PatchResultSuccess() return PatchResultSuccess()
} }

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.misc.branding.icon.patch package app.revanced.patches.youtube.layout.etc.branding.icon.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
@ -11,8 +11,8 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.IconHelper import app.revanced.util.resources.IconHelper.customIcon
import app.revanced.util.resources.ResourceHelper import app.revanced.util.resources.ResourceHelper.updatePatchStatusIcon
@Patch @Patch
@Name("custom-branding-icon-afn-red") @Name("custom-branding-icon-afn-red")
@ -20,18 +20,11 @@ import app.revanced.util.resources.ResourceHelper
@DependsOn([SettingsPatch::class]) @DependsOn([SettingsPatch::class])
@YouTubeCompatibility @YouTubeCompatibility
@Version("0.0.1") @Version("0.0.1")
class CustomBrandingPatch_Red : ResourcePatch { class CustomBrandingIconRedPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext): PatchResult {
IconHelper.customIcon( context.customIcon("red")
context, context.updatePatchStatusIcon("red")
"red"
)
ResourceHelper.iconPatchSuccess(
context,
"red"
)
return PatchResultSuccess() return PatchResultSuccess()
} }

View File

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

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.misc.branding.name.patch package app.revanced.patches.youtube.layout.etc.branding.name.patch
import app.revanced.extensions.startsWithAny import app.revanced.extensions.startsWithAny
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
@ -13,7 +13,7 @@ import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.options.PatchOptions import app.revanced.patches.shared.patch.options.PatchOptions
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper import app.revanced.util.resources.ResourceHelper.updatePatchStatusLabel
import org.w3c.dom.Element import org.w3c.dom.Element
@Patch @Patch
@ -32,7 +32,7 @@ class CustomBrandingNamePatch : ResourcePatch {
// App name // App name
val resourceFileNames = arrayOf("strings.xml") val resourceFileNames = arrayOf("strings.xml")
val appName = PatchOptions.YouTube_AppName val appName = PatchOptions.YouTubeAppName
context.forEach { context.forEach {
if (!it.name.startsWithAny(*resourceFileNames)) return@forEach if (!it.name.startsWithAny(*resourceFileNames)) return@forEach
@ -54,10 +54,7 @@ class CustomBrandingNamePatch : ResourcePatch {
} }
} }
ResourceHelper.labelPatchSuccess( context.updatePatchStatusLabel("$appName")
context,
"$appName"
)
return PatchResultSuccess() return PatchResultSuccess()
} }

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.misc.forceheader.patch package app.revanced.patches.youtube.layout.etc.forceheader.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
@ -12,7 +12,6 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
import java.nio.file.Files import java.nio.file.Files
import java.nio.file.StandardCopyOption import java.nio.file.StandardCopyOption
import kotlin.io.path.exists import kotlin.io.path.exists
@ -51,18 +50,15 @@ class PremiumHeadingPatch : ResourcePatch {
prefs.writeText( prefs.writeText(
prefs.readText() prefs.readText()
.replace( .replace(
"<SwitchPreference android:title=\"@string/revanced_override_premium_header_title\" android:key=\"revanced_override_premium_header\" android:defaultValue=\"false\" android:summaryOn=\"@string/revanced_override_premium_header_summary_on\" android:summaryOff=\"@string/revanced_override_premium_header_summary_off\" />", "HEADER_SWITCH",
"" "FORCE_PREMIUM_HEADER"
).replace( ).replace(
"header-switch", "header-switch",
"force-premium-heading" "force-premium-heading"
) )
) )
ResourceHelper.patchSuccess( SettingsPatch.updatePatchStatus("force-premium-heading")
context,
"force-premium-heading"
)
return PatchResultSuccess() return PatchResultSuccess()
} }

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.misc.materialyou.patch package app.revanced.patches.youtube.layout.etc.materialyou.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
@ -10,9 +10,10 @@ import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility 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.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.patches.youtube.misc.theme.bytecode.patch.GeneralThemePatch import app.revanced.util.resources.ResourceHelper.updatePatchStatusTheme
import app.revanced.util.resources.ResourceHelper
import app.revanced.util.resources.ResourceUtils.copyXmlNode import app.revanced.util.resources.ResourceUtils.copyXmlNode
import java.nio.file.Files import java.nio.file.Files
import java.nio.file.StandardCopyOption import java.nio.file.StandardCopyOption
@ -68,12 +69,9 @@ class MaterialYouPatch : ResourcePatch {
/* /*
add settings add settings
*/ */
context.updatePatchStatusTheme("materialyou")
ResourceHelper.themePatchSuccess( isMonetPatchIncluded = true
context,
"default",
"materialyou"
)
return PatchResultSuccess() return PatchResultSuccess()
} }

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.misc.optimize.patch package app.revanced.patches.youtube.layout.etc.optimize.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
@ -11,7 +11,6 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch @Patch
@Name("optimize-resource") @Name("optimize-resource")
@ -27,10 +26,7 @@ import app.revanced.util.resources.ResourceHelper
class OptimizeResourcePatch : ResourcePatch { class OptimizeResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext): PatchResult {
ResourceHelper.patchSuccess( SettingsPatch.updatePatchStatus("optimize-resource")
context,
"optimize-resource"
)
return PatchResultSuccess() return PatchResultSuccess()
} }

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.misc.optimize.patch package app.revanced.patches.youtube.layout.etc.optimize.patch
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name

View File

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

View File

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

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.misc.pipnotification.bytecode.patch package app.revanced.patches.youtube.layout.etc.pipnotification.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@ -8,13 +9,19 @@ import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess 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.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.misc.pipnotification.bytecode.fingerprints.* import app.revanced.patches.youtube.layout.etc.pipnotification.fingerprints.*
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
@Name("hide-pip-notification-bytecode-patch") @Patch
@Name("hide-pip-notification")
@Description("Disable pip notification when you first launch pip mode.")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility @YouTubeCompatibility
@Version("0.0.1") @Version("0.0.1")
class PiPNotificationBytecodePatch : BytecodePatch( class PiPNotificationPatch : BytecodePatch(
listOf( listOf(
PrimaryPiPFingerprint, PrimaryPiPFingerprint,
SecondaryPiPFingerprint SecondaryPiPFingerprint
@ -32,6 +39,11 @@ class PiPNotificationBytecodePatch : BytecodePatch(
it.mutableMethod.addInstruction(index, "return-void") it.mutableMethod.addInstruction(index, "return-void")
} }
/*
add settings
*/
SettingsPatch.updatePatchStatus("hide-pip-notification")
return PatchResultSuccess() return PatchResultSuccess()
} }
} }

View File

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

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.misc.theme.bytecode.patch package app.revanced.patches.youtube.layout.etc.theme.bytecode.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
@ -10,8 +10,8 @@ import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.misc.theme.bytecode.fingerprints.LithoThemeFingerprint import app.revanced.patches.youtube.layout.etc.theme.bytecode.fingerprints.LithoThemeFingerprint
import app.revanced.patches.youtube.misc.theme.resource.patch.GeneralThemeResourcePatch import app.revanced.patches.youtube.layout.etc.theme.resource.patch.GeneralThemeResourcePatch
import app.revanced.util.integrations.Constants.UTILS_PATH import app.revanced.util.integrations.Constants.UTILS_PATH
import org.jf.dexlib2.iface.instruction.formats.Instruction35c import org.jf.dexlib2.iface.instruction.formats.Instruction35c
@ -42,4 +42,7 @@ class GeneralThemePatch : BytecodePatch(
return PatchResultSuccess() return PatchResultSuccess()
} }
internal companion object {
var isMonetPatchIncluded: Boolean = false
}
} }

View File

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.misc.theme.resource.patch package app.revanced.patches.youtube.layout.etc.theme.resource.patch
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version

View File

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

View File

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

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.misc.tooltip.bytecode.patch package app.revanced.patches.youtube.layout.etc.tooltip.patch
import app.revanced.extensions.toErrorResult import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
@ -9,12 +10,21 @@ import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn 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.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.resourceid.patch.SharedResourcdIdPatch
import app.revanced.patches.youtube.misc.tooltip.bytecode.fingerprints.TooltipContentViewFingerprint import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
@Name("hide-tooltip-content-bytecode-patch") @Patch
@DependsOn([SharedResourcdIdPatch::class]) @Name("hide-tooltip-content")
@Description("Hides the tooltip box that appears on first install.")
@DependsOn(
[
SettingsPatch::class,
SharedResourcdIdPatch::class
]
)
@YouTubeCompatibility @YouTubeCompatibility
@Version("0.0.1") @Version("0.0.1")
class TooltipContentViewBytecodePatch : BytecodePatch( class TooltipContentViewBytecodePatch : BytecodePatch(
@ -29,6 +39,11 @@ class TooltipContentViewBytecodePatch : BytecodePatch(
"return-void" "return-void"
) ?: return TooltipContentViewFingerprint.toErrorResult() ) ?: return TooltipContentViewFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.updatePatchStatus("hide-tooltip-content")
return PatchResultSuccess() 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.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility 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.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper
@Patch @Patch
@Name("hide-flyout-panel") @Name("hide-flyout-panel")
@ -31,18 +30,15 @@ class FlyoutPanelPatch : ResourcePatch {
/* /*
add settings add settings
*/ */
ResourceHelper.addSettings2( SettingsPatch.addPreference(
context, arrayOf(
"PREFERENCE_CATEGORY: REVANCED_SETTINGS", "PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE: LAYOUT_SETTINGS", "PREFERENCE_HEADER: FLYOUT_PANEL",
"PREFERENCE_HEADER: FLYOUT_PANEL", "SETTINGS: FLYOUT_PANEL_COMPONENT"
"SETTINGS: FLYOUT_PANEL_COMPONENT" )
) )
ResourceHelper.patchSuccess( SettingsPatch.updatePatchStatus("hide-flyout-panel")
context,
"hide-flyout-panel"
)
return PatchResultSuccess() 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.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch 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.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext 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.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess 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.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 app.revanced.util.integrations.Constants.FLYOUTPANEL_LAYOUT
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction 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 @YouTubeCompatibility
@Version("0.0.1") @Version("0.0.1")
class OldQualityLayoutBytecodePatch : BytecodePatch( class OldQualityLayoutPatch : BytecodePatch(
listOf(QualityMenuViewInflateFingerprint) listOf(QualityMenuViewInflateFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
@ -33,6 +40,19 @@ class OldQualityLayoutBytecodePatch : BytecodePatch(
} }
} ?: return QualityMenuViewInflateFingerprint.toErrorResult() } ?: 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() 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.findMutableMethodOf
import app.revanced.extensions.toResult import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext 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.extensions.instruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult 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.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch 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 app.revanced.util.integrations.Constants.FULLSCREEN_LAYOUT
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.formats.Instruction31i import org.jf.dexlib2.iface.instruction.formats.Instruction31i
@Name("hide-endscreen-overlay-bytecode-patch") @Patch
@DependsOn([ResourceMappingPatch::class]) @Name("hide-endscreen-overlay")
@Description("Hide endscreen overlay on swipe controls.")
@DependsOn(
[
ResourceMappingPatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility @YouTubeCompatibility
@Version("0.0.1") @Version("0.0.1")
class HideEndscreenOverlayBytecodePatch : BytecodePatch() { class HideEndscreenOverlayPatch : BytecodePatch() {
// list of resource names to get the id of // list of resource names to get the id of
private val resourceIds = arrayOf( private val resourceIds = arrayOf(
"app_related_endscreen_results" "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.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch 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.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext 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.PatchResult
import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess 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.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 app.revanced.util.integrations.Constants.FULLSCREEN_LAYOUT
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.ReferenceInstruction import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
import org.jf.dexlib2.iface.reference.FieldReference 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 @YouTubeCompatibility
@Version("0.0.1") @Version("0.0.1")
class HideFilmstripOverlayBytecodePatch : BytecodePatch( class HideFilmstripOverlayPatch : BytecodePatch(
listOf( listOf(
ScrubbingLabelFingerprint ScrubbingLabelFingerprint
) )
@ -49,6 +56,19 @@ class HideFilmstripOverlayBytecodePatch : BytecodePatch(
it.removeInstruction(index) 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() 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 app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode 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.findMutableMethodOf
import app.revanced.extensions.injectHideCall 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.Instruction21c
import org.jf.dexlib2.iface.instruction.formats.Instruction31i import org.jf.dexlib2.iface.instruction.formats.Instruction31i
@Name("hide-fullscreen-buttoncontainer-bytecode-patch") @Name("hide-fullscreen-buttoncontainer")
@DependsOn([ResourceMappingPatch::class]) @DependsOn([ResourceMappingPatch::class])
@YouTubeCompatibility @YouTubeCompatibility
@Version("0.0.1") @Version("0.0.1")
class FullscreenButtonContainerBytecodePatch : BytecodePatch() { class HideFullscreenButtonContainerPatch : BytecodePatch() {
private val resourceIds = arrayOf( private val resourceIds = arrayOf(
"quick_actions_element_container" "quick_actions_element_container"
).map { name -> ).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.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext 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.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess 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.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.fingerprints.LayoutConstructorFingerprint 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 app.revanced.util.integrations.Constants.FULLSCREEN_LAYOUT
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
import org.jf.dexlib2.builder.instruction.BuilderInstruction35c import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
import org.jf.dexlib2.iface.instruction.formats.Instruction35c 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 @YouTubeCompatibility
@Version("0.0.1") @Version("0.0.1")
class HideFullscreenPanelsBytecodePatch : BytecodePatch( class HideFullscreenPanelsPatch : BytecodePatch(
listOf( listOf(
FullscreenViewAdderFingerprint, FullscreenViewAdderFingerprint,
LayoutConstructorFingerprint LayoutConstructorFingerprint
@ -45,6 +57,19 @@ class HideFullscreenPanelsBytecodePatch : BytecodePatch(
} }
} ?: return FullscreenViewAdderFingerprint.toErrorResult() } ?: 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 -> LayoutConstructorFingerprint.result?.mutableMethod?.let { method ->
val invokeIndex = method.implementation!!.instructions.indexOfFirst { val invokeIndex = method.implementation!!.instructions.indexOfFirst {
it.opcode.ordinal == Opcode.INVOKE_VIRTUAL.ordinal && 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 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 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 app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode 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 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.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext 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.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess 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.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.annotation.YouTubeCompatibility 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 app.revanced.util.integrations.Constants.FULLSCREEN_LAYOUT
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction 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 @YouTubeCompatibility
@Version("0.0.1") @Version("0.0.1")
class HapticFeedBackBytecodePatch : BytecodePatch( class HapticFeedBackPatch : BytecodePatch(
listOf( listOf(
MarkerHapticsFingerprint, MarkerHapticsFingerprint,
SeekHapticsFingerprint, SeekHapticsFingerprint,
@ -44,6 +51,19 @@ class HapticFeedBackBytecodePatch : BytecodePatch(
} ?: return fingerprint.toErrorResult() } ?: 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() 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.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint 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.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint 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.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext 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.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess 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.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.fingerprints.SubtitleButtonControllerFingerprint 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 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 @YouTubeCompatibility
@Version("0.0.1") @Version("0.0.1")
class AutoCaptionsBytecodePatch : BytecodePatch( class AutoCaptionsPatch : BytecodePatch(
listOf( listOf(
StartVideoInformerFingerprint, StartVideoInformerFingerprint,
SubtitleButtonControllerFingerprint, SubtitleButtonControllerFingerprint,
@ -56,6 +64,19 @@ class AutoCaptionsBytecodePatch : BytecodePatch(
) )
} ?: return SubtitleTrackFingerprint.toErrorResult() } ?: 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() 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.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint 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.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext 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.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess 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.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.annotation.YouTubeCompatibility 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 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 @YouTubeCompatibility
@Version("0.0.1") @Version("0.0.1")
class PlayerPopupPanelsBytecodePatch : BytecodePatch( class PlayerPopupPanelsPatch : BytecodePatch(
listOf( listOf(
EngagementPanelControllerFingerprint EngagementPanelControllerFingerprint
) )
@ -37,6 +44,19 @@ class PlayerPopupPanelsBytecodePatch : BytecodePatch(
) )
} ?: return EngagementPanelControllerFingerprint.toErrorResult() } ?: 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() 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.findMutableMethodOf
import app.revanced.extensions.injectHideCall 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.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult 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.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch 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.Opcode
import org.jf.dexlib2.iface.instruction.formats.Instruction22c import org.jf.dexlib2.iface.instruction.formats.Instruction22c
import org.jf.dexlib2.iface.instruction.formats.Instruction31i import org.jf.dexlib2.iface.instruction.formats.Instruction31i
@Name("hide-crowdfunding-box-bytecode-patch") @Patch
@DependsOn([ResourceMappingPatch::class]) @Name("hide-crowdfunding-box")
@Description("Hides the crowdfunding box between the player and video description.")
@DependsOn(
[
ResourceMappingPatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility @YouTubeCompatibility
@Version("0.0.1") @Version("0.0.1")
class CrowdfundingBoxBytecodePatch : BytecodePatch() { class CrowdfundingBoxPatch : BytecodePatch() {
// list of resource names to get the id of // list of resource names to get the id of
private val resourceIds = arrayOf( 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.findMutableMethodOf
import app.revanced.extensions.toResult import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult 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.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch 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.Opcode
import org.jf.dexlib2.iface.instruction.formats.Instruction31i import org.jf.dexlib2.iface.instruction.formats.Instruction31i
@DependsOn([ResourceMappingPatch::class]) @Patch
@Name("header-switch-bytecode-patch") @Name("header-switch")
@Description("Add switch to change header.")
@DependsOn(
[
ResourceMappingPatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility @YouTubeCompatibility
@Version("0.0.1") @Version("0.0.1")
class HeaderSwitchBytecodePatch : BytecodePatch() { class HeaderSwitchPatch : BytecodePatch() {
// list of resource names to get the id of // list of resource names to get the id of
private val resourceIds = arrayOf( 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.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint 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.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch 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.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint 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.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch 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.injectHideCall
import app.revanced.extensions.toErrorResult import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext 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.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess 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.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.Instruction
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
import org.jf.dexlib2.iface.instruction.formats.Instruction21c 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 @YouTubeCompatibility
@Version("0.0.1") @Version("0.0.1")
class MixPlaylistsBytecodePatch : BytecodePatch( class MixPlaylistsPatch : BytecodePatch(
listOf( listOf(
CreateMixPlaylistFingerprint, CreateMixPlaylistFingerprint,
SecondCreateMixPlaylistFingerprint, SecondCreateMixPlaylistFingerprint,
@ -44,6 +51,19 @@ class MixPlaylistsBytecodePatch : BytecodePatch(
fingerprint.result?.hookMixPlaylists(boolean) ?: return fingerprint.toErrorResult() 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() 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.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.resourceid.patch.SharedResourcdIdPatch 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.extensions.toErrorResult
import app.revanced.patcher.annotation.Name 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.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess 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.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 app.revanced.util.integrations.Constants.GENERAL_LAYOUT
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Name("hide-email-address-bytecode-patch") @Patch
@Name("hide-email-address")
@DependsOn([SettingsPatch::class])
@YouTubeCompatibility @YouTubeCompatibility
@Version("0.0.1") @Version("0.0.1")
class HideEmailAddressBytecodePatch : BytecodePatch( class HideEmailAddressPatch : BytecodePatch(
listOf( listOf(
AccountSwitcherAccessibilityLabelFingerprint AccountSwitcherAccessibilityLabelFingerprint
) )
@ -38,6 +43,19 @@ class HideEmailAddressBytecodePatch : BytecodePatch(
} }
} ?: return AccountSwitcherAccessibilityLabelFingerprint.toErrorResult() } ?: 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() 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.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
@ -15,11 +15,11 @@ object PivotBarFingerprint : MethodFingerprint(
Opcode.MOVE_RESULT_OBJECT, Opcode.MOVE_RESULT_OBJECT,
Opcode.RETURN_OBJECT Opcode.RETURN_OBJECT
), ),
customFingerprint = { customFingerprint = { methodDef ->
it.definingClass == "Lcom/google/android/apps/youtube/app/ui/pivotbar/PivotBar;" && methodDef.definingClass == "Lcom/google/android/apps/youtube/app/ui/pivotbar/PivotBar;" &&
it.implementation?.instructions?.any { methodDef.implementation?.instructions?.any {
it.opcode.ordinal == Opcode.CONST.ordinal && it.opcode.ordinal == Opcode.CONST.ordinal &&
(it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.imageWithTextTabId (it as? WideLiteralInstruction)?.wideLiteral == SharedResourcdIdPatch.imageWithTextTabId
} == true } == 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.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext 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.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn 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.annotation.YouTubeCompatibility
import app.revanced.patches.shared.fingerprints.PivotBarCreateButtonViewFingerprint 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.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.integrations.Constants.GENERAL_LAYOUT
import app.revanced.util.pivotbar.InjectionUtils.REGISTER_TEMPLATE_REPLACEMENT import app.revanced.util.pivotbar.InjectionUtils.REGISTER_TEMPLATE_REPLACEMENT
import app.revanced.util.pivotbar.InjectionUtils.injectHook import app.revanced.util.pivotbar.InjectionUtils.injectHook
import org.jf.dexlib2.dexbacked.reference.DexBackedMethodReference import org.jf.dexlib2.dexbacked.reference.DexBackedMethodReference
import org.jf.dexlib2.iface.instruction.ReferenceInstruction import org.jf.dexlib2.iface.instruction.ReferenceInstruction
@Name("hide-create-button-bytecode-patch") @Patch
@DependsOn([SharedResourcdIdPatch::class]) @Name("hide-create-button")
@Description("Hides the create button in the navigation bar.")
@DependsOn(
[
SettingsPatch::class,
SharedResourcdIdPatch::class
]
)
@YouTubeCompatibility @YouTubeCompatibility
@Version("0.0.1") @Version("0.0.1")
class CreateButtonRemoverBytecodePatch : BytecodePatch( class CreateButtonRemoverPatch : BytecodePatch(
listOf( listOf(
PivotBarCreateButtonViewFingerprint, PivotBarCreateButtonViewFingerprint,
PivotBarFingerprint PivotBarFingerprint
@ -58,6 +68,19 @@ class CreateButtonRemoverBytecodePatch : BytecodePatch(
injectHook(hook, createButtonInstructions.indexOf(instruction) + 2) 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 PatchResultSuccess()
} }
return PivotBarCreateButtonViewFingerprint.toErrorResult() 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 app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode 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 app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode 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.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext 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.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn 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.annotation.YouTubeCompatibility
import app.revanced.patches.shared.fingerprints.PivotBarCreateButtonViewFingerprint 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.fingerprints.PivotBarEnumFingerprint
import app.revanced.patches.youtube.layout.general.pivotbar.shortsbutton.bytecode.fingerprints.PivotBarShortsButtonViewFingerprint 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.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.integrations.Constants.GENERAL_LAYOUT
import app.revanced.util.pivotbar.InjectionUtils.REGISTER_TEMPLATE_REPLACEMENT import app.revanced.util.pivotbar.InjectionUtils.REGISTER_TEMPLATE_REPLACEMENT
import app.revanced.util.pivotbar.InjectionUtils.injectHook import app.revanced.util.pivotbar.InjectionUtils.injectHook
@Patch
@Name("hide-shorts-button") @Name("hide-shorts-button")
@DependsOn([SharedResourcdIdPatch::class]) @Description("Hides the shorts button in the navigation bar.")
@DependsOn(
[
SettingsPatch::class,
SharedResourcdIdPatch::class
]
)
@YouTubeCompatibility @YouTubeCompatibility
@Version("0.0.1") @Version("0.0.1")
class ShortsButtonRemoverBytecodePatch : BytecodePatch( class ShortsButtonRemoverPatch : BytecodePatch(
listOf(PivotBarCreateButtonViewFingerprint) listOf(PivotBarCreateButtonViewFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
@ -62,6 +72,22 @@ class ShortsButtonRemoverBytecodePatch : BytecodePatch(
} ?: return PivotBarCreateButtonViewFingerprint.toErrorResult() } ?: 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() return PatchResultSuccess()
} }
private companion object { 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.findMutableMethodOf
import app.revanced.extensions.injectHideCall import app.revanced.extensions.injectHideCall
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext 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.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn 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.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch 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.Opcode
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
import org.jf.dexlib2.iface.instruction.formats.Instruction21c import org.jf.dexlib2.iface.instruction.formats.Instruction21c
import org.jf.dexlib2.iface.instruction.formats.Instruction31i import org.jf.dexlib2.iface.instruction.formats.Instruction31i
@Name("hide-shorts-component-bytecode-patch") @Patch
@DependsOn([ResourceMappingPatch::class]) @Name("hide-shorts-component")
@Description("Hides other Shorts components.")
@DependsOn(
[
LithoFilterPatch::class,
ResourceMappingPatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility @YouTubeCompatibility
@Version("0.0.1") @Version("0.0.1")
class ShortsComponentBytecodePatch : BytecodePatch() { class ShortsComponentPatch : BytecodePatch() {
// list of resource names to get the id of // list of resource names to get the id of
private val resourceIds = arrayOf( private val resourceIds = arrayOf(
@ -88,11 +100,31 @@ class ShortsComponentBytecodePatch : BytecodePatch() {
} }
} }
} }
val errorIndex = patchSuccessArray.indexOf(false)
return if (errorIndex == -1) { val errorIndex: Int = patchSuccessArray.indexOf(false)
BytecodeHelper.patchStatus(context, "ShortsComponent")
PatchResultSuccess() 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 } 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.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint 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.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext 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.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess 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.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.annotation.YouTubeCompatibility 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 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 @YouTubeCompatibility
@Version("0.0.1") @Version("0.0.1")
class HideSnackbarBytecodePatch : BytecodePatch( class HideSnackbarPatch : BytecodePatch(
listOf( listOf(
HideSnackbarFingerprint HideSnackbarFingerprint
) )
@ -35,6 +42,19 @@ class HideSnackbarBytecodePatch : BytecodePatch(
) )
} ?: return HideSnackbarFingerprint.toErrorResult() } ?: return HideSnackbarFingerprint.toErrorResult()
/*
add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: LAYOUT_SETTINGS",
"PREFERENCE_HEADER: GENERAL",
"SETTINGS: HIDE_SNACKBAR"
)
)
SettingsPatch.updatePatchStatus("hide-snackbar")
return PatchResultSuccess() return PatchResultSuccess()
} }
} }

View File

@ -1,49 +0,0 @@
package app.revanced.patches.youtube.layout.general.snackbar.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.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.")
@DependsOn(
[
HideSnackbarBytecodePatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class HideSnackbarPatch : 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"
)
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.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint 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.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext 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.BytecodePatch
import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess 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.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.annotation.YouTubeCompatibility 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 app.revanced.util.integrations.Constants.GENERAL_LAYOUT
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction 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 @YouTubeCompatibility
@Version("0.0.1") @Version("0.0.1")
class HideShortsOnStartupBytecodePatch : BytecodePatch( class HideShortsOnStartupPatch : BytecodePatch(
listOf( listOf(
UserWasInShortsFingerprint UserWasInShortsFingerprint
) )
@ -41,6 +48,21 @@ class HideShortsOnStartupBytecodePatch : BytecodePatch(
} }
} ?: return UserWasInShortsFingerprint.toErrorResult() } ?: 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() 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.findMutableMethodOf
import app.revanced.extensions.injectHideCall 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.Name
import app.revanced.patcher.annotation.Version import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult 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.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.annotation.YouTubeCompatibility import app.revanced.patches.shared.annotation.YouTubeCompatibility
import app.revanced.patches.shared.patch.mapping.ResourceMappingPatch 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.Opcode
import org.jf.dexlib2.iface.instruction.formats.Instruction22c import org.jf.dexlib2.iface.instruction.formats.Instruction22c
import org.jf.dexlib2.iface.instruction.formats.Instruction31i import org.jf.dexlib2.iface.instruction.formats.Instruction31i
@Name("hide-stories-bytecode-patch") @Patch
@DependsOn([ResourceMappingPatch::class]) @Name("hide-stories")
@Description("Hides YouTube Stories shelf on the feed.")
@DependsOn(
[
ResourceMappingPatch::class,
SettingsPatch::class
]
)
@YouTubeCompatibility @YouTubeCompatibility
@Version("0.0.1") @Version("0.0.1")
class HideStoriesBytecodePatch : BytecodePatch() { class HideStoriesPatch : BytecodePatch() {
// list of resource names to get the id of // list of resource names to get the id of
private val resourceIds = arrayOf( 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()
}
}

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