2023-02-19 23:54:29 +01:00
|
|
|
package app.revanced.patches.youtube.layout.hide.infocards.resource.patch
|
2022-11-08 00:11:12 +01:00
|
|
|
|
|
|
|
import app.revanced.patcher.data.ResourceContext
|
2023-08-27 04:26:14 +02:00
|
|
|
import app.revanced.patcher.patch.PatchResult
|
|
|
|
import app.revanced.patcher.patch.PatchResultSuccess
|
2022-11-08 00:11:12 +01:00
|
|
|
import app.revanced.patcher.patch.ResourcePatch
|
|
|
|
import app.revanced.patcher.patch.annotations.DependsOn
|
2022-11-25 00:05:54 +01:00
|
|
|
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
2022-11-28 20:13:34 +01:00
|
|
|
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
|
|
|
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
2023-02-19 23:54:29 +01:00
|
|
|
import app.revanced.patches.youtube.layout.hide.infocards.annotations.HideInfocardsCompatibility
|
|
|
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
2022-11-08 00:11:12 +01:00
|
|
|
|
|
|
|
@HideInfocardsCompatibility
|
2022-11-20 23:08:51 +01:00
|
|
|
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
2022-11-08 00:11:12 +01:00
|
|
|
class HideInfocardsResourcePatch : ResourcePatch {
|
|
|
|
internal companion object {
|
|
|
|
var drawerResourceId: Long = -1
|
|
|
|
}
|
|
|
|
|
2023-08-27 04:26:14 +02:00
|
|
|
override fun execute(context: ResourceContext): PatchResult {
|
2022-11-08 00:11:12 +01:00
|
|
|
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
|
|
|
SwitchPreference(
|
2023-05-25 08:10:16 +02:00
|
|
|
"revanced_hide_info_cards",
|
|
|
|
StringResource("revanced_hide_info_cards_title", "Hide info cards"),
|
|
|
|
StringResource("revanced_hide_info_cards_summary_on", "Info cards are hidden"),
|
|
|
|
StringResource("revanced_hide_info_cards_summary_off", "Info cards are shown")
|
2022-11-08 00:11:12 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2022-11-20 23:08:51 +01:00
|
|
|
drawerResourceId = ResourceMappingPatch.resourceMappings.single {
|
2022-11-08 00:11:12 +01:00
|
|
|
it.type == "id" && it.name == "info_cards_drawer_header"
|
|
|
|
}.id
|
2023-08-27 04:26:14 +02:00
|
|
|
|
|
|
|
return PatchResultSuccess()
|
2022-11-08 00:11:12 +01:00
|
|
|
}
|
|
|
|
}
|