OneSignal-Website-SDK icon indicating copy to clipboard operation
OneSignal-Website-SDK copied to clipboard

Feat/safari 16

Open rgomezp opened this issue 2 years ago • 0 comments

Description

1 Line Summary

Adds support for Safari 16 (VAPID).

Details

Safari 16 is introducing the standard PushAPI that Chrome, Firefox, and other browsers use today.

Safari 16 still supports it’s proprietary “Safari Push Notifications” on macOS, but the standard API is preferred since it supports more features. iOS/iPadOS 16.4 also supports the standard PushAPI. Apple will almost certainly drop the old API for macOS, but it may be a number of years before then so we will continue supporting it. We still want to continue supporting macOS 12.x and older, since it requires end users update to macOS 13 to get it.

Device Type

Introducing device_type: 17 for W3C version of Safari. Since the two Safari push types are fundamentally different, a new device_type value would clearly separate them and would keep things consistent in our system.

Data Purge Problem:

Safari has a 7 day window where after the user doesn’t visit the site, it will purge all data like IndexedDB and localStorage. We introduce a way to detect whether the user was previously subscribed to legacy notifications and avoid creating a second subscription.

iOS Support

With the introduction of web push for Safari on iOS, these changes will also work for that feature. However, it will require the site to host a manifest.json file. This PR updates our sandbox environment with that file.

Systems Affected

  • [x] WebSDK
  • [x] Backend
  • [ ] Dashboard

Validation

Tests

Info

Checklist

  • [x] All the automated tests pass or I explained why that is not possible
  • [x] I have personally tested this on my machine or explained why that is not possible
  • [x] I have included test coverage for these changes or explained why they are not needed

Programming Checklist Interfaces:

  • [x] Don't use default export
  • [x] New interfaces are in model files

Functions:

  • [x] Don't use default export
  • [x] All function signatures have return types
  • [x] Helpers should not access any data but rather be given the data to operate on.

Typescript:

  • [x] No Typescript warnings
  • [x] Avoid silencing null/undefined warnings with the exclamation point

Other:

  • [x] Iteration: refrain from using elem of array syntax. Prefer forEach or use map
  • [x] Avoid using global OneSignal accessor for context if possible. Instead, we can pass it to function/constructor so that we don't call OneSignal.context

Screenshots

Info

Screen Shot 2023-03-06 at 2 19 21 PM Currently Safari 16 does not display the custom icon. This is an upstream limitation.

Checklist

  • [x] I have included screenshots/recordings of the intended results or explained why they are not needed


This change is Reviewable

rgomezp avatar Nov 18 '22 23:11 rgomezp