rpush 3.3.0 → 3.3.1

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
  SHA256:
3
- metadata.gz: fb26cf5109afd2857d244091042f687898225e0ce0a44ea789bc3ae08aab585c
4
- data.tar.gz: 6fb69b76b4ca8310c5a89292d86500df86cf36ff9222050b50e712fda3e84ac0
3
+ metadata.gz: 3abc70a76bc7de39565ab73f4eef2b2466ff4dec4fe20ef57e10a9c4e6ff41f3
4
+ data.tar.gz: 42eb70527bd235e7c30b1dab4413d9368f68c129254704bb5af7698cb8cd6c68
5
5
  SHA512:
6
- metadata.gz: 67efc5af2f83e3d782d66bd9ff7674135a3d778bc9fe1669ab3fc11e19d68161839ad13b8265c8e8cac52ce8f68444d2617413d80eb16db95d329f5dfd9a1af1
7
- data.tar.gz: b5d21c00c7cc72d56dff95bd33d2d7742024d84b4f5faa0b0a4187256ea578f6ae8ad423e4d2e29b1af8b32e9fbecec29e0422c7524d0a1ad83959a23ace9197
6
+ metadata.gz: 19b1eeb3bb0e71dd11cd26af20efdb610cdda31c720293578e57d19b82c406841fe33f8aa63d6e4dd5ecff8e18bbcc5a760159259cc78c37aa093a29a70d059a
7
+ data.tar.gz: 75a2fc1eb17241bbaa7fcf3577ef6ba27ac5701f3e4a5396b08f099097b9a686aae9b465c954272871ee33c6c65d4142b4183c5bb17f60e731a1f70e5328c97e
@@ -12,6 +12,14 @@
12
12
 
13
13
  - None
14
14
 
15
+ ## 3.3.1 (2018-11-14)
16
+
17
+ When upgrading, don't forget to run `bundle exec rpush init` to get all the latest migrations.
18
+
19
+ ### Fixed
20
+
21
+ - Remove validation of 64-characters length from `device_token`. [#463](https://github.com/rpush/rpush/pull/463) (by [@chrisokamoto](https://github.com/chrisokamoto)).
22
+
15
23
  ## 3.3.0 (2018-11-14)
16
24
 
17
25
  When upgrading, don't forget to run `bundle exec rpush init` to get all the latest migrations.
data/README.md CHANGED
@@ -68,7 +68,7 @@ app.save!
68
68
  ```ruby
69
69
  n = Rpush::Apns::Notification.new
70
70
  n.app = Rpush::Apns::App.find_by_name("ios_app")
71
- n.device_token = "..." # 64-character hex string
71
+ n.device_token = "..." # hex string
72
72
  n.alert = "hi mom!"
73
73
  n.data = { foo: :bar }
74
74
  n.save!
@@ -97,7 +97,7 @@ app.save!
97
97
  ```ruby
98
98
  n = Rpush::Apns::Notification.new
99
99
  n.app = Rpush::Apnsp8::App.find_by_name("ios_app")
100
- n.device_token = "..." # 64-character hex string
100
+ n.device_token = "..." # hex string
101
101
  n.alert = "hi mom!"
102
102
  n.data = { foo: :bar }
103
103
  n.save!
@@ -49,6 +49,7 @@ class RpushMigrationGenerator < Rails::Generators::Base
49
49
  add_rpush_migration('rpush_3_2_0_add_apns_p8')
50
50
  add_rpush_migration('rpush_3_2_4_updates')
51
51
  add_rpush_migration('rpush_3_3_0_updates')
52
+ add_rpush_migration('rpush_3_3_1_updates')
52
53
  end
53
54
 
54
55
  protected
@@ -0,0 +1,11 @@
1
+ class Rpush331Updates < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
2
+ def self.up
3
+ change_column :rpush_notifications, :device_token, :string, null: true
4
+ change_column :rpush_feedback, :device_token, :string, null: true
5
+ end
6
+
7
+ def self.down
8
+ change_column :rpush_notifications, :device_token, :string, { null: true, limit: 64 }
9
+ change_column :rpush_feedback, :device_token, :string, { null: true, limit: 64 }
10
+ end
11
+ end
@@ -4,7 +4,7 @@ module Rpush
4
4
  module Apns
5
5
  class DeviceTokenFormatValidator < ::ActiveModel::Validator
6
6
  def validate(record)
7
- return if record.device_token =~ /^[a-z0-9]{64}$/i
7
+ return if record.device_token =~ /^[a-z0-9]\w+$/i
8
8
  record.errors[:device_token] << "is invalid"
9
9
  end
10
10
  end
@@ -2,7 +2,7 @@ module Rpush
2
2
  module VERSION
3
3
  MAJOR = 3
4
4
  MINOR = 3
5
- TINY = 0
5
+ TINY = 1
6
6
  PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".").freeze
