Refactored the way cover images are updated from SignalR to use an explicit event that is sent at a granular level for a given type of entity. (#1046)

Fixed a bad event listener for RefreshMetadata (now removed) to update metadata on Series Detail. Now uses ScanService, which indicates a series has completed a scan.
This commit is contained in:
Joseph Milazzo 2022-02-07 17:44:06 -08:00 committed by GitHub
parent c448a3e493
commit 67ba5e302f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 108 additions and 117 deletions

View file

@ -1,4 +1,5 @@
using System;
using System.Threading;
using API.DTOs.Update;
namespace API.SignalR
@ -75,20 +76,6 @@ namespace API.SignalR
}
public static SignalRMessage RefreshMetadataEvent(int libraryId, int seriesId)
{
return new SignalRMessage()
{
Name = SignalREvents.RefreshMetadata,
Body = new
{
SeriesId = seriesId,
LibraryId = libraryId
}
};
}
public static SignalRMessage BackupDatabaseProgressEvent(float progress)
{
return new SignalRMessage()
@ -161,5 +148,18 @@ namespace API.SignalR
}
};
}
public static SignalRMessage CoverUpdateEvent(int id, string entityType)
{
return new SignalRMessage()
{
Name = SignalREvents.CoverUpdate,
Body = new
{
Id = id,
EntityType = entityType,
}
};
}
}
}

View file

@ -2,12 +2,14 @@
{
public static class SignalREvents
{
public const string UpdateAvailable = "UpdateAvailable";
public const string ScanSeries = "ScanSeries";
/// <summary>
/// Event during Refresh Metadata for cover image change
/// An update is available for the Kavita instance
/// </summary>
public const string RefreshMetadata = "RefreshMetadata";
public const string UpdateAvailable = "UpdateAvailable";
/// <summary>
/// Used to tell when a scan series completes
/// </summary>
public const string ScanSeries = "ScanSeries";
/// <summary>
/// Event sent out during Refresh Metadata for progress tracking
/// </summary>
@ -48,6 +50,9 @@
/// Event sent out during downloading of files
/// </summary>
public const string DownloadProgress = "DownloadProgress";
/// <summary>
/// A cover was updated
/// </summary>
public const string CoverUpdate = "CoverUpdate";
}
}