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 Suppport for mutable_content in aioapns #745

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions push_notifications/apns_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ def apns_send_message(
loc_key: str = None,
priority: int = None,
collapse_id: str = None,
mutable_content: int = None,
err_func: ErrFunc = None,
):
"""
Expand All @@ -275,6 +276,9 @@ def apns_send_message(
apns_service = APNsService(
application_id=application_id, creds=creds, topic=topic, err_func=err_func
)
aps_kwargs = {}
if mutable_content:
aps_kwargs["mutable-content"] = mutable_content

request = apns_service._create_notification_request_from_args(
registration_id,
Expand All @@ -287,6 +291,7 @@ def apns_send_message(
loc_key=loc_key,
priority=priority,
collapse_id=collapse_id,
aps_kwargs=aps_kwargs
)
res = apns_service.send_message(request)
if not res.is_successful:
Expand All @@ -313,6 +318,7 @@ def apns_send_bulk_message(
loc_key: str = None,
priority: int = None,
collapse_id: str = None,
mutable_content: int = None,
err_func: ErrFunc = None,
):
"""
Expand All @@ -335,6 +341,9 @@ def apns_send_bulk_message(
apns_service = APNsService(
application_id=application_id, creds=creds, topic=topic, err_func=err_func
)
aps_kwargs = {}
if mutable_content:
aps_kwargs["mutable-content"] = mutable_content
for registration_id in registration_ids:
request = apns_service._create_notification_request_from_args(
registration_id,
Expand All @@ -347,6 +356,7 @@ def apns_send_bulk_message(
loc_key=loc_key,
priority=priority,
collapse_id=collapse_id,
aps_kwargs=aps_kwargs
)

result = apns_service.send_message(request)
Expand Down
Loading