From 8e95b7c87ac365ae06dc9db6e67753abeed09527 Mon Sep 17 00:00:00 2001 From: Luc Khai Hai Date: Mon, 8 Apr 2024 20:32:44 +0900 Subject: [PATCH] Use `send_each()` instead of deprecated `send_all()` (#260) --- fcm_django/models.py | 8 ++++---- requirements.txt | 2 +- setup.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fcm_django/models.py b/fcm_django/models.py index 4ebe3cd3..515ade35 100644 --- a/fcm_django/models.py +++ b/fcm_django/models.py @@ -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 @@ -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. @@ -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 ) @@ -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. diff --git a/requirements.txt b/requirements.txt index 80670753..06f5bb5e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/setup.py b/setup.py index 8fa9e6db..33aa680c 100644 --- a/setup.py +++ b/setup.py @@ -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,