Closed bmulholland closed 1 year ago
@bmulholland Thanks for reporting this issue. We recently released a major release and missed updating this documentation page. An update is going out shortly to fix the documentation.
In the meantime the replacement method for OneSignal.showNativePrompt()
is OneSignal.Notifications.requestPermission()
Also I can say this page is updated with the latest SDK API: https://documentation.onesignal.com/docs/web-sdk#enabling-a-push-subscription
Well no, actually, that isn't a replacement. In Firefox, that has a hardcoded requirement to show the slidedown prompt, which I don't want -- we already have a soft opt-in, so the user has just fulfilled Firefox's interaction requirement.
Oh and actually, with my settings, the slidedown prompt is disabled, so just nothing happens in Firefox...
Honestly this is like the third or fourth time I'm digging into the library code to detect basic bugs. This should never have been released like this.
I've patched it for now with:
window.OneSignalDeferred?.push((OneSignal) => {
OneSignal.context.promptsManager.internalShowNativePrompt()
})
What happened?
error: $OneSignal.showNativePrompt is not a function
What browsers are you seeing the problem on?
Firefox, Chrome (Chromium)
What operating system are you running?
latest macos
Steps to reproduce?
docs say https://documentation.onesignal.com/docs/native-browser-prompt#custom-code-native-prompt
so do nuxtApp.$OneSignal.showNativePrompt
What did you expect to happen?
-
Relevant log output
No response