Skip to content

Commit

Permalink
Fix: Firefox on Android
Browse files Browse the repository at this point in the history
Workaround for this issue: web-push-libs/web-push-php#108
  • Loading branch information
mpw-wwu committed Oct 22, 2019
1 parent d4cde45 commit 8e70e10
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion application/Model/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,13 @@ private function execPushNotifications() {
if ($stmt->rowCount() > 0) {
error_log('Datenbankeinträge Push-Subscriptions: ' . $stmt->rowCount());

$webPush = new WebPush($push_auth);
$notifications = array();
foreach ($stmt->fetchAll() as $row) {
error_log('Push-Sub: ' . $row['endpoint']);
if (strpos($row['endpoint'], 'mozilla') > 0) {
$webPush->setAutomaticPadding(0);
}
$notifications[] = [
'subscription' => Subscription::create([
'endpoint' => $row['endpoint'],
Expand All @@ -514,7 +518,6 @@ private function execPushNotifications() {
error_log('payload: ' . $notifications[sizeof($notifications)-1]['payload']);
}

$webPush = new WebPush($push_auth);
foreach ($notifications as $notification) {
$webPush->sendNotification($notification['subscription'], $notification['payload']);
}
Expand Down

0 comments on commit 8e70e10

Please sign in to comment.