This creates tasks that can be scheduled in celery for sending push notifications to users with native devices (will eventually include web app, but client requires additional development). Tested locally, with development build of iOS App.
This pull request includes significant updates to the notification system, particularly around push notifications for fasting events. It introduces new fields to manage user preferences for notifications and adds tasks for sending these notifications. Additionally, it includes changes to the DeviceToken model and its related serializers and utilities.
Notification System Enhancements:
Added new fields to the Profile model to manage user preferences for receiving different types of fasting notifications (include_weekly_fasts_in_notifications, receive_daily_fast_push_notifications, receive_ongoing_fast_push_notifications, receive_upcoming_fast_push_notifications). ([1], [2])
Created tasks for sending push notifications for upcoming, ongoing, and daily fasts (send_upcoming_fast_push_notification_task, send_ongoing_fast_push_notification_task, send_daily_fast_push_notification_task). (notifications/tasks.pyR1-R89)
Updated the send_push_notification function to filter tokens based on user preferences and notification type, and included logic to exclude weekly fasts if specified. ([1], [2])
Device Token Management:
Added a user field to the DeviceToken model to associate tokens with users and updated the device_type field to include 'web' as a valid option. ([1], [2])
Updated the DeviceTokenSerializer to include the user field and validate the device_type to accept 'ios', 'android', and 'web'. (notifications/serializers.pyL7-R14)
These changes enhance the notification system by allowing more granular control over which notifications users receive and ensuring that notifications are sent to the appropriate devices based on user preferences.
This creates tasks that can be scheduled in celery for sending push notifications to users with native devices (will eventually include web app, but client requires additional development). Tested locally, with development build of iOS App.
This pull request includes significant updates to the notification system, particularly around push notifications for fasting events. It introduces new fields to manage user preferences for notifications and adds tasks for sending these notifications. Additionally, it includes changes to the
DeviceToken
model and its related serializers and utilities.Notification System Enhancements:
Added new fields to the
Profile
model to manage user preferences for receiving different types of fasting notifications (include_weekly_fasts_in_notifications
,receive_daily_fast_push_notifications
,receive_ongoing_fast_push_notifications
,receive_upcoming_fast_push_notifications
). ([1], [2])Created tasks for sending push notifications for upcoming, ongoing, and daily fasts (
send_upcoming_fast_push_notification_task
,send_ongoing_fast_push_notification_task
,send_daily_fast_push_notification_task
). (notifications/tasks.pyR1-R89)Updated the
send_push_notification
function to filter tokens based on user preferences and notification type, and included logic to exclude weekly fasts if specified. ([1], [2])Device Token Management:
Added a
user
field to theDeviceToken
model to associate tokens with users and updated thedevice_type
field to include 'web' as a valid option. ([1], [2])Updated the
DeviceTokenSerializer
to include theuser
field and validate thedevice_type
to accept 'ios', 'android', and 'web'. (notifications/serializers.pyL7-R14)These changes enhance the notification system by allowing more granular control over which notifications users receive and ensuring that notifications are sent to the appropriate devices based on user preferences.