Skip to content

Commit

Permalink
fix: use shared screen for swipe controls
Browse files Browse the repository at this point in the history
  • Loading branch information
LisoUseInAIKyrios committed Feb 22, 2024
1 parent 40b2296 commit 902420d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
1 change: 1 addition & 0 deletions api/revanced-patches.api
Original file line number Diff line number Diff line change
Expand Up @@ -1625,6 +1625,7 @@ public final class app/revanced/patches/youtube/misc/settings/SettingsPatch$Pref
public final fun getMISC ()Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$Screen;
public final fun getSEEKBAR ()Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$Screen;
public final fun getSHORTS ()Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$Screen;
public final fun getSWIPE_CONTROLS ()Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$Screen;
public final fun getVIDEO ()Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$Screen;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.InputType
import app.revanced.patches.shared.misc.settings.preference.PreferenceScreen
import app.revanced.patches.shared.misc.settings.preference.PreferenceScreen.Sorting
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.shared.misc.settings.preference.TextPreference
import app.revanced.patches.youtube.misc.settings.SettingsPatch
import app.revanced.patches.youtube.misc.settings.SettingsResourcePatch
import app.revanced.util.ResourceGroup
import app.revanced.util.copyResources

Expand All @@ -21,22 +18,16 @@ internal object SwipeControlsResourcePatch : ResourcePatch() {
override fun execute(context: ResourceContext) {
AddResourcesPatch(this::class)

SettingsResourcePatch += PreferenceScreen(
key = "revanced_settings_screen_08",
titleKey = "revanced_swipe_controls_screen_title",
summaryKey = null,
sorting = Sorting.UNSORTED,
preferences = setOf(
SwitchPreference("revanced_swipe_brightness"),
SwitchPreference("revanced_swipe_volume"),
SwitchPreference("revanced_swipe_press_to_engage"),
SwitchPreference("revanced_swipe_haptic_feedback"),
SwitchPreference("revanced_swipe_save_and_restore_brightness"),
TextPreference("revanced_swipe_overlay_timeout", inputType = InputType.NUMBER),
TextPreference("revanced_swipe_text_overlay_size", inputType = InputType.NUMBER),
TextPreference("revanced_swipe_overlay_background_alpha", inputType = InputType.NUMBER),
TextPreference("revanced_swipe_threshold", inputType = InputType.NUMBER),
),
SettingsPatch.PreferenceScreen.SWIPE_CONTROLS.addPreferences(
SwitchPreference("revanced_swipe_brightness"),
SwitchPreference("revanced_swipe_volume"),
SwitchPreference("revanced_swipe_press_to_engage"),
SwitchPreference("revanced_swipe_haptic_feedback"),
SwitchPreference("revanced_swipe_save_and_restore_brightness"),
TextPreference("revanced_swipe_overlay_timeout", inputType = InputType.NUMBER),
TextPreference("revanced_swipe_text_overlay_size", inputType = InputType.NUMBER),
TextPreference("revanced_swipe_overlay_background_alpha", inputType = InputType.NUMBER),
TextPreference("revanced_swipe_threshold", inputType = InputType.NUMBER),
)

context.copyResources(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,13 @@ object SettingsPatch :
sorting = Sorting.UNSORTED,
)

// Swipe controls is item 8
val SWIPE_CONTROLS = Screen(
"revanced_settings_screen_08",
"revanced_swipe_controls_screen_title",
null,
sorting = Sorting.UNSORTED,
)

// RYD is item 9
// SB is item 10
val MISC = Screen("revanced_settings_screen_11", "revanced_misc_screen_title", null)
Expand Down

0 comments on commit 902420d

Please sign in to comment.