-
Notifications
You must be signed in to change notification settings - Fork 115
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
Feat/safari vapid #1002
Merged
Merged
Feat/safari vapid #1002
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rgomezp
approved these changes
Mar 10, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one comment, otherwise LGTM
jkasten2
force-pushed
the
feat/safari-vapid
branch
from
March 13, 2023 18:23
33b703b
to
2d2c688
Compare
corrected types and names based on Apple's docs and confirmed with testing
This clears up any confusion between the two Safari enums.
Add global methods other parts of the SDK an use to know which Push JS API should be used for Safari. These will allow use to easily change the logic later if we want to prefer VAPID over the window.safari API later.
Use the new "use*" Safari functions we added in the last commit to select the delivery platform. For context, this maps to player.device_type when a network call is made as well as few other parts of the SDK.
This isn't a substitute for testing on iOS, but this can help improve development speed as tweaks can be made faster.
window is not available in a ServiceWorker context. Also Legacy push API is not available in the ServiceWorker context anyway.
jkasten2
force-pushed
the
feat/safari-vapid
branch
from
March 13, 2023 18:29
2d2c688
to
33bde6a
Compare
Merged
jkasten2
added a commit
that referenced
this pull request
Jul 26, 2023
Corrected missing logic changes that PR #1002 introduced in main but were not accounted for in the last rebase. Tested on masOS 13.3.1 with Safari 16.4 to confirm the browser subscribes to push correctly with the backend.
13 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
One Line Summary
Add support for Safari browsers that only support the VAPID PushAPI (iOS), Legacy Safari push will continue to be preferred where it is available (macOS).
Details
Validation
Tests
macOS 13.1 with Safari 16.2
window.safari = undefined
to simulate an iOS WebApp env, ensured it used VAPID push and received pushesdelete PushSubscriptionOptions
to simulate Safari on pre-macOS13, ensured it subscribed and received notificationsiOS 16.4 beta 3
macOS 12.6.3 with Safari 15.6.1
Windows 11 22H2 Chrome 110.0.5481.105
Checklist
Programming Checklist
Interfaces:
Functions:
Typescript:
Other:
elem of array
syntax. PreferforEach
or usemap
context
if possible. Instead, we can pass it to function/constructor so that we don't callOneSignal.context
Screenshots
Info
Checklist
Related Tickets
Due to Safari on macOS 13+ bugs we are holding off on PR #930, which attempted to use VAPID by default and migrate existing Legacy Safari players to it.
This also resolves issue "Chrome Desktop with Dev iOS View - TypeError: Cannot read property 'pushNotification' of undefined" #560
This change is