Delegate // Notifying failureFlagForUOMObservation.

Co-Authored-By: Hiraku <dev@hiraku.tw>
This commit is contained in:
ShikiSuen 2022-08-02 15:20:26 +08:00
parent 2dc835af62
commit 7e42dca764
7 changed files with 27 additions and 3 deletions

View File

@ -29,7 +29,7 @@ import InputMethodKit
@objc(AppDelegate)
class AppDelegate: NSObject, NSApplicationDelegate, ctlNonModalAlertWindowDelegate,
FSEventStreamHelperDelegate
FSEventStreamHelperDelegate, NSUserNotificationCenterDelegate
{
func helper(_: FSEventStreamHelper, didReceive _: [FSEventStreamHelper.Event]) {
// 100ms 使使
@ -63,13 +63,25 @@ class AppDelegate: NSObject, NSApplicationDelegate, ctlNonModalAlertWindowDelega
fsStreamHelper.delegate = nil
}
func userNotificationCenter(_: NSUserNotificationCenter, shouldPresent _: NSUserNotification) -> Bool {
return true
}
func applicationDidFinishLaunching(_: Notification) {
NSUserNotificationCenter.default.delegate = self
// 使
if mgrPrefs.failureFlagForUOMObservation {
mgrLangModel.clearUserOverrideModelData(.imeModeCHS)
mgrLangModel.clearUserOverrideModelData(.imeModeCHT)
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()) {
IME.initLangModels(userOnly: false)
}

View File

@ -201,7 +201,8 @@ public enum InputState {
let attributedString = NSMutableAttributedString(
string: composingBufferConverted,
attributes: [
.underlineStyle: NSUnderlineStyle.thick.rawValue,
/// .thick
.underlineStyle: NSUnderlineStyle.single.rawValue,
.markedClauseSegment: 0,
]
)
@ -212,7 +213,8 @@ public enum InputState {
for (i, neta) in nodeValuesArray.enumerated() {
attributedString.setAttributes(
[
.underlineStyle: NSUnderlineStyle.thick.rawValue,
/// .thick
.underlineStyle: NSUnderlineStyle.single.rawValue,
.markedClauseSegment: i,
], range: NSRange(location: newBegin, length: neta.utf16.count)
)

View File

@ -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…";
"vChewing Preferences…" = "vChewing Preferences…";
"Uninstallation" = "Uninstallation";

View File

@ -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…";
"vChewing Preferences…" = "vChewing Preferences…";
"Uninstallation" = "Uninstallation";

View File

@ -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…" = "威注音について…";
"vChewing Preferences…" = "入力機能設定…";
"Uninstallation" = "入力アプリの卸除(おろしのぞき)";

View File

@ -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…" = "关于威注音…";
"vChewing Preferences…" = "威注音偏好设定…";
"Uninstallation" = "卸除输入法";

View File

@ -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…" = "關於威注音…";
"vChewing Preferences…" = "威注音偏好設定…";
"Uninstallation" = "卸除輸入法";