|
|
@@ -65,7 +65,7 @@ class BxDolPushWonderPush extends BxDolPush
|
|
|
|
|
|
$aFields = [
|
|
|
'accessToken' => $this->_sAcessToken,
|
|
|
- 'targetUserIds' => $iProfileId,
|
|
|
+ 'targetUserIds' => encryptUserId($iProfileId),
|
|
|
];
|
|
|
$aNotification = [
|
|
|
'alert' => [],
|
|
|
@@ -82,27 +82,35 @@ class BxDolPushWonderPush extends BxDolPush
|
|
|
$aNotification['alert']['web']['icon'] = $aMessage['icon'];
|
|
|
|
|
|
$aNotification['alert']['android'] = $aNotification['alert']['android'] ?? [];
|
|
|
- $aNotification['alert']['android']['smallIcon'] = $aMessage['icon'];
|
|
|
- }
|
|
|
+ $aNotification['alert']['android']['largeIcon'] = $aMessage['icon'];
|
|
|
|
|
|
- if('on' == getParam('bx_nexus_option_push_notifications_count')) {
|
|
|
- $iBadgeCount = $this->getNotificationsCount($iProfileId);
|
|
|
$aNotification['alert']['ios'] = $aNotification['alert']['ios'] ?? [];
|
|
|
- $aNotification['alert']['ios']['badge'] = $iBadgeCount;
|
|
|
+ $aNotification['alert']['ios']['attachments'] = ['url' => $aMessage['icon']];
|
|
|
}
|
|
|
|
|
|
if (!empty($sUrlWeb)) {
|
|
|
- $aNotification['alert']['targetUrl'] = $sUrlWeb;
|
|
|
+ $aNotification['alert']['web'] = $aNotification['alert']['web'] ?? [];
|
|
|
+ $aNotification['alert']['web']['targetUrl'] = $sUrlWeb;
|
|
|
|
|
|
$aFields['push'] = $aFields['push'] ?? [];
|
|
|
$aFields['push']['custom'] = $aFields['push']['custom'] ?? [];
|
|
|
$aFields['push']['custom']['url'] = $sUrlWeb;
|
|
|
}
|
|
|
if (!empty($sUrlApp)) {
|
|
|
- // TODO: ??? https://docs.wonderpush.com/reference/notification
|
|
|
+ $aNotification['alert']['ios'] = $aNotification['alert']['ios'] ?? [];
|
|
|
+ $aNotification['alert']['ios']['targetUrl'] = $sUrlApp;
|
|
|
+
|
|
|
+ $aNotification['alert']['android'] = $aNotification['alert']['android'] ?? [];
|
|
|
+ $aNotification['alert']['android']['targetUrl'] = $sUrlApp;
|
|
|
}
|
|
|
|
|
|
- $aFields['notifications'] = json_encode($aNotification);
|
|
|
+ if('on' == getParam('bx_nexus_option_push_notifications_count')) {
|
|
|
+ $iBadgeCount = $this->getNotificationsCount($iProfileId);
|
|
|
+ $aNotification['alert']['ios'] = $aNotification['alert']['ios'] ?? [];
|
|
|
+ $aNotification['alert']['ios']['badge'] = $iBadgeCount;
|
|
|
+ }
|
|
|
+
|
|
|
+ $aFields['notification'] = json_encode($aNotification);
|
|
|
|
|
|
// send request
|
|
|
|
|
|
@@ -123,8 +131,11 @@ class BxDolPushWonderPush extends BxDolPush
|
|
|
|
|
|
$oResult = @json_decode($sResult, true);
|
|
|
|
|
|
+ // bx_log('sys_push', "Payload:" . $aFields, BX_LOG_DEBUG);
|
|
|
+ // bx_log('sys_push', "Result:" . $sResult, BX_LOG_DEBUG);
|
|
|
+
|
|
|
if(isset($oResult['error'])) {
|
|
|
- bx_log('sys_push', $sError . " Message:" . $oResult['error']['message'], BX_LOG_ERR);
|
|
|
+ bx_log('sys_push', "Error message:" . $oResult['error']['message'], BX_LOG_ERR);
|
|
|
}
|
|
|
|
|
|
return $sResult;
|