rpush 7.0.1 → 9.0.0

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.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +34 -4
  3. data/README.md +24 -44
  4. data/lib/generators/rpush_migration_generator.rb +1 -0
  5. data/lib/generators/templates/rpush.rb +23 -13
  6. data/lib/generators/templates/rpush_7_1_0_updates.rb +12 -0
  7. data/lib/rpush/client/active_model/apns/notification.rb +0 -4
  8. data/lib/rpush/client/active_model/{gcm → fcm}/app.rb +4 -3
  9. data/lib/rpush/client/active_model/{gcm → fcm}/expiry_collapse_key_mutual_inclusion_validator.rb +1 -1
  10. data/lib/rpush/client/active_model/fcm/notification.rb +129 -0
  11. data/lib/rpush/client/active_model/fcm/notification_keys_in_allowed_list_validator.rb +20 -0
  12. data/lib/rpush/client/active_model.rb +4 -3
  13. data/lib/rpush/client/active_record/{gcm → fcm}/app.rb +2 -2
  14. data/lib/rpush/client/active_record/{gcm → fcm}/notification.rb +2 -2
  15. data/lib/rpush/client/active_record.rb +2 -2
  16. data/lib/rpush/client/redis/app.rb +2 -0
  17. data/lib/rpush/client/redis/{gcm → fcm}/app.rb +2 -2
  18. data/lib/rpush/client/redis/{gcm → fcm}/notification.rb +2 -2
  19. data/lib/rpush/client/redis.rb +2 -2
  20. data/lib/rpush/configuration.rb +2 -19
  21. data/lib/rpush/daemon/apns2/delivery.rb +0 -1
  22. data/lib/rpush/daemon/apnsp8/delivery.rb +0 -1
  23. data/lib/rpush/daemon/fcm/delivery.rb +162 -0
  24. data/lib/rpush/daemon/{gcm.rb → fcm.rb} +1 -1
  25. data/lib/rpush/daemon/google_credential_cache.rb +41 -0
  26. data/lib/rpush/daemon/service_config_methods.rb +0 -2
  27. data/lib/rpush/daemon/store/active_record.rb +15 -12
  28. data/lib/rpush/daemon/store/interface.rb +3 -3
  29. data/lib/rpush/daemon/store/redis.rb +13 -9
  30. data/lib/rpush/daemon/webpush/delivery.rb +2 -2
  31. data/lib/rpush/daemon.rb +3 -9
  32. data/lib/rpush/reflection_collection.rb +3 -3
  33. data/lib/rpush/version.rb +2 -2
  34. data/lib/rpush.rb +1 -1
  35. data/spec/functional/apns2_spec.rb +2 -6
  36. data/spec/functional/cli_spec.rb +41 -15
  37. data/spec/functional/embed_spec.rb +57 -26
  38. data/spec/functional/{gcm_priority_spec.rb → fcm_priority_spec.rb} +13 -7
  39. data/spec/functional/fcm_spec.rb +77 -0
  40. data/spec/functional/retry_spec.rb +21 -4
  41. data/spec/functional/synchronization_spec.rb +1 -1
  42. data/spec/functional_spec_helper.rb +1 -7
  43. data/spec/spec_helper.rb +4 -1
  44. data/spec/support/active_record_setup.rb +3 -1
  45. data/spec/unit/client/active_record/{gcm → fcm}/app_spec.rb +2 -2
  46. data/spec/unit/client/active_record/fcm/notification_spec.rb +10 -0
  47. data/spec/unit/client/active_record/shared/app.rb +1 -1
  48. data/spec/unit/client/redis/fcm/app_spec.rb +5 -0
  49. data/spec/unit/client/redis/fcm/notification_spec.rb +5 -0
  50. data/spec/unit/client/shared/apns/notification.rb +0 -15
  51. data/spec/unit/client/shared/fcm/app.rb +4 -0
  52. data/spec/unit/client/shared/fcm/notification.rb +92 -0
  53. data/spec/unit/configuration_spec.rb +1 -1
  54. data/spec/unit/daemon/apnsp8/delivery_spec.rb +1 -1
  55. data/spec/unit/daemon/fcm/delivery_spec.rb +127 -0
  56. data/spec/unit/daemon/service_config_methods_spec.rb +1 -1
  57. data/spec/unit/daemon/shared/store.rb +0 -42
  58. data/spec/unit/daemon/wns/delivery_spec.rb +1 -1
  59. data/spec/unit/logger_spec.rb +1 -1
  60. data/spec/unit_spec_helper.rb +1 -1
  61. metadata +127 -69
  62. data/lib/rpush/apns_feedback.rb +0 -18
  63. data/lib/rpush/client/active_model/gcm/notification.rb +0 -62
  64. data/lib/rpush/daemon/apns/delivery.rb +0 -43
  65. data/lib/rpush/daemon/apns/feedback_receiver.rb +0 -91
  66. data/lib/rpush/daemon/apns.rb +0 -17
  67. data/lib/rpush/daemon/dispatcher/apns_tcp.rb +0 -152
  68. data/lib/rpush/daemon/dispatcher/tcp.rb +0 -22
  69. data/lib/rpush/daemon/gcm/delivery.rb +0 -241
  70. data/lib/rpush/daemon/tcp_connection.rb +0 -190
  71. data/spec/functional/apns_spec.rb +0 -162
  72. data/spec/functional/gcm_spec.rb +0 -46
  73. data/spec/functional/new_app_spec.rb +0 -44
  74. data/spec/unit/apns_feedback_spec.rb +0 -39
  75. data/spec/unit/client/active_record/gcm/notification_spec.rb +0 -14
  76. data/spec/unit/client/redis/gcm/app_spec.rb +0 -5
  77. data/spec/unit/client/redis/gcm/notification_spec.rb +0 -5
  78. data/spec/unit/client/shared/gcm/app.rb +0 -4
  79. data/spec/unit/client/shared/gcm/notification.rb +0 -77
  80. data/spec/unit/daemon/apns/delivery_spec.rb +0 -108
  81. data/spec/unit/daemon/apns/feedback_receiver_spec.rb +0 -137
  82. data/spec/unit/daemon/dispatcher/tcp_spec.rb +0 -32
  83. data/spec/unit/daemon/gcm/delivery_spec.rb +0 -387
  84. data/spec/unit/daemon/tcp_connection_spec.rb +0 -292
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rpush
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.1
4
+ version: 9.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Leitch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-02 00:00:00.000000000 Z
11
+ date: 2024-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -78,14 +78,20 @@ dependencies:
78
78
  requirements:
