diff --git a/app/notifications/tasks.py b/app/notifications/tasks.py index b130055..381811b 100644 --- a/app/notifications/tasks.py +++ b/app/notifications/tasks.py @@ -80,18 +80,30 @@ def _send_fcm_to_user(user_id: int, title: str, body: str, data: dict[str, Any]) if not tokens: return - string_data = {str(key): str(value) for key, value in data.items()} + string_data = { + **{str(key): str(value) for key, value in data.items()}, + "title": title, + "body": body, + } for platform, token in tokens: webpush = None + notification = None + android = None if platform == "web": webpush = messaging.WebpushConfig( fcm_options=messaging.WebpushFCMOptions(link=settings.firebase_webpush_link) ) + notification = messaging.Notification(title=title, body=body) + elif platform == "android": + android = messaging.AndroidConfig(priority="high") + else: + notification = messaging.Notification(title=title, body=body) message = messaging.Message( token=token, - notification=messaging.Notification(title=title, body=body), + notification=notification, data=string_data, webpush=webpush, + android=android, ) try: messaging.send(message, app=app)