diff --git a/ApplicationLibrary/Views/Dashboard/DashboardView.swift b/ApplicationLibrary/Views/Dashboard/DashboardView.swift index c773473..1c5cebc 100644 --- a/ApplicationLibrary/Views/Dashboard/DashboardView.swift +++ b/ApplicationLibrary/Views/Dashboard/DashboardView.swift @@ -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() { diff --git a/ApplicationLibrary/Views/Setting/CoreView.swift b/ApplicationLibrary/Views/Setting/CoreView.swift index f4dea7a..6ac65c2 100644 --- a/ApplicationLibrary/Views/Setting/CoreView.swift +++ b/ApplicationLibrary/Views/Setting/CoreView.swift @@ -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 } } diff --git a/Library/Database/SharedPreferences.swift b/Library/Database/SharedPreferences.swift index e62151e..791acd3 100644 --- a/Library/Database/SharedPreferences.swift +++ b/Library/Database/SharedPreferences.swift @@ -83,6 +83,10 @@ public enum SharedPreferences { await alwaysOn.set(nil) } + // Core + + public static let disableDeprecatedWarnings = Preference("disable_deprecated_warnings", defaultValue: false) + #if DEBUG public static let inDebug = true #else diff --git a/Localizable.xcstrings b/Localizable.xcstrings index a9a0d89..f538e12 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -416,6 +416,16 @@ } } }, + "Disable Deprecated Warnings" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "禁用弃用警告" + } + } + } + }, "Do not enforce memory limits on sing-box. Will cause OOM on non-jailbroken iOS and tvOS devices." : { "localizations" : { "zh-Hans" : { @@ -426,6 +436,16 @@ } } }, + "Do not show warnings about usages of deprecated features." : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "不要显示关于废弃功能使用的警告。" + } + } + } + }, "Documentation" : { "localizations" : { "zh-Hans" : {