79
79
  - - ">="
80
80
  - !ruby/object:Gem::Version
81
- version: '5.2'
81
+ version: '6.0'
82
+ - - "<"
83
+ - !ruby/object:Gem::Version
84
+ version: 7.1.0
82
85
  type: :runtime
83
86
  prerelease: false
84
87
  version_requirements: !ruby/object:Gem::Requirement
85
88
  requirements:
86
89
  - - ">="
87
90
  - !ruby/object:Gem::Version
88
- version: '5.2'
91
+ version: '6.0'
92
+ - - "<"
93
+ - !ruby/object:Gem::Version
94
+ version: 7.1.0
89
95
  - !ruby/object:Gem::Dependency
90
96
  name: thor
91
97
  requirement: !ruby/object:Gem::Requirement
@@ -135,19 +141,47 @@ dependencies:
135
141
  - !ruby/object:Gem::Version
136
142
  version: '0'
137
143
  - !ruby/object:Gem::Dependency
138
- name: webpush
144
+ name: web-push
139
145
  requirement: !ruby/object:Gem::Requirement
140
146
  requirements:
141
- - - "~>"
147
+ - - ">="
142
148
  - !ruby/object:Gem::Version
143
- version: '1.0'
149
+ version: '0'
144
150
  type: :runtime
145
151
  prerelease: false
146
152
  version_requirements: !ruby/object:Gem::Requirement
147
153
  requirements:
148
- - - "~>"
154
+ - - ">="
149
155
  - !ruby/object:Gem::Version
150
- version: '1.0'
156
+ version: '0'
157
+ - !ruby/object:Gem::Dependency
158
+ name: googleauth
159
+ requirement: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ version: '0'
164
+ type: :runtime
165
+ prerelease: false
166
+ version_requirements: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - ">="
169
+ - !ruby/object:Gem::Version
170
+ version: '0'
171
+ - !ruby/object:Gem::Dependency
172
+ name: debug
173
+ requirement: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - ">="
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
178
+ type: :development
179
+ prerelease: false
180
+ version_requirements: !ruby/object:Gem::Requirement
181
+ requirements:
182
+ - - ">="
183
+ - !ruby/object:Gem::Version
184
+ version: '0'
151
185
  - !ruby/object:Gem::Dependency
152
186
  name: rake
153
187
  requirement: !ruby/object:Gem::Requirement
@@ -166,16 +200,16 @@ dependencies:
166
200
  name: rspec
167
201
  requirement: !ruby/object:Gem::Requirement
168
202
  requirements:
169
- - - "~>"
203
+ - - ">="
170
204
  - !ruby/object:Gem::Version
171
- version: 3.4.0
205
+ version: '0'
172
206
  type: :development
173
207
  prerelease: false
174
208
  version_requirements: !ruby/object:Gem::Requirement
