diff --git a/Source/Modules/IMEModules/mgrPrefs.swift b/Source/Modules/IMEModules/mgrPrefs.swift index 1a38a935..bf345dd5 100644 --- a/Source/Modules/IMEModules/mgrPrefs.swift +++ b/Source/Modules/IMEModules/mgrPrefs.swift @@ -53,6 +53,7 @@ struct UserDef { static let kUseSCPCTypingMode = "UseSCPCTypingMode" static let kMaxCandidateLength = "MaxCandidateLength" static let kShouldNotFartInLieuOfBeep = "ShouldNotFartInLieuOfBeep" + static let kShowHanyuPinyinInCompositionBuffer = "ShowHanyuPinyinInCompositionBuffer" static let kCandidateTextFontName = "CandidateTextFontName" static let kCandidateKeyLabelFontName = "CandidateKeyLabelFontName" @@ -230,6 +231,7 @@ public class mgrPrefs: NSObject { UserDef.kUseSCPCTypingMode, UserDef.kMaxCandidateLength, UserDef.kShouldNotFartInLieuOfBeep, + UserDef.kShowHanyuPinyinInCompositionBuffer, UserDef.kAssociatedPhrasesEnabled, ] } @@ -273,6 +275,8 @@ public class mgrPrefs: NSObject { ) UserDefaults.standard.setDefault(mgrPrefs.phraseReplacementEnabled, forKey: UserDef.kPhraseReplacementEnabled) UserDefaults.standard.setDefault(mgrPrefs.shouldNotFartInLieuOfBeep, forKey: UserDef.kShouldNotFartInLieuOfBeep) + UserDefaults.standard.setDefault( + mgrPrefs.showHanyuPinyinInCompositionBuffer, forKey: UserDef.kShowHanyuPinyinInCompositionBuffer) UserDefaults.standard.synchronize() } @@ -352,6 +356,9 @@ public class mgrPrefs: NSObject { @UserDefault(key: UserDef.kShouldNotFartInLieuOfBeep, defaultValue: true) static var shouldNotFartInLieuOfBeep: Bool + @UserDefault(key: UserDef.kShowHanyuPinyinInCompositionBuffer, defaultValue: false) + static var showHanyuPinyinInCompositionBuffer: Bool + static func toggleShouldNotFartInLieuOfBeep() -> Bool { shouldNotFartInLieuOfBeep = !shouldNotFartInLieuOfBeep UserDefaults.standard.set(shouldNotFartInLieuOfBeep, forKey: UserDef.kShouldNotFartInLieuOfBeep)