Skip to content

Commit

Permalink
Use send_each() instead of deprecated send_all() (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
lkh42t authored Apr 8, 2024
1 parent 215947a commit 8e95b7c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions fcm_django/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def send_message(
"""
Send notification of single message for all active devices in
queryset and deactivate if DELETE_INACTIVE_DEVICES setting is set to True.
Bulk sends using firebase.messaging.send_all. For every 500 messages, we send a
Bulk sends using firebase.messaging.send_each. For every 500 messages, we send a
single HTTP request to Firebase (the 500 is set by the firebase-sdk).
:param message: firebase.messaging.Message. If `message` includes a token/id, it
Expand All @@ -141,7 +141,7 @@ def send_message(
:param additional_registration_ids: specific registration_ids to add to the
:param app: firebase_admin.App. Specify a specific app to use
QuerySet lookup
:param more_send_message_kwargs: Parameters for firebase.messaging.send_all()
:param more_send_message_kwargs: Parameters for firebase.messaging.send_each()
- dry_run: bool. Whether to actually send the notification to the device
If there are any new parameters, you can still specify them here.
Expand All @@ -161,7 +161,7 @@ def send_message(
for token in registration_ids[i : i + MAX_MESSAGES_PER_BATCH]
]
responses.extend(
messaging.send_all(
messaging.send_each(
messages, app=app, **more_send_message_kwargs
).responses
)
Expand Down Expand Up @@ -302,7 +302,7 @@ def send_message(
:param message: firebase.messaging.Message. If `message` includes a token/id, it
will be overridden.
:param app: firebase_admin.App. Specify a specific app to use
:param more_send_message_kwargs: Parameters for firebase.messaging.send_all()
:param more_send_message_kwargs: Parameters for firebase.messaging.send_each()
- dry_run: bool. Whether to actually send the notification to the device
If there are any new parameters, you can still specify them here.
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Django>=3.2
django-tastypie>=0.14.0
djangorestframework>=3.9.2
firebase-admin>=5,<7
firebase-admin>=6.2,<7
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"fcm_django/migrations",
],
python_requires=">=3.7",
install_requires=["firebase-admin>=5,<7", "Django"],
install_requires=["firebase-admin>=6.2,<7", "Django"],
author=fcm_django.__author__,
author_email=fcm_django.__email__,
classifiers=CLASSIFIERS,
Expand Down

0 comments on commit 8e95b7c

Please sign in to comment.