175
209
  requirements:
176
- - - "~>"
210
+ - - ">="
177
211
  - !ruby/object:Gem::Version
178
- version: 3.4.0
212
+ version: '0'
179
213
  - !ruby/object:Gem::Dependency
180
214
  name: database_cleaner
181
215
  requirement: !ruby/object:Gem::Requirement
@@ -264,16 +298,16 @@ dependencies:
264
298
  name: codeclimate-test-reporter
265
299
  requirement: !ruby/object:Gem::Requirement
266
300
  requirements:
267
- - - ">="
301
+ - - '='
268
302
  - !ruby/object:Gem::Version
269
- version: '0'
303
+ version: 1.0.7
270
304
  type: :development
271
305
  prerelease: false
272
306
  version_requirements: !ruby/object:Gem::Requirement
273
307
  requirements:
274
- - - ">="
308
+ - - '='
275
309
  - !ruby/object:Gem::Version
276
- version: '0'
310
+ version: 1.0.7
277
311
  - !ruby/object:Gem::Dependency
278
312
  name: simplecov
279
313
  requirement: !ruby/object:Gem::Requirement
@@ -294,14 +328,14 @@ dependencies:
294
328
  requirements:
295
329
  - - "~>"
296
330
  - !ruby/object:Gem::Version
297
- version: 1.12.0
331
+ version: '1.66'
298
332
  type: :development
299
333
  prerelease: false
300
334
  version_requirements: !ruby/object:Gem::Requirement
301
335
  requirements:
302
336
  - - "~>"
303
337
  - !ruby/object:Gem::Version
304
- version: 1.12.0
338
+ version: '1.66'
305
339
  - !ruby/object:Gem::Dependency
306
340
  name: rubocop-performance
307
341
  requirement: !ruby/object:Gem::Requirement
@@ -316,6 +350,48 @@ dependencies:
316
350
  - - ">="
317
351
  - !ruby/object:Gem::Version
318
352
  version: '0'
353
+ - !ruby/object:Gem::Dependency
354
+ name: rubocop-rake
355
+ requirement: !ruby/object:Gem::Requirement
356
+ requirements:
357
+ - - ">="
358
+ - !ruby/object:Gem::Version
359
+ version: '0'
360
+ type: :development
361
+ prerelease: false
362
+ version_requirements: !ruby/object:Gem::Requirement
363
+ requirements:
364
+ - - ">="
365
+ - !ruby/object:Gem::Version
366
+ version: '0'
367
+ - !ruby/object:Gem::Dependency
368
+ name: rubocop-rspec
369
+ requirement: !ruby/object:Gem::Requirement
370
+ requirements:
371
+ - - ">="
372
+ - !ruby/object:Gem::Version
373
+ version: '0'
374
+ type: :development
375
+ prerelease: false
376
+ version_requirements: !ruby/object:Gem::Requirement
377
+ requirements:
378
+ - - ">="
379
+ - !ruby/object:Gem::Version
380
+ version: '0'
381
+ - !ruby/object:Gem::Dependency
382
+ name: rubocop-rails
383
+ requirement: !ruby/object:Gem::Requirement
384
+ requirements:
385
+ - - ">="
386
+ - !ruby/object:Gem::Version
387
+ version: '0'
388
+ type: :development
389
+ prerelease: false
390
+ version_requirements: !ruby/object:Gem::Requirement
391
+ requirements:
392
+ - - ">="
393
+ - !ruby/object:Gem::Version
394
+ version: '0'
319
395
  - !ruby/object:Gem::Dependency
320
396
  name: byebug
321
397
  requirement: !ruby/object:Gem::Requirement
@@ -413,8 +489,8 @@ files:
413
489
  - lib/generators/templates/rpush_4_1_0_updates.rb
414
490
  - lib/generators/templates/rpush_4_1_1_updates.rb
415
491
  - lib/generators/templates/rpush_4_2_0_updates.rb
492
+ - lib/generators/templates/rpush_7_1_0_updates.rb
416
493
  - lib/rpush.rb
417
- - lib/rpush/apns_feedback.rb
418
494
  - lib/rpush/cli.rb
419
495
  - lib/rpush/client/active_model.rb
420
496
  - lib/rpush/client/active_model/adm/app.rb
@@ -429,9 +505,10 @@ files:
429
505
  - lib/rpush/client/active_model/apnsp8/app.rb
430
506
  - lib/rpush/client/active_model/apnsp8/notification.rb
431
507
  - lib/rpush/client/active_model/certificate_private_key_validator.rb
