From b8b52e8a075de9d91504c3e6bf7c0b8af0602dc9 Mon Sep 17 00:00:00 2001 From: jrconlin Date: Mon, 13 Nov 2017 13:04:05 -0800 Subject: [PATCH] bug: Update APNs APS block Closes #1076 --- autopush/router/apnsrouter.py | 5 ++++- autopush/tests/test_integration.py | 6 ++++-- autopush/tests/test_router.py | 5 ++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/autopush/router/apnsrouter.py b/autopush/router/apnsrouter.py index 45dcbf0c..d49a4c95 100644 --- a/autopush/router/apnsrouter.py +++ b/autopush/router/apnsrouter.py @@ -137,7 +137,10 @@ def _route(self, notification, router_data): payload["enckey"] = notification.headers["encryption_key"] payload['aps'] = router_data.get('aps', { "mutable-content": 1, - "alert": {"title": " ", "body": " "} + "alert": { + "loc-key": "SentTab.NoTabArrivingNotification.body", + "title-loc-key": "SentTab.NoTabArrivingNotification.title", + } }) apns_id = str(uuid.uuid4()).lower() # APNs may force close a connection on us without warning. diff --git a/autopush/tests/test_integration.py b/autopush/tests/test_integration.py index 9d54b032..c97a72d5 100644 --- a/autopush/tests/test_integration.py +++ b/autopush/tests/test_integration.py @@ -1938,8 +1938,10 @@ def test_registration(self): assert ca_data['cryptokey'] == crypto_key assert ca_data['enc'] == salt assert 'mutable-content' in ca_data['aps'] - assert ca_data['aps']['alert']['title'] == " " - assert ca_data['aps']['alert']['body'] == " " + assert ca_data["aps"]["alert"]["loc-key"] == \ + "SentTab.NoTabArrivingNotification.body" + assert ca_data["aps"]["alert"]["title-loc-key"] == \ + "SentTab.NoTabArrivingNotification.title" assert ca_data['body'] == base64url_encode(data) @inlineCallbacks diff --git a/autopush/tests/test_router.py b/autopush/tests/test_router.py index 338fb58a..bd8eefae 100644 --- a/autopush/tests/test_router.py +++ b/autopush/tests/test_router.py @@ -182,7 +182,10 @@ def test_route_notification(self): "ver": 10, "aps": { "mutable-content": 1, - "alert": {"title": " ", "body": " "} + "alert": { + "loc-key": "SentTab.NoTabArrivingNotification.body", + "title-loc-key": "SentTab.NoTabArrivingNotification.title", + }, }, "enckey": "test", "con": "aesgcm",