diff --git a/src/main/kotlin/app/revanced/patches/shared/settings/preference/impl/SwitchPreference.kt b/src/main/kotlin/app/revanced/patches/shared/settings/preference/impl/SwitchPreference.kt index 78d9f1d3..2845849b 100644 --- a/src/main/kotlin/app/revanced/patches/shared/settings/preference/impl/SwitchPreference.kt +++ b/src/main/kotlin/app/revanced/patches/shared/settings/preference/impl/SwitchPreference.kt @@ -1,10 +1,7 @@ package app.revanced.patches.shared.settings.preference.impl -import app.revanced.patches.shared.settings.preference.BasePreference -import app.revanced.patches.shared.settings.preference.IResource -import app.revanced.patches.shared.settings.preference.addDefault -import app.revanced.patches.shared.settings.preference.addSummary -import app.revanced.patches.shared.settings.preference.SummaryType +import app.revanced.patches.shared.settings.preference.* +import app.revanced.patches.shared.settings.resource.patch.AbstractSettingsResourcePatch.Companion.include import org.w3c.dom.Document import org.w3c.dom.Element @@ -16,16 +13,21 @@ import org.w3c.dom.Element * @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. + * @param userDialogMessage The message to show in a dialog when the user toggles the preference. */ internal class SwitchPreference( key: String, title: StringResource, val default: Boolean = false, val summaryOn: StringResource? = null, - val summaryOff: StringResource? = null + val summaryOff: StringResource? = null, + val userDialogMessage: StringResource? = null ) : BasePreference(key, title) { override val tag: String = "SwitchPreference" override fun serialize(ownerDocument: Document, resourceCallback: ((IResource) -> Unit)?): Element { + // dialog message is stored as a regular string and later referenced by SettingsEnum + userDialogMessage?.include() + return super.serialize(ownerDocument, resourceCallback).apply { addDefault(default) addSummary(summaryOn?.also { resourceCallback?.invoke(it) }, SummaryType.ON) diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/bytecode/patch/SpoofAppVersionPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/bytecode/patch/SpoofAppVersionPatch.kt index 8c071d31..573ed5cb 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/bytecode/patch/SpoofAppVersionPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/bytecode/patch/SpoofAppVersionPatch.kt @@ -36,8 +36,11 @@ class SpoofAppVersionPatch : BytecodePatch( "revanced_spoof_app_version", StringResource("revanced_spoof_app_version_title", "Spoof app version"), false, - StringResource("revanced_spoof_app_version_summary_on", "Version spoofed to 17.30.34. If switched off, the old UI layout may remain until logging out or clearing app data"), - StringResource("revanced_spoof_app_version_summary_off", "Version not spoofed") + StringResource("revanced_spoof_app_version_summary_on", "Version spoofed to 17.30.34"), + StringResource("revanced_spoof_app_version_summary_off", "Version not spoofed"), + StringResource("revanced_spoof_app_version_user_dialog_message", + "App version will be spoofed to 17.30.34. This will give the old UI layout, but unknown side effects may occur." + + " If later turned off, the old UI layout may remain until you log out or clear the app data.") ) ) 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 b3946737..f25fdd0c 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 @@ -52,7 +52,12 @@ class DebuggingPatch : ResourcePatch { ), true, StringResource("revanced_debug_toast_on_error_summary_on", "Toast shown if error occurs"), - StringResource("revanced_debug_toast_on_error_summary_off", "Toast not shown if error occurs") + StringResource("revanced_debug_toast_on_error_summary_off", "Toast not shown if error occurs"), + StringResource("revanced_debug_toast_on_error_user_dialog_message", + "Turning off error toasts hides all ReVanced error notifications." + + " This includes hiding normal network connection timeouts, " + + "but also hides notification of any unexpected and more serious errors." + ) ), ), StringResource("revanced_debug_summary", "Enable or disable debugging options") diff --git a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/patch/SpoofSignatureVerificationPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/patch/SpoofSignatureVerificationPatch.kt index d40cf228..cc5cbe78 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/patch/SpoofSignatureVerificationPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/patch/SpoofSignatureVerificationPatch.kt @@ -45,7 +45,9 @@ class SpoofSignatureVerificationPatch : BytecodePatch( StringResource("revanced_spoof_signature_verification_title", "Spoof app signature"), true, StringResource("revanced_spoof_signature_verification_summary_on", "App signature spoofed"), - StringResource("revanced_spoof_signature_verification_summary_off", "App signature not spoofed") + StringResource("revanced_spoof_signature_verification_summary_off", "App signature not spoofed"), + StringResource("revanced_spoof_signature_verification_user_dialog_message", + "Signature spoofing can fix playback issues, but may causes side effects.") ) ) 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 eee60808..4248b677 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 @@ -18,6 +18,7 @@ import app.revanced.patches.shared.settings.resource.patch.AbstractSettingsResou import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.util.resources.ResourceUtils import app.revanced.util.resources.ResourceUtils.copyResources +import app.revanced.util.resources.ResourceUtils.mergeStrings import org.w3c.dom.Node @Name("settings-resource-patch") @@ -77,6 +78,8 @@ class SettingsResourcePatch : AbstractSettingsResourcePatch( ) ) + context.mergeStrings("settings/host/values/strings.xml") + return PatchResultSuccess() } diff --git a/src/main/resources/settings/host/values/strings.xml b/src/main/resources/settings/host/values/strings.xml new file mode 100644 index 00000000..c0740672 --- /dev/null +++ b/src/main/resources/settings/host/values/strings.xml @@ -0,0 +1,4 @@ + + + Do you wish to proceed? +