mgrPrefs // +showHanyuPinyinInCompositionBuffer.

This commit is contained in:
ShikiSuen 2022-05-14 17:00:44 +08:00
parent 66e016d06e
commit 94fcf061d2
1 changed files with 7 additions and 0 deletions

View File

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