@@ -11,7 +11,7 @@ describe 'APNs http2 adapter' do
11
11
  )
12
12
  }
13
13
  let(:app) { create_app }
14
- let(:fake_device_token) { 'a' * 64 }
14
+ let(:fake_device_token) { 'a' * 108 }
15
15
  let(:fake_http2_request) { double }
16
16
  let(:fake_http_resp_headers) {
17
17
  {
@@ -27,7 +27,7 @@ describe 'APNs' do
27
27
  notification = Rpush::Apns::Notification.new
28
28
  notification.app = app
29
29
  notification.alert = 'test'
30
- notification.device_token = 'a' * 64
30
+ notification.device_token = 'a' * 108
31
31
  notification.save!
32
32
  notification
33
33
  end
@@ -16,7 +16,7 @@ describe 'embedding' do
16
16
 
17
17
  notification.app = app
18
18
  notification.alert = 'test'
19
- notification.device_token = 'a' * 64
19
+ notification.device_token = 'a' * 108
20
20
  notification.save!
21
21
 
22
22
  stub_tcp_connection
@@ -24,7 +24,7 @@ describe 'New app loading' do
24
24
  notification = Rpush::Apns::Notification.new
25
25
  notification.app = app
26
26
  notification.alert = 'test'
27
- notification.device_token = 'a' * 64
27
+ notification.device_token = 'a' * 108
28
28
  notification.save!
29
29
  notification
30
30
  end
@@ -38,6 +38,7 @@ require 'generators/templates/rpush_3_1_1_updates'
38
38
  require 'generators/templates/rpush_3_2_0_add_apns_p8'
39
39
  require 'generators/templates/rpush_3_2_4_updates'
40
40
  require 'generators/templates/rpush_3_3_0_updates'
41
+ require 'generators/templates/rpush_3_3_1_updates'
41
42
 
42
43
  migrations = [
43
44
  AddRpush,
@@ -51,7 +52,8 @@ migrations = [
51
52
  Rpush311Updates,
52
53
  Rpush320AddApnsP8,
53
54
  Rpush324Updates,
54
- Rpush330Updates
55
+ Rpush330Updates,
56
+ Rpush331Updates
55
57
  ]
56
58
 
57
59
  unless ENV['TRAVIS']
@@ -17,7 +17,7 @@ describe Rpush::Client::ActiveRecord::Apns::Notification do
17
17
  end
18
18
 
19
19
  it "should validate the length of the binary conversion of the notification" do
20
- notification.device_token = "a" * 64
20
+ notification.device_token = "a" * 108
21
21
  notification.alert = "way too long!" * 200
22
22
  expect(notification.valid?).to be_falsey
23
23
  expect(notification.errors[:base].include?("APN notification cannot be larger than 2048 bytes. Try condensing your alert and device attributes.")).to be_truthy
@@ -25,7 +25,7 @@ describe Rpush::Client::ActiveRecord::Apns::Notification do
25
25
 
26
26
  it "should store long alerts" do
27
27
  notification.app = app
28
- notification.device_token = "a" * 64
28
+ notification.device_token = "a" * 108
29
29
  notification.alert = "*" * 300
30
30
  expect(notification.valid?).to be_truthy
31
31
 
@@ -110,7 +110,7 @@ describe Rpush::Client::ActiveRecord::Apns::Notification, 'MDM' do
110
110
  let(:notification) { Rpush::Client::ActiveRecord::Apns::Notification.new }
111
111
 
112
112
  before do
113
- notification.device_token = "a" * 64
113
+ notification.device_token = "a" * 108
114
114
  notification.id = 1234
115
115
  end
116
116
 
@@ -225,7 +225,7 @@ describe Rpush::Client::ActiveRecord::Apns::Notification, 'to_binary' do
225
225
  let(:notification) { Rpush::Client::ActiveRecord::Apns::Notification.new }
226
226
 
227
227
  before do
228
- notification.device_token = "a" * 64
228
+ notification.device_token = "a" * 108
229
229
  notification.id = 1234
230
230
  end
231
231
 
@@ -259,7 +259,7 @@ describe Rpush::Client::ActiveRecord::Apns::Notification, 'to_binary' do
259
259
  notification.app = Rpush::Client::ActiveRecord::Apns::App.new(name: 'my_app', environment: 'development', certificate: TEST_CERT)
260
260
  now = Time.now
261
261
  allow(Time).to receive_messages(now: now)
262
- expect(notification.to_binary).to eq "\x02\x00\x00\x00\x99\x01\x00 \xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\x02\x00a{\"aps\":{\"alert\":\"Don't panic Mr Mainwaring, don't panic!\",\"badge\":3,\"sound\":\"1.aiff\"},\"hi\":\"mom\"}\x03\x00\x04\x00\x00\x04\xD2\x04\x00\x04#{[now.to_i + 86_400].pack('N')}\x05\x00\x01\n"
262
+ expect(notification.to_binary).to eq "\x02\x00\x00\x00\xAF\x01\x00 \xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\x02\x00a{\"aps\":{\"alert\":\"Don't panic Mr Mainwaring, don't panic!\",\"badge\":3,\"sound\":\"1.aiff\"},\"hi\":\"mom\"}\x03\x00\x04\x00\x00\x04\xD2\x04\x00\x04#{[now.to_i + 86_400].pack('N')}\x05\x00\x01\n"
263
263
  end
264
264
  end if active_record?
265
265
 
@@ -281,7 +281,7 @@ end if active_record?
281
281
  describe Rpush::Client::ActiveRecord::Apns::Notification, "bug #35" do
282
282
  it "should limit payload size to 256 bytes but not the entire packet" do
283
283
  notification = Rpush::Client::ActiveRecord::Apns::Notification.new do |n|
284
- n.device_token = "a" * 64
284
+ n.device_token = "a" * 108
285
285
  n.alert = "a" * 210
286
286
  n.app = Rpush::Client::ActiveRecord::Apns::App.create!(name: 'my_app', environment: 'development', certificate: TEST_CERT)
287
287
  end
@@ -2,7 +2,7 @@ require "unit_spec_helper"
2
2
 
3
3
  describe Rpush::Daemon::Feeder do
4
4
  let!(:app) { Rpush::Apns::App.create!(name: 'my_app', environment: 'development', certificate: TEST_CERT) }
5
- let(:notification) { Rpush::Apns::Notification.create!(device_token: "a" * 64, app: app) }
5
+ let(:notification) { Rpush::Apns::Notification.create!(device_token: "a" * 108, app: app) }
6
6
  let(:logger) { double }
7
7
  let(:interruptible_sleeper) { double(sleep: nil, stop: nil) }
8
8
  let(:store) { double(Rpush::Daemon::Store::ActiveRecord, deliverable_notifications: [notification], release_connection: nil) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rpush
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Leitch
@@ -389,6 +389,7 @@ files:
389
389
  - lib/generators/templates/rpush_3_2_0_add_apns_p8.rb
390
390
  - lib/generators/templates/rpush_3_2_4_updates.rb
391
391
  - lib/generators/templates/rpush_3_3_0_updates.rb
392
+ - lib/generators/templates/rpush_3_3_1_updates.rb
392
393
  - lib/rpush.rb
393
394
  - lib/rpush/apns_feedback.rb
394
395
  - lib/rpush/cli.rb