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.
This commit is contained in:
@@ -456,10 +456,10 @@
|
|||||||
inert until there is an account; signing in re-enables them through
|
inert until there is an account; signing in re-enables them through
|
||||||
the ordinary IsConnected notification. -->
|
the ordinary IsConnected notification. -->
|
||||||
<StackPanel Visibility="{Binding SelectedElement.IsScoreboard, Converter={StaticResource BoolToVis}}"
|
<StackPanel Visibility="{Binding SelectedElement.IsScoreboard, Converter={StaticResource BoolToVis}}"
|
||||||
IsEnabled="{Binding IsConnected}" Margin="0,0,0,8">
|
IsEnabled="{Binding CanUseScoreboard}" Margin="0,0,0,8">
|
||||||
<TextBlock Text="Sign in to YouTube to use the scoreboard."
|
<TextBlock Text="Sign in to YouTube to use the scoreboard."
|
||||||
Foreground="{StaticResource Brush.OnSurfaceVariant}" FontSize="11" Margin="0,0,0,4"
|
Foreground="{StaticResource Brush.OnSurfaceVariant}" FontSize="11" Margin="0,0,0,4"
|
||||||
Visibility="{Binding IsConnected, Converter={StaticResource InverseBoolToVis}}"/>
|
Visibility="{Binding CanUseScoreboard, Converter={StaticResource InverseBoolToVis}}"/>
|
||||||
<!-- DEBUG builds only: prove the strip in the preview before a real
|
<!-- DEBUG builds only: prove the strip in the preview before a real
|
||||||
stream. Absent from Release, not merely hidden by a flag. -->
|
stream. Absent from Release, not merely hidden by a flag. -->
|
||||||
<CheckBox Style="{StaticResource YtCheckBox}" Margin="0,0,0,4"
|
<CheckBox Style="{StaticResource YtCheckBox}" Margin="0,0,0,4"
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ public partial class MainViewModel
|
|||||||
{
|
{
|
||||||
if (SetProperty(ref _isConnected, value))
|
if (SetProperty(ref _isConnected, value))
|
||||||
{
|
{
|
||||||
|
OnPropertyChanged(nameof(CanUseScoreboard));
|
||||||
// ON-AIR requires a sign-in; dropping the session turns the pill
|
// ON-AIR requires a sign-in; dropping the session turns the pill
|
||||||
// off so the state can never offer a stream without an account.
|
// off so the state can never offer a stream without an account.
|
||||||
if (!value) OnAirPillOn = false;
|
if (!value) OnAirPillOn = false;
|
||||||
|
|||||||
@@ -51,6 +51,11 @@ public partial class MainViewModel
|
|||||||
private const bool DevelopmentBuild = false;
|
private const bool DevelopmentBuild = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/// <summary>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).</summary>
|
||||||
|
public bool CanUseScoreboard => IsConnected || IsDevelopmentBuild;
|
||||||
|
|
||||||
/// <summary>True in a DEBUG build. Used only to expose development-only controls, never to
|
/// <summary>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.</summary>
|
/// change behaviour — the shipped binary differs by their absence, not by a code path.</summary>
|
||||||
public bool IsDevelopmentBuild => DevelopmentBuild;
|
public bool IsDevelopmentBuild => DevelopmentBuild;
|
||||||
|
|||||||
@@ -17,13 +17,13 @@ public class ScoreboardPropertiesTests
|
|||||||
// Gated on the selected layer being a scoreboard.
|
// Gated on the selected layer being a scoreboard.
|
||||||
Assert.Contains("SelectedElement.IsScoreboard", panel);
|
Assert.Contains("SelectedElement.IsScoreboard", panel);
|
||||||
|
|
||||||
// Signed out: the whole block is inert (the board is fed by the signed-in channel), with a
|
// Signed out: the block is inert with a one-line explanation — EXCEPT in a DEBUG build, where
|
||||||
// one-line explanation. Signing in re-enables it through the ordinary IsConnected raise.
|
// CanUseScoreboard is true so the strip can be previewed without an account.
|
||||||
var block = panel[panel.IndexOf("Scoreboard config", System.StringComparison.Ordinal)..];
|
var block = panel[panel.IndexOf("Scoreboard config", System.StringComparison.Ordinal)..];
|
||||||
block = block[..block.IndexOf("<!-- Countdown config -->", System.StringComparison.Ordinal)];
|
block = block[..block.IndexOf("<!-- Countdown config -->", 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("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.
|
// The master switch sits in the same panel: off hides the strip and stops the polling.
|
||||||
Assert.Contains("ScoreboardEnabled", panel);
|
Assert.Contains("ScoreboardEnabled", panel);
|
||||||
@@ -57,7 +57,7 @@ public class ScoreboardPropertiesTests
|
|||||||
{
|
{
|
||||||
"ScoreboardTextColor", "ScoreboardBackgroundColor", "ScoreboardBackgroundOpacity",
|
"ScoreboardTextColor", "ScoreboardBackgroundColor", "ScoreboardBackgroundOpacity",
|
||||||
"ScoreboardFontSize", "ScoreboardColorOptions", "ScoreboardShowSubscribers",
|
"ScoreboardFontSize", "ScoreboardColorOptions", "ScoreboardShowSubscribers",
|
||||||
"ScoreboardEnabled",
|
"ScoreboardEnabled", "CanUseScoreboard",
|
||||||
})
|
})
|
||||||
Assert.NotNull(type.GetProperty(name));
|
Assert.NotNull(type.GetProperty(name));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user