feat: support set remote config update interval
# Conflicts: # ClashX.xcodeproj/project.pbxproj # ClashX/Support Files/en.lproj/Localizable.strings # ClashX/Support Files/zh-Hans.lproj/Localizable.strings
This commit is contained in:
parent
c546b3bec1
commit
4bd711be16
@ -12,6 +12,7 @@
|
||||
0AE14FF125A35685007EF89B /* AnrDetectThread.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE14FEE25A35685007EF89B /* AnrDetectThread.swift */; };
|
||||
4913C82321157D0200F6B87C /* Notification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4913C82221157D0200F6B87C /* Notification.swift */; };
|
||||
491E6203258A424D00313AEF /* CommonUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 491E61FD258A424500313AEF /* CommonUtils.m */; };
|
||||
49228457270AADE20027A4B6 /* RemoteConfigUpdateIntervalSettingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49228456270AADE20027A4B6 /* RemoteConfigUpdateIntervalSettingView.swift */; };
|
||||
4929F610258CD22E00A435F6 /* menu_icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4929F60F258CD22E00A435F6 /* menu_icon@2x.png */; };
|
||||
4929F677258CD89B00A435F6 /* Country.mmdb.gz in Resources */ = {isa = PBXBuildFile; fileRef = 4929F676258CD89B00A435F6 /* Country.mmdb.gz */; };
|
||||
4929F67F258CE04700A435F6 /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4929F67E258CE04700A435F6 /* Settings.swift */; };
|
||||
@ -131,6 +132,7 @@
|
||||
4913C82221157D0200F6B87C /* Notification.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Notification.swift; sourceTree = "<group>"; };
|
||||
491E61FC258A424500313AEF /* CommonUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonUtils.h; sourceTree = "<group>"; };
|
||||
491E61FD258A424500313AEF /* CommonUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommonUtils.m; sourceTree = "<group>"; };
|
||||
49228456270AADE20027A4B6 /* RemoteConfigUpdateIntervalSettingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoteConfigUpdateIntervalSettingView.swift; sourceTree = "<group>"; };
|
||||
4929F60F258CD22E00A435F6 /* menu_icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "menu_icon@2x.png"; sourceTree = "<group>"; };
|
||||
4929F676258CD89B00A435F6 /* Country.mmdb.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; path = Country.mmdb.gz; sourceTree = "<group>"; };
|
||||
4929F67E258CE04700A435F6 /* Settings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Settings.swift; sourceTree = "<group>"; };
|
||||
@ -358,6 +360,7 @@
|
||||
495340AF20DE5F7200B0D3FF /* StatusItemView.xib */,
|
||||
F910AA23240134AF00116E95 /* ProxyGroupMenu.swift */,
|
||||
493A9F272453E60400D35296 /* ProxyDelayHistoryMenu.swift */,
|
||||
49228456270AADE20027A4B6 /* RemoteConfigUpdateIntervalSettingView.swift */,
|
||||
);
|
||||
path = Views;
|
||||
sourceTree = "<group>";
|
||||
@ -722,6 +725,7 @@
|
||||
49722FEF211F338B00650A41 /* FileEvent.swift in Sources */,
|
||||
49D176A72355FE680093DD7B /* NetworkChangeNotifier.swift in Sources */,
|
||||
4913C82321157D0200F6B87C /* Notification.swift in Sources */,
|
||||
49228457270AADE20027A4B6 /* RemoteConfigUpdateIntervalSettingView.swift in Sources */,
|
||||
F9203A26236342820020D57D /* AppDelegate+..swift in Sources */,
|
||||
499A485C22ED793C00F6C675 /* NSView+Nib.swift in Sources */,
|
||||
493A9F282453E60400D35296 /* ProxyDelayHistoryMenu.swift in Sources */,
|
||||
|
@ -728,6 +728,10 @@ extension AppDelegate {
|
||||
@IBAction func actionUpdateRemoteConfig(_ sender: Any) {
|
||||
RemoteConfigManager.shared.updateCheck(ignoreTimeLimit: true, showNotification: true)
|
||||
}
|
||||
|
||||
@IBAction func actionSetUpdateInterval(_ sender: Any) {
|
||||
RemoteConfigManager.showAdd()
|
||||
}
|
||||
|
||||
@IBAction func actionSetUseApiMode(_ sender: Any) {
|
||||
let alert = NSAlert()
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="18122" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="19162" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="18122"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="19162"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
@ -310,6 +310,12 @@
|
||||
<action selector="actionAutoUpdateRemoteConfig:" target="Voe-Tx-rLC" id="YMu-H3-jf6"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Set update interval" id="h1H-7k-9HS">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="actionSetUpdateInterval:" target="Voe-Tx-rLC" id="sD1-ap-W4A"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
@ -671,7 +677,7 @@
|
||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||
<prototypeCellViews>
|
||||
<tableCellView identifier="urlCell" id="Nfz-jY-8Of">
|
||||
<rect key="frame" x="1" y="1" width="181" height="30"/>
|
||||
<rect key="frame" x="11" y="1" width="181" height="30"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" tag="1" translatesAutoresizingMaskIntoConstraints="NO" id="4q7-nk-ts1">
|
||||
@ -710,7 +716,7 @@
|
||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||
<prototypeCellViews>
|
||||
<tableCellView identifier="nameCell" id="nJ2-CL-UMO">
|
||||
<rect key="frame" x="185" y="1" width="86" height="17"/>
|
||||
<rect key="frame" x="195" y="1" width="86" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" tag="1" translatesAutoresizingMaskIntoConstraints="NO" id="ma1-VU-D1q">
|
||||
@ -736,7 +742,7 @@
|
||||
</tableCellView>
|
||||
</prototypeCellViews>
|
||||
</tableColumn>
|
||||
<tableColumn identifier="updateTime" width="81" minWidth="40" maxWidth="1000" id="xoc-hs-9qa">
|
||||
<tableColumn identifier="updateTime" width="52" minWidth="40" maxWidth="1000" id="xoc-hs-9qa">
|
||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Update Time">
|
||||
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
|
||||
@ -749,11 +755,11 @@
|
||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||
<prototypeCellViews>
|
||||
<tableCellView identifier="timeCell" id="EV1-my-fwa">
|
||||
<rect key="frame" x="274" y="1" width="85" height="17"/>
|
||||
<rect key="frame" x="284" y="1" width="56" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" tag="1" translatesAutoresizingMaskIntoConstraints="NO" id="giF-oe-BsQ">
|
||||
<rect key="frame" x="0.0" y="1" width="85" height="16"/>
|
||||
<rect key="frame" x="0.0" y="1" width="56" height="16"/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Never" id="X8i-uo-gQE">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
@ -906,7 +912,7 @@
|
||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||
<prototypeCellViews>
|
||||
<tableCellView identifier="nameCell" id="8mR-Pw-M5O">
|
||||
<rect key="frame" x="1" y="1" width="193" height="28"/>
|
||||
<rect key="frame" x="11" y="1" width="193" height="28"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" tag="1" translatesAutoresizingMaskIntoConstraints="NO" id="6q3-XW-4SC">
|
||||
@ -951,7 +957,7 @@
|
||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||
<prototypeCellViews>
|
||||
<tableCellView identifier="urlCell" id="hgu-Ez-7fj">
|
||||
<rect key="frame" x="197" y="1" width="188" height="28"/>
|
||||
<rect key="frame" x="207" y="1" width="188" height="28"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" tag="1" translatesAutoresizingMaskIntoConstraints="NO" id="rfv-RN-Pkz">
|
||||
@ -977,7 +983,7 @@
|
||||
</tableCellView>
|
||||
</prototypeCellViews>
|
||||
</tableColumn>
|
||||
<tableColumn identifier="secret" width="79" minWidth="40" maxWidth="1000" id="5hn-k8-CWe">
|
||||
<tableColumn identifier="secret" width="50" minWidth="40" maxWidth="1000" id="5hn-k8-CWe">
|
||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Api Secret">
|
||||
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
|
||||
@ -993,11 +999,11 @@
|
||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||
<prototypeCellViews>
|
||||
<tableCellView identifier="secretCell" id="1lj-rr-UvU">
|
||||
<rect key="frame" x="388" y="1" width="83" height="22"/>
|
||||
<rect key="frame" x="398" y="1" width="54" height="22"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" tag="1" translatesAutoresizingMaskIntoConstraints="NO" id="T9c-i1-UF2">
|
||||
<rect key="frame" x="0.0" y="3" width="83" height="16"/>
|
||||
<rect key="frame" x="0.0" y="3" width="54" height="16"/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="abcd" id="laF-Oa-HjF">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
|
@ -56,7 +56,7 @@ class RemoteConfigManager {
|
||||
|
||||
refreshActivity = NSBackgroundActivityScheduler(identifier: "com.ClashX.configupdate")
|
||||
refreshActivity?.repeats = true
|
||||
refreshActivity?.interval = 60 * 60 * 3 // Three hour
|
||||
refreshActivity?.interval = 60 * 60 * 2 // Two hour
|
||||
refreshActivity?.tolerance = 60 * 60
|
||||
|
||||
refreshActivity?.schedule { [weak self] completionHandler in
|
||||
@ -88,8 +88,7 @@ class RemoteConfigManager {
|
||||
|
||||
for config in configs {
|
||||
if config.updating { continue }
|
||||
// 48 hour check
|
||||
let timeLimitNoMantians = Date().timeIntervalSince(config.updateTime ?? Date(timeIntervalSince1970: 0)) < 60 * 60 * 48
|
||||
let timeLimitNoMantians = Date().timeIntervalSince(config.updateTime ?? Date(timeIntervalSince1970: 0)) < Settings.configAutoUpdateInterval
|
||||
|
||||
if timeLimitNoMantians && !ignoreTimeLimit {
|
||||
Logger.log("[Auto Upgrade] Bypassing \(config.name) due to time check")
|
||||
@ -215,4 +214,28 @@ class RemoteConfigManager {
|
||||
return res
|
||||
}
|
||||
}
|
||||
|
||||
static func showAdd() {
|
||||
let alertView = NSAlert()
|
||||
alertView.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
||||
alertView.addButton(withTitle: NSLocalizedString("Cancel", comment: ""))
|
||||
alertView.messageText = NSLocalizedString("Update remote config update interval", comment: "")
|
||||
let setupView = RemoteConfigUpdateIntervalSettingView()
|
||||
setupView.frame = NSRect(x: 0, y: 0, width: 100, height: 22)
|
||||
alertView.accessoryView = setupView
|
||||
let response = alertView.runModal()
|
||||
|
||||
guard response == .alertFirstButtonReturn else { return }
|
||||
let stringValue = setupView.textfield.stringValue
|
||||
guard let intValue = Int(stringValue), intValue > 0 else {
|
||||
let alert = NSAlert()
|
||||
alert.alertStyle = .critical
|
||||
alert.informativeText = NSLocalizedString("Should be a least 1 hour", comment: "")
|
||||
alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
||||
alert.runModal()
|
||||
return
|
||||
}
|
||||
Settings.configAutoUpdateInterval = TimeInterval(intValue * 60 * 60)
|
||||
RemoteConfigManager.shared.autoUpdateCheck()
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
// Copyright © 2020 west2online. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
enum Settings {
|
||||
@UserDefault("mmdbDownloadUrl", defaultValue: "")
|
||||
static var mmdbDownloadUrl:String
|
||||
@ -15,4 +16,7 @@ enum Settings {
|
||||
|
||||
@UserDefault("usePacMode", defaultValue: false)
|
||||
static var usePacMode:Bool
|
||||
|
||||
@UserDefault("configAutoUpdateInterval", defaultValue: 48*60*60)
|
||||
static var configAutoUpdateInterval:TimeInterval
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Add a remote config" = "Add a remote config";
|
||||
|
||||
@ -68,6 +67,9 @@
|
||||
/* No comment provided by engineer. */
|
||||
"Global" = "Global";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"hours" = "hours";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Install" = "Install";
|
||||
|
||||
@ -80,6 +82,8 @@
|
||||
/* No comment provided by engineer. */
|
||||
"Load Balance" = "Load Balance";
|
||||
|
||||
"Mode" = "Mode";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Need to Restart the ClashX to Take effect, Please start clashX manually" = "Need to Restart the ClashX to Take effect, Please start clashX manually";
|
||||
|
||||
@ -125,6 +129,12 @@
|
||||
/* No comment provided by engineer. */
|
||||
"Rule" = "Rule";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Script" = "Script";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Should be a least 1 hour" = "Should be a least 1 hour";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Show speedTest at top" = "Show speedTest at top";
|
||||
|
||||
@ -158,6 +168,9 @@
|
||||
/* No comment provided by engineer. */
|
||||
"Update GEOIP Database" = "Update GEOIP Database";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Update remote config update interval" = "Update remote config update interval";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Updating" = "Updating";
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Add a remote config" = "添加托管配置文件";
|
||||
|
||||
@ -68,6 +67,9 @@
|
||||
/* No comment provided by engineer. */
|
||||
"Global" = "全局";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"hours" = "小时";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Install" = "安装";
|
||||
|
||||
@ -80,6 +82,8 @@
|
||||
/* No comment provided by engineer. */
|
||||
"Load Balance" = "负载均衡";
|
||||
|
||||
"Mode" = "模式";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Need to Restart the ClashX to Take effect, Please start clashX manually" = "需要重启ClashX生效,请手动启动ClashX";
|
||||
|
||||
@ -125,6 +129,12 @@
|
||||
/* No comment provided by engineer. */
|
||||
"Rule" = "规则";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Script" = "脚本";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Should be a least 1 hour" = "至少需要1小时间隔";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Show speedTest at top" = "顶端显示测速按钮";
|
||||
|
||||
@ -158,6 +168,9 @@
|
||||
/* No comment provided by engineer. */
|
||||
"Update GEOIP Database" = "更新IP数据库";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Update remote config update interval" = "远程配置自动更新间隔";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Updating" = "更新中";
|
||||
|
||||
|
@ -1,20 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="19162" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="19162"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner"/>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<customView misplaced="YES" id="c22-O7-iKe" customClass="RemoteConfigAddView" customModule="ClashX" customModuleProvider="target">
|
||||
<customView misplaced="YES" id="c22-O7-iKe" customClass="RemoteConfigAddView" customModule="ClashX_Pro" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="338" height="54"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="xFP-JM-BeS">
|
||||
<rect key="frame" x="-2" y="3" width="87" height="17"/>
|
||||
<rect key="frame" x="-2" y="3" width="87" height="16"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" title="Config Name:" id="rjt-gw-VUT">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
@ -22,7 +22,7 @@
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2NP-oB-lQ0">
|
||||
<rect key="frame" x="88" y="32" width="250" height="22"/>
|
||||
<rect key="frame" x="88" y="31" width="250" height="22"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="250" id="jJz-ed-Kab"/>
|
||||
<constraint firstAttribute="height" constant="22" id="kdH-PF-SsK"/>
|
||||
@ -37,7 +37,7 @@
|
||||
</connections>
|
||||
</textField>
|
||||
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="j93-9X-lPb">
|
||||
<rect key="frame" x="88" y="0.0" width="250" height="22"/>
|
||||
<rect key="frame" x="88" y="0.0" width="250" height="21"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" id="wzb-HN-Y8H">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
@ -45,7 +45,7 @@
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="vtb-1g-EKX">
|
||||
<rect key="frame" x="59" y="35" width="26" height="17"/>
|
||||
<rect key="frame" x="59" y="34" width="26" height="16"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" title="Url:" id="QhQ-wR-TSQ">
|
||||
<font key="font" usesAppearanceFont="YES"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
|
40
ClashX/Views/RemoteConfigUpdateIntervalSettingView.swift
Normal file
40
ClashX/Views/RemoteConfigUpdateIntervalSettingView.swift
Normal file
@ -0,0 +1,40 @@
|
||||
//
|
||||
// RemoteConfigUpdateIntervalSettingView.swift
|
||||
// ClashX Pro
|
||||
//
|
||||
// Created by yicheng on 2021/10/4.
|
||||
// Copyright © 2021 west2online. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import AppKit
|
||||
|
||||
class RemoteConfigUpdateIntervalSettingView: NSView {
|
||||
init() {
|
||||
super.init(frame: .zero)
|
||||
setup()
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
let stackView = NSStackView()
|
||||
let textfield = NSTextField()
|
||||
func setup() {
|
||||
stackView.addArrangedSubview(textfield)
|
||||
stackView.addArrangedSubview(NSTextField(labelWithString: NSLocalizedString("hours", comment: "")))
|
||||
addSubview(stackView)
|
||||
NSLayoutConstraint.activate([
|
||||
stackView.topAnchor.constraint(equalTo: topAnchor),
|
||||
stackView.leadingAnchor.constraint(equalTo: leadingAnchor),
|
||||
stackView.trailingAnchor.constraint(equalTo: trailingAnchor),
|
||||
stackView.bottomAnchor.constraint(equalTo: bottomAnchor),
|
||||
heightAnchor.constraint(equalToConstant: 22),
|
||||
textfield.widthAnchor.constraint(greaterThanOrEqualToConstant: 50)
|
||||
])
|
||||
stackView.translatesAutoresizingMaskIntoConstraints = false
|
||||
textfield.translatesAutoresizingMaskIntoConstraints = false
|
||||
textfield.stringValue = "\(Int(Settings.configAutoUpdateInterval/3600))"
|
||||
}
|
||||
}
|
@ -1,4 +1,3 @@
|
||||
|
||||
/* Class = "NSMenuItem"; title = "ERROR"; ObjectID = "0iu-lB-eZN"; */
|
||||
"0iu-lB-eZN.title" = "ERROR";
|
||||
|
||||
@ -29,7 +28,7 @@
|
||||
/* Class = "NSMenu"; title = "Main Menu"; ObjectID = "AYu-sK-qS6"; */
|
||||
"AYu-sK-qS6.title" = "Main Menu";
|
||||
|
||||
/* Class = "NSMenu"; title = "Remote Config"; ObjectID = "az2-wz-yyy"; */
|
||||
/* Class = "NSMenu"; title = "Remote config"; ObjectID = "az2-wz-yyy"; */
|
||||
"az2-wz-yyy.title" = "托管配置";
|
||||
|
||||
/* Class = "NSMenuItem"; title = "Start at login"; ObjectID = "B1J-XB-BiZ"; */
|
||||
@ -56,7 +55,7 @@
|
||||
/* Class = "NSMenuItem"; title = "Manage"; ObjectID = "Dwg-Qb-2AU"; */
|
||||
"Dwg-Qb-2AU.title" = "管理";
|
||||
|
||||
/* Class = "NSMenuItem"; title = "Remote Config"; ObjectID = "h1C-R6-Y9w"; */
|
||||
/* Class = "NSMenuItem"; title = "Remote config"; ObjectID = "h1C-R6-Y9w"; */
|
||||
"h1C-R6-Y9w.title" = "托管配置";
|
||||
|
||||
/* Class = "NSMenuItem"; title = "About"; ObjectID = "hUb-k9-TEf"; */
|
||||
@ -190,3 +189,6 @@
|
||||
|
||||
/* Class = "NSTextFieldCell"; title = "This allows you to control the clash core running in the different machine"; ObjectID = "WkL-aX-66E"; */
|
||||
"WkL-aX-66E.title" = "远程控制器允许你控制其他设备上的 Clash 状态。";
|
||||
|
||||
/* Class = "NSMenuItem"; title = "Set update Interval"; ObjectID = "h1H-7k-9HS"; */
|
||||
"h1H-7k-9HS.title" = "设置更新间隔";
|
||||
|
Loading…
Reference in New Issue
Block a user