Fix notifications not working for some users
This commit is contained in:
parent
942d23c040
commit
4935be532d
1 changed files with 19 additions and 14 deletions
|
@ -25,6 +25,8 @@ class Notification < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_gcm_notification
|
def send_gcm_notification
|
||||||
|
if !read
|
||||||
|
begin
|
||||||
if !Rpush::Gcm::App.find_by_name("tappb")
|
if !Rpush::Gcm::App.find_by_name("tappb")
|
||||||
app = Rpush::Gcm::App.new
|
app = Rpush::Gcm::App.new
|
||||||
app.name = "tappb"
|
app.name = "tappb"
|
||||||
|
@ -40,6 +42,9 @@ class Notification < ActiveRecord::Base
|
||||||
n.priority = 'high'
|
n.priority = 'high'
|
||||||
n.content_available = true
|
n.content_available = true
|
||||||
n.save!
|
n.save!
|
||||||
|
rescue
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue