OneSignal – Free Web Push Notifications - Version 2.2.0

Version Description

  • Service Worker scope change to non-root for new user installs
Download this release

Release Info

Developer OneSignal
Plugin Icon 128x128 OneSignal – Free Web Push Notifications
Version 2.2.0
Comparing to
See all releases

Code changes from version 2.1.7 to 2.2.0

Files changed (4) hide show
  1. onesignal-public.php +17 -3
  2. onesignal-settings.php +13 -1
  3. onesignal.php +1 -1
  4. readme.txt +6 -2
onesignal-public.php CHANGED
@@ -66,9 +66,23 @@ class OneSignal_Public
66
  window.OneSignal = window.OneSignal || [];
67
 
68
  OneSignal.push( function() {
69
- OneSignal.SERVICE_WORKER_UPDATER_PATH = "OneSignalSDKUpdaterWorker.js.php";
70
- OneSignal.SERVICE_WORKER_PATH = "OneSignalSDKWorker.js.php";
71
- OneSignal.SERVICE_WORKER_PARAM = { scope: '/' };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
 
73
  <?php
74
  if (self::valid_for_key('default_url', $onesignal_wp_settings)) {
66
  window.OneSignal = window.OneSignal || [];
67
 
68
  OneSignal.push( function() {
69
+ <?php
70
+ if(array_key_exists('onesignal_sw_js', $onesignal_wp_settings)) {
71
+ /**
72
+ * strstr method will remove the unecessary path before /wp-content
73
+ * Ex. It will give you a string like this:
74
+ * /wp-content/plugins/onesignal-free-web-push-notifications/
75
+ */
76
+ $path = strstr(plugin_dir_url(__FILE__), '/wp-content');
77
+ echo "OneSignal.SERVICE_WORKER_UPDATER_PATH = 'OneSignalSDKUpdaterWorker.js';
78
+ OneSignal.SERVICE_WORKER_PATH = 'OneSignalSDKWorker.js';
79
+ OneSignal.SERVICE_WORKER_PARAM = { scope: '$path'+'sdk_files/push/onesignal/' };";
80
+ } else {
81
+ echo 'OneSignal.SERVICE_WORKER_UPDATER_PATH = "OneSignalSDKUpdaterWorker.js.php";
82
+ OneSignal.SERVICE_WORKER_PATH = "OneSignalSDKWorker.js.php";
83
+ OneSignal.SERVICE_WORKER_PARAM = { scope: "/" };';
84
+ }
85
+ ?>
86
 
87
  <?php
88
  if (self::valid_for_key('default_url', $onesignal_wp_settings)) {
onesignal-settings.php CHANGED
@@ -87,7 +87,11 @@ class OneSignal {
87
  'use_custom_sdk_init' => false,
88
  'show_notification_send_status_message' => true,
89
  'use_http_permission_request' => 'CALCULATE_SPECIAL_VALUE',
90
- 'persist_notifications' => 'CALCULATE_SPECIAL_VALUE'
 
 
 
 
91
  );
92
 
93
  $legacies = array(
@@ -111,6 +115,14 @@ class OneSignal {
111
  // Assign defaults if the key doesn't exist in $onesignal_wp_settings
112
  // Except for those with value CALCULATE_LEGACY_VALUE -- we need special logic for legacy values that used to exist in previous plugin versions
113
  reset($defaults);
 
 
 
 
 
 
 
 
114
  foreach ($defaults as $key => $value) {
115
  if ($value === "CALCULATE_LEGACY_VALUE") {
116
  if (!array_key_exists($key, $onesignal_wp_settings)) {
87
  'use_custom_sdk_init' => false,
88
  'show_notification_send_status_message' => true,
89
  'use_http_permission_request' => 'CALCULATE_SPECIAL_VALUE',
90
+ 'persist_notifications' => 'CALCULATE_SPECIAL_VALUE',
91
+ /*
92
+ * 'onesignal_sw_js' => true -> this is false people who
93
+ * upgraded from version 2.1.7
94
+ */
95
  );
96
 
97
  $legacies = array(
115
  // Assign defaults if the key doesn't exist in $onesignal_wp_settings
116
  // Except for those with value CALCULATE_LEGACY_VALUE -- we need special logic for legacy values that used to exist in previous plugin versions
117
  reset($defaults);
118
+
119
+ /*
120
+ * 'onesignal_sw_js' => true -> for new users
121
+ */
122
+ if ($is_new_user) {
123
+ $defaults['onesignal_sw_js'] = true;
124
+ }
125
+
126
  foreach ($defaults as $key => $value) {
127
  if ($value === "CALCULATE_LEGACY_VALUE") {
128
  if (!array_key_exists($key, $onesignal_wp_settings)) {
onesignal.php CHANGED
@@ -6,7 +6,7 @@ defined('ABSPATH') or die('This page may not be accessed directly.');
6
  * Plugin Name: OneSignal Push Notifications
7
  * Plugin URI: https://onesignal.com/
8
  * Description: Free web push notifications.
9
- * Version: 2.1.7
10
  * Author: OneSignal
11
  * Author URI: https://onesignal.com
12
  * License: MIT
6
  * Plugin Name: OneSignal Push Notifications
7
  * Plugin URI: https://onesignal.com/
8
  * Description: Free web push notifications.
9
+ * Version: 2.2.0
10
  * Author: OneSignal
11
  * Author URI: https://onesignal.com
12
  * License: MIT
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://onesignal.com
4
  Tags: push notification, push notifications, desktop notifications, mobile notifications, chrome push, android, android notification, android notifications, android push, desktop notification, firefox, firefox push, mobile, mobile notification, notification, notifications, notify, onesignal, push, push messages, safari, safari push, web push, chrome
5
  Requires at least: 3.8
6
  Tested up to: 5.7
7
- Stable tag: 2.1.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -20,7 +20,7 @@ After setup, your visitors opt-in to receive push notifications when you publish
20
 
21
  You can configure notification delivery at preset intervals, create user segments, and customize the opt-in process for visitors.
22
 
23
- OneSignal’s free plan allows targeting up to 30,000 subscribers with push notifications. Contact support@onesignal.com if you have any questions. We’d love to hear from you!
24
 
25
  = Company =
26
  OneSignal is trusted by over 1,189,788 developers and marketing strategists. We power push notifications for everyone from early stage startups to Fortune 500 Companies, sending over 6 billion notifications per day. It is the most popular push notification plugin on Wordpress with 100,000+ installations.
@@ -67,6 +67,10 @@ HTTPS Setup Video: [youtube https://www.youtube.com/watch?v=BeTZ2KgytC0]
67
 
68
  == Changelog ==
69
 
 
 
 
 
70
  = 2.1.7 =
71
 
72
  - Update Tested Up To Version to 5.7
4
  Tags: push notification, push notifications, desktop notifications, mobile notifications, chrome push, android, android notification, android notifications, android push, desktop notification, firefox, firefox push, mobile, mobile notification, notification, notifications, notify, onesignal, push, push messages, safari, safari push, web push, chrome
5
  Requires at least: 3.8
6
  Tested up to: 5.7
7
+ Stable tag: 2.2.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
20
 
21
  You can configure notification delivery at preset intervals, create user segments, and customize the opt-in process for visitors.
22
 
23
+ OneSignal’s free plan allows targeting up to 10,000 subscribers with push notifications. Contact support@onesignal.com if you have any questions. We’d love to hear from you!
24
 
25
  = Company =
26
  OneSignal is trusted by over 1,189,788 developers and marketing strategists. We power push notifications for everyone from early stage startups to Fortune 500 Companies, sending over 6 billion notifications per day. It is the most popular push notification plugin on Wordpress with 100,000+ installations.
67
 
68
  == Changelog ==
69
 
70
+ = 2.2.0 =
71
+
72
+ - Service Worker scope change to non-root for new user installs
73
+
74
  = 2.1.7 =
75
 
76
  - Update Tested Up To Version to 5.7