Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

push_notifications: Play default sound for APNs alerts.

Chris Bobbe557940d82ba8
diff --git a/zerver/lib/push_notifications.py b/zerver/lib/push_notifications.py
index bfd37ede2c6..6e1b96e409e 100644
--- a/zerver/lib/push_notifications.py
+++ b/zerver/lib/push_notifications.py
@@ -1452,7 +1452,7 @@ class APNsHTTPHeaders:
@dataclass
class APNsPayload(PushRequestBasePayload):
- aps: dict[str, int | dict[str, str]]
+ aps: dict[str, int | str | dict[str, str]]
@dataclass
@@ -1518,9 +1518,10 @@ def send_push_notifications(
apns_priority=apns_priority,
apns_push_type=apns_push_type,
)
- aps: dict[str, int | dict[str, str]] = {"mutable-content": 1}
+ aps: dict[str, int | str | dict[str, str]] = {"mutable-content": 1}
if not is_removal:
aps["alert"] = {"title": "New notification"}
+ aps["sound"] = "default"
apns_payload = APNsPayload(
push_key_id=push_device.push_key_id,
encrypted_data=encrypted_data,
diff --git a/zerver/tests/test_e2ee_push_notifications.py b/zerver/tests/test_e2ee_push_notifications.py
index fea5e9d9149..d0fad5afd93 100644
--- a/zerver/tests/test_e2ee_push_notifications.py
+++ b/zerver/tests/test_e2ee_push_notifications.py
@@ -70,7 +70,11 @@ class SendPushNotificationTest(E2EEPushNotificationTestCase):
apns_message = send_notification.call_args.args[0].message
self.assertEqual(
apns_message["aps"],
- {"mutable-content": 1, "alert": {"title": "New notification"}},
+ {
+ "mutable-content": 1,
+ "alert": {"title": "New notification"},
+ "sound": "default",
+ },
)
self.assertEqual(