devise-onesignal 3.1.5 → 3.2.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 +5 -0
- data/README.md +2 -0
- data/lib/devise-onesignal.rb +3 -13
- data/lib/devise-onesignal/configuration.rb +10 -0
- data/lib/devise-onesignal/engine.rb +6 -0
- data/lib/devise-onesignal/railtie.rb +1 -1
- data/lib/devise-onesignal/version.rb +1 -1
- data/vendor/assets/javascripts/devise-onesignal.js.erb +7 -3
- metadata +61 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c4bbba75425d00e40dc42cc19aa6dc9a2d59a1df466897746613837a1340af1
|
4
|
+
data.tar.gz: ba30d7c7da239a34d0ac1dab03aa630f12fa142c1d261f582b4166ab48451f58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa276c43c42453f79d4f89ce8beeefb8183eebee06de5bb9ea01437291f5b5dbfd586050f97e518b35718a0a4f44a168d5c3f1c0b467288d2c56a72abe00a0c9
|
7
|
+
data.tar.gz: 98ac629f3c05a4abcb7108cf76706d6b6859c732cf977f744e3f2f94d188edbc67aaab8f0b231bd7d6d1fa9ef5864e7e50a3ab091163e497038be5f4f027af67
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -149,6 +149,8 @@ In your controllers and views you can access a `current_device` method that retu
|
|
149
149
|
|
150
150
|
Just call `OneSignalSubscribe();` in your frontend code and OneSignal will ask your user for permission to send notifications. On the following request an existing `Device` object will either get updated or a new one will get created.
|
151
151
|
|
152
|
+
You can check whether the current user has already enabled notifications by using the `OneSignalSubscribed();` function.
|
153
|
+
|
152
154
|
### Unsubscribing
|
153
155
|
|
154
156
|
**Note:** You most likely don't want to let your users unsubscribe from receiving notifications, but instead allow them to manually disable receiving any new notifications. For that purpose use the [notifications-rails](https://github.com/jonhue/notifications-rails) gem, which adds a notification API and detailed user settings.
|
data/lib/devise-onesignal.rb
CHANGED
@@ -2,25 +2,15 @@ require 'devise-onesignal/version'
|
|
2
2
|
|
3
3
|
module DeviseOnesignal
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
class << self
|
8
|
-
attr_accessor :configuration
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.configure
|
12
|
-
self.configuration ||= Configuration.new
|
13
|
-
yield configuration
|
14
|
-
end
|
5
|
+
require 'devise-onesignal/configuration'
|
15
6
|
|
16
7
|
autoload :DeviceLib, 'devise-onesignal/device_lib'
|
17
8
|
|
18
9
|
autoload :Owner, 'devise-onesignal/owner'
|
19
10
|
autoload :DeviceConcern, 'devise-onesignal/device_concern'
|
20
11
|
autoload :DeviceHelper, 'devise-onesignal/device_helper'
|
21
|
-
require 'devise-onesignal/railtie'
|
22
12
|
|
23
|
-
|
24
|
-
|
13
|
+
require 'devise-onesignal/engine'
|
14
|
+
require 'devise-onesignal/railtie'
|
25
15
|
|
26
16
|
end
|
@@ -35,16 +35,20 @@ function OneSignalInit() {
|
|
35
35
|
|
36
36
|
|
37
37
|
|
38
|
+
function OneSignalSubscribed() {
|
39
|
+
OneSignalPlayerId != null;
|
40
|
+
};
|
41
|
+
|
38
42
|
function OneSignalSubscribe() {
|
39
|
-
if (
|
43
|
+
if (OneSignalSubscribed()) {
|
40
44
|
OneSignal.setSubscription(true);
|
41
45
|
} else {
|
42
46
|
OneSignal.registerForPushNotifications({
|
43
47
|
modalPrompt: <%= DeviseOnesignal.configuration.subscribe_with_modal ? 'true' : 'false' %>
|
44
48
|
});
|
45
49
|
};
|
46
|
-
}
|
50
|
+
};
|
47
51
|
|
48
52
|
function OneSignalUnsubscribe() {
|
49
53
|
OneSignal.setSubscription(false);
|
50
|
-
}
|
54
|
+
};
|
metadata
CHANGED
@@ -1,17 +1,73 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise-onesignal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
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-01-
|
11
|
+
date: 2018-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: railties
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: activerecord
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: actionview
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '5.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '5.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: actionpack
|
15
71
|
requirement: !ruby/object:Gem::Requirement
|
16
72
|
requirements:
|
17
73
|
- - ">="
|
@@ -55,7 +111,7 @@ dependencies:
|
|
55
111
|
description: Implement user targeted cross-platform notifications with OneSignal &
|
56
112
|
Devise in your Rails app. This gem can also be used without Devise, but it is primarily
|
57
113
|
intended to be used along with some sort of user-management-system.
|
58
|
-
email:
|
114
|
+
email: me@jonhue.me
|
59
115
|
executables: []
|
60
116
|
extensions: []
|
61
117
|
extra_rdoc_files: []
|
@@ -68,6 +124,7 @@ files:
|
|
68
124
|
- lib/devise-onesignal/device_concern.rb
|
69
125
|
- lib/devise-onesignal/device_helper.rb
|
70
126
|
- lib/devise-onesignal/device_lib.rb
|
127
|
+
- lib/devise-onesignal/engine.rb
|
71
128
|
- lib/devise-onesignal/owner.rb
|
72
129
|
- lib/devise-onesignal/railtie.rb
|
73
130
|
- lib/devise-onesignal/version.rb
|