feat(alerts): a Test alert button in the alert properties

Sits to the right of the Built-in video pill, labelled "Test alert". It enqueues one synthetic
Super Chat through the real AlertOverlayLayer, so what plays is exactly what a viewer triggers —
the custom clip when one is set, the built-in clip otherwise — and it goes through the same
output path (preview and encoder) as a live alert. Local only: nothing reaches YouTube and no
chat row is invented.
This commit is contained in:
2026-11-01 14:04:20 -08:00
parent 754377c5db
commit 005b459fe0
3 changed files with 32 additions and 0 deletions
+7
View File
@@ -767,6 +767,13 @@
Foreground="#888" FontSize="10" TextWrapping="Wrap" Margin="0,0,0,6"/>
<DockPanel Margin="0,0,0,4">
<!-- Test alert (creator ruling 2026-11-01): plays the clip this box
would play — custom if one is set, built-in otherwise. -->
<Button DockPanel.Dock="Right" Content="▶ Test alert"
Command="{Binding TestAlertCommand}"
Style="{StaticResource YtButtonSecondary}"
Padding="8,2" FontSize="11" VerticalAlignment="Center"
ToolTip="Play the alert here, exactly as a viewer would trigger it"/>
<TextBlock DockPanel.Dock="Left" Text="Built-in video" Foreground="{StaticResource Brush.OnSurfaceVariant}" FontSize="11" VerticalAlignment="Center" Width="84"/>
<ToggleButton Style="{StaticResource PillToggle}"
IsChecked="{Binding SelectedElement.AlertUseDefaultVideo, Mode=TwoWay}"
+24
View File
@@ -119,6 +119,30 @@ public partial class MainViewModel : ViewModelBase
set => SetProperty(ref _featureRequestEmail, value);
}
/// <summary>
/// Properties-panel "Test alert" (creator ruling 2026-11-01): fire one synthetic Super Chat
/// through the REAL alert layer, so what plays is exactly what a viewer would trigger — the
/// custom clip if one is set, the built-in clip otherwise. Local only; nothing is sent to
/// YouTube and no chat row is invented.
/// </summary>
public RelayCommand TestAlertCommand { get; private set; } = null!;
private void TestAlert()
{
_alertLayer.Enqueue(new Models.ChatMessage
{
AuthorName = "Test viewer",
Message = "Test alert — this is what a Super Chat looks like.",
Timestamp = System.DateTime.Now,
IsSimulated = true,
IsSuperChat = true,
SuperChatAmount = 5.00,
SuperChatCurrency = "$",
SuperChatDisplayString = "$5.00",
Kind = Models.ChatEventKind.SuperChat,
});
}
public ICommand OpenSettingsCommand { get; }
public ICommand OpenBugCommand { get; }
public ICommand OpenFeatureCommand { get; }
+1
View File
@@ -235,6 +235,7 @@ public partial class MainViewModel : ViewModelBase
OpenMicPickerCommand = new RelayCommand(_ => PickMicrophone());
OpenSettingsCommand = new RelayCommand(_ => ToggleSettingsDrawer());
InitPreviewHistory();
TestAlertCommand = new RelayCommand(_ => TestAlert());
OpenBugCommand = new RelayCommand(_ => ShowOverlay(nameof(IsBugOpen), "Report Bug"));
OpenFeatureCommand = new RelayCommand(_ => ShowOverlay(nameof(IsFeatureOpen), "Feature Request"));
OpenAboutCommand = new RelayCommand(_ => ShowOverlay(nameof(IsAboutOpen), "About"));