mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-08-11 18:32:12 +00:00
Removed the snackbar from every place except the layout that renders it
This commit is contained in:
parent
18dc8bf9b8
commit
3eda45df8f
@ -24,10 +24,7 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
|||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
protected IJSRuntime JsRuntime { get; init; } = null!;
|
protected IJSRuntime JsRuntime { get; init; } = null!;
|
||||||
|
|
||||||
[Inject]
|
|
||||||
protected ISnackbar Snackbar { get; init; } = null!;
|
|
||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
protected RustService RustService { get; init; } = null!;
|
protected RustService RustService { get; init; } = null!;
|
||||||
|
|
||||||
@ -529,7 +526,7 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
|||||||
|
|
||||||
protected async Task CopyToClipboard()
|
protected async Task CopyToClipboard()
|
||||||
{
|
{
|
||||||
await this.RustService.CopyText2Clipboard(this.Snackbar, this.Result2Copy());
|
await this.RustService.CopyText2Clipboard(this.Result2Copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
private ChatThread CreateSendToChatThread()
|
private ChatThread CreateSendToChatThread()
|
||||||
|
|||||||
@ -795,7 +795,7 @@ public partial class DocumentAnalysisAssistant : AssistantBaseCore<NoSettingsPan
|
|||||||
}
|
}
|
||||||
|
|
||||||
var luaCode = this.GenerateLuaPolicyExport();
|
var luaCode = this.GenerateLuaPolicyExport();
|
||||||
await this.RustService.CopyText2Clipboard(this.Snackbar, luaCode);
|
await this.RustService.CopyText2Clipboard(luaCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GenerateLuaPolicyExport()
|
private string GenerateLuaPolicyExport()
|
||||||
|
|||||||
@ -67,7 +67,7 @@ public partial class AssistantI18N : AssistantBaseCore<SettingsDialogI18N>
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
AsyncAction = async () => await this.WriteToPluginFile(),
|
AsyncAction = async () => await this.WriteToPluginFile(),
|
||||||
#else
|
#else
|
||||||
AsyncAction = async () => await this.RustService.CopyText2Clipboard(this.Snackbar, this.finalLuaCode.ToString()),
|
AsyncAction = async () => await this.RustService.CopyText2Clipboard(this.finalLuaCode.ToString()),
|
||||||
#endif
|
#endif
|
||||||
DisabledActionParam = () => this.finalLuaCode.Length == 0,
|
DisabledActionParam = () => this.finalLuaCode.Length == 0,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -280,9 +280,7 @@ public partial class VisualBriefingAssistant
|
|||||||
if (this.lastBuildDiagnostics is null)
|
if (this.lastBuildDiagnostics is null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
await this.RustService.CopyText2Clipboard(
|
await this.RustService.CopyText2Clipboard(this.lastBuildDiagnostics.ToClipboardText());
|
||||||
this.Snackbar,
|
|
||||||
this.lastBuildDiagnostics.ToClipboardText());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -57,12 +57,6 @@ public partial class VisualBriefingAssistant : MSGComponentBase
|
|||||||
[Inject]
|
[Inject]
|
||||||
private IDialogService DialogService { get; init; } = null!;
|
private IDialogService DialogService { get; init; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Defines <c>Snackbar</c> for the visual briefing feature.
|
|
||||||
/// </summary>
|
|
||||||
[Inject]
|
|
||||||
private ISnackbar Snackbar { get; init; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines <c>AssistantSessionService</c> for the visual briefing feature.
|
/// Defines <c>AssistantSessionService</c> for the visual briefing feature.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -38,10 +38,7 @@ public partial class MudCopyClipboardButton : ComponentBase
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public Size Size { get; set; } = Size.Small;
|
public Size Size { get; set; } = Size.Small;
|
||||||
|
|
||||||
[Inject]
|
|
||||||
private ISnackbar Snackbar { get; init; } = null!;
|
|
||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
private RustService RustService { get; init; } = null!;
|
private RustService RustService { get; init; } = null!;
|
||||||
|
|
||||||
@ -58,7 +55,7 @@ public partial class MudCopyClipboardButton : ComponentBase
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private async Task CopyToClipboard(string textContent)
|
private async Task CopyToClipboard(string textContent)
|
||||||
{
|
{
|
||||||
await this.RustService.CopyText2Clipboard(this.Snackbar, textContent);
|
await this.RustService.CopyText2Clipboard(textContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -73,7 +70,7 @@ public partial class MudCopyClipboardButton : ComponentBase
|
|||||||
{
|
{
|
||||||
case ContentType.TEXT:
|
case ContentType.TEXT:
|
||||||
var textContent = (ContentText) contentToCopy;
|
var textContent = (ContentText) contentToCopy;
|
||||||
await this.RustService.CopyText2Clipboard(this.Snackbar, textContent.Text);
|
await this.RustService.CopyText2Clipboard(textContent.Text);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -74,7 +74,7 @@ public partial class SettingsPanelApp : SettingsPanelBase
|
|||||||
private async Task GenerateEncryptionSecret()
|
private async Task GenerateEncryptionSecret()
|
||||||
{
|
{
|
||||||
var secret = EnterpriseEncryption.GenerateSecret();
|
var secret = EnterpriseEncryption.GenerateSecret();
|
||||||
await this.RustService.CopyText2Clipboard(this.Snackbar, secret);
|
await this.RustService.CopyText2Clipboard(secret);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetStartPageHelpText()
|
private string GetStartPageHelpText()
|
||||||
|
|||||||
@ -16,6 +16,4 @@ public abstract class SettingsPanelBase : MSGComponentBase
|
|||||||
[Inject]
|
[Inject]
|
||||||
protected RustService RustService { get; init; } = null!;
|
protected RustService RustService { get; init; } = null!;
|
||||||
|
|
||||||
[Inject]
|
|
||||||
protected ISnackbar Snackbar { get; init; } = null!;
|
|
||||||
}
|
}
|
||||||
@ -56,6 +56,6 @@ public abstract class SettingsPanelProviderBase : SettingsPanelBase
|
|||||||
if (string.IsNullOrWhiteSpace(luaCode))
|
if (string.IsNullOrWhiteSpace(luaCode))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
await this.RustService.CopyText2Clipboard(this.Snackbar, luaCode);
|
await this.RustService.CopyText2Clipboard(luaCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,9 +23,6 @@ public partial class TextInfoLine : MSGComponentBase
|
|||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
private RustService RustService { get; init; } = null!;
|
private RustService RustService { get; init; } = null!;
|
||||||
|
|
||||||
[Inject]
|
|
||||||
private ISnackbar Snackbar { get; init; } = null!;
|
|
||||||
|
|
||||||
#region Overrides of ComponentBase
|
#region Overrides of ComponentBase
|
||||||
|
|
||||||
@ -43,5 +40,5 @@ public partial class TextInfoLine : MSGComponentBase
|
|||||||
|
|
||||||
private string ClipboardTooltip => string.Format(T("Copy {0} to the clipboard"), this.ClipboardTooltipSubject);
|
private string ClipboardTooltip => string.Format(T("Copy {0} to the clipboard"), this.ClipboardTooltipSubject);
|
||||||
|
|
||||||
private async Task CopyToClipboard(string content) => await this.RustService.CopyText2Clipboard(this.Snackbar, content);
|
private async Task CopyToClipboard(string content) => await this.RustService.CopyText2Clipboard(content);
|
||||||
}
|
}
|
||||||
@ -26,9 +26,6 @@ public partial class TextInfoLines : MSGComponentBase
|
|||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
private RustService RustService { get; init; } = null!;
|
private RustService RustService { get; init; } = null!;
|
||||||
|
|
||||||
[Inject]
|
|
||||||
private ISnackbar Snackbar { get; init; } = null!;
|
|
||||||
|
|
||||||
#region Overrides of ComponentBase
|
#region Overrides of ComponentBase
|
||||||
|
|
||||||
@ -46,7 +43,7 @@ public partial class TextInfoLines : MSGComponentBase
|
|||||||
|
|
||||||
private string ClipboardTooltip => string.Format(T("Copy {0} to the clipboard"), this.ClipboardTooltipSubject);
|
private string ClipboardTooltip => string.Format(T("Copy {0} to the clipboard"), this.ClipboardTooltipSubject);
|
||||||
|
|
||||||
private async Task CopyToClipboard(string content) => await this.RustService.CopyText2Clipboard(this.Snackbar, content);
|
private async Task CopyToClipboard(string content) => await this.RustService.CopyText2Clipboard(content);
|
||||||
|
|
||||||
private string GetColor()
|
private string GetColor()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -25,9 +25,6 @@ public partial class VoiceRecorder : MSGComponentBase
|
|||||||
[Inject]
|
[Inject]
|
||||||
private GlobalShortcutService GlobalShortcutService { get; init; } = null!;
|
private GlobalShortcutService GlobalShortcutService { get; init; } = null!;
|
||||||
|
|
||||||
[Inject]
|
|
||||||
private ISnackbar Snackbar { get; init; } = null!;
|
|
||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
private VoiceRecordingAvailabilityService VoiceRecordingAvailabilityService { get; init; } = null!;
|
private VoiceRecordingAvailabilityService VoiceRecordingAvailabilityService { get; init; } = null!;
|
||||||
|
|
||||||
@ -448,7 +445,7 @@ public partial class VoiceRecorder : MSGComponentBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Copy the transcribed text to the clipboard:
|
// Copy the transcribed text to the clipboard:
|
||||||
await this.RustService.CopyText2Clipboard(this.Snackbar, transcribedText);
|
await this.RustService.CopyText2Clipboard(transcribedText);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@ -12,10 +12,7 @@ public partial class AssistantPluginEditorDialog : MSGComponentBase
|
|||||||
{
|
{
|
||||||
[Inject]
|
[Inject]
|
||||||
protected RustService RustService { get; init; } = null!;
|
protected RustService RustService { get; init; } = null!;
|
||||||
|
|
||||||
[Inject]
|
|
||||||
protected ISnackbar Snackbar { get; init; } = null!;
|
|
||||||
|
|
||||||
private const string PLUGIN_FILE_NAME = "plugin.lua";
|
private const string PLUGIN_FILE_NAME = "plugin.lua";
|
||||||
private static readonly ILogger LOGGER = Program.LOGGER_FACTORY.CreateLogger(nameof(AssistantPluginEditorDialog));
|
private static readonly ILogger LOGGER = Program.LOGGER_FACTORY.CreateLogger(nameof(AssistantPluginEditorDialog));
|
||||||
|
|
||||||
@ -134,7 +131,7 @@ public partial class AssistantPluginEditorDialog : MSGComponentBase
|
|||||||
|
|
||||||
private void Cancel() => this.MudDialog.Cancel();
|
private void Cancel() => this.MudDialog.Cancel();
|
||||||
|
|
||||||
private async Task CopyToClipboard() => await this.RustService.CopyText2Clipboard(this.Snackbar, this.Result2Copy());
|
private async Task CopyToClipboard() => await this.RustService.CopyText2Clipboard(this.Result2Copy());
|
||||||
|
|
||||||
private static bool AreSamePath(string left, string right)
|
private static bool AreSamePath(string left, string right)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -19,9 +19,6 @@ public abstract class SettingsDialogBase : MSGComponentBase
|
|||||||
[Inject]
|
[Inject]
|
||||||
protected RustService RustService { get; init; } = null!;
|
protected RustService RustService { get; init; } = null!;
|
||||||
|
|
||||||
[Inject]
|
|
||||||
protected ISnackbar Snackbar { get; init; } = null!;
|
|
||||||
|
|
||||||
protected readonly List<ConfigurationSelectData<string>> AvailableLLMProviders = new();
|
protected readonly List<ConfigurationSelectData<string>> AvailableLLMProviders = new();
|
||||||
protected readonly List<ConfigurationSelectData<string>> AvailableEmbeddingProviders = new();
|
protected readonly List<ConfigurationSelectData<string>> AvailableEmbeddingProviders = new();
|
||||||
|
|
||||||
|
|||||||
@ -172,7 +172,7 @@ public partial class SettingsDialogChatTemplate : SettingsDialogBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(luaCode))
|
if (!string.IsNullOrWhiteSpace(luaCode))
|
||||||
await this.RustService.CopyText2Clipboard(this.Snackbar, luaCode);
|
await this.RustService.CopyText2Clipboard(luaCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task CopyPackagedChatTemplateLuaToClipboard(ChatTemplate chatTemplate, string pluginDirectory)
|
private async Task CopyPackagedChatTemplateLuaToClipboard(ChatTemplate chatTemplate, string pluginDirectory)
|
||||||
@ -187,6 +187,6 @@ public partial class SettingsDialogChatTemplate : SettingsDialogBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(luaCode))
|
if (!string.IsNullOrWhiteSpace(luaCode))
|
||||||
await this.RustService.CopyText2Clipboard(this.Snackbar, luaCode);
|
await this.RustService.CopyText2Clipboard(luaCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -110,7 +110,7 @@ public partial class SettingsDialogDataSources : SettingsDialogBase
|
|||||||
{
|
{
|
||||||
var publicLuaCode = eriDataSource.ExportAsConfigurationSection();
|
var publicLuaCode = eriDataSource.ExportAsConfigurationSection();
|
||||||
if (!string.IsNullOrWhiteSpace(publicLuaCode))
|
if (!string.IsNullOrWhiteSpace(publicLuaCode))
|
||||||
await this.RustService.CopyText2Clipboard(this.Snackbar, publicLuaCode);
|
await this.RustService.CopyText2Clipboard(publicLuaCode);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -179,7 +179,7 @@ public partial class SettingsDialogDataSources : SettingsDialogBase
|
|||||||
if (string.IsNullOrWhiteSpace(luaCode))
|
if (string.IsNullOrWhiteSpace(luaCode))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
await this.RustService.CopyText2Clipboard(this.Snackbar, luaCode);
|
await this.RustService.CopyText2Clipboard(luaCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task EditDataSource(IDataSource dataSource)
|
private async Task EditDataSource(IDataSource dataSource)
|
||||||
|
|||||||
@ -75,7 +75,7 @@ public partial class SettingsDialogProfiles : SettingsDialogBase
|
|||||||
|
|
||||||
var luaCode = profile.ExportAsConfigurationSection();
|
var luaCode = profile.ExportAsConfigurationSection();
|
||||||
if (!string.IsNullOrWhiteSpace(luaCode))
|
if (!string.IsNullOrWhiteSpace(luaCode))
|
||||||
await this.RustService.CopyText2Clipboard(this.Snackbar, luaCode);
|
await this.RustService.CopyText2Clipboard(luaCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task DeleteProfile(Profile profile)
|
private async Task DeleteProfile(Profile profile)
|
||||||
|
|||||||
@ -118,7 +118,7 @@ public partial class MainLayout : LayoutComponentBase, IMessageBusReceiver, ILan
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// Set the snackbar for the update service:
|
// Set the snackbar for the update service:
|
||||||
UpdateService.SetBlazorDependencies(this.Snackbar);
|
UpdateService.MarkBlazorReady();
|
||||||
TemporaryChatService.Initialize();
|
TemporaryChatService.Initialize();
|
||||||
|
|
||||||
// Should the navigation bar be open by default?
|
// Should the navigation bar be open by default?
|
||||||
|
|||||||
@ -26,9 +26,6 @@ public partial class Information : MSGComponentBase
|
|||||||
[Inject]
|
[Inject]
|
||||||
private IDialogService DialogService { get; init; } = null!;
|
private IDialogService DialogService { get; init; } = null!;
|
||||||
|
|
||||||
[Inject]
|
|
||||||
private ISnackbar Snackbar { get; init; } = null!;
|
|
||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
private UpdatePolicy UpdatePolicy { get; init; } = null!;
|
private UpdatePolicy UpdatePolicy { get; init; } = null!;
|
||||||
|
|
||||||
@ -488,12 +485,12 @@ public partial class Information : MSGComponentBase
|
|||||||
|
|
||||||
private async Task CopyStartupLogPath()
|
private async Task CopyStartupLogPath()
|
||||||
{
|
{
|
||||||
await this.RustService.CopyText2Clipboard(this.Snackbar, this.logPaths.LogStartupPath);
|
await this.RustService.CopyText2Clipboard(this.logPaths.LogStartupPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task CopyAppLogPath()
|
private async Task CopyAppLogPath()
|
||||||
{
|
{
|
||||||
await this.RustService.CopyText2Clipboard(this.Snackbar, this.logPaths.LogAppPath);
|
await this.RustService.CopyText2Clipboard(this.logPaths.LogAppPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
private const string LICENSE = """
|
private const string LICENSE = """
|
||||||
|
|||||||
@ -6,15 +6,13 @@ namespace AIStudio.Tools.Services;
|
|||||||
/// Wire up the clipboard service to copy Markdown to the clipboard.
|
/// Wire up the clipboard service to copy Markdown to the clipboard.
|
||||||
/// We use our own Rust-based clipboard service for this.
|
/// We use our own Rust-based clipboard service for this.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class MarkdownClipboardService(RustService rust, ISnackbar snackbar) : IMudMarkdownClipboardService
|
public sealed class MarkdownClipboardService(RustService rust) : IMudMarkdownClipboardService
|
||||||
{
|
{
|
||||||
private ISnackbar Snackbar { get; } = snackbar;
|
|
||||||
|
|
||||||
private RustService Rust { get; } = rust;
|
private RustService Rust { get; } = rust;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets called when the user wants to copy the Markdown to the clipboard.
|
/// Gets called when the user wants to copy the Markdown to the clipboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text">The Markdown text to copy.</param>
|
/// <param name="text">The Markdown text to copy.</param>
|
||||||
public async ValueTask CopyToClipboardAsync(string text) => await this.Rust.CopyText2Clipboard(this.Snackbar, text);
|
public async ValueTask CopyToClipboardAsync(string text) => await this.Rust.CopyText2Clipboard(text);
|
||||||
}
|
}
|
||||||
@ -7,13 +7,16 @@ public sealed partial class RustService
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tries to copy the given text to the clipboard.
|
/// Tries to copy the given text to the clipboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="snackbar">The snackbar to show the result.</param>
|
/// <remarks>
|
||||||
|
/// The outcome is reported through the message bus. Callers used to hand in their snackbar, which
|
||||||
|
/// was the reason most components injected one at all, and it meant this notification was styled
|
||||||
|
/// here instead of together with every other notification of the app.
|
||||||
|
/// </remarks>
|
||||||
/// <param name="text">The text to copy to the clipboard.</param>
|
/// <param name="text">The text to copy to the clipboard.</param>
|
||||||
public async Task CopyText2Clipboard(ISnackbar snackbar, string text)
|
public async Task CopyText2Clipboard(string text)
|
||||||
{
|
{
|
||||||
var message = TB("Successfully copied the text to your clipboard");
|
var message = TB("Successfully copied the text to your clipboard");
|
||||||
var iconColor = Color.Error;
|
var succeeded = false;
|
||||||
var severity = Severity.Error;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var encryptedText = await text.Encrypt(this.encryptor!);
|
var encryptedText = await text.Encrypt(this.encryptor!);
|
||||||
@ -32,19 +35,16 @@ public sealed partial class RustService
|
|||||||
message = TB("Failed to copy the text to your clipboard.");
|
message = TB("Failed to copy the text to your clipboard.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
iconColor = Color.Success;
|
succeeded = true;
|
||||||
severity = Severity.Success;
|
|
||||||
this.logger!.LogDebug("Successfully copied the text to the clipboard.");
|
this.logger!.LogDebug("Successfully copied the text to the clipboard.");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
snackbar.Add(message, severity, config =>
|
if (succeeded)
|
||||||
{
|
await MessageBus.INSTANCE.SendSuccess(new(Icons.Material.Filled.ContentCopy, message));
|
||||||
config.Icon = Icons.Material.Filled.ContentCopy;
|
else
|
||||||
config.IconSize = Size.Large;
|
await MessageBus.INSTANCE.SendError(new(Icons.Material.Filled.ContentCopy, message));
|
||||||
config.IconColor = iconColor;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -11,8 +11,7 @@ public sealed class UpdateService : BackgroundService, IMessageBusReceiver
|
|||||||
private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(UpdateService).Namespace, nameof(UpdateService));
|
private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(UpdateService).Namespace, nameof(UpdateService));
|
||||||
|
|
||||||
private static bool IS_INITIALIZED;
|
private static bool IS_INITIALIZED;
|
||||||
private static ISnackbar? SNACKBAR;
|
|
||||||
|
|
||||||
private readonly SettingsManager settingsManager;
|
private readonly SettingsManager settingsManager;
|
||||||
private readonly MessageBus messageBus;
|
private readonly MessageBus messageBus;
|
||||||
private readonly RustService rust;
|
private readonly RustService rust;
|
||||||
@ -101,12 +100,7 @@ public sealed class UpdateService : BackgroundService, IMessageBusReceiver
|
|||||||
|
|
||||||
if (notifyUserWhenNoUpdate)
|
if (notifyUserWhenNoUpdate)
|
||||||
{
|
{
|
||||||
SNACKBAR!.Add(TB("Failed to check for updates. Please try again later."), Severity.Error, config =>
|
await this.messageBus.SendError(new(Icons.Material.Filled.Error, TB("Failed to check for updates. Please try again later.")));
|
||||||
{
|
|
||||||
config.Icon = Icons.Material.Filled.Error;
|
|
||||||
config.IconSize = Size.Large;
|
|
||||||
config.IconColor = Color.Error;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -133,12 +127,7 @@ public sealed class UpdateService : BackgroundService, IMessageBusReceiver
|
|||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
SNACKBAR!.Add(TB("Failed to install update automatically. Please try again manually."), Severity.Error, config =>
|
await this.messageBus.SendError(new(Icons.Material.Filled.Error, TB("Failed to install update automatically. Please try again manually.")));
|
||||||
{
|
|
||||||
config.Icon = Icons.Material.Filled.Error;
|
|
||||||
config.IconSize = Size.Large;
|
|
||||||
config.IconColor = Color.Error;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -148,12 +137,7 @@ public sealed class UpdateService : BackgroundService, IMessageBusReceiver
|
|||||||
{
|
{
|
||||||
if (notifyUserWhenNoUpdate)
|
if (notifyUserWhenNoUpdate)
|
||||||
{
|
{
|
||||||
SNACKBAR!.Add(TB("No update found."), Severity.Normal, config =>
|
await this.messageBus.SendInfo(new(Icons.Material.Filled.Update, TB("No update found.")));
|
||||||
{
|
|
||||||
config.Icon = Icons.Material.Filled.Update;
|
|
||||||
config.IconSize = Size.Large;
|
|
||||||
config.IconColor = Color.Primary;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -168,9 +152,8 @@ public sealed class UpdateService : BackgroundService, IMessageBusReceiver
|
|||||||
_ => Timeout.InfiniteTimeSpan
|
_ => Timeout.InfiniteTimeSpan
|
||||||
};
|
};
|
||||||
|
|
||||||
public static void SetBlazorDependencies(ISnackbar snackbar)
|
/// <summary>
|
||||||
{
|
/// Signals that the Blazor UI is ready, so queued update notifications can be shown.
|
||||||
SNACKBAR = snackbar;
|
/// </summary>
|
||||||
IS_INITIALIZED = true;
|
public static void MarkBlazorReady() => IS_INITIALIZED = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user