docbrown/app/services/read_notifications_service.rb
Ben Halpern 1672098388
Removing clear notifications attempt (#1209)
* Removing clear notifications dealy

* Fix user_id issue
2018-11-27 18:29:50 -05:00

30 lines
799 B
Ruby

class ReadNotificationsService
def initialize(user)
@user = user
end
def mark_as_read
NotificationCounter.new(@user).set_to_zero
# remove_notifications(@user.id)
"read"
end
# This was not working as expected. Go back to drawing board.
# def remove_notifications(user_id)
# return unless ApplicationConfig["PUSHER_BEAMS_KEY"] && ApplicationConfig["PUSHER_BEAMS_KEY"].size == 64
# payload = {
# apns: {
# aps: {
# alert: {
# title: "DEV Notifications",
# body: "Marking as read 🙂"
# }
# },
# data: {
# url: "REMOVE_NOTIFICATIONS"
# }
# }
# }
# Pusher::PushNotifications.publish(interests: ["user-notifications-#{user_id}"], payload: payload)
# end
end