mirror of
https://github.com/qinyuhang/ShadowsocksX-NG-R.git
synced 2026-10-21 23:34:14 +00:00
Add check updates at launch menu
This commit is contained in:
@@ -49,6 +49,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
||||
@IBOutlet weak var connectAtLaunchMenuItem: NSMenuItem!
|
||||
@IBOutlet weak var ShowNetworkSpeedItem: NSMenuItem!
|
||||
@IBOutlet weak var checkUpdateMenuItem: NSMenuItem!
|
||||
@IBOutlet weak var checkUpdateAtLaunchMenuItem: NSMenuItem!
|
||||
|
||||
// MARK: Variables
|
||||
var statusItemView:StatusItemView!
|
||||
@@ -456,24 +457,26 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
||||
}
|
||||
|
||||
@IBAction func feedback(_ sender: NSMenuItem) {
|
||||
NSWorkspace.shared().open(URL(string: "https://github.com/qinyuhang/ShadowsocksX-NG/issues")!)
|
||||
NSWorkspace.shared().open(URL(string: "https://github.com/shadowsocksr/ShadowsocksX-NG/issues")!)
|
||||
}
|
||||
|
||||
@IBAction func checkForUpdate(_ sender: NSMenuItem) {
|
||||
checkForUpdate(mustShowAlert: true)
|
||||
}
|
||||
|
||||
@IBAction func checkUpdatesAtLaunch(_ sender: NSMenuItem) {
|
||||
let defaults = UserDefaults.standard
|
||||
defaults.set(!defaults.bool(forKey: "AutoCheckUpdate"), forKey: "AutoCheckUpdate")
|
||||
checkUpdateAtLaunchMenuItem.state = defaults.bool(forKey: "AutoCheckUpdate") ? 1 : 0
|
||||
}
|
||||
|
||||
@IBAction func showAbout(_ sender: NSMenuItem) {
|
||||
NSApp.orderFrontStandardAboutPanel(sender);
|
||||
NSApp.activate(ignoringOtherApps: true)
|
||||
}
|
||||
|
||||
func updateLaunchAtLoginMenu() {
|
||||
if launchAtLoginController.launchAtLogin {
|
||||
lanchAtLoginMenuItem.state = 1
|
||||
} else {
|
||||
lanchAtLoginMenuItem.state = 0
|
||||
}
|
||||
lanchAtLoginMenuItem.state = launchAtLoginController.launchAtLogin ? 1 : 0
|
||||
}
|
||||
|
||||
// MARK: this function is use to update menu bar
|
||||
@@ -584,17 +587,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
||||
// statusItemView.setIcon(image!)
|
||||
}
|
||||
|
||||
if defaults.bool(forKey: "enable_showSpeed") {
|
||||
ShowNetworkSpeedItem.state = 1
|
||||
}else{
|
||||
ShowNetworkSpeedItem.state = 0
|
||||
}
|
||||
|
||||
if defaults.bool(forKey: "ConnectAtLaunch") {
|
||||
connectAtLaunchMenuItem.state = 1
|
||||
} else {
|
||||
connectAtLaunchMenuItem.state = 0
|
||||
}
|
||||
ShowNetworkSpeedItem.state = defaults.bool(forKey: "enable_showSpeed") ? 1 : 0
|
||||
connectAtLaunchMenuItem.state = defaults.bool(forKey: "ConnectAtLaunch") ? 1 : 0
|
||||
checkUpdateAtLaunchMenuItem.state = defaults.bool(forKey: "AutoCheckUpdate") ? 1 : 0
|
||||
}
|
||||
|
||||
func updateServersMenu() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="16D17a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="16E144f" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
|
||||
@@ -17,6 +17,7 @@
|
||||
<outlet property="RunningStatusMenuItem" destination="fzk-mE-CEV" id="R4x-gK-Qcw"/>
|
||||
<outlet property="ShowNetworkSpeedItem" destination="a3h-uQ-DuO" id="OLq-K8-rEO"/>
|
||||
<outlet property="autoModeMenuItem" destination="r07-Gu-aEz" id="9aH-pQ-Rgi"/>
|
||||
<outlet property="checkUpdateAtLaunchMenuItem" destination="3nJ-zQ-Agj" id="bbR-eO-uCo"/>
|
||||
<outlet property="checkUpdateMenuItem" destination="wyZ-4G-qg9" id="Sva-xA-VQY"/>
|
||||
<outlet property="connectAtLaunchMenuItem" destination="aB3-cf-5j0" id="kW6-UF-38P"/>
|
||||
<outlet property="exportAllServerProfileItem" destination="6k0-gn-DQv" id="1xA-cd-5Ia"/>
|
||||
@@ -221,6 +222,12 @@
|
||||
<action selector="checkForUpdate:" target="Voe-Tx-rLC" id="HSc-jw-aqr"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Check Updates At Launch" id="3nJ-zQ-Agj">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="checkUpdatesAtLaunch:" target="Voe-Tx-rLC" id="e2u-iJ-h5L"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="About" id="LgB-6g-Gba">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
|
||||
@@ -102,3 +102,5 @@
|
||||
"uEp-Gz-cu0.title" = "HTTP代理设置...";
|
||||
|
||||
"wyZ-4G-qg9.title" = "检查更新";
|
||||
|
||||
"3nJ-zQ-Agj.title" = "打开时检查更新";
|
||||
|
||||
Reference in New Issue
Block a user