Fix issues on new systems

This commit is contained in:
世界
2025-09-23 21:45:01 +08:00
parent a696864985
commit 286f6fd794
8 changed files with 64 additions and 7 deletions
@@ -1,6 +1,9 @@
import Libbox
import Library
import SwiftUI
#if canImport(UIKit)
import UIKit
#endif
public struct ExtensionStatusView: View {
@Environment(\.scenePhase) private var scenePhase
@@ -115,6 +118,8 @@ public struct ExtensionStatusView: View {
}
private struct StatusItem<T>: View where T: View {
@Environment(\.colorScheme) private var colorScheme
private let title: String
@ViewBuilder private let content: () -> T
@@ -148,7 +153,14 @@ public struct ExtensionStatusView: View {
#elseif os(macOS)
return Color(nsColor: .textBackgroundColor)
#elseif os(tvOS)
return Color(uiColor: .black)
switch colorScheme {
case .dark:
return Color(uiColor: .black)
default:
return Color(uiColor: .white)
}
#else
return Color.clear
#endif
}
}
@@ -108,6 +108,9 @@ public struct OverviewView: View {
try LibboxNewStandaloneCommandClient()!.setSystemProxyEnabled(isEnabled)
} else {
// Apple BUG: HTTP Proxy cannot be disabled via setTunnelNetworkSettings, so we can only restart the Network Extension
await MainActor.run {
reasserting = true
}
try await profile.stop()
var waitSeconds = 0
while await profile.status != .disconnected {
@@ -118,6 +121,9 @@ public struct OverviewView: View {
}
}
try await profile.start()
await MainActor.run {
reasserting = false
}
}
} catch {
await MainActor.run {