Update Ukraine support message

This commit is contained in:
Tyrrrz 2023-01-10 22:25:35 +02:00
parent 4edcdf0955
commit 6e56f29404
3 changed files with 39 additions and 14 deletions

View file

@ -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;
}

View file

@ -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();

View file

@ -41,17 +41,26 @@ public class RootViewModel : Screen, IHandle<NotificationMessage>, 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();
}