feat(youtube): import / export of revanced settings (#2077)

Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
LisoUseInAIKyrios
2023-05-15 11:51:43 +04:00
committed by GitHub
co-authored by oSumAtrIX
parent 0555cdc54f
commit 5ff3215132
79 changed files with 437 additions and 572 deletions
@@ -50,7 +50,6 @@ class AudioAdsPatch : BytecodePatch(
"revanced_block_audio_ads",
"Block audio ads"
),
true,
StringResource(
"revanced_block_audio_ads_on",
"Audio ads are blocked"
@@ -59,6 +58,7 @@ class AudioAdsPatch : BytecodePatch(
"revanced_block_audio_ads_off",
"Audio ads are unblocked"
),
default = true,
)
)
@@ -66,7 +66,7 @@ class EmbeddedAdsPatch : BytecodePatch(
StringResource("key_revanced_proxy_purpleadblock", "purpleadblock")
)
),
"ttv-lol"
default = "ttv-lol"
)
)
@@ -132,7 +132,6 @@ class VideoAdsPatch : AbstractAdPatch(
"revanced_block_video_ads",
"Block video ads"
),
true,
StringResource(
"revanced_block_video_ads_on",
"Video ads are blocked"
@@ -141,6 +140,7 @@ class VideoAdsPatch : AbstractAdPatch(
"revanced_block_video_ads_off",
"Video ads are unblocked"
),
default = true
)
)
@@ -98,7 +98,7 @@ class ShowDeletedMessagesPatch : BytecodePatch(
StringResource("key_revanced_deleted_messages_cross_out", "cross-out")
)
),
"cross-out"
default = "cross-out"
)
)
@@ -36,7 +36,6 @@ class AutoClaimChannelPointPatch : BytecodePatch(
"revanced_auto_claim_channel_points",
"Automatically claim Channel Points"
),
true,
StringResource(
"revanced_auto_claim_channel_points_on",
"Channel Points are claimed automatically"
@@ -45,6 +44,7 @@ class AutoClaimChannelPointPatch : BytecodePatch(
"revanced_auto_claim_channel_points_off",
"Channel Points are not claimed automatically"
),
default = true
)
)
@@ -59,7 +59,6 @@ class DebugModePatch : BytecodePatch(
"revanced_debug_mode_enable",
"Enable debug mode"
),
false,
StringResource(
"revanced_debug_mode_on",
"Debug mode is enabled (not recommended)"
@@ -68,6 +67,7 @@ class DebugModePatch : BytecodePatch(
"revanced_debug_mode_off",
"Debug mode is disabled"
),
default = false,
)
)
@@ -20,7 +20,6 @@ import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.util.AbstractPreferenceScreen
import app.revanced.patches.twitch.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.twitch.misc.settings.annotations.SettingsCompatibility
import app.revanced.patches.twitch.misc.settings.components.CustomPreferenceCategory
import app.revanced.patches.twitch.misc.settings.fingerprints.MenuGroupsOnClickFingerprint
import app.revanced.patches.twitch.misc.settings.fingerprints.MenuGroupsUpdatedFingerprint
import app.revanced.patches.twitch.misc.settings.fingerprints.SettingsActivityOnCreateFingerprint
@@ -183,10 +182,11 @@ class SettingsPatch : BytecodePatch(
internal inner class CustomCategory(key: String, title: String) : Screen.Category(key, title) {
/* For Twitch, we need to load our CustomPreferenceCategory class instead of the default one. */
override fun transform(): PreferenceCategory {
return CustomPreferenceCategory(
return PreferenceCategory(
key,
StringResource("${key}_title", title),
preferences.sortedBy { it.title.value }
preferences.sortedBy { it.title.value },
"app.revanced.twitch.settingsmenu.preference.CustomPreferenceCategory"
)
}
}
@@ -1,20 +0,0 @@
package app.revanced.patches.twitch.misc.settings.components
import app.revanced.patches.shared.settings.preference.BasePreference
import app.revanced.patches.shared.settings.preference.impl.PreferenceCategory
import app.revanced.patches.shared.settings.preference.impl.StringResource
/**
* Customized preference category for Twitch.
*
* @param key The key of the preference.
* @param title The title of the preference.
* @param preferences Child preferences of this category.
*/
internal open class CustomPreferenceCategory(
key: String,
title: StringResource,
preferences: List<BasePreference>
) : PreferenceCategory(key, title, preferences) {
override val tag: String = "app.revanced.twitch.settingsmenu.preference.CustomPreferenceCategory"
}