From 0533e6c63e8da02f0b2b4df9652450c178255215 Mon Sep 17 00:00:00 2001 From: Tim Schneeberger Date: Fri, 25 Nov 2022 00:05:54 +0100 Subject: [PATCH] refactor: abstract settings patch away from YouTube (#1103) Co-authored-by: oSumAtrIX --- .../WatchWhileActivityFingerprint.kt | 2 +- .../patch/AbstractIntegrationsPatch.kt} | 3 +- .../{ => misc}/patch/ResourceMappingPatch.kt | 2 +- .../patches/shared/settings/BasePreference.kt | 31 +++++ .../patches/shared/settings/BaseResource.kt | 26 ++++ .../shared/settings/ComponentsExtensions.kt | 42 ++++++ .../settings}/IPreference.kt | 4 +- .../patches/shared/settings/IResource.kt | 16 +++ .../patches/shared/settings/SummaryType.kt | 5 + .../shared/settings/impl/ArrayResource.kt | 31 +++++ .../settings}/impl/InputType.kt | 2 +- .../shared/settings/impl/ListPreference.kt | 38 ++++++ .../shared/settings/impl/Preference.kt | 44 +++++++ .../settings/impl/PreferenceCategory.kt | 29 +++++ .../shared/settings/impl/PreferenceScreen.kt | 34 +++++ .../shared/settings/impl/StringResource.kt | 31 +++++ .../shared/settings/impl/SwitchPreference.kt | 35 +++++ .../shared/settings/impl/TextPreference.kt | 35 +++++ .../patch/PremiumNavbarTabPatch.kt | 2 +- .../fingerprints/InitFingerprint.kt | 2 +- .../patch/TikTokIntegrationsPatch.kt | 2 +- .../fingerprints/InitFingerprint.kt | 2 +- .../integrations/patch/IntegrationsPatch.kt | 2 +- .../general/bytecode/patch/GeneralAdsPatch.kt | 1 - .../resource/patch/GeneralAdsResourcePatch.kt | 9 +- .../youtube/ad/video/patch/VideoAdsPatch.kt | 4 +- .../resource/patch/DownloadsResourcePatch.kt | 5 +- .../patch/EnableSeekbarTappingPatch.kt | 4 +- .../bytecode/SwipeControlsBytecodePatch.kt | 2 +- .../resource/SwipeControlsResourcePatch.kt | 6 +- .../autocaptions/patch/AutoCaptionsPatch.kt | 4 +- .../patch/HideAutoplayButtonPatch.kt | 6 +- .../layout/buttons/patch/HideButtonsPatch.kt | 8 +- .../castbutton/patch/HideCastButtonPatch.kt | 4 +- .../resource/patch/CommentsResourcePatch.kt | 8 +- .../patch/FullscreenPanelsRemoverPatch.kt | 4 +- .../resource/patch/AlbumCardsResourcePatch.kt | 6 +- .../patch/HideArtistCardPatch.kt | 6 +- .../patch/HideCaptionsButtonPatch.kt | 4 +- .../patch/CrowdfundingBoxResourcePatch.kt | 6 +- .../patch/HideEndscreenCardsResourcePatch.kt | 6 +- .../patch/HideInfocardsResourcePatch.kt | 6 +- .../patch/MixPlaylistsPatch.kt | 4 +- .../patch/HideTimeAndSeekbarPatch.kt | 4 +- .../patch/OldQualityLayoutPatch.kt | 4 +- .../patch/HideEmailAddressResourcePatch.kt | 6 +- .../patch/CreateButtonRemoverPatch.kt | 6 +- .../patch/ShortsButtonRemoverPatch.kt | 4 +- .../patch/PlayerPopupPanelsPatch.kt | 4 +- .../layout/reels/patch/HideReelsPatch.kt | 4 +- .../ReturnYouTubeDislikeResourcePatch.kt | 4 +- .../patch/SponsorBlockBytecodePatch.kt | 2 +- .../patch/SponsorBlockResourcePatch.kt | 6 +- .../patch/DisableShortsOnStartupPatch.kt | 4 +- .../patch/TabletMiniPlayerPatch.kt | 4 +- .../layout/watchinvr/patch/WatchinVRPatch.kt | 4 +- .../watermark/patch/HideWatermarkPatch.kt | 4 +- .../widesearchbar/patch/WideSearchbarPatch.kt | 4 +- .../misc/autorepeat/patch/AutoRepeatPatch.kt | 4 +- .../misc/debugging/patch/DebuggingPatch.kt | 4 +- .../hdrbrightness/patch/HDRBrightnessPatch.kt | 4 +- .../fingerprints/InitFingerprint.kt | 2 +- .../fingerprints/ServiceFingerprint.kt | 2 +- .../StandalonePlayerFingerprint.kt | 2 +- .../integrations/patch/IntegrationsPatch.kt | 2 +- .../patch/bytecode/MicroGBytecodePatch.kt | 2 +- .../patch/resource/MicroGResourcePatch.kt | 4 +- .../patch/MinimizedPlaybackPatch.kt | 4 +- .../patch/OpenLinksDirectlyPatch.kt | 4 +- .../playback/fix/patch/FixPlaybackPatch.kt | 4 +- .../patch/PlayerControlsBytecodePatch.kt | 2 +- .../settings/bytecode/patch/SettingsPatch.kt | 10 +- .../framework/components/BasePreference.kt | 14 -- .../components/impl/ArrayResource.kt | 9 -- .../framework/components/impl/Preference.kt | 18 --- .../components/impl/PreferenceScreen.kt | 20 --- .../components/impl/StringResource.kt | 10 -- .../components/impl/SwitchPreference.kt | 21 --- .../components/impl/TextPreference.kt | 22 ---- .../resource/patch/SettingsResourcePatch.kt | 121 ++++-------------- .../patch/RememberVideoQualityPatch.kt | 4 +- .../patch/CustomVideoBufferPatch.kt | 8 +- .../zoomhaptics/patch/ZoomHapticsPatch.kt | 4 +- .../revanced/util/resources/ResourceUtils.kt | 2 +- 84 files changed, 554 insertions(+), 336 deletions(-) rename src/main/kotlin/app/revanced/{ => patches}/shared/fingerprints/WatchWhileActivityFingerprint.kt (84%) rename src/main/kotlin/app/revanced/{shared/patches/IntegrationsFingerprint.kt => patches/shared/integrations/patch/AbstractIntegrationsPatch.kt} (94%) rename src/main/kotlin/app/revanced/patches/shared/mapping/{ => misc}/patch/ResourceMappingPatch.kt (98%) create mode 100644 src/main/kotlin/app/revanced/patches/shared/settings/BasePreference.kt create mode 100644 src/main/kotlin/app/revanced/patches/shared/settings/BaseResource.kt create mode 100644 src/main/kotlin/app/revanced/patches/shared/settings/ComponentsExtensions.kt rename src/main/kotlin/app/revanced/patches/{youtube/misc/settings/framework/components => shared/settings}/IPreference.kt (62%) create mode 100644 src/main/kotlin/app/revanced/patches/shared/settings/IResource.kt create mode 100644 src/main/kotlin/app/revanced/patches/shared/settings/SummaryType.kt create mode 100644 src/main/kotlin/app/revanced/patches/shared/settings/impl/ArrayResource.kt rename src/main/kotlin/app/revanced/patches/{youtube/misc/settings/framework/components => shared/settings}/impl/InputType.kt (52%) create mode 100644 src/main/kotlin/app/revanced/patches/shared/settings/impl/ListPreference.kt create mode 100644 src/main/kotlin/app/revanced/patches/shared/settings/impl/Preference.kt create mode 100644 src/main/kotlin/app/revanced/patches/shared/settings/impl/PreferenceCategory.kt create mode 100644 src/main/kotlin/app/revanced/patches/shared/settings/impl/PreferenceScreen.kt create mode 100644 src/main/kotlin/app/revanced/patches/shared/settings/impl/StringResource.kt create mode 100644 src/main/kotlin/app/revanced/patches/shared/settings/impl/SwitchPreference.kt create mode 100644 src/main/kotlin/app/revanced/patches/shared/settings/impl/TextPreference.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/BasePreference.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/ArrayResource.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/Preference.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/PreferenceScreen.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/StringResource.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/SwitchPreference.kt delete mode 100644 src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/TextPreference.kt diff --git a/src/main/kotlin/app/revanced/shared/fingerprints/WatchWhileActivityFingerprint.kt b/src/main/kotlin/app/revanced/patches/shared/fingerprints/WatchWhileActivityFingerprint.kt similarity index 84% rename from src/main/kotlin/app/revanced/shared/fingerprints/WatchWhileActivityFingerprint.kt rename to src/main/kotlin/app/revanced/patches/shared/fingerprints/WatchWhileActivityFingerprint.kt index a2140bd58..b10c5e23e 100644 --- a/src/main/kotlin/app/revanced/shared/fingerprints/WatchWhileActivityFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/shared/fingerprints/WatchWhileActivityFingerprint.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.fingerprints +package app.revanced.patches.shared.fingerprints import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint diff --git a/src/main/kotlin/app/revanced/shared/patches/IntegrationsFingerprint.kt b/src/main/kotlin/app/revanced/patches/shared/integrations/patch/AbstractIntegrationsPatch.kt similarity index 94% rename from src/main/kotlin/app/revanced/shared/patches/IntegrationsFingerprint.kt rename to src/main/kotlin/app/revanced/patches/shared/integrations/patch/AbstractIntegrationsPatch.kt index 1673f4c05..2ef2e48dc 100644 --- a/src/main/kotlin/app/revanced/shared/patches/IntegrationsFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/shared/integrations/patch/AbstractIntegrationsPatch.kt @@ -1,4 +1,4 @@ -package app.revanced.shared.patches +package app.revanced.patches.shared.integrations.patch import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Version @@ -9,7 +9,6 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultError import app.revanced.patcher.patch.PatchResultSuccess -import app.revanced.shared.patches.AbstractIntegrationsPatch.IntegrationsFingerprint.RegisterResolver import org.jf.dexlib2.iface.Method @Description("Applies mandatory patches to implement the ReVanced integrations into the application.") diff --git a/src/main/kotlin/app/revanced/patches/shared/mapping/patch/ResourceMappingPatch.kt b/src/main/kotlin/app/revanced/patches/shared/mapping/misc/patch/ResourceMappingPatch.kt similarity index 98% rename from src/main/kotlin/app/revanced/patches/shared/mapping/patch/ResourceMappingPatch.kt rename to src/main/kotlin/app/revanced/patches/shared/mapping/misc/patch/ResourceMappingPatch.kt index ef15d6f1e..b607dc283 100644 --- a/src/main/kotlin/app/revanced/patches/shared/mapping/patch/ResourceMappingPatch.kt +++ b/src/main/kotlin/app/revanced/patches/shared/mapping/misc/patch/ResourceMappingPatch.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.shared.mapping.patch +package app.revanced.patches.shared.mapping.misc.patch import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name diff --git a/src/main/kotlin/app/revanced/patches/shared/settings/BasePreference.kt b/src/main/kotlin/app/revanced/patches/shared/settings/BasePreference.kt new file mode 100644 index 000000000..364d5d04b --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/shared/settings/BasePreference.kt @@ -0,0 +1,31 @@ +package app.revanced.patches.shared.settings + +import app.revanced.patches.shared.settings.impl.StringResource +import org.w3c.dom.Document +import org.w3c.dom.Element + +/** + * Base preference class for all preferences. + * + * @param key The key of the preference. + * @param title The title of the preference. + */ +internal abstract class BasePreference( + override val key: String, + override val title: StringResource, +) : IPreference { + + /** + * Serialize preference element to XML. + * Overriding methods should invoke super and operate on its return value. + * @param ownerDocument Target document to create elements from. + * @param resourceCallback Called when a resource has been processed. + */ + open fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)? = null): Element { + return ownerDocument.createElement(tag).apply { + if(key.isNotEmpty()) + setAttribute("android:key", key) + setAttribute("android:title", "@string/${title.also { resourceCallback?.invoke(it) }.name}") + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/shared/settings/BaseResource.kt b/src/main/kotlin/app/revanced/patches/shared/settings/BaseResource.kt new file mode 100644 index 000000000..8ce5b6c72 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/shared/settings/BaseResource.kt @@ -0,0 +1,26 @@ +package app.revanced.patches.shared.settings + +import org.w3c.dom.Document +import org.w3c.dom.Element + +/** + * Base resource class for all resources. + * + * @param name The name of the resource. + */ +internal abstract class BaseResource( + override val name: String +) : IResource { + + /** + * Serialize resource element to XML. + * Overriding methods should invoke super and operate on its return value. + * @param ownerDocument Target document to create elements from. + * @param resourceCallback Called when a resource has been processed. + */ + open fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)? = null): Element { + return ownerDocument.createElement(tag).apply { + setAttribute("name", name) + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/shared/settings/ComponentsExtensions.kt b/src/main/kotlin/app/revanced/patches/shared/settings/ComponentsExtensions.kt new file mode 100644 index 000000000..6221ed953 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/shared/settings/ComponentsExtensions.kt @@ -0,0 +1,42 @@ +package app.revanced.patches.shared.settings + +import app.revanced.patches.shared.settings.impl.StringResource +import org.w3c.dom.Element +import org.w3c.dom.Node + +/** + * Add a resource node child + * + * @param resource The resource to add. + * @param resourceCallback Called when a resource has been processed. + */ +internal fun Node.addResource(resource: BaseResource, resourceCallback: ((IResource) -> Unit)? = null) { + appendChild(resource.serialize(ownerDocument, resourceCallback)) +} + +/** + * Add a preference node child to the settings. + * + * @param preference The preference to add. + * @param resourceCallback Called when a resource has been processed. + */ +internal fun Node.addPreference(preference: BasePreference, resourceCallback: ((IResource) -> Unit)? = null) { + appendChild(preference.serialize(ownerDocument, resourceCallback)) +} + +internal fun Element.addSummary(summaryResource: StringResource?, summaryType: SummaryType = SummaryType.DEFAULT) = + summaryResource?.let { summary -> + setAttribute("android:${summaryType.type}", "@string/${summary.name}") + } + +internal fun Element.addDefault(default: T) { + default?.let { + setAttribute( + "android:defaultValue", when (it) { + is Boolean -> if (it) "true" else "false" + is String -> it + else -> throw IllegalArgumentException("Unsupported default value type: ${it::class.java.name}") + } + ) + } +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/IPreference.kt b/src/main/kotlin/app/revanced/patches/shared/settings/IPreference.kt similarity index 62% rename from src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/IPreference.kt rename to src/main/kotlin/app/revanced/patches/shared/settings/IPreference.kt index bf25a62b1..3674b5db0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/IPreference.kt +++ b/src/main/kotlin/app/revanced/patches/shared/settings/IPreference.kt @@ -1,6 +1,6 @@ -package app.revanced.patches.youtube.misc.settings.framework.components +package app.revanced.patches.shared.settings -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource +import app.revanced.patches.shared.settings.impl.StringResource /** * Preference diff --git a/src/main/kotlin/app/revanced/patches/shared/settings/IResource.kt b/src/main/kotlin/app/revanced/patches/shared/settings/IResource.kt new file mode 100644 index 000000000..9d865c204 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/shared/settings/IResource.kt @@ -0,0 +1,16 @@ +package app.revanced.patches.shared.settings + +/** + * Resource + */ +internal interface IResource { + /** + * Name of the resource. + */ + val name: String + + /** + * Tag name of the resource. + */ + val tag: String +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/shared/settings/SummaryType.kt b/src/main/kotlin/app/revanced/patches/shared/settings/SummaryType.kt new file mode 100644 index 000000000..fb857d239 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/shared/settings/SummaryType.kt @@ -0,0 +1,5 @@ +package app.revanced.patches.shared.settings + +enum class SummaryType(val type: String) { + DEFAULT("summary"), ON("summaryOn"), OFF("summaryOff") +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/shared/settings/impl/ArrayResource.kt b/src/main/kotlin/app/revanced/patches/shared/settings/impl/ArrayResource.kt new file mode 100644 index 000000000..19a841800 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/shared/settings/impl/ArrayResource.kt @@ -0,0 +1,31 @@ +package app.revanced.patches.shared.settings.impl + +import app.revanced.patches.shared.settings.BaseResource +import app.revanced.patches.shared.settings.IResource +import org.w3c.dom.Document +import org.w3c.dom.Element + +/** + * Represents an array resource. + * + * @param name The name of the array resource. + * @param items The items of the array resource. + */ +internal data class ArrayResource( + override val name: String, + val items: List +) : BaseResource(name) { + override val tag = "string-array" + + override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element { + return super.serialize(ownerDocument, resourceCallback).apply { + items.forEach { item -> + setAttribute("name", item.also { resourceCallback?.invoke(it) }.name) + + this.appendChild(ownerDocument.createElement("item").also { itemNode -> + itemNode.textContent = item.value + }) + } + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/InputType.kt b/src/main/kotlin/app/revanced/patches/shared/settings/impl/InputType.kt similarity index 52% rename from src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/InputType.kt rename to src/main/kotlin/app/revanced/patches/shared/settings/impl/InputType.kt index 53b54a2b0..5b7599e9f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/InputType.kt +++ b/src/main/kotlin/app/revanced/patches/shared/settings/impl/InputType.kt @@ -1,4 +1,4 @@ -package app.revanced.patches.youtube.misc.settings.framework.components.impl +package app.revanced.patches.shared.settings.impl enum class InputType(val type: String) { STRING("text"), diff --git a/src/main/kotlin/app/revanced/patches/shared/settings/impl/ListPreference.kt b/src/main/kotlin/app/revanced/patches/shared/settings/impl/ListPreference.kt new file mode 100644 index 000000000..5ddf0ce3b --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/shared/settings/impl/ListPreference.kt @@ -0,0 +1,38 @@ +package app.revanced.patches.shared.settings.impl + +import app.revanced.patches.shared.settings.BasePreference +import app.revanced.patches.shared.settings.IResource +import app.revanced.patches.shared.settings.addDefault +import app.revanced.patches.shared.settings.addSummary +import org.w3c.dom.Document +import org.w3c.dom.Element + +/** + * List preference. + * + * @param key The key of the list preference. + * @param title The title of the list preference. + * @param entries The human-readable entries of the list preference. + * @param entryValues The entry values of the list preference. + * @param default The default entry value of the list preference. + * @param summary The summary of the list preference. + */ +internal class ListPreference( + key: String, + title: StringResource, + val entries: ArrayResource, + val entryValues: ArrayResource, + val default: String? = null, + val summary: StringResource? = null +) : BasePreference(key, title) { + override val tag: String = "ListPreference" + + override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element { + return super.serialize(ownerDocument, resourceCallback).apply { + setAttribute("android:entries", "@array/${entries.also { resourceCallback?.invoke(it) }.name}") + setAttribute("android:entryValues", "@array/${entryValues.also { resourceCallback?.invoke(it) }.name}") + addDefault(default) + addSummary(summary) + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/shared/settings/impl/Preference.kt b/src/main/kotlin/app/revanced/patches/shared/settings/impl/Preference.kt new file mode 100644 index 000000000..59370167a --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/shared/settings/impl/Preference.kt @@ -0,0 +1,44 @@ +package app.revanced.patches.shared.settings.impl + +import app.revanced.patches.shared.settings.BasePreference +import app.revanced.patches.shared.settings.IResource +import app.revanced.patches.shared.settings.addSummary +import org.w3c.dom.Document +import org.w3c.dom.Element + +/** + * A Preference object. + * + * @param title The title of the preference. + * @param intent The intent of the preference. + * @param summary The summary of the text preference. + */ +internal class Preference( + key: String, + title: StringResource, + val intent: Intent, + val summary: StringResource? = null +) : BasePreference(key, title) { + override val tag: String = "Preference" + + /* Key-less constructor */ + constructor( + title: StringResource, + intent: Intent, + summary: StringResource? = null + ) : this("", title, intent, summary) + + override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element { + return super.serialize(ownerDocument, resourceCallback).apply { + addSummary(summary?.also { resourceCallback?.invoke(it) }) + + this.appendChild(ownerDocument.createElement("intent").also { intentNode -> + intentNode.setAttribute("android:targetPackage", intent.targetPackage) + intentNode.setAttribute("android:data", intent.data) + intentNode.setAttribute("android:targetClass", intent.targetClass) + }) + } + } + + data class Intent(val targetPackage: String, val data: String, val targetClass: String) +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/shared/settings/impl/PreferenceCategory.kt b/src/main/kotlin/app/revanced/patches/shared/settings/impl/PreferenceCategory.kt new file mode 100644 index 000000000..2bba02921 --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/shared/settings/impl/PreferenceCategory.kt @@ -0,0 +1,29 @@ +package app.revanced.patches.shared.settings.impl + +import app.revanced.patches.shared.settings.BasePreference +import app.revanced.patches.shared.settings.IResource +import org.w3c.dom.Document +import org.w3c.dom.Element + +/** + * Preference category. + * + * @param key The key of the preference. + * @param title The title of the preference. + * @param preferences Child preferences of this category. + */ +internal open class PreferenceCategory( + key: String, + title: StringResource, + val preferences: List +) : BasePreference(key, title) { + override val tag: String = "PreferenceCategory" + + override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element { + return super.serialize(ownerDocument, resourceCallback).apply { + for (childPreference in preferences) { + this.appendChild(childPreference.serialize(ownerDocument, resourceCallback)) + } + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/shared/settings/impl/PreferenceScreen.kt b/src/main/kotlin/app/revanced/patches/shared/settings/impl/PreferenceScreen.kt new file mode 100644 index 000000000..0990aa53c --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/shared/settings/impl/PreferenceScreen.kt @@ -0,0 +1,34 @@ +package app.revanced.patches.shared.settings.impl + +import app.revanced.patches.shared.settings.BasePreference +import app.revanced.patches.shared.settings.IResource +import app.revanced.patches.shared.settings.addSummary +import org.w3c.dom.Document +import org.w3c.dom.Element + +/** + * Preference screen. + * + * @param key The key of the preference. + * @param title The title of the preference. + * @param preferences Child preferences of this screen. + * @param summary The summary of the text preference. + */ +internal open class PreferenceScreen( + key: String, + title: StringResource, + val preferences: List, + val summary: StringResource? = null +) : BasePreference(key, title) { + override val tag: String = "PreferenceScreen" + + override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element { + return super.serialize(ownerDocument, resourceCallback).apply { + addSummary(summary?.also { resourceCallback?.invoke(it) }) + + for (childPreference in preferences) { + this.appendChild(childPreference.serialize(ownerDocument, resourceCallback)) + } + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/shared/settings/impl/StringResource.kt b/src/main/kotlin/app/revanced/patches/shared/settings/impl/StringResource.kt new file mode 100644 index 000000000..6fc22251b --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/shared/settings/impl/StringResource.kt @@ -0,0 +1,31 @@ +package app.revanced.patches.shared.settings.impl + +import app.revanced.patches.shared.settings.BaseResource +import app.revanced.patches.shared.settings.IResource +import org.w3c.dom.Document +import org.w3c.dom.Element + +/** + * Represents a string value in the strings.xml file + * + * @param name The name of the string + * @param value The value of the string + * @param formatted If the string is formatted. If false, the attribute will be set + */ +internal data class StringResource( + override val name: String, + val value: String, + val formatted: Boolean = true +) : BaseResource(name) { + override val tag = "string" + + override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element { + return super.serialize(ownerDocument, resourceCallback).apply { + // if the string is un-formatted, explicitly add the formatted attribute + if (!formatted) + setAttribute("formatted", "false") + + textContent = value + } + } +} diff --git a/src/main/kotlin/app/revanced/patches/shared/settings/impl/SwitchPreference.kt b/src/main/kotlin/app/revanced/patches/shared/settings/impl/SwitchPreference.kt new file mode 100644 index 000000000..f6abd1a6d --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/shared/settings/impl/SwitchPreference.kt @@ -0,0 +1,35 @@ +package app.revanced.patches.shared.settings.impl + +import app.revanced.patches.shared.settings.* +import app.revanced.patches.shared.settings.BasePreference +import app.revanced.patches.shared.settings.IResource +import app.revanced.patches.shared.settings.addDefault +import app.revanced.patches.shared.settings.addSummary +import org.w3c.dom.Document +import org.w3c.dom.Element + +/** + * Switch preference. + * + * @param key The key of the switch. + * @param title The title of the switch. + * @param default The default value of the switch. + * @param summaryOn The summary to show when the preference is enabled. + * @param summaryOff The summary to show when the preference is disabled. + */ +internal class SwitchPreference( + key: String, title: StringResource, + val default: Boolean = false, + val summaryOn: StringResource? = null, + val summaryOff: StringResource? = null +) : BasePreference(key, title) { + override val tag: String = "SwitchPreference" + + override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element { + return super.serialize(ownerDocument, resourceCallback).apply { + addDefault(default) + addSummary(summaryOn?.also { resourceCallback?.invoke(it) }, SummaryType.ON) + addSummary(summaryOff?.also { resourceCallback?.invoke(it) }, SummaryType.OFF) + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/shared/settings/impl/TextPreference.kt b/src/main/kotlin/app/revanced/patches/shared/settings/impl/TextPreference.kt new file mode 100644 index 000000000..5eca4a69c --- /dev/null +++ b/src/main/kotlin/app/revanced/patches/shared/settings/impl/TextPreference.kt @@ -0,0 +1,35 @@ +package app.revanced.patches.shared.settings.impl + +import app.revanced.patches.shared.settings.BasePreference +import app.revanced.patches.shared.settings.IResource +import app.revanced.patches.shared.settings.addDefault +import app.revanced.patches.shared.settings.addSummary +import org.w3c.dom.Document +import org.w3c.dom.Element + +/** + * Text preference. + * + * @param key The key of the text preference. + * @param title The title of the text preference. + * @param inputType The input type of the text preference. + * @param default The default value of the text preference. + * @param summary The summary of the text preference. + */ +internal class TextPreference( + key: String, + title: StringResource, + var inputType: InputType = InputType.STRING, + val default: String? = null, + val summary: StringResource? = null +) : BasePreference(key, title) { + override val tag: String = "EditTextPreference" + + override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element { + return super.serialize(ownerDocument, resourceCallback).apply { + setAttribute("android:inputType", inputType.type) + addDefault(default) + addSummary(summary?.also { resourceCallback?.invoke(it) }) + } + } +} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/spotify/premium_navbar_tab/patch/PremiumNavbarTabPatch.kt b/src/main/kotlin/app/revanced/patches/spotify/premium_navbar_tab/patch/PremiumNavbarTabPatch.kt index 99e2d879e..e45bb6fbe 100644 --- a/src/main/kotlin/app/revanced/patches/spotify/premium_navbar_tab/patch/PremiumNavbarTabPatch.kt +++ b/src/main/kotlin/app/revanced/patches/spotify/premium_navbar_tab/patch/PremiumNavbarTabPatch.kt @@ -14,7 +14,7 @@ import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.spotify.premium_navbar_tab.annotations.PremiumNavbarTabCompatibility import app.revanced.patches.spotify.premium_navbar_tab.fingerprints.AddPremiumNavbarTabFingerprint import app.revanced.patches.spotify.premium_navbar_tab.fingerprints.AddPremiumNavbarTabParentFingerprint -import app.revanced.patches.shared.mapping.patch.ResourceMappingPatch +import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch import org.jf.dexlib2.Opcode import org.jf.dexlib2.iface.instruction.WideLiteralInstruction diff --git a/src/main/kotlin/app/revanced/patches/tiktok/misc/integrations/fingerprints/InitFingerprint.kt b/src/main/kotlin/app/revanced/patches/tiktok/misc/integrations/fingerprints/InitFingerprint.kt index 025270bab..9afc4eccf 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/misc/integrations/fingerprints/InitFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/misc/integrations/fingerprints/InitFingerprint.kt @@ -1,6 +1,6 @@ package app.revanced.patches.tiktok.misc.integrations.fingerprints -import app.revanced.shared.patches.AbstractIntegrationsPatch.IntegrationsFingerprint +import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint object InitFingerprint : IntegrationsFingerprint( customFingerprint = { methodDef -> diff --git a/src/main/kotlin/app/revanced/patches/tiktok/misc/integrations/patch/TikTokIntegrationsPatch.kt b/src/main/kotlin/app/revanced/patches/tiktok/misc/integrations/patch/TikTokIntegrationsPatch.kt index 2b3a82639..5d81d9396 100644 --- a/src/main/kotlin/app/revanced/patches/tiktok/misc/integrations/patch/TikTokIntegrationsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/tiktok/misc/integrations/patch/TikTokIntegrationsPatch.kt @@ -3,7 +3,7 @@ package app.revanced.patches.tiktok.misc.integrations.patch import app.revanced.patcher.annotation.Name import app.revanced.patches.tiktok.misc.integrations.annotations.TikTokIntegrationsCompatibility import app.revanced.patches.tiktok.misc.integrations.fingerprints.InitFingerprint -import app.revanced.shared.patches.AbstractIntegrationsPatch +import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch @Name("tiktok-integrations") @TikTokIntegrationsCompatibility diff --git a/src/main/kotlin/app/revanced/patches/twitch/misc/integrations/fingerprints/InitFingerprint.kt b/src/main/kotlin/app/revanced/patches/twitch/misc/integrations/fingerprints/InitFingerprint.kt index 4e22c792e..7f55dd22f 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/misc/integrations/fingerprints/InitFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/misc/integrations/fingerprints/InitFingerprint.kt @@ -3,7 +3,7 @@ package app.revanced.patches.twitch.misc.integrations.fingerprints import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Version import app.revanced.patches.twitch.misc.integrations.annotations.IntegrationsCompatibility -import app.revanced.shared.patches.AbstractIntegrationsPatch.IntegrationsFingerprint +import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint @Name("init-fingerprint") @IntegrationsCompatibility diff --git a/src/main/kotlin/app/revanced/patches/twitch/misc/integrations/patch/IntegrationsPatch.kt b/src/main/kotlin/app/revanced/patches/twitch/misc/integrations/patch/IntegrationsPatch.kt index dbe27ff0a..027106d88 100644 --- a/src/main/kotlin/app/revanced/patches/twitch/misc/integrations/patch/IntegrationsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/twitch/misc/integrations/patch/IntegrationsPatch.kt @@ -3,7 +3,7 @@ package app.revanced.patches.twitch.misc.integrations.patch import app.revanced.patcher.annotation.Name import app.revanced.patches.twitch.misc.integrations.fingerprints.InitFingerprint import app.revanced.patches.twitch.misc.integrations.annotations.IntegrationsCompatibility -import app.revanced.shared.patches.AbstractIntegrationsPatch +import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch @Name("integrations") @IntegrationsCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/general/bytecode/patch/GeneralAdsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/general/bytecode/patch/GeneralAdsPatch.kt index c390e87c5..cc9562bb7 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/general/bytecode/patch/GeneralAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/general/bytecode/patch/GeneralAdsPatch.kt @@ -18,7 +18,6 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patches.youtube.ad.general.annotation.GeneralAdsCompatibility import app.revanced.patches.youtube.ad.general.bytecode.fingerprints.ReelConstructorFingerprint import app.revanced.patches.youtube.ad.general.resource.patch.GeneralAdsResourcePatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.* import org.jf.dexlib2.iface.Method import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction import org.jf.dexlib2.iface.instruction.formats.Instruction31i diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/general/resource/patch/GeneralAdsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/general/resource/patch/GeneralAdsResourcePatch.kt index 416a5bf80..1628eb32e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/general/resource/patch/GeneralAdsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/general/resource/patch/GeneralAdsResourcePatch.kt @@ -6,13 +6,16 @@ import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn -import app.revanced.patches.shared.mapping.patch.ResourceMappingPatch +import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch +import app.revanced.patches.shared.settings.impl.InputType +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.TextPreference import app.revanced.patches.youtube.ad.general.annotation.GeneralAdsCompatibility import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch.PreferenceScreen -import app.revanced.patches.youtube.misc.settings.framework.components.impl.* @DependsOn(dependencies = [ FixLocaleConfigErrorPatch::class, @@ -184,7 +187,7 @@ class GeneralAdsResourcePatch : ResourcePatch { "Chapter teasers are shown" ) ), - PreferenceScreen( + app.revanced.patches.shared.settings.impl.PreferenceScreen( "revanced_adremover_custom", StringResource("revanced_adremover_custom_title", "Custom filter"), listOf( diff --git a/src/main/kotlin/app/revanced/patches/youtube/ad/video/patch/VideoAdsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/ad/video/patch/VideoAdsPatch.kt index 21ee64c71..340f00f78 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/ad/video/patch/VideoAdsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/ad/video/patch/VideoAdsPatch.kt @@ -17,8 +17,8 @@ import app.revanced.patches.youtube.ad.video.fingerprints.LoadVideoAdsFingerprin import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.playback.fix.patch.FixPlaybackPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference @Patch @DependsOn([IntegrationsPatch::class, SettingsPatch::class, FixPlaybackPatch::class]) diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/resource/patch/DownloadsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/resource/patch/DownloadsResourcePatch.kt index 9c59df08e..c85f76851 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/resource/patch/DownloadsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/resource/patch/DownloadsResourcePatch.kt @@ -8,11 +8,14 @@ import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patches.shared.settings.impl.* +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.TextPreference import app.revanced.patches.youtube.interaction.downloads.annotation.DownloadsCompatibility import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch import app.revanced.patches.youtube.misc.playercontrols.resource.patch.BottomControlsResourcePatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.* import app.revanced.util.resources.ResourceUtils import app.revanced.util.resources.ResourceUtils.Settings.mergeStrings import app.revanced.util.resources.ResourceUtils.copyResources diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/patch/EnableSeekbarTappingPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/patch/EnableSeekbarTappingPatch.kt index 0fb295aa8..7c197652e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/patch/EnableSeekbarTappingPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/patch/EnableSeekbarTappingPatch.kt @@ -16,8 +16,8 @@ import app.revanced.patches.youtube.interaction.seekbar.fingerprints.SeekbarTapp import app.revanced.patches.youtube.interaction.seekbar.fingerprints.SeekbarTappingParentFingerprint import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference import org.jf.dexlib2.Opcode import org.jf.dexlib2.builder.instruction.BuilderInstruction21t import org.jf.dexlib2.iface.Method diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/patch/bytecode/SwipeControlsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/patch/bytecode/SwipeControlsBytecodePatch.kt index 60f9aa77d..ba044d498 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/patch/bytecode/SwipeControlsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/patch/bytecode/SwipeControlsBytecodePatch.kt @@ -14,7 +14,7 @@ import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable import app.revanced.patches.youtube.interaction.swipecontrols.annotation.SwipeControlsCompatibility import app.revanced.patches.youtube.interaction.swipecontrols.fingerprints.SwipeControlsHostActivityFingerprint -import app.revanced.shared.fingerprints.WatchWhileActivityFingerprint +import app.revanced.patches.shared.fingerprints.WatchWhileActivityFingerprint import app.revanced.patches.youtube.interaction.swipecontrols.patch.resource.SwipeControlsResourcePatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/patch/resource/SwipeControlsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/patch/resource/SwipeControlsResourcePatch.kt index 665345294..cc5f52060 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/patch/resource/SwipeControlsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/patch/resource/SwipeControlsResourcePatch.kt @@ -7,9 +7,13 @@ import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn +import app.revanced.patches.shared.settings.impl.* +import app.revanced.patches.shared.settings.impl.PreferenceScreen +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.TextPreference import app.revanced.patches.youtube.interaction.swipecontrols.annotation.SwipeControlsCompatibility import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.* import app.revanced.util.resources.ResourceUtils import app.revanced.util.resources.ResourceUtils.copyResources diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/patch/AutoCaptionsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/patch/AutoCaptionsPatch.kt index 9990da999..10f79df8e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/patch/AutoCaptionsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/patch/AutoCaptionsPatch.kt @@ -16,8 +16,8 @@ import app.revanced.patches.youtube.layout.autocaptions.fingerprints.SubtitleBut import app.revanced.patches.youtube.layout.autocaptions.fingerprints.SubtitleTrackFingerprint import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference @Patch @DependsOn([IntegrationsPatch::class, SettingsPatch::class]) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/autoplaybutton/patch/HideAutoplayButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/autoplaybutton/patch/HideAutoplayButtonPatch.kt index 9010738cb..9b73c6206 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/autoplaybutton/patch/HideAutoplayButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/autoplaybutton/patch/HideAutoplayButtonPatch.kt @@ -15,10 +15,10 @@ import app.revanced.patches.youtube.layout.autoplaybutton.annotations.AutoplayBu import app.revanced.patches.youtube.layout.autoplaybutton.fingerprints.AutoNavInformerFingerprint import app.revanced.patches.youtube.layout.autoplaybutton.fingerprints.LayoutConstructorFingerprint import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch -import app.revanced.patches.shared.mapping.patch.ResourceMappingPatch +import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference import org.jf.dexlib2.iface.instruction.Instruction import org.jf.dexlib2.iface.instruction.ReferenceInstruction import org.jf.dexlib2.iface.instruction.WideLiteralInstruction diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/patch/HideButtonsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/patch/HideButtonsPatch.kt index dc2f4abd2..d5e2673ee 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/patch/HideButtonsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/patch/HideButtonsPatch.kt @@ -11,11 +11,11 @@ import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch import app.revanced.patches.youtube.layout.buttons.annotations.HideButtonsCompatibility -import app.revanced.patches.shared.mapping.patch.ResourceMappingPatch +import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.PreferenceScreen -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.PreferenceScreen +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference @Patch @DependsOn([ResourceMappingPatch::class, LithoFilterPatch::class]) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/castbutton/patch/HideCastButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/castbutton/patch/HideCastButtonPatch.kt index b511660f6..3487189d3 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/castbutton/patch/HideCastButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/castbutton/patch/HideCastButtonPatch.kt @@ -14,8 +14,8 @@ import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.youtube.layout.castbutton.annotations.CastButtonCompatibility import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference @Patch @DependsOn([IntegrationsPatch::class, SettingsPatch::class]) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/comments/resource/patch/CommentsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/comments/resource/patch/CommentsResourcePatch.kt index 6652fcdeb..52bba0d81 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/comments/resource/patch/CommentsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/comments/resource/patch/CommentsResourcePatch.kt @@ -8,11 +8,11 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patches.youtube.layout.comments.annotations.CommentsCompatibility -import app.revanced.patches.shared.mapping.patch.ResourceMappingPatch +import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.PreferenceScreen -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.PreferenceScreen +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference @Name("comments-resource-patch") @CommentsCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreenpanels/patch/FullscreenPanelsRemoverPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreenpanels/patch/FullscreenPanelsRemoverPatch.kt index b73d2404d..4faa41e2f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreenpanels/patch/FullscreenPanelsRemoverPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/fullscreenpanels/patch/FullscreenPanelsRemoverPatch.kt @@ -18,8 +18,8 @@ import app.revanced.patches.youtube.layout.fullscreenpanels.fingerprints.Fullscr import app.revanced.patches.youtube.layout.fullscreenpanels.fingerprints.FullscreenViewAdderParentFingerprint import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference @Patch @Name("disable-fullscreen-panels") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hidealbumcards/resource/patch/AlbumCardsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hidealbumcards/resource/patch/AlbumCardsResourcePatch.kt index d1edaa16f..329835ad1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hidealbumcards/resource/patch/AlbumCardsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hidealbumcards/resource/patch/AlbumCardsResourcePatch.kt @@ -8,10 +8,10 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patches.youtube.layout.hidealbumcards.annotations.AlbumCardsCompatibility -import app.revanced.patches.shared.mapping.patch.ResourceMappingPatch +import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference @Name("hide-album-cards-resource-patch") @AlbumCardsCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hideartistcard/patch/HideArtistCardPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hideartistcard/patch/HideArtistCardPatch.kt index 1cf9f6213..d2c89c659 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hideartistcard/patch/HideArtistCardPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hideartistcard/patch/HideArtistCardPatch.kt @@ -11,10 +11,10 @@ import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch import app.revanced.patches.youtube.layout.buttons.annotations.HideArtistCardCompatibility -import app.revanced.patches.shared.mapping.patch.ResourceMappingPatch +import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference @Patch @DependsOn([ResourceMappingPatch::class, LithoFilterPatch::class]) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hidecaptionsbutton/patch/HideCaptionsButtonPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hidecaptionsbutton/patch/HideCaptionsButtonPatch.kt index 3e7d10542..ba163b459 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hidecaptionsbutton/patch/HideCaptionsButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hidecaptionsbutton/patch/HideCaptionsButtonPatch.kt @@ -14,8 +14,8 @@ import app.revanced.patches.youtube.layout.autocaptions.annotations.AutoCaptions import app.revanced.patches.youtube.layout.autocaptions.fingerprints.SubtitleButtonControllerFingerprint import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference import org.jf.dexlib2.Opcode @Patch diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hidecrowdfundingbox/resource/patch/CrowdfundingBoxResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hidecrowdfundingbox/resource/patch/CrowdfundingBoxResourcePatch.kt index 33d0a41b5..fd61e472f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hidecrowdfundingbox/resource/patch/CrowdfundingBoxResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hidecrowdfundingbox/resource/patch/CrowdfundingBoxResourcePatch.kt @@ -8,10 +8,10 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patches.youtube.layout.hidecrowdfundingbox.annotations.CrowdfundingBoxCompatibility -import app.revanced.patches.shared.mapping.patch.ResourceMappingPatch +import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference @Name("crowdfunding-box-resource-patch") @CrowdfundingBoxCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hideendscreencards/resource/patch/HideEndscreenCardsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hideendscreencards/resource/patch/HideEndscreenCardsResourcePatch.kt index 06750b7df..adac71781 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hideendscreencards/resource/patch/HideEndscreenCardsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hideendscreencards/resource/patch/HideEndscreenCardsResourcePatch.kt @@ -8,10 +8,10 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patches.youtube.layout.hideendscreencards.annotations.HideEndscreenCardsCompatibility -import app.revanced.patches.shared.mapping.patch.ResourceMappingPatch +import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference @Name("hide-endscreen-cards-resource-patch") @HideEndscreenCardsCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hideinfocards/resource/patch/HideInfocardsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hideinfocards/resource/patch/HideInfocardsResourcePatch.kt index 6dd2fd0bc..bbb1b0e27 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hideinfocards/resource/patch/HideInfocardsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hideinfocards/resource/patch/HideInfocardsResourcePatch.kt @@ -7,10 +7,10 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patches.youtube.layout.hideinfocards.annotations.HideInfocardsCompatibility -import app.revanced.patches.shared.mapping.patch.ResourceMappingPatch +import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference @HideInfocardsCompatibility @DependsOn([SettingsPatch::class, ResourceMappingPatch::class]) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hidemixplaylists/patch/MixPlaylistsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hidemixplaylists/patch/MixPlaylistsPatch.kt index c6f692ba6..b1de97af0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hidemixplaylists/patch/MixPlaylistsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hidemixplaylists/patch/MixPlaylistsPatch.kt @@ -17,8 +17,8 @@ import app.revanced.patches.youtube.layout.hidemixplaylists.fingerprints.CreateM import app.revanced.patches.youtube.layout.hidemixplaylists.fingerprints.SecondCreateMixPlaylistFingerprint import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference import org.jf.dexlib2.iface.instruction.OneRegisterInstruction @Patch diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hidetimeandseekbar/patch/HideTimeAndSeekbarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hidetimeandseekbar/patch/HideTimeAndSeekbarPatch.kt index 09a221e76..67dddb43b 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/hidetimeandseekbar/patch/HideTimeAndSeekbarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hidetimeandseekbar/patch/HideTimeAndSeekbarPatch.kt @@ -15,8 +15,8 @@ import app.revanced.patches.youtube.layout.hidetimeandseekbar.fingerprints.TimeC import app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints.CreateVideoPlayerSeekbarFingerprint import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference @Patch @DependsOn([IntegrationsPatch::class, SettingsPatch::class]) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/oldqualitylayout/patch/OldQualityLayoutPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/oldqualitylayout/patch/OldQualityLayoutPatch.kt index 581b3c182..0fc946236 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/oldqualitylayout/patch/OldQualityLayoutPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/oldqualitylayout/patch/OldQualityLayoutPatch.kt @@ -14,8 +14,8 @@ import app.revanced.patches.youtube.layout.oldqualitylayout.annotations.OldQuali import app.revanced.patches.youtube.layout.oldqualitylayout.fingerprints.QualityMenuViewInflateFingerprint import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction @Patch diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/personalinformation/resource/patch/HideEmailAddressResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/personalinformation/resource/patch/HideEmailAddressResourcePatch.kt index 4ffe9175f..181553ef0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/personalinformation/resource/patch/HideEmailAddressResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/personalinformation/resource/patch/HideEmailAddressResourcePatch.kt @@ -8,10 +8,10 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patches.youtube.layout.personalinformation.annotations.HideEmailAddressCompatibility -import app.revanced.patches.shared.mapping.patch.ResourceMappingPatch +import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference @Name("hide-email-address-resource-patch") @HideEmailAddressCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/pivotbar/createbutton/patch/CreateButtonRemoverPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/pivotbar/createbutton/patch/CreateButtonRemoverPatch.kt index 7cebc3a57..bea19f524 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/pivotbar/createbutton/patch/CreateButtonRemoverPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/pivotbar/createbutton/patch/CreateButtonRemoverPatch.kt @@ -18,10 +18,10 @@ import app.revanced.patches.youtube.layout.pivotbar.fingerprints.PivotBarFingerp import app.revanced.patches.youtube.layout.pivotbar.utils.InjectionUtils.REGISTER_TEMPLATE_REPLACEMENT import app.revanced.patches.youtube.layout.pivotbar.utils.InjectionUtils.injectHook import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch -import app.revanced.patches.shared.mapping.patch.ResourceMappingPatch +import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference @Patch @DependsOn([IntegrationsPatch::class, ResourceMappingPatch::class, SettingsPatch::class]) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/pivotbar/shortsbutton/patch/ShortsButtonRemoverPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/pivotbar/shortsbutton/patch/ShortsButtonRemoverPatch.kt index dd20a3cac..8e4c370b1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/pivotbar/shortsbutton/patch/ShortsButtonRemoverPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/pivotbar/shortsbutton/patch/ShortsButtonRemoverPatch.kt @@ -20,8 +20,8 @@ import app.revanced.patches.youtube.layout.pivotbar.utils.InjectionUtils.REGISTE import app.revanced.patches.youtube.layout.pivotbar.utils.InjectionUtils.injectHook import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference @Patch @DependsOn([IntegrationsPatch::class, SettingsPatch::class]) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/playerpopuppanels/patch/PlayerPopupPanelsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/playerpopuppanels/patch/PlayerPopupPanelsPatch.kt index 8cce12f6c..8712edb62 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/playerpopuppanels/patch/PlayerPopupPanelsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/playerpopuppanels/patch/PlayerPopupPanelsPatch.kt @@ -14,8 +14,8 @@ import app.revanced.patches.youtube.layout.playerpopuppanels.annotations.PlayerP import app.revanced.patches.youtube.layout.playerpopuppanels.fingerprints.EngagementPanelControllerFingerprint import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference @Patch @DependsOn([IntegrationsPatch::class, SettingsPatch::class]) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/reels/patch/HideReelsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/reels/patch/HideReelsPatch.kt index 8ffba7742..fa7e15979 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/reels/patch/HideReelsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/reels/patch/HideReelsPatch.kt @@ -12,8 +12,8 @@ import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patches.youtube.layout.reels.annotations.HideReelsCompatibility import app.revanced.patches.youtube.layout.reels.fingerprints.HideReelsFingerprint import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference //@Patch TODO: this is currently in the general-bytecode-ads patch due to the integrations having a preference for including reels or not. Move it here. @Name("hide-reels") diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/resource/patch/ReturnYouTubeDislikeResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/resource/patch/ReturnYouTubeDislikeResourcePatch.kt index 79bd00e01..581454369 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/resource/patch/ReturnYouTubeDislikeResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/resource/patch/ReturnYouTubeDislikeResourcePatch.kt @@ -11,8 +11,8 @@ import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patches.youtube.layout.returnyoutubedislike.annotations.ReturnYouTubeDislikeCompatibility import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.Preference -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource +import app.revanced.patches.shared.settings.impl.Preference +import app.revanced.patches.shared.settings.impl.StringResource import app.revanced.util.resources.ResourceUtils.Settings.mergeStrings @DependsOn([FixLocaleConfigErrorPatch::class, SettingsPatch::class]) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/bytecode/patch/SponsorBlockBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/bytecode/patch/SponsorBlockBytecodePatch.kt index b884e06de..9b3d507cd 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/bytecode/patch/SponsorBlockBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/bytecode/patch/SponsorBlockBytecodePatch.kt @@ -21,7 +21,7 @@ import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlock import app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints.* import app.revanced.patches.youtube.layout.sponsorblock.resource.patch.SponsorBlockResourcePatch import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch -import app.revanced.patches.shared.mapping.patch.ResourceMappingPatch +import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.playercontrols.bytecode.patch.PlayerControlsBytecodePatch import app.revanced.patches.youtube.misc.video.information.patch.VideoInformationPatch import app.revanced.patches.youtube.misc.video.videoid.patch.VideoIdPatch diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/resource/patch/SponsorBlockResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/resource/patch/SponsorBlockResourcePatch.kt index 6833a7061..fd391a276 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/resource/patch/SponsorBlockResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/resource/patch/SponsorBlockResourcePatch.kt @@ -9,10 +9,10 @@ import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patches.youtube.layout.sponsorblock.annotations.SponsorBlockCompatibility import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch -import app.revanced.patches.shared.mapping.patch.ResourceMappingPatch +import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.Preference -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource +import app.revanced.patches.shared.settings.impl.Preference +import app.revanced.patches.shared.settings.impl.StringResource import app.revanced.util.resources.ResourceUtils import app.revanced.util.resources.ResourceUtils.Settings.mergeStrings import app.revanced.util.resources.ResourceUtils.copyResources diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/patch/DisableShortsOnStartupPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/patch/DisableShortsOnStartupPatch.kt index 0398cca0a..3e6dc9a13 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/patch/DisableShortsOnStartupPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/patch/DisableShortsOnStartupPatch.kt @@ -14,8 +14,8 @@ import app.revanced.patches.youtube.layout.startupshortsreset.annotations.Startu import app.revanced.patches.youtube.layout.startupshortsreset.fingerprints.UserWasInShortsFingerprint import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference @Patch @DependsOn([IntegrationsPatch::class, SettingsPatch::class]) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/patch/TabletMiniPlayerPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/patch/TabletMiniPlayerPatch.kt index ffb494868..410983790 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/patch/TabletMiniPlayerPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/patch/TabletMiniPlayerPatch.kt @@ -20,8 +20,8 @@ import app.revanced.patches.youtube.layout.tabletminiplayer.fingerprints.MiniPla import app.revanced.patches.youtube.layout.tabletminiplayer.fingerprints.MiniPlayerResponseModelSizeCheckFingerprint import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference import org.jf.dexlib2.iface.instruction.OneRegisterInstruction @Patch diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/watchinvr/patch/WatchinVRPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/watchinvr/patch/WatchinVRPatch.kt index 73e4f54a2..70c88c73e 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/watchinvr/patch/WatchinVRPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/watchinvr/patch/WatchinVRPatch.kt @@ -14,8 +14,8 @@ import app.revanced.patches.youtube.layout.watchinvr.annotations.WatchinVRCompat import app.revanced.patches.youtube.layout.watchinvr.fingerprints.WatchinVRFingerprint import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference @Patch @DependsOn([IntegrationsPatch::class, SettingsPatch::class]) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/watermark/patch/HideWatermarkPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/watermark/patch/HideWatermarkPatch.kt index 4009355cc..eae453c4c 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/watermark/patch/HideWatermarkPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/watermark/patch/HideWatermarkPatch.kt @@ -18,8 +18,8 @@ import app.revanced.patches.youtube.layout.watermark.fingerprints.HideWatermarkF import app.revanced.patches.youtube.layout.watermark.fingerprints.HideWatermarkParentFingerprint import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference @Patch @DependsOn([IntegrationsPatch::class, SettingsPatch::class]) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/widesearchbar/patch/WideSearchbarPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/widesearchbar/patch/WideSearchbarPatch.kt index 20b1e5ca5..5c2d1ff03 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/widesearchbar/patch/WideSearchbarPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/widesearchbar/patch/WideSearchbarPatch.kt @@ -20,8 +20,8 @@ import app.revanced.patches.youtube.layout.widesearchbar.fingerprints.WideSearch import app.revanced.patches.youtube.layout.widesearchbar.fingerprints.WideSearchbarTwoParentFingerprint import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference @Patch @DependsOn([IntegrationsPatch::class, SettingsPatch::class]) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/patch/AutoRepeatPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/patch/AutoRepeatPatch.kt index 7de04e2b4..b90ceb5ad 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/patch/AutoRepeatPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/patch/AutoRepeatPatch.kt @@ -18,8 +18,8 @@ import app.revanced.patches.youtube.misc.autorepeat.fingerprints.AutoRepeatFinge import app.revanced.patches.youtube.misc.autorepeat.fingerprints.AutoRepeatParentFingerprint import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference @Patch @DependsOn([IntegrationsPatch::class]) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/debugging/patch/DebuggingPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/debugging/patch/DebuggingPatch.kt index c25b37e97..b2ac5f609 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/debugging/patch/DebuggingPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/debugging/patch/DebuggingPatch.kt @@ -10,8 +10,8 @@ import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.youtube.misc.debugging.annotations.DebuggingCompatibility import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference import org.w3c.dom.Element @Patch diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/hdrbrightness/patch/HDRBrightnessPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/hdrbrightness/patch/HDRBrightnessPatch.kt index 24f18d281..64e066292 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/hdrbrightness/patch/HDRBrightnessPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/hdrbrightness/patch/HDRBrightnessPatch.kt @@ -14,8 +14,8 @@ import app.revanced.patches.youtube.misc.hdrbrightness.annotations.HDRBrightness import app.revanced.patches.youtube.misc.hdrbrightness.fingerprints.HDRBrightnessFingerprint import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference import org.jf.dexlib2.iface.instruction.ReferenceInstruction import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction import org.jf.dexlib2.iface.reference.FieldReference diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/InitFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/InitFingerprint.kt index 18975a225..730e856c1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/InitFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/InitFingerprint.kt @@ -1,6 +1,6 @@ package app.revanced.patches.youtube.misc.integrations.fingerprints -import app.revanced.shared.patches.AbstractIntegrationsPatch.IntegrationsFingerprint +import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint object InitFingerprint : IntegrationsFingerprint( strings = listOf("Application creation"), diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/ServiceFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/ServiceFingerprint.kt index c739b93fc..813aaf573 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/ServiceFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/ServiceFingerprint.kt @@ -1,6 +1,6 @@ package app.revanced.patches.youtube.misc.integrations.fingerprints -import app.revanced.shared.patches.AbstractIntegrationsPatch.IntegrationsFingerprint +import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint object ServiceFingerprint : IntegrationsFingerprint( customFingerprint = { methodDef -> methodDef.definingClass.endsWith("ApiPlayerService;") && methodDef.name == "" }, diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/StandalonePlayerFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/StandalonePlayerFingerprint.kt index cbad83c52..ff7106145 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/StandalonePlayerFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/fingerprints/StandalonePlayerFingerprint.kt @@ -1,6 +1,6 @@ package app.revanced.patches.youtube.misc.integrations.fingerprints -import app.revanced.shared.patches.AbstractIntegrationsPatch.IntegrationsFingerprint +import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint object StandalonePlayerFingerprint : IntegrationsFingerprint( strings = listOf( diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/patch/IntegrationsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/patch/IntegrationsPatch.kt index cd6986320..a5d219fa3 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/patch/IntegrationsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/integrations/patch/IntegrationsPatch.kt @@ -5,7 +5,7 @@ import app.revanced.patches.youtube.misc.integrations.annotations.IntegrationsCo import app.revanced.patches.youtube.misc.integrations.fingerprints.InitFingerprint import app.revanced.patches.youtube.misc.integrations.fingerprints.ServiceFingerprint import app.revanced.patches.youtube.misc.integrations.fingerprints.StandalonePlayerFingerprint -import app.revanced.shared.patches.AbstractIntegrationsPatch +import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch @Name("integrations") @IntegrationsCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/microg/patch/bytecode/MicroGBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/microg/patch/bytecode/MicroGBytecodePatch.kt index f309d7bc4..d08505350 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/microg/patch/bytecode/MicroGBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/microg/patch/bytecode/MicroGBytecodePatch.kt @@ -10,7 +10,7 @@ import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch -import app.revanced.shared.fingerprints.WatchWhileActivityFingerprint +import app.revanced.patches.shared.fingerprints.WatchWhileActivityFingerprint import app.revanced.patches.youtube.layout.castbutton.patch.HideCastButtonPatch import app.revanced.patches.youtube.misc.clientspoof.patch.ClientSpoofPatch import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/microg/patch/resource/MicroGResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/microg/patch/resource/MicroGResourcePatch.kt index 6d747a448..a57236a0d 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/microg/patch/resource/MicroGResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/microg/patch/resource/MicroGResourcePatch.kt @@ -16,8 +16,8 @@ import app.revanced.patches.youtube.misc.microg.shared.Constants.REVANCED_PACKAG import app.revanced.patches.youtube.misc.microg.shared.Constants.SPOOFED_PACKAGE_NAME import app.revanced.patches.youtube.misc.microg.shared.Constants.SPOOFED_PACKAGE_SIGNATURE import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.Preference -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource +import app.revanced.patches.shared.settings.impl.Preference +import app.revanced.patches.shared.settings.impl.StringResource import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsResourcePatch import app.revanced.util.microg.Constants.MICROG_VENDOR import app.revanced.util.microg.MicroGManifestHelper diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/patch/MinimizedPlaybackPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/patch/MinimizedPlaybackPatch.kt index bf3b630cb..8d2f2ee50 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/patch/MinimizedPlaybackPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/patch/MinimizedPlaybackPatch.kt @@ -18,8 +18,8 @@ import app.revanced.patches.youtube.misc.minimizedplayback.fingerprints.Minimize import app.revanced.patches.youtube.misc.minimizedplayback.fingerprints.MinimizedPlaybackManagerFingerprint import app.revanced.patches.youtube.misc.minimizedplayback.fingerprints.MinimizedPlaybackSettingsFingerprint import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference import org.jf.dexlib2.iface.instruction.ReferenceInstruction import org.jf.dexlib2.iface.reference.MethodReference diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/openlinksdirectly/patch/OpenLinksDirectlyPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/openlinksdirectly/patch/OpenLinksDirectlyPatch.kt index 38ad89a3e..c4497c246 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/openlinksdirectly/patch/OpenLinksDirectlyPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/openlinksdirectly/patch/OpenLinksDirectlyPatch.kt @@ -16,8 +16,8 @@ import app.revanced.patches.youtube.misc.openlinksdirectly.annotations.OpenLinks import app.revanced.patches.youtube.misc.openlinksdirectly.fingerprints.OpenLinksDirectlyFingerprintPrimary import app.revanced.patches.youtube.misc.openlinksdirectly.fingerprints.OpenLinksDirectlyFingerprintSecondary import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference import org.jf.dexlib2.iface.instruction.Instruction import org.jf.dexlib2.iface.instruction.formats.Instruction11x import org.jf.dexlib2.iface.instruction.formats.Instruction35c diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/playback/fix/patch/FixPlaybackPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/playback/fix/patch/FixPlaybackPatch.kt index 9402fb2d1..c3ded142f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/playback/fix/patch/FixPlaybackPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/playback/fix/patch/FixPlaybackPatch.kt @@ -12,8 +12,8 @@ import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.playback.fix.annotations.FixPlaybackCompatibility import app.revanced.patches.youtube.misc.video.information.patch.VideoInformationPatch import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference import app.revanced.patches.youtube.misc.video.videoid.patch.VideoIdPatch @DependsOn([ diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/bytecode/patch/PlayerControlsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/bytecode/patch/PlayerControlsBytecodePatch.kt index a049a5c3b..50b3d5cf1 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/bytecode/patch/PlayerControlsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/bytecode/patch/PlayerControlsBytecodePatch.kt @@ -11,7 +11,7 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn -import app.revanced.patches.shared.mapping.patch.ResourceMappingPatch +import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.playercontrols.annotation.PlayerControlsCompatibility import app.revanced.patches.youtube.misc.playercontrols.fingerprints.BottomControlsInflateFingerprint import app.revanced.patches.youtube.misc.playercontrols.fingerprints.PlayerControlsVisibilityFingerprint diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/bytecode/patch/SettingsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/bytecode/patch/SettingsPatch.kt index 82cff22b4..9d9732ef0 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/bytecode/patch/SettingsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/bytecode/patch/SettingsPatch.kt @@ -11,15 +11,15 @@ import app.revanced.patcher.patch.PatchResult import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch +import app.revanced.patches.shared.settings.BasePreference +import app.revanced.patches.shared.settings.impl.Preference +import app.revanced.patches.shared.settings.impl.PreferenceScreen +import app.revanced.patches.shared.settings.impl.StringResource import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch import app.revanced.patches.youtube.misc.settings.annotations.SettingsCompatibility import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.LicenseActivityFingerprint import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.ThemeSetterAppFingerprint import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.ThemeSetterSystemFingerprint -import app.revanced.patches.youtube.misc.settings.framework.components.BasePreference -import app.revanced.patches.youtube.misc.settings.framework.components.impl.Preference -import app.revanced.patches.youtube.misc.settings.framework.components.impl.PreferenceScreen -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsResourcePatch import org.jf.dexlib2.util.MethodUtil import java.io.Closeable @@ -134,7 +134,7 @@ class SettingsPatch : BytecodePatch( fun addString(identifier: String, value: String, formatted: Boolean = true) = SettingsResourcePatch.addString(identifier, value, formatted) - fun addPreferenceScreen(preferenceScreen: app.revanced.patches.youtube.misc.settings.framework.components.impl.PreferenceScreen) = + fun addPreferenceScreen(preferenceScreen: app.revanced.patches.shared.settings.impl.PreferenceScreen) = SettingsResourcePatch.addPreferenceScreen(preferenceScreen) fun addPreference(preference: Preference) = diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/BasePreference.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/BasePreference.kt deleted file mode 100644 index da9e7a1e7..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/BasePreference.kt +++ /dev/null @@ -1,14 +0,0 @@ -package app.revanced.patches.youtube.misc.settings.framework.components - -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource - -/** - * Base preference class for all preferences. - * - * @param key The key of the preference. - * @param title The title of the preference. - */ -internal abstract class BasePreference( - override val key: String, - override val title: StringResource, -) : IPreference \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/ArrayResource.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/ArrayResource.kt deleted file mode 100644 index c2c60dcf2..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/ArrayResource.kt +++ /dev/null @@ -1,9 +0,0 @@ -package app.revanced.patches.youtube.misc.settings.framework.components.impl - -/** - * Represents an array resource. - * - * @param name The name of the array resource. - * @param items The items of the array resource. - */ -internal data class ArrayResource(val name: String, val items: List) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/Preference.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/Preference.kt deleted file mode 100644 index 6818b5c89..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/Preference.kt +++ /dev/null @@ -1,18 +0,0 @@ -package app.revanced.patches.youtube.misc.settings.framework.components.impl - -/** - * A Preference object. - * - * @param title The title of the preference. - * @param intent The intent of the preference. - * @param summary The summary of the text preference. - */ -internal class Preference( - val title: StringResource, - val intent: Intent, - val summary: StringResource? = null -) { - val tag: String = "Preference" - - data class Intent(val targetPackage: String, val data: String, val targetClass: String) -} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/PreferenceScreen.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/PreferenceScreen.kt deleted file mode 100644 index 9087540d3..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/PreferenceScreen.kt +++ /dev/null @@ -1,20 +0,0 @@ -package app.revanced.patches.youtube.misc.settings.framework.components.impl - -import app.revanced.patches.youtube.misc.settings.framework.components.BasePreference - -/** - * Preference screen. - * - * @param key The key of the preference. - * @param title The title of the preference. - * @param preferences Child preferences of this screen. - * @param summary The summary of the text preference. - */ -internal open class PreferenceScreen( - key: String, - title: StringResource, - val preferences: List, - var summary: StringResource? = null -) : BasePreference(key, title) { - override val tag: String = "PreferenceScreen" -} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/StringResource.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/StringResource.kt deleted file mode 100644 index 7c731cc1b..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/StringResource.kt +++ /dev/null @@ -1,10 +0,0 @@ -package app.revanced.patches.youtube.misc.settings.framework.components.impl - -/** - * Represents a string value in the strings.xml file - * - * @param name The name of the string - * @param value The value of the string - * @param formatted If the string is formatted. If false, the attribute will be set - */ -internal data class StringResource(val name: String, val value: String, val formatted: Boolean = true) diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/SwitchPreference.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/SwitchPreference.kt deleted file mode 100644 index e98d60eff..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/SwitchPreference.kt +++ /dev/null @@ -1,21 +0,0 @@ -package app.revanced.patches.youtube.misc.settings.framework.components.impl - -import app.revanced.patches.youtube.misc.settings.framework.components.BasePreference - -/** - * Switch preference. - * - * @param key The key of the switch. - * @param title The title of the switch. - * @param default The default value of the switch. - * @param summaryOn The summary to show when the preference is enabled. - * @param summaryOff The summary to show when the preference is disabled. - */ -internal class SwitchPreference( - key: String, title: StringResource, - val default: Boolean = false, - var summaryOn: StringResource? = null, - var summaryOff: StringResource? = null -) : BasePreference(key, title) { - override val tag: String = "SwitchPreference" -} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/TextPreference.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/TextPreference.kt deleted file mode 100644 index e348e3740..000000000 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/framework/components/impl/TextPreference.kt +++ /dev/null @@ -1,22 +0,0 @@ -package app.revanced.patches.youtube.misc.settings.framework.components.impl - -import app.revanced.patches.youtube.misc.settings.framework.components.BasePreference - -/** - * Text preference. - * - * @param key The key of the text preference. - * @param title The title of the text preference. - * @param inputType The input type of the text preference. - * @param default The default value of the text preference. - * @param summary The summary of the text preference. - */ -internal class TextPreference( - key: String, - title: StringResource, - var inputType: InputType = InputType.STRING, - var default: String? = null, - var summary: StringResource? = null -) : BasePreference(key, title) { - override val tag: String = "EditTextPreference" -} \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/resource/patch/SettingsResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/resource/patch/SettingsResourcePatch.kt index 80d2d749f..364701d77 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/settings/resource/patch/SettingsResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/settings/resource/patch/SettingsResourcePatch.kt @@ -9,14 +9,18 @@ import app.revanced.patcher.patch.PatchResultSuccess import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch -import app.revanced.patches.shared.mapping.patch.ResourceMappingPatch +import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch import app.revanced.patches.youtube.misc.settings.annotations.SettingsCompatibility import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.BasePreference -import app.revanced.patches.youtube.misc.settings.framework.components.impl.* +import app.revanced.patches.shared.settings.IResource +import app.revanced.patches.shared.settings.addPreference +import app.revanced.patches.shared.settings.addResource +import app.revanced.patches.shared.settings.impl.ArrayResource +import app.revanced.patches.shared.settings.impl.Preference +import app.revanced.patches.shared.settings.impl.PreferenceScreen +import app.revanced.patches.shared.settings.impl.StringResource import app.revanced.util.resources.ResourceUtils import app.revanced.util.resources.ResourceUtils.copyResources -import org.w3c.dom.Element import org.w3c.dom.Node @Name("settings-resource-patch") @@ -145,17 +149,7 @@ class SettingsResourcePatch : ResourcePatch { * @param arrayResource The array resource to add. */ fun addArray(arrayResource: ArrayResource) { - arraysNode!!.appendChild(arraysNode!!.ownerDocument.createElement("string-array").also { arrayNode -> - arrayResource.items.forEach { item -> - item.include() - - arrayNode.setAttribute("name", item.name) - - arrayNode.appendChild(arrayNode.ownerDocument.createElement("item").also { itemNode -> - itemNode.textContent = item.value - }) - } - }) + arraysNode!!.appendChild(arrayResource.serialize(arraysNode!!.ownerDocument) { it.include() }) } /** @@ -164,7 +158,7 @@ class SettingsResourcePatch : ResourcePatch { * @param preferenceScreen The name of the preference screen. */ fun addPreferenceScreen(preferenceScreen: PreferenceScreen) = - revancedPreferenceNode!!.addPreference(preferenceScreen) + revancedPreferenceNode!!.addPreference(preferenceScreen) { it.include() } /** * Add a preference fragment to the preferences. @@ -172,101 +166,34 @@ class SettingsResourcePatch : ResourcePatch { * @param preference The preference to add. */ fun addPreference(preference: Preference) { - preferencesNode!!.appendChild(preferencesNode.createElement(preference.tag).also { preferenceNode -> - preferenceNode.setAttribute( - "android:title", "@string/${preference.title.also { it.include() }.name}" - ) - preference.summary?.let { summary -> - preferenceNode.setAttribute("android:summary", "@string/${summary.also { it.include() }.name}") - } - - preferenceNode.appendChild(preferenceNode.createElement("intent").also { intentNode -> - intentNode.setAttribute("android:targetPackage", preference.intent.targetPackage) - intentNode.setAttribute("android:data", preference.intent.data) - intentNode.setAttribute("android:targetClass", preference.intent.targetClass) - }) - }) - } - - - /** - * Add a preference to the settings. - * - * @param preference The preference to add. - */ - private fun Node.addPreference(preference: BasePreference) { - // add a summary to the element - fun Element.addSummary(summaryResource: StringResource?, summaryType: SummaryType = SummaryType.DEFAULT) = - summaryResource?.let { summary -> - setAttribute("android:${summaryType.type}", "@string/${summary.also { it.include() }.name}") - } - - fun Element.addDefault(default: T) { - default?.let { - setAttribute( - "android:defaultValue", when (it) { - is Boolean -> if (it) "true" else "false" - is String -> it - else -> throw IllegalArgumentException("Unsupported default value type: ${it::class.java.name}") - } - ) - } - } - - val preferenceElement = ownerDocument.createElement(preference.tag) - preferenceElement.setAttribute("android:key", preference.key) - preferenceElement.setAttribute("android:title", "@string/${preference.title.also { it.include() }.name}") - - when (preference) { - is PreferenceScreen -> { - for (childPreference in preference.preferences) preferenceElement.addPreference(childPreference) - preferenceElement.addSummary(preference.summary) - } - is SwitchPreference -> { - preferenceElement.addDefault(preference.default) - preferenceElement.addSummary(preference.summaryOn, SummaryType.ON) - preferenceElement.addSummary(preference.summaryOff, SummaryType.OFF) - } - is TextPreference -> { - preferenceElement.setAttribute("android:inputType", preference.inputType.type) - preferenceElement.addDefault(preference.default) - preferenceElement.addSummary(preference.summary) - } - } - - appendChild(preferenceElement) + preferencesNode!!.addPreference(preference) { it.include() } } /** - * Add a new string to the resources. + * Add a new resource to the resources. * - * @throws IllegalArgumentException if the string already exists. + * @throws IllegalArgumentException if the resource already exists. */ - private fun StringResource.include() { - if (strings.any { it.name == name }) return - strings.add(this) + private fun IResource.include() { + when(this) { + is StringResource -> { + if (strings.any { it.name == name }) return + strings.add(this) + } + is ArrayResource -> addArray(this) + else -> throw NotImplementedError("Unsupported resource type") + } } private fun DomFileEditor?.getNode(tagName: String) = this!!.file.getElementsByTagName(tagName).item(0) private fun Node?.createElement(tagName: String) = this!!.ownerDocument.createElement(tagName) - - private enum class SummaryType(val type: String) { - DEFAULT("summary"), ON("summaryOn"), OFF("summaryOff") - } } override fun close() { // merge all strings, skip duplicates - strings.forEach { stringResource -> - stringsNode!!.appendChild(stringsNode!!.ownerDocument.createElement("string").also { stringElement -> - stringElement.setAttribute("name", stringResource.name) - - // if the string is un-formatted, explicitly add the formatted attribute - if (!stringResource.formatted) stringElement.setAttribute("formatted", "false") - - stringElement.textContent = stringResource.value - }) + strings.forEach { + stringsNode!!.addResource(it) } // rename the intent package names if it was set diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/video/quality/patch/RememberVideoQualityPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/video/quality/patch/RememberVideoQualityPatch.kt index a998eaf30..a0a9f6130 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/video/quality/patch/RememberVideoQualityPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/video/quality/patch/RememberVideoQualityPatch.kt @@ -18,8 +18,8 @@ import app.revanced.patches.youtube.misc.video.quality.fingerprints.VideoQuality import app.revanced.patches.youtube.misc.video.quality.fingerprints.VideoQualitySetterFingerprint import app.revanced.patches.youtube.misc.video.quality.fingerprints.VideoUserQualityChangeFingerprint import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference import app.revanced.patches.youtube.misc.video.videoid.patch.VideoIdPatch import org.jf.dexlib2.iface.instruction.ReferenceInstruction import org.jf.dexlib2.iface.reference.FieldReference diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/videobuffer/patch/CustomVideoBufferPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/videobuffer/patch/CustomVideoBufferPatch.kt index 18587ebf9..aada9f994 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/videobuffer/patch/CustomVideoBufferPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/videobuffer/patch/CustomVideoBufferPatch.kt @@ -14,10 +14,10 @@ import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.InputType -import app.revanced.patches.youtube.misc.settings.framework.components.impl.PreferenceScreen -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.TextPreference +import app.revanced.patches.shared.settings.impl.InputType +import app.revanced.patches.shared.settings.impl.PreferenceScreen +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.TextPreference import app.revanced.patches.youtube.misc.videobuffer.annotations.CustomVideoBufferCompatibility import app.revanced.patches.youtube.misc.videobuffer.fingerprints.MaxBufferFingerprint import app.revanced.patches.youtube.misc.videobuffer.fingerprints.PlaybackBufferFingerprint diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/zoomhaptics/patch/ZoomHapticsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/zoomhaptics/patch/ZoomHapticsPatch.kt index a10f59dad..c5f650dfe 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/zoomhaptics/patch/ZoomHapticsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/zoomhaptics/patch/ZoomHapticsPatch.kt @@ -13,8 +13,8 @@ import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource -import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference +import app.revanced.patches.shared.settings.impl.StringResource +import app.revanced.patches.shared.settings.impl.SwitchPreference import app.revanced.patches.youtube.misc.zoomhaptics.annotations.ZoomHapticsCompatibility import app.revanced.patches.youtube.misc.zoomhaptics.fingerprints.ZoomHapticsFingerprint diff --git a/src/main/kotlin/app/revanced/util/resources/ResourceUtils.kt b/src/main/kotlin/app/revanced/util/resources/ResourceUtils.kt index c160e788e..eb79befc3 100644 --- a/src/main/kotlin/app/revanced/util/resources/ResourceUtils.kt +++ b/src/main/kotlin/app/revanced/util/resources/ResourceUtils.kt @@ -3,7 +3,7 @@ package app.revanced.util.resources import app.revanced.patcher.data.DomFileEditor import app.revanced.patcher.data.ResourceContext import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch -import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource +import app.revanced.patches.shared.settings.impl.StringResource import org.w3c.dom.Node import java.nio.file.Files import java.nio.file.StandardCopyOption