diff --git a/DiscordChatExporter.Gui/Services/SettingsService.cs b/DiscordChatExporter.Gui/Services/SettingsService.cs index 79cf78e5..0d6eb3b0 100644 --- a/DiscordChatExporter.Gui/Services/SettingsService.cs +++ b/DiscordChatExporter.Gui/Services/SettingsService.cs @@ -16,6 +16,10 @@ public partial class SettingsService : SettingsBase public bool IsTokenPersisted { get; set; } = true; + public bool ShouldShowThreads { get; set; } + + public bool ShouldShowArchivedThreads { get; set; } + public string DateFormat { get; set; } = "MM/dd/yyyy h:mm tt"; public int ParallelLimit { get; set; } = 1; diff --git a/DiscordChatExporter.Gui/ViewModels/Components/DashboardViewModel.cs b/DiscordChatExporter.Gui/ViewModels/Components/DashboardViewModel.cs index 9ef563a8..2a3af34e 100644 --- a/DiscordChatExporter.Gui/ViewModels/Components/DashboardViewModel.cs +++ b/DiscordChatExporter.Gui/ViewModels/Components/DashboardViewModel.cs @@ -89,11 +89,8 @@ public class DashboardViewModel : PropertyChangedBase Token = _settingsService.LastToken; } - public async ValueTask ShowSettingsAsync() - { - var dialog = _viewModelFactory.CreateSettingsViewModel(); - await _dialogManager.ShowDialogAsync(dialog); - } + public async ValueTask ShowSettingsAsync() => + await _dialogManager.ShowDialogAsync(_viewModelFactory.CreateSettingsViewModel()); public void ShowHelp() => ProcessEx.StartShellExecute(App.DocumentationUrl); @@ -165,6 +162,7 @@ public class DashboardViewModel : PropertyChangedBase var channels = new List(); + // Regular channels await foreach (var channel in _discord.GetGuildChannelsAsync(SelectedGuild.Id)) { if (channel.Kind == ChannelKind.GuildCategory) @@ -173,6 +171,17 @@ public class DashboardViewModel : PropertyChangedBase channels.Add(channel); } + // Threads + if (_settingsService.ShouldShowThreads) + { + await foreach (var thread in _discord.GetGuildThreadsAsync( + SelectedGuild.Id, + _settingsService.ShouldShowArchivedThreads)) + { + channels.Add(thread); + } + } + AvailableChannels = channels; SelectedChannels = null; } diff --git a/DiscordChatExporter.Gui/ViewModels/Dialogs/SettingsViewModel.cs b/DiscordChatExporter.Gui/ViewModels/Dialogs/SettingsViewModel.cs index 82492e36..b8325aa2 100644 --- a/DiscordChatExporter.Gui/ViewModels/Dialogs/SettingsViewModel.cs +++ b/DiscordChatExporter.Gui/ViewModels/Dialogs/SettingsViewModel.cs @@ -26,6 +26,18 @@ public class SettingsViewModel : DialogScreen set => _settingsService.IsTokenPersisted = value; } + public bool ShouldShowThreads + { + get => _settingsService.ShouldShowThreads; + set => _settingsService.ShouldShowThreads = value; + } + + public bool ShouldShowArchivedThreads + { + get => _settingsService.ShouldShowArchivedThreads; + set => _settingsService.ShouldShowArchivedThreads = value; + } + public string DateFormat { get => _settingsService.DateFormat; diff --git a/DiscordChatExporter.Gui/Views/Components/DashboardView.xaml b/DiscordChatExporter.Gui/Views/Components/DashboardView.xaml index a411a26f..2175d8ad 100644 --- a/DiscordChatExporter.Gui/Views/Components/DashboardView.xaml +++ b/DiscordChatExporter.Gui/Views/Components/DashboardView.xaml @@ -304,7 +304,7 @@ diff --git a/DiscordChatExporter.Gui/Views/Dialogs/SettingsView.xaml b/DiscordChatExporter.Gui/Views/Dialogs/SettingsView.xaml index 232a9e03..52f366c3 100644 --- a/DiscordChatExporter.Gui/Views/Dialogs/SettingsView.xaml +++ b/DiscordChatExporter.Gui/Views/Dialogs/SettingsView.xaml @@ -82,6 +82,38 @@ IsChecked="{Binding IsTokenPersisted}" /> + + + + + + + + + + + +