Merge pull request #849 from immense/bug/scope-loader-messages

Scope loader messages to the circuit connection.
This commit is contained in:
Darren Kattan 2024-03-11 10:17:27 -05:00 committed by GitHub
commit 512d7862d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 13 deletions

View File

@ -261,7 +261,7 @@ public class CircuitConnection : CircuitHandler, ICircuitConnection
"There are already the maximum amount of active remote control sessions for your organization.",
"Max number of concurrent sessions reached.",
"bg-warning");
await _messenger.Send(message, ConnectionId);
return Result.Fail<RemoteControlSessionEx>("Max number of concurrent sessions reached.");

View File

@ -1,8 +1,7 @@
using Immense.RemoteControl.Shared.Primitives;
using Immense.SimpleMessenger;
using Remotely.Server.Hubs;
using Remotely.Server.Models.Messages;
using System;
using System.Threading.Tasks;
namespace Remotely.Server.Services;
@ -12,23 +11,16 @@ public interface ILoaderService
void HideLoader();
}
public class LoaderService : ILoaderService
public class LoaderService(IMessenger _messenger, ICircuitConnection _circuitConnection) : ILoaderService
{
private readonly IMessenger _messenger;
public LoaderService(IMessenger messenger)
{
_messenger = messenger;
}
public async Task<IDisposable> ShowLoader(string statusMessage)
{
await _messenger.Send(new ShowLoaderMessage(true, statusMessage));
await _messenger.Send(new ShowLoaderMessage(true, statusMessage), _circuitConnection.ConnectionId);
return new CallbackDisposable(HideLoader);
}
public void HideLoader()
{
_messenger.Send(new ShowLoaderMessage(false, string.Empty));
_messenger.Send(new ShowLoaderMessage(false, string.Empty), _circuitConnection.ConnectionId);
}
}