push messages on PWA
Now that iOS finally supports them.
Wie bauen wir das in interkit ein? Angeblich funktioniert es genauso wie im Desktop Safari und überall auch.
Oder macht Capacitor das schon?
Bei Test auf iOS ging es nicht. Evtl habe ich es selbst mit dieser Abfrage zerstört:
const isPushNotificationsAvailable = () => {
return Capacitor.isPluginAvailable('PushNotifications');
}
aber haben wir einen push server?
siehe z.b. https://www.heise.de/blog/Web-Push-und-Badging-in-iOS-16-4-Beta-1-Mega-Update-fuer-Progressive-Web-Apps-7518359.html und https://webkit.org/blog/13878/web-push-for-web-apps-on-ios-and-ipados/
achtung, muss noch evtl als beta feature aktiviert werden:
How to enable Push API While waiting for IOS 16 you can turn on Push API on your iPhone by going to Settings, typing Safari in search, click on Safari, scroll all the way down and go to Advanced and tap on Experimental Features. Now scroll down to where it says "Push API", and enable it by tapping on green switch button to turn it on.
hier eine implementierung von web push: https://dzone.com/articles/pwa-push-notifications-in-javascript-yes-you-can-in-12-steps
-
proof of concept / mwe browser, android, ios -
build into interkit server -
api endpoint(s): register, unregistercomm via InterkitClient -
backend: save registration, handle next to FCM push
-
-
frontend: permission asking browser/ios/android -
make a testing/debug component: -
show "yes this is a PWA which can receive push notifications" - like, https? css check for
standalone
? listen for installed event? - "interkit server has a registration token for your device"
- like, https? css check for
-
button: send me a test notification - unregister button?
-
-
customize sound etc -
documentation (general, install (credentials))
-
do not Notify when tab is visible?
-
safari/ios: didnt get/send webpushsubscription, maybe because doesnt ask for permissions? have to do it explicitly? -
quick test android -
firefox+chromes linux desktop: "activate" button doesn't do anything -
notifications seem to arrive for domain (not project), is this the only way? how do others do it? -
desktop browsers seem weird, disable completely, allow only android/ios?
-
current WIP
do not Notify when tab is visible?
looks like SW Works on Android13self.addEventListener('push')
never fires, so it can't be prevented by BroadcastChannel stuff.
Why is that? Is something missing? Was the SW cookbook out of date?
If this is correct, we'll have to prevent serverside (heartbeat)?
-
iOS still doesn't work. no idea why. push event in SW doesnt arrive. -
ignoreable: auto title doesnt work -
TODO: click on notification does nothing. need to explicitly handle? see https://stackoverflow.com/questions/38713685/how-can-i-initiate-a-pwa-progressive-webapp-open-from-a-click-on-a-push-notifi