Implementate notifiche

This commit is contained in:
2025-09-09 11:43:07 +02:00
parent 54be40518a
commit dfb86e3cd7
36 changed files with 338 additions and 33 deletions

View File

@@ -1,16 +1,37 @@
using salesbook.Shared.Core.Interface;
using salesbook.Shared.Core.Interface.IntegryApi;
using Shiny;
using Shiny.Notifications;
using Shiny.Push;
namespace salesbook.Maui.Core.System.Notification;
public class FirebaseNotificationService(IPushManager pushManager, IIntegryNotificationRestClient integryNotificationRestClient) : IFirebaseNotificationService
public class FirebaseNotificationService(
IPushManager pushManager,
IIntegryNotificationRestClient integryNotificationRestClient,
INotificationManager notificationManager
) : IFirebaseNotificationService
{
public async Task InitFirebase()
{
var (accessState, token) = await pushManager.RequestAccess();
CreateNotificationChannel();
var (accessState, token) = await pushManager.RequestAccess();
if (accessState == AccessState.Denied || token is null) return;
await integryNotificationRestClient.Register(token);
}
private void CreateNotificationChannel()
{
var channel = new Channel
{
Identifier = "salesbook_push",
Description = "Notifiche push di SalesBook",
Importance = ChannelImportance.High,
Actions = []
};
notificationManager.AddChannel(channel);
}
}