diff --git a/driver/Fcm.php b/driver/Fcm.php index 3bf4581..cf71280 100644 --- a/driver/Fcm.php +++ b/driver/Fcm.php @@ -5,7 +5,6 @@ use humhub\modules\fcmPush\components\SendReport; use humhub\modules\fcmPush\models\ConfigureForm; use humhub\modules\fcmPush\Module; -use humhub\modules\notification\models\Notification as NotificationHumHub; use Kreait\Firebase\Contract\Messaging; use Kreait\Firebase\Exception\FirebaseException; use Kreait\Firebase\Exception\MessagingException; @@ -34,7 +33,7 @@ public function processCloudMessage(array $tokens, string $title, string $body, } $message = CloudMessage::new() - ->withNotification(Notification::create($title, $body)) + ->withNotification(Notification::create($title, $body, $imageUrl)) ->withWebPushConfig(['fcm_options' => ['link' => $url]]) ->withData(['url' => $url, 'notification_count' => $notificationCount]); diff --git a/driver/FcmLegacy.php b/driver/FcmLegacy.php index 63bcf8e..d32a62c 100644 --- a/driver/FcmLegacy.php +++ b/driver/FcmLegacy.php @@ -3,10 +3,9 @@ namespace humhub\modules\fcmPush\driver; use humhub\modules\fcmPush\components\SendReport; -use humhub\modules\web\pwa\widgets\SiteIcon; +use humhub\modules\fcmPush\models\ConfigureForm; use Yii; use yii\httpclient\Client; -use humhub\modules\fcmPush\models\ConfigureForm; class FcmLegacy extends Client implements DriverInterface { @@ -34,13 +33,13 @@ public function processCloudMessage(array $tokens, string $title, string $body, "notification" => [ "title" => $title, "body" => $body, - "icon" => SiteIcon::getUrl(180), + "icon" => $imageUrl, "click_action" => $url, ], "data" => [ "title" => $title, "body" => $body, - "icon" => SiteIcon::getUrl(180), + "icon" => $imageUrl, "url" => $url, ], "registration_ids" => $tokens, diff --git a/driver/Proxy.php b/driver/Proxy.php index ac903ed..c78f317 100644 --- a/driver/Proxy.php +++ b/driver/Proxy.php @@ -3,12 +3,10 @@ namespace humhub\modules\fcmPush\driver; use humhub\modules\fcmPush\components\SendReport; +use humhub\modules\fcmPush\models\ConfigureForm; use humhub\modules\fcmPush\Module; -use humhub\modules\notification\models\Notification; -use humhub\modules\web\pwa\widgets\SiteIcon; use Yii; use yii\httpclient\Client; -use humhub\modules\fcmPush\models\ConfigureForm; class Proxy extends Client implements DriverInterface { @@ -35,8 +33,7 @@ public function processCloudMessage(array $tokens, string $title, string $body, 'tokens' => $tokens, 'title' => $title, 'body' => $body, - 'imageUrl' => $imageUrl, - 'iconUrl' => SiteIcon::getUrl(180), + 'iconUrl' => $imageUrl, 'url' => $url, 'notificationCount' => $notificationCount, ]; diff --git a/services/MessagingService.php b/services/MessagingService.php index 401c9af..cf0372f 100644 --- a/services/MessagingService.php +++ b/services/MessagingService.php @@ -30,7 +30,7 @@ public function processNotification(BaseNotification $baseNotification, User $us Yii::$app->name, $baseNotification->text(), Url::to(['/notification/entry', 'id' => $baseNotification->record->id], true), - null, + SiteIcon::getUrl(180), NotificationHumHub::findUnseen($user)->count(), ); }