notify_user 0.0.12 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b23753216db75ab487cf93cab071dd99a316cb7
4
- data.tar.gz: f3624ce566592cf904d14cf3d0b1d9d4b1ef90fc
3
+ metadata.gz: 086d1f42cbe0570383ffe1a7bb695fdf64b5070f
4
+ data.tar.gz: 81e64332739e082a9219361c319eddc118124d6c
5
5
  SHA512:
6
- metadata.gz: da72718b83416ce4b2dce42d11251cb56b11369964879e365aba63ce05131e773f8ae85a97e3e548012b54183a7740231e4c5740ce9ef94c327df737348140e1
7
- data.tar.gz: a29fb1877aeb9de553c32f738cf4221474724db390f94b854d1067a29fd3831879c99035ad19897328f33365fa5106e1a49b6d440df47e34bc8484919b339d6b
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: 1},
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
 
@@ -1,3 +1,3 @@
1
1
  module NotifyUser
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.14"
3
3
  end