Update Ukraine support message

pull/986/head
Tyrrrz 2 years ago
parent 4edcdf0955
commit 6e56f29404

@ -92,6 +92,12 @@ public abstract class ExportCommandBase : TokenCommandBase
)] )]
public string DateFormat { get; init; } = "dd-MMM-yy hh:mm tt"; 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; private ChannelExporter? _channelExporter;
protected ChannelExporter Exporter => _channelExporter ??= new ChannelExporter(Discord); protected ChannelExporter Exporter => _channelExporter ??= new ChannelExporter(Discord);
@ -234,12 +240,20 @@ public abstract class ExportCommandBase : TokenCommandBase
public override ValueTask ExecuteAsync(IConsole console) public override ValueTask ExecuteAsync(IConsole console)
{ {
// War in Ukraine message // Support Ukraine callout
console.Output.WriteLine("========================================================================"); if (!IsUkraineSupportMessageDisabled)
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("========================================================================"); console.Output.WriteLine("│ Thank you for supporting Ukraine <3 │");
console.Output.WriteLine(""); 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; return default;
} }

@ -6,6 +6,8 @@ namespace DiscordChatExporter.Gui.Services;
public partial class SettingsService : SettingsManager public partial class SettingsService : SettingsManager
{ {
public bool IsUkraineSupportMessageEnabled { get; set; } = true;
public bool IsAutoUpdateEnabled { get; set; } = true; public bool IsAutoUpdateEnabled { get; set; } = true;
public bool IsDarkModeEnabled { get; set; } = IsDarkModeEnabledByDefault(); public bool IsDarkModeEnabled { get; set; } = IsDarkModeEnabledByDefault();

@ -41,17 +41,26 @@ public class RootViewModel : Screen, IHandle<NotificationMessage>, IDisposable
DisplayName = $"{App.Name} v{App.VersionString}"; DisplayName = $"{App.Name} v{App.VersionString}";
} }
private async Task ShowWarInUkraineMessageAsync() private async Task ShowUkraineSupportMessageAsync()
{ {
var dialog = _viewModelFactory.CreateMessageBoxViewModel( if (!_settingsService.IsUkraineSupportMessageEnabled)
"Ukraine is at war!", @" return;
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.
Press LEARN MORE to find ways that you can help.".Trim(), var dialog = _viewModelFactory.CreateMessageBoxViewModel(
"LEARN MORE", "CLOSE" "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) if (await _dialogManager.ShowDialogAsync(dialog) == true)
{ {
ProcessEx.StartShellExecute("https://tyrrrz.me/ukraine?source=discordchatexporter"); 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() public async void OnViewFullyLoaded()
{ {
await ShowWarInUkraineMessageAsync(); await ShowUkraineSupportMessageAsync();
await CheckForUpdatesAsync(); await CheckForUpdatesAsync();
} }

Loading…
Cancel
Save