fixing past page, can't instantiate interface

This commit is contained in:
Andy Pack 2023-05-26 23:34:09 +01:00
parent 0adc052dc6
commit 6fd7249c5e
Signed by: sarsoo
GPG Key ID: A55BA3536A5E0ED7
12 changed files with 11 additions and 30 deletions

View File

@ -9,7 +9,7 @@ public interface INowPlayingHubClient
public Task OnNewPlaying(CurrentlyPlayingDTO context); public Task OnNewPlaying(CurrentlyPlayingDTO context);
public Task OnNewAudioFeature(TrackAudioFeatures features); public Task OnNewAudioFeature(TrackAudioFeatures features);
public Task OnNewPlayCount(PlayCount playCount); public Task OnNewPlayCount(PlayCount playCount);
public Task OnNewCard(ICard card); public Task OnNewCard(Card card);
} }
public interface INowPlayingHub public interface INowPlayingHub

View File

@ -5,7 +5,7 @@ namespace Selector.SignalR;
public interface IPastHub public interface IPastHub
{ {
Task OnConnected(); Task OnConnected();
Task OnSubmitted(IPastParams param); Task OnSubmitted(PastParams param);
} }
public interface IPastHubClient public interface IPastHubClient

View File

@ -1,9 +1,9 @@
using System; using System;
using Selector.SignalR; using Selector.SignalR;
namespace Selector.Web.NowPlaying; namespace Selector.SignalR;
public class Card : ICard public class Card
{ {
public string Content { get; set; } public string Content { get; set; }
} }

View File

@ -1,6 +0,0 @@
namespace Selector.SignalR;
public interface ICard
{
string Content { get; set; }
}

View File

@ -1,10 +0,0 @@
namespace Selector.SignalR;
public interface IPastParams
{
string Track { get; set; }
string Album { get; set; }
string Artist { get; set; }
string From { get; set; }
string To { get; set; }
}

View File

@ -1,9 +1,9 @@
using System; using System;
using Selector.SignalR; using Selector.SignalR;
namespace Selector.Web; namespace Selector.SignalR;
public class PastParams : IPastParams public class PastParams
{ {
public string Track { get; set; } public string Track { get; set; }
public string Album { get; set; } public string Album { get; set; }

View File

@ -10,7 +10,7 @@ public class NowHubCache
private readonly ILogger<NowHubCache> logger; private readonly ILogger<NowHubCache> logger;
public TrackAudioFeatures LastFeature { get; private set; } public TrackAudioFeatures LastFeature { get; private set; }
public List<ICard> LastCards { get; private set; } = new(); public List<Card> LastCards { get; private set; } = new();
private readonly object updateLock = new(); private readonly object updateLock = new();
private readonly object bindingLock = new(); private readonly object bindingLock = new();

View File

@ -32,7 +32,7 @@ public class NowHubClient: BaseSignalRClient, INowPlayingHub, IDisposable
NewPlayCountCallbacks.Add(hubConnection.On(nameof(OnNewPlayCount), action)); NewPlayCountCallbacks.Add(hubConnection.On(nameof(OnNewPlayCount), action));
} }
public void OnNewCard(Action<ICard> action) public void OnNewCard(Action<Card> action)
{ {
NewCardCallbacks.Add(hubConnection.On(nameof(OnNewCard), action)); NewCardCallbacks.Add(hubConnection.On(nameof(OnNewCard), action));
} }
@ -52,7 +52,7 @@ public class NowHubClient: BaseSignalRClient, INowPlayingHub, IDisposable
NewPlayCountCallbacks.Add(hubConnection.On(nameof(OnNewPlayCount), action)); NewPlayCountCallbacks.Add(hubConnection.On(nameof(OnNewPlayCount), action));
} }
public void OnNewCard(Func<ICard, Task> action) public void OnNewCard(Func<Card, Task> action)
{ {
NewCardCallbacks.Add(hubConnection.On(nameof(OnNewCard), action)); NewCardCallbacks.Add(hubConnection.On(nameof(OnNewCard), action));
} }

View File

@ -21,7 +21,7 @@ public class PastHubClient: BaseSignalRClient, IPastHub, IDisposable
return hubConnection.InvokeAsync(nameof(OnConnected)); return hubConnection.InvokeAsync(nameof(OnConnected));
} }
public Task OnSubmitted(IPastParams param) public Task OnSubmitted(PastParams param)
{ {
return hubConnection.InvokeAsync(nameof(OnSubmitted), param); return hubConnection.InvokeAsync(nameof(OnSubmitted), param);
} }

View File

@ -12,7 +12,6 @@ using Selector.Cache;
using Selector.Model; using Selector.Model;
using Selector.Model.Extensions; using Selector.Model.Extensions;
using Selector.SignalR; using Selector.SignalR;
using Selector.Web.NowPlaying;
using SpotifyAPI.Web; using SpotifyAPI.Web;
using StackExchange.Redis; using StackExchange.Redis;

View File

@ -57,7 +57,7 @@ namespace Selector.Web.Hubs
" (Expanded Edition)", " (Expanded Edition)",
}; };
public async Task OnSubmitted(IPastParams param) public async Task OnSubmitted(PastParams param)
{ {
param.Track = string.IsNullOrWhiteSpace(param.Track) ? null : param.Track; param.Track = string.IsNullOrWhiteSpace(param.Track) ? null : param.Track;
param.Album = string.IsNullOrWhiteSpace(param.Album) ? null : param.Album; param.Album = string.IsNullOrWhiteSpace(param.Album) ? null : param.Album;

View File

@ -41,13 +41,11 @@
<ItemGroup> <ItemGroup>
<Folder Include="wwwroot\" /> <Folder Include="wwwroot\" />
<Folder Include="NowPlaying\" />
<Folder Include="Past\" /> <Folder Include="Past\" />
<Folder Include="Auth\" /> <Folder Include="Auth\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Remove="NowPlaying\" />
<None Remove="Past\" /> <None Remove="Past\" />
<None Remove="Microsoft.AspNetCore.Authentication.JwtBearer" /> <None Remove="Microsoft.AspNetCore.Authentication.JwtBearer" />
<None Remove="Auth\" /> <None Remove="Auth\" />