fixup! fixup! fixup! fixup! fixup! wip: Notifications support through Apprise

Robert Dailey 5 months ago
parent b4fbd28ff1
commit 7cda987e39

@ -4,7 +4,7 @@ public abstract class ConfigurationScope : IDisposable
{
private IDisposable? _scope;
public void SetScope(IDisposable scope)
public virtual void SetScope(IDisposable scope)
{
_scope = scope;
}

@ -19,16 +19,12 @@ public sealed class NotificationService(
{
public void AddInstanceMetrics(string instanceName, IReadOnlyCollection<IPresentableNotification> metrics)
{
if (_activeInstanceName is not null)
{
RenderInstanceEvents(_activeInstanceName, presentableNotifications);
}
_activeInstanceName = instanceName;
throw new NotImplementedException();
}
public async Task SendNotification(bool succeeded)
{
/*
// If the user didn't configure notifications, exit early and do nothing.
if (settingsProvider.Settings.Notifications is null)
{
@ -60,6 +56,7 @@ public sealed class NotificationService(
{
log.Error(e, "Failed to send notification");
}
*/
}
private static string RenderInstanceEvents(

@ -3,10 +3,19 @@ using Recyclarr.Config;
namespace Recyclarr.Tests.TestLibrary;
public class TestConfigurationScope(ILifetimeScope scope) : ConfigurationScope(scope)
public class TestConfigurationScope : ConfigurationScope
{
private ILifetimeScope? _lifetimeScope;
public T Resolve<T>() where T : notnull
{
return Scope.Resolve<T>();
ArgumentNullException.ThrowIfNull(_lifetimeScope);
return _lifetimeScope.Resolve<T>();
}
public override void SetScope(IDisposable scope)
{
base.SetScope(scope);
_lifetimeScope = (ILifetimeScope) scope;
}
}

Loading…
Cancel
Save