Fix service error permission

This commit is contained in:
世界
2024-01-23 18:25:00 +08:00
parent 5fb2fd3498
commit 339e37f4be
3 changed files with 24 additions and 29 deletions
@@ -1,3 +1,4 @@
import Libbox
import Library
import SwiftUI
@@ -101,11 +102,13 @@ public struct DashboardView: View {
}
private nonisolated func checkServiceError() async {
if let serviceError = try? String(contentsOf: ExtensionProvider.errorFile) {
await MainActor.run {
alert = Alert(title: Text("Service Error"), message: Text(serviceError))
}
try? FileManager.default.removeItem(at: ExtensionProvider.errorFile)
var error: NSError?
let message = LibboxReadServiceError(&error)
if error != nil {
return
}
await MainActor.run {
alert = Alert(title: Text("Service Error"), message: Text(message))
}
}
}