mirror of
https://github.com/openclaw/openclaw.git
synced 2026-10-03 09:39:25 +00:00
refactor(ios): reuse approval prompt parsing (#147985)
This commit is contained in:
parent
7043f8fb4f
commit
502c3a6afd
2 changed files with 6 additions and 29 deletions
|
|
@ -366,16 +366,6 @@ enum ExecApprovalNotificationBridge {
|
|||
configuration: self.configuration)
|
||||
}
|
||||
|
||||
static func parsePrompt(
|
||||
actionIdentifier: String,
|
||||
userInfo: [AnyHashable: Any]) -> ApprovalNotificationPrompt?
|
||||
{
|
||||
ApprovalNotificationBridge.parsePrompt(
|
||||
actionIdentifier: actionIdentifier,
|
||||
userInfo: userInfo,
|
||||
configuration: self.configuration)
|
||||
}
|
||||
|
||||
static func parseRequestedPush(userInfo: [AnyHashable: Any]) -> ApprovalNotificationPrompt? {
|
||||
ApprovalNotificationBridge.parseRequestedPush(
|
||||
userInfo: userInfo,
|
||||
|
|
@ -404,16 +394,6 @@ enum PluginApprovalNotificationBridge {
|
|||
configuration: self.configuration)
|
||||
}
|
||||
|
||||
static func parsePrompt(
|
||||
actionIdentifier: String,
|
||||
userInfo: [AnyHashable: Any]) -> ApprovalNotificationPrompt?
|
||||
{
|
||||
ApprovalNotificationBridge.parsePrompt(
|
||||
actionIdentifier: actionIdentifier,
|
||||
userInfo: userInfo,
|
||||
configuration: self.configuration)
|
||||
}
|
||||
|
||||
static func parseRequestedPush(userInfo: [AnyHashable: Any]) -> ApprovalNotificationPrompt? {
|
||||
ApprovalNotificationBridge.parseRequestedPush(
|
||||
userInfo: userInfo,
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ private final class MockNotificationCenter: NotificationCentering, @unchecked Se
|
|||
|
||||
@Suite(.serialized) struct ExecApprovalNotificationBridgeTests {
|
||||
@Test func `parse prompt maps default notification tap`() {
|
||||
let prompt = ExecApprovalNotificationBridge.parsePrompt(
|
||||
let prompt = ApprovalNotificationBridge.parsePrompt(
|
||||
actionIdentifier: UNNotificationDefaultActionIdentifier,
|
||||
userInfo: [
|
||||
"openclaw": [
|
||||
|
|
@ -51,7 +51,7 @@ private final class MockNotificationCenter: NotificationCentering, @unchecked Se
|
|||
}
|
||||
|
||||
@Test func `parse prompt maps review action`() {
|
||||
let prompt = ExecApprovalNotificationBridge.parsePrompt(
|
||||
let prompt = ApprovalNotificationBridge.parsePrompt(
|
||||
actionIdentifier: ExecApprovalNotificationBridge.reviewActionIdentifier,
|
||||
userInfo: [
|
||||
"openclaw": [
|
||||
|
|
@ -67,7 +67,7 @@ private final class MockNotificationCenter: NotificationCentering, @unchecked Se
|
|||
}
|
||||
|
||||
@Test func `parse prompt ignores unexpected action identifiers`() {
|
||||
let prompt = ExecApprovalNotificationBridge.parsePrompt(
|
||||
let prompt = ApprovalNotificationBridge.parsePrompt(
|
||||
actionIdentifier: "openclaw.exec-approval.allow-once",
|
||||
userInfo: [
|
||||
"openclaw": [
|
||||
|
|
@ -326,12 +326,9 @@ private final class MockNotificationCenter: NotificationCentering, @unchecked Se
|
|||
],
|
||||
]
|
||||
|
||||
#expect(PluginApprovalNotificationBridge.parsePrompt(
|
||||
#expect(ApprovalNotificationBridge.parsePrompt(
|
||||
actionIdentifier: UNNotificationDefaultActionIdentifier,
|
||||
userInfo: userInfo)?.kind == .plugin)
|
||||
#expect(PluginApprovalNotificationBridge.parsePrompt(
|
||||
actionIdentifier: PluginApprovalNotificationBridge.reviewActionIdentifier,
|
||||
userInfo: userInfo)?.kind == .plugin)
|
||||
#expect(ApprovalNotificationBridge.parsePrompt(
|
||||
actionIdentifier: PluginApprovalNotificationBridge.reviewActionIdentifier,
|
||||
userInfo: userInfo)?.kind == .plugin)
|
||||
|
|
@ -353,10 +350,10 @@ private final class MockNotificationCenter: NotificationCentering, @unchecked Se
|
|||
|
||||
#expect(PluginApprovalNotificationBridge.parseRequestedPush(userInfo: execUserInfo) == nil)
|
||||
#expect(ExecApprovalNotificationBridge.parseRequestedPush(userInfo: pluginUserInfo) == nil)
|
||||
#expect(PluginApprovalNotificationBridge.parsePrompt(
|
||||
#expect(ApprovalNotificationBridge.parsePrompt(
|
||||
actionIdentifier: ExecApprovalNotificationBridge.reviewActionIdentifier,
|
||||
userInfo: pluginUserInfo) == nil)
|
||||
#expect(ExecApprovalNotificationBridge.parsePrompt(
|
||||
#expect(ApprovalNotificationBridge.parsePrompt(
|
||||
actionIdentifier: PluginApprovalNotificationBridge.reviewActionIdentifier,
|
||||
userInfo: execUserInfo) == nil)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue