Migliorata gestione e visualizzazione notifiche

This commit is contained in:
2025-09-12 15:42:56 +02:00
parent b798b01da0
commit 223e74c490
20 changed files with 229 additions and 60 deletions

View File

@@ -6,12 +6,14 @@
@using salesbook.Shared.Core.Messages.Activity.Copy
@using salesbook.Shared.Core.Messages.Activity.New
@using salesbook.Shared.Core.Messages.Contact
@using salesbook.Shared.Core.Messages.Notification
@using salesbook.Shared.Core.Messages.Notification.Loaded
@using salesbook.Shared.Core.Messages.Notification.NewPush
@inject IDialogService Dialog
@inject IMessenger Messenger
@inject CopyActivityService CopyActivityService
@inject NewPushNotificationService NewPushNotificationService
@inject NotificationState Notification
@inject NotificationsLoadedService NotificationsLoadedService
<div class="container animated-navbar @(IsVisible ? "show-nav" : "hide-nav") @(IsVisible ? PlusVisible ? "with-plus" : "without-plus" : "with-plus")">
<nav class="navbar @(IsVisible ? PlusVisible ? "with-plus" : "without-plus" : "with-plus")">
@@ -68,8 +70,7 @@
protected override Task OnInitializedAsync()
{
CopyActivityService.OnCopyActivity += async dto => await CreateActivity(dto);
NewPushNotificationService.OnNotificationReceived += NewNotificationReceived;
InitMessage();
NavigationManager.LocationChanged += (_, args) =>
{
@@ -117,4 +118,11 @@
Notification.ReceivedNotifications.Add(notification);
InvokeAsync(StateHasChanged);
}
private void InitMessage()
{
CopyActivityService.OnCopyActivity += async dto => await CreateActivity(dto);
NewPushNotificationService.OnNotificationReceived += NewNotificationReceived;
NotificationsLoadedService.OnNotificationsLoaded += () => InvokeAsync(StateHasChanged);
}
}