Super Progressive Web Apps - Version 2.1.6

Version Description

  • Date: 04.February.2021 BugFixed: Manifest shows start URL is out of the scope URL in Specific cases #162 BugFixed: Offline analytics undefined variable #99 Enhancement: iOS application icons are blur overwrite by WordPress #161 BugFixed: Quick action feature for PWA icons need to specify size #147
Download this release

Release Info

Developer superpwa
Plugin Icon 128x128 Super Progressive Web Apps
Version 2.1.6
Comparing to
See all releases

Code changes from version 2.1.5 to 2.1.6

addons/apple-touch-icons.php CHANGED
@@ -33,4 +33,26 @@ function superpwa_ati_add_apple_touch_icons( $tags ) {
33
 
34
  return $tags;
35
  }
36
- add_filter( 'superpwa_wp_head_tags', 'superpwa_ati_add_apple_touch_icons' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
  return $tags;
35
  }
36
+ add_filter( 'superpwa_wp_head_tags', 'superpwa_ati_add_apple_touch_icons' );
37
+
38
+ /**
39
+ * Remove apple-touch-icon added by WordPress in heading (site_icon_meta_tags)
40
+ *
41
+ * Wordpress introduce this filter since 4.3.0 (site_icon_meta_tags)
42
+ * @since 2.1.6 introduce
43
+ * @param (string) $tags HTML element tags passed on by site_icon_meta_tags
44
+ *
45
+ * @return (string) Remove the Apple Touch Icons from the existing tag string
46
+ */
47
+ function superpwa_remove_site_apple_touch_icon($meta_tags) {
48
+ if(is_customize_preview() && is_admin()){
49
+ return $meta_tags;
50
+ }
51
+ foreach ($meta_tags as $key => $value) {
52
+ if(strpos($value, 'apple-touch-icon') !== false){
53
+ unset($meta_tags[$key]);
54
+ }
55
+ }
56
+ return $meta_tags;
57
+ }
58
+ add_filter( 'site_icon_meta_tags', 'superpwa_remove_site_apple_touch_icon', 0 );
admin/admin-ui-setup.php CHANGED
@@ -214,7 +214,7 @@ function superpwa_register_settings() {
214
  // Disabling "Add to home screen"
215
  add_settings_field(
216
  'superpwa_disable_add_to_home', // ID
217
- __('Disabling "Add to home screen"', 'super-progressive-web-apps'), // Title
218
  'superpwa_disable_add_to_home_cb', // CB
219
  'superpwa_pwa_advance_section', // Page slug
220
  'superpwa_pwa_advance_section' // Settings Section ID
214
  // Disabling "Add to home screen"
215
  add_settings_field(
216
  'superpwa_disable_add_to_home', // ID
217
+ __('Disable "Add to home screen"', 'super-progressive-web-apps'), // Title
218
  'superpwa_disable_add_to_home_cb', // CB
219
  'superpwa_pwa_advance_section', // Page slug
220
  'superpwa_pwa_advance_section' // Settings Section ID
public/js/register-sw.js CHANGED
@@ -16,6 +16,9 @@ if ('serviceWorker' in navigator) {
16
  var a2hsBanner = document.getElementsByClassName("superpwa-sticky-banner");
17
  if(a2hsBanner.length){
18
  deferredPrompt.preventDefault();
 
 
 
19
  for (var i = 0; i < a2hsBanner.length; i++) {
20
  var showbanner = a2hsBanner[i].getAttribute("data-show");
21
  a2hsBanner[i].style.display="flex";
@@ -64,3 +67,8 @@ if ('serviceWorker' in navigator) {
64
 
65
  });
66
  }
 
 
 
 
 
16
  var a2hsBanner = document.getElementsByClassName("superpwa-sticky-banner");
17
  if(a2hsBanner.length){
18
  deferredPrompt.preventDefault();
19
+ //Disable on desktop
20
+ if(superpwa_sw.enableOnDesktop!=1 && !window.mobileCheck()){return ;}
21
+ if(typeof super_check_bar_closed_or_not == 'function' && !super_check_bar_closed_or_not()){return ;}
22
  for (var i = 0; i < a2hsBanner.length; i++) {
23
  var showbanner = a2hsBanner[i].getAttribute("data-show");
24
  a2hsBanner[i].style.display="flex";
67
 
68
  });
69
  }
70
+ window.mobileCheck = function() {
71
+ let check = false;
72
+ (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent||navigator.vendor||window.opera);
73
+ return check;
74
+ };
public/manifest.php CHANGED
@@ -129,8 +129,8 @@ function superpwa_manifest_template() {
129
  $manifest['theme_color'] = $settings['theme_color'];
130
  $manifest['display'] = superpwa_get_display();
131
  $manifest['orientation'] = superpwa_get_orientation();
132
- $manifest['start_url'] = superpwa_get_start_url( true );
133
- $manifest['scope'] = superpwa_get_scope();
134
 
135
  if(isset($settings['shortcut_url']) && $settings['shortcut_url']!=0){
136
  $shortcut_url = get_permalink( $settings['shortcut_url'] );
@@ -148,8 +148,8 @@ function superpwa_manifest_template() {
148
  'name'=>get_the_title( $settings['shortcut_url'] ),
149
  'short_name'=>get_the_title( $settings['shortcut_url'] ),
150
  'description'=>get_the_title( $settings['shortcut_url'] ),
151
- 'url'=>$shortcut_url,
152
- 'icons'=>$settings['icon']
153
  )
154
  );
155
  }
129
  $manifest['theme_color'] = $settings['theme_color'];
130
  $manifest['display'] = superpwa_get_display();
131
  $manifest['orientation'] = superpwa_get_orientation();
132
+ $manifest['start_url'] = user_trailingslashit(superpwa_get_start_url( true ));
133
+ $manifest['scope'] = user_trailingslashit(superpwa_get_scope());
134
 
135
  if(isset($settings['shortcut_url']) && $settings['shortcut_url']!=0){
136
  $shortcut_url = get_permalink( $settings['shortcut_url'] );
148
  'name'=>get_the_title( $settings['shortcut_url'] ),
149
  'short_name'=>get_the_title( $settings['shortcut_url'] ),
150
  'description'=>get_the_title( $settings['shortcut_url'] ),
151
+ 'url'=>user_trailingslashit( parse_url( trailingslashit( $shortcut_url ), PHP_URL_PATH ) ),
152
+ 'icons'=>array(array('src'=>$settings['icon'], 'sizes'=>'192x192'))
153
  )
154
  );
155
  }
public/sw.php CHANGED
@@ -265,12 +265,10 @@ function checkNeverCacheList(url) {
265
  <?php
266
  if(isset($settings['analytics_support']) && $settings['analytics_support']==1){
267
  echo 'importScripts("https://storage.googleapis.com/workbox-cdn/releases/6.0.2/workbox-sw.js");
268
- import * as googleAnalytics from \'workbox-google-analytics\';
269
-
270
- if(googleAnalytics){
271
  try{
272
- googleAnalytics.initialize();
273
- } catch (e){}
274
  }';
275
  }
276
  ?>
@@ -288,11 +286,13 @@ function superpwa_register_sw() {
288
 
289
  $settings = superpwa_get_settings();
290
  wp_enqueue_script( 'superpwa-register-sw', SUPERPWA_PATH_SRC . 'public/js/register-sw.js', array(), null, true );
291
- wp_localize_script( 'superpwa-register-sw', 'superpwa_sw', array(
292
  'url' => parse_url( superpwa_sw( 'src' ), PHP_URL_PATH ),
293
  'disable_addtohome' => isset($settings['disable_add_to_home'])? $settings['disable_add_to_home'] : 0,
294
- )
295
- );
 
 
296
  }
297
  add_action( 'wp_enqueue_scripts', 'superpwa_register_sw' );
298
 
265
  <?php
266
  if(isset($settings['analytics_support']) && $settings['analytics_support']==1){
267
  echo 'importScripts("https://storage.googleapis.com/workbox-cdn/releases/6.0.2/workbox-sw.js");
268
+ if(workbox.googleAnalytics){
 
 
269
  try{
270
+ workbox.googleAnalytics.initialize();
271
+ } catch (e){ console.log(e.message); }
272
  }';
273
  }
274
  ?>
286
 
287
  $settings = superpwa_get_settings();
288
  wp_enqueue_script( 'superpwa-register-sw', SUPERPWA_PATH_SRC . 'public/js/register-sw.js', array(), null, true );
289
+ $localize = array(
290
  'url' => parse_url( superpwa_sw( 'src' ), PHP_URL_PATH ),
291
  'disable_addtohome' => isset($settings['disable_add_to_home'])? $settings['disable_add_to_home'] : 0,
292
+ 'enableOnDesktop'=> false,
293
+ );
294
+ $localize = apply_filters('superpwa_sw_localize_data', $localize);
295
+ wp_localize_script( 'superpwa-register-sw', 'superpwa_sw', $localize);
296
  }
297
  add_action( 'wp_enqueue_scripts', 'superpwa_register_sw' );
298
 
readme.txt CHANGED
@@ -183,6 +183,13 @@ Feel free to get in touch if you have any questions.
183
  1. Settings page in WordPress Admin > SuperPWA > Settings
184
 
185
  == Changelog ==
 
 
 
 
 
 
 
186
 
187
  = 2.1.5 =
188
  * Date: [06.January.2021](https://superpwa.com/superpwa-2-1/?utm_source=wordpress.org&utm_medium=changelog)
183
  1. Settings page in WordPress Admin > SuperPWA > Settings
184
 
185
  == Changelog ==
186
+ = 2.1.6 =
187
+ * Date: [04.February.2021](https://superpwa.com/superpwa-2-1/?utm_source=wordpress.org&utm_medium=changelog)
188
+ BugFixed: Manifest shows start URL is out of the scope URL in Specific cases #162
189
+ BugFixed: Offline analytics undefined variable #99
190
+ Enhancement: iOS application icons are blur overwrite by WordPress #161
191
+ BugFixed: Quick action feature for PWA icons need to specify size #147
192
+
193
 
194
  = 2.1.5 =
195
  * Date: [06.January.2021](https://superpwa.com/superpwa-2-1/?utm_source=wordpress.org&utm_medium=changelog)
superpwa.php CHANGED
@@ -6,7 +6,7 @@
6
  * Author: SuperPWA
7
  * Author URI: https://profiles.wordpress.org/superpwa/
8
  * Contributors: SuperPWA
9
- * Version: 2.1.5
10
  * Text Domain: super-progressive-web-apps
11
  * Domain Path: /languages
12
  * License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
@@ -43,7 +43,7 @@ if ( ! defined('ABSPATH') ) exit;
43
  * @since 1.0
44
  */
45
  if ( ! defined( 'SUPERPWA_VERSION' ) ) {
46
- define( 'SUPERPWA_VERSION' , '2.1.5' );
47
  }
48
 
49
  /**
6
  * Author: SuperPWA
7
  * Author URI: https://profiles.wordpress.org/superpwa/
8
  * Contributors: SuperPWA
9
+ * Version: 2.1.6
10
  * Text Domain: super-progressive-web-apps
11
  * Domain Path: /languages
12
  * License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
43
  * @since 1.0
44
  */
45
  if ( ! defined( 'SUPERPWA_VERSION' ) ) {
46
+ define( 'SUPERPWA_VERSION' , '2.1.6' );
47
  }
48
 
49
  /**