mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-08 13:53:56 +00:00
49 lines
1.5 KiB
Swift
49 lines
1.5 KiB
Swift
import SwiftUI
|
|
|
|
struct DeepLinkAgentPromptAlert: ViewModifier {
|
|
@Environment(NodeAppModel.self) private var appModel: NodeAppModel
|
|
|
|
private var promptBinding: Binding<NodeAppModel.AgentDeepLinkPrompt?> {
|
|
Binding(
|
|
get: { self.appModel.pendingAgentDeepLinkPrompt },
|
|
set: { _ in
|
|
// Keep prompt state until explicit user action.
|
|
})
|
|
}
|
|
|
|
func body(content: Content) -> some View {
|
|
content.alert(item: self.promptBinding) { prompt in
|
|
Alert(
|
|
title: Text("Run OpenClaw agent?")
|
|
.font(OpenClawType.headline),
|
|
message: Text(
|
|
"""
|
|
Message:
|
|
\(prompt.messagePreview)
|
|
|
|
URL:
|
|
\(prompt.urlPreview)
|
|
""")
|
|
.font(OpenClawType.subhead),
|
|
primaryButton: .cancel(
|
|
Text("Cancel")
|
|
.font(OpenClawType.subheadSemiBold))
|
|
{
|
|
self.appModel.declinePendingAgentDeepLinkPrompt()
|
|
},
|
|
secondaryButton: .default(
|
|
Text("Run")
|
|
.font(OpenClawType.subheadSemiBold))
|
|
{
|
|
Task { await self.appModel.approvePendingAgentDeepLinkPrompt() }
|
|
})
|
|
}
|
|
}
|
|
}
|
|
|
|
extension View {
|
|
func deepLinkAgentPromptAlert() -> some View {
|
|
self.modifier(DeepLinkAgentPromptAlert())
|
|
}
|
|
}
|