UpdateSputnik // Use shared instance; Fix wrong key name.
This commit is contained in:
parent
794cca4e98
commit
70f47407f9
|
@ -9,11 +9,12 @@
|
|||
import Cocoa
|
||||
|
||||
public class UpdateSputnik {
|
||||
public static var shared: UpdateSputnik = .init()
|
||||
public var varkUpdateInfoPageURLKey: String = "UpdateInfoSite"
|
||||
public var varkUpdateCheckDateKeyPrevious: String = "PreviousUpdateCheckDate"
|
||||
public var varkUpdateCheckDateKeyNext: String = "NextUpdateCheckDate"
|
||||
public var varkUpdateCheckInterval: TimeInterval = 114_514
|
||||
public var varCheckUpdateAutomatically = "ChecvarkUpdateAutomatically"
|
||||
public var varCheckUpdateAutomatically = "CheckUpdateAutomatically"
|
||||
|
||||
public init() {}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
|||
}
|
||||
}
|
||||
|
||||
public let updateSputnik = UpdateSputnik()
|
||||
public var folderMonitor = FolderMonitor(
|
||||
url: URL(fileURLWithPath: LMMgr.dataFolderPath(isDefaultFolder: false))
|
||||
)
|
||||
|
@ -56,16 +55,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
|||
|
||||
PrefMgr.shared.fixOddPreferences()
|
||||
|
||||
// 配置更新小助手
|
||||
updateSputnik.varkUpdateInfoPageURLKey = "UpdateInfoSite"
|
||||
updateSputnik.varkUpdateCheckDateKeyPrevious = "PreviousUpdateCheckDate"
|
||||
updateSputnik.varkUpdateCheckDateKeyNext = "NextUpdateCheckDate"
|
||||
updateSputnik.varkUpdateCheckInterval = 114_514
|
||||
updateSputnik.varCheckUpdateAutomatically = "ChecvarkUpdateAutomatically"
|
||||
|
||||
// 只要使用者沒有勾選檢查更新、沒有主動做出要檢查更新的操作,就不要檢查更新。
|
||||
if PrefMgr.shared.checkUpdateAutomatically {
|
||||
updateSputnik.checkForUpdate(forced: false, url: kUpdateInfoSourceURL)
|
||||
UpdateSputnik.shared.checkForUpdate(forced: false, url: kUpdateInfoSourceURL)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import PopupCompositionBuffer
|
|||
import Shared
|
||||
import ShiftKeyUpChecker
|
||||
import TooltipUI
|
||||
import UpdateSputnik
|
||||
|
||||
/// 輸入法控制模組,乃在輸入法端用以控制輸入行為的基礎型別。
|
||||
///
|
||||
|
@ -202,7 +203,7 @@ extension SessionCtl {
|
|||
}
|
||||
|
||||
DispatchQueue.main.async {
|
||||
(NSApp.delegate as? AppDelegate)?.updateSputnik.checkForUpdate(forced: false, url: kUpdateInfoSourceURL)
|
||||
UpdateSputnik.shared.checkForUpdate(forced: false, url: kUpdateInfoSourceURL)
|
||||
}
|
||||
|
||||
handle(state: IMEState.ofEmpty())
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
import NotifierUI
|
||||
import Preferences
|
||||
import UpdateSputnik
|
||||
|
||||
extension Bool {
|
||||
fileprivate var state: NSControl.StateValue {
|
||||
|
@ -316,7 +317,7 @@ extension SessionCtl {
|
|||
}
|
||||
|
||||
@objc public func checkForUpdate(_: Any?) {
|
||||
(NSApp.delegate as? AppDelegate)?.updateSputnik.checkForUpdate(forced: true, url: kUpdateInfoSourceURL)
|
||||
UpdateSputnik.shared.checkForUpdate(forced: true, url: kUpdateInfoSourceURL)
|
||||
}
|
||||
|
||||
@objc public func openUserDataFolder(_: Any?) {
|
||||
|
|
Loading…
Reference in New Issue