granam / safari-push-notifications
Creates push package for Apple / Safari web push notifications
Installs: 20
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Type:project
Requires
- php: >=7.0
- ext-zip: *
- granam/strict-object: ^3.0
Requires (Dev)
- granam/exceptions-hierarchy: ~4.0
- mockery/mockery: ~1.0
- phpunit/phpunit: ~6.0
README
Heavily inspired by connorlacombe/Safari-Push-Notifications/.
Flow
On your Javascript command, by calling
pushSafariNotification
(webServiceId,
webServiceUrl,
serverPushUrl, userId, title, text, buttonText)
- browser will check if is Safari of sufficient version (OS X v10.9 and later)
- if user already allowed push notifications
- then push notification is send
- else if user already denied push notifications
- then push notification is not sent (to find out if push notifications can be sent, call JS function
hasUserAllowedPushNotifications
)
- then push notification is not sent (to find out if push notifications can be sent, call JS function
- if user does not YET decided to add or deny permissions to your side to send a push notification, it will
- trigger JS event
safariPushNotificationsPermissionsRequestStart
on window JS object - then asks user for permissions to accept push notifications from your side via Safari build-in layout
- then, if user agreed, Apple will send POST request to
\Granam\Safari\PushPackageController::pushPackages
by calling an URL you set via Apple developer console - then Apple will send user decision to
\Granam\Safari\PushPackageController::devicesRegistrations
by calling an URL you set via Apple developer console - then - if user agreed
- thenJS event
safariPushNotificationsPermissionsJustGranted
is triggered on window object - then push notification is send- else if user declined, then JS event
safariPushNotificationsPermissionsJustDenied
is triggered on window object and push notification is not sent
- else if user declined, then JS event
- then, if user agreed, Apple will send POST request to
- then JS event
safariPushNotificationsPermissionsRequestEnd
is triggered on window object
- trigger JS event