432
- - lib/rpush/client/active_model/gcm/app.rb
433
- - lib/rpush/client/active_model/gcm/expiry_collapse_key_mutual_inclusion_validator.rb
434
- - lib/rpush/client/active_model/gcm/notification.rb
508
+ - lib/rpush/client/active_model/fcm/app.rb
509
+ - lib/rpush/client/active_model/fcm/expiry_collapse_key_mutual_inclusion_validator.rb
510
+ - lib/rpush/client/active_model/fcm/notification.rb
511
+ - lib/rpush/client/active_model/fcm/notification_keys_in_allowed_list_validator.rb
435
512
  - lib/rpush/client/active_model/notification.rb
436
513
  - lib/rpush/client/active_model/payload_data_size_validator.rb
437
514
  - lib/rpush/client/active_model/pushy/app.rb
@@ -456,8 +533,8 @@ files:
456
533
  - lib/rpush/client/active_record/apnsp8/app.rb
457
534
  - lib/rpush/client/active_record/apnsp8/notification.rb
458
535
  - lib/rpush/client/active_record/app.rb
459
- - lib/rpush/client/active_record/gcm/app.rb
460
- - lib/rpush/client/active_record/gcm/notification.rb
536
+ - lib/rpush/client/active_record/fcm/app.rb
537
+ - lib/rpush/client/active_record/fcm/notification.rb
461
538
  - lib/rpush/client/active_record/notification.rb
462
539
  - lib/rpush/client/active_record/pushy/app.rb
463
540
  - lib/rpush/client/active_record/pushy/notification.rb
@@ -480,8 +557,8 @@ files:
480
557
  - lib/rpush/client/redis/apnsp8/app.rb
481
558
  - lib/rpush/client/redis/apnsp8/notification.rb
482
559
  - lib/rpush/client/redis/app.rb
483
- - lib/rpush/client/redis/gcm/app.rb
484
- - lib/rpush/client/redis/gcm/notification.rb
560
+ - lib/rpush/client/redis/fcm/app.rb
561
+ - lib/rpush/client/redis/fcm/notification.rb
485
562
  - lib/rpush/client/redis/notification.rb
486
563
  - lib/rpush/client/redis/pushy/app.rb
487
564
  - lib/rpush/client/redis/pushy/notification.rb
@@ -497,9 +574,6 @@ files:
497
574
  - lib/rpush/daemon.rb
498
575
  - lib/rpush/daemon/adm.rb
499
576
  - lib/rpush/daemon/adm/delivery.rb
500
- - lib/rpush/daemon/apns.rb
501
- - lib/rpush/daemon/apns/delivery.rb
502
- - lib/rpush/daemon/apns/feedback_receiver.rb
503
577
  - lib/rpush/daemon/apns2.rb
504
578
  - lib/rpush/daemon/apns2/delivery.rb
505
579
  - lib/rpush/daemon/apnsp8.rb
@@ -511,15 +585,14 @@ files:
511
585
  - lib/rpush/daemon/delivery.rb
512
586
  - lib/rpush/daemon/delivery_error.rb
513
587
  - lib/rpush/daemon/dispatcher/apns_http2.rb
514
- - lib/rpush/daemon/dispatcher/apns_tcp.rb
515
588
  - lib/rpush/daemon/dispatcher/apnsp8_http2.rb
516
589
  - lib/rpush/daemon/dispatcher/http.rb
517
- - lib/rpush/daemon/dispatcher/tcp.rb
518
590
  - lib/rpush/daemon/dispatcher_loop.rb
519
591
  - lib/rpush/daemon/errors.rb
592
+ - lib/rpush/daemon/fcm.rb
593
+ - lib/rpush/daemon/fcm/delivery.rb
520
594
  - lib/rpush/daemon/feeder.rb
521
- - lib/rpush/daemon/gcm.rb
522
- - lib/rpush/daemon/gcm/delivery.rb
595
+ - lib/rpush/daemon/google_credential_cache.rb
523
596
  - lib/rpush/daemon/interruptible_sleep.rb
524
597
  - lib/rpush/daemon/loggable.rb
525
598
  - lib/rpush/daemon/proc_title.rb
@@ -540,7 +613,6 @@ files:
540
613
  - lib/rpush/daemon/store/redis.rb
541
614
  - lib/rpush/daemon/string_helpers.rb
542
615
  - lib/rpush/daemon/synchronizer.rb
543
- - lib/rpush/daemon/tcp_connection.rb
544
616
  - lib/rpush/daemon/webpush.rb
545
617
  - lib/rpush/daemon/webpush/delivery.rb
546
618
  - lib/rpush/daemon/wns.rb
@@ -566,12 +638,10 @@ files:
566
638
  - spec/.rubocop.yml
567
639
  - spec/functional/adm_spec.rb
568
640
  - spec/functional/apns2_spec.rb
