Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]: Migration Guide for v16 #1172

Closed
fresh-avocado opened this issue Apr 29, 2024 · 2 comments
Closed

[Question]: Migration Guide for v16 #1172

fresh-avocado opened this issue Apr 29, 2024 · 2 comments

Comments

@fresh-avocado
Copy link

fresh-avocado commented Apr 29, 2024

How can we help?

A few years ago I configured One Signal in a website. I added the following script tag on all pages:

<script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async />

and I also self-hosted OneSignalSDKWorker.js and OneSignalSDKUpdaterWorker.js. Both have the same file contents:

importScripts("https://cdn.onesignal.com/sdks/OneSignalSDK.js");

According to this migration guide I need to update the script tag to:

<script src="https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js" defer></script>

the contents of OneSignalSDKWorker.js to:

importScripts("https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.sw.js");

and rest of the updates: window.OneSignalDeferred = window.OneSignalDeferred || [] and OneSignalDeferred.push((OneSignal) => ...).

Thus, I have the following questions:

  1. What should happen to OneSignalSDKUpdaterWorker.js?
  2. After I make the necessary updates according to the migration guide, will the push notifications still work for my previous subscribers that used the previous SDK version?
  3. Are there any other things that I need to do in order to update the SDK version, but still make it work for old users?

Thank you in advance for your help! 😁

@jkasten2
Copy link
Member

jkasten2 commented May 2, 2024

@fresh-avocado Thanks for reaching out.

  1. What should happen to OneSignalSDKUpdaterWorker.js?

This file hasn't been used a while (since version 151510, Nov 22, 2021). However since you may have end-user who haven't visited your site since then to be extra safe I would recommend updating the contains of this file to importScripts("https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.sw.js"); as well.

  1. After I make the necessary updates according to the migration guide, will the push notifications still work for my previous subscribers that used the previous SDK version?

yes, pushes will continue to be received and display for all existing subscribers. Even if they don't open your site again after updating.

  1. Are there any other things that I need to do in order to update the SDK version, but still make it work for old users?

No other changes are needed.

@fresh-avocado
Copy link
Author

@jkasten2 thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants