Resource icon

XenForo OneSignal Push Notifications - Now With Simple Install 1.1.11.2

No permission to download

Dan18

Fan
Joined
Jun 9, 2014
Messages
772
So what i did was wrote a script via cronjob which will check the local copy file date and compare with cdn copies date and only download a new copy to overwrite the local copy. This way i can keep local copy always updated :)
I tired using this PHP script here: https://www.keycdn.com/blog/leverage-browser-caching/
To grab:
https://cdn.onesignal.com/sdks/OneSignalSDK.js
and
https://github.com/OneSignal/OneSignal-Website-SDK/raw/master/dist/OneSignalSDK.js

But it didn't work.

Script just return this:
Code:
<html>
<head><title>302 Found</title></head>
<body bgcolor="white">
<center><h1>302 Found</h1></center>
<hr><center>nginx/1.4.6 (Ubuntu)</center>
</body>
</html>
 

Mouth

Enthusiast
Joined
Oct 3, 2009
Messages
199
Users tell me that their Facebook subscribed web pushes auto fade/disappear after ~30secs, but the site ones delivered through OneSignal remain until clicked to close. Can we have our auto fade/close too?
 

Mouth

Enthusiast
Joined
Oct 3, 2009
Messages
199
Users tell me that their Facebook subscribed web pushes auto fade/disappear after ~30secs, but the site ones delivered through OneSignal remain until clicked to close. Can we have our auto fade/close too?
Ahh, I see. ....

"On Firefox and Safari, notifications are automatically dismissed after a short amount of time. On Chrome, by default, notifications last indefinitely (they are displayed until the user interacts with it by dismissing it or clicking it). On Chrome Desktop v47+, you can add a parameter to control whether a notification is displayed indefinitely or dismissed after ~20 seconds." Ref: https://documentation.onesignal.com/v3.0/docs/web-push-sdk-setup-http

