Creata card notifiche

This commit is contained in:
2025-09-09 16:30:51 +02:00
parent dfb86e3cd7
commit 7319378e75
13 changed files with 289 additions and 18 deletions

View File

@@ -1,8 +1,15 @@
using Shiny.Push;
using CommunityToolkit.Mvvm.Messaging;
using salesbook.Shared.Core.Dto.Notification;
using salesbook.Shared.Core.Interface.IntegryApi;
using salesbook.Shared.Core.Messages.Notification;
using Shiny.Push;
namespace salesbook.Maui.Core.System.Notification.Push;
public class PushNotificationDelegate : IPushDelegate
public class PushNotificationDelegate(
IIntegryNotificationRestClient integryNotificationRestClient,
IMessenger messenger
) : IPushDelegate
{
public Task OnEntry(PushNotification notification)
{
@@ -12,14 +19,21 @@ public class PushNotificationDelegate : IPushDelegate
public Task OnReceived(PushNotification notification)
{
// fires when a push notification is received (silient or notification)
//notification.Data["content-available"] = "1";
if (notification.Notification is null) return Task.CompletedTask;
var pushNotification = new PushNotificationDTO
{
Title = notification.Notification.Title,
Message = notification.Notification.Message
};
messenger.Send(new NewPushNotificationMessage(pushNotification));
return Task.CompletedTask;
}
public Task OnNewToken(string token)
{
// fires when a push notification change is set by the operating system or provider
integryNotificationRestClient.Register(token);
return Task.CompletedTask;
}