Delegate // Notifying failureFlagForUOMObservation.
Co-Authored-By: Hiraku <dev@hiraku.tw>
This commit is contained in:
parent
2dc835af62
commit
7e42dca764
|
@ -29,7 +29,7 @@ import InputMethodKit
|
||||||
|
|
||||||
@objc(AppDelegate)
|
@objc(AppDelegate)
|
||||||
class AppDelegate: NSObject, NSApplicationDelegate, ctlNonModalAlertWindowDelegate,
|
class AppDelegate: NSObject, NSApplicationDelegate, ctlNonModalAlertWindowDelegate,
|
||||||
FSEventStreamHelperDelegate
|
FSEventStreamHelperDelegate, NSUserNotificationCenterDelegate
|
||||||
{
|
{
|
||||||
func helper(_: FSEventStreamHelper, didReceive _: [FSEventStreamHelper.Event]) {
|
func helper(_: FSEventStreamHelper, didReceive _: [FSEventStreamHelper.Event]) {
|
||||||
// 拖 100ms 再重載,畢竟有些有特殊需求的使用者可能會想使用巨型自訂語彙檔案。
|
// 拖 100ms 再重載,畢竟有些有特殊需求的使用者可能會想使用巨型自訂語彙檔案。
|
||||||
|
@ -63,13 +63,25 @@ class AppDelegate: NSObject, NSApplicationDelegate, ctlNonModalAlertWindowDelega
|
||||||
fsStreamHelper.delegate = nil
|
fsStreamHelper.delegate = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func userNotificationCenter(_: NSUserNotificationCenter, shouldPresent _: NSUserNotification) -> Bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
func applicationDidFinishLaunching(_: Notification) {
|
func applicationDidFinishLaunching(_: Notification) {
|
||||||
|
NSUserNotificationCenter.default.delegate = self
|
||||||
// 一旦發現與使用者半衰模組的觀察行為有關的崩潰標記被開啟,就清空既有的半衰記憶資料檔案。
|
// 一旦發現與使用者半衰模組的觀察行為有關的崩潰標記被開啟,就清空既有的半衰記憶資料檔案。
|
||||||
if mgrPrefs.failureFlagForUOMObservation {
|
if mgrPrefs.failureFlagForUOMObservation {
|
||||||
mgrLangModel.clearUserOverrideModelData(.imeModeCHS)
|
mgrLangModel.clearUserOverrideModelData(.imeModeCHS)
|
||||||
mgrLangModel.clearUserOverrideModelData(.imeModeCHT)
|
mgrLangModel.clearUserOverrideModelData(.imeModeCHT)
|
||||||
mgrPrefs.failureFlagForUOMObservation = false
|
mgrPrefs.failureFlagForUOMObservation = false
|
||||||
|
let userNotification = NSUserNotification()
|
||||||
|
userNotification.title = NSLocalizedString("vChewing", comment: "")
|
||||||
|
userNotification.informativeText =
|
||||||
|
"\(NSLocalizedString("vChewing crashed while handling previously loaded UOM observation data. These data files are cleaned now to ensure the usability.", comment: ""))"
|
||||||
|
userNotification.soundName = NSUserNotificationDefaultSoundName
|
||||||
|
NSUserNotificationCenter.default.deliver(userNotification)
|
||||||
}
|
}
|
||||||
|
|
||||||
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now()) {
|
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now()) {
|
||||||
IME.initLangModels(userOnly: false)
|
IME.initLangModels(userOnly: false)
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,7 +201,8 @@ public enum InputState {
|
||||||
let attributedString = NSMutableAttributedString(
|
let attributedString = NSMutableAttributedString(
|
||||||
string: composingBufferConverted,
|
string: composingBufferConverted,
|
||||||
attributes: [
|
attributes: [
|
||||||
.underlineStyle: NSUnderlineStyle.thick.rawValue,
|
/// 不能用 .thick,否則會看不到游標。
|
||||||
|
.underlineStyle: NSUnderlineStyle.single.rawValue,
|
||||||
.markedClauseSegment: 0,
|
.markedClauseSegment: 0,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
@ -212,7 +213,8 @@ public enum InputState {
|
||||||
for (i, neta) in nodeValuesArray.enumerated() {
|
for (i, neta) in nodeValuesArray.enumerated() {
|
||||||
attributedString.setAttributes(
|
attributedString.setAttributes(
|
||||||
[
|
[
|
||||||
.underlineStyle: NSUnderlineStyle.thick.rawValue,
|
/// 不能用 .thick,否則會看不到游標。
|
||||||
|
.underlineStyle: NSUnderlineStyle.single.rawValue,
|
||||||
.markedClauseSegment: i,
|
.markedClauseSegment: i,
|
||||||
], range: NSRange(location: newBegin, length: neta.utf16.count)
|
], range: NSRange(location: newBegin, length: neta.utf16.count)
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"vChewing" = "vChewing";
|
||||||
|
"vChewing crashed while handling previously loaded UOM observation data. These data files are cleaned now to ensure the usability." = "vChewing crashed while handling previously loaded UOM observation data. These data files are cleaned now to ensure the usability.";
|
||||||
"About vChewing…" = "About vChewing…";
|
"About vChewing…" = "About vChewing…";
|
||||||
"vChewing Preferences…" = "vChewing Preferences…";
|
"vChewing Preferences…" = "vChewing Preferences…";
|
||||||
"Uninstallation" = "Uninstallation";
|
"Uninstallation" = "Uninstallation";
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"vChewing" = "vChewing";
|
||||||
|
"vChewing crashed while handling previously loaded UOM observation data. These data files are cleaned now to ensure the usability." = "vChewing crashed while handling previously loaded UOM observation data. These data files are cleaned now to ensure the usability.";
|
||||||
"About vChewing…" = "About vChewing…";
|
"About vChewing…" = "About vChewing…";
|
||||||
"vChewing Preferences…" = "vChewing Preferences…";
|
"vChewing Preferences…" = "vChewing Preferences…";
|
||||||
"Uninstallation" = "Uninstallation";
|
"Uninstallation" = "Uninstallation";
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"vChewing" = "威注音入力アプリ";
|
||||||
|
"vChewing crashed while handling previously loaded UOM observation data. These data files are cleaned now to ensure the usability." = "臨時記憶モジュールの観測行為による威注音入力アプリの意外中止は発生した。威注音入力アプリの無事利用のために、既存臨時記憶データは全てお消しした。";
|
||||||
"About vChewing…" = "威注音について…";
|
"About vChewing…" = "威注音について…";
|
||||||
"vChewing Preferences…" = "入力機能設定…";
|
"vChewing Preferences…" = "入力機能設定…";
|
||||||
"Uninstallation" = "入力アプリの卸除(おろしのぞき)";
|
"Uninstallation" = "入力アプリの卸除(おろしのぞき)";
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"vChewing" = "威注音输入法";
|
||||||
|
"vChewing crashed while handling previously loaded UOM observation data. These data files are cleaned now to ensure the usability." = "威注音输入法的使用者半衰记忆模组在观测时崩溃,相关半衰记忆资料档案内容已全部清空。";
|
||||||
"About vChewing…" = "关于威注音…";
|
"About vChewing…" = "关于威注音…";
|
||||||
"vChewing Preferences…" = "威注音偏好设定…";
|
"vChewing Preferences…" = "威注音偏好设定…";
|
||||||
"Uninstallation" = "卸除输入法";
|
"Uninstallation" = "卸除输入法";
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
"vChewing" = "威注音輸入法";
|
||||||
|
"vChewing crashed while handling previously loaded UOM observation data. These data files are cleaned now to ensure the usability." = "威注音輸入法的使用者半衰記憶模組在觀測時崩潰,相關半衰記憶資料檔案內容已全部清空。";
|
||||||
"About vChewing…" = "關於威注音…";
|
"About vChewing…" = "關於威注音…";
|
||||||
"vChewing Preferences…" = "威注音偏好設定…";
|
"vChewing Preferences…" = "威注音偏好設定…";
|
||||||
"Uninstallation" = "卸除輸入法";
|
"Uninstallation" = "卸除輸入法";
|
||||||
|
|
Loading…
Reference in New Issue