Update: 2026-05-08 14:29:22
This commit is contained in:
@@ -33,7 +33,7 @@ class NotificationService
|
||||
$stmt = $db->prepare("SELECT push_token FROM user_devices WHERE user_id = ? AND device_fingerprint = ? AND push_token IS NOT NULL");
|
||||
$stmt->execute([$userId, $deviceId]);
|
||||
} else {
|
||||
$stmt = $db->prepare("SELECT push_token FROM user_devices WHERE user_id = ? AND push_token IS NOT NULL AND is_active = 1");
|
||||
$stmt = $db->prepare("SELECT push_token FROM user_devices WHERE user_id = ? AND push_token IS NOT NULL");
|
||||
$stmt->execute([$userId]);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ class NotificationService
|
||||
$stmt = $db->prepare("SELECT push_token FROM user_devices WHERE user_id = ? AND device_fingerprint = ? AND push_token IS NOT NULL");
|
||||
$stmt->execute([$userId, $deviceId]);
|
||||
} else {
|
||||
$stmt = $db->prepare("SELECT push_token FROM user_devices WHERE user_id = ? AND push_token IS NOT NULL AND is_active = 1");
|
||||
$stmt = $db->prepare("SELECT push_token FROM user_devices WHERE user_id = ? AND push_token IS NOT NULL");
|
||||
$stmt->execute([$userId]);
|
||||
}
|
||||
|
||||
@@ -130,6 +130,31 @@ class NotificationService
|
||||
],
|
||||
],
|
||||
];
|
||||
} else {
|
||||
// Silent push / Live Activity Update
|
||||
$message['android'] = [
|
||||
'priority' => 'high'
|
||||
];
|
||||
$message['apns'] = [
|
||||
'headers' => [
|
||||
'apns-priority' => '5',
|
||||
'apns-push-type' => 'background'
|
||||
],
|
||||
'payload' => [
|
||||
'aps' => [
|
||||
'content-available' => 1
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
// If the data contains live activity update markers, adjust headers for iOS ActivityKit
|
||||
if (isset($data['type']) && $data['type'] === 'batch_progress') {
|
||||
$message['apns']['headers']['apns-push-type'] = 'liveactivity';
|
||||
$message['apns']['headers']['apns-priority'] = '10';
|
||||
$message['apns']['payload']['aps']['content-state'] = $data;
|
||||
$message['apns']['payload']['aps']['timestamp'] = time();
|
||||
$message['apns']['payload']['aps']['event'] = 'update';
|
||||
}
|
||||
}
|
||||
|
||||
$payload = ['message' => $message];
|
||||
|
||||
Reference in New Issue
Block a user