rpush 2.7.0 → 3.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +41 -0
  3. data/README.md +36 -15
  4. data/lib/generators/rpush_migration_generator.rb +1 -0
  5. data/lib/generators/templates/add_adm.rb +1 -1
  6. data/lib/generators/templates/add_alert_is_json_to_rapns_notifications.rb +1 -1
  7. data/lib/generators/templates/add_app_to_rapns.rb +1 -1
  8. data/lib/generators/templates/add_fail_after_to_rpush_notifications.rb +1 -1
  9. data/lib/generators/templates/add_gcm.rb +1 -1
  10. data/lib/generators/templates/add_rpush.rb +11 -11
  11. data/lib/generators/templates/add_wpns.rb +1 -1
  12. data/lib/generators/templates/create_rapns_apps.rb +1 -1
  13. data/lib/generators/templates/create_rapns_feedback.rb +1 -1
  14. data/lib/generators/templates/create_rapns_notifications.rb +1 -1
  15. data/lib/generators/templates/rename_rapns_to_rpush.rb +1 -1
  16. data/lib/generators/templates/rpush.rb +1 -1
  17. data/lib/generators/templates/rpush_2_0_0_updates.rb +1 -1
  18. data/lib/generators/templates/rpush_2_1_0_updates.rb +1 -1
  19. data/lib/generators/templates/rpush_2_6_0_updates.rb +1 -1
  20. data/lib/generators/templates/rpush_2_7_0_updates.rb +1 -1
  21. data/lib/generators/templates/rpush_3_0_0_updates.rb +11 -0
  22. data/lib/rpush.rb +2 -9
  23. data/lib/rpush/apns_feedback.rb +4 -0
  24. data/lib/rpush/cli.rb +2 -2
  25. data/lib/rpush/client/active_model.rb +3 -0
  26. data/lib/rpush/client/active_model/apns/notification.rb +11 -1
  27. data/lib/rpush/client/active_model/apns2/app.rb +15 -0
  28. data/lib/rpush/client/active_model/apns2/notification.rb +9 -0
  29. data/lib/rpush/client/active_record.rb +3 -0
  30. data/lib/rpush/client/active_record/apns/feedback.rb +0 -4
  31. data/lib/rpush/client/active_record/apns2/app.rb +11 -0
  32. data/lib/rpush/client/active_record/apns2/notification.rb +10 -0
  33. data/lib/rpush/client/active_record/app.rb +0 -4
  34. data/lib/rpush/client/active_record/notification.rb +0 -7
  35. data/lib/rpush/client/redis.rb +3 -0
  36. data/lib/rpush/client/redis/apns2/app.rb +11 -0
  37. data/lib/rpush/client/redis/apns2/notification.rb +11 -0
  38. data/lib/rpush/client/redis/notification.rb +1 -0
  39. data/lib/rpush/daemon.rb +5 -3
  40. data/lib/rpush/daemon/apns2.rb +10 -0
  41. data/lib/rpush/daemon/apns2/delivery.rb +127 -0
  42. data/lib/rpush/daemon/dispatcher/apns_http2.rb +50 -0
  43. data/lib/rpush/daemon/dispatcher/apns_tcp.rb +1 -1
  44. data/lib/rpush/daemon/dispatcher/http.rb +1 -1
  45. data/lib/rpush/daemon/gcm/delivery.rb +5 -5
  46. data/lib/rpush/daemon/service_config_methods.rb +4 -3
  47. data/lib/rpush/daemon/store/active_record/reconnectable.rb +11 -3
  48. data/lib/rpush/daemon/synchronizer.rb +14 -12
  49. data/lib/rpush/version.rb +12 -1
  50. data/spec/functional/apns2_spec.rb +232 -0
  51. data/spec/functional/apns_spec.rb +1 -2
  52. data/spec/functional/synchronization_spec.rb +29 -0
  53. data/spec/spec_helper.rb +0 -5
  54. data/spec/support/active_record_setup.rb +2 -1
  55. data/spec/unit/apns_feedback_spec.rb +9 -2
  56. data/spec/unit/client/active_record/apns/notification_spec.rb +34 -2
  57. data/spec/unit/daemon/store/active_record/reconnectable_spec.rb +30 -0
  58. data/spec/unit_spec_helper.rb +2 -21
  59. metadata +256 -29
  60. data/lib/rpush/client/mongoid.rb +0 -36
  61. data/lib/rpush/client/mongoid/adm/app.rb +0 -14
  62. data/lib/rpush/client/mongoid/adm/notification.rb +0 -11
  63. data/lib/rpush/client/mongoid/apns/app.rb +0 -11
  64. data/lib/rpush/client/mongoid/apns/feedback.rb +0 -24
  65. data/lib/rpush/client/mongoid/apns/notification.rb +0 -15
  66. data/lib/rpush/client/mongoid/app.rb +0 -23
  67. data/lib/rpush/client/mongoid/gcm/app.rb +0 -11
  68. data/lib/rpush/client/mongoid/gcm/notification.rb +0 -11
  69. data/lib/rpush/client/mongoid/notification.rb +0 -51
  70. data/lib/rpush/client/mongoid/wns/app.rb +0 -14
  71. data/lib/rpush/client/mongoid/wns/badge_notification.rb +0 -15
  72. data/lib/rpush/client/mongoid/wns/notification.rb +0 -11
  73. data/lib/rpush/client/mongoid/wns/raw_notification.rb +0 -11
  74. data/lib/rpush/client/mongoid/wpns/app.rb +0 -11
  75. data/lib/rpush/client/mongoid/wpns/notification.rb +0 -11
  76. data/lib/rpush/daemon/store/mongoid.rb +0 -157
  77. data/spec/support/config/mongoid.yml +0 -69
  78. data/spec/support/mongoid_setup.rb +0 -10
  79. data/spec/unit/daemon/store/mongoid_spec.rb +0 -339
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1610a8d44461c0347fcc0d4475906e96c79f7d6
4
- data.tar.gz: ef3c2b45c48acd439f6e928bfd87fa8c67a80ccb
3
+ metadata.gz: d3a376996f25fb2305f09b2cf069aaddf26e5d6f
4
+ data.tar.gz: 9add19dd6ade95761aee96acdf7eac4149e8e8b6
5
5
  SHA512:
