devise-onesignal 1.1.1 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e61b368657dae7e5fe98a32f79f4d6e33e0fc8c4feccad9e8cd8f569957a248
4
- data.tar.gz: 5783917015531e75b88da923d66a21c1c0c885df4935ae0a60df40bef14ff61d
3
+ metadata.gz: c0f650e900ff08e671a6ae3d04385c6c57e64f310ffbc06cf9fbbdd11b3bd917
4
+ data.tar.gz: 11a32381521ca68f8c60b3a657218dcc79e17bb06f2acd2284094c2da07a6c64
5
5
  SHA512:
6
- metadata.gz: 9cf7ef8f6cc4b16477f3fa3a62a517c21b9d3d313a5e9edc0f77f1767f35d8dffb6bae51cc49b0e06eacfe3999a9826b8d21bdf18b79aa2730af6adbede2312d
7
- data.tar.gz: f3c618ef8f1edc815a68ca323ddd85cf8805a316d978f989e0080c77de57ffe6171a14e9906a98a5c1f2be152c770eebf42671616ec500f29dea4a0eba599934
6
+ metadata.gz: a2f640c82b049573428632254904d39347777ea20071012b79fd3405c9bca69df558d2a0182d9090a15d2077d6bc71460e923e030650573b5b40ba56047757cc
7
+ data.tar.gz: 67033ef583f45281dca2c2e1ec09e60b0224fc08b11dbda877fb262135292ab097ad61003e59a47f0694ac06d619c4a6b52cecb2322105f219ba568c131eb487
data/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@
4
4
 
5
5
  * nothing yet
6
6
 
7
+ ### 1.2.1 - 2017-12-18
8
+
9
+ * enhancements
10
+ * add more configuration options
11
+
7
12
  ### 1.1.1 - 2017-12-18
8
13
 
9
14
  * bugfixes
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: 'allow', user: UserObject}
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
- 'allow'
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 | 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` |
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.devise_class
12
- @@devise_class || 'User'
16
+ def self.persist_notification
17
+ @@persist_notification || false
13
18
  end
14
- cattr_writer :devise_class, instance_accessor: false
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
@@ -1,5 +1,5 @@
1
1
  module DeviseOneSignal
2
2
 
3
- VERSION = '1.1.1'
3
+ VERSION = '1.2.1'
4
4
 
5
5
  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 Deskop v47+
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
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise-onesignal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Hübotter