|
|
@ -20,23 +20,16 @@ using INotificationManager = DesktopNotifications.INotificationManager; |
|
|
|
namespace StabilityMatrix.Avalonia.Services; |
|
|
|
namespace StabilityMatrix.Avalonia.Services; |
|
|
|
|
|
|
|
|
|
|
|
[Singleton(typeof(INotificationService))] |
|
|
|
[Singleton(typeof(INotificationService))] |
|
|
|
public class NotificationService : INotificationService, IDisposable |
|
|
|
public class NotificationService(ILogger<NotificationService> logger, ISettingsManager settingsManager) |
|
|
|
|
|
|
|
: INotificationService, |
|
|
|
|
|
|
|
IDisposable |
|
|
|
{ |
|
|
|
{ |
|
|
|
private readonly ILogger<NotificationService> logger; |
|
|
|
|
|
|
|
private readonly ISettingsManager settingsManager; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private WindowNotificationManager? notificationManager; |
|
|
|
private WindowNotificationManager? notificationManager; |
|
|
|
|
|
|
|
|
|
|
|
private readonly AsyncLock nativeNotificationManagerLock = new(); |
|
|
|
private readonly AsyncLock nativeNotificationManagerLock = new(); |
|
|
|
private volatile INotificationManager? nativeNotificationManager; |
|
|
|
private volatile INotificationManager? nativeNotificationManager; |
|
|
|
private volatile bool isNativeNotificationManagerInitialized; |
|
|
|
private volatile bool isNativeNotificationManagerInitialized; |
|
|
|
|
|
|
|
|
|
|
|
public NotificationService(ILogger<NotificationService> logger, ISettingsManager settingsManager) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
this.logger = logger; |
|
|
|
|
|
|
|
this.settingsManager = settingsManager; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void Initialize( |
|
|
|
public void Initialize( |
|
|
|
Visual? visual, |
|
|
|
Visual? visual, |
|
|
|
NotificationPosition position = NotificationPosition.BottomRight, |
|
|
|
NotificationPosition position = NotificationPosition.BottomRight, |
|
|
|