Feedback received callback #77

Closed
mattconnolly opened this Issue Oct 15, 2012 · 1 comment

Projects

None yet

2 participants

Contributor

I need a way to invoke some code when feedback is received so I can mark users/devices as do not send any more notifications.

Since the feedback is being handled by rapns with a rails environment loaded (connection to database, etc), this could easily be done from within rapns itself if we could specify the block to execute when feedback is received.

Contributor

My idea is that the user with the Rails app can create a config/initializers/rapns.rb file and do something like this:

Rapns.configure do |config|
  config.on_feedback do |feedback|
    device = Device.find_by_device_token feedback.device_token
    if device
      device.active = false
      device.save
    end
  end
end

And that block will be called when feedback is received.

@mattconnolly mattconnolly added a commit to mattconnolly/rapns that referenced this issue Oct 15, 2012
@mattconnolly Matt Connolly + mattconnolly Adding Rapns::Config class; Adding support for Config to be modified …
…from the rails app 'config/initializers/rapns.rb' file; Adding Feedback receiver call a callback when feedback is received.

For issue #77
3fd15dd
@ileitch ileitch closed this Dec 6, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment