notify_user 0.0.12 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/notify_user/base_notifications_controller.rb +1 -1
- data/app/models/notify_user/apns.rb +1 -1
- data/app/models/notify_user/base_notification.rb +4 -0
- data/lib/notify_user/channels/apns/apns_channel.rb +6 -0
- data/lib/notify_user/version.rb +1 -1
- data/spec/dummy/rails-4.0.4/log/test.log +4456 -0
- data/spec/models/notify_user/notification_spec.rb +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 086d1f42cbe0570383ffe1a7bb695fdf64b5070f
|
4
|
+
data.tar.gz: 81e64332739e082a9219361c319eddc118124d6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a93032a0d421de42e672305ab0ba740febc7768df050eb3062a583ebbaf871e7faa4bcea0774f70c20855a4254fcfe82682b0ae9d40e2b270c284999a1d4eeaa
|
7
|
+
data.tar.gz: 3ce914c932743f44c758da731dbee28f347d35587786717a59d07680a25818737a54b0fa4b9f58271bf529e46c31196d32782c0f95204ae9f83faa8260ddf21f
|
@@ -38,7 +38,7 @@ class NotifyUser::BaseNotificationsController < ApplicationController
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def notifications_count
|
41
|
-
@notifications = NotifyUser::BaseNotification.for_target(@user).where('state IN (?)', ["sent"])
|
41
|
+
@notifications = NotifyUser::BaseNotification.for_target(@user).where('state IN (?)', ["sent", "pending"])
|
42
42
|
render json: {:count => @notifications.count}
|
43
43
|
end
|
44
44
|
|
@@ -15,7 +15,7 @@ module NotifyUser
|
|
15
15
|
|
16
16
|
payload = {
|
17
17
|
:alias => notification.target_id,
|
18
|
-
:aps => {alert: notification.mobile_message(space_allowance), badge:
|
18
|
+
:aps => {alert: notification.mobile_message(space_allowance), badge: notification.count_for_target},
|
19
19
|
:n_data => {
|
20
20
|
'#' => notification.id,
|
21
21
|
t: notification.created_at.to_time.to_i,
|
@@ -58,6 +58,10 @@ module NotifyUser
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
def count_for_target
|
62
|
+
NotifyUser::BaseNotification.for_target(target).where('state IN (?)', ["sent", "pending"]).count
|
63
|
+
end
|
64
|
+
|
61
65
|
def message
|
62
66
|
ActionView::Base.new(
|
63
67
|
Rails.configuration.paths["app/views"]).render(
|
@@ -19,6 +19,12 @@ class ApnsChannel
|
|
19
19
|
Urbanairship.master_secret = ENV['DEV_UA_MASTER_SECRET']
|
20
20
|
|
21
21
|
NotifyUser::Apns.push_notification(notification)
|
22
|
+
|
23
|
+
#sets the api keys bake to their original state
|
24
|
+
|
25
|
+
Urbanairship.application_key = ENV['UA_APPLICATION_KEY']
|
26
|
+
Urbanairship.application_secret = ENV['UA_APPLICATION_SECRET']
|
27
|
+
Urbanairship.master_secret = ENV['UA_MASTER_SECRET']
|
22
28
|
end
|
23
29
|
end
|
24
30
|
|
data/lib/notify_user/version.rb
CHANGED