569
- - spec/functional/apns_spec.rb
570
641
  - spec/functional/cli_spec.rb
571
642
  - spec/functional/embed_spec.rb
572
- - spec/functional/gcm_priority_spec.rb
573
- - spec/functional/gcm_spec.rb
574
- - spec/functional/new_app_spec.rb
643
+ - spec/functional/fcm_priority_spec.rb
644
+ - spec/functional/fcm_spec.rb
575
645
  - spec/functional/pushy_spec.rb
576
646
  - spec/functional/retry_spec.rb
577
647
  - spec/functional/synchronization_spec.rb
@@ -586,7 +656,6 @@ files:
586
656
  - spec/support/simplecov_helper.rb
587
657
  - spec/support/simplecov_quality_formatter.rb
588
658
  - spec/tmp/.gitkeep
589
- - spec/unit/apns_feedback_spec.rb
590
659
  - spec/unit/client/active_record/adm/app_spec.rb
591
660
  - spec/unit/client/active_record/adm/notification_spec.rb
592
661
  - spec/unit/client/active_record/apns/app_spec.rb
@@ -596,8 +665,8 @@ files:
596
665
  - spec/unit/client/active_record/apns2/notification_spec.rb
597
666
  - spec/unit/client/active_record/apnsp8/notification_spec.rb
598
667
  - spec/unit/client/active_record/app_spec.rb
599
- - spec/unit/client/active_record/gcm/app_spec.rb
600
- - spec/unit/client/active_record/gcm/notification_spec.rb
668
+ - spec/unit/client/active_record/fcm/app_spec.rb
669
+ - spec/unit/client/active_record/fcm/notification_spec.rb
601
670
  - spec/unit/client/active_record/notification_spec.rb
602
671
  - spec/unit/client/active_record/pushy/app_spec.rb
603
672
  - spec/unit/client/active_record/pushy/notification_spec.rb
@@ -618,8 +687,8 @@ files:
618
687
  - spec/unit/client/redis/apns2/notification_spec.rb
619
688
  - spec/unit/client/redis/apnsp8/notification_spec.rb
620
689
  - spec/unit/client/redis/app_spec.rb
621
- - spec/unit/client/redis/gcm/app_spec.rb
622
- - spec/unit/client/redis/gcm/notification_spec.rb
690
+ - spec/unit/client/redis/fcm/app_spec.rb
691
+ - spec/unit/client/redis/fcm/notification_spec.rb
623
692
  - spec/unit/client/redis/notification_spec.rb
624
693
  - spec/unit/client/redis/pushy/app_spec.rb
625
694
  - spec/unit/client/redis/pushy/notification_spec.rb
@@ -635,8 +704,8 @@ files:
635
704
  - spec/unit/client/shared/apns/feedback.rb
636
705
  - spec/unit/client/shared/apns/notification.rb
637
706
  - spec/unit/client/shared/app.rb
638
- - spec/unit/client/shared/gcm/app.rb
639
- - spec/unit/client/shared/gcm/notification.rb
707
+ - spec/unit/client/shared/fcm/app.rb
708
+ - spec/unit/client/shared/fcm/notification.rb
640
709
  - spec/unit/client/shared/notification.rb
641
710
  - spec/unit/client/shared/pushy/app.rb
642
711
  - spec/unit/client/shared/pushy/notification.rb
@@ -649,18 +718,15 @@ files:
649
718
  - spec/unit/configuration_spec.rb
650
719
  - spec/unit/daemon/adm/delivery_spec.rb
651
720
  - spec/unit/daemon/apns/certificate_expired_error_spec.rb
652
- - spec/unit/daemon/apns/delivery_spec.rb
653
- - spec/unit/daemon/apns/feedback_receiver_spec.rb
654
721
  - spec/unit/daemon/apnsp8/delivery_spec.rb
655
722
  - spec/unit/daemon/app_runner_spec.rb
656
723
  - spec/unit/daemon/batch_spec.rb
657
724
  - spec/unit/daemon/delivery_error_spec.rb
658
725
  - spec/unit/daemon/delivery_spec.rb
659
726
  - spec/unit/daemon/dispatcher/http_spec.rb
660
- - spec/unit/daemon/dispatcher/tcp_spec.rb
661
727
  - spec/unit/daemon/dispatcher_loop_spec.rb
728
+ - spec/unit/daemon/fcm/delivery_spec.rb
662
729
  - spec/unit/daemon/feeder_spec.rb
663
- - spec/unit/daemon/gcm/delivery_spec.rb
664
730
  - spec/unit/daemon/proc_title_spec.rb
665
731
  - spec/unit/daemon/pushy/delivery_spec.rb
666
732
  - spec/unit/daemon/retryable_error_spec.rb
@@ -670,7 +736,6 @@ files:
670
736
  - spec/unit/daemon/store/active_record/reconnectable_spec.rb
671
737
  - spec/unit/daemon/store/active_record_spec.rb
672
738
  - spec/unit/daemon/store/redis_spec.rb
673
- - spec/unit/daemon/tcp_connection_spec.rb
674
739
  - spec/unit/daemon/webpush/delivery_spec.rb
675
740
  - spec/unit/daemon/wns/delivery_spec.rb
676
741
  - spec/unit/daemon/wns/post_request_spec.rb
@@ -706,14 +771,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
706
771
  requirements:
707
772
  - - ">="
708
773
  - !ruby/object:Gem::Version
709
- version: 2.4.0
774
+ version: 3.0.0
710
775
  required_rubygems_version: !ruby/object:Gem::Requirement
711
776
  requirements:
712
777
  - - ">="
713
778
  - !ruby/object:Gem::Version
714
779
  version: '0'
715
780
  requirements: []
716
- rubygems_version: 3.3.5
781
+ rubygems_version: 3.3.3
717
782
  signing_key:
718
783
  specification_version: 4
719
784
  summary: The push notification service for Ruby.
@@ -721,12 +786,10 @@ test_files:
721
786
  - spec/.rubocop.yml
722
787
  - spec/functional/adm_spec.rb
723
788
  - spec/functional/apns2_spec.rb
724
- - spec/functional/apns_spec.rb
725
789
  - spec/functional/cli_spec.rb
726
790
  - spec/functional/embed_spec.rb
727
- - spec/functional/gcm_priority_spec.rb
728
- - spec/functional/gcm_spec.rb
729
- - spec/functional/new_app_spec.rb
791
+ - spec/functional/fcm_priority_spec.rb
792
+ - spec/functional/fcm_spec.rb
730
793
  - spec/functional/pushy_spec.rb
731
794
  - spec/functional/retry_spec.rb
732
795
  - spec/functional/synchronization_spec.rb
@@ -741,7 +804,6 @@ test_files:
741
804
  - spec/support/simplecov_helper.rb
742
805
  - spec/support/simplecov_quality_formatter.rb
743
806
  - spec/tmp/.gitkeep
744
- - spec/unit/apns_feedback_spec.rb
745
807
  - spec/unit/client/active_record/adm/app_spec.rb
746
808
  - spec/unit/client/active_record/adm/notification_spec.rb
747
809
  - spec/unit/client/active_record/apns/app_spec.rb
@@ -751,8 +813,8 @@ test_files:
751
813
  - spec/unit/client/active_record/apns2/notification_spec.rb
752
814
  - spec/unit/client/active_record/apnsp8/notification_spec.rb
753
815
  - spec/unit/client/active_record/app_spec.rb
754
- - spec/unit/client/active_record/gcm/app_spec.rb
755
- - spec/unit/client/active_record/gcm/notification_spec.rb
816
+ - spec/unit/client/active_record/fcm/app_spec.rb
817
+ - spec/unit/client/active_record/fcm/notification_spec.rb
756
818
  - spec/unit/client/active_record/notification_spec.rb
757
819
  - spec/unit/client/active_record/pushy/app_spec.rb
758
820
  - spec/unit/client/active_record/pushy/notification_spec.rb
@@ -773,8 +835,8 @@ test_files:
773
835
  - spec/unit/client/redis/apns2/notification_spec.rb
774
836
  - spec/unit/client/redis/apnsp8/notification_spec.rb
775
837
  - spec/unit/client/redis/app_spec.rb
776
- - spec/unit/client/redis/gcm/app_spec.rb
777
- - spec/unit/client/redis/gcm/notification_spec.rb
838
+ - spec/unit/client/redis/fcm/app_spec.rb
839
+ - spec/unit/client/redis/fcm/notification_spec.rb
778
840
  - spec/unit/client/redis/notification_spec.rb
779
841
  - spec/unit/client/redis/pushy/app_spec.rb
780
842
  - spec/unit/client/redis/pushy/notification_spec.rb
@@ -790,8 +852,8 @@ test_files:
790
852
  - spec/unit/client/shared/apns/feedback.rb
791
853
  - spec/unit/client/shared/apns/notification.rb
792
854
  - spec/unit/client/shared/app.rb
793
- - spec/unit/client/shared/gcm/app.rb
794
- - spec/unit/client/shared/gcm/notification.rb
855
+ - spec/unit/client/shared/fcm/app.rb
856
+ - spec/unit/client/shared/fcm/notification.rb
795
857
  - spec/unit/client/shared/notification.rb
796
858
  - spec/unit/client/shared/pushy/app.rb
797
859
  - spec/unit/client/shared/pushy/notification.rb
