feat(youtube/general-ads): merge hide-get-premium patch into general-ads patch

This commit is contained in:
oSumAtrIX 2023-05-24 21:36:48 +02:00
parent acccfd9f92
commit 5195dd8936
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4
4 changed files with 28 additions and 19 deletions

View file

@ -14,13 +14,21 @@ import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.misc.fix.verticalscroll.patch.VerticalScrollPatch
import app.revanced.patches.youtube.ad.general.annotation.HideAdsCompatibility
import app.revanced.patches.youtube.ad.general.resource.patch.HideAdsResourcePatch
import app.revanced.patches.youtube.ad.getpremium.bytecode.patch.HideGetPremiumPatch
import app.revanced.patches.youtube.misc.fix.backtoexitgesture.patch.FixBackToExitGesturePatch
import org.jf.dexlib2.iface.instruction.formats.Instruction31i
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
@Patch
@DependsOn([HideAdsResourcePatch::class, VerticalScrollPatch::class, FixBackToExitGesturePatch::class])
@DependsOn(
[
HideGetPremiumPatch::class,
HideAdsResourcePatch::class,
VerticalScrollPatch::class,
FixBackToExitGesturePatch::class
]
)
@Name("hide-ads")
@Description("Removes general ads.")
@HideAdsCompatibility

View file

@ -1,4 +1,4 @@
package app.revanced.patches.youtube.layout.hide.getpremium.annotations
package app.revanced.patches.youtube.ad.getpremium.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package

View file

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

View file

@ -1,7 +1,6 @@
package app.revanced.patches.youtube.layout.hide.getpremium.bytecode.patch
package app.revanced.patches.youtube.ad.getpremium.bytecode.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
@ -11,33 +10,35 @@ import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.layout.hide.getpremium.annotations.HideGetPremiumCompatibility
import app.revanced.patches.youtube.layout.hide.getpremium.bytecode.fingerprints.GetPremiumViewFingerprint
import app.revanced.patches.youtube.ad.getpremium.annotations.HideGetPremiumCompatibility
import app.revanced.patches.youtube.ad.getpremium.bytecode.fingerprints.GetPremiumViewFingerprint
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
@Patch
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
@Name("hide-get-premium")
@Description("Hides advertisement for YouTube Premium under the video player.")
@HideGetPremiumCompatibility
@Version("0.0.1")
class HideGetPremiumPatch : BytecodePatch(
listOf(
GetPremiumViewFingerprint,
)
) {
class HideGetPremiumPatch : BytecodePatch(listOf(GetPremiumViewFingerprint,)) {
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SettingsPatch.PreferenceScreen.ADS.addPreferences(
SwitchPreference(
"revanced_hide_get_premium",
StringResource("revanced_hide_get_premium_title", "Hide YouTube Premium advertisement"),
StringResource("revanced_hide_get_premium_summary_on", "YouTube Premium advertisement are hidden"),
StringResource("revanced_hide_get_premium_summary_off", "YouTube Premium advertisement are shown")
StringResource(
"revanced_hide_get_premium_title",
"Hide YouTube Premium advertisement under video player"
),
StringResource(
"revanced_hide_get_premium_summary_on",
"YouTube Premium advertisement are hidden"
),
StringResource(
"revanced_hide_get_premium_summary_off",
"YouTube Premium advertisement are shown"
)
)
)