rpush 5.0.0 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +74 -2
- data/README.md +104 -18
- data/lib/generators/templates/add_adm.rb +1 -1
- data/lib/generators/templates/add_alert_is_json_to_rapns_notifications.rb +2 -2
- data/lib/generators/templates/add_app_to_rapns.rb +2 -2
- data/lib/generators/templates/add_fail_after_to_rpush_notifications.rb +1 -1
- data/lib/generators/templates/add_gcm.rb +11 -25
- data/lib/generators/templates/add_rpush.rb +33 -83
- data/lib/generators/templates/add_wpns.rb +1 -1
- data/lib/generators/templates/create_rapns_apps.rb +1 -1
- data/lib/generators/templates/create_rapns_feedback.rb +3 -9
- data/lib/generators/templates/create_rapns_notifications.rb +3 -9
- data/lib/generators/templates/rename_rapns_to_rpush.rb +9 -33
- data/lib/generators/templates/rpush.rb +4 -0
- data/lib/generators/templates/rpush_2_0_0_updates.rb +5 -17
- data/lib/generators/templates/rpush_2_1_0_updates.rb +1 -1
- data/lib/generators/templates/rpush_2_6_0_updates.rb +1 -1
- data/lib/generators/templates/rpush_2_7_0_updates.rb +1 -1
- data/lib/generators/templates/rpush_3_0_0_updates.rb +1 -1
- data/lib/generators/templates/rpush_3_0_1_updates.rb +1 -1
- data/lib/generators/templates/rpush_3_1_0_add_pushy.rb +1 -1
- data/lib/generators/templates/rpush_3_1_1_updates.rb +1 -1
- data/lib/generators/templates/rpush_3_2_0_add_apns_p8.rb +1 -1
- data/lib/generators/templates/rpush_3_2_4_updates.rb +1 -1
- data/lib/generators/templates/rpush_3_3_0_updates.rb +1 -1
- data/lib/generators/templates/rpush_3_3_1_updates.rb +3 -3
- data/lib/generators/templates/rpush_4_1_0_updates.rb +1 -1
- data/lib/generators/templates/rpush_4_1_1_updates.rb +1 -1
- data/lib/generators/templates/rpush_4_2_0_updates.rb +1 -1
- data/lib/rpush/cli.rb +1 -1
- data/lib/rpush/client/active_model.rb +5 -1
- data/lib/rpush/client/active_model/adm/data_validator.rb +1 -1
- data/lib/rpush/client/active_model/apns/app.rb +1 -17
- data/lib/rpush/client/active_model/apns/device_token_format_validator.rb +2 -2
- data/lib/rpush/client/active_model/apns/notification.rb +13 -1
- data/lib/rpush/client/active_model/apns/notification_payload_size_validator.rb +15 -0
- data/lib/rpush/client/active_model/apns2/app.rb +7 -1
- data/lib/rpush/client/active_model/apns2/notification.rb +14 -0
- data/lib/rpush/client/active_model/certificate_private_key_validator.rb +19 -0
- data/lib/rpush/client/active_model/gcm/expiry_collapse_key_mutual_inclusion_validator.rb +1 -1
- data/lib/rpush/client/active_model/payload_data_size_validator.rb +1 -1
- data/lib/rpush/client/active_model/registration_ids_count_validator.rb +1 -1
- data/lib/rpush/client/active_model/webpush/app.rb +41 -0
- data/lib/rpush/client/active_model/webpush/notification.rb +66 -0
- data/lib/rpush/client/active_record.rb +4 -0
- data/lib/rpush/client/active_record/apns/active_record_serializable_notification.rb +65 -0
- data/lib/rpush/client/active_record/apns/notification.rb +1 -57
- data/lib/rpush/client/active_record/apns2/notification.rb +4 -1
- data/lib/rpush/client/active_record/apnsp8/notification.rb +1 -0
- data/lib/rpush/client/active_record/webpush/app.rb +11 -0
- data/lib/rpush/client/active_record/webpush/notification.rb +12 -0
- data/lib/rpush/client/redis.rb +3 -0
- data/lib/rpush/client/redis/apns2/notification.rb +1 -0
- data/lib/rpush/client/redis/apnsp8/notification.rb +2 -0
- data/lib/rpush/client/redis/pushy/notification.rb +0 -1
- data/lib/rpush/client/redis/webpush/app.rb +15 -0
- data/lib/rpush/client/redis/webpush/notification.rb +15 -0
- data/lib/rpush/configuration.rb +3 -2
- data/lib/rpush/daemon.rb +4 -1
- data/lib/rpush/daemon/apns/feedback_receiver.rb +1 -1
- data/lib/rpush/daemon/apns2/delivery.rb +14 -2
- data/lib/rpush/daemon/apnsp8/delivery.rb +14 -3
- data/lib/rpush/daemon/app_runner.rb +1 -1
- data/lib/rpush/daemon/batch.rb +12 -5
- data/lib/rpush/daemon/delivery.rb +1 -2
- data/lib/rpush/daemon/store/active_record/reconnectable.rb +1 -1
- data/lib/rpush/daemon/string_helpers.rb +1 -1
- data/lib/rpush/daemon/webpush.rb +10 -0
- data/lib/rpush/daemon/webpush/delivery.rb +114 -0
- data/lib/rpush/logger.rb +1 -0
- data/lib/rpush/version.rb +1 -1
- data/spec/functional/apns2_spec.rb +99 -2
- data/spec/functional/retry_spec.rb +1 -1
- data/spec/functional/webpush_spec.rb +30 -0
- data/spec/spec_helper.rb +3 -1
- data/spec/support/active_record_setup.rb +4 -3
- data/spec/support/config/database.yml +4 -4
- data/spec/support/simplecov_helper.rb +2 -2
- data/spec/unit/client/active_record/adm/app_spec.rb +2 -54
- data/spec/unit/client/active_record/adm/notification_spec.rb +2 -39
- data/spec/unit/client/active_record/apns/app_spec.rb +3 -26
- data/spec/unit/client/active_record/apns/feedback_spec.rb +1 -5
- data/spec/unit/client/active_record/apns/notification_spec.rb +29 -293
- data/spec/unit/client/active_record/apns2/app_spec.rb +5 -0
- data/spec/unit/client/active_record/apns2/notification_spec.rb +65 -0
- data/spec/unit/client/active_record/apnsp8/notification_spec.rb +28 -0
- data/spec/unit/client/active_record/app_spec.rb +1 -26
- data/spec/unit/client/active_record/gcm/app_spec.rb +3 -1
- data/spec/unit/client/active_record/gcm/notification_spec.rb +6 -88
- data/spec/unit/client/active_record/notification_spec.rb +3 -11
- data/spec/unit/client/active_record/pushy/app_spec.rb +2 -13
- data/spec/unit/client/active_record/pushy/notification_spec.rb +2 -55
- data/spec/unit/client/active_record/shared/app.rb +14 -0
- data/spec/unit/{notification_shared.rb → client/active_record/shared/notification.rb} +12 -7
- data/spec/unit/client/active_record/webpush/app_spec.rb +6 -0
- data/spec/unit/client/active_record/webpush/notification_spec.rb +6 -0
- data/spec/unit/client/active_record/wns/badge_notification_spec.rb +1 -11
- data/spec/unit/client/active_record/wns/raw_notification_spec.rb +3 -12
- data/spec/unit/client/active_record/wpns/app_spec.rb +3 -1
- data/spec/unit/client/active_record/wpns/notification_spec.rb +2 -17
- data/spec/unit/client/redis/adm/app_spec.rb +5 -0
- data/spec/unit/client/redis/adm/notification_spec.rb +5 -0
- data/spec/unit/client/redis/apns/app_spec.rb +5 -0
- data/spec/unit/client/redis/apns/feedback_spec.rb +5 -0
- data/spec/unit/client/redis/apns/notification_spec.rb +50 -0
- data/spec/unit/client/redis/apns2/app_spec.rb +4 -0
- data/spec/unit/client/redis/apns2/notification_spec.rb +50 -0
- data/spec/unit/client/redis/apnsp8/notification_spec.rb +29 -0
- data/spec/unit/client/redis/app_spec.rb +5 -0
- data/spec/unit/client/redis/gcm/app_spec.rb +5 -0
- data/spec/unit/client/redis/gcm/notification_spec.rb +5 -0
- data/spec/unit/client/redis/notification_spec.rb +5 -0
- data/spec/unit/client/redis/pushy/app_spec.rb +5 -0
- data/spec/unit/client/redis/pushy/notification_spec.rb +5 -0
- data/spec/unit/client/redis/webpush/app_spec.rb +5 -0
- data/spec/unit/client/redis/webpush/notification_spec.rb +5 -0
- data/spec/unit/client/redis/wns/badge_notification_spec.rb +5 -0
- data/spec/unit/client/redis/wns/raw_notification_spec.rb +22 -0
- data/spec/unit/client/redis/wpns/app_spec.rb +5 -0
- data/spec/unit/client/redis/wpns/notification_spec.rb +5 -0
- data/spec/unit/client/shared/adm/app.rb +51 -0
- data/spec/unit/client/shared/adm/notification.rb +39 -0
- data/spec/unit/client/shared/apns/app.rb +29 -0
- data/spec/unit/client/shared/apns/feedback.rb +9 -0
- data/spec/unit/client/shared/apns/notification.rb +277 -0
- data/spec/unit/client/shared/app.rb +17 -0
- data/spec/unit/client/shared/gcm/app.rb +4 -0
- data/spec/unit/client/shared/gcm/notification.rb +77 -0
- data/spec/unit/client/shared/notification.rb +10 -0
- data/spec/unit/client/shared/pushy/app.rb +17 -0
- data/spec/unit/client/shared/pushy/notification.rb +55 -0
- data/spec/unit/client/shared/webpush/app.rb +33 -0
- data/spec/unit/client/shared/webpush/notification.rb +83 -0
- data/spec/unit/client/shared/wns/badge_notification.rb +15 -0
- data/spec/unit/client/shared/wns/raw_notification.rb +21 -0
- data/spec/unit/client/shared/wpns/app.rb +4 -0
- data/spec/unit/client/shared/wpns/notification.rb +18 -0
- data/spec/unit/daemon/apnsp8/delivery_spec.rb +53 -0
- data/spec/unit/daemon/batch_spec.rb +50 -2
- data/spec/unit/daemon/delivery_spec.rb +10 -0
- data/spec/unit/daemon/pushy/delivery_spec.rb +5 -3
- data/spec/unit/daemon/shared/store.rb +312 -0
- data/spec/unit/daemon/store/active_record/reconnectable_spec.rb +7 -7
- data/spec/unit/daemon/store/active_record_spec.rb +2 -290
- data/spec/unit/daemon/store/redis_spec.rb +2 -291
- data/spec/unit/daemon/webpush/delivery_spec.rb +144 -0
- data/spec/unit_spec_helper.rb +3 -0
- metadata +137 -13
- data/lib/rpush/client/active_model/apns/binary_notification_validator.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f8cbb341eafccf585f3967e5b1ef434a422f9a14175466060a978d2d4adbe4e
|
4
|
+
data.tar.gz: c8f767c447855b04a7e2d9e980a9408bdbafe11f6e84f711c0893122f2202cec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e6997a5008122ca85fed5a5f4eab96e0c6e585aa8fc4ab305c394608c10fb6bfdec2b79077e3098e137e173e65b0e7804038b5230013a51446d980ed2d6bb95
|
7
|
+
data.tar.gz: 5e6b265e5e034bebe78a30cdd4f2af63a08933777a58d86d1f8c6a73a2f4783fad7cba6f4b2181a08a79def81879594544979642dae8c3326de407205c6c4852
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,79 @@
|
|
2
2
|
|
3
3
|
## [Unreleased](https://github.com/rpush/rpush/tree/HEAD)
|
4
4
|
|
5
|
-
[Full Changelog](https://github.com/rpush/rpush/compare/
|
5
|
+
[Full Changelog](https://github.com/rpush/rpush/compare/v5.4.0...HEAD)
|
6
|
+
|
7
|
+
## [v6.0.0](https://github.com/rpush/rpush/tree/v6.0.0) (2021-05-21)
|
8
|
+
|
9
|
+
[Full Changelog](https://github.com/rpush/rpush/compare/v5.4.0...v6.0.0)
|
10
|
+
|
11
|
+
This release contains **breaking changes**, such as removing support for Rails versions older than 5.2.
|
12
|
+
Please see the details in the PRs below.
|
13
|
+
|
14
|
+
**Merged pull requests:**
|
15
|
+
|
16
|
+
- Switch to GitHub Actions for CI [\#615](https://github.com/rpush/rpush/pull/615) ([aried3r](https://github.com/aried3r))
|
17
|
+
- Prepare 6.0.0 release [\#613](https://github.com/rpush/rpush/pull/613) ([aried3r](https://github.com/aried3r))
|
18
|
+
- Bump activesupport version to 5.2 or later [\#610](https://github.com/rpush/rpush/pull/610) ([biow0lf](https://github.com/biow0lf))
|
19
|
+
- Fixed infinite loop issue with Apnsp8 delivery [\#608](https://github.com/rpush/rpush/pull/608) ([diminish7](https://github.com/diminish7))
|
20
|
+
- Eliminate deprecation warning in Ruby 3.0 [\#602](https://github.com/rpush/rpush/pull/602) ([rofreg](https://github.com/rofreg))
|
21
|
+
- Make ActiveRecord validations work with Apns2 client [\#601](https://github.com/rpush/rpush/pull/601) ([favrik](https://github.com/favrik))
|
22
|
+
- Bump gemspec post\_install\_message [\#600](https://github.com/rpush/rpush/pull/600) ([fdoxyz](https://github.com/fdoxyz))
|
23
|
+
- Remove references and checks for unsupported versions of Rails [\#599](https://github.com/rpush/rpush/pull/599) ([ericsaupe](https://github.com/ericsaupe))
|
24
|
+
- Drop support for Rails 5.0 and 5.1 [\#597](https://github.com/rpush/rpush/pull/597) ([ericsaupe](https://github.com/ericsaupe))
|
25
|
+
- Fix silent APNS notifications for Apns2 and Apnsp8 [\#596](https://github.com/rpush/rpush/pull/596) ([shved270189](https://github.com/shved270189))
|
26
|
+
- Updates README to Apple's new EOL date for the APNs legacy binary protocol [\#595](https://github.com/rpush/rpush/pull/595) ([gregblake](https://github.com/gregblake))
|
27
|
+
|
28
|
+
## [v5.4.0](https://github.com/rpush/rpush/tree/v5.4.0) (2021-02-15)
|
29
|
+
|
30
|
+
[Full Changelog](https://github.com/rpush/rpush/compare/v5.3.0...v5.4.0)
|
31
|
+
|
32
|
+
**Merged pull requests:**
|
33
|
+
|
34
|
+
- fix typo in README.md [\#587](https://github.com/rpush/rpush/pull/587) ([yltsrc](https://github.com/yltsrc))
|
35
|
+
- Support Ruby 3.0 & Rails 6.1 [\#586](https://github.com/rpush/rpush/pull/586) ([andreaslillebo](https://github.com/andreaslillebo))
|
36
|
+
|
37
|
+
## [v5.3.0](https://github.com/rpush/rpush/tree/v5.3.0) (2021-01-07)
|
38
|
+
|
39
|
+
[Full Changelog](https://github.com/rpush/rpush/compare/v5.2.0...v5.3.0)
|
40
|
+
|
41
|
+
**Implemented enhancements:**
|
42
|
+
|
43
|
+
- support for Webpush with VAPID [\#574](https://github.com/rpush/rpush/pull/574) ([jkraemer](https://github.com/jkraemer))
|
44
|
+
|
45
|
+
**Merged pull requests:**
|
46
|
+
|
47
|
+
- Bug fix: APNS P8 Notifications Are Marked as Invalid When the Payload Exceeds 2kb \(2048 bytes\) [\#583](https://github.com/rpush/rpush/pull/583) ([gregblake](https://github.com/gregblake))
|
48
|
+
- Fix more Rails 6.1 deprecation warnings [\#582](https://github.com/rpush/rpush/pull/582) ([jas14](https://github.com/jas14))
|
49
|
+
- Feature/apns2 default headers [\#579](https://github.com/rpush/rpush/pull/579) ([jkraemer](https://github.com/jkraemer))
|
50
|
+
- Fix APNS2 documentation in README [\#578](https://github.com/rpush/rpush/pull/578) ([jamestjw](https://github.com/jamestjw))
|
51
|
+
- Fixed typo with misspell [\#575](https://github.com/rpush/rpush/pull/575) ([hsbt](https://github.com/hsbt))
|
52
|
+
|
53
|
+
## [v5.2.0](https://github.com/rpush/rpush/tree/v5.2.0) (2020-10-08)
|
54
|
+
|
55
|
+
[Full Changelog](https://github.com/rpush/rpush/compare/v5.1.0...v5.2.0)
|
56
|
+
|
57
|
+
**Merged pull requests:**
|
58
|
+
|
59
|
+
- Allow opting out of foreground stdout logging [\#571](https://github.com/rpush/rpush/pull/571) ([benlangfeld](https://github.com/benlangfeld))
|
60
|
+
- Do not retry notifications which already have been delivered/failed [\#567](https://github.com/rpush/rpush/pull/567) ([AlexTatarnikov](https://github.com/AlexTatarnikov))
|
61
|
+
- Improve APNs documentation. [\#553](https://github.com/rpush/rpush/pull/553) ([timdiggins](https://github.com/timdiggins))
|
62
|
+
|
63
|
+
## [v5.1.0](https://github.com/rpush/rpush/tree/v5.1.0) (2020-09-25)
|
64
|
+
|
65
|
+
[Full Changelog](https://github.com/rpush/rpush/compare/v5.0.0...v5.1.0)
|
66
|
+
|
67
|
+
**Merged pull requests:**
|
68
|
+
|
69
|
+
- Resume APNS2 delivery when async requests timeout [\#564](https://github.com/rpush/rpush/pull/564) ([benlangfeld](https://github.com/benlangfeld))
|
70
|
+
- Improve DB reconnection for big tables [\#563](https://github.com/rpush/rpush/pull/563) ([AlexTatarnikov](https://github.com/AlexTatarnikov))
|
71
|
+
- Default the Rails environment to RAILS_ENV if set [\#562](https://github.com/rpush/rpush/pull/562) ([benlangfeld](https://github.com/benlangfeld))
|
72
|
+
- Allow Apns2 payloads to be up to 4096 bytes [\#561](https://github.com/rpush/rpush/pull/561) ([benlangfeld](https://github.com/benlangfeld))
|
73
|
+
- Improve test coverage [\#528](https://github.com/rpush/rpush/pull/528) ([jhottenstein](https://github.com/jhottenstein))
|
74
|
+
|
75
|
+
## [v5.0.0](https://github.com/rpush/rpush/tree/v5.0.0) (2020-02-21)
|
76
|
+
|
77
|
+
[Full Changelog](https://github.com/rpush/rpush/compare/v4.2.0...v5.0.0)
|
6
78
|
|
7
79
|
**Merged pull requests:**
|
8
80
|
|
@@ -469,4 +541,4 @@ Bug fixes:
|
|
469
541
|
- Removed rpush.yml in favour of command line options.
|
470
542
|
- Started the changelog!
|
471
543
|
|
472
|
-
\*
|
544
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
[![Gem Version](https://badge.fury.io/rb/rpush.svg)](http://badge.fury.io/rb/rpush)
|
2
|
-
[![
|
2
|
+
[![RPush Test](https://github.com/rpush/rpush/actions/workflows/test.yml/badge.svg)](https://github.com/rpush/rpush/actions/workflows/test.yml)
|
3
3
|
[![Test Coverage](https://codeclimate.com/github/rpush/rpush/badges/coverage.svg)](https://codeclimate.com/github/rpush/rpush)
|
4
4
|
[![Code Climate](https://codeclimate.com/github/rpush/rpush/badges/gpa.svg)](https://codeclimate.com/github/rpush/rpush)
|
5
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)
|
@@ -18,6 +18,7 @@ Rpush aims to be the *de facto* gem for sending push notifications in Ruby. Its
|
|
18
18
|
* [**Amazon Device Messaging**](#amazon-device-messaging)
|
19
19
|
* [**Windows Phone Push Notification Service**](#windows-phone-notification-service)
|
20
20
|
* [**Pushy**](#pushy)
|
21
|
+
* [**Webpush**](#webpush)
|
21
22
|
|
22
23
|
#### Feature Highlights
|
23
24
|
|
@@ -52,56 +53,98 @@ $ bundle exec rpush init
|
|
52
53
|
|
53
54
|
#### Apple Push Notification Service
|
54
55
|
|
56
|
+
There is a choice of two modes (and one legacy mode) using certificates or using tokens:
|
55
57
|
|
56
|
-
|
58
|
+
* `Rpush::Apns2` This requires an annually renewable certificate. see https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/establishing_a_certificate-based_connection_to_apns
|
59
|
+
* `Rpush::Apnsp8` This uses encrypted tokens and requires an encryption key id and encryption key (provide as a p8 file). (see https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/establishing_a_token-based_connection_to_apns)
|
60
|
+
* `Rpush::Apns` There is also the original APNS (the original version using certificates with a binary underlying protocol over TCP directly rather than over Http/2).
|
61
|
+
Apple have [announced](https://developer.apple.com/news/?id=c88acm2b) that this is not supported after March 31, 2021.
|
62
|
+
|
63
|
+
If this is your first time using the APNs, you will need to generate either SSL certificates (for Apns2 or Apns) or an Encryption Key (p8) and an Encryption Key ID (for Apnsp8). See [Generating Certificates](https://github.com/rpush/rpush/wiki/Generating-Certificates) for instructions.
|
64
|
+
|
65
|
+
##### Apnsp8
|
66
|
+
|
67
|
+
To use the p8 APNs Api:
|
57
68
|
|
58
69
|
```ruby
|
59
|
-
app = Rpush::
|
70
|
+
app = Rpush::Apnsp8::App.new
|
60
71
|
app.name = "ios_app"
|
61
|
-
app.
|
72
|
+
app.apn_key = File.read("/path/to/sandbox.p8")
|
62
73
|
app.environment = "development" # APNs environment.
|
63
|
-
app.
|
74
|
+
app.apn_key_id = "APN KEY ID" # This is the Encryption Key ID provided by apple
|
75
|
+
app.team_id = "TEAM ID" # the team id - e.g. ABCDE12345
|
76
|
+
app.bundle_id = "BUNDLE ID" # the unique bundle id of the app, like com.example.appname
|
64
77
|
app.connections = 1
|
65
78
|
app.save!
|
66
79
|
```
|
67
80
|
|
68
81
|
```ruby
|
69
|
-
n = Rpush::
|
70
|
-
n.app = Rpush::
|
82
|
+
n = Rpush::Apnsp8::Notification.new
|
83
|
+
n.app = Rpush::Apnsp8::App.find_by_name("ios_app")
|
71
84
|
n.device_token = "..." # hex string
|
72
85
|
n.alert = "hi mom!"
|
73
86
|
n.data = { foo: :bar }
|
74
87
|
n.save!
|
75
88
|
```
|
76
89
|
|
77
|
-
|
90
|
+
##### Apns2
|
78
91
|
|
79
|
-
|
92
|
+
(NB this uses the same protocol as Apnsp8, but authenticates with a certificate rather than tokens)
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
app = Rpush::Apns2::App.new
|
96
|
+
app.name = "ios_app"
|
97
|
+
app.certificate = File.read("/path/to/sandbox.pem")
|
98
|
+
app.environment = "development"
|
99
|
+
app.password = "certificate password"
|
100
|
+
app.bundle_id = "BUNDLE ID" # the unique bundle id of the app, like com.example.appname
|
101
|
+
app.connections = 1
|
102
|
+
app.save!
|
103
|
+
```
|
104
|
+
|
105
|
+
```ruby
|
106
|
+
n = Rpush::Apns2::Notification.new
|
107
|
+
n.app = Rpush::Apns2::App.find_by_name("ios_app")
|
108
|
+
n.device_token = "..." # hex string
|
109
|
+
n.alert = "hi mom!"
|
110
|
+
n.data = {
|
111
|
+
headers: { 'apns-topic': "BUNDLE ID" }, # the bundle id of the app, like com.example.appname. Not necessary if set on the app (see above)
|
112
|
+
foo: :bar
|
113
|
+
}
|
114
|
+
n.save!
|
115
|
+
```
|
80
116
|
|
81
|
-
|
117
|
+
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.
|
82
118
|
|
83
|
-
|
119
|
+
##### Apns (legacy protocol)
|
84
120
|
|
85
121
|
```ruby
|
86
|
-
app = Rpush::
|
122
|
+
app = Rpush::Apns::App.new
|
87
123
|
app.name = "ios_app"
|
88
|
-
app.
|
124
|
+
app.certificate = File.read("/path/to/sandbox.pem")
|
89
125
|
app.environment = "development" # APNs environment.
|
90
|
-
app.
|
91
|
-
app.team_id = "TEAM ID"
|
92
|
-
app.bundle_id = "BUNDLE ID"
|
126
|
+
app.password = "certificate password"
|
93
127
|
app.connections = 1
|
94
128
|
app.save!
|
95
129
|
```
|
96
130
|
|
97
131
|
```ruby
|
98
132
|
n = Rpush::Apns::Notification.new
|
99
|
-
n.app = Rpush::
|
133
|
+
n.app = Rpush::Apns::App.find_by_name("ios_app")
|
100
134
|
n.device_token = "..." # hex string
|
101
135
|
n.alert = "hi mom!"
|
102
136
|
n.data = { foo: :bar }
|
103
137
|
n.save!
|
104
138
|
```
|
139
|
+
|
140
|
+
##### Safari Push Notifications
|
141
|
+
|
142
|
+
Using one of the notifications methods above, the `url_args` attribute is available for Safari Push Notifications.
|
143
|
+
|
144
|
+
##### Environment
|
145
|
+
|
146
|
+
The app `environment` for any Apns* option is "development" for XCode installs, and "production" for app store and TestFlight. Note that for Apns2 you can now use one (production + sandbox) certificate (you don't need a separate "sandbox" or development certificate), but if you do generate a development/sandbox certificate it can only be used for "development". With Apnsp8 tokens, you can target either "development" or "production" environments.
|
147
|
+
|
105
148
|
#### Firebase Cloud Messaging
|
106
149
|
|
107
150
|
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.
|
@@ -208,7 +251,7 @@ n.save!
|
|
208
251
|
|
209
252
|
#### Windows Raw Push Notifications
|
210
253
|
|
211
|
-
Note: The data is passed as `.to_json` so only this format is supported,
|
254
|
+
Note: The data is passed as `.to_json` so only this format is supported, although raw notifications are meant to support any kind of data.
|
212
255
|
Current data structure enforces hashes and `.to_json` representation is natural presentation of it.
|
213
256
|
|
214
257
|
```ruby
|
@@ -256,6 +299,49 @@ n.save!
|
|
256
299
|
|
257
300
|
For more documentation on [Pushy](https://pushy.me/docs).
|
258
301
|
|
302
|
+
#### Webpush
|
303
|
+
|
304
|
+
[Webpush](https://tools.ietf.org/html/draft-ietf-webpush-protocol-10) is a
|
305
|
+
protocol for delivering push messages to desktop browsers. It's supported by
|
306
|
+
all major browsers (except Safari, you have to use one of the Apns transports
|
307
|
+
for that).
|
308
|
+
|
309
|
+
Using [VAPID](https://tools.ietf.org/html/draft-ietf-webpush-vapid-01), there
|
310
|
+
is no need for the sender of push notifications to register upfront with push
|
311
|
+
services (as was the case with the now legacy Mozilla or Google desktop push
|
312
|
+
providers).
|
313
|
+
|
314
|
+
Instead, you generate a pair of keys and use the public key when subscribing
|
315
|
+
users in your web app. The keys are stored along with an email address (which,
|
316
|
+
according to the spec, can be used by push service providers to contact you in
|
317
|
+
case of problems) in the `certificates` field of the Rpush Application record:
|
318
|
+
|
319
|
+
```ruby
|
320
|
+
vapid_keypair = Webpush.generate_key.to_hash
|
321
|
+
app = Rpush::Webpush::App.new
|
322
|
+
app.name = 'webpush'
|
323
|
+
app.certificate = vapid_keypair.merge(subject: 'user@example.org').to_json
|
324
|
+
app.connections = 1
|
325
|
+
app.save!
|
326
|
+
```
|
327
|
+
|
328
|
+
The `subscription` object you obtain from a subscribed browser holds an
|
329
|
+
endpoint URL and cryptographic keys. When sending a notification, simply pass
|
330
|
+
the whole subscription as sole member of the `registration_ids` collection:
|
331
|
+
|
332
|
+
```ruby
|
333
|
+
n = Rpush::Webpush::Notification.new
|
334
|
+
n.app = Rpush::App.find_by_name("webpush")
|
335
|
+
n.registration_ids = [subscription]
|
336
|
+
n.data = { message: "hi mom!" }
|
337
|
+
n.save!
|
338
|
+
```
|
339
|
+
|
340
|
+
In order to send the same message to multiple devices, create one
|
341
|
+
`Notification` per device, as passing multiple subscriptions at once as
|
342
|
+
`registration_ids` is not supported.
|
343
|
+
|
344
|
+
|
259
345
|
### Running Rpush
|
260
346
|
|
261
347
|
It is recommended to run Rpush as a separate process in most cases, though embedding and manual modes are provided for low-workload environments.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class AddAlertIsJsonToRapnsNotifications < ActiveRecord::
|
1
|
+
class AddAlertIsJsonToRapnsNotifications < ActiveRecord::Migration[5.0]
|
2
2
|
def self.up
|
3
3
|
add_column :rapns_notifications, :alert_is_json, :boolean, null: true, default: false
|
4
4
|
end
|
@@ -6,4 +6,4 @@ class AddAlertIsJsonToRapnsNotifications < ActiveRecord::VERSION::MAJOR >= 5 ? A
|
|
6
6
|
def self.down
|
7
7
|
remove_column :rapns_notifications, :alert_is_json
|
8
8
|
end
|
9
|
-
end
|
9
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class AddAppToRapns < ActiveRecord::
|
1
|
+
class AddAppToRapns < ActiveRecord::Migration[5.0]
|
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
|
@@ -8,4 +8,4 @@ class AddAppToRapns < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migratio
|
|
8
8
|
remove_column :rapns_notifications, :app
|
9
9
|
remove_column :rapns_feedback, :app
|
10
10
|
end
|
11
|
-
end
|
11
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class AddFailAfterToRpushNotifications < ActiveRecord::
|
1
|
+
class AddFailAfterToRpushNotifications < ActiveRecord::Migration[5.0]
|
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::
|
1
|
+
class AddGcm < ActiveRecord::Migration[5.0]
|
2
2
|
module Rapns
|
3
3
|
class App < ActiveRecord::Base
|
4
4
|
self.table_name = 'rapns_apps'
|
@@ -19,8 +19,8 @@ class AddGcm < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0]
|
|
19
19
|
|
20
20
|
change_column :rapns_notifications, :type, :string, null: false
|
21
21
|
change_column :rapns_apps, :type, :string, null: false
|
22
|
-
change_column :rapns_notifications, :device_token, :string,
|
23
|
-
change_column :rapns_notifications, :expiry, :integer,
|
22
|
+
change_column :rapns_notifications, :device_token, :string, null: true, limit: 64
|
23
|
+
change_column :rapns_notifications, :expiry, :integer, null: true, default: 1.day.to_i
|
24
24
|
change_column :rapns_apps, :environment, :string, null: true
|
25
25
|
change_column :rapns_apps, :certificate, :text, null: true, default: nil
|
26
26
|
|
@@ -50,18 +50,10 @@ class AddGcm < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0]
|
|
50
50
|
change_column :rapns_notifications, :app_id, :integer, null: false
|
51
51
|
remove_column :rapns_notifications, :app
|
52
52
|
|
53
|
-
if
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
remove_index :rapns_notifications, name: "index_rapns_notifications_on_delivered_failed_deliver_after"
|
58
|
-
end
|
59
|
-
else
|
60
|
-
if index_name_exists?(:rapns_notifications, "index_rapns_notifications_multi", true)
|
61
|
-
remove_index :rapns_notifications, name: "index_rapns_notifications_multi"
|
62
|
-
elsif index_name_exists?(:rapns_notifications, "index_rapns_notifications_on_delivered_failed_deliver_after", false)
|
63
|
-
remove_index :rapns_notifications, name: "index_rapns_notifications_on_delivered_failed_deliver_after"
|
64
|
-
end
|
53
|
+
if index_name_exists?(:rapns_notifications, "index_rapns_notifications_multi")
|
54
|
+
remove_index :rapns_notifications, name: "index_rapns_notifications_multi"
|
55
|
+
elsif index_name_exists?(:rapns_notifications, "index_rapns_notifications_on_delivered_failed_deliver_after")
|
56
|
+
remove_index :rapns_notifications, name: "index_rapns_notifications_on_delivered_failed_deliver_after"
|
65
57
|
end
|
66
58
|
|
67
59
|
add_index :rapns_notifications, [:app_id, :delivered, :failed, :deliver_after], name: "index_rapns_notifications_multi"
|
@@ -73,8 +65,8 @@ class AddGcm < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0]
|
|
73
65
|
remove_column :rapns_notifications, :type
|
74
66
|
remove_column :rapns_apps, :type
|
75
67
|
|
76
|
-
change_column :rapns_notifications, :device_token, :string,
|
77
|
-
change_column :rapns_notifications, :expiry, :integer,
|
68
|
+
change_column :rapns_notifications, :device_token, :string, null: false, limit: 64
|
69
|
+
change_column :rapns_notifications, :expiry, :integer, null: false, default: 1.day.to_i
|
78
70
|
change_column :rapns_apps, :environment, :string, null: false
|
79
71
|
change_column :rapns_apps, :certificate, :text, null: false
|
80
72
|
|
@@ -100,14 +92,8 @@ class AddGcm < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0]
|
|
100
92
|
AddGcm::Rapns::Notification.update_all(['app = ?', app.key], ['app_id = ?', app.id])
|
101
93
|
end
|
102
94
|
|
103
|
-
if
|
104
|
-
|
105
|
-
remove_index :rapns_notifications, name: :index_rapns_notifications_multi
|
106
|
-
end
|
107
|
-
else
|
108
|
-
if index_name_exists?(:rapns_notifications, :index_rapns_notifications_multi, true)
|
109
|
-
remove_index :rapns_notifications, name: :index_rapns_notifications_multi
|
110
|
-
end
|
95
|
+
if index_name_exists?(:rapns_notifications, :index_rapns_notifications_multi)
|
96
|
+
remove_index :rapns_notifications, name: :index_rapns_notifications_multi
|
111
97
|
end
|
112
98
|
|
113
99
|
remove_column :rapns_notifications, :app_id
|
@@ -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::
|
22
|
+
class AddRpush < ActiveRecord::Migration[5.0]
|
23
23
|
def self.migrations
|
24
24
|
[CreateRapnsNotifications, CreateRapnsFeedback,
|
25
25
|
AddAlertIsJsonToRapnsNotifications, AddAppToRapns,
|
@@ -41,7 +41,7 @@ class AddRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
class CreateRapnsNotifications < ActiveRecord::
|
44
|
+
class CreateRapnsNotifications < ActiveRecord::Migration[5.0]
|
45
45
|
def self.up
|
46
46
|
create_table :rapns_notifications do |t|
|
47
47
|
t.integer :badge, null: true
|
@@ -64,21 +64,15 @@ class AddRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def self.down
|
67
|
-
if
|
68
|
-
|
69
|
-
remove_index :rapns_notifications, name: 'index_rapns_notifications_multi'
|
70
|
-
end
|
71
|
-
else
|
72
|
-
if index_name_exists?(:rapns_notifications, 'index_rapns_notifications_multi', true)
|
73
|
-
remove_index :rapns_notifications, name: 'index_rapns_notifications_multi'
|
74
|
-
end
|
67
|
+
if index_name_exists?(:rapns_notifications, 'index_rapns_notifications_multi')
|
68
|
+
remove_index :rapns_notifications, name: 'index_rapns_notifications_multi'
|
75
69
|
end
|
76
70
|
|
77
71
|
drop_table :rapns_notifications
|
78
72
|
end
|
79
73
|
end
|
80
74
|
|
81
|
-
class CreateRapnsFeedback < ActiveRecord::
|
75
|
+
class CreateRapnsFeedback < ActiveRecord::Migration[5.0]
|
82
76
|
def self.up
|
83
77
|
create_table :rapns_feedback do |t|
|
84
78
|
t.string :device_token, null: false, limit: 64
|
@@ -90,21 +84,15 @@ class AddRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0
|
|
90
84
|
end
|
91
85
|
|
92
86
|
def self.down
|
93
|
-
if
|
94
|
-
|
95
|
-
remove_index :rapns_feedback, name: :index_rapns_feedback_on_device_token
|
96
|
-
end
|
97
|
-
else
|
98
|
-
if index_name_exists?(:rapns_feedback, :index_rapns_feedback_on_device_token, true)
|
99
|
-
remove_index :rapns_feedback, name: :index_rapns_feedback_on_device_token
|
100
|
-
end
|
87
|
+
if index_name_exists?(:rapns_feedback, :index_rapns_feedback_on_device_token)
|
88
|
+
remove_index :rapns_feedback, name: :index_rapns_feedback_on_device_token
|
101
89
|
end
|
102
90
|
|
103
91
|
drop_table :rapns_feedback
|
104
92
|
end
|
105
93
|
end
|
106
94
|
|
107
|
-
class AddAlertIsJsonToRapnsNotifications < ActiveRecord::
|
95
|
+
class AddAlertIsJsonToRapnsNotifications < ActiveRecord::Migration[5.0]
|
108
96
|
def self.up
|
109
97
|
add_column :rapns_notifications, :alert_is_json, :boolean, null: true, default: false
|
110
98
|
end
|
@@ -114,7 +102,7 @@ class AddRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0
|
|
114
102
|
end
|
115
103
|
end
|
116
104
|
|
117
|
-
class AddAppToRapns < ActiveRecord::
|
105
|
+
class AddAppToRapns < ActiveRecord::Migration[5.0]
|
118
106
|
def self.up
|
119
107
|
add_column :rapns_notifications, :app, :string, null: true
|
120
108
|
add_column :rapns_feedback, :app, :string, null: true
|
@@ -126,7 +114,7 @@ class AddRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0
|
|
126
114
|
end
|
127
115
|
end
|
128
116
|
|
129
|
-
class CreateRapnsApps < ActiveRecord::
|
117
|
+
class CreateRapnsApps < ActiveRecord::Migration[5.0]
|
130
118
|
def self.up
|
131
119
|
create_table :rapns_apps do |t|
|
132
120
|
t.string :key, null: false
|
@@ -143,7 +131,7 @@ class AddRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0
|
|
143
131
|
end
|
144
132
|
end
|
145
133
|
|
146
|
-
class AddGcm < ActiveRecord::
|
134
|
+
class AddGcm < ActiveRecord::Migration[5.0]
|
147
135
|
module Rapns
|
148
136
|
class App < ActiveRecord::Base
|
149
137
|
self.table_name = 'rapns_apps'
|
@@ -164,8 +152,8 @@ class AddRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0
|
|
164
152
|
|
165
153
|
change_column :rapns_notifications, :type, :string, null: false
|
166
154
|
change_column :rapns_apps, :type, :string, null: false
|
167
|
-
change_column :rapns_notifications, :device_token, :string,
|
168
|
-
change_column :rapns_notifications, :expiry, :integer,
|
155
|
+
change_column :rapns_notifications, :device_token, :string, null: true, limit: 64
|
156
|
+
change_column :rapns_notifications, :expiry, :integer, null: true, default: 1.day.to_i
|
169
157
|
change_column :rapns_apps, :environment, :string, null: true
|
170
158
|
change_column :rapns_apps, :certificate, :text, null: true, default: nil
|
171
159
|
|
@@ -195,18 +183,10 @@ class AddRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0
|
|
195
183
|
change_column :rapns_notifications, :app_id, :integer, null: false
|
196
184
|
remove_column :rapns_notifications, :app
|
197
185
|
|
198
|
-
if
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
remove_index :rapns_notifications, name: "index_rapns_notifications_on_delivered_failed_deliver_after"
|
203
|
-
end
|
204
|
-
else
|
205
|
-
if index_name_exists?(:rapns_notifications, "index_rapns_notifications_multi", true)
|
206
|
-
remove_index :rapns_notifications, name: "index_rapns_notifications_multi"
|
207
|
-
elsif index_name_exists?(:rapns_notifications, "index_rapns_notifications_on_delivered_failed_deliver_after", false)
|
208
|
-
remove_index :rapns_notifications, name: "index_rapns_notifications_on_delivered_failed_deliver_after"
|
209
|
-
end
|
186
|
+
if index_name_exists?(:rapns_notifications, "index_rapns_notifications_multi")
|
187
|
+
remove_index :rapns_notifications, name: "index_rapns_notifications_multi"
|
188
|
+
elsif index_name_exists?(:rapns_notifications, "index_rapns_notifications_on_delivered_failed_deliver_after")
|
189
|
+
remove_index :rapns_notifications, name: "index_rapns_notifications_on_delivered_failed_deliver_after"
|
210
190
|
end
|
211
191
|
|
212
192
|
add_index :rapns_notifications, [:app_id, :delivered, :failed, :deliver_after], name: "index_rapns_notifications_multi"
|
@@ -218,8 +198,8 @@ class AddRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0
|
|
218
198
|
remove_column :rapns_notifications, :type
|
219
199
|
remove_column :rapns_apps, :type
|
220
200
|
|
221
|
-
change_column :rapns_notifications, :device_token, :string,
|
222
|
-
change_column :rapns_notifications, :expiry, :integer,
|
201
|
+
change_column :rapns_notifications, :device_token, :string, null: false, limit: 64
|
202
|
+
change_column :rapns_notifications, :expiry, :integer, null: false, default: 1.day.to_i
|
223
203
|
change_column :rapns_apps, :environment, :string, null: false
|
224
204
|
change_column :rapns_apps, :certificate, :text, null: false
|
225
205
|
|
@@ -245,14 +225,8 @@ class AddRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0
|
|
245
225
|
AddGcm::Rapns::Notification.where(app_id: app.id).update_all(app: app.key)
|
246
226
|
end
|
247
227
|
|
248
|
-
if
|
249
|
-
|
250
|
-
remove_index :rapns_notifications, name: :index_rapns_notifications_multi
|
251
|
-
end
|
252
|
-
else
|
253
|
-
if index_name_exists?(:rapns_notifications, :index_rapns_notifications_multi, true)
|
254
|
-
remove_index :rapns_notifications, name: :index_rapns_notifications_multi
|
255
|
-
end
|
228
|
+
if index_name_exists?(:rapns_notifications, :index_rapns_notifications_multi)
|
229
|
+
remove_index :rapns_notifications, name: :index_rapns_notifications_multi
|
256
230
|
end
|
257
231
|
|
258
232
|
remove_column :rapns_notifications, :app_id
|
@@ -261,7 +235,7 @@ class AddRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0
|
|
261
235
|
end
|
262
236
|
end
|
263
237
|
|
264
|
-
class AddWpns < ActiveRecord::
|
238
|
+
class AddWpns < ActiveRecord::Migration[5.0]
|
265
239
|
module Rapns
|
266
240
|
class Notification < ActiveRecord::Base
|
267
241
|
self.table_name = 'rapns_notifications'
|
@@ -278,7 +252,7 @@ class AddRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0
|
|
278
252
|
end
|
279
253
|
end
|
280
254
|
|
281
|
-
class AddAdm < ActiveRecord::
|
255
|
+
class AddAdm < ActiveRecord::Migration[5.0]
|
282
256
|
module Rapns
|
283
257
|
class Notification < ActiveRecord::Base
|
284
258
|
self.table_name = 'rapns_notifications'
|
@@ -302,7 +276,7 @@ class AddRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0
|
|
302
276
|
end
|
303
277
|
end
|
304
278
|
|
305
|
-
class RenameRapnsToRpush < ActiveRecord::
|
279
|
+
class RenameRapnsToRpush < ActiveRecord::Migration[5.0]
|
306
280
|
module Rpush
|
307
281
|
class App < ActiveRecord::Base
|
308
282
|
self.table_name = 'rpush_apps'
|
@@ -322,24 +296,12 @@ class AddRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0
|
|
322
296
|
rename_table :rapns_apps, :rpush_apps
|
323
297
|
rename_table :rapns_feedback, :rpush_feedback
|
324
298
|
|
325
|
-
if
|
326
|
-
|
327
|
-
rename_index :rpush_notifications, :index_rapns_notifications_multi, :index_rpush_notifications_multi
|
328
|
-
end
|
329
|
-
else
|
330
|
-
if index_name_exists?(:rpush_notifications, :index_rapns_notifications_multi, true)
|
331
|
-
rename_index :rpush_notifications, :index_rapns_notifications_multi, :index_rpush_notifications_multi
|
332
|
-
end
|
299
|
+
if index_name_exists?(:rpush_notifications, :index_rapns_notifications_multi)
|
300
|
+
rename_index :rpush_notifications, :index_rapns_notifications_multi, :index_rpush_notifications_multi
|
333
301
|
end
|
334
302
|
|
335
|
-
if
|
336
|
-
|
337
|
-
rename_index :rpush_feedback, :index_rapns_feedback_on_device_token, :index_rpush_feedback_on_device_token
|
338
|
-
end
|
339
|
-
else
|
340
|
-
if index_name_exists?(:rpush_feedback, :index_rapns_feedback_on_device_token, true)
|
341
|
-
rename_index :rpush_feedback, :index_rapns_feedback_on_device_token, :index_rpush_feedback_on_device_token
|
342
|
-
end
|
303
|
+
if index_name_exists?(:rpush_feedback, :index_rapns_feedback_on_device_token)
|
304
|
+
rename_index :rpush_feedback, :index_rapns_feedback_on_device_token, :index_rpush_feedback_on_device_token
|
343
305
|
end
|
344
306
|
|
345
307
|
update_type(RenameRapnsToRpush::Rpush::Notification, 'Rapns::Apns::Notification', 'Rpush::Apns::Notification')
|
@@ -364,24 +326,12 @@ class AddRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0
|
|
364
326
|
update_type(RenameRapnsToRpush::Rpush::App, 'Rpush::Adm::App', 'Rapns::Adm::App')
|
365
327
|
update_type(RenameRapnsToRpush::Rpush::App, 'Rpush::Wpns::App', 'Rapns::Wpns::App')
|
366
328
|
|
367
|
-
if
|
368
|
-
|
369
|
-
rename_index :rpush_notifications, :index_rpush_notifications_multi, :index_rapns_notifications_multi
|
370
|
-
end
|
371
|
-
else
|
372
|
-
if index_name_exists?(:rpush_notifications, :index_rpush_notifications_multi, true)
|
373
|
-
rename_index :rpush_notifications, :index_rpush_notifications_multi, :index_rapns_notifications_multi
|
374
|
-
end
|
329
|
+
if index_name_exists?(:rpush_notifications, :index_rpush_notifications_multi)
|
330
|
+
rename_index :rpush_notifications, :index_rpush_notifications_multi, :index_rapns_notifications_multi
|
375
331
|
end
|
376
332
|
|
377
|
-
if
|
378
|
-
|
379
|
-
rename_index :rpush_feedback, :index_rpush_feedback_on_device_token, :index_rapns_feedback_on_device_token
|
380
|
-
end
|
381
|
-
else
|
382
|
-
if index_name_exists?(:rpush_feedback, :index_rpush_feedback_on_device_token, true)
|
383
|
-
rename_index :rpush_feedback, :index_rpush_feedback_on_device_token, :index_rapns_feedback_on_device_token
|
384
|
-
end
|
333
|
+
if index_name_exists?(:rpush_feedback, :index_rpush_feedback_on_device_token)
|
334
|
+
rename_index :rpush_feedback, :index_rpush_feedback_on_device_token, :index_rapns_feedback_on_device_token
|
385
335
|
end
|
386
336
|
|
387
337
|
rename_table :rpush_notifications, :rapns_notifications
|
@@ -390,7 +340,7 @@ class AddRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0
|
|
390
340
|
end
|
391
341
|
end
|
392
342
|
|
393
|
-
class AddFailAfterToRpushNotifications < ActiveRecord::
|
343
|
+
class AddFailAfterToRpushNotifications < ActiveRecord::Migration[5.0]
|
394
344
|
def self.up
|
395
345
|
add_column :rpush_notifications, :fail_after, :timestamp, null: true
|
396
346
|
end
|