From 2d44957e08cf109b9998dc30eeea2a082479a841 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Wed, 14 Sep 2022 17:12:05 +0800 Subject: [PATCH 01/10] IMKCandidates // Simplify doSet(). --- .../CandidateUI/ctlCandidateIMK.swift | 39 ++++++------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/Source/Modules/UIModules/CandidateUI/ctlCandidateIMK.swift b/Source/Modules/UIModules/CandidateUI/ctlCandidateIMK.swift index a59fd18e..3e5a0cb9 100644 --- a/Source/Modules/UIModules/CandidateUI/ctlCandidateIMK.swift +++ b/Source/Modules/UIModules/CandidateUI/ctlCandidateIMK.swift @@ -163,40 +163,23 @@ public class ctlCandidateIMK: IMKCandidates, ctlCandidateProtocol { } } - func doSet(windowTopLeftPoint: NSPoint, bottomOutOfScreenAdjustmentHeight height: CGFloat) { + func doSet(windowTopLeftPoint: NSPoint, bottomOutOfScreenAdjustmentHeight heightDelta: CGFloat) { var adjustedPoint = windowTopLeftPoint - var adjustedHeight = height - - var screenFrame = NSScreen.main?.visibleFrame ?? NSRect.seniorTheBeast - for screen in NSScreen.screens { - let frame = screen.visibleFrame - if windowTopLeftPoint.x >= frame.minX, windowTopLeftPoint.x <= frame.maxX, - windowTopLeftPoint.y >= frame.minY, windowTopLeftPoint.y <= frame.maxY - { - screenFrame = frame - break - } - } - - if adjustedHeight > screenFrame.size.height / 2.0 { adjustedHeight = 0.0 } - let windowSize = candidateFrame().size - - // bottom beneath the screen? - if adjustedPoint.y - windowSize.height < screenFrame.minY { - adjustedPoint.y = windowTopLeftPoint.y + adjustedHeight + windowSize.height + var delta = heightDelta + var screenFrame = NSScreen.main?.visibleFrame ?? NSRect.seniorTheBeast + for frame in NSScreen.screens.map(\.visibleFrame).filter({ !$0.contains(windowTopLeftPoint) }) { + screenFrame = frame + break } - // top over the screen? - if adjustedPoint.y >= screenFrame.maxY { adjustedPoint.y = screenFrame.maxY - 1.0 } + if delta > screenFrame.size.height / 2.0 { delta = 0.0 } - // right - if adjustedPoint.x + windowSize.width >= screenFrame.maxX { - adjustedPoint.x = screenFrame.maxX - windowSize.width + if adjustedPoint.y < screenFrame.minY + windowSize.height { + adjustedPoint.y = windowTopLeftPoint.y + windowSize.height + delta } - - // left - if adjustedPoint.x < screenFrame.minX { adjustedPoint.x = screenFrame.minX } + adjustedPoint.y = min(adjustedPoint.y, screenFrame.maxY - 1.0) + adjustedPoint.x = min(max(adjustedPoint.x, screenFrame.minX), screenFrame.maxX - windowSize.width - 1.0) setCandidateFrameTopLeft(adjustedPoint) } From a77b56e8d27105d54c166452fbe6ca38bab08294 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Wed, 14 Sep 2022 17:18:14 +0800 Subject: [PATCH 02/10] IME // Tweak Info.plist contents as what suggested in WWDC2006. --- Source/Resources/IME-Info.plist | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Source/Resources/IME-Info.plist b/Source/Resources/IME-Info.plist index 54a5892d..99b14976 100644 --- a/Source/Resources/IME-Info.plist +++ b/Source/Resources/IME-Info.plist @@ -90,13 +90,15 @@ InputMethodConnectionName - org.atelierInmu.inputmethod.vChewing_Connection + org_atelierInmu_inputmethod_vChewing_Connection InputMethodServerControllerClass ctlInputMethod InputMethodServerDelegateClass ctlInputMethod InputMethodServerPreferencesWindowControllerClass ctlPrefWindow + InputMethodSessionController + ctlInputMethod LSApplicationCategoryType public.app-category.utilities LSHasLocalizedDisplayName @@ -131,9 +133,10 @@ Hans Hant - Han + Hani + Hanb tsInputMethodIconFileKey - Bopomofo.tiff + MenuIcon-TCVIM.png From 5249ff5c0c7cc82f2de5d01f5ac715ec0ed7230c Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Thu, 15 Sep 2022 10:13:36 +0800 Subject: [PATCH 03/10] Repo // Remove unnecessary entitlements for app-style installer. --- vChewing.xcodeproj/project.pbxproj | 8 ++------ vChewingInstaller.entitlements | 14 -------------- 2 files changed, 2 insertions(+), 20 deletions(-) delete mode 100644 vChewingInstaller.entitlements diff --git a/vChewing.xcodeproj/project.pbxproj b/vChewing.xcodeproj/project.pbxproj index 4efbc018..aa36d838 100644 --- a/vChewing.xcodeproj/project.pbxproj +++ b/vChewing.xcodeproj/project.pbxproj @@ -227,7 +227,6 @@ 5B20430628BEE30900BFC6FD /* BookmarkManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarkManager.swift; sourceTree = ""; }; 5B20430B28BEFC0C00BFC6FD /* vChewing.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = vChewing.entitlements; sourceTree = ""; }; 5B20430C28BEFC1200BFC6FD /* vChewingPhraseEditor.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = vChewingPhraseEditor.entitlements; sourceTree = ""; }; - 5B20430D28BF279900BFC6FD /* vChewingInstaller.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = vChewingInstaller.entitlements; sourceTree = ""; }; 5B21176B287539BB000443A9 /* ctlInputMethod_HandleStates.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ctlInputMethod_HandleStates.swift; sourceTree = ""; }; 5B21176D28753B35000443A9 /* ctlInputMethod_HandleDisplay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ctlInputMethod_HandleDisplay.swift; sourceTree = ""; }; 5B21176F28753B9D000443A9 /* ctlInputMethod_Delegates.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ctlInputMethod_Delegates.swift; sourceTree = ""; }; @@ -815,7 +814,6 @@ 6A0D4E9215FC0CFA00ABF4B3 = { isa = PBXGroup; children = ( - 5B20430D28BF279900BFC6FD /* vChewingInstaller.entitlements */, 5B20430C28BEFC1200BFC6FD /* vChewingPhraseEditor.entitlements */, 5B20430B28BEFC0C00BFC6FD /* vChewing.entitlements */, 5BBD627827B6C4D900271480 /* Update-Info.plist */, @@ -1848,14 +1846,13 @@ CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_ENTITLEMENTS = vChewingInstaller.entitlements; CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 2610; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_TEAM = ""; - ENABLE_HARDENED_RUNTIME = YES; + ENABLE_HARDENED_RUNTIME = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_OBJC_EXCEPTIONS = YES; @@ -1892,14 +1889,13 @@ CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_ENTITLEMENTS = vChewingInstaller.entitlements; CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 2610; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_TEAM = ""; - ENABLE_HARDENED_RUNTIME = YES; + ENABLE_HARDENED_RUNTIME = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_TREAT_WARNINGS_AS_ERRORS = YES; diff --git a/vChewingInstaller.entitlements b/vChewingInstaller.entitlements deleted file mode 100644 index d0c50061..00000000 --- a/vChewingInstaller.entitlements +++ /dev/null @@ -1,14 +0,0 @@ - - - - - com.apple.security.files.bookmarks.app-scope - - com.apple.security.temporary-exception.files.home-relative-path.read-write - - /Library/Input Methods/ - - com.apple.security.temporary-exception.shared-preference.read-write - org.atelierInmu.vChewing.vChewingInstaller - - From 1909e85a0236fd22ec156fd8090fe0b06a61bea9 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Thu, 15 Sep 2022 11:17:07 +0800 Subject: [PATCH 04/10] Voltaire & Tooltip & PCB, etc. // Fix NSWindow positioning. --- Source/Modules/UIModules/CandidateUI/ctlCandidate.swift | 2 +- Source/Modules/UIModules/CandidateUI/ctlCandidateIMK.swift | 2 +- .../PopupCompositionBufferUI/ctlPopupCompositionBuffer.swift | 2 +- Source/Modules/UIModules/TooltipUI/ctlTooltip.swift | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Modules/UIModules/CandidateUI/ctlCandidate.swift b/Source/Modules/UIModules/CandidateUI/ctlCandidate.swift index 73d81745..06a68973 100644 --- a/Source/Modules/UIModules/CandidateUI/ctlCandidate.swift +++ b/Source/Modules/UIModules/CandidateUI/ctlCandidate.swift @@ -161,7 +161,7 @@ public class ctlCandidate: NSWindowController, ctlCandidateProtocol { var adjustedPoint = windowTopLeftPoint var delta = heightDelta var screenFrame = NSScreen.main?.visibleFrame ?? NSRect.seniorTheBeast - for frame in NSScreen.screens.map(\.visibleFrame).filter({ !$0.contains(windowTopLeftPoint) }) { + for frame in NSScreen.screens.map(\.visibleFrame).filter({ $0.contains(windowTopLeftPoint) }) { screenFrame = frame break } diff --git a/Source/Modules/UIModules/CandidateUI/ctlCandidateIMK.swift b/Source/Modules/UIModules/CandidateUI/ctlCandidateIMK.swift index 3e5a0cb9..4189f7a8 100644 --- a/Source/Modules/UIModules/CandidateUI/ctlCandidateIMK.swift +++ b/Source/Modules/UIModules/CandidateUI/ctlCandidateIMK.swift @@ -168,7 +168,7 @@ public class ctlCandidateIMK: IMKCandidates, ctlCandidateProtocol { let windowSize = candidateFrame().size var delta = heightDelta var screenFrame = NSScreen.main?.visibleFrame ?? NSRect.seniorTheBeast - for frame in NSScreen.screens.map(\.visibleFrame).filter({ !$0.contains(windowTopLeftPoint) }) { + for frame in NSScreen.screens.map(\.visibleFrame).filter({ $0.contains(windowTopLeftPoint) }) { screenFrame = frame break } diff --git a/Source/Modules/UIModules/PopupCompositionBufferUI/ctlPopupCompositionBuffer.swift b/Source/Modules/UIModules/PopupCompositionBufferUI/ctlPopupCompositionBuffer.swift index a63bef92..c1f6444f 100644 --- a/Source/Modules/UIModules/PopupCompositionBufferUI/ctlPopupCompositionBuffer.swift +++ b/Source/Modules/UIModules/PopupCompositionBufferUI/ctlPopupCompositionBuffer.swift @@ -146,7 +146,7 @@ public class ctlPopupCompositionBuffer: NSWindowController { var adjustedPoint = windowOrigin var screenFrame = NSScreen.main?.visibleFrame ?? NSRect.seniorTheBeast - for frame in NSScreen.screens.map(\.visibleFrame).filter({ !$0.contains(windowOrigin) }) { + for frame in NSScreen.screens.map(\.visibleFrame).filter({ $0.contains(windowOrigin) }) { screenFrame = frame break } diff --git a/Source/Modules/UIModules/TooltipUI/ctlTooltip.swift b/Source/Modules/UIModules/TooltipUI/ctlTooltip.swift index bf5236ed..dc5e6f01 100644 --- a/Source/Modules/UIModules/TooltipUI/ctlTooltip.swift +++ b/Source/Modules/UIModules/TooltipUI/ctlTooltip.swift @@ -130,7 +130,7 @@ public class ctlTooltip: NSWindowController { var adjustedPoint = windowTopLeftPoint var delta = heightDelta var screenFrame = NSScreen.main?.visibleFrame ?? NSRect.seniorTheBeast - for frame in NSScreen.screens.map(\.visibleFrame).filter({ !$0.contains(windowTopLeftPoint) }) { + for frame in NSScreen.screens.map(\.visibleFrame).filter({ $0.contains(windowTopLeftPoint) }) { screenFrame = frame break } From bd7bb02b5bb960ac6c3a3477c96fb61118162df2 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Thu, 15 Sep 2022 10:38:56 +0800 Subject: [PATCH 05/10] AppDelegate // Stop crashing vChewing on fresh installation. --- Source/Modules/AppDelegate.swift | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Source/Modules/AppDelegate.swift b/Source/Modules/AppDelegate.swift index 19fce5a2..4e332945 100644 --- a/Source/Modules/AppDelegate.swift +++ b/Source/Modules/AppDelegate.swift @@ -28,7 +28,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele private var ctlClientListMgrInstance: ctlClientListMgr? private var ctlPrefWindowInstance: ctlPrefWindow? private var ctlAboutWindowInstance: ctlAboutWindow? // New About Window - public lazy var folderMonitor = FolderMonitor( + public var folderMonitor = FolderMonitor( url: URL(fileURLWithPath: mgrLangModel.dataFolderPath(isDefaultFolder: false)) ) private var currentAlertType: String = "" @@ -54,13 +54,14 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele DispatchQueue.main.asyncAfter(deadline: DispatchTime.now()) { IME.initLangModels(userOnly: false) + self.folderMonitor.folderDidChange = { [weak self] in + self?.reloadOnFolderChangeHappens() + } + if mgrLangModel.userDataFolderExists { + self.folderMonitor.startMonitoring() + } } - folderMonitor.folderDidChange = { [weak self] in - self?.reloadOnFolderChangeHappens() - } - folderMonitor.startMonitoring() - mgrPrefs.fixOddPreferences() mgrPrefs.setMissingDefaults() @@ -78,7 +79,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele folderMonitor.folderDidChange = { [weak self] in self?.reloadOnFolderChangeHappens() } - folderMonitor.startMonitoring() + if mgrLangModel.userDataFolderExists { + folderMonitor.startMonitoring() + } } func showClientListMgr() { From d279e52c75baed812bbbe5714094a3703b4d9c06 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Thu, 15 Sep 2022 11:58:03 +0800 Subject: [PATCH 06/10] ctlIME // Optimize notification texts for Alphanumerical mode toggle. --- Source/Modules/ControllerModules/ctlInputMethod_Core.swift | 7 +++---- Source/Resources/Base.lproj/Localizable.strings | 3 ++- Source/Resources/en.lproj/Localizable.strings | 3 ++- Source/Resources/ja.lproj/Localizable.strings | 3 ++- Source/Resources/zh-Hans.lproj/Localizable.strings | 3 ++- Source/Resources/zh-Hant.lproj/Localizable.strings | 3 ++- 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Source/Modules/ControllerModules/ctlInputMethod_Core.swift b/Source/Modules/ControllerModules/ctlInputMethod_Core.swift index 880c3dc2..5d39c5fa 100644 --- a/Source/Modules/ControllerModules/ctlInputMethod_Core.swift +++ b/Source/Modules/ControllerModules/ctlInputMethod_Core.swift @@ -231,10 +231,9 @@ class ctlInputMethod: IMKInputController { if ShiftKeyUpChecker.check(event), !mgrPrefs.disableShiftTogglingAlphanumericalMode { if !shouldUseShiftToggleHandle || (!rencentKeyHandledByKeyHandlerEtc && shouldUseShiftToggleHandle) { NotifierController.notify( - message: NSLocalizedString("Alphanumerical Mode", comment: "") + "\n" - + (toggleASCIIMode() - ? NSLocalizedString("NotificationSwitchON", comment: "") - : NSLocalizedString("NotificationSwitchOFF", comment: "")) + message: toggleASCIIMode() + ? NSLocalizedString("Alphanumerical Input Mode", comment: "") + : NSLocalizedString("Chinese Input Mode", comment: "") ) } if shouldUseShiftToggleHandle { diff --git a/Source/Resources/Base.lproj/Localizable.strings b/Source/Resources/Base.lproj/Localizable.strings index dd952131..c357bc1e 100644 --- a/Source/Resources/Base.lproj/Localizable.strings +++ b/Source/Resources/Base.lproj/Localizable.strings @@ -1,4 +1,6 @@ "vChewing" = "vChewing"; +"Alphanumerical Input Mode" = "Alphanumerical Input Mode"; +"Chinese Input Mode" = "Chinese Input Mode"; "Please enter the client app bundle identifier(s) you want to register." = "Please enter the client app bundle identifier(s) you want to register."; "One record per line. Use Option+Enter to break lines.\nBlank lines will be dismissed." = "One record per line. Use Option+Enter to break lines.\nBlank lines will be dismissed."; "Just Select" = "Just Select"; @@ -68,7 +70,6 @@ "zh-Hans" = "Simplified Chinese"; "zh-Hant" = "Traditional Chinese"; "ja" = "Japanese"; -"Alphanumerical Input Mode" = "Alphanumerical Input Mode"; "Apple Zhuyin Bopomofo (Dachen)" = "Apple Zhuyin Bopomofo (Standard)"; "Apple Zhuyin Eten (Traditional)" = "Apple Zhuyin Eten (Traditional)"; "Symbol & Emoji Input" = "Symbol & Emoji Input"; diff --git a/Source/Resources/en.lproj/Localizable.strings b/Source/Resources/en.lproj/Localizable.strings index dd952131..c357bc1e 100644 --- a/Source/Resources/en.lproj/Localizable.strings +++ b/Source/Resources/en.lproj/Localizable.strings @@ -1,4 +1,6 @@ "vChewing" = "vChewing"; +"Alphanumerical Input Mode" = "Alphanumerical Input Mode"; +"Chinese Input Mode" = "Chinese Input Mode"; "Please enter the client app bundle identifier(s) you want to register." = "Please enter the client app bundle identifier(s) you want to register."; "One record per line. Use Option+Enter to break lines.\nBlank lines will be dismissed." = "One record per line. Use Option+Enter to break lines.\nBlank lines will be dismissed."; "Just Select" = "Just Select"; @@ -68,7 +70,6 @@ "zh-Hans" = "Simplified Chinese"; "zh-Hant" = "Traditional Chinese"; "ja" = "Japanese"; -"Alphanumerical Input Mode" = "Alphanumerical Input Mode"; "Apple Zhuyin Bopomofo (Dachen)" = "Apple Zhuyin Bopomofo (Standard)"; "Apple Zhuyin Eten (Traditional)" = "Apple Zhuyin Eten (Traditional)"; "Symbol & Emoji Input" = "Symbol & Emoji Input"; diff --git a/Source/Resources/ja.lproj/Localizable.strings b/Source/Resources/ja.lproj/Localizable.strings index 454f6e6e..3b4f2c45 100644 --- a/Source/Resources/ja.lproj/Localizable.strings +++ b/Source/Resources/ja.lproj/Localizable.strings @@ -1,4 +1,6 @@ "vChewing" = "威注音入力アプリ"; +"Alphanumerical Input Mode" = "英數入力モード"; +"Chinese Input Mode" = "漢語入力モード"; "Please enter the client app bundle identifier(s) you want to register." = "登録したい客体アプリの唯一識別子(Bundle Identifier)をご入力ください。"; "One record per line. Use Option+Enter to break lines.\nBlank lines will be dismissed." = "毎行は1つ記録とみなす。Option+Enter キーで改行。\n空白の記録値は無視される。"; "Just Select" = "直接に選ぶ"; @@ -68,7 +70,6 @@ "zh-Hans" = "簡體中国語"; "zh-Hant" = "繁體中国語"; "ja" = "和語"; -"Alphanumerical Input Mode" = "英数入力モード"; "Apple Zhuyin Bopomofo (Dachen)" = "Apple 注音ボポモフォ(大千標準)"; "Apple Zhuyin Eten (Traditional)" = "Apple 注音ボポモフォ(倚天伝統)"; "Symbol & Emoji Input" = "符号&絵文字入力"; diff --git a/Source/Resources/zh-Hans.lproj/Localizable.strings b/Source/Resources/zh-Hans.lproj/Localizable.strings index 5c983e90..208ac07e 100644 --- a/Source/Resources/zh-Hans.lproj/Localizable.strings +++ b/Source/Resources/zh-Hans.lproj/Localizable.strings @@ -1,4 +1,6 @@ "vChewing" = "威注音输入法"; +"Alphanumerical Input Mode" = "英数输入模式"; +"Chinese Input Mode" = "中文输入模式"; "Please enter the client app bundle identifier(s) you want to register." = "请键入您要登记的客体应用的唯一标帜(Bundle Identifier)。"; "One record per line. Use Option+Enter to break lines.\nBlank lines will be dismissed." = "每行一笔记录,用 Option+Enter 换行。\n空白值会被无视。"; "Just Select" = "直接选取"; @@ -68,7 +70,6 @@ "zh-Hans" = "简体中文"; "zh-Hant" = "繁体中文"; "ja" = "和文"; -"Alphanumerical Input Mode" = "原生英数输入模式"; "Apple Zhuyin Bopomofo (Dachen)" = "Apple 标准注音键盘布局 (大千)"; "Apple Zhuyin Eten (Traditional)" = "Apple 倚天注音键盘布局 (传统)"; "Symbol & Emoji Input" = "符号&绘文字输入"; diff --git a/Source/Resources/zh-Hant.lproj/Localizable.strings b/Source/Resources/zh-Hant.lproj/Localizable.strings index 8fc5a76b..2206b502 100644 --- a/Source/Resources/zh-Hant.lproj/Localizable.strings +++ b/Source/Resources/zh-Hant.lproj/Localizable.strings @@ -1,4 +1,6 @@ "vChewing" = "威注音輸入法"; +"Alphanumerical Input Mode" = "英數輸入模式"; +"Chinese Input Mode" = "中文輸入模式"; "Please enter the client app bundle identifier(s) you want to register." = "請鍵入您要登記的客體應用的唯一標幟(Bundle Identifier)。"; "One record per line. Use Option+Enter to break lines.\nBlank lines will be dismissed." = "每行一筆記錄,用 Option+Enter 換行。\n空白值會被無視。"; "Just Select" = "直接選取"; @@ -68,7 +70,6 @@ "zh-Hans" = "簡體中文"; "zh-Hant" = "繁體中文"; "ja" = "和文"; -"Alphanumerical Input Mode" = "原生英數輸入模式"; "Apple Zhuyin Bopomofo (Dachen)" = "Apple 標準注音鍵盤佈局 (大千)"; "Apple Zhuyin Eten (Traditional)" = "Apple 倚天注音鍵盤佈局 (傳統)"; "Symbol & Emoji Input" = "符號&繪文字輸入"; From 8dd225d627ff1d66cab4306916ba87eea7aec204 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Thu, 15 Sep 2022 13:43:54 +0800 Subject: [PATCH 07/10] Repo // Some preparation work memos for future development. --- .gitignore | 1 + vChewing.xcodeproj/project.pbxproj | 33 ++++++++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index f796cba3..110c2978 100644 --- a/.gitignore +++ b/.gitignore @@ -175,6 +175,7 @@ FakesAssemblies/ Generated\ Files/ Generated_Code/ Icon +Installer/PKGRoot/ install-sh ipch/ Makefile.in diff --git a/vChewing.xcodeproj/project.pbxproj b/vChewing.xcodeproj/project.pbxproj index aa36d838..40290427 100644 --- a/vChewing.xcodeproj/project.pbxproj +++ b/vChewing.xcodeproj/project.pbxproj @@ -475,6 +475,13 @@ path = SubLMs; sourceTree = ""; }; + 5B44B97C28D2F283004508BF /* PKGRoot */ = { + isa = PBXGroup; + children = ( + ); + path = PKGRoot; + sourceTree = ""; + }; 5B5F8AEC28C86AB3007C11F1 /* NSAttributedTextView */ = { isa = PBXGroup; children = ( @@ -897,6 +904,7 @@ 6ACA41E715FC1D9000935EF6 /* Installer */ = { isa = PBXGroup; children = ( + 5B44B97C28D2F283004508BF /* PKGRoot */, 6A225A1E23679F2600F685C6 /* NotarizedArchives */, 5BBBB77827AEDB330023B93A /* Resources */, D4F0BBE0279AF8B30071253C /* AppDelegate.swift */, @@ -959,9 +967,10 @@ buildPhases = ( 6A0D4E9E15FC0D2D00ABF4B3 /* Sources */, 6A0D4E9F15FC0D2D00ABF4B3 /* Frameworks */, - 5B9A5A00285184BB001FFCAF /* ShellScript */, + 5B9A5A00285184BB001FFCAF /* Run Script (Build Dictionary Data) */, 6A0D4EA015FC0D2D00ABF4B3 /* Resources */, 5BDC5CBE27C28E8B00E1CCE2 /* Embed Foundation Extensions */, + 5B6F882E28D2F49F004EF52F /* Run Script (Build PKG Installer) */, ); buildRules = ( ); @@ -1127,7 +1136,26 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 5B9A5A00285184BB001FFCAF /* ShellScript */ = { + 5B6F882E28D2F49F004EF52F /* Run Script (Build PKG Installer) */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Run Script (Build PKG Installer)"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/zsh; + shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n# cd \"${SRCROOT}/\"\n# mkdir -p \"${SRCROOT}/Installer/PKGRoot/Library/Input Methods/\"\n# mkdir -p \"${SRCROOT}/Installer/PKGRoot/Library/Keyboard Layouts/\"\n# cp -a \"${BUILD_DIR}/Release/vChewing.app\" \"${SRCROOT}/Installer/PKGRoot/Library/Input Methods/\"\n# cp -a ${SRCROOT}/KeyboardExtension/vChewingKeyLayout.bundle \"${SRCROOT}/Installer/PKGRoot/Library/Keyboard Layouts/\"\n# cp -a ${SRCROOT}/KeyboardExtension/vChewingKeyLayout.bundle/Contents/Resources/vChewing*.keylayout \"${SRCROOT}/Installer/PKGRoot/Library/Keyboard Layouts/\"\n"; + }; + 5B9A5A00285184BB001FFCAF /* Run Script (Build Dictionary Data) */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -1153,6 +1181,7 @@ "$(SRCROOT)/Source/Data/components/common/data-zhuyinwen.txt", "$(SRCROOT)/Source/Data/components/common/phone-header.txt", ); + name = "Run Script (Build Dictionary Data)"; outputFileListPaths = ( ); outputPaths = ( From 5badd9837e88a54eca98dc4ce9df399ed5d53c28 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Thu, 15 Sep 2022 14:44:03 +0800 Subject: [PATCH 08/10] PKG // Do not run certain postflight script content since macOS 12. --- Installer/pkgPostInstall.sh | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/Installer/pkgPostInstall.sh b/Installer/pkgPostInstall.sh index 8e8df3ae..adbb0cff 100644 --- a/Installer/pkgPostInstall.sh +++ b/Installer/pkgPostInstall.sh @@ -3,18 +3,22 @@ TARGET='vChewing' login_user=$(/usr/bin/stat -f%Su /dev/console) -# First, copy the wrongfully installed contents to the right location: -cp -r /Library/Input\ Methods/"${TARGET}".app /Users/"${login_user}"/Library/Input\ Methods/ || true -cp -r /Library/Keyboard\ Layouts/"${TARGET}"* /Users/"${login_user}"/Library/Keyboard\ Layouts/ || true -chown "${login_user}" /Users/"${login_user}"/Library/Input\ Methods/"${TARGET}".app || true -chown "${login_user}" /Users/"${login_user}"/Library/Keyboard\ Layouts/"${TARGET}"* || true +base_ver=12.0 +ver=$(sw_vers | grep ProductVersion | cut -d':' -f2 | tr -d ' ') +if [ $(echo -e $base_ver"\n"$ver | sort -V | tail -1) == "$base_ver" ] +then + # Copy the wrongfully installed contents to the right location: + cp -r /Library/Input\ Methods/"${TARGET}".app /Users/"${login_user}"/Library/Input\ Methods/ || true + cp -r /Library/Keyboard\ Layouts/"${TARGET}"* /Users/"${login_user}"/Library/Keyboard\ Layouts/ || true -sleep 1 - -# Second, clean the wrongfully installed contents: -rm -rf /Library/Input\ Methods/"${TARGET}".app || true -rm -rf /Library/Keyboard\ Layouts/"${TARGET}"* || true -sleep 1 + # Clean the wrongfully installed contents: + chown "${login_user}" /Users/"${login_user}"/Library/Input\ Methods/"${TARGET}".app || true + chown "${login_user}" /Users/"${login_user}"/Library/Keyboard\ Layouts/"${TARGET}"* || true + sleep 1 + rm -rf /Library/Input\ Methods/"${TARGET}".app || true + rm -rf /Library/Keyboard\ Layouts/"${TARGET}"* || true + sleep 1 +fi # Finally, register the input method: /Users/"${login_user}"/Library/Input\ Methods/"${TARGET}".app/Contents/MacOS/"${TARGET}" install --all || true From 067a7486ebf761bccd450154e1b710f0de303d29 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Thu, 15 Sep 2022 12:09:47 +0800 Subject: [PATCH 09/10] Update Data - 20220915 --- Source/Data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Data b/Source/Data index c5b2fe7f..e3277eaf 160000 --- a/Source/Data +++ b/Source/Data @@ -1 +1 @@ -Subproject commit c5b2fe7f08971cf2719f553de9de967097bd56b6 +Subproject commit e3277eaff3592b356f76f50362de56bdf6ed927c From be46d1bd26decdf7245dde5e715a2fe5a30ef7b9 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Thu, 15 Sep 2022 12:12:05 +0800 Subject: [PATCH 10/10] Bump version to 2.6.2 Build 2620. --- Update-Info.plist | 4 ++-- vChewing.pkgproj | 2 +- vChewing.xcodeproj/project.pbxproj | 32 +++++++++++++++--------------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Update-Info.plist b/Update-Info.plist index 653bb0ac..3f1a6f1c 100644 --- a/Update-Info.plist +++ b/Update-Info.plist @@ -3,9 +3,9 @@ CFBundleShortVersionString - 2.6.1 + 2.6.2 CFBundleVersion - 2610 + 2620 UpdateInfoEndpoint https://gitee.com/vchewing/vChewing-macOS/raw/main/Update-Info.plist UpdateInfoSite diff --git a/vChewing.pkgproj b/vChewing.pkgproj index 2d496215..2bace737 100644 --- a/vChewing.pkgproj +++ b/vChewing.pkgproj @@ -726,7 +726,7 @@ USE_HFS+_COMPRESSION VERSION - 2.6.1 + 2.6.2 TYPE 0 diff --git a/vChewing.xcodeproj/project.pbxproj b/vChewing.xcodeproj/project.pbxproj index 40290427..5a24bb64 100644 --- a/vChewing.xcodeproj/project.pbxproj +++ b/vChewing.xcodeproj/project.pbxproj @@ -1510,7 +1510,7 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2610; + CURRENT_PROJECT_VERSION = 2620; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_PREPROCESSOR_DEFINITIONS = ( @@ -1520,7 +1520,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 2.6.1; + MARKETING_VERSION = 2.6.2; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = org.atelierInmu.vChewingTests; @@ -1549,13 +1549,13 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2610; + CURRENT_PROJECT_VERSION = 2620; ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 2.6.1; + MARKETING_VERSION = 2.6.2; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = org.atelierInmu.vChewingTests; @@ -1587,7 +1587,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2610; + CURRENT_PROJECT_VERSION = 2620; DEAD_CODE_STRIPPING = YES; ENABLE_HARDENED_RUNTIME = YES; GCC_C_LANGUAGE_STANDARD = gnu11; @@ -1609,7 +1609,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MARKETING_VERSION = 2.6.1; + MARKETING_VERSION = 2.6.2; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = org.atelierInmu.vChewing.vChewingPhraseEditor; @@ -1639,7 +1639,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2610; + CURRENT_PROJECT_VERSION = 2620; DEAD_CODE_STRIPPING = YES; ENABLE_HARDENED_RUNTIME = YES; ENABLE_NS_ASSERTIONS = NO; @@ -1657,7 +1657,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MARKETING_VERSION = 2.6.1; + MARKETING_VERSION = 2.6.2; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = org.atelierInmu.vChewing.vChewingPhraseEditor; @@ -1773,7 +1773,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2610; + CURRENT_PROJECT_VERSION = 2620; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = ""; @@ -1802,7 +1802,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MARKETING_VERSION = 2.6.1; + MARKETING_VERSION = 2.6.2; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = org.atelierInmu.inputmethod.vChewing; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -1832,7 +1832,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2610; + CURRENT_PROJECT_VERSION = 2620; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = ""; @@ -1855,7 +1855,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MARKETING_VERSION = 2.6.1; + MARKETING_VERSION = 2.6.2; PRODUCT_BUNDLE_IDENTIFIER = org.atelierInmu.inputmethod.vChewing; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -1878,7 +1878,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2610; + CURRENT_PROJECT_VERSION = 2620; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = NO; @@ -1899,7 +1899,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MARKETING_VERSION = 2.6.1; + MARKETING_VERSION = 2.6.2; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = org.atelierInmu.vChewing.vChewingInstaller; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -1921,7 +1921,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2610; + CURRENT_PROJECT_VERSION = 2620; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = NO; @@ -1936,7 +1936,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MARKETING_VERSION = 2.6.1; + MARKETING_VERSION = 2.6.2; PRODUCT_BUNDLE_IDENTIFIER = org.atelierInmu.vChewing.vChewingInstaller; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = "";