Repo // NSApplication.shared -> NSApp.

This commit is contained in:
ShikiSuen 2022-10-12 12:10:49 +08:00
parent 08148779e5
commit 939162e08a
8 changed files with 10 additions and 10 deletions

View File

@ -50,7 +50,7 @@ extension NSApplication {
public static var isDarkMode: Bool {
if #unavailable(macOS 10.14) { return false }
if #available(macOS 10.15, *) {
let appearanceDescription = NSApplication.shared.effectiveAppearance.debugDescription
let appearanceDescription = NSApp.effectiveAppearance.debugDescription
.lowercased()
return appearanceDescription.contains("dark")
} else if let appleInterfaceStyle = UserDefaults.standard.string(forKey: "AppleInterfaceStyle") {

View File

@ -67,7 +67,7 @@ public enum Uninstaller {
if !FileManager.trashTargetIfExists(pathIMELibrary + kTargetBundle) { return -1 } // App
//
if selfKill {
NSApplication.shared.terminate(nil)
NSApp.terminate(nil)
}
return 0
}

View File

@ -114,6 +114,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
// New About Window
@IBAction func about(_: Any) {
CtlAboutWindow.show()
NSApplication.shared.activate(ignoringOtherApps: true)
NSApp.activate(ignoringOtherApps: true)
}
}

View File

@ -55,7 +55,7 @@ struct VwrPrefPaneDevZone: View {
isOn: $selUseIMKCandidateWindow.onChange {
PrefMgr.shared.useIMKCandidateWindow = selUseIMKCandidateWindow
NSLog("vChewing App self-terminated due to enabling / disabling IMK candidate window.")
NSApplication.shared.terminate(nil)
NSApp.terminate(nil)
}
)
Text(

View File

@ -88,7 +88,7 @@ struct VwrPrefPaneDictionary: View {
PrefMgr.shared.userDataFolderSpecified = newPath
tbxUserDataPathSpecified = PrefMgr.shared.userDataFolderSpecified
BookmarkManager.shared.saveBookmark(for: url)
(NSApplication.shared.delegate as! AppDelegate).updateDirectoryMonitorPath()
(NSApp.delegate as! AppDelegate).updateDirectoryMonitorPath()
} else {
IMEApp.buzz()
if !bolPreviousFolderValidity {

View File

@ -99,7 +99,7 @@ struct VwrPrefPaneGeneral: View {
UserDefaults.standard.removeObject(forKey: UserDef.kAppleLanguages.rawValue)
}
NSLog("vChewing App self-terminated due to UI language change.")
NSApplication.shared.terminate(nil)
NSApp.terminate(nil)
}
) {
Text(LocalizedStringKey("Follow OS settings")).tag(["auto"])

View File

@ -194,13 +194,13 @@ class CtlPrefWindow: NSWindowController {
}
NSLog("vChewing App self-terminated due to UI language change.")
NSApplication.shared.terminate(nil)
NSApp.terminate(nil)
}
}
@IBAction func updateIMKCandidateEnableStatusAction(_: Any) {
NSLog("vChewing App self-terminated due to enabling / disabling IMK candidate window.")
NSApplication.shared.terminate(nil)
NSApp.terminate(nil)
}
@IBAction func clickedWhetherIMEShouldNotFartToggleAction(_: Any) {
@ -260,7 +260,7 @@ class CtlPrefWindow: NSWindowController {
if LMMgr.checkIfSpecifiedUserDataFolderValid(newPath) {
PrefMgr.shared.userDataFolderSpecified = newPath
BookmarkManager.shared.saveBookmark(for: url)
(NSApplication.shared.delegate as! AppDelegate).updateDirectoryMonitorPath()
(NSApp.delegate as! AppDelegate).updateDirectoryMonitorPath()
} else {
IMEApp.buzz()
if !bolPreviousFolderValidity {

View File

@ -25,6 +25,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
// Call the New About Window
@IBAction func about(_: Any) {
CtlAboutWindow.show()
NSApplication.shared.activate(ignoringOtherApps: true)
NSApp.activate(ignoringOtherApps: true)
}
}