Add an option to not save token

Closes #252
pull/278/head
Alexey Golub 5 years ago
parent cec8409ac4
commit 5cb6adf19e

@ -5,9 +5,11 @@ namespace DiscordChatExporter.Core.Services
{
public class SettingsService : SettingsManager
{
public string DateFormat { get; set; } = "dd-MMM-yy hh:mm tt";
public bool IsAutoUpdateEnabled { get; set; } = true;
public string DateFormat { get; set; } = "dd-MMM-yy hh:mm tt";
public bool IsTokenPersisted { get; set; } = true;
public AuthToken? LastToken { get; set; }
@ -21,5 +23,7 @@ namespace DiscordChatExporter.Core.Services
Configuration.SubDirectoryPath = "";
Configuration.FileName = "Settings.dat";
}
public bool ShouldSerializeLastToken() => IsTokenPersisted;
}
}

@ -7,16 +7,22 @@ namespace DiscordChatExporter.Gui.ViewModels.Dialogs
{
private readonly SettingsService _settingsService;
public string DateFormat
{
get => _settingsService.DateFormat;
set => _settingsService.DateFormat = value;
}
public bool IsAutoUpdateEnabled
{
get => _settingsService.IsAutoUpdateEnabled;
set => _settingsService.IsAutoUpdateEnabled = value;
}
public string DateFormat
public bool IsTokenPersisted
{
get => _settingsService.DateFormat;
set => _settingsService.DateFormat = value;
get => _settingsService.IsTokenPersisted;
set => _settingsService.IsTokenPersisted = value;
}
public SettingsViewModel(SettingsService settingsService)

@ -41,6 +41,21 @@
IsChecked="{Binding IsAutoUpdateEnabled}" />
</DockPanel>
<!-- Persist token -->
<DockPanel
LastChildFill="False"
Background="Transparent"
ToolTip="Persist last used token between sessions">
<TextBlock
Margin="16,8"
DockPanel.Dock="Left"
Text="Save token" />
<ToggleButton
Margin="16,8"
DockPanel.Dock="Right"
IsChecked="{Binding IsTokenPersisted}" />
</DockPanel>
<!-- Save button -->
<Button
Margin="8"

Loading…
Cancel
Save