diff --git a/ApplicationLibrary/Views/Setting/CoreView.swift b/ApplicationLibrary/Views/Setting/CoreView.swift index 8dfda54..86afc0d 100644 --- a/ApplicationLibrary/Views/Setting/CoreView.swift +++ b/ApplicationLibrary/Views/Setting/CoreView.swift @@ -19,6 +19,7 @@ public struct CoreView: View { @State private var version = "" @State private var dataSize: String? + @State private var dataSizeLoaded = false #if os(macOS) @State private var helperUnavailable = false @@ -38,6 +39,12 @@ public struct CoreView: View { FormTextItem("Version", version) if let dataSize { FormTextItem("Data Size", dataSize) + } else if !dataSizeLoaded { + HStack { + Text("Data Size") + Spacer() + ProgressView() + } } else { #if os(macOS) HStack { @@ -124,11 +131,6 @@ public struct CoreView: View { } else { await MainActor.run { version = LibboxVersion() - #if os(macOS) - if Variant.useSystemExtension { - helperUnavailable = HelperServiceManager.rootHelperStatus != .enabled - } - #endif isLoading = false } await loadSettingsBackground() @@ -173,6 +175,7 @@ public struct CoreView: View { self.helperUnavailable = helperUnavailable #endif self.dataSize = dataSize + self.dataSizeLoaded = true } } diff --git a/ApplicationLibrary/Views/Setting/MacAppView.swift b/ApplicationLibrary/Views/Setting/MacAppView.swift index c17915e..fccf76c 100644 --- a/ApplicationLibrary/Views/Setting/MacAppView.swift +++ b/ApplicationLibrary/Views/Setting/MacAppView.swift @@ -29,6 +29,7 @@ public struct AppView: View { @Environment(\.showMenuBarExtra) private var showMenuBarExtra @Environment(\.menuBarExtraSpeedMode) private var menuBarExtraSpeedMode @State private var menuBarExtraInBackground = false + @State private var helperStatusLoaded = false @State private var rootHelperRegistrationStatus: SMAppService.Status = .notRegistered #endif @@ -108,7 +109,9 @@ public struct AppView: View { } Section { - if rootHelperRegistrationStatus == .enabled { + if !helperStatusLoaded { + ProgressView() + } else if rootHelperRegistrationStatus == .enabled { FormButton { Task { do { @@ -171,11 +174,14 @@ public struct AppView: View { #if os(macOS) startAtLogin = SMAppService.mainApp.status == .enabled menuBarExtraInBackground = await SharedPreferences.menuBarExtraInBackground.get() - if Variant.useSystemExtension { - refreshHelperStatus() - } #endif isLoading = false + #if os(macOS) + if Variant.useSystemExtension { + refreshHelperStatus() + helperStatusLoaded = true + } + #endif } private static func currentLanguage() -> String? {