Skip to content

Commit

Permalink
Update docs & tests to reflect APNs usage in FCM v1 API (#370)
Browse files Browse the repository at this point in the history
* Update docs to reflect apns usage changes in FCM v1 api

* Extend FCM v1 api tests to ensure apns settings are passed along

* Add changelog entry

* Fix linter errors
  • Loading branch information
devonh authored Apr 29, 2024
1 parent 5016621 commit c025ac1
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 6 deletions.
1 change: 1 addition & 0 deletions changelog.d/370.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update docs & tests to reflect APNs usage in FCM v1 API.
2 changes: 1 addition & 1 deletion docs/applications.md
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 9 additions & 5 deletions sygnal.yaml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: ""
22 changes: 22 additions & 0 deletions tests/test_gcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ 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",
Expand All @@ -131,6 +133,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:
Expand Down Expand Up @@ -231,6 +244,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",
}
},
Expand Down

0 comments on commit c025ac1

Please sign in to comment.