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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd9849d656f3afe0487b2b007a31484a320f3ecb91c1a413e7eecb9728a06219
4
- data.tar.gz: c292a315ba5e62a6a04db0e51a3022b282e537a4973eef72164192c8945e9f48
3
+ metadata.gz: 3c4bbba75425d00e40dc42cc19aa6dc9a2d59a1df466897746613837a1340af1
4
+ data.tar.gz: ba30d7c7da239a34d0ac1dab03aa630f12fa142c1d261f582b4166ab48451f58
5
5
  SHA512:
6
- metadata.gz: 21389f2a43e0050bad447613a5be4b848f90fa24a21ba23a528211bb16fc354eba56a860198770b8a7941345b6d6b6d16a9166ece36be93595461edba6b0a84c
7
- data.tar.gz: 3fb6ddbe84cc95fe956d4bd862b5ad4069211d7d1cd152c6d40f1530bb0f227ad2801dcec73281c369cc638bfa7518ccdb77cfa415c25f119aaa647670c42256
6
+ metadata.gz: fa276c43c42453f79d4f89ce8beeefb8183eebee06de5bb9ea01437291f5b5dbfd586050f97e518b35718a0a4f44a168d5c3f1c0b467288d2c56a72abe00a0c9
7
+ data.tar.gz: 98ac629f3c05a4abcb7108cf76706d6b6859c732cf977f744e3f2f94d188edbc67aaab8f0b231bd7d6d1fa9ef5864e7e50a3ab091163e497038be5f4f027af67
data/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@
4
4
 
5
5
  * nothing yet
6
6
 
7
+ ### 3.2.0 - 2018-01-21
8
+
9
+ * features
10
+ * add `OneSignalSubscribed()` function
11
+
7
12
  ### 3.1.5 - 2018-01-06
8
13
 
9
14
  * enhancements
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.
@@ -2,25 +2,15 @@ require 'devise-onesignal/version'
2
2
 
3
3
  module DeviseOnesignal
4
4
 
5
- autoload :Configuration, 'devise-onesignal/configuration'
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
- class Engine < ::Rails::Engine
24
- end
13
+ require 'devise-onesignal/engine'
14
+ require 'devise-onesignal/railtie'
25
15
 
26
16
  end
@@ -1,4 +1,14 @@
1
1
  module DeviseOnesignal
2
+
3
+ class << self
4
+ attr_accessor :configuration
5
+ end
6
+
7
+ def self.configure
8
+ self.configuration ||= Configuration.new
9
+ yield configuration
10
+ end
11
+
2
12
  class Configuration
3
13
 
4
14
  attr_accessor :app_id
@@ -0,0 +1,6 @@
1
+ require 'rails/railtie'
2
+
3
+ module DeviseOnesignal
4
+ class Engine < ::Rails::Engine
5
+ end
6
+ end
@@ -1,4 +1,4 @@
1
- require 'rails'
1
+ require 'rails/railtie'
2
2
 
3
3
  module DeviseOnesignal
4
4
  class Railtie < Rails::Railtie
@@ -1,5 +1,5 @@
1
1
  module DeviseOnesignal
2
2
 
3
- VERSION = '3.1.5'
3
+ VERSION = '3.2.0'
4
4
 
5
5
  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 ( OneSignalPlayerId != null ) {
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.1.5
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-06 00:00:00.000000000 Z
11
+ date: 2018-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rails
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: jonas.huebotter@gmail.com
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