From 52d513c750c17214cefaafedcbe165a50e132162 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Wed, 19 Jan 2022 00:41:34 +0800 Subject: [PATCH] Zonble: Add a static func to batch clean user plist settings. Co-Authored-By: Weizhong Yang a.k.a zonble --- Source/PreferencesModule.swift | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Source/PreferencesModule.swift b/Source/PreferencesModule.swift index 779fb1f5..77a92308 100644 --- a/Source/PreferencesModule.swift +++ b/Source/PreferencesModule.swift @@ -163,6 +163,29 @@ struct ComposingBufferSize { // MARK: - @objc public class Preferences: NSObject { + static func reset() { + let defaults = UserDefaults.standard + defaults.removeObject(forKey: kKeyboardLayoutPreferenceKey) + defaults.removeObject(forKey: kBasisKeyboardLayoutPreferenceKey) + defaults.removeObject(forKey: kFunctionKeyKeyboardLayoutPreferenceKey) + defaults.removeObject(forKey: kFunctionKeyKeyboardLayoutOverrideIncludeShiftKey) + defaults.removeObject(forKey: kCandidateListTextSizeKey) + defaults.removeObject(forKey: kSelectPhraseAfterCursorAsCandidatePreferenceKey) + defaults.removeObject(forKey: kUseHorizontalCandidateListPreferenceKey) + defaults.removeObject(forKey: kComposingBufferSizePreferenceKey) + defaults.removeObject(forKey: kChooseCandidateUsingSpaceKey) + defaults.removeObject(forKey: kChineseConversionEnabledKey) + defaults.removeObject(forKey: kHalfWidthPunctuationEnabledKey) + defaults.removeObject(forKey: kEscToCleanInputBufferKey) + defaults.removeObject(forKey: kCandidateTextFontName) + defaults.removeObject(forKey: kCandidateKeyLabelFontName) + defaults.removeObject(forKey: kCandidateKeys) + defaults.removeObject(forKey: kPhraseReplacementEnabledKey) + defaults.removeObject(forKey: kChineseConversionEngineKey) + defaults.removeObject(forKey: kUseWinNT351BPMF) + defaults.removeObject(forKey: kShouldNotFartInLieuOfBeep) + } + @UserDefault(key: kKeyboardLayoutPreferenceKey, defaultValue: 0) @objc static var keyboardLayout: Int