I modified template onesignal_js from;
Code:
        var OneSignal = OneSignal || [];
        OneSignal.push(
          ["init", {
            appId: "{$xenOptions.os_pn_app_id}",
            safari_web_id: '{$xenOptions.os_pn_safari_key}',
... to ...
Code:
        var OneSignal = OneSignal || [];
        OneSignal.push(
          ["init", {
            persistNotification: false, // Automatically dismiss the notification after ~20 seconds in Chrome Desktop v47+
            appId: "{$xenOptions.os_pn_app_id}",
            safari_web_id: '{$xenOptions.os_pn_safari_key}',

So that this add-on for my site would also auto dismiss/close the notification.

I'd like to request/recommend a tickbox ACP option @ /admin.php?options/list/onesignal_pn for this functionality to be on or off.
 

pierce

Habitué
Joined
Apr 10, 2016
Messages
1,165
These are excellent suggestions to add to the product.

I'm currently going on holidays tomorrow so don't have much time over the next week.

It's been busy over the last few weeks as well and i am glad i pushed on the project when i had the time to do so.

Also need to look at porting to xf2. Which means i may leave multi language support out of xf1.5 until xf2 version is done. Till then alerts.php under model can be edited directly for the main language of the forum.

Xf2 is important because we all need to keep moving forward and a lot of forums have adapted this modification which means they possibly have become reliant on it. Which puts a lot responsibility on me.
 

Mouth

Enthusiast
Joined
Oct 3, 2009
Messages
199
Admin and Moderators (only?) are getting a push notification of "This site has been updated.." quite regularly. What is this?
 

pierce

Habitué
Joined
Apr 10, 2016
Messages
1,165
I don't have that as text in any alert.

I wonder is the page title (any threads called this site...) over riding the notifications text?
 

R0binHood

Habitué
Joined
Nov 23, 2011
Messages
1,606
Check this out, on Chrome 56 onwards you can include a large image below the notification.

https://documentation.onesignal.com/v3.0/docs/web-push-notification-icons

It could potentially be neat if a post had an attached image, it included it in the notification. Or perhaps if someone uploaded an image to the gallery. I'm not sure if that would be annoying or not. Good to know it's an option though, could be useful for manually sent notifications by admins to make them stand out.
 

Mouth

Enthusiast
Joined
Oct 3, 2009
Messages
199
I don't have that as text in any alert.

I wonder is the page title (any threads called this site...) over riding the notifications text?
The exact text is "This site has been upgraded in the backgrou..". When I tap on the notification (Android) nothing happens.

No page title or any threads with similiar or exact text
 

R0binHood

Habitué
Joined
Nov 23, 2011
Messages
1,606
I'm having an issue with Chrome notifications, they don't seem to be working for me.

They haven't for a few weeks, but I figured it might just be my computer. Got around to doing some testing this morning, FF and Safari still work great.

I went to the OneSignal site, found my multiple users for Chrome and Safari in the 'All Users' tab (couldn't find my FF user though for some reason, it doesn't help you can't search the 'Tag' field which has all the forum user IDs and usernames in it)

Added those users to a test group and proceeded to do some manual testing to my account sending the notifications from the OneSignal ACP.

The FF and Safari ones are working great, getting an error with Chrome though and get an invalid response

upload_2017-4-25_11-36-18.png


I double checked my XF ACP Options and keys seem fine. I tried resetting my REST API key just in case, but no luck.

I sent them a message on Intercom to see if they can help.

Anyone else having issues on Chrome?
 

pierce

Habitué
Joined
Apr 10, 2016
Messages
1,165
Gcm id?
I'm having an issue with Chrome notifications, they don't seem to be working for me.

They haven't for a few weeks, but I figured it might just be my computer. Got around to doing some testing this morning, FF and Safari still work great.

I went to the OneSignal site, found my multiple users for Chrome and Safari in the 'All Users' tab (couldn't find my FF user though for some reason, it doesn't help you can't search the 'Tag' field which has all the forum user IDs and usernames in it)

Added those users to a test group and proceeded to do some manual testing to my account sending the notifications from the OneSignal ACP.

The FF and Safari ones are working great, getting an error with Chrome though and get an invalid response

View attachment 46592


I double checked my XF ACP Options and keys seem fine. I tried resetting my REST API key just in case, but no luck.

I sent them a message on Intercom to see if they can help.

Anyone else having issues on Chrome?
 

pierce

Habitué
Joined
Apr 10, 2016
Messages
1,165
https://github.com/OneSignal/OneSignal-Website-SDK/issues/60 appears to discuss/address this issue, but I'm not skilled enough with JS development and service workers to understand it deeply enough to determine how it might apply to my scenario. Any pointers?

I see your comment on github.

You can remove the Google example service worker.

The requirement is /any/ service worker and Onesignal qualifies for that.
 

R0binHood

Habitué
Joined
Nov 23, 2011
Messages
1,606
Ahh sorry, I've just gone back and caught up with the thread.

I updated it and still doesn't seem to work :(

I didn't have a secure hash setup either, I followed your instructions earlier in the thread and created a 128 character password as a hash, and enabled security.

What's the security all about anyway?

I pinged OneSignal a message about my latest edit, perhaps they'll issue me a new one like someone else in the thread. Will see what they say.

Ahh, I see. ....

"On Firefox and Safari, notifications are automatically dismissed after a short amount of time. On Chrome, by default, notifications last indefinitely (they are displayed until the user interacts with it by dismissing it or clicking it). On Chrome Desktop v47+, you can add a parameter to control whether a notification is displayed indefinitely or dismissed after ~20 seconds." Ref: https://documentation.onesignal.com/v3.0/docs/web-push-sdk-setup-http

I modified template onesignal_js from;
Code:
        var OneSignal = OneSignal || [];
        OneSignal.push(
          ["init", {
            appId: "{$xenOptions.os_pn_app_id}",
            safari_web_id: '{$xenOptions.os_pn_safari_key}',
... to ...
Code:
        var OneSignal = OneSignal || [];
        OneSignal.push(
          ["init", {
            persistNotification: false, // Automatically dismiss the notification after ~20 seconds in Chrome Desktop v47+
            appId: "{$xenOptions.os_pn_app_id}",
            safari_web_id: '{$xenOptions.os_pn_safari_key}',

So that this add-on for my site would also auto dismiss/close the notification.

I'd like to request/recommend a tickbox ACP option @ /admin.php?options/list/onesignal_pn for this functionality to be on or off.

Option to fade it out on Chrome would be nice.

I just noticed that the Firefox notification seems to make a noise too. It would be good to have a user preference to enable/disable alert sounds. Not sure if that's a setting that you could be user configured though.
 

R0binHood

Habitué
Joined
Nov 23, 2011
Messages
1,606
Weirdly I set this up on another forum last week and it's using 380462037497 just grand on Chrome.
 

R0binHood

Habitué
Joined
Nov 23, 2011
Messages
1,606
Got my first reply, they're telling me that the one account I've been trying to fix on the forum (mine) was signed up under a different GCM number.

So I need to delete that user from the dashboard, reset by browser and sign up as a new user.

Obviously that's just one account though.

The GCM for the add on was whatever it's been since the beginning, then perhaps it got changed? Then I changed it again today...

Waiting to hear back about how to ensure everyone is signed up using the right number, but I'm concerned he's going to come back and say that there's going to be a mix mash of users signed up under different GCM numbers and the only way to fix it will be for them to resubscribe after resetting their browser cache. As if that's going to happen...

Fingers crossed there's a way to sort it on the back end.
 
Joined
Apr 29, 2011
Messages
566
pierce

I used gonative.io to create an app for one of my sites and paid their license for premium push notifications, which uses OneSignal.

They configured my Android and iOS apps to use the same OneSignal app ID as I use for web push notifications using your addon, but I'm not getting notifications via the apps.

Should I have expected this, or would you expect your addon push notifications irrespective of the platform assuming the delivery part is configured correctly?
 

pierce

Habitué
Joined
Apr 10, 2016
Messages
1,165
How does the app work?

Can the app create/use tags?
 
Top