Tools View & Crash Report & OOM Report

This commit is contained in:
世界
2026-04-23 08:12:52 +08:00
parent 73180f0230
commit b48f4ad97f
46 changed files with 4279 additions and 533 deletions
+13
View File
@@ -9,13 +9,16 @@ import UserNotifications
class ApplicationDelegate: NSObject, UIApplicationDelegate, UNUserNotificationCenterDelegate {
private var profileServer: ProfileServer?
private var reportTransferServer: ReportTransferServer?
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
NativeCrashReporter.installForCurrentProcess()
NSLog("Here I stand")
let options = LibboxSetupOptions()
options.basePath = FilePath.sharedDirectory.relativePath
options.workingPath = FilePath.workingDirectory.relativePath
options.tempPath = FilePath.cacheDirectory.relativePath
options.crashReportSource = "Application"
var error: NSError?
LibboxSetup(options, &error)
LibboxSetLocale(Locale.current.identifier)
@@ -77,6 +80,16 @@ class ApplicationDelegate: NSObject, UIApplicationDelegate, UNUserNotificationCe
} catch {
NSLog("setup profile server error: \(error.localizedDescription)")
}
do {
let reportTransferServer = try ReportTransferServer()
reportTransferServer.start()
await MainActor.run {
self.reportTransferServer = reportTransferServer
}
NSLog("started report transfer server")
} catch {
NSLog("setup report transfer server error: \(error.localizedDescription)")
}
registerFileProviderDomain()
}
}
+4
View File
@@ -58,6 +58,10 @@
<key>NSApplicationServiceIdentifier</key>
<string>sing-box:profile</string>
</dict>
<dict>
<key>NSApplicationServiceIdentifier</key>
<string>sing-box:report-transfer</string>
</dict>
</array>
</dict>
<key>NSUbiquitousContainers</key>
+8
View File
@@ -73,6 +73,7 @@ struct MainView: View {
}
.tag(page)
.tabItem { page.label }
.badge(page == .tools ? environments.totalUnreadReportCount : 0)
}
}
}
@@ -176,6 +177,13 @@ struct MainView: View {
environments.connect()
}
}
.onReceive(NotificationCenter.default.publisher(for: .reportReceived)) { _ in
Task {
await environments.crashReportManager.refresh()
await environments.oomReportManager.refresh()
selection = .tools
}
}
.environment(\.selection, $selection)
.environment(\.importProfile, $importProfile)
.environment(\.importRemoteProfile, $importRemoteProfile)