From 6e56f2940421a873bddf0e2d7ffc74b8f7853572 Mon Sep 17 00:00:00 2001 From: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Date: Tue, 10 Jan 2023 22:25:35 +0200 Subject: [PATCH] Update Ukraine support message --- .../Commands/Base/ExportCommandBase.cs | 26 ++++++++++++++----- .../Services/SettingsService.cs | 2 ++ .../ViewModels/RootViewModel.cs | 25 ++++++++++++------ 3 files changed, 39 insertions(+), 14 deletions(-) diff --git a/DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs b/DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs index 01319c4c..3183b8d0 100644 --- a/DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs +++ b/DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs @@ -92,6 +92,12 @@ public abstract class ExportCommandBase : TokenCommandBase )] public string DateFormat { get; init; } = "dd-MMM-yy hh:mm tt"; + [CommandOption( + "fuck-russia", + Description = "Don't print the Support Ukraine message to the console." + )] + public bool IsUkraineSupportMessageDisabled { get; init; } + private ChannelExporter? _channelExporter; protected ChannelExporter Exporter => _channelExporter ??= new ChannelExporter(Discord); @@ -234,12 +240,20 @@ public abstract class ExportCommandBase : TokenCommandBase public override ValueTask ExecuteAsync(IConsole console) { - // War in Ukraine message - console.Output.WriteLine("========================================================================"); - console.Output.WriteLine("|| Ukraine is at war! Support my country in its fight for freedom ||"); - console.Output.WriteLine("|| Learn more: https://tyrrrz.me/ukraine ||"); - console.Output.WriteLine("========================================================================"); - console.Output.WriteLine(""); + // Support Ukraine callout + if (!IsUkraineSupportMessageDisabled) + { + console.Output.WriteLine("┌────────────────────────────────────────────────────────────────────┐"); + console.Output.WriteLine("│ Thank you for supporting Ukraine <3 │"); + console.Output.WriteLine("│ │"); + console.Output.WriteLine("│ As Russia wages a genocidal war against my country, │"); + console.Output.WriteLine("│ I'm grateful to everyone who continues to │"); + console.Output.WriteLine("│ stand with Ukraine in our fight for freedom. │"); + console.Output.WriteLine("│ │"); + console.Output.WriteLine("│ Learn more: https://tyrrrz.me/ukraine │"); + console.Output.WriteLine("└────────────────────────────────────────────────────────────────────┘"); + console.Output.WriteLine(""); + } return default; } diff --git a/DiscordChatExporter.Gui/Services/SettingsService.cs b/DiscordChatExporter.Gui/Services/SettingsService.cs index 88baf9f6..f50809a8 100644 --- a/DiscordChatExporter.Gui/Services/SettingsService.cs +++ b/DiscordChatExporter.Gui/Services/SettingsService.cs @@ -6,6 +6,8 @@ namespace DiscordChatExporter.Gui.Services; public partial class SettingsService : SettingsManager { + public bool IsUkraineSupportMessageEnabled { get; set; } = true; + public bool IsAutoUpdateEnabled { get; set; } = true; public bool IsDarkModeEnabled { get; set; } = IsDarkModeEnabledByDefault(); diff --git a/DiscordChatExporter.Gui/ViewModels/RootViewModel.cs b/DiscordChatExporter.Gui/ViewModels/RootViewModel.cs index d765765d..32f82294 100644 --- a/DiscordChatExporter.Gui/ViewModels/RootViewModel.cs +++ b/DiscordChatExporter.Gui/ViewModels/RootViewModel.cs @@ -41,17 +41,26 @@ public class RootViewModel : Screen, IHandle, IDisposable DisplayName = $"{App.Name} v{App.VersionString}"; } - private async Task ShowWarInUkraineMessageAsync() + private async Task ShowUkraineSupportMessageAsync() { - var dialog = _viewModelFactory.CreateMessageBoxViewModel( - "Ukraine is at war!", @" -My country, Ukraine, has been invaded by Russian military forces in an act of aggression that can only be described as genocide. -Be on the right side of history! Consider supporting Ukraine in its fight for freedom. + if (!_settingsService.IsUkraineSupportMessageEnabled) + return; -Press LEARN MORE to find ways that you can help.".Trim(), - "LEARN MORE", "CLOSE" + var dialog = _viewModelFactory.CreateMessageBoxViewModel( + "Thank you for supporting Ukraine!", + """ + As Russia wages a genocidal war against my country, I'm grateful to everyone who continues to stand with Ukraine in our fight for freedom. + + Click LEARN MORE to find ways that you can help. + """, + "LEARN MORE", + "CANCEL" ); + // Disable this message in the future + _settingsService.IsUkraineSupportMessageEnabled = false; + _settingsService.Save(); + if (await _dialogManager.ShowDialogAsync(dialog) == true) { ProcessEx.StartShellExecute("https://tyrrrz.me/ukraine?source=discordchatexporter"); @@ -87,7 +96,7 @@ Press LEARN MORE to find ways that you can help.".Trim(), public async void OnViewFullyLoaded() { - await ShowWarInUkraineMessageAsync(); + await ShowUkraineSupportMessageAsync(); await CheckForUpdatesAsync(); }