mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Migrate ServerEventNotifier.OnPackageInstalling to IEventConsumer
This commit is contained in:
parent
8c9cd5f6d7
commit
b7ceb40d6e
@ -38,7 +38,6 @@ namespace Emby.Server.Implementations.EntryPoints
|
|||||||
public Task RunAsync()
|
public Task RunAsync()
|
||||||
{
|
{
|
||||||
_installationManager.PluginUninstalled += OnPluginUninstalled;
|
_installationManager.PluginUninstalled += OnPluginUninstalled;
|
||||||
_installationManager.PackageInstalling += OnPackageInstalling;
|
|
||||||
_installationManager.PackageInstallationCancelled += OnPackageInstallationCancelled;
|
_installationManager.PackageInstallationCancelled += OnPackageInstallationCancelled;
|
||||||
_installationManager.PackageInstallationCompleted += OnPackageInstallationCompleted;
|
_installationManager.PackageInstallationCompleted += OnPackageInstallationCompleted;
|
||||||
_installationManager.PackageInstallationFailed += OnPackageInstallationFailed;
|
_installationManager.PackageInstallationFailed += OnPackageInstallationFailed;
|
||||||
@ -46,11 +45,6 @@ namespace Emby.Server.Implementations.EntryPoints
|
|||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void OnPackageInstalling(object sender, InstallationInfo e)
|
|
||||||
{
|
|
||||||
await SendMessageToAdminSessions("PackageInstalling", e).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void OnPackageInstallationCancelled(object sender, InstallationInfo e)
|
private async void OnPackageInstallationCancelled(object sender, InstallationInfo e)
|
||||||
{
|
{
|
||||||
await SendMessageToAdminSessions("PackageInstallationCancelled", e).ConfigureAwait(false);
|
await SendMessageToAdminSessions("PackageInstallationCancelled", e).ConfigureAwait(false);
|
||||||
@ -103,7 +97,6 @@ namespace Emby.Server.Implementations.EntryPoints
|
|||||||
if (dispose)
|
if (dispose)
|
||||||
{
|
{
|
||||||
_installationManager.PluginUninstalled -= OnPluginUninstalled;
|
_installationManager.PluginUninstalled -= OnPluginUninstalled;
|
||||||
_installationManager.PackageInstalling -= OnPackageInstalling;
|
|
||||||
_installationManager.PackageInstallationCancelled -= OnPackageInstallationCancelled;
|
_installationManager.PackageInstallationCancelled -= OnPackageInstallationCancelled;
|
||||||
_installationManager.PackageInstallationCompleted -= OnPackageInstallationCompleted;
|
_installationManager.PackageInstallationCompleted -= OnPackageInstallationCompleted;
|
||||||
_installationManager.PackageInstallationFailed -= OnPackageInstallationFailed;
|
_installationManager.PackageInstallationFailed -= OnPackageInstallationFailed;
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using MediaBrowser.Controller.Events;
|
||||||
|
using MediaBrowser.Controller.Events.Updates;
|
||||||
|
using MediaBrowser.Controller.Session;
|
||||||
|
|
||||||
|
namespace Jellyfin.Server.Implementations.Events.Consumers.Updates
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Notifies admin users when a plugin is being installed.
|
||||||
|
/// </summary>
|
||||||
|
public class PluginInstallingNotifier : IEventConsumer<PluginInstallingEventArgs>
|
||||||
|
{
|
||||||
|
private readonly ISessionManager _sessionManager;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="PluginInstallingNotifier"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sessionManager">The session manager.</param>
|
||||||
|
public PluginInstallingNotifier(ISessionManager sessionManager)
|
||||||
|
{
|
||||||
|
_sessionManager = sessionManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public async Task OnEvent(PluginInstallingEventArgs eventArgs)
|
||||||
|
{
|
||||||
|
await _sessionManager.SendMessageToAdminSessions("PackageInstalling", eventArgs.Argument, CancellationToken.None).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
using Jellyfin.Data.Events;
|
||||||
|
using MediaBrowser.Model.Updates;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Controller.Events.Updates
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An event that occurs when a plugin is installing.
|
||||||
|
/// </summary>
|
||||||
|
public class PluginInstallingEventArgs : GenericEventArgs<InstallationInfo>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="PluginInstallingEventArgs"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="arg">The installation info.</param>
|
||||||
|
public PluginInstallingEventArgs(InstallationInfo arg) : base(arg)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user