Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add category to apns-async calls #758

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions push_notifications/apns_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def _create_notification_request_from_args(
loc_key: str = None,
priority: int = None,
collapse_id: str = None,
category: str = None,
aps_kwargs: dict = {},
message_kwargs: dict = {},
notification_request_kwargs: dict = {},
Expand Down Expand Up @@ -158,6 +159,7 @@ def _create_notification_request_from_args(
"badge": badge,
"sound": sound,
"thread-id": thread_id,
"category": category,
**aps_kwargs,
},
**extra,
Expand Down Expand Up @@ -223,6 +225,7 @@ def apns_send_message(
priority: int = None,
collapse_id: str = None,
err_func: ErrFunc = None,
category: str = None,
):
"""
Sends an APNS notification to a single registration_id.
Expand Down Expand Up @@ -254,6 +257,7 @@ def apns_send_message(
priority=priority,
collapse_id=collapse_id,
err_func=err_func,
category=category,
)

for result in results.values():
Expand All @@ -278,6 +282,7 @@ def apns_send_bulk_message(
priority: int = None,
collapse_id: str = None,
err_func: ErrFunc = None,
category: str = None,
):
"""
Sends an APNS notification to one or more registration_ids.
Expand Down Expand Up @@ -312,6 +317,7 @@ def apns_send_bulk_message(
priority=priority,
collapse_id=collapse_id,
err_func=err_func,
category=category,
))

results = {}
Expand Down Expand Up @@ -356,6 +362,7 @@ async def _send_bulk_request(
priority: int = None,
collapse_id: str = None,
err_func: ErrFunc = None,
category: str = None,
):
client = _create_client(
creds=creds, application_id=application_id, topic=topic, err_func=err_func
Expand All @@ -372,6 +379,7 @@ async def _send_bulk_request(
loc_key=loc_key,
priority=priority,
collapse_id=collapse_id,
category=category,
) for registration_id in registration_ids]

send_requests = [_send_request(client, request) for request in requests]
Expand Down
Loading