Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More realistic APN sandbox support #304

Closed

Conversation

rromanchuk
Copy link
Contributor

A user has_many tokens that can be generated from both development (sandboxed devices), or production (not sandboxed devices) and is unrelated to the rails environment or endpoint being used. It's per-token introspection, which makes it's it a little annoying juggling connection pools, but it's a life saver when correctly supported.

  def ios_device_tokens(recipient)
    recipient.notification_tokens.where(environment: :production, platform: :iOS).pluck(:token)
  end

  def ios_development_device_tokens(recipient)
    recipient.notification_tokens.where(environment: :development, platform: :iOS).pluck(:token)
  end

…andboxed devices), or production (not sandboxed devices) and is unrelated to the rails environment or endpoint being used
@excid3
Copy link
Owner

excid3 commented Jan 15, 2024

In Noticed v2, I'd recommend using two separate iOS delivery methods for this case instead.

deliver_by :ios do |config|
 config.device_tokens = ->(recipient) { retrieve production tokens }
end

deliver_by :ios_development, class: "Noticed::DeliveryMethods::Ios" do |config|
  config.development = true
  config.device_tokens = ->(recipient) { retrieve development tokens }
end

@excid3 excid3 closed this Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants