From 9405c54750aed6b3e78b89b5c2e71364bdab620c Mon Sep 17 00:00:00 2001 From: gramps Date: Fri, 30 Oct 2026 15:01:32 -0700 Subject: [PATCH] feat(scoreboard): dev mode can configure the board without signing in Creator (2026-10-30): in dev mode the "Show the scoreboard" option must always be available. The block's gate becomes CanUseScoreboard = IsConnected || IsDevelopmentBuild. Signed-out Release still shows the inert block with its "sign in" line; a DEBUG build is fully usable, so the strip can be toggled and previewed before there is an account. IsConnected raises it, so signing in flips it live. Guard: ScoreboardPropertiesTests now asserts the CanUseScoreboard gate (enabled AND hint), and the VM surface list includes it. --- Controls/LeftPanel.xaml | 4 ++-- ViewModels/MainViewModel.Account.cs | 1 + ViewModels/MainViewModel.Scoreboard.cs | 5 +++++ ytLive.Tests/ScoreboardPropertiesTests.cs | 10 +++++----- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Controls/LeftPanel.xaml b/Controls/LeftPanel.xaml index 65d5a4c..6e5c1d3 100644 --- a/Controls/LeftPanel.xaml +++ b/Controls/LeftPanel.xaml @@ -456,10 +456,10 @@ inert until there is an account; signing in re-enables them through the ordinary IsConnected notification. --> + IsEnabled="{Binding CanUseScoreboard}" Margin="0,0,0,8"> + Visibility="{Binding CanUseScoreboard, Converter={StaticResource InverseBoolToVis}}"/> Can the scoreboard be configured at all? Signed-in creators yes; in a DEBUG build + /// always, so the strip can be previewed and judged before there is an account (creator, + /// 2026-10-30). + public bool CanUseScoreboard => IsConnected || IsDevelopmentBuild; + /// True in a DEBUG build. Used only to expose development-only controls, never to /// change behaviour — the shipped binary differs by their absence, not by a code path. public bool IsDevelopmentBuild => DevelopmentBuild; diff --git a/ytLive.Tests/ScoreboardPropertiesTests.cs b/ytLive.Tests/ScoreboardPropertiesTests.cs index 84913e6..c157a2e 100644 --- a/ytLive.Tests/ScoreboardPropertiesTests.cs +++ b/ytLive.Tests/ScoreboardPropertiesTests.cs @@ -17,13 +17,13 @@ public class ScoreboardPropertiesTests // Gated on the selected layer being a scoreboard. Assert.Contains("SelectedElement.IsScoreboard", panel); - // Signed out: the whole block is inert (the board is fed by the signed-in channel), with a - // one-line explanation. Signing in re-enables it through the ordinary IsConnected raise. + // Signed out: the block is inert with a one-line explanation — EXCEPT in a DEBUG build, where + // CanUseScoreboard is true so the strip can be previewed without an account. var block = panel[panel.IndexOf("Scoreboard config", System.StringComparison.Ordinal)..]; block = block[..block.IndexOf("", System.StringComparison.Ordinal)]; - Assert.Contains("IsEnabled=\"{Binding IsConnected}\"", block); + Assert.Contains("IsEnabled=\"{Binding CanUseScoreboard}\"", block); Assert.Contains("Sign in to YouTube to use the scoreboard.", block); - Assert.Contains("InverseBoolToVis", block); + Assert.Contains("CanUseScoreboard, Converter={StaticResource InverseBoolToVis}", block); // The master switch sits in the same panel: off hides the strip and stops the polling. Assert.Contains("ScoreboardEnabled", panel); @@ -57,7 +57,7 @@ public class ScoreboardPropertiesTests { "ScoreboardTextColor", "ScoreboardBackgroundColor", "ScoreboardBackgroundOpacity", "ScoreboardFontSize", "ScoreboardColorOptions", "ScoreboardShowSubscribers", - "ScoreboardEnabled", + "ScoreboardEnabled", "CanUseScoreboard", }) Assert.NotNull(type.GetProperty(name)); }