using ytLive.Services;
namespace ytLive.ViewModels;
public partial class MainViewModel
{
/// Test seam (mirrors CameraEnumeratorOverride): tests inject a fake
/// stats service before constructing the VM so refresh never hits the network.
internal static Func? ChannelStatsFactoryOverride { get; set; }
/// The YPP pull-out backing VM — the drawer below Stream Settings
/// on the Live screen's right edge (TASK 39).
public Services.YppTrackerViewModel Ypp { get; private set; } = null!;
private void InitYpp()
{
Ypp = new YppTrackerViewModel(
() => _layoutStore,
() => ChannelStatsFactoryOverride?.Invoke() ?? new ChannelStatsService(_youtubeAuth),
() => IsConnected,
() => _youtubeAuth.CurrentChannel?.DisplayName);
// One drawer at a time: the two pull-outs share the preview's right edge,
// so opening one collapses the other (both directions).
BroadcastForm.PropertyChanged += (_, e) =>
{
if (e.PropertyName == nameof(LiveBroadcastFormViewModel.IsDrawerOpen) && BroadcastForm.IsDrawerOpen)
Ypp.IsDrawerOpen = false;
};
Ypp.PropertyChanged += (_, e) =>
{
if (e.PropertyName == nameof(YppTrackerViewModel.IsDrawerOpen) && Ypp.IsDrawerOpen)
BroadcastForm.IsDrawerOpen = false;
};
}
}