reset traffic api at switch display traffic at menu bar
This commit is contained in:
parent
7e06f08aad
commit
204861eb88
|
@ -146,6 +146,14 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
func setupData() {
|
func setupData() {
|
||||||
|
|
||||||
|
ConfigManager.shared
|
||||||
|
.showNetSpeedIndicatorObservable.skip(1)
|
||||||
|
.bind {
|
||||||
|
_ in
|
||||||
|
ApiRequest.shared.resetTrafficStreamApi()
|
||||||
|
}.disposed(by: disposeBag)
|
||||||
|
|
||||||
Observable
|
Observable
|
||||||
.merge([ConfigManager.shared.proxyPortAutoSetObservable,
|
.merge([ConfigManager.shared.proxyPortAutoSetObservable,
|
||||||
ConfigManager.shared.isProxySetByOtherVariable.asObservable()])
|
ConfigManager.shared.isProxySetByOtherVariable.asObservable()])
|
||||||
|
|
|
@ -261,11 +261,19 @@ extension ApiRequest {
|
||||||
|
|
||||||
extension ApiRequest {
|
extension ApiRequest {
|
||||||
func resetStreamApis() {
|
func resetStreamApis() {
|
||||||
trafficWebSocketRetryCount = 0
|
resetLogStreamApi()
|
||||||
|
resetTrafficStreamApi()
|
||||||
|
}
|
||||||
|
|
||||||
|
func resetLogStreamApi() {
|
||||||
loggingWebSocketRetryCount = 0
|
loggingWebSocketRetryCount = 0
|
||||||
requestTrafficInfo()
|
|
||||||
requestLog()
|
requestLog()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func resetTrafficStreamApi() {
|
||||||
|
trafficWebSocketRetryCount = 0
|
||||||
|
requestTrafficInfo()
|
||||||
|
}
|
||||||
|
|
||||||
private func requestTrafficInfo() {
|
private func requestTrafficInfo() {
|
||||||
trafficWebSocket?.disconnect(forceTimeout: 0, closeCode: 0)
|
trafficWebSocket?.disconnect(forceTimeout: 0, closeCode: 0)
|
||||||
|
|
|
@ -23,7 +23,7 @@ go build -ldflags '-X "github.com/Dreamacro/clash/constant.Version={version}" \
|
||||||
|
|
||||||
|
|
||||||
def write_to_info(version):
|
def write_to_info(version):
|
||||||
path = "info.plist"
|
path = "../info.plist"
|
||||||
|
|
||||||
with open(path, 'rb') as f:
|
with open(path, 'rb') as f:
|
||||||
contents = plistlib.load(f)
|
contents = plistlib.load(f)
|
||||||
|
|
Loading…
Reference in New Issue