@@ -804,18 +866,15 @@ test_files:
804
866
  - spec/unit/configuration_spec.rb
805
867
  - spec/unit/daemon/adm/delivery_spec.rb
806
868
  - spec/unit/daemon/apns/certificate_expired_error_spec.rb
807
- - spec/unit/daemon/apns/delivery_spec.rb
808
- - spec/unit/daemon/apns/feedback_receiver_spec.rb
809
869
  - spec/unit/daemon/apnsp8/delivery_spec.rb
810
870
  - spec/unit/daemon/app_runner_spec.rb
811
871
  - spec/unit/daemon/batch_spec.rb
812
872
  - spec/unit/daemon/delivery_error_spec.rb
813
873
  - spec/unit/daemon/delivery_spec.rb
814
874
  - spec/unit/daemon/dispatcher/http_spec.rb
815
- - spec/unit/daemon/dispatcher/tcp_spec.rb
816
875
  - spec/unit/daemon/dispatcher_loop_spec.rb
876
+ - spec/unit/daemon/fcm/delivery_spec.rb
817
877
  - spec/unit/daemon/feeder_spec.rb
818
- - spec/unit/daemon/gcm/delivery_spec.rb
819
878
  - spec/unit/daemon/proc_title_spec.rb
820
879
  - spec/unit/daemon/pushy/delivery_spec.rb
821
880
  - spec/unit/daemon/retryable_error_spec.rb
@@ -825,7 +884,6 @@ test_files:
825
884
  - spec/unit/daemon/store/active_record/reconnectable_spec.rb
826
885
  - spec/unit/daemon/store/active_record_spec.rb
827
886
  - spec/unit/daemon/store/redis_spec.rb
828
- - spec/unit/daemon/tcp_connection_spec.rb
829
887
  - spec/unit/daemon/webpush/delivery_spec.rb
830
888
  - spec/unit/daemon/wns/delivery_spec.rb
831
889
  - spec/unit/daemon/wns/post_request_spec.rb
