Remove ignoreDeviceSleep && Improve delete button on macOS

This commit is contained in:
世界
2024-02-16 13:41:32 +08:00
parent 1f6e99f576
commit bbee434895
11 changed files with 72 additions and 36 deletions
@@ -31,7 +31,7 @@ public struct CoreView: View {
Label("Open", systemImage: "macwindow.and.cursorarrow")
}
#endif
FormButton {
FormButton(role: .destructive) {
Task {
await destroyWorkingDirectory()
}
@@ -64,7 +64,7 @@
} label: {
Label("Update", systemImage: "arrow.down.doc.fill")
}
FormButton {
FormButton(role: .destructive) {
Task {
await uninstallSystemExtension()
}
@@ -9,7 +9,6 @@ struct PacketTunnelView: View {
@State private var isLoading = true
@State private var ignoreMemoryLimit = false
@State private var ignoreDeviceSleep = false
@State private var includeAllNetworks = false
@State private var excludeAPNs = false
@@ -39,17 +38,6 @@ struct PacketTunnelView: View {
Text("Do not enforce memory limits on sing-box. Will cause OOM on non-jailbroken iOS and tvOS devices.")
}
FormSection {
Toggle("Ignore Device Sleep", isOn: $ignoreDeviceSleep)
.onChangeCompat(of: ignoreDeviceSleep) { newValue in
Task {
await SharedPreferences.ignoreDeviceSleep.set(newValue)
}
}
} footer: {
Text("Ignore system `sleep()` and `wake()` events. May cause increased power usage, only enable if you encounter unexpected `rejected ... while device paused` errors.")
}
#if !os(tvOS)
FormSection {
@@ -152,7 +140,6 @@ struct PacketTunnelView: View {
private func loadSettings() async {
ignoreMemoryLimit = await SharedPreferences.ignoreMemoryLimit.get()
ignoreDeviceSleep = await SharedPreferences.ignoreDeviceSleep.get()
#if !os(tvOS)
includeAllNetworks = await SharedPreferences.includeAllNetworks.get()
excludeAPNs = await SharedPreferences.excludeAPNs.get()
@@ -86,7 +86,7 @@ public struct SettingView: View {
}
}
@State private var isLoading = false
@State private var isLoading = true
@State private var taiwanFlagAvailable = false
public init() {}