fix: add missing switch for tablet-mini-player patch

This commit is contained in:
oSumAtrIX 2022-08-22 03:58:04 +02:00
parent 5fe0e263b4
commit 244a1b2cb9
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4

View file

@ -19,10 +19,13 @@ import app.revanced.patches.youtube.layout.tabletminiplayer.fingerprints.MiniPla
import app.revanced.patches.youtube.layout.tabletminiplayer.fingerprints.MiniPlayerOverrideNoContextFingerprint
import app.revanced.patches.youtube.layout.tabletminiplayer.fingerprints.MiniPlayerResponseModelSizeCheckFingerprint
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Patch
@DependsOn([IntegrationsPatch::class])
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
@Name("tablet-mini-player")
@Description("Enables the tablet mini player layout.")
@TabletMiniPlayerCompatibility
@ -34,6 +37,14 @@ class TabletMiniPlayerPatch : BytecodePatch(
)
) {
override fun execute(data: BytecodeData): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(SwitchPreference(
"revanced_tablet_miniplayer",
StringResource("revanced_tablet_miniplayer_title", "Remove general ads"),
false,
StringResource("revanced_tablet_miniplayer_summary_on", "Tablet Mini-player is enabled"),
StringResource("revanced_tablet_miniplayer_summary_off", "Tablet Mini-player is disabled")
))
// first resolve the fingerprints via the parent fingerprint
val miniPlayerClass = MiniPlayerDimensionsCalculatorFingerprint.result!!.classDef