diff --git a/SrunBar/AboutWindow.swift b/SrunBar/AboutWindow.swift
index 816e5c4..bbfb1a9 100644
--- a/SrunBar/AboutWindow.swift
+++ b/SrunBar/AboutWindow.swift
@@ -12,19 +12,21 @@ class AboutWindow: NSWindowController, NSWindowDelegate {
@IBOutlet weak var versionLabel: NSTextField!
- let version = "v0.2.8"
+ let version = UserDefaults.standard.string(forKey: "version") ?? ""
+
let link = "https://github.com/vouv/SrunBar"
override var windowNibName : String! { "AboutWindow" }
override func windowDidLoad() {
super.windowDidLoad()
- self.versionLabel?.stringValue = "SrunBar " + version
+ debugPrint("load about")
+ versionLabel?.stringValue = "SrunBar " + version
self.window?.center()
self.window?.makeKeyAndOrderFront(nil)
NSApp.activate(ignoringOtherApps: true)
}
-
+
@IBAction func linkClicked(_ sender: NSButtonCell) {
let url = URL(string: link)
NSWorkspace.shared.open(url!)
diff --git a/SrunBar/AppDelegate.swift b/SrunBar/AppDelegate.swift
index e653d1a..84c9e74 100644
--- a/SrunBar/AppDelegate.swift
+++ b/SrunBar/AppDelegate.swift
@@ -11,13 +11,14 @@ import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
+ let version = "v0.3.0"
+
func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
// check update
// 每天执行一次更新
-// let al = NSAlert.init();
-// al.messageText = "update!"
-// al.runModal()
+ let def = UserDefaults.standard
+ def.set(version, forKey: "version")
}
func applicationWillTerminate(_ aNotification: Notification) {
diff --git a/SrunBar/Base.lproj/MainMenu.xib b/SrunBar/Base.lproj/MainMenu.xib
index 6476e6a..4d55dc0 100644
--- a/SrunBar/Base.lproj/MainMenu.xib
+++ b/SrunBar/Base.lproj/MainMenu.xib
@@ -17,17 +17,22 @@
-
-
+