devise-onesignal 1.1.1 → 1.2.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 +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +9 -7
- data/lib/devise-onesignal/configuration.rb +13 -3
- data/lib/devise-onesignal/version.rb +1 -1
- data/vendor/assets/javascripts/devise-onesignal.js.erb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0f650e900ff08e671a6ae3d04385c6c57e64f310ffbc06cf9fbbdd11b3bd917
|
4
|
+
data.tar.gz: 11a32381521ca68f8c60b3a657218dcc79e17bb06f2acd2284094c2da07a6c64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2f640c82b049573428632254904d39347777ea20071012b79fd3405c9bca69df558d2a0182d9090a15d2077d6bc71460e923e030650573b5b40ba56047757cc
|
7
|
+
data.tar.gz: 67033ef583f45281dca2c2e1ec09e60b0224fc08b11dbda877fb262135292ab097ad61003e59a47f0694ac06d619c4a6b52cecb2322105f219ba568c131eb487
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -92,7 +92,7 @@ devise-onesignal introduces an `current_onesignal` method available in your cont
|
|
92
92
|
|
93
93
|
```ruby
|
94
94
|
$ current_onesignal
|
95
|
-
{id: 'e9b66bc5-a1e5-4f3f-8a3e-894f576b193a', permission: '
|
95
|
+
{id: 'e9b66bc5-a1e5-4f3f-8a3e-894f576b193a', permission: 'granted', user: UserObject}
|
96
96
|
```
|
97
97
|
|
98
98
|
**Note:** When no user is associated with that ID, the returned hash does not include the key.
|
@@ -105,7 +105,7 @@ You can access the OneSignal PlayerId and Permission from the User object:
|
|
105
105
|
$ User.first.onesignal_id
|
106
106
|
'e9b66bc5-a1e5-4f3f-8a3e-894f576b193a'
|
107
107
|
$ User.first.onesignal_permission
|
108
|
-
'
|
108
|
+
'granted'
|
109
109
|
```
|
110
110
|
|
111
111
|
---
|
@@ -116,11 +116,13 @@ $ User.first.onesignal_permission
|
|
116
116
|
DeviseOneSignal::Configuration.app_id = 'OneSignal APP ID'
|
117
117
|
```
|
118
118
|
|
119
|
-
| Option
|
120
|
-
|
|
121
|
-
| `app_id` (required)
|
122
|
-
| `devise_class`
|
123
|
-
| `auto_register`
|
119
|
+
| Option | Description | Default |
|
120
|
+
| ---------------------- | -------------------------------------------------------------------------- | -------- |
|
121
|
+
| `app_id` (required) | OneSignal application ID | `nil` |
|
122
|
+
| `devise_class` | Devise class | `'User'` |
|
123
|
+
| `auto_register` | Whether or not the app should automatically try to subscribe the user | `false` |
|
124
|
+
| `persist_notification` | Automatically dismiss the notification after ~20 seconds in Chrome | `false` |
|
125
|
+
| `subscribe_with_modal` | Show a modal instead of a native window when subscribing user to OneSignal | `false` |
|
124
126
|
|
125
127
|
---
|
126
128
|
|
@@ -3,15 +3,25 @@ module DeviseOneSignal
|
|
3
3
|
|
4
4
|
cattr_accessor :app_id, instance_accessor: false
|
5
5
|
|
6
|
+
def self.devise_class
|
7
|
+
@@devise_class || 'User'
|
8
|
+
end
|
9
|
+
cattr_writer :devise_class, instance_accessor: false
|
10
|
+
|
6
11
|
def self.auto_register
|
7
12
|
@@auto_register || false
|
8
13
|
end
|
9
14
|
cattr_writer :auto_register, instance_accessor: false
|
10
15
|
|
11
|
-
def self.
|
12
|
-
@@
|
16
|
+
def self.persist_notification
|
17
|
+
@@persist_notification || false
|
13
18
|
end
|
14
|
-
cattr_writer :
|
19
|
+
cattr_writer :persist_notification, instance_accessor: false
|
20
|
+
|
21
|
+
def self.subscribe_with_modal
|
22
|
+
@@subscribe_with_modal || false
|
23
|
+
end
|
24
|
+
cattr_writer :subscribe_with_modal, instance_accessor: false
|
15
25
|
|
16
26
|
end
|
17
27
|
end
|
@@ -18,7 +18,7 @@ function OneSignalInit() {
|
|
18
18
|
notifyButton: {
|
19
19
|
enable: false
|
20
20
|
},
|
21
|
-
persistNotification: false // Automatically dismiss the notification after ~20 seconds in Chrome
|
21
|
+
persistNotification: <%= DeviseOneSignal::Configuration.persist_notification ? 'true' : 'false' %> // Automatically dismiss the notification after ~20 seconds in Chrome Desktop v47+
|
22
22
|
}]);
|
23
23
|
|
24
24
|
// Firstly this will check user id
|
@@ -43,7 +43,7 @@ function OneSignalSubscribe() {
|
|
43
43
|
OneSignal.setSubscription(true);
|
44
44
|
} else {
|
45
45
|
OneSignal.registerForPushNotifications({
|
46
|
-
modalPrompt: true
|
46
|
+
modalPrompt: <%= DeviseOneSignal::Configuration.subscribe_with_modal ? 'true' : 'false' %>
|
47
47
|
});
|
48
48
|
};
|
49
49
|
}
|