Repo // Turn currentLM and currentUOM into dynamic var.

This commit is contained in:
ShikiSuen 2022-10-21 08:46:40 +08:00
parent 60b3fcf625
commit 9e857b80d4
3 changed files with 12 additions and 12 deletions

View File

@ -27,7 +27,7 @@ public enum LMMgr {
public private(set) static var uomCHT = vChewingLM.LMUserOverride(
dataURL: Self.userOverrideModelDataURL(.imeModeCHT))
public static func currentLM() -> vChewingLM.LMInstantiator {
public static var currentLM: vChewingLM.LMInstantiator {
switch IMEApp.currentInputMode {
case .imeModeCHS:
return Self.lmCHS
@ -38,7 +38,7 @@ public enum LMMgr {
}
}
public static func currentUOM() -> vChewingLM.LMUserOverride {
public static var currentUOM: vChewingLM.LMUserOverride {
switch IMEApp.currentInputMode {
case .imeModeCHS:
return Self.uomCHS

View File

@ -63,7 +63,7 @@ public class SessionCtl: IMKInputController {
/// 調
var inputHandler: InputHandlerProtocol = InputHandler(
lm: LMMgr.currentLM(), uom: LMMgr.currentUOM(), pref: PrefMgr.shared
lm: LMMgr.currentLM, uom: LMMgr.currentUOM, pref: PrefMgr.shared
)
///
public var state: IMEStateProtocol = IMEState.ofEmpty() {
@ -110,8 +110,8 @@ public class SessionCtl: IMKInputController {
inputHandler.clear() // handle State.Empty()
// ----------------------------
///
inputHandler.currentLM = LMMgr.currentLM() //
inputHandler.currentUOM = LMMgr.currentUOM()
inputHandler.currentLM = LMMgr.currentLM //
inputHandler.currentUOM = LMMgr.currentUOM
///
inputHandler.ensureKeyboardParser()
///
@ -241,12 +241,12 @@ extension SessionCtl {
///
public func syncBaseLMPrefs() {
LMMgr.currentLM().isPhraseReplacementEnabled = PrefMgr.shared.phraseReplacementEnabled
LMMgr.currentLM().isCNSEnabled = PrefMgr.shared.cns11643Enabled
LMMgr.currentLM().isSymbolEnabled = PrefMgr.shared.symbolInputEnabled
LMMgr.currentLM().isSCPCEnabled = PrefMgr.shared.useSCPCTypingMode
LMMgr.currentLM().isCassetteEnabled = PrefMgr.shared.cassetteEnabled
LMMgr.currentLM().deltaOfCalendarYears = PrefMgr.shared.deltaOfCalendarYears
LMMgr.currentLM.isPhraseReplacementEnabled = PrefMgr.shared.phraseReplacementEnabled
LMMgr.currentLM.isCNSEnabled = PrefMgr.shared.cns11643Enabled
LMMgr.currentLM.isSymbolEnabled = PrefMgr.shared.symbolInputEnabled
LMMgr.currentLM.isSCPCEnabled = PrefMgr.shared.useSCPCTypingMode
LMMgr.currentLM.isCassetteEnabled = PrefMgr.shared.cassetteEnabled
LMMgr.currentLM.deltaOfCalendarYears = PrefMgr.shared.deltaOfCalendarYears
}
}

View File

@ -250,7 +250,7 @@ extension SessionCtl {
? NSLocalizedString("NotificationSwitchON", comment: "")
: NSLocalizedString("NotificationSwitchOFF", comment: ""))
)
if !LMMgr.currentLM().currentCassette.isLoaded {
if !LMMgr.currentLM.currentCassette.isLoaded {
LMMgr.loadCassetteData()
}
}