Push Notifications

Started by vbgamer45, February 01, 2019, 05:29:54 AM

Previous topic - Next topic

vbgamer45

Link to the mod

For SMF 2.0.x and SMF 1.1.x

Adds push notifications for Chrome and Firefox using the OneSignal api.
Works for replies and adds support for the following mods
Awesome Post Ratings
@Mentions Mod
Who Quoted Me

Requires an OneSignal account and cURl support for PHP


Install Information:
Install via the SMF's Package Manager via upload package.


############################################
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

pocttopus

Interesting feature... these notifications were missing for SMF.
But where is Who Quoted Me mod?  ???

Mick.

Bro, very cool. I was just thinking about this the other day as I noticed a few websites prompted me with a small popup if I wanted to be notified. Interesting, Im going to try this and see whats up  ;)

Arantor

Quote from: pocttopus on February 01, 2019, 06:56:33 AM
Interesting feature... these notifications were missing for SMF.
But where is Who Quoted Me mod?  ???

SMF 2.1 can do this but not with push notifications. Though I love how your first reaction is not "oh, a cool new thing" but essentially a criticism.


pocttopus

Quote from: Arantor on February 01, 2019, 07:40:43 AM
Quote from: pocttopus on February 01, 2019, 06:56:33 AM
Interesting feature... these notifications were missing for SMF.
But where is Who Quoted Me mod?  ???

SMF 2.1 can do this but not with push notifications. Though I love how your first reaction is not "oh, a cool new thing" but essentially a criticism.
I had tried to use 2.1 but only on localhost and that's not the real feeling how 2.1 behaves comparing to 2.0.15 which is our current version on our community, so I did not noticed that quote notifications are implemented on 2.1. :-\
I had no intention to write criticism, I was just curious about the mods which are supported by "push notifications".  :)

Quote from: Shambles on February 01, 2019, 07:46:24 AM
Quote from: pocttopus on February 01, 2019, 06:56:33 AM
But where is Who Quoted Me mod?  ???

It's an SMFHACKS mod:    https://www.smfhacks.com/index.php?topic=9724.0
Thanks!  ;)

-Rock Lee-

Great, that's what I was looking for. Now to test it on a test site and see if it's what I need... Thank you for your work @vbgamer45!


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

vbgamer45

The who quoted mod is in the approval process as well.

I originally did the push notifications system for create a forum but then realized the service I used did not support wildcard dns subdomains without having it setup for each.

I can add some more notifications and toggles to turn then on and off depending on feedback.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Mick.

Hey bro, whats' the difference between your mod and this tiny script you can add into the index.template in the <head> section taken from their website?  :o

<link rel="manifest" href="/manifest.json" />
<script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async=""></script>
<script>
  var OneSignal = window.OneSignal || [];
  OneSignal.push(function() {
    OneSignal.init({
      appId: "**********************************",
    });
  });
</script>

vbgamer45

That is a base script. That script doesn't track members. You can't do mass messages though their backend.
Doesn't have subscribe,unsubscribe options via html.  And you wouldn't be able to receive alerts if someone replied to your topic.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Mick.

Quote from: vbgamer45 on February 02, 2019, 08:48:55 AM
That is a base script. That script doesn't track members. You can't do mass messages though their backend.
Doesn't have subscribe,unsubscribe options via html.  And you wouldn't be able to receive alerts if someone replied to your topic.
Oh right on. Even better, I'm giving it a whirl

vbgamer45

Have some fun with it maybe you can make it look nicer. I am backend developer so I just try to build out the core functions.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Shambles

Hmm might have a play with this mod - thanks for making it available.

I manually installed the code from OneSignal and it seems quite accurate with its stats, plus the instant messaging is decent.

Shambles

The mod installs the .js files into $boarddir but the code is looking in the website root for them:

QuoteFailed to register/update a ServiceWorker for scope 'https://www.i30ownersclub.com/': Load failed with status 404 for script 'https://www.i30ownersclub.com/OneSignalSDKWorker.js?appId=5212**********************202d'

$boarddir for me is https://www.i30ownersclub.com/forum/

Guess I'll just move the files up a level...

vbgamer45

Yeah forgot about people in subfolders.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Shambles

I've moved the three files up to the root but not a great deal is happening (no further errors in the console though).

Question:

Both the .js files contain the same importScripts command. Is this by design?

importScripts('https://cdn.onesignal.com/sdks/OneSignalSDKWorker.js');

vbgamer45

Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Shambles

Just trying to work out why nothing happens when the mod is installed (ie, messages aren't received, notifications not requested).

Does the mod not require a manifest.json file?

vbgamer45

Requires manifest.json

cURL needs to be installed.

After you click the subscribe to notifications in your user account and some replies. You should get a push notification in your browser. Tested on firefox and chrome.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Shambles

I can see the manifest is built by the mod, just wondered if it needed <link rel="manifest" href="/manifest.json" />

When I inserted the OneSignal code manually in my index.template.php the whole thing worked perfectly.


Advertisement: