Repo // NSApplication.shared -> NSApp.
This commit is contained in:
parent
08148779e5
commit
939162e08a
|
@ -50,7 +50,7 @@ extension NSApplication {
|
||||||
public static var isDarkMode: Bool {
|
public static var isDarkMode: Bool {
|
||||||
if #unavailable(macOS 10.14) { return false }
|
if #unavailable(macOS 10.14) { return false }
|
||||||
if #available(macOS 10.15, *) {
|
if #available(macOS 10.15, *) {
|
||||||
let appearanceDescription = NSApplication.shared.effectiveAppearance.debugDescription
|
let appearanceDescription = NSApp.effectiveAppearance.debugDescription
|
||||||
.lowercased()
|
.lowercased()
|
||||||
return appearanceDescription.contains("dark")
|
return appearanceDescription.contains("dark")
|
||||||
} else if let appleInterfaceStyle = UserDefaults.standard.string(forKey: "AppleInterfaceStyle") {
|
} else if let appleInterfaceStyle = UserDefaults.standard.string(forKey: "AppleInterfaceStyle") {
|
||||||
|
|
|
@ -67,7 +67,7 @@ public enum Uninstaller {
|
||||||
if !FileManager.trashTargetIfExists(pathIMELibrary + kTargetBundle) { return -1 } // 最後移除 App 自身
|
if !FileManager.trashTargetIfExists(pathIMELibrary + kTargetBundle) { return -1 } // 最後移除 App 自身
|
||||||
// 幹掉殘留在記憶體內的執行緒。
|
// 幹掉殘留在記憶體內的執行緒。
|
||||||
if selfKill {
|
if selfKill {
|
||||||
NSApplication.shared.terminate(nil)
|
NSApp.terminate(nil)
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,6 +114,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
||||||
// New About Window
|
// New About Window
|
||||||
@IBAction func about(_: Any) {
|
@IBAction func about(_: Any) {
|
||||||
CtlAboutWindow.show()
|
CtlAboutWindow.show()
|
||||||
NSApplication.shared.activate(ignoringOtherApps: true)
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ struct VwrPrefPaneDevZone: View {
|
||||||
isOn: $selUseIMKCandidateWindow.onChange {
|
isOn: $selUseIMKCandidateWindow.onChange {
|
||||||
PrefMgr.shared.useIMKCandidateWindow = selUseIMKCandidateWindow
|
PrefMgr.shared.useIMKCandidateWindow = selUseIMKCandidateWindow
|
||||||
NSLog("vChewing App self-terminated due to enabling / disabling IMK candidate window.")
|
NSLog("vChewing App self-terminated due to enabling / disabling IMK candidate window.")
|
||||||
NSApplication.shared.terminate(nil)
|
NSApp.terminate(nil)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
|
|
|
@ -88,7 +88,7 @@ struct VwrPrefPaneDictionary: View {
|
||||||
PrefMgr.shared.userDataFolderSpecified = newPath
|
PrefMgr.shared.userDataFolderSpecified = newPath
|
||||||
tbxUserDataPathSpecified = PrefMgr.shared.userDataFolderSpecified
|
tbxUserDataPathSpecified = PrefMgr.shared.userDataFolderSpecified
|
||||||
BookmarkManager.shared.saveBookmark(for: url)
|
BookmarkManager.shared.saveBookmark(for: url)
|
||||||
(NSApplication.shared.delegate as! AppDelegate).updateDirectoryMonitorPath()
|
(NSApp.delegate as! AppDelegate).updateDirectoryMonitorPath()
|
||||||
} else {
|
} else {
|
||||||
IMEApp.buzz()
|
IMEApp.buzz()
|
||||||
if !bolPreviousFolderValidity {
|
if !bolPreviousFolderValidity {
|
||||||
|
|
|
@ -99,7 +99,7 @@ struct VwrPrefPaneGeneral: View {
|
||||||
UserDefaults.standard.removeObject(forKey: UserDef.kAppleLanguages.rawValue)
|
UserDefaults.standard.removeObject(forKey: UserDef.kAppleLanguages.rawValue)
|
||||||
}
|
}
|
||||||
NSLog("vChewing App self-terminated due to UI language change.")
|
NSLog("vChewing App self-terminated due to UI language change.")
|
||||||
NSApplication.shared.terminate(nil)
|
NSApp.terminate(nil)
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
Text(LocalizedStringKey("Follow OS settings")).tag(["auto"])
|
Text(LocalizedStringKey("Follow OS settings")).tag(["auto"])
|
||||||
|
|
|
@ -194,13 +194,13 @@ class CtlPrefWindow: NSWindowController {
|
||||||
}
|
}
|
||||||
|
|
||||||
NSLog("vChewing App self-terminated due to UI language change.")
|
NSLog("vChewing App self-terminated due to UI language change.")
|
||||||
NSApplication.shared.terminate(nil)
|
NSApp.terminate(nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func updateIMKCandidateEnableStatusAction(_: Any) {
|
@IBAction func updateIMKCandidateEnableStatusAction(_: Any) {
|
||||||
NSLog("vChewing App self-terminated due to enabling / disabling IMK candidate window.")
|
NSLog("vChewing App self-terminated due to enabling / disabling IMK candidate window.")
|
||||||
NSApplication.shared.terminate(nil)
|
NSApp.terminate(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func clickedWhetherIMEShouldNotFartToggleAction(_: Any) {
|
@IBAction func clickedWhetherIMEShouldNotFartToggleAction(_: Any) {
|
||||||
|
@ -260,7 +260,7 @@ class CtlPrefWindow: NSWindowController {
|
||||||
if LMMgr.checkIfSpecifiedUserDataFolderValid(newPath) {
|
if LMMgr.checkIfSpecifiedUserDataFolderValid(newPath) {
|
||||||
PrefMgr.shared.userDataFolderSpecified = newPath
|
PrefMgr.shared.userDataFolderSpecified = newPath
|
||||||
BookmarkManager.shared.saveBookmark(for: url)
|
BookmarkManager.shared.saveBookmark(for: url)
|
||||||
(NSApplication.shared.delegate as! AppDelegate).updateDirectoryMonitorPath()
|
(NSApp.delegate as! AppDelegate).updateDirectoryMonitorPath()
|
||||||
} else {
|
} else {
|
||||||
IMEApp.buzz()
|
IMEApp.buzz()
|
||||||
if !bolPreviousFolderValidity {
|
if !bolPreviousFolderValidity {
|
||||||
|
|
|
@ -25,6 +25,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||||
// Call the New About Window
|
// Call the New About Window
|
||||||
@IBAction func about(_: Any) {
|
@IBAction func about(_: Any) {
|
||||||
CtlAboutWindow.show()
|
CtlAboutWindow.show()
|
||||||
NSApplication.shared.activate(ignoringOtherApps: true)
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue