Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

fix(mobile): restore alerts without native push (#36125)

Kelvin Amoaba1ed54cf4b5f8
diff --git a/mobile/rpc-foundation/goldens/matrix-notifications.display-test-screen-notifications.testpush-1.json b/mobile/rpc-foundation/goldens/matrix-notifications.display-test-screen-notifications.testpush-1.json
index 66b2b21f409..02289298b58 100644
--- a/mobile/rpc-foundation/goldens/matrix-notifications.display-test-screen-notifications.testpush-1.json
+++ b/mobile/rpc-foundation/goldens/matrix-notifications.display-test-screen-notifications.testpush-1.json
@@ -99,7 +99,7 @@
"startedAt": 0
}
},
- "1813829924d9": {
+ "1697b5e93ff5": {
"crash": {
"$rpc": "null"
},
@@ -111,11 +111,29 @@
"labels": ["Send test notification"],
"text": [
"Having trouble receiving alerts?",
- "Send a test through Orca’s push service.",
+ "Test push delivery, or a local notification when push is unavailable.",
"Send test notification",
"Send test notification",
"Troubleshooting",
- "Accepted by Orca’s push service. Check for the notification."
+ "Could not reach the desktop. Try again."
+ ]
+ },
+ "170e48b3b256": {
+ "crash": {
+ "$rpc": "null"
+ },
+ "elements": {
+ "Pressable": 2,
+ "Text": 5,
+ "View": 3
+ },
+ "labels": ["Send test notification"],
+ "text": [
+ "Having trouble receiving alerts?",
+ "Test push delivery, or a local notification when push is unavailable.",
+ "Send test notification",
+ "Send test notification",
+ "Troubleshooting"
]
},
"1d12f3e78a48": {
@@ -156,7 +174,7 @@
}
}
},
- "2632a7be552e": {
+ "1fe5ab7da384": {
"crash": {
"$rpc": "null"
},
@@ -168,11 +186,11 @@
"labels": ["Send test notification"],
"text": [
"Having trouble receiving alerts?",
- "Send a test through Orca’s push service.",
+ "Test push delivery, or a local notification when push is unavailable.",
"Send test notification",
"Send test notification",
"Troubleshooting",
- "Update your desktop to run this test."
+ "Accepted by Orca’s push service. Check for the notification."
]
},
"401bb4233294": {
@@ -240,7 +258,7 @@
}
}
},
- "4f67ed2e2c74": {
+ "5ba4fa4750da": {
"crash": {
"$rpc": "null"
},
@@ -252,11 +270,11 @@
"labels": ["Send test notification"],
"text": [
"Having trouble receiving alerts?",
- "Send a test through Orca’s push service.",
+ "Test push delivery, or a local notification when push is unavailable.",
"Send test notification",
"Send test notification",
"Troubleshooting",
- "Could not reach the desktop. Try again."
+ "transport failure"
]
},
"649d12c8eb9b": {
@@ -294,7 +312,7 @@
}
}
},
- "6967f95147f9": {
+ "6a40b555d64d": {
"crash": {
"$rpc": "null"
},
@@ -306,7 +324,7 @@
"labels": ["Sending…"],
"text": [
"Having trouble receiving alerts?",
- "Send a test through Orca’s push service.",
+ "Test push delivery, or a local notification when push is unavailable.",
"Send test notification",
"Sending…",
"Troubleshooting"
@@ -383,7 +401,7 @@
}
}
},
- "b7f125cb7db0": {
+ "9f9fa89c12c8": {
"crash": {
"$rpc": "null"
},
@@ -395,11 +413,44 @@
"labels": ["Send test notification"],
"text": [
"Having trouble receiving alerts?",
- "Send a test through Orca’s push service.",
+ "Test push delivery, or a local notification when push is unavailable.",
"Send test notification",
"Send test notification",
"Troubleshooting",
- "transport failure"
+ "This desktop does not support push notifications. Update it to receive push. Local test scheduled. Check for the notification. This checks display only; it does not verify agent alert delivery."
+ ]
+ },
+ "b23af609a818": {
+ "name": "notification.schedule",
+ "ordinal": 3,
+ "value": {
+ "content": {
+ "body": "Local notification test from this phone.",
+ "sound": "default",
+ "title": "Test notification"
+ },
+ "trigger": {
+ "channelId": "orca-desktop"
+ }
+ }
+ },
+ "b590df6ffade": {
+ "crash": {
+ "$rpc": "null"
+ },
+ "elements": {
+ "Pressable": 2,
+ "Text": 6,
+ "View": 3
+ },
+ "labels": ["Send test notification"],
+ "text": [
+ "Having trouble receiving alerts?",
+ "Test push delivery, or a local notification when push is unavailable.",
+ "Send test notification",
+ "Send test notification",
+ "Troubleshooting",
+ "Could not send through Orca’s push service. Try again."
]
},
"c37bd4097e53": {
@@ -474,24 +525,6 @@
}
}
},
- "d86c08a509c4": {
- "crash": {
- "$rpc": "null"
- },
- "elements": {
- "Pressable": 2,
- "Text": 5,
- "View": 3
- },
- "labels": ["Send test notification"],
- "text": [
- "Having trouble receiving alerts?",
- "Send a test through Orca’s push service.",
- "Send test notification",
- "Send test notification",
- "Troubleshooting"
- ]
- },
"eb79a9b3682a": {
"status": "fulfilled",
"startedAt": 0,
@@ -536,25 +569,6 @@
}
}
},
- "f3e2e816b496": {
- "crash": {
- "$rpc": "null"
- },
- "elements": {
- "Pressable": 2,
- "Text": 6,
- "View": 3
- },
- "labels": ["Send test notification"],
- "text": [
- "Having trouble receiving alerts?",
- "Send a test through Orca’s push service.",
- "Send test notification",
- "Send test notification",
- "Troubleshooting",
- "Could not send through Orca’s push service. Try again."
- ]
- },
"f68b017d64bd": {
"name": "notifications.testPush#1",
"ordinal": 2,
@@ -572,7 +586,7 @@
"settlements": {
"mount": "eb79a9b3682a"
},
- "state": "d86c08a509c4",
+ "state": "170e48b3b256",
"effects": []
}
},
@@ -585,7 +599,7 @@
"mount": "eb79a9b3682a",
"press": "eb79a9b3682a"
},
- "state": "6967f95147f9",
+ "state": "6a40b555d64d",
"effects": []
}
},
@@ -598,7 +612,7 @@
"mount": "eb79a9b3682a",
"press": "eb79a9b3682a"
},
- "state": "1813829924d9",
+ "state": "1fe5ab7da384",
"effects": []
}
},
@@ -611,7 +625,7 @@
"mount": "eb79a9b3682a",
"press": "eb79a9b3682a"
},
- "state": "f3e2e816b496",
+ "state": "b590df6ffade",
"effects": []
}
},
@@ -624,7 +638,7 @@
"mount": "eb79a9b3682a",
"press": "eb79a9b3682a"
},
- "state": "f3e2e816b496",
+ "state": "b590df6ffade",
"effects": []
}
},
@@ -637,7 +651,7 @@
"mount": "eb79a9b3682a",
"press": "eb79a9b3682a"
},
- "state": "f3e2e816b496",
+ "state": "b590df6ffade",
"effects": []
}
},
@@ -650,7 +664,7 @@
"mount": "eb79a9b3682a",
"press": "eb79a9b3682a"
},
- "state": "f3e2e816b496",
+ "state": "b590df6ffade",
"effects": []
}
},
@@ -663,7 +677,7 @@
"mount": "eb79a9b3682a",
"press": "eb79a9b3682a"
},
- "state": "f3e2e816b496",
+ "state": "b590df6ffade",
"effects": []
}
},
@@ -676,7 +690,7 @@
"mount": "eb79a9b3682a",
"press": "eb79a9b3682a"
},
- "state": "4f67ed2e2c74",
+ "state": "1697b5e93ff5",
"effects": []
}
},
@@ -689,7 +703,7 @@
"mount": "eb79a9b3682a",
"press": "eb79a9b3682a"
},
- "state": "4f67ed2e2c74",
+ "state": "1697b5e93ff5",
"effects": []
}
},
@@ -702,8 +716,8 @@
"mount": "eb79a9b3682a",
"press": "eb79a9b3682a"
},
- "state": "2632a7be552e",
- "effects": []
+ "state": "9f9fa89c12c8",
+ "effects": ["b23af609a818"]
}
},
{
@@ -715,7 +729,7 @@
"mount": "eb79a9b3682a",
"press": "eb79a9b3682a"
},
- "state": "b7f125cb7db0",
+ "state": "5ba4fa4750da",
"effects": []
}
},
@@ -728,7 +742,7 @@
"mount": "eb79a9b3682a",
"press": "eb79a9b3682a"
},
- "state": "d86c08a509c4",
+ "state": "170e48b3b256",
"effects": []
}
}
diff --git a/mobile/rpc-foundation/goldens/notifications-display-test-accepted.json b/mobile/rpc-foundation/goldens/notifications-display-test-accepted.json
index de0ad9f0796..91455628812 100644
--- a/mobile/rpc-foundation/goldens/notifications-display-test-accepted.json
+++ b/mobile/rpc-foundation/goldens/notifications-display-test-accepted.json
@@ -31,7 +31,25 @@
"startedAt": 0
}
},
- "1813829924d9": {
+ "170e48b3b256": {
+ "crash": {
+ "$rpc": "null"
+ },
+ "elements": {
+ "Pressable": 2,
+ "Text": 5,
+ "View": 3
+ },
+ "labels": ["Send test notification"],
+ "text": [
+ "Having trouble receiving alerts?",
+ "Test push delivery, or a local notification when push is unavailable.",
+ "Send test notification",
+ "Send test notification",
+ "Troubleshooting"
+ ]
+ },
+ "1fe5ab7da384": {
"crash": {
"$rpc": "null"
},
@@ -43,7 +61,7 @@
"labels": ["Send test notification"],
"text": [
"Having trouble receiving alerts?",
- "Send a test through Orca’s push service.",
+ "Test push delivery, or a local notification when push is unavailable.",
"Send test notification",
"Send test notification",
"Troubleshooting",
@@ -85,7 +103,7 @@
}
}
},
- "6967f95147f9": {
+ "6a40b555d64d": {
"crash": {
"$rpc": "null"
},
@@ -97,30 +115,12 @@
"labels": ["Sending…"],
"text": [
"Having trouble receiving alerts?",
- "Send a test through Orca’s push service.",
+ "Test push delivery, or a local notification when push is unavailable.",
"Send test notification",
"Sending…",
"Troubleshooting"
]
},
- "d86c08a509c4": {
- "crash": {
- "$rpc": "null"
- },
- "elements": {
- "Pressable": 2,
- "Text": 5,
- "View": 3
- },
- "labels": ["Send test notification"],
- "text": [
- "Having trouble receiving alerts?",
- "Send a test through Orca’s push service.",
- "Send test notification",
- "Send test notification",
- "Troubleshooting"
- ]
- },
"eb79a9b3682a": {
"status": "fulfilled",
"startedAt": 0,
@@ -146,7 +146,7 @@
"settlements": {
"mount": "eb79a9b3682a"
},
- "state": "d86c08a509c4",
+ "state": "170e48b3b256",
"effects": []
}
},
@@ -159,7 +159,7 @@
"mount": "eb79a9b3682a",
"press": "eb79a9b3682a"
},
- "state": "6967f95147f9",
+ "state": "6a40b555d64d",
"effects": []
}
},
@@ -172,7 +172,7 @@
"mount": "eb79a9b3682a",
"press": "eb79a9b3682a"
},
- "state": "1813829924d9",
+ "state": "1fe5ab7da384",
"effects": []
}
}
diff --git a/mobile/rpc-foundation/goldens/notifications-display-test-not-registered.json b/mobile/rpc-foundation/goldens/notifications-display-test-not-registered.json
index fe8794a169f..05000669c8c 100644
--- a/mobile/rpc-foundation/goldens/notifications-display-test-not-registered.json
+++ b/mobile/rpc-foundation/goldens/notifications-display-test-not-registered.json
@@ -67,7 +67,7 @@
}
}
},
- "6967f95147f9": {
+ "170e48b3b256": {
"crash": {
"$rpc": "null"
},
@@ -76,16 +76,16 @@
"Text": 5,
"View": 3
},
- "labels": ["Sending…"],
+ "labels": ["Send test notification"],
"text": [
"Having trouble receiving alerts?",
- "Send a test through Orca’s push service.",
+ "Test push delivery, or a local notification when push is unavailable.",
+ "Send test notification",
"Send test notification",
- "Sending…",
"Troubleshooting"
]
},
- "d35f59ee0a2d": {
+ "2010c1c947ad": {
"crash": {
"$rpc": "null"
},
@@ -97,14 +97,14 @@
"labels": ["Send test notification"],
"text": [
"Having trouble receiving alerts?",
- "Send a test through Orca’s push service.",
+ "Test push delivery, or a local notification when push is unavailable.",
"Send test notification",
"Send test notification",
"Troubleshooting",
- "Reconnect to register this phone for notifications."
+ "Push registration is not ready on this desktop. Try again shortly. Local test scheduled. Check for the notification. This checks display only; it does not verify agent alert delivery."
]
},
- "d86c08a509c4": {
+ "6a40b555d64d": {
"crash": {
"$rpc": "null"
},
@@ -113,15 +113,29 @@
"Text": 5,
"View": 3
},
- "labels": ["Send test notification"],
+ "labels": ["Sending…"],
"text": [
"Having trouble receiving alerts?",
- "Send a test through Orca’s push service.",
- "Send test notification",
+ "Test push delivery, or a local notification when push is unavailable.",
"Send test notification",
+ "Sending…",
"Troubleshooting"
]
},
+ "b23af609a818": {
+ "name": "notification.schedule",
+ "ordinal": 3,
+ "value": {
+ "content": {
+ "body": "Local notification test from this phone.",
+ "sound": "default",
+ "title": "Test notification"
+ },
+ "trigger": {
+ "channelId": "orca-desktop"
+ }
+ }
+ },
"eb79a9b3682a": {
"status": "fulfilled",
"startedAt": 0,
@@ -147,7 +161,7 @@
"settlements": {
"mount": "eb79a9b3682a"
},
- "state": "d86c08a509c4",
+ "state": "170e48b3b256",
"effects": []
}
},
@@ -160,7 +174,7 @@
"mount": "eb79a9b3682a",
"press": "eb79a9b3682a"
},
- "state": "6967f95147f9",
+ "state": "6a40b555d64d",
"effects": []
}
},
@@ -173,8 +187,8 @@
"mount": "eb79a9b3682a",
"press": "eb79a9b3682a"
},
- "state": "d35f59ee0a2d",
- "effects": []
+ "state": "2010c1c947ad",
+ "effects": ["b23af609a818"]
}
}
]
diff --git a/mobile/rpc-foundation/goldens/notifications-display-test-rate-limited.json b/mobile/rpc-foundation/goldens/notifications-display-test-rate-limited.json
index 325dede690a..4e85c8c4b10 100644
--- a/mobile/rpc-foundation/goldens/notifications-display-test-rate-limited.json
+++ b/mobile/rpc-foundation/goldens/notifications-display-test-rate-limited.json
@@ -31,7 +31,25 @@
"startedAt": 0
}
},
- "6967f95147f9": {
+ "170e48b3b256": {
+ "crash": {
+ "$rpc": "null"
+ },
+ "elements": {
+ "Pressable": 2,
+ "Text": 5,
+ "View": 3
+ },
+ "labels": ["Send test notification"],
+ "text": [
+ "Having trouble receiving alerts?",
+ "Test push delivery, or a local notification when push is unavailable.",
+ "Send test notification",
+ "Send test notification",
+ "Troubleshooting"
+ ]
+ },
+ "6a40b555d64d": {
"crash": {
"$rpc": "null"
},
@@ -43,12 +61,31 @@
"labels": ["Sending…"],
"text": [
"Having trouble receiving alerts?",
- "Send a test through Orca’s push service.",
+ "Test push delivery, or a local notification when push is unavailable.",
"Send test notification",
"Sending…",
"Troubleshooting"
]
},
+ "7ca6a8859979": {
+ "crash": {
+ "$rpc": "null"
+ },
+ "elements": {
+ "Pressable": 2,
+ "Text": 6,
+ "View": 3
+ },
+ "labels": ["Send test notification"],
+ "text": [
+ "Having trouble receiving alerts?",
+ "Test push delivery, or a local notification when push is unavailable.",
+ "Send test notification",
+ "Send test notification",
+ "Troubleshooting",
+ "Too many notifications. Try again later."
+ ]
+ },
"8cdc3e6a317e": {
"name": "notifications.testPush#1",
"ordinal": 1,
@@ -85,43 +122,6 @@
}
}
},
- "c7f154da2a28": {
- "crash": {
- "$rpc": "null"
- },
- "elements": {
- "Pressable": 2,
- "Text": 6,
- "View": 3
- },
- "labels": ["Send test notification"],
- "text": [
- "Having trouble receiving alerts?",
- "Send a test through Orca’s push service.",
- "Send test notification",
- "Send test notification",
- "Troubleshooting",
- "Too many notifications. Try again later."
- ]
- },
- "d86c08a509c4": {
- "crash": {
- "$rpc": "null"
- },
- "elements": {
- "Pressable": 2,
- "Text": 5,
- "View": 3
- },
- "labels": ["Send test notification"],
- "text": [
- "Having trouble receiving alerts?",
- "Send a test through Orca’s push service.",
- "Send test notification",
- "Send test notification",
- "Troubleshooting"
- ]
- },
"eb79a9b3682a": {
"status": "fulfilled",
"startedAt": 0,
@@ -147,7 +147,7 @@
"settlements": {
"mount": "eb79a9b3682a"
},
- "state": "d86c08a509c4",
+ "state": "170e48b3b256",
"effects": []
}
},
@@ -160,7 +160,7 @@
"mount": "eb79a9b3682a",
"press": "eb79a9b3682a"
},
- "state": "6967f95147f9",
+ "state": "6a40b555d64d",
"effects": []
}
},
@@ -173,7 +173,7 @@
"mount": "eb79a9b3682a",
"press": "eb79a9b3682a"
},
- "state": "c7f154da2a28",
+ "state": "7ca6a8859979",
"effects": []
}
}
diff --git a/mobile/rpc-foundation/goldens/notifications-display-test-unknown-reason.json b/mobile/rpc-foundation/goldens/notifications-display-test-unknown-reason.json
index ec2d5f54abf..8694517a3a5 100644
--- a/mobile/rpc-foundation/goldens/notifications-display-test-unknown-reason.json
+++ b/mobile/rpc-foundation/goldens/notifications-display-test-unknown-reason.json
@@ -42,6 +42,24 @@
"variant": "push-test-result"
}
},
+ "170e48b3b256": {
+ "crash": {
+ "$rpc": "null"
+ },
+ "elements": {
+ "Pressable": 2,
+ "Text": 5,
+ "View": 3
+ },
+ "labels": ["Send test notification"],
+ "text": [
+ "Having trouble receiving alerts?",
+ "Test push delivery, or a local notification when push is unavailable.",
+ "Send test notification",
+ "Send test notification",
+ "Troubleshooting"
+ ]
+ },
"67d697ba09ce": {
"name": "notifications.testPush#1",
"ordinal": 1,
@@ -78,7 +96,7 @@
}
}
},
- "6967f95147f9": {
+ "6a40b555d64d": {
"crash": {
"$rpc": "null"
},
@@ -90,28 +108,29 @@
"labels": ["Sending…"],
"text": [
"Having trouble receiving alerts?",
- "Send a test through Orca’s push service.",
+ "Test push delivery, or a local notification when push is unavailable.",
"Send test notification",
"Sending…",
"Troubleshooting"
]
},
- "d86c08a509c4": {
+ "b590df6ffade": {
"crash": {
"$rpc": "null"
},
"elements": {
"Pressable": 2,
- "Text": 5,
+ "Text": 6,
"View": 3
},
"labels": ["Send test notification"],
"text": [
"Having trouble receiving alerts?",
- "Send a test through Orca’s push service.",
+ "Test push delivery, or a local notification when push is unavailable.",
"Send test notification",
"Send test notification",
- "Troubleshooting"
+ "Troubleshooting",
+ "Could not send through Orca’s push service. Try again."
]
},
"eb79a9b3682a": {
@@ -122,25 +141,6 @@
"$rpc": "undefined"
}
},
- "f3e2e816b496": {
- "crash": {
- "$rpc": "null"
- },
- "elements": {
- "Pressable": 2,
- "Text": 6,
- "View": 3
- },
- "labels": ["Send test notification"],
- "text": [
- "Having trouble receiving alerts?",
- "Send a test through Orca’s push service.",
- "Send test notification",
- "Send test notification",
- "Troubleshooting",
- "Could not send through Orca’s push service. Try again."
- ]
- },
"f68b017d64bd": {
"name": "notifications.testPush#1",
"ordinal": 2,
@@ -158,7 +158,7 @@
"settlements": {
"mount": "eb79a9b3682a"
},
- "state": "d86c08a509c4",
+ "state": "170e48b3b256",
"effects": []
}
},
@@ -171,7 +171,7 @@
"mount": "eb79a9b3682a",
"press": "eb79a9b3682a"
},
- "state": "6967f95147f9",
+ "state": "6a40b555d64d",
"effects": []
}
},
@@ -184,7 +184,7 @@
"mount": "eb79a9b3682a",
"press": "eb79a9b3682a"
},
- "state": "f3e2e816b496",
+ "state": "b590df6ffade",
"effects": ["14bb4c669631"]
}
}
diff --git a/mobile/rpc-foundation/pilot-scenarios.json b/mobile/rpc-foundation/pilot-scenarios.json
index dfcd2902fd2..e7775dee5ce 100644
--- a/mobile/rpc-foundation/pilot-scenarios.json
+++ b/mobile/rpc-foundation/pilot-scenarios.json
@@ -20081,8 +20081,13 @@
"sites": ["mobile/src/settings/notification-display-test.tsx"],
"schedules": [],
"deviceStore": {
+ "orca:pushServiceNotificationsEnabled": "true",
"orca:hosts": "[{\"id\":\"host-1\",\"name\":\"Desk\",\"endpoint\":\"ws://desk.local:7777\",\"publicKeyB64\":\"AAAA\",\"lastConnected\":1700000000000}]"
},
+ "deviceState": {
+ "notificationPermissions": { "status": "granted", "canAskAgain": true },
+ "pushToken": { "type": "ios", "data": "fixture-apns-token" }
+ },
"steps": [
{
"action": "mount",
@@ -20120,8 +20125,13 @@
"sites": ["mobile/src/settings/notification-display-test.tsx"],
"schedules": [],
"deviceStore": {
+ "orca:pushServiceNotificationsEnabled": "true",
"orca:hosts": "[{\"id\":\"host-1\",\"name\":\"Desk\",\"endpoint\":\"ws://desk.local:7777\",\"publicKeyB64\":\"AAAA\",\"lastConnected\":1700000000000}]"
},
+ "deviceState": {
+ "notificationPermissions": { "status": "granted", "canAskAgain": true },
+ "pushToken": { "type": "ios", "data": "fixture-apns-token" }
+ },
"steps": [
{
"action": "mount",
@@ -20160,8 +20170,13 @@
"sites": ["mobile/src/settings/notification-display-test.tsx"],
"schedules": [],
"deviceStore": {
+ "orca:pushServiceNotificationsEnabled": "true",
"orca:hosts": "[{\"id\":\"host-1\",\"name\":\"Desk\",\"endpoint\":\"ws://desk.local:7777\",\"publicKeyB64\":\"AAAA\",\"lastConnected\":1700000000000}]"
},
+ "deviceState": {
+ "notificationPermissions": { "status": "granted", "canAskAgain": true },
+ "pushToken": { "type": "ios", "data": "fixture-apns-token" }
+ },
"steps": [
{
"action": "mount",
@@ -20200,8 +20215,13 @@
"sites": ["mobile/src/settings/notification-display-test.tsx"],
"schedules": [],
"deviceStore": {
+ "orca:pushServiceNotificationsEnabled": "true",
"orca:hosts": "[{\"id\":\"host-1\",\"name\":\"Desk\",\"endpoint\":\"ws://desk.local:7777\",\"publicKeyB64\":\"AAAA\",\"lastConnected\":1700000000000}]"
},
+ "deviceState": {
+ "notificationPermissions": { "status": "granted", "canAskAgain": true },
+ "pushToken": { "type": "ios", "data": "fixture-apns-token" }
+ },
"steps": [
{
"action": "mount",
diff --git a/mobile/src/i18n/locales/de.json b/mobile/src/i18n/locales/de.json
index c7062ad3c92..38485e987c9 100644
--- a/mobile/src/i18n/locales/de.json
+++ b/mobile/src/i18n/locales/de.json
@@ -2718,19 +2718,26 @@
"notificationDisplayTest": {
"accepted": "Vom Push-Dienst von Orca angenommen. Prüfen, ob die Benachrichtigung angekommen ist.",
"connectDesktop": "Eine Verbindung zum Desktop herstellen und erneut versuchen.",
- "description": "Eine Testbenachrichtigung über den Push-Dienst von Orca senden.",
+ "description": "Push-Zustellung oder eine lokale Benachrichtigung testen, wenn Push nicht verfügbar ist.",
"desktopUnreachable": "Der Desktop konnte nicht erreicht werden. Erneut versuchen.",
"loadFailed": "Die gekoppelten Desktops konnten nicht geladen werden.",
"pairDesktop": "Einen Desktop koppeln und erneut versuchen.",
"pushServiceFailed": "Die Benachrichtigung konnte nicht über den Push-Dienst von Orca gesendet werden. Erneut versuchen.",
"rateLimited": "Zu viele Benachrichtigungen. Später erneut versuchen.",
- "reconnectPhone": "Erneut verbinden, um dieses Smartphone für Benachrichtigungen zu registrieren.",
"sendButton": "Testbenachrichtigung senden",
"sendFailed": "Die Push-Testbenachrichtigung konnte nicht gesendet werden.",
"sending": "Wird gesendet…",
"troubleReceivingAlerts": "Probleme beim Empfang von Benachrichtigungen?",
"troubleshooting": "Fehlerbehebung",
- "updateDesktop": "Orca auf dem Desktop aktualisieren, um diesen Test auszuführen."
+ "localTitle": "Testbenachrichtigung",
+ "localBody": "Lokaler Benachrichtigungstest von diesem Telefon.",
+ "localScheduled": "{{reason}} Lokaler Test geplant. Prüfe, ob die Benachrichtigung erscheint. Dies prüft nur die Anzeige, nicht die Zustellung von Agentenmeldungen.",
+ "disabled": "Benachrichtigungen sind in Orca deaktiviert. Aktiviere sie und versuche es erneut.",
+ "osDisabled": "Benachrichtigungen sind in den Systemeinstellungen deaktiviert. Erlaube sie und versuche es erneut.",
+ "noToken": "Auf diesem Telefon ist kein Push-Token verfügbar.",
+ "unsupportedHost": "Dieser Desktop unterstützt keine Push-Benachrichtigungen. Aktualisiere ihn, um Push zu empfangen.",
+ "registrationPending": "Die Push-Registrierung ist auf diesem Desktop noch nicht bereit. Versuche es in Kürze erneut.",
+ "liveFallbackScheduled": "{{reason}} Lokaler Test geplant. Prüfe, ob die Benachrichtigung erscheint. Live-Meldungen sind verfügbar, solange Orca läuft und verbunden ist."
},
"notificationSettingsScreen": {
"description": "Auf diesem Gerät Benachrichtigungen erhalten, wenn ein Agent eine Eingabe benötigt oder eine Aufgabe abschließt.",
diff --git a/mobile/src/i18n/locales/en.json b/mobile/src/i18n/locales/en.json
index 867fb8bf74b..2234157c069 100644
--- a/mobile/src/i18n/locales/en.json
+++ b/mobile/src/i18n/locales/en.json
@@ -80,18 +80,25 @@
"loadFailed": "Could not load paired desktops.",
"pairDesktop": "Pair a desktop and try again.",
"connectDesktop": "Connect a desktop and try again.",
- "updateDesktop": "Update your desktop to run this test.",
"desktopUnreachable": "Could not reach the desktop. Try again.",
"accepted": "Accepted by Orca’s push service. Check for the notification.",
- "reconnectPhone": "Reconnect to register this phone for notifications.",
"rateLimited": "Too many notifications. Try again later.",
"pushServiceFailed": "Could not send through Orca’s push service. Try again.",
"sendFailed": "Could not send push test.",
"troubleReceivingAlerts": "Having trouble receiving alerts?",
- "description": "Send a test through Orca’s push service.",
+ "description": "Test push delivery, or a local notification when push is unavailable.",
"sending": "Sending…",
"sendButton": "Send test notification",
- "troubleshooting": "Troubleshooting"
+ "troubleshooting": "Troubleshooting",
+ "localTitle": "Test notification",
+ "localBody": "Local notification test from this phone.",
+ "localScheduled": "{{reason}} Local test scheduled. Check for the notification. This checks display only; it does not verify agent alert delivery.",
+ "disabled": "Notifications are turned off in Orca. Enable notifications and try again.",
+ "osDisabled": "Notifications are turned off in system settings. Allow notifications and try again.",
+ "noToken": "No push token is available on this phone.",
+ "unsupportedHost": "This desktop does not support push notifications. Update it to receive push.",
+ "registrationPending": "Push registration is not ready on this desktop. Try again shortly.",
+ "liveFallbackScheduled": "{{reason}} Local test scheduled. Check for the notification. Live alerts are available while Orca is running and connected."
},
"notificationSettingsScreen": {
"loadFailed": "Could not load notification settings. Try again.",
diff --git a/mobile/src/i18n/locales/es.json b/mobile/src/i18n/locales/es.json
index befc509224a..e774aadf9cf 100644
--- a/mobile/src/i18n/locales/es.json
+++ b/mobile/src/i18n/locales/es.json
@@ -2797,19 +2797,26 @@
"notificationDisplayTest": {
"accepted": "Prueba aceptada por el servicio de notificaciones push de Orca. Comprueba si recibes la notificación.",
"connectDesktop": "Conéctate a un escritorio y vuelve a intentarlo.",
- "description": "Envía una prueba a través del servicio de notificaciones push de Orca.",
+ "description": "Prueba la entrega de notificaciones push, o una notificación local si push no está disponible.",
"desktopUnreachable": "No se pudo conectar con el escritorio. Vuelve a intentarlo.",
"loadFailed": "No se pudieron cargar los escritorios emparejados.",
"pairDesktop": "Empareja un escritorio y vuelve a intentarlo.",
"pushServiceFailed": "No se pudo enviar a través del servicio de notificaciones push de Orca. Vuelve a intentarlo.",
"rateLimited": "Demasiadas notificaciones. Vuelve a intentarlo más tarde.",
- "reconnectPhone": "Vuelve a conectarte para registrar este teléfono para recibir notificaciones.",
"sendButton": "Enviar notificación de prueba",
"sendFailed": "No se pudo enviar la notificación push de prueba.",
"sending": "Enviando…",
"troubleReceivingAlerts": "¿Tienes problemas para recibir alertas?",
"troubleshooting": "Solución de problemas",
- "updateDesktop": "Actualiza tu escritorio para realizar esta prueba."
+ "localTitle": "Notificación de prueba",
+ "localBody": "Prueba de notificación local desde este teléfono.",
+ "localScheduled": "{{reason}} Prueba local programada. Comprueba si aparece la notificación. Esto solo comprueba la visualización, no la entrega de alertas de agentes.",
+ "disabled": "Las notificaciones están desactivadas en Orca. Actívalas e inténtalo de nuevo.",
+ "osDisabled": "Las notificaciones están desactivadas en los ajustes del sistema. Permítelas e inténtalo de nuevo.",
+ "noToken": "No hay ningún token push disponible en este teléfono.",
+ "unsupportedHost": "Este ordenador no admite notificaciones push. Actualízalo para recibirlas.",
+ "registrationPending": "El registro push aún no está listo en este ordenador. Inténtalo de nuevo en breve.",
+ "liveFallbackScheduled": "{{reason}} Prueba local programada. Comprueba si aparece la notificación. Las alertas en directo están disponibles mientras Orca está en ejecución y conectado."
},
"notificationSettingsScreen": {
"description": "Recibe notificaciones en este dispositivo cuando un agente necesite tu intervención o termine una tarea.",
diff --git a/mobile/src/i18n/locales/fr.json b/mobile/src/i18n/locales/fr.json
index 2e0dbbbff06..6c2c5734feb 100644
--- a/mobile/src/i18n/locales/fr.json
+++ b/mobile/src/i18n/locales/fr.json
@@ -2797,19 +2797,26 @@
"notificationDisplayTest": {
"accepted": "Test accepté par le service de notifications push d'Orca. Vérifiez si vous avez reçu la notification.",
"connectDesktop": "Connectez-vous à un ordinateur, puis réessayez.",
- "description": "Envoyez un test via le service de notifications push d'Orca.",
+ "description": "Testez la réception push, ou une notification locale si le push est indisponible.",
"desktopUnreachable": "Impossible de joindre l'ordinateur. Réessayez.",
"loadFailed": "Impossible de charger les ordinateurs appairés.",
"pairDesktop": "Appairez un ordinateur, puis réessayez.",
"pushServiceFailed": "Impossible d'envoyer le test via le service de notifications push d'Orca. Réessayez.",
"rateLimited": "Trop de notifications. Réessayez plus tard.",
- "reconnectPhone": "Reconnectez-vous pour enregistrer ce téléphone auprès du service de notifications.",
"sendButton": "Envoyer une notification de test",
"sendFailed": "Impossible d'envoyer la notification push de test.",
"sending": "Envoi…",
"troubleReceivingAlerts": "Vous avez du mal à recevoir les alertes ?",
"troubleshooting": "Dépannage",
- "updateDesktop": "Mettez Orca à jour sur votre ordinateur pour lancer ce test."
+ "localTitle": "Notification de test",
+ "localBody": "Test de notification locale depuis ce téléphone.",
+ "localScheduled": "{{reason}} Test local programmé. Vérifiez la notification. Ce test vérifie uniquement son affichage, pas la réception des alertes des agents.",
+ "disabled": "Les notifications sont désactivées dans Orca. Activez-les et réessayez.",
+ "osDisabled": "Les notifications sont désactivées dans les réglages système. Autorisez-les et réessayez.",
+ "noToken": "Aucun jeton push n’est disponible sur ce téléphone.",
+ "unsupportedHost": "Cet ordinateur ne prend pas en charge les notifications push. Mettez-le à jour pour les recevoir.",
+ "registrationPending": "L’inscription push n’est pas encore prête sur cet ordinateur. Réessayez dans un instant.",
+ "liveFallbackScheduled": "{{reason}} Test local programmé. Vérifiez la notification. Les alertes en direct sont disponibles tant qu’Orca est en cours d’exécution et connecté."
},
"notificationSettingsScreen": {
"description": "Recevez une notification sur cet appareil lorsqu'un agent a besoin de votre intervention ou termine une tâche.",
diff --git a/mobile/src/i18n/locales/ja.json b/mobile/src/i18n/locales/ja.json
index 9b544b325e2..08cb70e56d3 100644
--- a/mobile/src/i18n/locales/ja.json
+++ b/mobile/src/i18n/locales/ja.json
@@ -2714,19 +2714,26 @@
"notificationDisplayTest": {
"accepted": "Orca のプッシュサービスが通知を受け付けました。通知が届いているか確認してください。",
"connectDesktop": "デスクトップに接続してから再試行してください。",
- "description": "Orca のプッシュサービス経由でテスト通知を送信します。",
+ "description": "プッシュ通知の配信をテストします。プッシュを利用できない場合はローカル通知をテストします。",
"desktopUnreachable": "デスクトップに接続できませんでした。再試行してください。",
"loadFailed": "ペアリング済みのデスクトップ一覧を読み込めませんでした。",
"pairDesktop": "デスクトップとペアリングしてから再試行してください。",
"pushServiceFailed": "Orca のプッシュサービス経由で送信できませんでした。再試行してください。",
"rateLimited": "通知が多すぎます。しばらくしてから再試行してください。",
- "reconnectPhone": "このスマートフォンを通知の受信先として登録するには、再接続してください。",
"sendButton": "テスト通知を送信する",
"sendFailed": "テスト用のプッシュ通知を送信できませんでした。",
"sending": "送信中…",
"troubleReceivingAlerts": "通知が届きませんか?",
"troubleshooting": "トラブルシューティング",
- "updateDesktop": "このテストを実行するには、デスクトップを更新してください。"
+ "localTitle": "テスト通知",
+ "localBody": "この端末からのローカル通知テストです。",
+ "localScheduled": "{{reason}} ローカルテストを予約しました。通知を確認してください。このテストは表示のみを確認し、Agentのアラート配信は確認しません。",
+ "disabled": "Orca の通知がオフになっています。通知を有効にして、もう一度お試しください。",
+ "osDisabled": "システム設定で通知がオフになっています。通知を許可して、もう一度お試しください。",
+ "noToken": "この端末ではプッシュトークンを利用できません。",
+ "unsupportedHost": "このデスクトップはプッシュ通知に対応していません。受信するには更新してください。",
+ "registrationPending": "このデスクトップではプッシュ登録がまだ完了していません。しばらくしてからもう一度お試しください。",
+ "liveFallbackScheduled": "{{reason}} ローカルテストを予約しました。通知を確認してください。Orca が実行中で接続されている間は、リアルタイムのアラートを受信できます。"
},
"notificationSettingsScreen": {
"description": "Agent が入力を必要とするときやタスクを完了したときに、このデバイスに通知が届きます。",
diff --git a/mobile/src/i18n/locales/ko.json b/mobile/src/i18n/locales/ko.json
index cab462d4ed1..85d9effedae 100644
--- a/mobile/src/i18n/locales/ko.json
+++ b/mobile/src/i18n/locales/ko.json
@@ -2714,19 +2714,26 @@
"notificationDisplayTest": {
"accepted": "Orca 푸시 서비스에서 요청을 접수했습니다. 알림이 도착했는지 확인하세요.",
"connectDesktop": "데스크톱에 연결한 후 다시 시도하세요.",
- "description": "Orca 푸시 서비스를 통해 테스트 알림을 보내세요.",
+ "description": "푸시 알림 전달을 테스트하거나, 푸시를 사용할 수 없으면 로컬 알림을 테스트합니다.",
"desktopUnreachable": "데스크톱에 연결하지 못했습니다. 다시 시도하세요.",
"loadFailed": "페어링된 데스크톱 목록을 불러오지 못했습니다.",
"pairDesktop": "데스크톱을 페어링한 후 다시 시도하세요.",
"pushServiceFailed": "Orca 푸시 서비스를 통해 전송하지 못했습니다. 다시 시도하세요.",
"rateLimited": "알림이 너무 많습니다. 나중에 다시 시도하세요.",
- "reconnectPhone": "이 휴대폰을 알림 수신 기기로 등록하려면 다시 연결하세요.",
"sendButton": "테스트 알림 보내기",
"sendFailed": "테스트 푸시 알림을 전송하지 못했습니다.",
"sending": "전송 중…",
"troubleReceivingAlerts": "알림 수신에 문제가 있나요?",
"troubleshooting": "문제 해결",
- "updateDesktop": "이 테스트를 실행하려면 데스크톱을 업데이트하세요."
+ "localTitle": "테스트 알림",
+ "localBody": "이 휴대전화의 로컬 알림 테스트입니다.",
+ "localScheduled": "{{reason}} 로컬 테스트를 예약했습니다. 알림을 확인하세요. 이 테스트는 표시만 확인하며 Agent 알림 전달은 확인하지 않습니다.",
+ "disabled": "Orca에서 알림이 꺼져 있습니다. 알림을 켜고 다시 시도하세요.",
+ "osDisabled": "시스템 설정에서 알림이 꺼져 있습니다. 알림을 허용하고 다시 시도하세요.",
+ "noToken": "이 휴대전화에서 사용할 수 있는 푸시 토큰이 없습니다.",
+ "unsupportedHost": "이 데스크톱은 푸시 알림을 지원하지 않습니다. 푸시를 받으려면 업데이트하세요.",
+ "registrationPending": "이 데스크톱의 푸시 등록이 아직 준비되지 않았습니다. 잠시 후 다시 시도하세요.",
+ "liveFallbackScheduled": "{{reason}} 로컬 테스트를 예약했습니다. 알림을 확인하세요. Orca가 실행 중이고 연결되어 있는 동안 실시간 알림을 받을 수 있습니다."
},
"notificationSettingsScreen": {
"description": "에이전트가 입력을 요청하거나 작업을 완료하면 이 기기에서 알림을 받으세요.",
diff --git a/mobile/src/i18n/locales/pt.json b/mobile/src/i18n/locales/pt.json
index 3448e839fe2..ae3665c92d3 100644
--- a/mobile/src/i18n/locales/pt.json
+++ b/mobile/src/i18n/locales/pt.json
@@ -2797,19 +2797,26 @@
"notificationDisplayTest": {
"accepted": "O serviço de notificações push do Orca aceitou o teste. Verifique se a notificação chegou.",
"connectDesktop": "Conecte um desktop e tente novamente.",
- "description": "Envie um teste pelo serviço de notificações push do Orca.",
+ "description": "Teste a entrega de notificações push ou uma notificação local quando o push não estiver disponível.",
"desktopUnreachable": "Não foi possível acessar o desktop. Tente novamente.",
"loadFailed": "Não foi possível carregar os desktops pareados.",
"pairDesktop": "Pareie um desktop e tente novamente.",
"pushServiceFailed": "Não foi possível enviar pelo serviço de notificações push do Orca. Tente novamente.",
"rateLimited": "Notificações demais. Tente novamente mais tarde.",
- "reconnectPhone": "Reconecte-se para registrar este celular para receber notificações.",
"sendButton": "Enviar Notificação de Teste",
"sendFailed": "Não foi possível enviar o teste de notificação push.",
"sending": "Enviando…",
"troubleReceivingAlerts": "Está com dificuldade para receber alertas?",
"troubleshooting": "Solução de problemas",
- "updateDesktop": "Atualize seu desktop para executar este teste."
+ "localTitle": "Notificação de teste",
+ "localBody": "Teste de notificação local deste telefone.",
+ "localScheduled": "{{reason}} Teste local agendado. Verifique a notificação. Este teste verifica apenas a exibição, não a entrega de alertas dos agentes.",
+ "disabled": "As notificações estão desativadas no Orca. Ative-as e tente novamente.",
+ "osDisabled": "As notificações estão desativadas nas configurações do sistema. Permita-as e tente novamente.",
+ "noToken": "Nenhum token push está disponível neste telefone.",
+ "unsupportedHost": "Este computador não oferece suporte a notificações push. Atualize-o para recebê-las.",
+ "registrationPending": "O registro push ainda não está pronto neste computador. Tente novamente em instantes.",
+ "liveFallbackScheduled": "{{reason}} Teste local agendado. Verifique a notificação. Os alertas ao vivo estão disponíveis enquanto o Orca estiver em execução e conectado."
},
"notificationSettingsScreen": {
"description": "Receba notificações neste dispositivo quando um agente precisar da sua resposta ou concluir uma tarefa.",
diff --git a/mobile/src/i18n/locales/ru.json b/mobile/src/i18n/locales/ru.json
index daf2c1bd921..8526bc980dd 100644
--- a/mobile/src/i18n/locales/ru.json
+++ b/mobile/src/i18n/locales/ru.json
@@ -2876,19 +2876,26 @@
"notificationDisplayTest": {
"accepted": "Служба push-уведомлений Orca приняла запрос. Проверьте, пришло ли уведомление.",
"connectDesktop": "Подключитесь к компьютеру и повторите попытку.",
- "description": "Отправьте тестовое уведомление через службу push-уведомлений Orca.",
+ "description": "Проверьте доставку push-уведомления или локального уведомления, если push недоступен.",
"desktopUnreachable": "Не удалось связаться с компьютером. Повторите попытку.",
"loadFailed": "Не удалось загрузить список сопряжённых компьютеров.",
"pairDesktop": "Выполните сопряжение с компьютером и повторите попытку.",
"pushServiceFailed": "Не удалось отправить через службу push-уведомлений Orca. Повторите попытку.",
"rateLimited": "Слишком много уведомлений. Повторите попытку позже.",
- "reconnectPhone": "Подключитесь заново, чтобы зарегистрировать этот телефон для получения уведомлений.",
"sendButton": "Отправить тестовое уведомление",
"sendFailed": "Не удалось отправить тестовое push-уведомление.",
"sending": "Отправка…",
"troubleReceivingAlerts": "Не приходят уведомления?",
"troubleshooting": "Устранение неполадок",
- "updateDesktop": "Обновите Orca на компьютере, чтобы выполнить эту проверку."
+ "localTitle": "Тестовое уведомление",
+ "localBody": "Тест локального уведомления с этого телефона.",
+ "localScheduled": "{{reason}} Локальный тест запланирован. Проверьте уведомление. Это проверяет только отображение, а не доставку оповещений агентов.",
+ "disabled": "Уведомления в Orca отключены. Включите их и повторите попытку.",
+ "osDisabled": "Уведомления отключены в настройках системы. Разрешите их и повторите попытку.",
+ "noToken": "На этом телефоне нет доступного push-токена.",
+ "unsupportedHost": "Этот компьютер не поддерживает push-уведомления. Обновите его, чтобы получать push.",
+ "registrationPending": "Регистрация push на этом компьютере ещё не готова. Повторите попытку чуть позже.",
+ "liveFallbackScheduled": "{{reason}} Локальный тест запланирован. Проверьте уведомление. Оповещения в реальном времени доступны, пока Orca работает и подключена."
},
"notificationSettingsScreen": {
"description": "Получайте уведомления на этом устройстве, когда агенту нужен ваш ответ или он завершает задачу.",
diff --git a/mobile/src/i18n/locales/tr.json b/mobile/src/i18n/locales/tr.json
index 79b56a695a5..44afc2f6942 100644
--- a/mobile/src/i18n/locales/tr.json
+++ b/mobile/src/i18n/locales/tr.json
@@ -2718,19 +2718,26 @@
"notificationDisplayTest": {
"accepted": "Orca'nın anlık bildirim hizmeti tarafından kabul edildi. Bildirimin gelip gelmediğini kontrol edin.",
"connectDesktop": "Bir masaüstü bilgisayara bağlanın ve yeniden deneyin.",
- "description": "Orca'nın anlık bildirim hizmeti üzerinden bir test bildirimi gönderin.",
+ "description": "Anlık bildirim iletimini veya kullanılamıyorsa yerel bir bildirimi test edin.",
"desktopUnreachable": "Masaüstü bilgisayara ulaşılamadı. Yeniden deneyin.",
"loadFailed": "Eşleştirilmiş masaüstü bilgisayarlar yüklenemedi.",
"pairDesktop": "Bir masaüstü bilgisayarla eşleştirin ve yeniden deneyin.",
"pushServiceFailed": "Orca'nın anlık bildirim hizmeti üzerinden gönderilemedi. Yeniden deneyin.",
"rateLimited": "Çok fazla bildirim gönderildi. Daha sonra yeniden deneyin.",
- "reconnectPhone": "Bu telefonu bildirimler için kaydetmek üzere yeniden bağlanın.",
"sendButton": "Test bildirimi gönder",
"sendFailed": "Anlık bildirim testi gönderilemedi.",
"sending": "Gönderiliyor…",
"troubleReceivingAlerts": "Bildirim almakta sorun mu yaşıyorsunuz?",
"troubleshooting": "Sorun Giderme",
- "updateDesktop": "Bu testi çalıştırmak için masaüstü uygulamanızı güncelleyin."
+ "localTitle": "Test bildirimi",
+ "localBody": "Bu telefondan yerel bildirim testi.",
+ "localScheduled": "{{reason}} Yerel test planlandı. Bildirimi kontrol edin. Bu test yalnızca gösterimi denetler; ajan uyarılarının iletimini doğrulamaz.",
+ "disabled": "Orca bildirimleri kapalı. Bildirimleri açıp tekrar deneyin.",
+ "osDisabled": "Sistem ayarlarında bildirimler kapalı. Bildirimlere izin verip tekrar deneyin.",
+ "noToken": "Bu telefonda kullanılabilir anlık bildirim belirteci yok.",
+ "unsupportedHost": "Bu masaüstü anlık bildirimleri desteklemiyor. Almak için güncelleyin.",
+ "registrationPending": "Bu masaüstünde anlık bildirim kaydı henüz hazır değil. Kısa süre sonra tekrar deneyin.",
+ "liveFallbackScheduled": "{{reason}} Yerel test planlandı. Bildirimi kontrol edin. Orca çalışır ve bağlı durumdayken canlı uyarılar alınabilir."
},
"notificationSettingsScreen": {
"description": "Bir ajan sizden yanıt beklediğinde veya bir görevi tamamladığında bu cihazda bildirim alın.",
diff --git a/mobile/src/i18n/locales/zh-Hant.json b/mobile/src/i18n/locales/zh-Hant.json
index f5433c89099..ce9cf32ca81 100644
--- a/mobile/src/i18n/locales/zh-Hant.json
+++ b/mobile/src/i18n/locales/zh-Hant.json
@@ -2714,19 +2714,26 @@
"notificationDisplayTest": {
"accepted": "Orca 的推播服務已接受請求。請查看是否收到通知。",
"connectDesktop": "請先連線至電腦,再試一次。",
- "description": "透過 Orca 的推播服務傳送測試通知。",
+ "description": "測試推播送達;推播無法使用時,測試本機通知。",
"desktopUnreachable": "無法連線至電腦,請再試一次。",
"loadFailed": "無法載入已配對的電腦。",
"pairDesktop": "請先配對電腦,再試一次。",
"pushServiceFailed": "無法透過 Orca 的推播服務傳送,請再試一次。",
"rateLimited": "通知過多,請稍後再試。",
- "reconnectPhone": "請重新連線,將此手機註冊為通知接收裝置。",
"sendButton": "傳送測試通知",
"sendFailed": "無法傳送測試推播。",
"sending": "正在傳送…",
"troubleReceivingAlerts": "接收通知時遇到問題嗎?",
"troubleshooting": "疑難排解",
- "updateDesktop": "請更新電腦上的 Orca,以執行此測試。"
+ "localTitle": "測試通知",
+ "localBody": "來自此手機的本機通知測試。",
+ "localScheduled": "{{reason}} 已安排本機測試。請檢查通知。此測試僅驗證顯示,不驗證代理程式提醒是否送達。",
+ "disabled": "Orca 中的通知已關閉。請啟用通知後再試。",
+ "osDisabled": "系統設定中的通知已關閉。請允許通知後再試。",
+ "noToken": "此手機上沒有可用的推播權杖。",
+ "unsupportedHost": "此桌面端不支援推播通知。請更新以接收推播。",
+ "registrationPending": "此桌面端的推播註冊尚未就緒。請稍後再試。",
+ "liveFallbackScheduled": "{{reason}} 已安排本機測試。請檢查通知。Orca 執行且保持連線時,可接收即時提醒。"
},
"notificationSettingsScreen": {
"description": "當代理程式需要您的回應或完成任務時,在此裝置上接收通知。",
diff --git a/mobile/src/i18n/locales/zh.json b/mobile/src/i18n/locales/zh.json
index 61c8a120cde..e38731d692f 100644
--- a/mobile/src/i18n/locales/zh.json
+++ b/mobile/src/i18n/locales/zh.json
@@ -2714,19 +2714,26 @@
"notificationDisplayTest": {
"accepted": "Orca 推送服务已接受请求。请查看通知。",
"connectDesktop": "请先连接桌面,然后重试。",
- "description": "通过 Orca 推送服务发送测试通知。",
+ "description": "测试推送送达;推送不可用时,测试本地通知。",
"desktopUnreachable": "无法连接到桌面。请重试。",
"loadFailed": "无法加载已配对的桌面。",
"pairDesktop": "请先配对桌面,然后重试。",
"pushServiceFailed": "无法通过 Orca 推送服务发送。请重试。",
"rateLimited": "通知发送过于频繁。请稍后重试。",
- "reconnectPhone": "请重新连接,将此手机注册为通知接收设备。",
"sendButton": "发送测试通知",
"sendFailed": "无法发送测试推送。",
"sending": "正在发送…",
"troubleReceivingAlerts": "接收提醒遇到问题?",
"troubleshooting": "故障排查",
- "updateDesktop": "请更新桌面以运行此测试。"
+ "localTitle": "测试通知",
+ "localBody": "来自此手机的本地通知测试。",
+ "localScheduled": "{{reason}} 已安排本地测试。请检查通知。此测试仅验证显示,不验证Agent提醒是否送达。",
+ "disabled": "Orca 中的通知已关闭。请启用通知后重试。",
+ "osDisabled": "系统设置中的通知已关闭。请允许通知后重试。",
+ "noToken": "此手机上没有可用的推送令牌。",
+ "unsupportedHost": "此桌面端不支持推送通知。请更新以接收推送。",
+ "registrationPending": "此桌面端的推送注册尚未就绪。请稍后重试。",
+ "liveFallbackScheduled": "{{reason}} 已安排本地测试。请检查通知。Orca 运行且保持连接时,可接收实时提醒。"
},
"notificationSettingsScreen": {
"description": "智能体需要您提供输入或已完成任务时,在此设备上接收通知。",
diff --git a/mobile/src/notifications/android-foreground-push.ts b/mobile/src/notifications/android-foreground-push.ts
index cbff78d0bf2..a7a05653514 100644
--- a/mobile/src/notifications/android-foreground-push.ts
+++ b/mobile/src/notifications/android-foreground-push.ts
@@ -3,6 +3,34 @@ import * as Notifications from 'expo-notifications'
import { canPresentForegroundPush } from './push-receive'
import { readOrcaPushPayload } from './push-payload'
+export async function presentForegroundPush(
+ identifier: string,
+ content: Pick<Notifications.NotificationContent, 'title' | 'body' | 'data' | 'sound'>,
+ prepare: () => boolean | Promise<boolean> = () => true,
+ isCurrent: () => boolean = () => true
+): Promise<void> {
+ const payload = readOrcaPushPayload(content.data)
+ if (
+ !payload ||
+ !(await prepare()) ||
+ !(await canPresentForegroundPush(payload)) ||
+ !isCurrent()
+ ) {
+ return
+ }
+ await Notifications.scheduleNotificationAsync({
+ identifier,
+ content: {
+ title: content.title,
+ body: content.body,
+ data: content.data,
+ sound: content.sound === 'default' ? 'default' : false
+ },
+ trigger:
+ typeof content.data?.channelId === 'string' ? { channelId: content.data.channelId } : null
+ })
+}
+
export function startAndroidForegroundPushPresentation(): () => void {
if (Platform.OS !== 'android') {
return () => {}
@@ -24,26 +52,9 @@ export function startAndroidForegroundPushPresentation(): () => void {
return
}
- void present().catch((error: unknown) => {
+ void presentForegroundPush(identifier, content).catch((error: unknown) => {
console.warn('[push] Foreground notification presentation failed', error)
})
-
- async function present(): Promise<void> {
- if (!payload || !(await canPresentForegroundPush(payload))) {
- return
- }
- await Notifications.scheduleNotificationAsync({
- identifier,
- content: {
- title: content.title,
- body: content.body,
- data: content.data,
- sound: content.sound === 'default' ? 'default' : false
- },
- trigger:
- typeof content.data?.channelId === 'string' ? { channelId: content.data.channelId } : null
- })
- }
})
return () => subscription.remove()
}
diff --git a/mobile/src/notifications/host-push-registration-state.ts b/mobile/src/notifications/host-push-registration-state.ts
new file mode 100644
index 00000000000..893592136fa
--- /dev/null
+++ b/mobile/src/notifications/host-push-registration-state.ts
@@ -0,0 +1,43 @@
+import type { RpcOperationSender } from '../transport/rpc-operation-sender'
+
+export type HostPushState = {
+ connection: {
+ client: RpcOperationSender | null
+ support: ReturnType<typeof createHostPushSupportCompletion> | null
+ }
+ // An unanswered probe is unknown, not unsupported.
+ supported: boolean | null
+ capabilityProbeStop: (() => void) | null
+ chain: Promise<void>
+}
+
+export type HostPushSupportCompletion = {
+ readonly completed: Promise<boolean | null>
+ readonly signal: AbortSignal
+}
+
+export function createHostPushSupportCompletion() {
+ let complete: (supported: boolean | null) => void = () => {}
+ const completed = new Promise<boolean | null>((resolve) => {
+ complete = resolve
+ })
+ const controller = new AbortController()
+ return {
+ completed,
+ signal: controller.signal,
+ complete,
+ retire() {
+ complete(null)
+ controller.abort()
+ }
+ }
+}
+
+export function createHostPushState(): HostPushState {
+ return {
+ connection: { client: null, support: null },
+ supported: null,
+ capabilityProbeStop: null,
+ chain: Promise.resolve()
+ }
+}
diff --git a/mobile/src/notifications/mobile-notifications.test.ts b/mobile/src/notifications/mobile-notifications.test.ts
index 87c867f3954..51144921c66 100644
--- a/mobile/src/notifications/mobile-notifications.test.ts
+++ b/mobile/src/notifications/mobile-notifications.test.ts
@@ -6,6 +6,36 @@ import { RpcClientStreamRegistry } from '../transport/rpc-client-stream-registry
import { MobileRelayRpcStreams } from '../transport/mobile-relay-rpc-streams'
import type { RpcClient } from '../transport/rpc-client'
import type { RpcResponse } from '../transport/types'
+import { deriveHostFingerprint } from './push-host-fingerprint'
+
+const fallback = vi.hoisted(() => ({
+ token: vi.fn(),
+ supported: vi.fn(),
+ completion: { completed: Promise.resolve(true), signal: new AbortController().signal },
+ eligible: vi.fn(),
+ schedule: vi.fn(),
+ preferences: { onlyWhenDesktopAway: true, sound: true, suppressWhileViewing: true }
+}))
+vi.mock('./push-token', () => ({ getDevicePushToken: fallback.token }))
+vi.mock('./push-registration', () => ({
+ getHostPushSupported: fallback.supported,
+ getHostPushSupportCompletion: () => fallback.completion
+}))
+vi.mock('./push-receive', () => ({ canPresentForegroundPush: fallback.eligible }))
+vi.mock('expo-notifications', () => ({ scheduleNotificationAsync: fallback.schedule }))
+vi.mock('react-native', () => ({ Platform: { OS: 'ios' } }))
+vi.mock('./desktop-notification-channel', () => ({
+ ensureDesktopNotificationChannel: vi.fn(),
+ DESKTOP_NOTIFICATION_CHANNEL_ID: 'orca-desktop'
+}))
+vi.mock('./notification-delivery-preferences', () => ({
+ loadNotificationDeliveryPreferences: async () => fallback.preferences
+}))
+vi.mock('../transport/host-store', () => ({
+ loadHostCatalog: async () => [
+ { id: 'host-1', publicKeyB64: 'AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE=' }
+ ]
+}))
vi.mock('./push-socket-dismissal', () => ({
dismissHostPushNotification: vi.fn(async () => {})
@@ -131,20 +161,175 @@ function client() {
}
}
-beforeEach(() => vi.clearAllMocks())
+beforeEach(() => {
+ vi.clearAllMocks()
+ fallback.token.mockResolvedValue({ platform: 'ios', token: 'apns' })
+ fallback.supported.mockReturnValue(true)
+ fallback.eligible.mockResolvedValue(true)
+ fallback.schedule.mockResolvedValue('local')
+ fallback.preferences = { onlyWhenDesktopAway: true, sound: true, suppressWhileViewing: true }
+})
+
+const liveAlert = {
+ type: 'notification',
+ source: 'agent-task-complete',
+ title: 'Needs input',
+ body: 'Reply',
+ notificationId: 'agent-1',
+ notificationEpoch: 'epoch-1',
+ notificationSeq: 4,
+ paneKey: 'pane-1',
+ worktreeId: 'workspace-1',
+ executionHost: 'runtime:ssh-1'
+}
+
+function emitAlert(event: unknown = liveAlert) {
+ const rpc = registryClient()
+ const stop = subscribeToDesktopNotifications(rpc.client, 'host-1')
+ rpc.registry.handleResponse({
+ id: rpc.sent[0]!.id,
+ ok: true,
+ streaming: true,
+ result: event,
+ _meta: { runtimeId: 'runtime-1' }
+ })
+ return stop
+}
+
+it.each([true, false, null])(
+ 'presents live alerts without a token (host push support %s)',
+ async (support) => {
+ fallback.token.mockResolvedValue(null)
+ fallback.supported.mockReturnValue(support)
+ emitAlert()
+ await vi.waitFor(() => expect(fallback.schedule).toHaveBeenCalledOnce())
+ expect(fallback.schedule.mock.calls[0][0]).toMatchObject({
+ content: {
+ title: 'Needs input',
+ body: 'Reply',
+ sound: 'default',
+ data: {
+ hostFingerprint: deriveHostFingerprint('AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE='),
+ notificationId: 'agent-1',
+ notificationEpoch: 'epoch-1',
+ notificationSeq: 4,
+ paneKey: 'pane-1',
+ worktreeId: 'workspace-1',
+ executionHost: 'runtime:ssh-1'
+ }
+ }
+ })
+ }
+)
+
+it('presents an unsupported host with a token, using the silent channel preference', async () => {
+ fallback.supported.mockReturnValue(false)
+ fallback.preferences.sound = false
+ emitAlert()
+ await vi.waitFor(() => expect(fallback.schedule).toHaveBeenCalledOnce())
+ expect(fallback.schedule.mock.calls[0][0]).toMatchObject({
+ content: { sound: false, data: { channelId: 'orca-desktop-silent' } },
+ trigger: { channelId: 'orca-desktop-silent' }
+ })
+})
+
+it.each([true, null])(
+ 'does not race push registration when a token exists (support %s)',
+ async (support) => {
+ fallback.supported.mockReturnValue(support)
+ emitAlert()
+ await new Promise((resolve) => setTimeout(resolve, 0))
+ expect(fallback.schedule).not.toHaveBeenCalled()
+ }
+)
+
+it.each([
+ { desktopAllowed: false },
+ { desktopAway: false },
+ { source: 'test' },
+ { agentState: 'working' }
+])('applies push eligibility to desktop-suppressed stream frames %j', async (fields) => {
+ fallback.token.mockResolvedValue(null)
+ emitAlert({ ...liveAlert, ...fields })
+ await new Promise((resolve) => setTimeout(resolve, 0))
+ expect(fallback.schedule).not.toHaveBeenCalled()
+})
+
+it('delegates foreground eligibility before scheduling', async () => {
+ fallback.token.mockResolvedValue(null)
+ fallback.eligible.mockResolvedValue(false)
+ emitAlert()
+ await vi.waitFor(() => expect(fallback.eligible).toHaveBeenCalled())
+ expect(fallback.schedule).not.toHaveBeenCalled()
+})
+
+it('does not schedule after a subscription is disposed during token lookup', async () => {
+ let finish: (value: null) => void = () => {}
+ fallback.token.mockReturnValue(
+ new Promise<null>((resolve) => {
+ finish = resolve
+ })
+ )
+ const stop = emitAlert()
+ stop()
+ finish(null)
+ await new Promise((resolve) => setTimeout(resolve, 0))
+ expect(fallback.schedule).not.toHaveBeenCalled()
+})
+
+it('uses an unsupported capability answer that arrives during token lookup', async () => {
+ let finish: (value: { platform: string; token: string }) => void = () => {}
+ fallback.supported.mockReturnValue(null)
+ fallback.token.mockReturnValue(
+ new Promise((resolve) => {
+ finish = resolve
+ })
+ )
+ emitAlert()
+ fallback.supported.mockReturnValue(false)
+ finish({ platform: 'ios', token: 'apns' })
+ await vi.waitFor(() => expect(fallback.schedule).toHaveBeenCalledOnce())
+})
+
+it('rechecks the device token during final fallback preparation', async () => {
+ fallback.token.mockResolvedValueOnce(null).mockResolvedValue({ platform: 'ios', token: 'apns' })
+ emitAlert()
+ await new Promise((resolve) => setTimeout(resolve, 0))
+ expect(fallback.schedule).not.toHaveBeenCalled()
+})
+
+it.each(['disposal', 'host-upgrade'])(
+ 'rechecks delivery authority after foreground eligibility (%s)',
+ async (change) => {
+ let finish: (eligible: boolean) => void = () => {}
+ fallback.token.mockResolvedValue(null)
+ if (change === 'host-upgrade') {
+ fallback.supported.mockReturnValue(false)
+ fallback.token.mockResolvedValue({ platform: 'ios', token: 'apns' })
+ }
+ fallback.eligible.mockReturnValue(
+ new Promise<boolean>((resolve) => {
+ finish = resolve
+ })
+ )
+ const stop = emitAlert()
+ await vi.waitFor(() => expect(fallback.eligible).toHaveBeenCalledOnce())
+ if (change === 'disposal') {
+ stop()
+ } else {
+ fallback.supported.mockReturnValue(true)
+ }
+ finish(true)
+ await new Promise((resolve) => setTimeout(resolve, 0))
+ expect(fallback.schedule).not.toHaveBeenCalled()
+ }
+)
describe('subscribeToDesktopNotifications', () => {
- it('catches up on ready and ignores socket alert events', async () => {
+ it('requests dismissal reconciliation on ready', async () => {
const rpc = client()
subscribeToDesktopNotifications(rpc as never, 'host-1')
rpc.emit({ type: 'ready', subscriptionId: 'sub-1', epoch: 'epoch-1' })
- rpc.emit({
- type: 'notification',
- notificationId: 'agent-1',
- title: 'Needs input',
- body: 'Reply',
- source: 'agent-task-complete'
- })
await Promise.resolve()
expect(requestNotificationCatchup).toHaveBeenCalledWith(rpc, 'host-1', expect.any(Function))
expect(dismissHostPushNotification).not.toHaveBeenCalled()
diff --git a/mobile/src/notifications/mobile-notifications.ts b/mobile/src/notifications/mobile-notifications.ts
index edc770b9d19..7470cf3d7bf 100644
--- a/mobile/src/notifications/mobile-notifications.ts
+++ b/mobile/src/notifications/mobile-notifications.ts
@@ -2,6 +2,22 @@ import { requestNotificationCatchup } from './push-dismissal-reconciliation'
import { dismissHostPushNotification } from './push-socket-dismissal'
import type { DismissNotificationEvent } from './desktop-notification-events'
import type { RpcClient } from '../transport/rpc-client'
+import { waitForPushFallback } from './push-fallback'
+import { getHostPushSupported, getHostPushSupportCompletion } from './push-registration'
+import { loadHostCatalog } from '../transport/host-store'
+import { deriveHostFingerprint } from './push-host-fingerprint'
+import { presentForegroundPush } from './android-foreground-push'
+import {
+ DESKTOP_NOTIFICATION_CHANNEL_ID,
+ ensureDesktopNotificationChannel
+} from './desktop-notification-channel'
+import { loadNotificationDeliveryPreferences } from './notification-delivery-preferences'
+import {
+ allowsMobilePushDelivery,
+ mobilePushAlertContent
+} from '../../../src/shared/mobile-push-alert'
+import { reserveNotificationCooldown } from '../../../src/shared/notification-burst-cooldown'
+import type { MobileNotificationDispatchEvent } from '../../../src/main/runtime/runtime-mobile-notification-controller'
export {
ensureNotificationPermissions,
@@ -11,11 +27,90 @@ export {
export function subscribeToDesktopNotifications(client: RpcClient, hostId: string): () => void {
let disposed = false
+ const pending = new AbortController()
+ const recentNotifications = new Map<string, number>()
+
+ async function present(event: MobileNotificationDispatchEvent): Promise<void> {
+ const content = mobilePushAlertContent(event)
+ if (!content) {
+ return
+ }
+ const support = getHostPushSupportCompletion(hostId, client)
+ const currentConnection = () =>
+ !disposed &&
+ support !== null &&
+ !support.signal.aborted &&
+ getHostPushSupportCompletion(hostId, client) === support
+ let noToken = false
+ const isCurrent = () =>
+ currentConnection() && (noToken || getHostPushSupported(hostId) === false)
+ async function prepareFallback(): Promise<boolean> {
+ noToken = false
+ if (!currentConnection()) {
+ return false
+ }
+ if (getHostPushSupported(hostId) !== false) {
+ noToken = (await waitForPushFallback([support], pending.signal)) === 'no-token'
+ }
+ return isCurrent()
+ }
+ if (!(await prepareFallback())) {
+ return
+ }
+ const preferences = await loadNotificationDeliveryPreferences()
+ if (!allowsMobilePushDelivery(preferences, event)) {
+ return
+ }
+ const host = (await loadHostCatalog()).find((entry) => entry.id === hostId)
+ const hostFingerprint = host && deriveHostFingerprint(host.publicKeyB64)
+ if (!hostFingerprint || disposed) {
+ return
+ }
+ if (
+ event.emittedAt !== undefined &&
+ !reserveNotificationCooldown(
+ recentNotifications,
+ event.attentionKey ?? event.worktreeId ?? 'global',
+ event.emittedAt
+ )
+ ) {
+ return
+ }
+ const channelId = `${DESKTOP_NOTIFICATION_CHANNEL_ID}${preferences.sound ? '' : '-silent'}`
+ await ensureDesktopNotificationChannel()
+ if (disposed) {
+ return
+ }
+ await presentForegroundPush(
+ JSON.stringify([hostFingerprint, event.notificationEpoch, event.notificationSeq]),
+ {
+ title: content.title,
+ body: content.body,
+ sound: preferences.sound ? 'default' : null,
+ data: {
+ kind: 'alert',
+ hostFingerprint,
+ notificationId: event.notificationId,
+ notificationEpoch: event.notificationEpoch,
+ notificationSeq: event.notificationSeq,
+ worktreeId: event.worktreeId,
+ paneKey: event.paneKey,
+ executionHost: event.executionHost,
+ channelId
+ }
+ },
+ prepareFallback,
+ isCurrent
+ )
+ }
const params = { includeDesktopSuppressed: true }
const unsubscribeStream = client.subscribe('notifications.subscribe', params, (data: unknown) => {
- // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: every frame a shipped host or the transport sends is an object with a string `type`: the host's `ready`, `end`, notification and dismiss events, or the transport's `error`.
- const event = data as DismissNotificationEvent | { type: string }
+ // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: notifications.subscribe emits the runtime's dispatch/dismiss union or transport control frames, with no transformation of notification fields.
+ const event = data as
+ | MobileNotificationDispatchEvent
+ | DismissNotificationEvent
+ | { type: 'ready' | 'end' | 'error' }
// Transport detaches the listener on unsubscribe, so any callback still running precedes disposal.
if (event.type === 'ready') {
// Use the watermark only to dismiss stale pushes; socket history must not become another OS delivery route.
@@ -23,12 +118,18 @@ export function subscribeToDesktopNotifications(client: RpcClient, hostId: strin
return
}
if (!disposed && event.type === 'dismiss') {
- void dismissHostPushNotification(event as DismissNotificationEvent, hostId).catch(() => {})
+ void dismissHostPushNotification(event, hostId).catch(() => {})
+ }
+ if (!disposed && event.type === 'notification') {
+ void present(event).catch((error: unknown) => {
+ console.warn('[push] Live notification presentation failed', error)
+ })
}
})
return () => {
disposed = true
+ pending.abort()
unsubscribeStream()
}
}
diff --git a/mobile/src/notifications/notification-consent-ownership.test.ts b/mobile/src/notifications/notification-consent-ownership.test.ts
index 26bca6fc76b..02aa76623c9 100644
--- a/mobile/src/notifications/notification-consent-ownership.test.ts
+++ b/mobile/src/notifications/notification-consent-ownership.test.ts
@@ -42,6 +42,7 @@ vi.mock('react-native', () => ({
Linking: { openSettings: vi.fn() },
useWindowDimensions: () => ({ width: 390, height: 844 })
}))
+vi.mock('expo-notifications', () => ({ scheduleNotificationAsync: vi.fn() }))
vi.mock('expo-router', () => ({
useFocusEffect: vi.fn(),
useLocalSearchParams: () => ({ hostId: 'host', steps: 'notifications' }),
diff --git a/mobile/src/notifications/push-dismissal-native-races.test.ts b/mobile/src/notifications/push-dismissal-native-races.test.ts
index fd6e7f97aaa..d88b5264b7d 100644
--- a/mobile/src/notifications/push-dismissal-native-races.test.ts
+++ b/mobile/src/notifications/push-dismissal-native-races.test.ts
@@ -7,6 +7,8 @@ import {
wasPushDismissed
} from './push-dismissal-watermarks'
import { foregroundNotificationBehavior } from './push-receive'
+import { presentForegroundPush } from './android-foreground-push'
+import { dismissPresentedPushNotification } from './push-tray-dismissal'
import { loadNotificationDeliveryPreferences } from './notification-delivery-preferences'
const memory = vi.hoisted(() => new Map<string, string>())
@@ -43,7 +45,12 @@ vi.mock('@react-native-async-storage/async-storage', () => ({
})
}
}))
-vi.mock('expo-notifications', () => ({ getPresentedNotificationsAsync: async () => [] }))
+const schedule = vi.hoisted(() => vi.fn(async () => 'socket-alert'))
+vi.mock('expo-notifications', () => ({
+ getPresentedNotificationsAsync: async () => [],
+ scheduleNotificationAsync: schedule
+}))
+vi.mock('react-native', () => ({ Platform: { OS: 'android' } }))
vi.mock('../transport/host-store', () => ({ loadHostCatalog: async () => [{ id: 'host' }] }))
vi.mock('./push-host-fingerprint', () => ({ resolveHostIdForFingerprint: () => 'host' }))
vi.mock('../storage/preferences', () => ({
@@ -143,3 +150,24 @@ it('suppresses presentation when dismissal completes during the handler sound re
shouldSetBadge: false
})
})
+
+it('does not schedule an alert dismissed while final fallback preparation is pending', async () => {
+ let finish: (allowed: boolean) => void = () => {}
+ const prepare = vi.fn(
+ () =>
+ new Promise<boolean>((resolve) => {
+ finish = resolve
+ })
+ )
+ const pending = presentForegroundPush(
+ 'socket-alert',
+ { title: 'Needs input', body: 'Reply', data: payload, sound: 'default' },
+ prepare
+ )
+ await vi.waitFor(() => expect(prepare).toHaveBeenCalledOnce())
+ await dismissPresentedPushNotification(payload.notificationId, payload.hostFingerprint, fence)
+ expect(await wasPushDismissed(payload)).toBe(true)
+ finish(true)
+ await pending
+ expect(schedule).not.toHaveBeenCalled()
+})
diff --git a/mobile/src/notifications/push-fallback-capability.test.tsx b/mobile/src/notifications/push-fallback-capability.test.tsx
new file mode 100644
index 00000000000..5981b832ba0
--- /dev/null
+++ b/mobile/src/notifications/push-fallback-capability.test.tsx
@@ -0,0 +1,233 @@
+import { createElement } from 'react'
+import { act, create, type ReactTestRenderer } from 'react-test-renderer'
+import { afterEach, beforeEach, expect, it, vi } from 'vitest'
+import {
+ attachPushRegistration,
+ resetPushRegistrationForTests,
+ NOTIFICATIONS_REMOTE_PUSH_CAPABILITY
+} from './push-registration'
+import { subscribeToDesktopNotifications } from './mobile-notifications'
+import { NotificationDisplayTest } from '../settings/notification-display-test'
+import { removeHostAndCloseClient } from '../transport/host-removal-lifecycle'
+import { findAllByHostType } from '../test-support/react-test-renderer-host-nodes'
+import type { RpcClient } from '../transport/rpc-client'
+import type { RpcResponse } from '../transport/types'
+import type { MobilePushToken } from './push-token'
+
+const native = vi.hoisted(() => {
+ const clients: { hostId: string; state: string; client: RpcClient }[] = []
+ return { token: vi.fn(), schedule: vi.fn(), eligible: vi.fn(), clients }
+})
+vi.mock('react-native', () => ({
+ AppState: { currentState: 'background' },
+ Platform: { OS: 'ios' },
+ Pressable: 'Pressable',
+ Text: 'Text',
+ View: 'View',
+ StyleSheet: { create: (value: unknown) => value, absoluteFillObject: {} }
+}))
+vi.mock('expo-notifications', () => ({ scheduleNotificationAsync: native.schedule }))
+vi.mock('./push-token', () => ({ getDevicePushToken: native.token }))
+vi.mock('./push-receive', () => ({ canPresentForegroundPush: native.eligible }))
+vi.mock('./push-dismissal-reconciliation', () => ({ requestNotificationCatchup: vi.fn() }))
+vi.mock('./push-socket-dismissal', () => ({ dismissHostPushNotification: vi.fn() }))
+vi.mock('../transport/use-all-host-clients', () => ({ useAllHostClients: () => native.clients }))
+vi.mock('../mobile-web-shell/removed-host-shell-cache', () => ({
+ deleteHostPageCache: vi.fn(),
+ forgetHostUpdateFailures: vi.fn()
+}))
+vi.mock('../transport/host-descriptor-store', () => ({ forgetHostDescriptor: vi.fn() }))
+vi.mock('../transport/host-store', () => ({
+ removeHost: async () => {
+ throw new Error('host metadata write failed')
+ },
+ loadHostCatalog: async () => [
+ { id: 'host', publicKeyB64: 'AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE=' },
+ { id: 'second', publicKeyB64: 'AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgI=' }
+ ]
+}))
+vi.mock('../storage/preferences', () => ({
+ loadPushNotificationsEnabled: async () => true,
+ saveRemotePushHostRegistrations: async () => {},
+ loadRemotePushHostRegistrations: async () => ({
+ registeredHostIds: [],
+ pendingUnregisterHostIds: []
+ })
+}))
+vi.mock('./notification-permissions', () => ({
+ getNotificationPermissionState: async () => ({ granted: true })
+}))
+vi.mock('./notification-delivery-preferences', () => ({
+ loadNotificationDeliveryPreferences: async () => ({ onlyWhenDesktopAway: false, sound: true })
+}))
+vi.mock('./desktop-notification-channel', () => ({
+ ensureDesktopNotificationChannel: async () => {},
+ DESKTOP_NOTIFICATION_CHANNEL_ID: 'orca-desktop'
+}))
+
+function deferred<T>() {
+ let resolve: (value: T) => void = () => {}
+ const promise = new Promise<T>((done) => {
+ resolve = done
+ })
+ return { promise, resolve }
+}
+function connection(hostId = 'host') {
+ const status = deferred<RpcResponse>()
+ let frame: (data: unknown) => void = () => {}
+ const client: RpcClient = {
+ sendRequest: vi.fn(async (method: string): Promise<RpcResponse> =>
+ method === 'status.get'
+ ? status.promise
+ : { id: 'test', ok: true, result: { accepted: true }, _meta: { runtimeId: 'runtime' } }
+ ),
+ subscribe: (_method, _params, handler) => {
+ frame = handler
+ return () => {}
+ },
+ updateTerminalSubscriptionViewport: () => {},
+ getState: () => 'connected',
+ getReconnectAttempt: () => 0,
+ getLastConnectedAt: () => null,
+ onStateChange: () => () => {},
+ notifyForeground: () => {},
+ close: () => {}
+ }
+ const detach = attachPushRegistration(hostId, client)
+ native.clients.push({ hostId, state: 'connected', client })
+ return {
+ client,
+ detach,
+ answer: (supported: boolean) =>
+ status.resolve({
+ id: 'status',
+ ok: true,
+ result: { capabilities: supported ? [NOTIFICATIONS_REMOTE_PUSH_CAPABILITY] : [] },
+ _meta: { runtimeId: 'runtime' }
+ }),
+ emit: () =>
+ frame({
+ type: 'notification',
+ source: 'agent-task-complete',
+ title: 'Done',
+ body: 'Reply',
+ notificationId: 'alert',
+ notificationEpoch: 'epoch',
+ notificationSeq: 1,
+ worktreeId: 'workspace'
+ })
+ }
+}
+let renderer: ReactTestRenderer | undefined
+let stop: (() => void) | undefined
+beforeEach(() => {
+ vi.clearAllMocks()
+ resetPushRegistrationForTests()
+ native.token.mockReturnValue(new Promise(() => {}))
+ native.schedule.mockResolvedValue('local')
+ native.eligible.mockResolvedValue(true)
+ native.clients = []
+})
+afterEach(async () => {
+ stop?.()
+ stop = undefined
+ await act(async () => renderer?.unmount())
+ renderer = undefined
+ resetPushRegistrationForTests()
+})
+async function begin(route: string, rpc: ReturnType<typeof connection>) {
+ if (route === 'live') {
+ stop = subscribeToDesktopNotifications(rpc.client, 'host')
+ rpc.emit()
+ } else {
+ await act(async () => {
+ renderer = create(createElement(NotificationDisplayTest, { onTroubleshoot: vi.fn() }))
+ })
+ await act(async () => findAllByHostType(renderer!.root, 'Pressable')[0].props.onPress())
+ }
+ await vi.waitFor(() => expect(native.token).toHaveBeenCalled())
+}
+it.each(['live', 'settings'])(
+ '%s releases a pending native token wait when the real host proves unsupported',
+ async (route) => {
+ const rpc = connection()
+ await begin(route, rpc)
+ await act(async () => rpc.answer(false))
+ await vi.waitFor(() => expect(native.schedule).toHaveBeenCalledOnce())
+ if (renderer) {
+ expect(JSON.stringify(renderer.toJSON())).toContain('does not support push')
+ }
+ }
+)
+it.each(['live', 'settings'])(
+ '%s keeps waiting for a no-token answer after the host proves supported',
+ async (route) => {
+ const token = deferred<MobilePushToken | null>()
+ native.token.mockReturnValue(token.promise)
+ const rpc = connection()
+ await begin(route, rpc)
+ await act(async () => rpc.answer(true))
+ expect(native.schedule).not.toHaveBeenCalled()
+ await act(async () => token.resolve(null))
+ await vi.waitFor(() => expect(native.schedule).toHaveBeenCalledOnce())
+ }
+)
+it.each(['live', 'settings'])(
+ '%s cannot borrow unsupported capability from a replacement connection',
+ async (route) => {
+ const token = deferred<MobilePushToken | null>()
+ native.token.mockReturnValue(token.promise)
+ const rpc = connection()
+ await begin(route, rpc)
+ rpc.detach()
+ const replacement = connection()
+ await act(async () => {
+ replacement.answer(false)
+ token.resolve(null)
+ })
+ expect(native.schedule).not.toHaveBeenCalled()
+ }
+)
+
+it('settings waits for every captured host to prove unsupported before bypassing a pending token', async () => {
+ const first = connection()
+ const second = connection('second')
+ await begin('settings', first)
+ await act(async () => first.answer(false))
+ expect(native.schedule).not.toHaveBeenCalled()
+ await act(async () => second.answer(false))
+ await vi.waitFor(() => expect(native.schedule).toHaveBeenCalledOnce())
+})
+it('fences a retired connection after the final foreground policy completes', async () => {
+ const eligibility = deferred<boolean>()
+ native.eligible.mockReturnValue(eligibility.promise)
+ const rpc = connection()
+ rpc.answer(false)
+ stop = subscribeToDesktopNotifications(rpc.client, 'host')
+ rpc.emit()
+ await vi.waitFor(() => expect(native.eligible).toHaveBeenCalledOnce())
+ rpc.detach()
+ const replacement = connection()
+ await act(async () => replacement.answer(false))
+ eligibility.resolve(true)
+ rpc.emit()
+ await new Promise((resolve) => setTimeout(resolve, 0))
+ expect(native.schedule).not.toHaveBeenCalled()
+})
+
+it('resumes fresh alerts after failed metadata removal without reviving an older pending alert', async () => {
+ const token = deferred<MobilePushToken | null>()
+ native.token.mockReturnValue(token.promise)
+ const rpc = connection()
+ await begin('live', rpc)
+ const forgetClient = vi.fn()
+ await expect(removeHostAndCloseClient('host', forgetClient)).rejects.toThrow(
+ 'host metadata write failed'
+ )
+ expect(forgetClient).not.toHaveBeenCalled()
+ token.resolve(null)
+ await new Promise((resolve) => setTimeout(resolve, 0))
+ expect(native.schedule).not.toHaveBeenCalled()
+ rpc.emit()
+ await vi.waitFor(() => expect(native.schedule).toHaveBeenCalledOnce())
+})
diff --git a/mobile/src/notifications/push-fallback.ts b/mobile/src/notifications/push-fallback.ts
new file mode 100644
index 00000000000..ca27604ebc1
--- /dev/null
+++ b/mobile/src/notifications/push-fallback.ts
@@ -0,0 +1,61 @@
+import { waitForPromiseWithSignal } from '../../../src/shared/abort-signal-reason'
+import type { HostPushSupportCompletion } from './host-push-registration-state'
+import { getDevicePushToken } from './push-token'
+
+export async function waitForPushFallback(
+ hosts: readonly (HostPushSupportCompletion | null)[],
+ signal: AbortSignal
+): Promise<'no-token' | 'unsupported-host' | null> {
+ const pending = new AbortController()
+ const cancel = () => pending.abort()
+ const signals = [signal, ...hosts.flatMap((host) => (host ? [host.signal] : []))]
+ for (const source of signals) {
+ source.addEventListener('abort', cancel, { once: true })
+ if (source.aborted) {
+ cancel()
+ }
+ }
+ try {
+ if (pending.signal.aborted) {
+ return null
+ }
+ const answers = hosts.map((host) =>
+ host ? waitForPromiseWithSignal(host.completed, pending.signal) : Promise.resolve(null)
+ )
+ const completed = Promise.all(answers).then(
+ (values) => values.length > 0 && values.every((value) => value === false)
+ )
+ const unsupported = Promise.race([
+ completed,
+ ...answers.map(async (answer) => ((await answer) === false ? completed : false))
+ ])
+ const token = waitForPromiseWithSignal(getDevicePushToken(), pending.signal)
+ // Only eligible evidence wins early; either negative answer must wait for the other source.
+ return await Promise.race([
+ token.then(async (value) =>
+ value === null
+ ? ('no-token' as const)
+ : (await unsupported)
+ ? ('unsupported-host' as const)
+ : null
+ ),
+ unsupported.then(async (value) =>
+ value
+ ? ('unsupported-host' as const)
+ : (await token) === null
+ ? ('no-token' as const)
+ : null
+ )
+ ])
+ } catch (error) {
+ if (pending.signal.aborted) {
+ return null
+ }
+ throw error
+ } finally {
+ pending.abort()
+ for (const source of signals) {
+ source.removeEventListener('abort', cancel)
+ }
+ }
+}
diff --git a/mobile/src/notifications/push-payload.ts b/mobile/src/notifications/push-payload.ts
index 5ac5b17cfe6..878772f29b5 100644
--- a/mobile/src/notifications/push-payload.ts
+++ b/mobile/src/notifications/push-payload.ts
@@ -25,7 +25,7 @@ export function readOrcaPushPayload(data: unknown): OrcaPushPayload | null {
}
const nested = (data as { orca?: unknown }).orca
const record = (nested && typeof nested === 'object' ? nested : data) as Record<string, unknown>
- // Only gateway pushes carry a fingerprint; locally scheduled data does not.
+ // Push and socket alerts use the same paired-host identity.
const hostFingerprint = readString(record.hostFingerprint)
if (!hostFingerprint) {
return null
diff --git a/mobile/src/notifications/push-registration.ts b/mobile/src/notifications/push-registration.ts
index 8feb7e6cbe5..9213177de81 100644
--- a/mobile/src/notifications/push-registration.ts
+++ b/mobile/src/notifications/push-registration.ts
@@ -1,4 +1,10 @@
import { ensureDesktopNotificationChannel } from './desktop-notification-channel'
+import {
+ createHostPushSupportCompletion,
+ createHostPushState,
+ type HostPushState,
+ type HostPushSupportCompletion
+} from './host-push-registration-state'
import { AppState } from 'react-native'
import { startMobilePushLeaseRenewal } from './mobile-push-lease-renewal'
import {
@@ -12,7 +18,7 @@ import type {
MobilePushRegisterInput
} from '../../../src/shared/mobile-push-contract'
import { NOTIFICATIONS_REMOTE_PUSH_RUNTIME_CAPABILITY } from '../../../src/shared/protocol-version'
-import type { RpcOperationSender } from '../transport/rpc-operation-sender'
+import type { RpcOperationSender as PushClient } from '../transport/rpc-operation-sender'
import { startRuntimeCapabilityProbe } from '../transport/runtime-capability-probe'
import { pushRouteRegister, pushRouteUnregister } from './mobile-push-registration-operations'
import {
@@ -25,23 +31,24 @@ import { addPushTokenListener, getDevicePushToken, type MobilePushToken } from '
export const NOTIFICATIONS_REMOTE_PUSH_CAPABILITY = NOTIFICATIONS_REMOTE_PUSH_RUNTIME_CAPABILITY
-type PushClient = RpcOperationSender
-
const REQUEST_TIMEOUT_MS = 5_000
const REMOVAL_TIMEOUT_MS = 2_000
const TOKEN_TIMEOUT_MS = 2_000
-type HostPushState = {
- connection: { client: PushClient | null }
- // An unanswered probe is unknown, not unsupported.
- supported: boolean | null
- capabilityProbeStop: (() => void) | null
- chain: Promise<void>
-}
-
type RegistrationRecords = { registered: Set<string>; pending: Set<string> }
const hostsById = new Map<string, HostPushState>()
+
+export function getHostPushSupported(hostId: string): boolean | null {
+ return hostsById.get(hostId)?.supported ?? null
+}
+export function getHostPushSupportCompletion(
+ hostId: string,
+ client: PushClient
+): HostPushSupportCompletion | null {
+ const connection = hostsById.get(hostId)?.connection
+ return connection?.client === client ? connection.support : null
+}
let registrationRecords: RegistrationRecords | null = null
let tokenPromise: Promise<MobilePushToken | null> | null = null
// A late registration must not overwrite a newer preference or consent choice.
@@ -50,12 +57,7 @@ let consentGeneration = 0
function hostState(hostId: string): HostPushState {
let state = hostsById.get(hostId)
if (!state) {
- state = {
- connection: { client: null },
- supported: null,
- capabilityProbeStop: null,
- chain: Promise.resolve()
- }
+ state = createHostPushState()
hostsById.set(hostId, state)
}
return state
@@ -156,6 +158,7 @@ async function reconcileHost(hostId: string): Promise<void> {
return
}
state.supported = capabilities.includes(NOTIFICATIONS_REMOTE_PUSH_CAPABILITY)
+ state.connection.support?.complete(state.supported)
void enqueueReconcile(hostId)
})
return
@@ -224,6 +227,8 @@ export function attachPushRegistration(hostId: string, client: PushClient): () =
if (state.connection.client !== client) {
state.capabilityProbeStop?.()
state.capabilityProbeStop = null
+ state.connection.support?.retire()
+ state.connection.support = createHostPushSupportCompletion()
state.connection.client = client
state.supported = null
}
@@ -231,6 +236,8 @@ export function attachPushRegistration(hostId: string, client: PushClient): () =
const connection = state.connection
return () => {
if (connection.client === client) {
+ connection.support?.retire()
+ connection.support = null
connection.client = null
state.capabilityProbeStop?.()
state.capabilityProbeStop = null
@@ -277,6 +284,7 @@ export async function unregisterPushForRemovedHost(hostId: string): Promise<() =
const state = hostsById.get(hostId)
// Retire ownership before waiting for earlier RPCs to settle.
hostsById.delete(hostId)
+ state?.connection.support?.retire()
state?.capabilityProbeStop?.()
if (state) {
state.capabilityProbeStop = null
@@ -292,6 +300,7 @@ export async function unregisterPushForRemovedHost(hostId: string): Promise<() =
return () => {
if (state && !hostsById.has(hostId)) {
// Preserve disconnect ownership without reviving stale registration work.
+ state.connection.support = state.connection.client ? createHostPushSupportCompletion() : null
hostsById.set(hostId, { ...state, supported: null, capabilityProbeStop: null })
void enqueueReconcile(hostId)
}
@@ -312,6 +321,9 @@ export function startPushTokenSync(): () => void {
}
export function resetPushRegistrationForTests(): void {
+ for (const state of hostsById.values()) {
+ state.connection.support?.retire()
+ }
hostsById.clear()
registrationRecords = null
tokenPromise = null
diff --git a/mobile/src/settings/notification-display-test.test.tsx b/mobile/src/settings/notification-display-test.test.tsx
index 29df616f072..ecb592026fa 100644
--- a/mobile/src/settings/notification-display-test.test.tsx
+++ b/mobile/src/settings/notification-display-test.test.tsx
@@ -6,6 +6,12 @@ import { findAllByHostType } from '../test-support/react-test-renderer-host-node
const mocks = vi.hoisted(() => ({
loadHosts: vi.fn(),
+ token: vi.fn(),
+ supported: vi.fn(),
+ completion: { completed: Promise.resolve(true), signal: new AbortController().signal },
+ enabled: vi.fn(),
+ permission: vi.fn(),
+ schedule: vi.fn(),
clients: [] as { state: string; client: { sendRequest: ReturnType<typeof vi.fn> } }[]
}))
vi.mock('react-native', () => ({
@@ -16,11 +22,33 @@ vi.mock('react-native', () => ({
}))
vi.mock('../transport/host-store', () => ({ loadHostCatalog: mocks.loadHosts }))
vi.mock('../transport/use-all-host-clients', () => ({ useAllHostClients: () => mocks.clients }))
+vi.mock('../notifications/push-token', () => ({ getDevicePushToken: mocks.token }))
+vi.mock('../notifications/push-registration', () => ({
+ getHostPushSupported: mocks.supported,
+ getHostPushSupportCompletion: () => mocks.completion
+}))
+vi.mock('../storage/preferences', () => ({ loadPushNotificationsEnabled: mocks.enabled }))
+vi.mock('../notifications/notification-permissions', () => ({
+ getNotificationPermissionState: mocks.permission
+}))
+vi.mock('../notifications/notification-delivery-preferences', () => ({
+ loadNotificationDeliveryPreferences: async () => ({ sound: true })
+}))
+vi.mock('../notifications/desktop-notification-channel', () => ({
+ ensureDesktopNotificationChannel: vi.fn(),
+ DESKTOP_NOTIFICATION_CHANNEL_ID: 'orca-desktop'
+}))
+vi.mock('expo-notifications', () => ({ scheduleNotificationAsync: mocks.schedule }))
let renderer: ReactTestRenderer
beforeEach(() => {
mocks.loadHosts.mockReset().mockResolvedValue([{ id: 'first' }, { id: 'second' }])
mocks.clients = []
+ mocks.token.mockReset().mockResolvedValue({ platform: 'ios', token: 'token' })
+ mocks.supported.mockReset().mockReturnValue(true)
+ mocks.enabled.mockReset().mockResolvedValue(true)
+ mocks.permission.mockReset().mockResolvedValue({ granted: true })
+ mocks.schedule.mockReset().mockResolvedValue('local')
})
afterEach(() => act(() => renderer?.unmount()))
@@ -75,7 +103,10 @@ it('explains when every desktop needs registration or an update', async () => {
client: { sendRequest: vi.fn().mockResolvedValue(response) }
}))
await send()
- expect(JSON.stringify(renderer.toJSON())).toContain('Reconnect to register this phone')
+ const output = JSON.stringify(renderer.toJSON())
+ expect(output).toContain('Push registration is not ready')
+ expect(output).toContain('This checks display only')
+ expect(output).not.toContain('Live alerts are available')
})
it.each([false, true])('explains missing pairing or connection (paired=%s)', async (paired) => {
@@ -87,3 +118,38 @@ it.each([false, true])('explains missing pairing or connection (paired=%s)', asy
paired ? 'Connect a desktop' : 'Pair a desktop'
)
})
+
+it.each(['no-token', 'old-host'])('explains %s and schedules only a local test', async (reason) => {
+ const request = vi.fn().mockResolvedValue({ ok: false, error: { code: 'method_not_found' } })
+ mocks.clients = [{ state: 'connected', client: { sendRequest: request } }]
+ if (reason === 'no-token') {
+ mocks.token.mockResolvedValue(null)
+ } else {
+ mocks.supported.mockReturnValue(false)
+ mocks.token.mockReturnValue(new Promise(() => {}))
+ }
+ await send()
+ expect(mocks.schedule).toHaveBeenCalledOnce()
+ expect(request).not.toHaveBeenCalled()
+ const output = JSON.stringify(renderer.toJSON())
+ expect(output).toContain(reason === 'no-token' ? 'No push token' : 'does not support push')
+ expect(output).toContain('Local test scheduled')
+ expect(output).toContain('while Orca is running and connected')
+})
+
+it.each(['app', 'os'])(
+ 'explains notifications disabled by %s without sending any test',
+ async (disabledBy) => {
+ const request = vi.fn().mockResolvedValue({ ok: true, result: { accepted: true } })
+ mocks.clients = [{ state: 'connected', client: { sendRequest: request } }]
+ if (disabledBy === 'app') {
+ mocks.enabled.mockResolvedValue(false)
+ } else {
+ mocks.permission.mockResolvedValue({ granted: false })
+ }
+ await send()
+ expect(JSON.stringify(renderer.toJSON())).toContain('Notifications are turned off')
+ expect(request).not.toHaveBeenCalled()
+ expect(mocks.schedule).not.toHaveBeenCalled()
+ }
+)
diff --git a/mobile/src/settings/notification-display-test.tsx b/mobile/src/settings/notification-display-test.tsx
index fde883750fe..6be92c1e701 100644
--- a/mobile/src/settings/notification-display-test.tsx
+++ b/mobile/src/settings/notification-display-test.tsx
@@ -7,11 +7,26 @@ import { colors, spacing, typography } from '../theme/mobile-theme'
import { themedStyleSheet } from '../theme/themed-styles'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
import { useMobileTranslation } from '../i18n/use-mobile-translation'
+import * as Notifications from 'expo-notifications'
+import { waitForPushFallback } from '../notifications/push-fallback'
+import {
+ getHostPushSupported,
+ getHostPushSupportCompletion
+} from '../notifications/push-registration'
+import { getNotificationPermissionState } from '../notifications/notification-permissions'
+import { loadPushNotificationsEnabled } from '../storage/preferences'
+import { loadNotificationDeliveryPreferences } from '../notifications/notification-delivery-preferences'
+import {
+ DESKTOP_NOTIFICATION_CHANNEL_ID,
+ ensureDesktopNotificationChannel
+} from '../notifications/desktop-notification-channel'
export function NotificationDisplayTest({ onTroubleshoot }: { onTroubleshoot: () => void }) {
useMobileColorScheme()
const t = useMobileTranslation()
const busy = useRef(false)
+ const pending = useRef<AbortController | null>(null)
+ useEffect(() => () => pending.current?.abort(), [])
const [hostIds, setHostIds] = useState<string[]>([])
const [sending, setSending] = useState(false)
const [message, setMessage] = useState<string | null>(null)
@@ -30,25 +45,110 @@ export function NotificationDisplayTest({ onTroubleshoot }: { onTroubleshoot: ()
return
}
busy.current = true
+ const controller = new AbortController()
+ pending.current = controller
+ const connected = clients
+ .filter((entry) => entry.state === 'connected')
+ .map((entry) => ({
+ ...entry,
+ support: getHostPushSupportCompletion(entry.hostId, entry.client)
+ }))
+ const isCurrent = () =>
+ !controller.signal.aborted &&
+ connected.every(
+ ({ hostId, client, support }) =>
+ !support?.signal.aborted && getHostPushSupportCompletion(hostId, client) === support
+ )
setSending(true)
setMessage(null)
+ const localTest = async (reason: string, liveFallback = false) => {
+ const { sound } = await loadNotificationDeliveryPreferences()
+ await ensureDesktopNotificationChannel()
+ if (!isCurrent()) {
+ return
+ }
+ await Notifications.scheduleNotificationAsync({
+ content: {
+ title: t('settings.notificationDisplayTest.localTitle', 'Test notification'),
+ body: t(
+ 'settings.notificationDisplayTest.localBody',
+ 'Local notification test from this phone.'
+ ),
+ sound: sound ? 'default' : false
+ },
+ trigger: { channelId: `${DESKTOP_NOTIFICATION_CHANNEL_ID}${sound ? '' : '-silent'}` }
+ })
+ setMessage(
+ liveFallback
+ ? t(
+ 'settings.notificationDisplayTest.liveFallbackScheduled',
+ '{{reason}} Local test scheduled. Check for the notification. Live alerts are available while Orca is running and connected.',
+ { reason }
+ )
+ : t(
+ 'settings.notificationDisplayTest.localScheduled',
+ '{{reason}} Local test scheduled. Check for the notification. This checks display only; it does not verify agent alert delivery.',
+ { reason }
+ )
+ )
+ }
try {
+ if (!(await loadPushNotificationsEnabled())) {
+ throw new Error(
+ t(
+ 'settings.notificationDisplayTest.disabled',
+ 'Notifications are turned off in Orca. Enable notifications and try again.'
+ )
+ )
+ }
+ if (!(await getNotificationPermissionState()).granted) {
+ throw new Error(
+ t(
+ 'settings.notificationDisplayTest.osDisabled',
+ 'Notifications are turned off in system settings. Allow notifications and try again.'
+ )
+ )
+ }
if (hostIds.length === 0) {
throw new Error(
t('settings.notificationDisplayTest.pairDesktop', 'Pair a desktop and try again.')
)
}
- const connected = clients.filter((entry) => entry.state === 'connected')
if (connected.length === 0) {
throw new Error(
t('settings.notificationDisplayTest.connectDesktop', 'Connect a desktop and try again.')
)
}
- let unavailable = t(
- 'settings.notificationDisplayTest.updateDesktop',
- 'Update your desktop to run this test.'
+ const unsupportedHost = t(
+ 'settings.notificationDisplayTest.unsupportedHost',
+ 'This desktop does not support push notifications. Update it to receive push.'
)
- for (const { client } of connected) {
+ const fallback = connected.every(({ hostId }) => getHostPushSupported(hostId) === false)
+ ? 'unsupported-host'
+ : await waitForPushFallback(
+ connected.map(({ support }) => support),
+ controller.signal
+ )
+ if (!isCurrent()) {
+ return
+ }
+ if (fallback === 'unsupported-host') {
+ await localTest(unsupportedHost, true)
+ return
+ }
+ if (fallback === 'no-token') {
+ await localTest(
+ t(
+ 'settings.notificationDisplayTest.noToken',
+ 'No push token is available on this phone.'
+ ),
+ true
+ )
+ return
+ }
+ const pushHosts = connected.filter(({ hostId }) => getHostPushSupported(hostId) !== false)
+ let unavailable = unsupportedHost
+ for (const { client } of pushHosts) {
const reply = await pushDeliveryTest.request(client, null, {
timeoutMs: 20000,
failWhenDisconnected: true
@@ -78,8 +178,8 @@ export function NotificationDisplayTest({ onTroubleshoot }: { onTroubleshoot: ()
}
if (result?.reason === 'not_registered') {
unavailable = t(
- 'settings.notificationDisplayTest.reconnectPhone',
- 'Reconnect to register this phone for notifications.'
+ 'settings.notificationDisplayTest.registrationPending',
+ 'Push registration is not ready on this desktop. Try again shortly.'
)
continue
}
@@ -95,14 +195,21 @@ export function NotificationDisplayTest({ onTroubleshoot }: { onTroubleshoot: ()
)
)
}
- throw new Error(unavailable)
+ await localTest(unavailable)
} catch (error) {
+ if (!isCurrent()) {
+ return
+ }
setMessage(
error instanceof Error
? error.message
: t('settings.notificationDisplayTest.sendFailed', 'Could not send push test.')
)
} finally {
+ controller.abort()
+ if (pending.current === controller) {
+ pending.current = null
+ }
busy.current = false
setSending(false)
}
@@ -118,7 +225,7 @@ export function NotificationDisplayTest({ onTroubleshoot }: { onTroubleshoot: ()
<Text style={styles.detail}>
{t(
'settings.notificationDisplayTest.description',
- 'Send a test through Orca’s push service.'
+ 'Test push delivery, or a local notification when push is unavailable.'
)}
</Text>
<Pressable
diff --git a/mobile/src/test-support/rpc-recording/declared-device-state.ts b/mobile/src/test-support/rpc-recording/declared-device-state.ts
index cf9c9b25e0b..4831fdf2bae 100644
--- a/mobile/src/test-support/rpc-recording/declared-device-state.ts
+++ b/mobile/src/test-support/rpc-recording/declared-device-state.ts
@@ -11,7 +11,11 @@ type DeclaredNotification = {
}
export type DeclaredDeviceState = {
readonly deviceStore?: Readonly<Record<string, string>>
- readonly deviceState?: { readonly notificationTray?: readonly DeclaredNotification[] }
+ readonly deviceState?: {
+ readonly notificationTray?: readonly DeclaredNotification[]
+ readonly notificationPermissions?: { readonly status: string; readonly canAskAgain: boolean }
+ readonly pushToken?: { readonly type: string; readonly data: string }
+ }
}
type DeviceEffect = (name: string, value: unknown) => void
@@ -32,9 +36,9 @@ export function declaredDeviceSubstitutes(declared: DeclaredDeviceState): {
if (store) {
substitutes.set('@react-native-async-storage/async-storage', declaredDeviceStore(store, effect))
}
- const tray = declared.deviceState?.notificationTray
- if (tray) {
- substitutes.set('expo-notifications', declaredNotificationTray(tray, effect))
+ const notifications = declared.deviceState
+ if (notifications) {
+ substitutes.set('expo-notifications', declaredNotifications(notifications, effect))
}
return {
substitutes,
@@ -61,18 +65,31 @@ function declaredDeviceStore(
})
}
-function declaredNotificationTray(
- tray: readonly DeclaredNotification[],
+function declaredNotifications(
+ device: NonNullable<DeclaredDeviceState['deviceState']>,
effect: DeviceEffect
): unknown {
return partialNativeModule('expo-notifications', {
// Preserve namespace-import traps with __esModule; see native-module-traps.ts.
__esModule: true,
// Clone each read so consumers cannot mutate the scenario’s declaration.
- getPresentedNotificationsAsync: () => Promise.resolve(structuredClone(tray)),
- dismissNotificationAsync: (identifier: string) => {
- effect('notification-tray.dismiss', { identifier })
- return Promise.resolve()
- }
+ ...(device.notificationTray && {
+ getPresentedNotificationsAsync: () =>
+ Promise.resolve(structuredClone(device.notificationTray)),
+ dismissNotificationAsync: (identifier: string) => {
+ effect('notification-tray.dismiss', { identifier })
+ return Promise.resolve()
+ }
+ }),
+ ...(device.notificationPermissions && {
+ getPermissionsAsync: () => Promise.resolve(structuredClone(device.notificationPermissions)),
+ scheduleNotificationAsync: (request: unknown) => {
+ effect('notification.schedule', request)
+ return Promise.resolve('recorded-local-notification')
+ }
+ }),
+ ...(device.pushToken && {
+ getDevicePushTokenAsync: () => Promise.resolve(structuredClone(device.pushToken))
+ })
})
}
diff --git a/src/main/runtime/push/push-dispatcher.test.ts b/src/main/runtime/push/push-dispatcher.test.ts
index fde2e907438..96928327ded 100644
--- a/src/main/runtime/push/push-dispatcher.test.ts
+++ b/src/main/runtime/push/push-dispatcher.test.ts
@@ -1,6 +1,7 @@
import { describe, expect, it, vi } from 'vitest'
import type { PushGatewayClient } from './push-gateway-client'
-import { mapPushAgentState, PushDispatcher } from './push-dispatcher'
+import { PushDispatcher } from './push-dispatcher'
+import { mapPushAgentState } from '../../../shared/mobile-push-alert'
import {
createHarness,
flush,
diff --git a/src/main/runtime/push/push-dispatcher.ts b/src/main/runtime/push/push-dispatcher.ts
index c3b0101cf6b..a021539af8c 100644
--- a/src/main/runtime/push/push-dispatcher.ts
+++ b/src/main/runtime/push/push-dispatcher.ts
@@ -1,10 +1,7 @@
import { reserveNotificationCooldown } from '../../../shared/notification-burst-cooldown'
// Send background push after socket fan-out without making sockets wait or fail on gateway results.
-import {
- MOBILE_PUSH_SOURCES,
- type MobilePushAgentState,
- type MobilePushRegistration
-} from '../../../shared/mobile-push-contract'
+import type { MobilePushRegistration } from '../../../shared/mobile-push-contract'
+import { allowsMobilePushDelivery, mobilePushAlertContent } from '../../../shared/mobile-push-alert'
import type { MobileNotificationEvent } from '../runtime-mobile-notification-controller'
import type { PushGatewayClient, PushSendNotification } from './push-gateway-client'
import { PushOutcomeCounters } from './push-outcome-counters'
@@ -12,8 +9,6 @@ import { PushOutcomeCounters } from './push-outcome-counters'
const PUSH_RETRY_DELAY_MS = 2_000
// Split requests at the gateway's per-send limit so extra paired phones still receive notifications.
const MAX_REGISTRATIONS_PER_SEND = 20
-const PUSH_TITLE_MAX_LENGTH = 80
-const PUSH_BODY_MAX_LENGTH = 180
export type PushDispatcherRegistry = {
listDevices(): readonly { deviceId: string; pushRegistration?: MobilePushRegistration }[]
@@ -29,35 +24,6 @@ type PushDispatcherOptions = {
type PushTarget = { deviceId: string; registration: MobilePushRegistration }
-function clip(value: string, maxLength: number): string {
- const normalized = value.replace(/\s+/g, ' ').trim()
- return normalized.length <= maxLength ? normalized : `${normalized.slice(0, maxLength - 1)}…`
-}
-
-export function mapPushAgentState(
- source: string,
- state: string | undefined
-): MobilePushAgentState | null | undefined {
- if (source !== 'agent-task-complete') {
- return null
- }
- if (state === 'blocked' || state === 'waiting' || state === 'needs-input') {
- return 'needs-input'
- }
- return state === undefined || state === 'done' || state === 'finished' ? 'finished' : undefined
-}
-
-function allowsPushDelivery(
- registration: MobilePushRegistration,
- event: MobileNotificationEvent
-): boolean {
- return (
- event.type === 'notification' &&
- event.desktopAllowed !== false &&
- (!registration.filter.onlyWhenDesktopAway || event.desktopAway !== false)
- )
-}
-
export class PushDispatcher {
private readonly recentNotifications = new Map<string, number>()
private readonly outcomes = new PushOutcomeCounters()
@@ -141,12 +107,8 @@ export class PushDispatcher {
}
}
}
- const source = MOBILE_PUSH_SOURCES.find((candidate) => candidate === event.source)
- if (!source || event.notificationSeq === undefined || event.notificationEpoch === undefined) {
- return null
- }
- const agentState = mapPushAgentState(source, event.agentState)
- if (agentState === undefined) {
+ const content = mobilePushAlertContent(event)
+ if (!content) {
return null
}
const targets = this.registry.listDevices().flatMap((device) => {
@@ -154,7 +116,7 @@ export class PushDispatcher {
if (
!registration ||
registration.expiresAt <= Date.now() ||
- !allowsPushDelivery(registration, event)
+ !allowsMobilePushDelivery(registration.filter, event)
) {
return []
}
@@ -179,12 +141,7 @@ export class PushDispatcher {
notification: {
expiresAt: Date.now() + 300_000,
...(event.notificationId ? { notificationId: event.notificationId } : {}),
- notificationSeq: event.notificationSeq,
- notificationEpoch: event.notificationEpoch,
- source,
- agentState,
- title: clip(event.title, PUSH_TITLE_MAX_LENGTH),
- body: clip(event.body, PUSH_BODY_MAX_LENGTH),
+ ...content,
...(event.worktreeId ? { worktreeId: event.worktreeId } : {}),
...(event.paneKey ? { paneKey: event.paneKey } : {}),
...(event.executionHost ? { executionHost: event.executionHost } : {})
diff --git a/src/shared/mobile-push-alert.ts b/src/shared/mobile-push-alert.ts
new file mode 100644
index 00000000000..5d9685ff3ac
--- /dev/null
+++ b/src/shared/mobile-push-alert.ts
@@ -0,0 +1,67 @@
+import {
+ MOBILE_PUSH_SOURCES,
+ type MobilePushAgentState,
+ type MobilePushFilter
+} from './mobile-push-contract'
+
+type AlertEvent = {
+ type: string
+ source?: string
+ agentState?: string
+ desktopAllowed?: boolean
+ desktopAway?: boolean
+ notificationSeq?: number
+ notificationEpoch?: string
+ title?: string
+ body?: string
+}
+
+function clip(value: string, maxLength: number): string {
+ const normalized = value.replace(/\s+/g, ' ').trim()
+ return normalized.length <= maxLength ? normalized : `${normalized.slice(0, maxLength - 1)}…`
+}
+
+export function mapPushAgentState(
+ source: string,
+ state: string | undefined
+): MobilePushAgentState | null | undefined {
+ if (source !== 'agent-task-complete') {
+ return null
+ }
+ if (state === 'blocked' || state === 'waiting' || state === 'needs-input') {
+ return 'needs-input'
+ }
+ return state === undefined || state === 'done' || state === 'finished' ? 'finished' : undefined
+}
+
+export function allowsMobilePushDelivery(filter: MobilePushFilter, event: AlertEvent): boolean {
+ return (
+ event.type === 'notification' &&
+ event.desktopAllowed !== false &&
+ (!filter.onlyWhenDesktopAway || event.desktopAway !== false)
+ )
+}
+
+export function mobilePushAlertContent(event: AlertEvent) {
+ const source = MOBILE_PUSH_SOURCES.find((candidate) => candidate === event.source)
+ if (
+ !source ||
+ event.notificationSeq === undefined ||
+ event.notificationEpoch === undefined ||
+ typeof event.title !== 'string' ||
+ typeof event.body !== 'string'
+ ) {
+ return null
+ }
+ const agentState = mapPushAgentState(source, event.agentState)
+ return agentState === undefined
+ ? null
+ : {
+ source,
+ agentState,
+ notificationSeq: event.notificationSeq,
+ notificationEpoch: event.notificationEpoch,
+ title: clip(event.title, 80),
+ body: clip(event.body, 180)
+ }
+}