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