Repo // Stablize the static AppDelegate instance.
This commit is contained in:
parent
c33c50d2d8
commit
e9c4f845d6
|
@ -15,6 +15,7 @@ import UpdateSputnik
|
||||||
|
|
||||||
@objc(AppDelegate)
|
@objc(AppDelegate)
|
||||||
public class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDelegate {
|
public class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDelegate {
|
||||||
|
public static let shared = AppDelegate()
|
||||||
private var folderMonitor = FolderMonitor(
|
private var folderMonitor = FolderMonitor(
|
||||||
url: URL(fileURLWithPath: LMMgr.dataFolderPath(isDefaultFolder: false))
|
url: URL(fileURLWithPath: LMMgr.dataFolderPath(isDefaultFolder: false))
|
||||||
)
|
)
|
||||||
|
|
|
@ -292,7 +292,7 @@ public extension SessionCtl {
|
||||||
|
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
UpdateSputnik.shared.checkForUpdate(forced: false, url: kUpdateInfoSourceURL)
|
UpdateSputnik.shared.checkForUpdate(forced: false, url: kUpdateInfoSourceURL)
|
||||||
(NSApp.delegate as? AppDelegate)?.checkMemoryUsage()
|
AppDelegate.shared.checkMemoryUsage()
|
||||||
}
|
}
|
||||||
|
|
||||||
state = IMEState.ofEmpty()
|
state = IMEState.ofEmpty()
|
||||||
|
|
|
@ -363,7 +363,7 @@ public extension SessionCtl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func selfUninstall(_: Any? = nil) {
|
@objc func selfUninstall(_: Any? = nil) {
|
||||||
(NSApp.delegate as? AppDelegate)?.selfUninstall()
|
AppDelegate.shared.selfUninstall()
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func selfTerminate(_: Any? = nil) {
|
@objc func selfTerminate(_: Any? = nil) {
|
||||||
|
|
|
@ -86,7 +86,7 @@ struct VwrPrefPaneDictionary: View {
|
||||||
if LMMgr.checkIfSpecifiedUserDataFolderValid(newPath) {
|
if LMMgr.checkIfSpecifiedUserDataFolderValid(newPath) {
|
||||||
userDataFolderSpecified = newPath
|
userDataFolderSpecified = newPath
|
||||||
BookmarkManager.shared.saveBookmark(for: url)
|
BookmarkManager.shared.saveBookmark(for: url)
|
||||||
(NSApp.delegate as? AppDelegate)?.updateDirectoryMonitorPath()
|
AppDelegate.shared.updateDirectoryMonitorPath()
|
||||||
} else {
|
} else {
|
||||||
IMEApp.buzz()
|
IMEApp.buzz()
|
||||||
if !bolPreviousFolderValidity {
|
if !bolPreviousFolderValidity {
|
||||||
|
|
|
@ -354,7 +354,7 @@ class CtlPrefWindow: NSWindowController, NSWindowDelegate {
|
||||||
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)
|
||||||
(NSApp.delegate as? AppDelegate)?.updateDirectoryMonitorPath()
|
AppDelegate.shared.updateDirectoryMonitorPath()
|
||||||
} else {
|
} else {
|
||||||
IMEApp.buzz()
|
IMEApp.buzz()
|
||||||
if !bolPreviousFolderValidity {
|
if !bolPreviousFolderValidity {
|
||||||
|
|
|
@ -67,7 +67,8 @@ else {
|
||||||
public let theServer = server
|
public let theServer = server
|
||||||
public let kUpdateInfoSourceURL = urlUpdateInfoSource
|
public let kUpdateInfoSourceURL = urlUpdateInfoSource
|
||||||
|
|
||||||
NSApp.run()
|
NSApplication.shared.delegate = AppDelegate.shared
|
||||||
|
_ = NSApplicationMain(CommandLine.argc, CommandLine.unsafeArgv)
|
||||||
|
|
||||||
// MARK: - Top-level Enums relating to Input Mode and Language Supports.
|
// MARK: - Top-level Enums relating to Input Mode and Language Supports.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue