Iniziata implementazione notifiche firebase
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user