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
@@ -26,25 +26,23 @@ class CopyVideoUrlResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
PreferenceScreen(
"revanced_copy_video_url",
StringResource("revanced_copy_video_url_title", "Copy video URL settings"),
"revanced_copy_video_url_preference_screen",
StringResource("revanced_copy_video_url_preference_screen_title", "Copy video URL settings"),
listOf(
SwitchPreference(
"revanced_copy_video_url_enabled",
StringResource("revanced_copy_video_url_enabled_title", "Show copy video URL button"),
true,
StringResource("revanced_copy_video_url_enabled_summary_on", "Button is shown, click to copy video URL without timestamp"),
StringResource("revanced_copy_video_url_enabled_summary_off", "Button is not shown")
"revanced_copy_video_url",
StringResource("revanced_copy_video_url_title", "Show copy video URL button"),
StringResource("revanced_copy_video_url_summary_on", "Button is shown, click to copy video URL without timestamp"),
StringResource("revanced_copy_video_url_summary_off", "Button is not shown")
),
SwitchPreference(
"revanced_copy_video_url_timestamp_enabled",
StringResource("revanced_copy_video_url_timestamp_enabled_title", "Show copy timestamp URL button"),
true,
StringResource("revanced_copy_video_url_timestamp_enabled_summary_on", "Button is shown, click to copy video URL with timestamp"),
StringResource("revanced_copy_video_url_timestamp_enabled_summary_off", "Button is not shown")
"revanced_copy_video_url_timestamp",
StringResource("revanced_copy_video_url_timestamp_title", "Show copy timestamp URL button"),
StringResource("revanced_copy_video_url_timestamp_summary_on", "Button is shown, click to copy video URL with timestamp"),
StringResource("revanced_copy_video_url_timestamp_summary_off", "Button is not shown")
)
),
StringResource("revanced_copy_video_url_summary", "Settings related to copy URL buttons in video player")
StringResource("revanced_copy_video_url_preference_screen_summary", "Settings related to copy URL buttons in video player")
)
)
@@ -25,25 +25,23 @@ class DownloadsResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
PreferenceScreen(
"revanced_downloads",
StringResource("revanced_downloads_title", "Download settings"),
"revanced_external_downloader_preference_screen",
StringResource("revanced_external_downloader_preference_screen_title", "Download settings"),
listOf(
SwitchPreference(
"revanced_downloads_enabled",
StringResource("revanced_downloads_enabled_title", "Show download button"),
true,
StringResource("revanced_downloads_enabled_summary_on", "Download button is shown"),
StringResource("revanced_downloads_enabled_summary_off", "Download button is not shown")
"revanced_external_downloader",
StringResource("revanced_external_downloader_title", "Show download button"),
StringResource("revanced_external_downloader_summary_on", "Download button is shown"),
StringResource("revanced_external_downloader_summary_off", "Download button is not shown")
),
TextPreference(
"revanced_downloads_package_name",
StringResource("revanced_downloads_package_name_title", "Downloader package name"),
InputType.STRING,
"org.schabi.newpipe" /* NewPipe */,
StringResource("revanced_downloads_package_name_summary", "Package name of the downloader app such as NewPipe\\'s or PowerTube\\'s")
"revanced_external_downloader_name",
StringResource("revanced_external_downloader_name_title", "Downloader package name"),
StringResource("revanced_external_downloader_name_summary", "Package name of the downloader app such as NewPipe\\'s or PowerTube\\'s"),
InputType.TEXT
)
),
StringResource("revanced_downloads_summary", "Settings related to downloads")
StringResource("revanced_external_downloader_preference_screen_summary", "Settings related to downloads")
)
)
@@ -38,11 +38,10 @@ class EnableSeekbarTappingPatch : BytecodePatch(
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
SwitchPreference(
"revanced_enable_tap_seeking",
StringResource("revanced_seekbar_tapping_enabled_title", "Enable seekbar tapping"),
true,
StringResource("revanced_seekbar_tapping_summary_on", "Seekbar tapping is enabled"),
StringResource("revanced_seekbar_tapping_summary_off", "Seekbar tapping is disabled")
"revanced_tap_seeking",
StringResource("revanced_tap_seeking_title", "Enable seekbar tapping"),
StringResource("revanced_tap_seeking_summary_on", "Seekbar tapping is enabled"),
StringResource("revanced_tap_seeking_summary_off", "Seekbar tapping is disabled")
)
)
@@ -25,74 +25,68 @@ class SwipeControlsResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
PreferenceScreen(
"revanced_swipe_controls", StringResource("revanced_swipe_controls_title", "Swipe controls"), listOf(
"revanced_swipe_controls_preference_screen",
StringResource("revanced_swipe_controls_preference_screen_title", "Swipe controls"),
listOf(
SwitchPreference(
"revanced_enable_swipe_brightness",
StringResource("revanced_swipe_brightness_enabled_title", "Enable brightness gesture"),
true,
"revanced_swipe_brightness",
StringResource("revanced_swipe_brightness_title", "Enable brightness gesture"),
StringResource("revanced_swipe_brightness_summary_on", "Brightness swipe is enabled"),
StringResource("revanced_swipe_brightness_summary_off", "Brightness swipe is disabled")
),
SwitchPreference(
"revanced_enable_swipe_volume",
StringResource("revanced_swipe_volume_enabled_title", "Enable volume gesture"),
true,
"revanced_swipe_volume",
StringResource("revanced_swipe_volume_title", "Enable volume gesture"),
StringResource("revanced_swipe_volume_summary_on", "Volume swipe is enabled"),
StringResource("revanced_swipe_volume_summary_off", "Volume swipe is disabled")
),
SwitchPreference(
"revanced_enable_press_to_swipe",
StringResource("revanced_press_to_swipe_enabled_title", "Enable press-to-swipe gesture"),
false,
StringResource("revanced_press_to_swipe_summary_on", "Press-to-swipe is enabled"),
StringResource("revanced_press_to_swipe_summary_off", "Press-to-swipe is disabled")
"revanced_swipe_press_to_engage",
StringResource("revanced_swipe_press_to_engage_title", "Enable press-to-swipe gesture"),
StringResource("revanced_swipe_press_to_engage_summary_on", "Press-to-swipe is enabled"),
StringResource("revanced_swipe_press_to_engage_summary_off", "Press-to-swipe is disabled")
),
SwitchPreference(
"revanced_enable_swipe_haptic_feedback",
StringResource("revanced_swipe_haptic_feedback_enabled_title", "Enable haptic feedback"),
true,
"revanced_swipe_haptic_feedback",
StringResource("revanced_swipe_haptic_feedback_title", "Enable haptic feedback"),
StringResource("revanced_swipe_haptic_feedback_summary_on", "Haptic feedback is enabled"),
StringResource("revanced_swipe_haptic_feedback_summary_off", "Haptic feedback is disabled")
),
TextPreference(
"revanced_swipe_overlay_timeout",
StringResource("revanced_swipe_overlay_timeout_title", "Swipe overlay timeout"),
InputType.NUMBER,
"500",
StringResource(
"revanced_swipe_overlay_timeout_summary",
"The amount of milliseconds the overlay is visible"
)
),
InputType.NUMBER
),
TextPreference(
"revanced_swipe_overlay_text_size",
StringResource("revanced_swipe_overlay_text_size_title", "Swipe overlay text size"),
InputType.NUMBER,
"22",
StringResource("revanced_swipe_overlay_text_size_summary", "The text size for swipe overlay")
"revanced_swipe_text_overlay_size",
StringResource("revanced_swipe_text_overlay_size_title", "Swipe overlay text size"),
StringResource("revanced_swipe_text_overlay_size_summary", "The text size for swipe overlay"),
InputType.NUMBER
),
TextPreference(
"revanced_swipe_overlay_background_alpha",
StringResource("revanced_swipe_overlay_background_alpha_title", "Swipe background visibility"),
InputType.NUMBER,
"127",
StringResource(
"revanced_swipe_overlay_background_alpha_summary",
"The visibility of swipe overlay background"
)
),
InputType.NUMBER
),
TextPreference(
"revanced_swipe_magnitude_threshold",
StringResource("revanced_swipe_magnitude_threshold_title", "Swipe magnitude threshold"),
InputType.NUMBER,
"30",
"revanced_swipe_threshold",
StringResource("revanced_swipe_threshold_title", "Swipe magnitude threshold"),
StringResource(
"revanced_swipe_magnitude_threshold_summary",
"revanced_swipe_threshold_summary",
"The amount of threshold for swipe to occur"
)
),
InputType.NUMBER
)
),
StringResource("revanced_swipe_controls_summary","Control volume and brightness")
StringResource("revanced_swipe_controls_preference_screen_summary","Control volume and brightness")
)
)