Iniziata implementazione notifiche firebase

This commit is contained in:
2025-08-25 10:00:41 +02:00
parent 9957229e70
commit 833a1e456f
16 changed files with 244 additions and 2 deletions

View File

@@ -0,0 +1,16 @@
using salesbook.Shared.Core.Interface;
using Shiny;
using Shiny.Push;
namespace salesbook.Maui.Core.System.Notification;
public class FirebaseNotificationService(IPushManager pushManager, IIntegryNotificationRestClient integryNotificationRestClient) : IFirebaseNotificationService
{
public async Task InitFirebase()
{
var (accessState, token) = await pushManager.RequestAccess();
if (accessState == AccessState.Denied || token is null) return;
await integryNotificationRestClient.Register(token);
}
}

View File

@@ -0,0 +1,31 @@
using Shiny.Push;
namespace salesbook.Maui.Core.System.Notification.Push;
public class PushNotificationDelegate : IPushDelegate
{
public Task OnEntry(PushNotification notification)
{
// fires when the user taps on a push notification
return Task.CompletedTask;
}
public Task OnReceived(PushNotification notification)
{
// fires when a push notification is received (silient or notification)
//notification.Data["content-available"] = "1";
return Task.CompletedTask;
}
public Task OnNewToken(string token)
{
// fires when a push notification change is set by the operating system or provider
return Task.CompletedTask;
}
public Task OnUnRegistered(string token)
{
// fires when a push notification change is set by the operating system or provider
return Task.CompletedTask;
}
}