Support » Plugin: Web Push » Problem with version 1.1.5 and WordPress VIP

  • Resolved iwhitet3

    (@iwhitet3)


    Hi,

    The plugin is not working for me in the following browsers:
    Chrome 49.0.2623.110 (64-bit)
    Chrome 51.0.2700.0 canary (64-bit)
    Firefox 45.0.1
    Safari 9.1 (11601.5.17.1)

    The webpage is completely broken in Safari with web push plugin enabled – appears to be choking on ES6 arrow function syntax:
    [Error] SyntaxError: Unexpected token ')' (anonymous function) (wp-web-push.js:94)

    I am using a WordPress VIP installation and I don’t have access to the wp-content/plugins directory so I’ve installed and activated the plugin via functions.php. I’m currently testing on a stage server with HTTPS. The plugin appears to be active as I can reach the settings page. Also, I created and entered a GCM API Key and Project number in the settings page.

    When I visit the WordPress site, I don’t receive a prompt for to allow push notifications even though it’s set to appear the first time a user visits the site, which prevents me from sending test notifications. Also, the bell icon in the lower right corner of the screen is non functional – nothing happens when it is clicked and I don’t see any errors in the console.

    Please let me know if I can provide any additional information. Thanks.

    https://wordpress.org/plugins/web-push/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Marco Castelluccio

    (@marco-c-1)

    I’ve just released version 1.1.6, which should fix the Safari issue (note that Safari doesn’t support Web Push, so the plugin won’t do anything in Safari).

    Could you test again?

    Is the stage server public? I’d like to debug the issue, it would be easier if I could see your website.

    Thread Starter iwhitet3

    (@iwhitet3)

    Thank you for the quick reply.

    I installed the latest version (1.1.6) and I’m still having the same issues.

    Safari is still showing a syntax error due to the es6 arrow function used in this code:

    (function (global) {
    
        if (global.$swRegistrations) {
            return;
        }
    
        global.$swRegistrations = {};
    
        if ('serviceWorker' in navigator) {
            var enabledSw = [{
                "scope": "\/",
                "url": "\/?_wpswmanager=wpswmanager%2Fsw%2Fsw%40%2F"
            }
            ];
            enabledSw.forEach(entry => {
                var scope = entry.scope;
                var swUrl = entry.url;
                global.$swRegistrations[scope] = navigator.serviceWorker.register(swUrl, {
                    scope: scope
                });
            });
        }
    
    })(window);

    The stage server is no public and I will need to get approval to give you credentials. I’ll have to get back to you on that.

    Thanks.

    Plugin Author Marco Castelluccio

    (@marco-c-1)

    I will update the plugin shortly with a fix for the arrow function usage (it was in a library that the plugin is using).

    Plugin Author Marco Castelluccio

    (@marco-c-1)

    About the other issue, could you describe how you installed the plugin? I want to reproduce exactly the same conditions on my local machine.

    Thread Starter iwhitet3

    (@iwhitet3)

    Sure.
    1) I placed the web-push plugin directory in the theme plugins directory:
    vip-quickstart/www/wp-content/themes/vip/longitudes/plugins

    2) I activated the plugin via functions.php like so:
    require_once( WP_CONTENT_DIR . '/themes/vip/longitudes/plugins/web-push/wp-web-push.php' );

    3) I used the following values in the web push settings menu in the dashboard:

    title: use site title
    icon: use the site icon
    show subscription icon
    automatic prompting: ask the user to register as soon as he visits the site
    interval between prompts: 0
    push triggers: all checked
    google chrome support: Entered GCM API Key and GCM Project Number

    Plugin Author Marco Castelluccio

    (@marco-c-1)

    I was reading the VIP WordPress.com documentation, looks like plugins aren’t allowed to create custom tables (‘The plugin should use the existing database tables and structure (no alterations). Custom post types, custom taxonomies, post meta, etc. are incredibly flexible.’).

    Unfortunately the Web Push plugin requires a table to store information about subscribers.

    Thread Starter iwhitet3

    (@iwhitet3)

    I see. I will pass that along to the client. I appreciate you taking the time to look into the problem.

    Thread Starter iwhitet3

    (@iwhitet3)

    Marking as resolved.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Problem with version 1.1.5 and WordPress VIP’ is closed to new replies.