Add button to disable deprecated warnings

This commit is contained in:
世界
2025-02-20 10:57:45 +08:00
parent f9eecf8f8c
commit 2fd7bdc822
4 changed files with 38 additions and 0 deletions
@@ -120,6 +120,9 @@ public struct DashboardView: View {
}
private nonisolated func checkDeprecatedNotes() async {
if await SharedPreferences.disableDeprecatedWarnings.get() {
return
}
do {
let reports = try LibboxNewStandaloneCommandClient()!.getDeprecatedNotes()
if reports.hasNext() {
@@ -7,6 +7,8 @@ import SwiftUI
public struct CoreView: View {
@State private var isLoading = true
@State private var disableDeprecatedWarnings = false
@State private var version = ""
@State private var dataSize = ""
@@ -24,6 +26,13 @@ public struct CoreView: View {
FormTextItem("Version", version)
FormTextItem("Data Size", dataSize)
if Variant.isBeta {
Section {}
FormToggle("Disable Deprecated Warnings", "Do not show warnings about usages of deprecated features.", $disableDeprecatedWarnings) { newValue in
await SharedPreferences.disableDeprecatedWarnings.set(newValue)
}
}
Section("Working Directory") {
#if os(macOS)
FormButton {
@@ -68,8 +77,10 @@ public struct CoreView: View {
}
private nonisolated func loadSettingsBackground() async {
let disableDeprecatedWarnings = await SharedPreferences.disableDeprecatedWarnings.get()
let dataSize = (try? FilePath.workingDirectory.formattedSize()) ?? "Unknown"
await MainActor.run {
self.disableDeprecatedWarnings = disableDeprecatedWarnings
self.dataSize = dataSize
}
}