Add native push notification infrastructure
- Add action_push_native gem and SaaS configuration - Add device registration API and UI - Add User::Devices concern - Add NotificationPusher::Native for push delivery - Add tests and fixtures for native push
This commit is contained in:
committed by
Rosa Gutierrez
parent
628a43ef61
commit
3c54cd84fc
@@ -12,18 +12,22 @@ class NotificationPusher
|
||||
return unless should_push?
|
||||
|
||||
build_payload.tap do |payload|
|
||||
push_to_user(payload)
|
||||
push_to_web(payload)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def should_push?
|
||||
notification.user.push_subscriptions.any? &&
|
||||
push_destination? &&
|
||||
!notification.creator.system? &&
|
||||
notification.user.active? &&
|
||||
notification.account.active?
|
||||
end
|
||||
|
||||
def push_destination?
|
||||
notification.user.push_subscriptions.any?
|
||||
end
|
||||
|
||||
def build_payload
|
||||
case notification.source_type
|
||||
when "Event"
|
||||
@@ -93,7 +97,7 @@ class NotificationPusher
|
||||
}
|
||||
end
|
||||
|
||||
def push_to_user(payload)
|
||||
def push_to_web(payload)
|
||||
subscriptions = notification.user.push_subscriptions
|
||||
enqueue_payload_for_delivery(payload, subscriptions)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user