Skip to content

Commit

Permalink
Add Suppport for mutable_content in aioapns
Browse files Browse the repository at this point in the history
  • Loading branch information
HashimJVZ committed Nov 6, 2024
1 parent 587d01b commit 314a484
Showing 1 changed file with 10 additions and 0 deletions.
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

0 comments on commit 314a484

Please sign in to comment.