### Data Used: {"content"=>"Aaaaaa", "repeat"=>nil, "repeat_unit"=>nil, "remind_at"=>nil, "completed_at"=>nil, "reminded_at"=>nil, :type=>"Reminder", :title=>"Reminder", :body=>"Aaaaaa", :sound=>"default"}
class NotificationService::EXPO < NotificationService
delegate :app, to: self
def self.app
@app ||= Exponent::Push::Client.new
end
def notify(notification)
data = notification.push_notification_data
app.publish({
to: registration_id,
sound: "default",
title: data[:title],
body: data[:body],
badge: user.total_counts["notifications"],
data: data
})
end
end
When registration_id is not valid anymore because the EXPO app that has that registration_id is removed from the device, it fails with:
ETHON: performed EASY effective_url=https://exp.host/--/api/v2/push/send response_code=200 return_code=ok total_time=9.14811
TypeError: no implicit conversion of String into Integer
from app/models/notification_service/expo.rb:34:in `notify'
from (irb):218
For now, I'm going to beginrescue that chunk.
Is there a way I can avoid that error? I can't seem to find what causes the problem.
The data I used is {"content"=>"Aaaaaa", "repeat"=>nil, "repeat_unit"=>nil, "remind_at"=>nil, "completed_at"=>nil, "reminded_at"=>nil, :type=>"Reminder", :title=>"Reminder", :body=>"Aaaaaa", :sound=>"default"}
My class:
When
registration_id
is not valid anymore because the EXPO app that has thatregistration_id
is removed from the device, it fails with:For now, I'm going to
begin
rescue
that chunk.Is there a way I can avoid that error? I can't seem to find what causes the problem.
The data I used is
{"content"=>"Aaaaaa", "repeat"=>nil, "repeat_unit"=>nil, "remind_at"=>nil, "completed_at"=>nil, "reminded_at"=>nil, :type=>"Reminder", :title=>"Reminder", :body=>"Aaaaaa", :sound=>"default"}