onsignal 5.0.0 → 5.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +15 -11
- data/app/controllers/concerns/on_signal_controller.rb +1 -1
- data/lib/on_signal/version.rb +1 -1
- metadata +3 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b865e3b6c4d7ecfdd69ba9bc1879a18813173b5bbeb06d7e310e0869401998f
|
4
|
+
data.tar.gz: db5b20fa14141fec8aa2fcd281c6b0d172d49ab4ed232fa6e82b5b76a6523125
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9550f4885061e370214831561b2e3c87d0d77cdd109ce55801bd0a272369785b3bc1a7d23c97e5fdf54c493b336c0205802d0bb5113a691ac30122d5a97bc019
|
7
|
+
data.tar.gz: e5a8b6dd0a20162b47e44ad7e4a08f783979d7606f2dd82c561032fe2f7034bb1c5fc81d992a9455f28522be8010ac9bea3e569786dad6ccab5b83c066a9bb81
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -38,19 +38,23 @@ Handle user subscriptions to OneSignal in your frontend code.
|
|
38
38
|
### Overview
|
39
39
|
|
40
40
|
```javascript
|
41
|
+
import 'onsignal/dist/OneSignalSDK';
|
41
42
|
import OnSignal from 'onsignal';
|
42
|
-
let onSignal = new OnSignal( 'OneSignal App ID', {
|
43
|
-
autoRegister: false
|
44
|
-
});
|
45
43
|
|
46
|
-
|
47
|
-
onSignal
|
44
|
+
document.addEventListener( 'ready', () => {
|
45
|
+
const onSignal = new OnSignal( 'OneSignal App ID', {
|
46
|
+
autoRegister: false
|
47
|
+
});
|
48
48
|
|
49
|
-
//
|
50
|
-
onSignal.
|
49
|
+
// Object to call OneSignal API from
|
50
|
+
onSignal.oneSignal;
|
51
51
|
|
52
|
-
// Current users
|
53
|
-
onSignal.
|
52
|
+
// Current users player ID
|
53
|
+
onSignal.playerId;
|
54
|
+
|
55
|
+
// Current users permission
|
56
|
+
onSignal.permission;
|
57
|
+
};
|
54
58
|
```
|
55
59
|
|
56
60
|
#### Options
|
@@ -58,7 +62,7 @@ onSignal.permission;
|
|
58
62
|
Pass options to OneSignal's `push(['init', {...}])` function as a hash. Default values are:
|
59
63
|
|
60
64
|
* `autoRegister` Automatically try to subscribe the user when loading a page. Accepts a boolean. Defaults to `false`.
|
61
|
-
* `persistNotification`
|
65
|
+
* `persistNotification` If set to `false `, automatically dismisses notifications after ~20 seconds in Chrome Desktop v47+. Accepts a boolean. Defaults to `false`.
|
62
66
|
* `welcomeNotification` Hash configuring the default OneSignal welcome notification. Accepts a hash. Defaults to `{ disable: true }`.
|
63
67
|
* `notifyButton` Hash configuring the default OneSignal notify button at the bottom right of the screen. Accepts a hash. Defaults to `{ enable: false }`.
|
64
68
|
|
@@ -131,7 +135,7 @@ class Admin < ApplicationRecord
|
|
131
135
|
end
|
132
136
|
```
|
133
137
|
|
134
|
-
Next attach a user object by defining a `set_onsignal_user` method. Let's say model is named `Admin` and `current_admin` is available at controller level. Just add a method to your `ApplicationController`:
|
138
|
+
Next attach a user object by defining a `set_onsignal_user` method. Let's say model our is named `Admin` and `current_admin` is available at controller level. Just add a method to your `ApplicationController`:
|
135
139
|
|
136
140
|
```ruby
|
137
141
|
def set_onsignal_user
|
@@ -18,7 +18,7 @@ module OnSignalController
|
|
18
18
|
device = OnSignal.configuration.device_const.constantize.find_or_create_by! onesignal_id: onesignal_player_id
|
19
19
|
device.onesignal_permission = cookies[:oneSignalPlayerPermission]
|
20
20
|
device.last_used = Time.now
|
21
|
-
device.owner =
|
21
|
+
device.owner = set_onsignal_user
|
22
22
|
device.save!
|
23
23
|
end
|
24
24
|
end
|
data/lib/on_signal/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onsignal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Hübotter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -135,28 +135,7 @@ homepage: https://github.com/jonhue/onsignal
|
|
135
135
|
licenses:
|
136
136
|
- MIT
|
137
137
|
metadata: {}
|
138
|
-
post_install_message:
|
139
|
-
**Thank you for installing OnSignal!**
|
140
|
-
|
141
|
-
|
142
|
-
There are four wo more steps to take:
|
143
|
-
|
144
|
-
1) Run `rails g devise_onesignal` and `rails db:migrate`
|
145
|
-
2) Enter your OneSignal App ID in config/initializers/devise-onesignal.rb
|
146
|
-
3) Add:
|
147
|
-
|
148
|
-
import 'devise-onesignal/dist/OneSignalSDK';
|
149
|
-
import * as deviseOneSignal from 'devise-onesignal';
|
150
|
-
|
151
|
-
to your webpack pack in app/javascript/packs/application.js
|
152
|
-
4) Add:
|
153
|
-
|
154
|
-
has_devices
|
155
|
-
|
156
|
-
to your authentication model
|
157
|
-
|
158
|
-
|
159
|
-
Learn more at https://github.com/jonhue/devise-onesignal
|
138
|
+
post_install_message:
|
160
139
|
rdoc_options: []
|
161
140
|
require_paths:
|
162
141
|
- lib
|