From b8c1b63d7b30360af3d0f616b3eb1db1f2b428ea Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Apr 2026 00:36:03 +0000 Subject: [PATCH 1/4] Initial plan From 45252febefce94cec6500835bfc20e9460a202a0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Apr 2026 00:41:10 +0000 Subject: [PATCH 2/4] Add Play on startup setting to auto-play last station when app opens Agent-Logs-Url: https://github.com/TheJoeFin/Trdo/sessions/bbe887a0-8caa-4095-9da8-05b4aa6e901b Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com> --- Trdo/Pages/SettingsPage.xaml | 24 +++++++++++++++++ Trdo/Services/SettingsService.cs | 40 ++++++++++++++++++++++++++++ Trdo/ViewModels/PlayerViewModel.cs | 7 +++++ Trdo/ViewModels/SettingsViewModel.cs | 28 +++++++++++++++++++ 4 files changed, 99 insertions(+) diff --git a/Trdo/Pages/SettingsPage.xaml b/Trdo/Pages/SettingsPage.xaml index d1a31c0..0b3dfc0 100644 --- a/Trdo/Pages/SettingsPage.xaml +++ b/Trdo/Pages/SettingsPage.xaml @@ -43,6 +43,30 @@ + + + + + + + + + + diff --git a/Trdo/Services/SettingsService.cs b/Trdo/Services/SettingsService.cs index a16f265..b20bbca 100644 --- a/Trdo/Services/SettingsService.cs +++ b/Trdo/Services/SettingsService.cs @@ -9,6 +9,46 @@ public static class SettingsService { private const string IsFirstRunKey = "IsFirstRun"; private const string IsVolumeSliderVisibleKey = "IsVolumeSliderVisible"; + private const string AutoPlayOnStartupKey = "AutoPlayOnStartup"; + + /// + /// Gets or sets whether the app should automatically start playing the last selected station on startup. + /// Defaults to false when no saved value exists. + /// + public static bool AutoPlayOnStartup + { + get + { + try + { + if (ApplicationData.Current.LocalSettings.Values.TryGetValue(AutoPlayOnStartupKey, out object? value)) + { + return value switch + { + bool b => b, + string s when bool.TryParse(s, out bool b2) => b2, + _ => false + }; + } + return false; + } + catch + { + return false; + } + } + set + { + try + { + ApplicationData.Current.LocalSettings.Values[AutoPlayOnStartupKey] = value; + } + catch + { + // Silently fail if unable to save + } + } + } /// /// Gets or sets whether the volume slider is visible on the playing page. diff --git a/Trdo/ViewModels/PlayerViewModel.cs b/Trdo/ViewModels/PlayerViewModel.cs index 53f21ff..614d335 100644 --- a/Trdo/ViewModels/PlayerViewModel.cs +++ b/Trdo/ViewModels/PlayerViewModel.cs @@ -108,6 +108,13 @@ public PlayerViewModel() { Debug.WriteLine($"[PlayerViewModel] Initializing stream with URL: {_selectedStation.StreamUrl}"); InitializeStream(_selectedStation.StreamUrl); + + // Auto-play on startup if the setting is enabled + if (SettingsService.AutoPlayOnStartup) + { + Debug.WriteLine("[PlayerViewModel] AutoPlayOnStartup is enabled, starting playback..."); + _player.Play(); + } } else { diff --git a/Trdo/ViewModels/SettingsViewModel.cs b/Trdo/ViewModels/SettingsViewModel.cs index 213852c..ab06b6d 100644 --- a/Trdo/ViewModels/SettingsViewModel.cs +++ b/Trdo/ViewModels/SettingsViewModel.cs @@ -20,6 +20,7 @@ public partial class SettingsViewModel : INotifyPropertyChanged private string _startupToggleText = "Off"; private string _watchdogToggleText = "Off"; private string _autoBufferToggleText = "Off"; + private string _autoPlayOnStartupToggleText = "Off"; private StartupTask? _startupTask; private bool _initDone; @@ -57,6 +58,7 @@ public SettingsViewModel() // Initialize toggle text WatchdogToggleText = GetToggleText(_playerViewModel.WatchdogEnabled); AutoBufferToggleText = GetToggleText(_playerViewModel.AutoBufferIncreaseEnabled); + AutoPlayOnStartupToggleText = GetToggleText(SettingsService.AutoPlayOnStartup); // Initialize startup task _ = InitializeStartupTaskAsync(); @@ -101,6 +103,32 @@ public string StartupToggleText } } + /// + /// Gets or sets whether the app should automatically start playing the last selected station on startup. + /// + public bool IsAutoPlayOnStartupEnabled + { + get => SettingsService.AutoPlayOnStartup; + set + { + if (value == SettingsService.AutoPlayOnStartup) return; + SettingsService.AutoPlayOnStartup = value; + OnPropertyChanged(); + AutoPlayOnStartupToggleText = GetToggleText(value); + } + } + + public string AutoPlayOnStartupToggleText + { + get => _autoPlayOnStartupToggleText; + set + { + if (value == _autoPlayOnStartupToggleText) return; + _autoPlayOnStartupToggleText = value; + OnPropertyChanged(); + } + } + public bool IsWatchdogEnabled { get => _playerViewModel.WatchdogEnabled; From 1de7e3a4ed952dc3541759b658f28d8253cebf59 Mon Sep 17 00:00:00 2001 From: Joe Finney Date: Wed, 1 Apr 2026 00:16:34 -0500 Subject: [PATCH 3/4] Add warning InfoBar for auto-play on startup toggle Show a warning InfoBar when enabling "Auto-play on startup" to inform users that audio will start automatically. Require explicit confirmation via an "Enable anyway" button. Refactor toggle logic to use event handler and OneWay binding. Rename "Enable Auto-Resume" to "Auto-recover" with updated description. Use shared PlayerViewModel instance in SettingsViewModel. --- Trdo/Pages/SettingsPage.xaml | 25 +++++++++++++-- Trdo/Pages/SettingsPage.xaml.cs | 46 ++++++++++++++++++++++++++++ Trdo/ViewModels/SettingsViewModel.cs | 2 +- 3 files changed, 69 insertions(+), 4 deletions(-) diff --git a/Trdo/Pages/SettingsPage.xaml b/Trdo/Pages/SettingsPage.xaml index 0b3dfc0..edc234b 100644 --- a/Trdo/Pages/SettingsPage.xaml +++ b/Trdo/Pages/SettingsPage.xaml @@ -51,12 +51,26 @@ Foreground="{ThemeResource TextFillColorSecondaryBrush}" Text="Automatically start playing the last selected station when the app opens" TextWrapping="Wrap" /> + + +