Advertisement:

Author Topic: Push Notifications  (Read 4662 times)

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 21,673
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Push Notifications
« on: February 01, 2019, 05:29:54 AM »
Link to Mod

For SMF 2.0.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

Offline pocttopus

  • Jr. Member
  • **
  • Posts: 357
  • Low pressure
    • @pocttopus on Twitter
Re: Push Notifications
« Reply #1 on: February 01, 2019, 06:56:33 AM »
Interesting feature... these notifications were missing for SMF.
But where is Who Quoted Me mod?  ???

Offline Mick.

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,077
  • Gender: Male
    • idesignSMF on Facebook
    • @idesign360 on Twitter
    • idesignSMF.com
Re: Push Notifications
« Reply #2 on: February 01, 2019, 07:21:47 AM »
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  ;)

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,982
    • StoryBB/StoryBB on GitHub
Re: Push Notifications
« Reply #3 on: February 01, 2019, 07:40:43 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.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Shambles

  • SMF Hero
  • ******
  • Posts: 5,209
  • Gender: Male
    • i30 Owners Club
Re: Push Notifications
« Reply #4 on: February 01, 2019, 07:46:24 AM »

Offline pocttopus

  • Jr. Member
  • **
  • Posts: 357
  • Low pressure
    • @pocttopus on Twitter
Re: Push Notifications
« Reply #5 on: February 01, 2019, 08:35:10 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".  :)

But where is Who Quoted Me mod?  ???

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

Offline Rock Lee

  • Native Language Support Specialist
  • SMF Hero
  • *
  • Posts: 3,033
  • Gender: Male
  • I also speak english :D
    • BomberCode.Oficial on Facebook
    • RockLee-BC on GitHub
    • @Bomber_Code on Twitter
    • Bomber Code ~ La nueva era del conocimiento
Re: Push Notifications
« Reply #6 on: February 01, 2019, 09:48:23 AM »
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 © 2018
Ayudas - Aportes - Tutoriales - Y mucho mas!!!


Ayudame via PayPal

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 21,673
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Push Notifications
« Reply #7 on: February 01, 2019, 09:57:39 AM »
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

Offline Mick.

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,077
  • Gender: Male
    • idesignSMF on Facebook
    • @idesign360 on Twitter
    • idesignSMF.com
Re: Push Notifications
« Reply #8 on: February 01, 2019, 11:39:20 PM »
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

Code: [Select]
<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>

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 21,673
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Push Notifications
« Reply #9 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.
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

Offline Mick.

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,077
  • Gender: Male
    • idesignSMF on Facebook
    • @idesign360 on Twitter
    • idesignSMF.com
Re: Push Notifications
« Reply #10 on: February 02, 2019, 08:54:22 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

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 21,673
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Push Notifications
« Reply #11 on: February 02, 2019, 09:08:58 AM »
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

Offline Shambles

  • SMF Hero
  • ******
  • Posts: 5,209
  • Gender: Male
    • i30 Owners Club
Re: Push Notifications
« Reply #12 on: February 02, 2019, 10:05:53 AM »
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.

Offline Shambles

  • SMF Hero
  • ******
  • Posts: 5,209
  • Gender: Male
    • i30 Owners Club
Re: Push Notifications
« Reply #13 on: February 02, 2019, 10:56:58 AM »
The mod installs the .js files into $boarddir but the code is looking in the website root for them:

Quote
Failed 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...

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 21,673
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Push Notifications
« Reply #14 on: February 02, 2019, 11:09:37 AM »
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

Offline Shambles

  • SMF Hero
  • ******
  • Posts: 5,209
  • Gender: Male
    • i30 Owners Club
Re: Push Notifications
« Reply #15 on: February 02, 2019, 11:13:31 AM »
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?

Code: [Select]
importScripts('https://cdn.onesignal.com/sdks/OneSignalSDKWorker.js');

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 21,673
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Push Notifications
« Reply #16 on: February 02, 2019, 11:18:34 AM »
I believe so
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

Offline Shambles

  • SMF Hero
  • ******
  • Posts: 5,209
  • Gender: Male
    • i30 Owners Club
Re: Push Notifications
« Reply #17 on: February 02, 2019, 11:44:27 AM »
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?

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 21,673
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Push Notifications
« Reply #18 on: February 02, 2019, 11:46:03 AM »
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

Offline Shambles

  • SMF Hero
  • ******
  • Posts: 5,209
  • Gender: Male
    • i30 Owners Club
Re: Push Notifications
« Reply #19 on: February 02, 2019, 11:53:07 AM »
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.