Implement send notification

This commit is contained in:
世界
2024-11-07 16:52:14 +08:00
parent c72167b0dc
commit 348f2809a1
6 changed files with 102 additions and 25 deletions
@@ -138,16 +138,21 @@ public struct DashboardView: View {
private func loopShowDeprecateNotes(_ reports: any LibboxDeprecatedNoteIteratorProtocol) {
if reports.hasNext() {
let report = reports.next()!
NSLog("show next")
alert = Alert(
title: Text("Deprecated Warning"),
message: Text(report.message()),
primaryButton: .cancel(Text("Ok")) {
loopShowDeprecateNotes(reports)
},
secondaryButton: .default(Text("Documentation")) {
primaryButton: .default(Text("Documentation")) {
openURL(URL(string: report.migrationLink)!)
loopShowDeprecateNotes(reports)
Task.detached {
try await Task.sleep(nanoseconds: 300 * MSEC_PER_SEC)
await loopShowDeprecateNotes(reports)
}
},
secondaryButton: .cancel(Text("Ok")) {
Task.detached {
try await Task.sleep(nanoseconds: 300 * MSEC_PER_SEC)
await loopShowDeprecateNotes(reports)
}
}
)
}
@@ -4,7 +4,6 @@ import SwiftUI
public struct ExtensionStatusView: View {
@Environment(\.scenePhase) private var scenePhase
@Environment(\.openURL) private var openURL
@StateObject private var commandClient = CommandClient(.status)
@State private var columnCount: Int = 4
@@ -91,9 +90,7 @@ public struct ExtensionStatusView: View {
.padding([.top, .leading, .trailing])
}
.onAppear {
commandClient.connect { urlString in
openURL(URL(string: urlString)!)
}
commandClient.connect()
}
.onDisappear {
commandClient.disconnect()