Kavita/API/SignalR/MessageFactory.cs
Joseph Milazzo d750ce77a0
Shakeout Bugs (#623)
* Fixed an issue where ScanSeries would not fetch all the entities and thus files would get duplicated on the Chapter

* Remove building extra language binaries on build.

* Fixed an issue where first scan would cause an issue with websocket due to trying to send NaN over the wire.

* Fixed an issue where on new scans scan in progress indicators wouldn't turn off due to the way we were consuming events off the pipe.

* Ensure login page doesn't flash on first load

* Don't process touch events at all unless selection is enabled.
2021-10-03 05:27:35 -07:00

113 lines
3.0 KiB
C#

using System.Threading;
using API.DTOs.Update;
namespace API.SignalR
{
public static class MessageFactory
{
public static SignalRMessage ScanSeriesEvent(int seriesId, string seriesName)
{
return new SignalRMessage()
{
Name = SignalREvents.ScanSeries,
Body = new
{
SeriesId = seriesId,
SeriesName = seriesName
}
};
}
public static SignalRMessage SeriesAddedEvent(int seriesId, string seriesName, int libraryId)
{
return new SignalRMessage()
{
Name = SignalREvents.SeriesAdded,
Body = new
{
SeriesId = seriesId,
SeriesName = seriesName,
LibraryId = libraryId
}
};
}
public static SignalRMessage SeriesRemovedEvent(int seriesId, string seriesName, int libraryId)
{
return new SignalRMessage()
{
Name = SignalREvents.SeriesRemoved,
Body = new
{
SeriesId = seriesId,
SeriesName = seriesName,
LibraryId = libraryId
}
};
}
public static SignalRMessage ScanLibraryEvent(int libraryId, string stage)
{
return new SignalRMessage()
{
Name = SignalREvents.ScanLibrary,
Body = new
{
LibraryId = libraryId,
Stage = stage
}
};
}
public static SignalRMessage ScanLibraryProgressEvent(int libraryId, float progress)
{
return new SignalRMessage()
{
Name = SignalREvents.ScanLibrary,
Body = new
{
LibraryId = libraryId,
Progress = progress,
}
};
}
public static SignalRMessage RefreshMetadataEvent(int libraryId, int seriesId)
{
return new SignalRMessage()
{
Name = SignalREvents.RefreshMetadata,
Body = new
{
SeriesId = seriesId,
LibraryId = libraryId
}
};
}
public static SignalRMessage UpdateVersionEvent(UpdateNotificationDto update)
{
return new SignalRMessage
{
Name = SignalREvents.UpdateVersion,
Body = update
};
}
public static SignalRMessage SeriesAddedToCollection(int tagId, int seriesId)
{
return new SignalRMessage
{
Name = SignalREvents.UpdateVersion,
Body = new
{
TagId = tagId,
SeriesId = seriesId
}
};
}
}
}