Merge remote-tracking branch 'origin/master' into meta-dev
# Conflicts: # .github/workflows/main.yml # ClashX/AppDelegate.swift # ClashX/Base.lproj/Main.storyboard # ClashX/General/ApiRequest.swift # ClashX/Models/ClashProxy.swift # ClashX/ViewControllers/Settings/GeneralSettingViewController.swift # ClashX/goClash/go.mod # ClashX/goClash/go.sum # ClashX/goClash/main.go # Podfile # Podfile.lock
This commit is contained in:
commit
2589b28eed
|
@ -73,8 +73,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||
var dashboardWindowController: ClashWebViewWindowController?
|
||||
|
||||
func applicationWillFinishLaunching(_ notification: Notification) {
|
||||
Logger.log("applicationWillFinishLaunching")
|
||||
signal(SIGPIPE, SIG_IGN)
|
||||
// crash recorder
|
||||
failLaunchProtect()
|
||||
NSAppleEventManager.shared()
|
||||
.setEventHandler(self,
|
||||
|
@ -103,13 +103,13 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||
|
||||
statusItemView.updateSize(width: statusItemLengthWithSpeed)
|
||||
statusMenu.delegate = self
|
||||
registCrashLogger()
|
||||
DispatchQueue.main.async {
|
||||
self.postFinishLaunching()
|
||||
}
|
||||
}
|
||||
|
||||
func postFinishLaunching() {
|
||||
Logger.log("postFinishLaunching")
|
||||
defer {
|
||||
statusItem.menu = statusMenu
|
||||
DispatchQueue.main.asyncAfter(deadline: .now()+1) {
|
||||
|
@ -144,6 +144,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||
RemoteConfigManager.shared.autoUpdateCheck()
|
||||
|
||||
setupNetworkNotifier()
|
||||
registCrashLogger()
|
||||
}
|
||||
|
||||
func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply {
|
||||
|
@ -1420,7 +1421,8 @@ extension AppDelegate {
|
|||
#else
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 5) {
|
||||
AppCenter.start(withAppSecret: "dce6e9a3-b6e3-4fd2-9f2d-35c767a99663", services: [
|
||||
Analytics.self
|
||||
Analytics.self,
|
||||
Crashes.self
|
||||
])
|
||||
}
|
||||
|
||||
|
|
|
@ -460,7 +460,7 @@ extension ApiRequest {
|
|||
private func requestTrafficInfo() {
|
||||
trafficWebSocketRetryTimer?.invalidate()
|
||||
trafficWebSocketRetryTimer = nil
|
||||
trafficWebSocket?.disconnect(forceTimeout: 0, closeCode: 0)
|
||||
trafficWebSocket?.disconnect(forceTimeout: 0.5)
|
||||
|
||||
let socket = WebSocket(url: URL(string: ConfigManager.apiUrl.appending("/traffic"))!)
|
||||
|
||||
|
@ -475,7 +475,7 @@ extension ApiRequest {
|
|||
private func requestLog() {
|
||||
loggingWebSocketRetryTimer?.invalidate()
|
||||
loggingWebSocketRetryTimer = nil
|
||||
loggingWebSocket?.disconnect()
|
||||
loggingWebSocket?.disconnect(forceTimeout: 1)
|
||||
|
||||
let uriString = "/logs?level=".appending(ConfigManager.selectLoggingApiLevel.rawValue)
|
||||
let socket = WebSocket(url: URL(string: ConfigManager.apiUrl.appending(uriString))!)
|
||||
|
|
|
@ -26,7 +26,7 @@ extension ClashProxyMode {
|
|||
|
||||
enum ClashLogLevel: String, Codable {
|
||||
case info
|
||||
case warning = "warn"
|
||||
case warning
|
||||
case error
|
||||
case debug
|
||||
case silent
|
||||
|
|
|
@ -216,12 +216,23 @@ class CustomWKWebView: WKWebView {
|
|||
var dragableAreaHeight: CGFloat = 30
|
||||
let alwaysDragableLeftAreaWidth: CGFloat = 150
|
||||
|
||||
override func mouseDown(with event: NSEvent) {
|
||||
super.mouseDown(with: event)
|
||||
private func isInDargArea(with event:NSEvent?) -> Bool {
|
||||
guard let event = event else { return false }
|
||||
let x = event.locationInWindow.x
|
||||
let y = (window?.frame.size.height ?? 0) - event.locationInWindow.y
|
||||
return x < alwaysDragableLeftAreaWidth || y < dragableAreaHeight
|
||||
}
|
||||
|
||||
if x < alwaysDragableLeftAreaWidth || y < dragableAreaHeight {
|
||||
override func acceptsFirstMouse(for event: NSEvent?) -> Bool {
|
||||
if isInDargArea(with: event) {
|
||||
return true
|
||||
}
|
||||
return super.acceptsFirstMouse(for: event)
|
||||
}
|
||||
|
||||
override func mouseDown(with event: NSEvent) {
|
||||
super.mouseDown(with: event)
|
||||
if isInDargArea(with: event) {
|
||||
window?.performDrag(with: event)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue