Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(YouTube): Reorganize settings menu #2737

Merged
merged 54 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
ed6ac39
feat(YouTube): Reorganize settings menu
LisoUseInAIKyrios Feb 17, 2024
9a43676
fix: no longer need to kludge the separators when they no longer exist
LisoUseInAIKyrios Feb 17, 2024
b94d2d7
fix: separator color for non dark mode
LisoUseInAIKyrios Feb 18, 2024
250ff1a
fix: Do not show separator on the toolbar
LisoUseInAIKyrios Feb 18, 2024
7ac26a4
fix: Move to seekbar submenu, since it's the time of the seekbar and …
LisoUseInAIKyrios Feb 18, 2024
c87de35
fix: Move to feed layout
LisoUseInAIKyrios Feb 18, 2024
c5213d3
fix: Move to Video menu
LisoUseInAIKyrios Feb 18, 2024
baec159
fix: Move to Other layout
LisoUseInAIKyrios Feb 18, 2024
fe12893
refactor: Use preference key to indicate the sorting style for Integr…
LisoUseInAIKyrios Feb 18, 2024
1897128
refactor: move Alternative Thumbnails and SwipeControls to top level …
LisoUseInAIKyrios Feb 18, 2024
77ed62f
refactor: move copy url buttons into Player layout
LisoUseInAIKyrios Feb 18, 2024
36db1ea
fix: remove duplicate method calls
LisoUseInAIKyrios Feb 18, 2024
7911184
fix: It's now more clear this is for the video player
LisoUseInAIKyrios Feb 18, 2024
6367698
fix: delete empty class file
LisoUseInAIKyrios Feb 18, 2024
24c2a15
fix: It's now more clear this is for the video player
LisoUseInAIKyrios Feb 18, 2024
788da27
fix: move to sub menu
LisoUseInAIKyrios Feb 18, 2024
8ec15d9
fix: More consistent sub menu names
LisoUseInAIKyrios Feb 18, 2024
9f1b728
fix: More concise
LisoUseInAIKyrios Feb 18, 2024
a67fad8
fix: More concise
LisoUseInAIKyrios Feb 18, 2024
e8b7931
fix: More concise title
LisoUseInAIKyrios Feb 18, 2024
aa64cf9
fix: More concise and consistent sub menu text
LisoUseInAIKyrios Feb 18, 2024
aa3ab7f
no functional changes: fix warnings and code formatting
LisoUseInAIKyrios Feb 18, 2024
cb9048a
refactor: organize strings, use consistent preference screen key nami…
LisoUseInAIKyrios Feb 18, 2024
ed9f04b
refactor: Can be more concise and remove 'menu' from the titles, as '…
LisoUseInAIKyrios Feb 18, 2024
2470510
refactor: Can remove 'button' from the titles of the button submenus,…
LisoUseInAIKyrios Feb 18, 2024
577f53f
fix: remove non functional `hide live chat button` (live chat is no l…
LisoUseInAIKyrios Feb 18, 2024
fe44954
fix: for now use unsorted for seekbar menu, to fix the ordering of cu…
LisoUseInAIKyrios Feb 18, 2024
7a63a37
fix: use no sorting for Shorts menu so ordering works better
LisoUseInAIKyrios Feb 18, 2024
3466873
fix: fix typo
LisoUseInAIKyrios Feb 19, 2024
ce548d2
fix: `Other layout` -> `General layout`
LisoUseInAIKyrios Feb 20, 2024
263b763
build: Sign release artifacts
oSumAtrIX Feb 15, 2024
f61ca95
build: Publish to GitHub Packages
oSumAtrIX Feb 15, 2024
f2e154f
fix: Compile DEX without debugging information
oSumAtrIX Feb 21, 2024
0ff33b0
chore(release): 4.3.0-dev.4 [skip ci]
semantic-release-bot Feb 21, 2024
2c79ebe
Merge branch 'dev' into fork/feat_reorganize_settings
oSumAtrIX Feb 21, 2024
fa5cedc
chore(release): 4.3.0-dev.4 [skip ci]
semantic-release-bot Feb 21, 2024
75f1646
feat(X): Add `Open links as query` patch (#2730)
dic1911 Feb 21, 2024
b9525f8
chore(release): 4.3.0-dev.4 [skip ci]
semantic-release-bot Feb 21, 2024
a83182b
Merge remote-tracking branch 'upstream/dev' into feat_reorganize_sett…
LisoUseInAIKyrios Feb 21, 2024
222263b
fix: more consistent and concise title
LisoUseInAIKyrios Feb 21, 2024
0af218f
Merge branch 'dev' into fork/feat_reorganize_settings
oSumAtrIX Feb 22, 2024
5f11be1
refactor: Rename and refactor
oSumAtrIX Feb 22, 2024
b0594e9
fix: Use shared screen for Alternative thumbnails
LisoUseInAIKyrios Feb 22, 2024
f08b657
Comments
LisoUseInAIKyrios Feb 22, 2024
7d6cf35
Comments
LisoUseInAIKyrios Feb 22, 2024
40b2296
fix: move to General layout
LisoUseInAIKyrios Feb 22, 2024
902420d
fix: use shared screen for swipe controls
LisoUseInAIKyrios Feb 22, 2024
2013d9e
comments
LisoUseInAIKyrios Feb 22, 2024
5074709
fix: change sorting parameter to non-null
LisoUseInAIKyrios Feb 22, 2024
c96d0e9
refactor: cleanup key names
LisoUseInAIKyrios Feb 22, 2024
dd0541c
comments
LisoUseInAIKyrios Feb 22, 2024
e2faca7
move gray separator to general
oSumAtrIX Feb 23, 2024
13f7c77
Feed layout -> Feed
LisoUseInAIKyrios Feb 25, 2024
7e46014
Merge branch 'dev' into fork/feat_reorganize_settings
oSumAtrIX Mar 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions api/revanced-patches.api
Original file line number Diff line number Diff line change
Expand Up @@ -723,10 +723,8 @@ public abstract class app/revanced/patches/shared/misc/settings/preference/BaseP
}

public class app/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$Screen : app/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$BasePreferenceCollection {
public fun <init> (Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;Ljava/util/Set;)V
public synthetic fun <init> (Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen;Ljava/lang/String;Ljava/util/Set;Ljava/util/Set;)V
public synthetic fun <init> (Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen;Ljava/lang/String;Ljava/util/Set;Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;Ljava/util/Set;Lapp/revanced/patches/shared/misc/settings/preference/PreferenceScreen$Sorting;)V
public synthetic fun <init> (Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;Ljava/util/Set;Lapp/revanced/patches/shared/misc/settings/preference/PreferenceScreen$Sorting;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun addPreferences ([Lapp/revanced/patches/shared/misc/settings/preference/BasePreference;)V
public final fun getCategories ()Ljava/util/Set;
public synthetic fun transform ()Lapp/revanced/patches/shared/misc/settings/preference/BasePreference;
Expand Down Expand Up @@ -798,12 +796,22 @@ public class app/revanced/patches/shared/misc/settings/preference/PreferenceCate
}

public class app/revanced/patches/shared/misc/settings/preference/PreferenceScreen : app/revanced/patches/shared/misc/settings/preference/BasePreference {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lapp/revanced/patches/shared/misc/settings/preference/PreferenceScreen$Sorting;Ljava/lang/String;Ljava/util/Set;)V
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lapp/revanced/patches/shared/misc/settings/preference/PreferenceScreen$Sorting;Ljava/lang/String;Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getPreferences ()Ljava/util/Set;
public fun serialize (Lorg/w3c/dom/Document;Lkotlin/jvm/functions/Function1;)Lorg/w3c/dom/Element;
}

public final class app/revanced/patches/shared/misc/settings/preference/PreferenceScreen$Sorting : java/lang/Enum {
public static final field BY_KEY Lapp/revanced/patches/shared/misc/settings/preference/PreferenceScreen$Sorting;
public static final field BY_TITLE Lapp/revanced/patches/shared/misc/settings/preference/PreferenceScreen$Sorting;
public static final field UNSORTED Lapp/revanced/patches/shared/misc/settings/preference/PreferenceScreen$Sorting;
public static fun getEntries ()Lkotlin/enums/EnumEntries;
public final fun getKeySuffix ()Ljava/lang/String;
public static fun valueOf (Ljava/lang/String;)Lapp/revanced/patches/shared/misc/settings/preference/PreferenceScreen$Sorting;
public static fun values ()[Lapp/revanced/patches/shared/misc/settings/preference/PreferenceScreen$Sorting;
}

public final class app/revanced/patches/shared/misc/settings/preference/SummaryType : java/lang/Enum {
public static final field DEFAULT Lapp/revanced/patches/shared/misc/settings/preference/SummaryType;
public static final field OFF Lapp/revanced/patches/shared/misc/settings/preference/SummaryType;
Expand Down Expand Up @@ -1468,7 +1476,6 @@ public final class app/revanced/patches/youtube/layout/tabletminiplayer/TabletMi
public static final field INSTANCE Lapp/revanced/patches/youtube/layout/tabletminiplayer/TabletMiniPlayerPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
public final fun unwrap (Lapp/revanced/patcher/fingerprint/MethodFingerprint;)Lkotlin/Triple;
}

public final class app/revanced/patches/youtube/layout/theme/ThemeBytecodePatch : app/revanced/patcher/patch/BytecodePatch {
Expand Down Expand Up @@ -1617,9 +1624,14 @@ public final class app/revanced/patches/youtube/misc/settings/SettingsPatch$Pref
public static final field INSTANCE Lapp/revanced/patches/youtube/misc/settings/SettingsPatch$PreferenceScreen;
public fun commit (Lapp/revanced/patches/shared/misc/settings/preference/PreferenceScreen;)V
public final fun getADS ()Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$Screen;
public final fun getINTERACTIONS ()Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$Screen;
public final fun getLAYOUT ()Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$Screen;
public final fun getALTERNATIVE_THUMBNAILS ()Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$Screen;
public final fun getFEED ()Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$Screen;
public final fun getGENERAL_LAYOUT ()Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$Screen;
public final fun getMISC ()Lapp/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen$Screen;
public final fun getPLAYER ()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 @@ -7,7 +7,7 @@ import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.reddit.ad.comments.fingerprints.HideCommentAdsFingerprint

@Patch(description = "Removes ads in the comments.",)
@Patch(description = "Removes ads in the comments.")
object HideCommentAdsPatch : BytecodePatch(
setOf(HideCommentAdsFingerprint)
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,13 @@ import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.reddit.customclients.syncforreddit.detection.piracy.fingerprints.PiracyDetectionFingerprint

@Patch(description = "Disables detection of modified versions.",)
@Patch(description = "Disables detection of modified versions.")
object DisablePiracyDetectionPatch : BytecodePatch(setOf(PiracyDetectionFingerprint)) {
override fun execute(context: BytecodeContext) {
// Do not throw an error if the fingerprint is not resolved.
// This is fine because new versions of the target app do not need this patch.
PiracyDetectionFingerprint.result?.mutableMethod?.apply {
addInstruction(
0,
"""
return-void
"""
)
addInstruction(0, "return-void")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,26 @@ abstract class BaseSettingsResourcePatch(
}

override fun close() {
fun Node.addPreference(preference: BasePreference) {
fun Node.addPreference(preference: BasePreference, prepend: Boolean = false) {
preference.serialize(ownerDocument) { resource ->
// TODO: Currently, resources can only be added to "values", which may not be the correct place.
// It may be necessary to ask for the desired resourceValue in the future.
AddResourcesPatch("values", resource)
}.let(this::appendChild)
}.let { preferenceNode ->
if (prepend && firstChild != null) {
insertBefore(preferenceNode, firstChild)
} else {
appendChild(preferenceNode)
}
}
}

// Add the root preference to an existing fragment if needed.
rootPreference?.let { (intentPreference, fragment) ->
context.xmlEditor["res/xml/$fragment.xml"].use { editor ->
val document = editor.file

document.getNode("PreferenceScreen").addPreference(intentPreference)
document.getNode("PreferenceScreen").addPreference(intentPreference, true)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package app.revanced.patches.shared.misc.settings.preference

import app.revanced.patches.shared.misc.settings.preference.PreferenceScreen.Sorting
import java.io.Closeable

abstract class BasePreferenceScreen(
private val root: MutableSet<Screen> = mutableSetOf()
private val root: MutableSet<Screen> = mutableSetOf(),
) : Closeable {

override fun close() {
Expand All @@ -24,33 +25,27 @@ abstract class BasePreferenceScreen(
titleKey: String = "${key}_title",
private val summaryKey: String? = "${key}_summary",
preferences: MutableSet<BasePreference> = mutableSetOf(),
val categories: MutableSet<Category> = mutableSetOf()
val categories: MutableSet<Category> = mutableSetOf(),
private val sorting: Sorting = Sorting.BY_TITLE,
) : BasePreferenceCollection(key, titleKey, preferences) {

/**
* Initialize using title and summary keys with suffix "_title" and "_summary".
*/
constructor(
key: String? = null,
preferences: MutableSet<BasePreference> = mutableSetOf(),
categories: MutableSet<Category> = mutableSetOf()
) : this(key, key + "_title", key + "_summary", preferences, categories)

override fun transform(): PreferenceScreen {
return PreferenceScreen(
key,
titleKey,
summaryKey,
sorting,
// Screens and preferences are sorted at runtime by integrations code,
// so they appear in alphabetical order for the localized language in use.
preferences = preferences + categories.map { it.transform() }
// so title sorting uses the localized language in use.
preferences = preferences + categories.map { it.transform() },
)
}

private fun ensureScreenInserted() {
// Add to screens if not yet done
if (!root.contains(this))
if (!root.contains(this)) {
root.add(this)
}
}

fun addPreferences(vararg preferences: BasePreference) {
Expand All @@ -61,22 +56,23 @@ abstract class BasePreferenceScreen(
open inner class Category(
key: String? = null,
titleKey: String = "${key}_title",
preferences: MutableSet<BasePreference> = mutableSetOf()
preferences: MutableSet<BasePreference> = mutableSetOf(),
) : BasePreferenceCollection(key, titleKey, preferences) {
override fun transform(): PreferenceCategory {
return PreferenceCategory(
key,
titleKey,
preferences = preferences
preferences = preferences,
)
}

fun addPreferences(vararg preferences: BasePreference) {
ensureScreenInserted()

// Add to the categories if not done yet.
if (!categories.contains(this))
if (!categories.contains(this)) {
categories.add(this)
}

this.preferences.addAll(preferences)
}
Expand All @@ -86,8 +82,8 @@ abstract class BasePreferenceScreen(
abstract class BasePreferenceCollection(
val key: String? = null,
val titleKey: String = "${key}_title",
val preferences: MutableSet<BasePreference> = mutableSetOf()
val preferences: MutableSet<BasePreference> = mutableSetOf(),
) {
abstract fun transform(): BasePreference
}
}
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
package app.revanced.patches.shared.misc.settings.preference

import app.revanced.patches.shared.misc.settings.preference.IntentPreference.Intent
import app.revanced.util.resource.BaseResource
import org.w3c.dom.Document

/**
* A preference that opens an intent.
*
* @param key The preference key. If null, other parameters must be specified.
* @param key Optional preference key.
* @param titleKey The preference title key.
* @param summaryKey The preference summary key.
* @param tag The preference tag.
* @param intent The intent to open.
*
* @see Intent
*/
class IntentPreference(
key: String? = null,
titleKey: String = "${key}_title",
summaryKey: String? = "${key}_summary",
tag: String = "Preference",
val intent: Intent,
) : BasePreference(null, titleKey, summaryKey, tag) {
) : BasePreference(key, titleKey, summaryKey, tag) {

override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ import org.w3c.dom.Document
/**
* A non-interactive preference.
*
* Typically used to present static text, but also used for custom integration code that responds to taps.
*
* @param key The preference key.
* @param summaryKey The preference summary key.
* @param tag The preference tag.
* @param selectable Whether the preference is selectable.
* @param tag The tag or full class name of the preference.
* @param selectable If the preference is selectable and responds to tap events.
*/
@Suppress("MemberVisibilityCanBePrivate")
class NonInteractivePreference(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import org.w3c.dom.Document
* @param key The key of the preference. If null, other parameters must be specified.
* @param titleKey The key of the preference title.
* @param summaryKey The key of the preference summary.
* @param sorting Sorting to use. If the sorting is not [Sorting.UNSORTED],
* then the key parameter will be modified to include the sort type.
* @param tag The tag or full class name of the preference.
* @param preferences The preferences in this screen.
*/
Expand All @@ -17,14 +19,40 @@ open class PreferenceScreen(
key: String? = null,
titleKey: String = "${key}_title",
summaryKey: String? = "${key}_summary",
sorting: Sorting = Sorting.BY_TITLE,
tag: String = "PreferenceScreen",
val preferences: Set<BasePreference>
) : BasePreference(key, titleKey, summaryKey, tag) {

val preferences: Set<BasePreference>,
// Alternatively, instead of repurposing the key for sorting,
// an extra bundle parameter can be added to the preferences XML declaration.
// This would require bundling and referencing an additional XML file
// or adding new attributes to the attrs.xml file.
// Since the key value is not currently used by integrations,
// for now it's much simpler to modify the key to include the sort parameter.
) : BasePreference(if (sorting == Sorting.UNSORTED) key else (key + sorting.keySuffix), titleKey, summaryKey, tag) {
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit) =
super.serialize(ownerDocument, resourceCallback).apply {
preferences.forEach {
appendChild(it.serialize(ownerDocument, resourceCallback))
}
}

/**
* How a PreferenceScreen should be sorted.
*/
enum class Sorting(val keySuffix: String) {
/**
* Sort by the localized preference title.
*/
BY_TITLE("_sort_by_title"),

/**
* Sort by the preference keys.
*/
BY_KEY("_sort_by_key"),

/**
* Unspecified sorting.
*/
UNSORTED("_sort_by_unsorted"),
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ object AudioAdsPatch : BytecodePatch(
override fun execute(context: BytecodeContext) {
AddResourcesPatch(this::class)

SettingsPatch.PreferenceScreen.ADS.CLIENT_SIDE.addPreferences(SwitchPreference("revanced_block_audio_ads"))
SettingsPatch.PreferenceScreen.ADS.CLIENT_SIDE.addPreferences(
SwitchPreference("revanced_block_audio_ads")
)

// Block playAds call
with(AudioAdsPresenterPlayFingerprint.result!!) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ object VideoAdsPatch : BaseAdPatch(
override fun execute(context: BytecodeContext) {
AddResourcesPatch(this::class)

SettingsPatch.PreferenceScreen.ADS.CLIENT_SIDE.addPreferences(SwitchPreference("revanced_block_video_ads"))
SettingsPatch.PreferenceScreen.ADS.CLIENT_SIDE.addPreferences(
SwitchPreference("revanced_block_video_ads")
)

/* Amazon ads SDK */
context.blockMethods(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ object DebugModePatch : BytecodePatch(
override fun execute(context: BytecodeContext) {
AddResourcesPatch(this::class)

SettingsPatch.PreferenceScreen.MISC.OTHER.addPreferences(SwitchPreference("revanced_twitch_debug_mode"))
SettingsPatch.PreferenceScreen.MISC.OTHER.addPreferences(
SwitchPreference("revanced_twitch_debug_mode")
)

listOf(
IsDebugConfigEnabledFingerprint,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.immutable.ImmutableField
import java.io.Closeable


@Patch(
name = "Settings",
description = "Adds settings menu to Twitch.",
Expand Down Expand Up @@ -62,7 +61,9 @@ object SettingsPatch : BytecodePatch(
override fun execute(context: BytecodeContext) {
AddResourcesPatch(this::class)

PreferenceScreen.MISC.OTHER.addPreferences(SwitchPreference("revanced_debug"))
PreferenceScreen.MISC.OTHER.addPreferences(
SwitchPreference("revanced_debug")
)

// Hook onCreate to handle fragment creation
SettingsActivityOnCreateFingerprint.result?.apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.misc.litho.filter.LithoFilterPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch.PreferenceScreen

@Patch(
dependencies = [
Expand All @@ -27,7 +26,7 @@ object HideAdsResourcePatch : ResourcePatch() {
override fun execute(context: ResourceContext) {
AddResourcesPatch(this::class)

PreferenceScreen.ADS.addPreferences(
SettingsPatch.PreferenceScreen.ADS.addPreferences(
SwitchPreference("revanced_hide_general_ads"),
SwitchPreference("revanced_hide_fullscreen_ads"),
SwitchPreference("revanced_hide_buttoned_ads"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ object HideGetPremiumPatch : BytecodePatch(setOf(GetPremiumViewFingerprint)) {
override fun execute(context: BytecodeContext) {
AddResourcesPatch(this::class)

SettingsPatch.PreferenceScreen.ADS.addPreferences(SwitchPreference("revanced_hide_get_premium"))
SettingsPatch.PreferenceScreen.ADS.addPreferences(
SwitchPreference("revanced_hide_get_premium")
)

GetPremiumViewFingerprint.result?.let {
it.mutableMethod.apply {
Expand Down
Loading
Loading