6
- metadata.gz: 3477a221b69f267071e04d02b52b2d5914ad3d1a905c421490c654fc3b161592e08659a4cba15f7c6b105ca3a63d88fa7f8b60ef6fcce96608cc147a6653f932
7
- data.tar.gz: 0952319256425cda18ae58a16580e3a8f0933b74bd2b9917065715002030c8c761efebbb1636b06a4d4354a8b53f3ef1fd467aa3a617408e1f1a5e4edbbe8549
6
+ metadata.gz: 3bb61ed7f84c1a43a8aafc2f212f1b0cdff0f8d06b9d3ff1995959f63627cb23ddc98ab48c1ca723552c44538038231d771b238749d69eb215197ac45e7045ef
7
+ data.tar.gz: ea5dea83855836f46ce6a35a48e5b35104f9979650b50370604bf8c0fe3de128b38db75f61ff714465b2593b3d0398af6dc4d303e8f7f2b2fef7147aeaf16d98
@@ -1,3 +1,44 @@
1
+ ## HEAD
2
+
3
+ ### Breaking Changes
4
+
5
+ - None
6
+
7
+ ### Added
8
+
9
+ - None
10
+
11
+ ### Fixed
12
+
13
+ - None
14
+
15
+ ## 3.0.0.rc1 (2017-08-31)
16
+
17
+ When upgrading, don't forget to run `bundle exec rpush init` to get all the latest migrations.
18
+
19
+ #### Features
20
+
21
+ * Added support for APNS `mutable-content` ([#296](https://github.com/rpush/rpush/pull/296) by [@tdtran](https://github.com/tdtran))
22
+ * Added support for HTTP2 base APNS Api ([#315](https://github.com/rpush/rpush/pull/315) by [@soulfly](https://github.com/soulfly) and [@Nattfodd](https://github.com/Nattfodd))
23
+
24
+ #### Changes
25
+
26
+ * **Breaking:** Dropped support for old Rubies and Rails versions. rpush 3.0 only supports Ruby versions 2.2.2 or higher and
27
+ Rails 4.2 or higher. ([#366](https://github.com/rpush/rpush/pull/366) by [@aried3r](https://github.com/aried3r))
28
+ * **Breaking:** Dropped MongoDB support because there was no one maintaining it. But we're open to adding it back in. ([#366](https://github.com/rpush/rpush/pull/366) by [@aried3r](https://github.com/aried3r))
29
+ * **Breaking:** Dropped JRuby support. ([#366](https://github.com/rpush/rpush/pull/366) by [@aried3r](https://github.com/aried3r))
30
+
31
+ * Make synchronizer aware of GCM and WNS apps ([#254](https://github.com/rpush/rpush/pull/254) by [@wouterh](https://github.com/wouterh))
32
+ * Precise after init commit msg ([#266](https://github.com/rpush/rpush/pull/266) by [@azranel](https://github.com/azranel))
33
+ * Use new GCM endpoint ([#303](https://github.com/rpush/rpush/pull/303) by [@aried3r](https://github.com/aried3r))
34
+ * Remove sound default value ([#320](https://github.com/rpush/rpush/pull/320) by [@amaierhofer](https://github.com/amaierhofer))
35
+
36
+ #### Bugfixes
37
+
38
+ * ~~~Lock `net-http-persistent` dependency to `< 3`. See also [#306](https://github.com/rpush/rpush/issues/306) for more details. (by [@amaierhofer](https://github.com/amaierhofer))~~~
39
+ * Fix `net-http-persistent` initializer to support version 2.x as well as 3.x. ([#309](https://github.com/rpush/rpush/pull/309) by [@amirmujkic](https://github.com/amirmujkic))
40
+ * Fixed Rpush::ApnsFeedback being run on every application type when using Redis. ([#318](https://github.com/rpush/rpush/pull/318) by [@robertasg](https://github.com/robertasg))
41
+
1
42
  ## 2.7.0 (February 9, 2016)
2
43
 
3
44
  #### Features
data/README.md CHANGED
@@ -1,4 +1,7 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/rpush.svg)](http://badge.fury.io/rb/rpush)
2
+ [![Build Status](https://travis-ci.org/rpush/rpush.svg?branch=master)](https://travis-ci.org/rpush/rpush)
3
+ [![Test Coverage](https://codeclimate.com/github/rpush/rpush/badges/coverage.svg)](https://codeclimate.com/github/rpush/rpush)
4
+ [![Code Climate](https://codeclimate.com/github/rpush/rpush/badges/gpa.svg)](https://codeclimate.com/github/rpush/rpush)
2
5
  [![Join the chat at https://gitter.im/rpush/rpush](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/rpush/rpush?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
3
6
 
4
7
  <img src="https://raw.github.com/rpush/rpush/master/logo.png" align="right" width="200px" />
@@ -11,13 +14,13 @@ Rpush aims to be the *de facto* gem for sending push notifications in Ruby. Its
11
14
 
12
15
  * [**Apple Push Notification Service**](#apple-push-notification-service)
13
16
  * Including Safari Push Notifications.
14
- * [**Google Cloud Messaging**](#google-cloud-messaging)
17
+ * [**Firebase Cloud Messaging**](#firebase-cloud-messaging) (used to be Google Cloud Messaging)
15
18
  * [**Amazon Device Messaging**](#amazon-device-messaging)
16
19
  * [**Windows Phone Push Notification Service**](#windows-phone-notification-service)
17
20
 
18
21
  #### Feature Highlights
19
22
 
20
- * Use [**ActiveRecord**](https://github.com/rpush/rpush/wiki/Using-ActiveRecord), [**Redis**](https://github.com/rpush/rpush/wiki/Using-Redis) or [**MongoDB**](https://github.com/rpush/rpush/wiki/Using-Mongodb) for storage.
23
+ * Use [**ActiveRecord**](https://github.com/rpush/rpush/wiki/Using-ActiveRecord) or [**Redis**](https://github.com/rpush/rpush/wiki/Using-Redis) for storage.
21
24
  * Plugins for [**Bugsnag**](https://github.com/rpush/rpush-plugin-bugsnag),
22
25
  [**Sentry**](https://github.com/rpush/rpush-plugin-sentry), [**StatsD**](https://github.com/rpush/rpush-plugin-statsd) or [write your own](https://github.com/rpush/rpush/wiki/Writing-a-Plugin).
23
26
  * Seamless integration with your projects, including **Rails**.
@@ -40,20 +43,22 @@ Initialize Rpush into your project. **Rails will be detected automatically.**
40
43
 
41
44
  ```sh
42
45
  $ cd /path/to/project
43
- $ rpush init
46
+ $ bundle
47
+ $ bundle exec rpush init
44
48
  ```
45
49
 
46
50
  ### Create an App & Notification
47
51
 
48
52
  #### Apple Push Notification Service
49
53
 
54
+
50
55
  If this is your first time using the APNs, you will need to generate SSL certificates. See [Generating Certificates](https://github.com/rpush/rpush/wiki/Generating-Certificates) for instructions.
51
56
 
52
57
  ```ruby
53
58
  app = Rpush::Apns::App.new
54
59
  app.name = "ios_app"
55
60
  app.certificate = File.read("/path/to/sandbox.pem")
56
- app.environment = "sandbox" # APNs environment.
61
+ app.environment = "development" # APNs environment.
57
62
  app.password = "certificate password"
58
63
  app.connections = 1
59
64
  app.save!
@@ -72,7 +77,11 @@ The `url_args` attribute is available for Safari Push Notifications.
72
77
 
73
78
  You should also implement the [ssl_certificate_will_expire](https://github.com/rpush/rpush/wiki/Reflection-API) reflection to monitor when your certificate is due to expire.
74
79
 
75
- #### Google Cloud Messaging
80
+ To use the newer APNs Api replace `Rpush::Apns::App` with `Rpush::Apns2::App`.
81
+
82
+ #### Firebase Cloud Messaging
83
+
84
+ FCM and GCM are – as of writing – compatible with each other. See also [this comment](https://github.com/rpush/rpush/issues/284#issuecomment-228330206) for further references.
76
85
 
77
86
  ```ruby
78
87
  app = Rpush::Gcm::App.new
@@ -97,9 +106,9 @@ n.notification = { body: 'great match!',
97
106
  n.save!
98
107
  ```
99
108
 
100
- GCM also requires you to respond to [Canonical IDs](https://github.com/rpush/rpush/wiki/Canonical-IDs).
109
+ FCM also requires you to respond to [Canonical IDs](https://github.com/rpush/rpush/wiki/Canonical-IDs).
101
110
 
102
- Check the [GCM reference](https://developers.google.com/cloud-messaging/http-server-ref#notification-payload-support) for what keys you can use and are available to you. **Note:** Not all are yet implemented in Rpush.
111
+ Check the [FCM reference](https://firebase.google.com/docs/cloud-messaging/http-server-ref#notification-payload-support) for what keys you can use and are available to you. **Note:** Not all are yet implemented in Rpush.
103
112
 
104
113
  #### Amazon Device Messaging
105
114
 
@@ -150,6 +159,10 @@ Uses the more recent [Toast template](https://msdn.microsoft.com/en-us/library/w
150
159
 
151
160
  The `client_id` here is the SID URL as seen [here](https://msdn.microsoft.com/en-us/library/windows/apps/hh465407.aspx#7-SIDandSecret). Do not confuse it with the `client_id` on dashboard.
152
161
 
162
+ You can (optionally) include a launch argument by adding a `launch` key to the notification data.
163
+
164
+ You can (optionally) include an [audio element](https://msdn.microsoft.com/en-us/library/windows/apps/xaml/br230842.aspx) by setting the sound on the notification.
165
+
153
166
  ```ruby
154
167
  app = Rpush::Wns::App.new
155
168
  app.name = "windows_phone_app"
@@ -163,7 +176,8 @@ app.save!
163
176
  n = Rpush::Wns::Notification.new
164
177
  n.app = Rpush::Wns::App.find_by_name("windows_phone_app")
165
178
  n.uri = "http://..."
166
- n.data = {title:"MyApp", body:"Hello world"}
179
+ n.data = {title:"MyApp", body:"Hello world", launch:"launch-argument"}
180
+ n.sound = "ms-appx:///mynotificationsound.wav"
167
181
  n.save!
168
182
  ```
169
183
 
@@ -180,6 +194,18 @@ n.data = { foo: 'foo', bar: 'bar' }
180
194
  n.save!
181
195
  ```
182
196
 
197
+ #### Windows Badge Push Notifications
198
+
199
+ Uses the [badge template](https://msdn.microsoft.com/en-us/library/windows/apps/xaml/br212849.aspx) and the type `wns/badge`.
200
+
201
+ ```ruby
202
+ n = Rpush::Wns::BadgeNotification.new
203
+ n.app = Rpush::Wns::App.find_by_name("windows_phone_app")
204
+ n.uri = 'http://...'
205
+ n.badge = 4
206
+ n.save!
207
+ ```
208
+
183
209
  ### Running Rpush
184
210
 
185
211
  It is recommended to run Rpush as a separate process in most cases, though embedding and manual modes are provided for low-workload environments.
@@ -260,7 +286,7 @@ You should run `rpush init` after upgrading Rpush to check for configuration and
260
286
  * [Why open multiple connections to the APNs?](https://github.com/rpush/rpush/wiki/Why-open-multiple-connections-to-the-APNs%3F)
261
287
  * [Silent failures might be dropped connections](https://github.com/rpush/rpush/wiki/Dropped-connections)
262
288
 
263
- ### Google Cloud Messaging
289
+ ### Firebase Cloud Messaging
264
290
  * [Notification Options](https://github.com/rpush/rpush/wiki/GCM-Notification-Options)
265
291
  * [Canonical IDs](https://github.com/rpush/rpush/wiki/Canonical-IDs)
266
292
  * [Delivery Failures & Retries](https://github.com/rpush/rpush/wiki/Delivery-Failures-&-Retries)
@@ -275,9 +301,4 @@ Note that the database username is changed at runtime to be the currently logged
275
301
  with mysql and you're using a user named 'bob', you will need to grant a mysql user 'bob' access to the 'rpush_test'
276
302
  mysql database.
277
303
 
278
- To switch between ActiveRecord and Redis, set the `CLIENT` environment variable to either `active_record`, `redis` or `mongoid`.
279
-
280
-
281
- [![Build Status](https://secure.travis-ci.org/rpush/rpush.svg?branch=master)](http://travis-ci.org/rpush/rpush)
282
- [![Test Coverage](https://codeclimate.com/github/rpush/rpush/badges/coverage.svg)](https://codeclimate.com/github/rpush/rpush)
283
- [![Code Climate](https://codeclimate.com/github/rpush/rpush/badges/gpa.svg)](https://codeclimate.com/github/rpush/rpush)
304
+ To switch between ActiveRecord and Redis, set the `CLIENT` environment variable to either `active_record` or `redis`.
@@ -42,6 +42,7 @@ class RpushMigrationGenerator < Rails::Generators::Base
42
42
  add_rpush_migration('rpush_2_1_0_updates')
43
43
  add_rpush_migration('rpush_2_6_0_updates')
44
44
  add_rpush_migration('rpush_2_7_0_updates')
45
+ add_rpush_migration('rpush_3_0_0_updates')
45
46
  end
46
47
 
47
48
  protected
@@ -1,4 +1,4 @@
1
- class AddAdm < ActiveRecord::Migration
1
+ class AddAdm < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
2
2
  module Rapns
3
3
  class Notification < ActiveRecord::Base
4
4
  self.table_name = 'rapns_notifications'
@@ -1,4 +1,4 @@
1
- class AddAlertIsJsonToRapnsNotifications < ActiveRecord::Migration
1
+ class AddAlertIsJsonToRapnsNotifications < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
2
2
  def self.up
3
3
  add_column :rapns_notifications, :alert_is_json, :boolean, null: true, default: false
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddAppToRapns < ActiveRecord::Migration
1
+ class AddAppToRapns < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
2
2
  def self.up
3
3
  add_column :rapns_notifications, :app, :string, null: true
4
4
  add_column :rapns_feedback, :app, :string, null: true
@@ -1,4 +1,4 @@
1
- class AddFailAfterToRpushNotifications < ActiveRecord::Migration
1
+ class AddFailAfterToRpushNotifications < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
2
2
  def self.up
3
3
  add_column :rpush_notifications, :fail_after, :timestamp, null: true
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddGcm < ActiveRecord::Migration
1
+ class AddGcm < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
2
2
  module Rapns
3
3
  class App < ActiveRecord::Base
4
4
  self.table_name = 'rapns_apps'
@@ -19,7 +19,7 @@
19
19
  # approach. The constituent parts of this migration have been executed
20
20
  # many times, by many people!
21
21
 
22
- class AddRpush < ActiveRecord::Migration
22
+ class AddRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
23
23
  def self.migrations
24
24
  [CreateRapnsNotifications, CreateRapnsFeedback,
25
25
  AddAlertIsJsonToRapnsNotifications, AddAppToRapns,
@@ -41,7 +41,7 @@ class AddRpush < ActiveRecord::Migration
41
41
  end
42
42
  end
43
43
 
44
- class CreateRapnsNotifications < ActiveRecord::Migration
44
+ class CreateRapnsNotifications < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
45
45
  def self.up
46
46
  create_table :rapns_notifications do |t|
47
47
  t.integer :badge, null: true
@@ -71,7 +71,7 @@ class AddRpush < ActiveRecord::Migration
71
71
  end
72
72
  end
73
73
 
74
- class CreateRapnsFeedback < ActiveRecord::Migration
74
+ class CreateRapnsFeedback < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
75
75
  def self.up
76
76
  create_table :rapns_feedback do |t|
77
77
  t.string :device_token, null: false, limit: 64
@@ -90,7 +90,7 @@ class AddRpush < ActiveRecord::Migration
90
90
  end
91
91
  end
92
92
 
93
- class AddAlertIsJsonToRapnsNotifications < ActiveRecord::Migration
93
+ class AddAlertIsJsonToRapnsNotifications < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
94
94
  def self.up
95
95
  add_column :rapns_notifications, :alert_is_json, :boolean, null: true, default: false
96
96
  end
@@ -100,7 +100,7 @@ class AddRpush < ActiveRecord::Migration
100
100
  end
101
101
  end
102
102
 
103
- class AddAppToRapns < ActiveRecord::Migration
103
+ class AddAppToRapns < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
104
104
  def self.up
105
105
  add_column :rapns_notifications, :app, :string, null: true
106
106
  add_column :rapns_feedback, :app, :string, null: true
@@ -112,7 +112,7 @@ class AddRpush < ActiveRecord::Migration
112
112
  end
113
113
  end
114
114
 
115
- class CreateRapnsApps < ActiveRecord::Migration
115
+ class CreateRapnsApps < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
116
116
  def self.up
117
117
  create_table :rapns_apps do |t|
118
118
  t.string :key, null: false
@@ -129,7 +129,7 @@ class AddRpush < ActiveRecord::Migration
129
129
  end
130
130
  end
131
131
 
132
- class AddGcm < ActiveRecord::Migration
132
+ class AddGcm < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
133
133
  module Rapns
134
134
  class App < ActiveRecord::Base
135
135
  self.table_name = 'rapns_apps'
@@ -232,7 +232,7 @@ class AddRpush < ActiveRecord::Migration
232
232
  end
233
233
  end
234
234
 
235
- class AddWpns < ActiveRecord::Migration
235
+ class AddWpns < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
236
236
  module Rapns
237
237
  class Notification < ActiveRecord::Base
238
238
  self.table_name = 'rapns_notifications'
@@ -249,7 +249,7 @@ class AddRpush < ActiveRecord::Migration
249
249
  end
250
250
  end
251
251
 
252
- class AddAdm < ActiveRecord::Migration
252
+ class AddAdm < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
253
253
  module Rapns
254
254
  class Notification < ActiveRecord::Base
255
255
  self.table_name = 'rapns_notifications'
@@ -273,7 +273,7 @@ class AddRpush < ActiveRecord::Migration
273
273
  end
274
274
  end
275
275
 
276
- class RenameRapnsToRpush < ActiveRecord::Migration
276
+ class RenameRapnsToRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
277
277
  module Rpush
278
278
  class App < ActiveRecord::Base
279
279
  self.table_name = 'rpush_apps'
@@ -337,7 +337,7 @@ class AddRpush < ActiveRecord::Migration
337
337
  end
338
338
  end
339
339
 
340
- class AddFailAfterToRpushNotifications < ActiveRecord::Migration
340
+ class AddFailAfterToRpushNotifications < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
341
341
  def self.up
342
342
  add_column :rpush_notifications, :fail_after, :timestamp, null: true
343
343
  end
@@ -1,4 +1,4 @@
1
- class AddWpns < ActiveRecord::Migration
1
+ class AddWpns < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
2
2
  module Rapns
3
3
  class Notification < ActiveRecord::Base
4
4
  self.table_name = 'rapns_notifications'
@@ -1,4 +1,4 @@
1
- class CreateRapnsApps < ActiveRecord::Migration
1
+ class CreateRapnsApps < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
2
2
  def self.up
3
3
  create_table :rapns_apps do |t|
4
4
  t.string :key, null: false
@@ -1,4 +1,4 @@
1
- class CreateRapnsFeedback < ActiveRecord::Migration
1
+ class CreateRapnsFeedback < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
2
2
  def self.up
3
3
  create_table :rapns_feedback do |t|
4
4
  t.string :device_token, null: false, limit: 64
@@ -1,4 +1,4 @@
1
- class CreateRapnsNotifications < ActiveRecord::Migration
1
+ class CreateRapnsNotifications < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
2
2
  def self.up
3
3
  create_table :rapns_notifications do |t|
4
4
  t.integer :badge, null: true
@@ -1,4 +1,4 @@
1
- class RenameRapnsToRpush < ActiveRecord::Migration
1
+ class RenameRapnsToRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
2
2
  module Rpush
3
3
  class App < ActiveRecord::Base
4
4
  self.table_name = 'rpush_apps'
@@ -1,6 +1,6 @@
1
1
  Rpush.configure do |config|
2
2
 
3
- # Supported clients are :active_record, :redis and :mongoid
3
+ # Supported clients are :active_record and :redis
4
4
  config.client = :active_record
5
5
 
6
6
  # Options passed to Redis.new
@@ -1,4 +1,4 @@
1
- class Rpush200Updates < ActiveRecord::Migration
1
+ class Rpush200Updates < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
2
2
  module Rpush
3
3
  class App < ActiveRecord::Base
4
4
  self.table_name = 'rpush_apps'
@@ -1,4 +1,4 @@
1
- class Rpush210Updates < ActiveRecord::Migration
1
+ class Rpush210Updates < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
2
2
  def self.up
3
3
  add_column :rpush_notifications, :url_args, :text, null: true
4
4
  add_column :rpush_notifications, :category, :string, null: true
@@ -1,4 +1,4 @@
1
- class Rpush260Updates < ActiveRecord::Migration
1
+ class Rpush260Updates < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
2
2
  def self.up
3
3
  add_column :rpush_notifications, :content_available, :boolean, default: false
4
4
  end
@@ -1,4 +1,4 @@
1
- class Rpush270Updates < ActiveRecord::Migration
1
+ class Rpush270Updates < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
2
2
  def self.up
3
3
  change_column :rpush_notifications, :alert, :text
4
4
  add_column :rpush_notifications, :notification, :text
@@ -0,0 +1,11 @@
1
+ class Rpush300Updates < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
2
+ def self.up
3
+ add_column :rpush_notifications, :mutable_content, :boolean, default: false
4
+ change_column :rpush_notifications, :sound, :string, default: nil
5
+ end
6
+
7
+ def self.down
8
+ remove_column :rpush_notifications, :mutable_content
9
+ change_column :rpush_notifications, :sound, :string, default: 'default'
10
+ end
11
+ end
@@ -1,16 +1,9 @@
1
1
  require 'logger'
2
2
  require 'multi_json'
3
3
  require 'active_support/all'
4
+ require 'net-http2'
4
5
 
5
- module Rpush
6
- def self.attr_accessible_available?
7
- require 'rails'
8
- rescue LoadError
9
- false
10
- else
11
- ::Rails::VERSION::STRING < '4' || defined?(::ActiveRecord::MassAssignmentSecurity)
12
- end
13
- end
6
+ require 'rails'
14
7
 
15
8
  require 'rpush/version'
16
9
  require 'rpush/cli'
@@ -4,6 +4,10 @@ module Rpush
4
4
  Rpush::Daemon.common_init
5
5
 
6
6
  Rpush::Apns::App.all.each do |app|
7
+ # Redis stores every App type on the same namespace, hence the
8
+ # additional filtering
9
+ next unless app.service_name == 'apns'
10
+
7
11
  receiver = Rpush::Daemon::Apns::FeedbackReceiver.new(app)
8
12
  receiver.check_for_feedback
9
13
  end
@@ -77,7 +77,7 @@ module Rpush
77
77
  Rails::Generators.invoke('rpush_migration', ['--force']) if install_migrations
78
78
 
79
79
  puts "\n* #{ANSI.green { 'Next steps:' }}"
80
- puts " - Run 'db:migrate'." if install_migrations
80
+ puts " - Run 'bundle exec rake db:migrate'." if install_migrations
81
81
  puts " - Review and update your configuration in #{default_config_path}."
82
82
  puts " - Create your first app, see https://github.com/rpush/rpush for examples."
83
83
  puts " - Run 'rpush help' for commands and options."
@@ -153,7 +153,7 @@ module Rpush
153
153
  end
154
154
 
155
155
  def check_ruby_version
156
- STDERR.puts(ANSI.yellow { 'WARNING: ' } + "You are using an old and unsupported version of Ruby.") if RUBY_VERSION <= '1.9.3' && RUBY_ENGINE == 'ruby'
156
+ STDERR.puts(ANSI.yellow { 'WARNING: ' } + "You are using an old and unsupported version of Ruby.") if RUBY_VERSION < '2.2.2' && RUBY_ENGINE == 'ruby'
157
157
  end
158
158
 
159
159
  def underscore_option_names