From 633da94df69aa1e747a9fe73a572822ae0d7f6d0 Mon Sep 17 00:00:00 2001 From: Devon Hudson Date: Wed, 17 Apr 2024 16:36:54 -0600 Subject: [PATCH 1/4] Update docs to reflect apns usage changes in FCM v1 api --- docs/applications.md | 2 +- sygnal.yaml.sample | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/applications.md b/docs/applications.md index 2989a665..10cc39fd 100644 --- a/docs/applications.md +++ b/docs/applications.md @@ -250,7 +250,7 @@ with `event_id_only` format. "room_alias": "#exampleroom:example.org", "sender_display_name": "Major Tom", "content_msgtype": "m.text", - "content_body": "I'm floating in a most peculiar way." + "content_body": "I'm floating in a most peculiar way.", "room_id": "!slw48wfj34rtnrf:example.org", "prio": "high", "unread": "2", diff --git a/sygnal.yaml.sample b/sygnal.yaml.sample index dd117418..1b59d4c5 100644 --- a/sygnal.yaml.sample +++ b/sygnal.yaml.sample @@ -228,9 +228,9 @@ apps: # # This allows you to specify additional options to send to Firebase. # # # # Of particular interest, admins who wish to support iOS apps using Firebase - # # probably wish to set content_available, and may need to set mutable_content. - # # (content_available allows your iOS app to be woken up by data messages, - # # and mutable_content allows your notification to be modified by a + # # probably wish to set content-available, and may need to set mutable-content. + # # (content-available allows your iOS app to be woken up by data messages, + # # and mutable-content allows your notification to be modified by a # # Notification Service app extension). # # # # See https://firebase.google.com/docs/cloud-messaging/http-server-ref @@ -240,5 +240,9 @@ apps: # # be overwritten or lead to an invalid request. # # # #fcm_options: - # # content_available: true - # # mutable_content: true + # # apns: + # # payload: + # # aps: + # # content-available: 1 + # # mutable-content: 1 + # # alert: "" From f44d578d396dac9e28985f1ba613f890c02c01de Mon Sep 17 00:00:00 2001 From: Devon Hudson Date: Wed, 17 Apr 2024 16:37:31 -0600 Subject: [PATCH 2/4] Extend FCM v1 api tests to ensure apns settings are passed along --- tests/test_gcm.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/test_gcm.py b/tests/test_gcm.py index 023fae59..c8ae23f0 100644 --- a/tests/test_gcm.py +++ b/tests/test_gcm.py @@ -115,6 +115,7 @@ def _get_access_token(self) -> str: class GcmTestCase(testutils.TestCase): + maxDiff = None def config_setup(self, config: Dict[str, Any]) -> None: config["apps"]["com.example.gcm"] = { "type": "tests.test_gcm.TestGcmPushkin", @@ -131,6 +132,17 @@ def config_setup(self, config: Dict[str, Any]) -> None: "api_version": "v1", "project_id": "example_project", "service_account_file": "/path/to/file.json", + "fcm_options": { + "apns": { + "payload": { + "aps": { + "content-available": 1, + "mutable-content": 1, + "alert": "" + }, + }, + }, + }, } def get_test_pushkin(self, name: str) -> TestGcmPushkin: @@ -231,6 +243,15 @@ def test_expected_api_v1(self) -> None: "missed_calls": "1", }, "android": {"priority": "high"}, + "apns": { + "payload": { + "aps": { + "content-available": 1, + "mutable-content": 1, + "alert": "" + }, + }, + }, "token": "spqr", } }, From a21491057f2929994aabed8e0ad1c79f8795f132 Mon Sep 17 00:00:00 2001 From: Devon Hudson Date: Fri, 26 Apr 2024 16:22:44 -0600 Subject: [PATCH 3/4] Add changelog entry --- changelog.d/370.doc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/370.doc diff --git a/changelog.d/370.doc b/changelog.d/370.doc new file mode 100644 index 00000000..52ec60db --- /dev/null +++ b/changelog.d/370.doc @@ -0,0 +1 @@ +Update docs & tests to reflect APNs usage in FCM v1 API. From bae149aede0bca03d8f1b9b8b2f670fe8d631b0b Mon Sep 17 00:00:00 2001 From: Devon Hudson Date: Fri, 26 Apr 2024 16:29:06 -0600 Subject: [PATCH 4/4] Fix linter errors --- tests/test_gcm.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_gcm.py b/tests/test_gcm.py index c8ae23f0..a5454937 100644 --- a/tests/test_gcm.py +++ b/tests/test_gcm.py @@ -116,6 +116,7 @@ def _get_access_token(self) -> str: class GcmTestCase(testutils.TestCase): maxDiff = None + def config_setup(self, config: Dict[str, Any]) -> None: config["apps"]["com.example.gcm"] = { "type": "tests.test_gcm.TestGcmPushkin", @@ -138,7 +139,7 @@ def config_setup(self, config: Dict[str, Any]) -> None: "aps": { "content-available": 1, "mutable-content": 1, - "alert": "" + "alert": "", }, }, }, @@ -248,7 +249,7 @@ def test_expected_api_v1(self) -> None: "aps": { "content-available": 1, "mutable-content": 1, - "alert": "" + "alert": "", }, }, },