@@ -1,18 +0,0 @@
1
- module Rpush
2
- def self.apns_feedback
3
- require 'rpush/daemon'
4
- Rpush::Daemon.common_init
5
-
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
- next unless app.feedback_enabled
11
-
12
- receiver = Rpush::Daemon::Apns::FeedbackReceiver.new(app)
13
- receiver.check_for_feedback
14
- end
15
-
16
- nil
17
- end
18
- end
@@ -1,62 +0,0 @@
1
- module Rpush
2
- module Client
3
- module ActiveModel
4
- module Gcm
5
- module Notification
6
- GCM_PRIORITY_HIGH = Rpush::Client::ActiveModel::Apns::Notification::APNS_PRIORITY_IMMEDIATE
7
- GCM_PRIORITY_NORMAL = Rpush::Client::ActiveModel::Apns::Notification::APNS_PRIORITY_CONSERVE_POWER
8
- GCM_PRIORITIES = [GCM_PRIORITY_HIGH, GCM_PRIORITY_NORMAL]
9
-
10
- def self.included(base)
11
- base.instance_eval do
12
- validates :registration_ids, presence: true
13
- validates :priority, inclusion: { in: GCM_PRIORITIES }, allow_nil: true
14
- validates :dry_run, inclusion: { in: [true, false] }
15
-
16
- validates_with Rpush::Client::ActiveModel::PayloadDataSizeValidator, limit: 4096
17
- validates_with Rpush::Client::ActiveModel::RegistrationIdsCountValidator, limit: 1000
18
-
19
- validates_with Rpush::Client::ActiveModel::Gcm::ExpiryCollapseKeyMutualInclusionValidator
20
- end
21
- end
22
-
23
- # This is a hack. The schema defines `priority` to be an integer, but GCM expects a string.
24
- # But for users of rpush to have an API they might expect (setting priority to `high`, not 10)
25
- # we do a little conversion here.
26
- # I'm not happy about it, but this will have to do until I can take a further look.
27
- def priority=(priority)
28
- case priority
29
- when 'high', GCM_PRIORITY_HIGH
30
- super(GCM_PRIORITY_HIGH)
31
- when 'normal', GCM_PRIORITY_NORMAL
32
- super(GCM_PRIORITY_NORMAL)
33
- else
34
- errors.add(:priority, 'must be one of either "normal" or "high"')
35
- end
36
- end
37
-
38
- def as_json(options = nil) # rubocop:disable Metrics/PerceivedComplexity
39
- json = {
40
- 'registration_ids' => registration_ids,
41
- 'delay_while_idle' => delay_while_idle,
42
- 'data' => data
43
- }
44
- json['collapse_key'] = collapse_key if collapse_key
45
- json['content_available'] = content_available if content_available
46
- json['mutable_content'] = mutable_content if mutable_content
47
- json['dry_run'] = dry_run if dry_run
48
- json['notification'] = notification if notification
49
- json['priority'] = priority_for_notification if priority
50
- json['time_to_live'] = expiry if expiry
51
- json
52
- end
53
-
54
- def priority_for_notification
55
- return 'high' if priority == GCM_PRIORITY_HIGH
56
- 'normal' if priority == GCM_PRIORITY_NORMAL
57
- end
58
- end
59
- end
60
- end
61
- end
62
- end
@@ -1,43 +0,0 @@
1
- module Rpush
2
- module Daemon
3
- module Apns
4
- class Delivery < Rpush::Daemon::Delivery
5
- def initialize(app, connection, batch)
6
- @app = app
7
- @connection = connection
8
- @batch = batch
9
- end
10
-
11
- def perform
12
- @connection.write(batch_to_binary)
13
- mark_batch_delivered
14
- describe_deliveries
15
- rescue Rpush::Daemon::TcpConnectionError => error
16
- mark_batch_retryable(Time.now + 10.seconds, error)
17
- raise
18
- rescue StandardError => error
19
- mark_batch_failed(error)
20
- raise
21
- ensure
22
- @batch.all_processed
23
- end
24
-
25
- protected
26
-
27
- def batch_to_binary
28
- payload = ""
29
- @batch.each_notification do |notification|
30
- payload << notification.to_binary
31
- end
32
- payload
33
- end
34
-
35
- def describe_deliveries
36
- @batch.each_notification do |notification|
37
- log_info("#{notification.id} sent to #{notification.device_token}")
38
- end
39
- end
40
- end
41
- end
42
- end
43
- end
@@ -1,91 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- module Rpush
4
- module Daemon
5
- module Apns
6
- class FeedbackReceiver
7
- include Reflectable
8
- include Loggable
9
-
10
- TUPLE_BYTES = 38
11
- HOSTS = {
12
- production: ['feedback.push.apple.com', 2196],
13
- development: ['feedback.sandbox.push.apple.com', 2196], # deprecated
14
- sandbox: ['feedback.sandbox.push.apple.com', 2196]
15
- }
16
-
17
- def initialize(app)
18
- @app = app
19
- @host, @port = HOSTS[@app.environment.to_sym]
20
- @certificate = app.certificate
21
- @password = app.password
22
- @interruptible_sleep = InterruptibleSleep.new
23
- end
24
-
25
- def start
26
- return if Rpush.config.push
27
- return unless @app.feedback_enabled
28
- Rpush.logger.info("[#{@app.name}] Starting feedback receiver... ", true)
29
-
30
- @thread = Thread.new do
31
- loop do
32
- break if @stop
33
- check_for_feedback
34
- @interruptible_sleep.sleep(Rpush.config.apns.feedback_receiver.frequency)
35
- end
36
-
37
- Rpush::Daemon.store.release_connection
38
- end
39
-
40
- puts Rainbow('✔').green if Rpush.config.foreground && Rpush.config.foreground_logging
41
- end
42
-
43
- def stop
44
- @stop = true
45
- @interruptible_sleep.stop
46
- @thread.join if @thread
47
- rescue StandardError => e
48
- log_error(e)
49
- reflect(:error, e)
50
- ensure
51
- @thread = nil
52
- end
53
-
54
- def check_for_feedback
55
- connection = nil
56
- begin
57
- connection = Rpush::Daemon::TcpConnection.new(@app, @host, @port)
58
- connection.connect
59
- tuple = connection.read(TUPLE_BYTES)
60
-
61
- while tuple
62
- timestamp, device_token = parse_tuple(tuple)
63
- create_feedback(timestamp, device_token)
64
- tuple = connection.read(TUPLE_BYTES)
65
- end
66
- rescue StandardError => e
67
- log_error(e)
68
- reflect(:error, e)
69
- ensure
70
- connection.close if connection
71
- end
72
- end
73
-
74
- protected
75
-
76
- def parse_tuple(tuple)
77
- failed_at, _, device_token = tuple.unpack("N1n1H*")
78
- [Time.at(failed_at).utc, device_token]
79
- end
80
-
81
- def create_feedback(failed_at, device_token)
82
- formatted_failed_at = failed_at.strftime('%Y-%m-%d %H:%M:%S UTC')
83
- log_info("[FeedbackReceiver] Delivery failed at #{formatted_failed_at} for #{device_token}.")
84
-
85
- feedback = Rpush::Daemon.store.create_apns_feedback(failed_at, device_token, @app)
86
- reflect(:apns_feedback, feedback)
87
- end
88
- end
89
- end
90
- end
91
- end