using ytLive.Helpers;
using ytLive.Services.Entitlement;
namespace ytLive.ViewModels;
///
/// The app-wide Steam ownership flag and its output-profile consumer.
///
/// Only the entitlement service decides whether the current Steam account owns the paid app.
/// Development builds use a fake owned result; Release builds use Steam.
///
public partial class MainViewModel
{
private IEntitlement _entitlement = CreateEntitlement();
private bool _isAppOwned;
public bool IsAppOwned
{
get => _isAppOwned;
private set
{
if (!SetProperty(ref _isAppOwned, value)) return;
OnPropertyChanged(nameof(HasProOutput));
}
}
public bool HasProOutput => DeveloperMode || IsAppOwned;
private static IEntitlement CreateEntitlement()
{
#if DEBUG
return new FakeEntitlement(true);
#else
return SteamEntitlement.NotConfigured();
#endif
}
/// Test seam: swap the ownership source without a Steam client.
internal IEntitlement EntitlementOverride
{
get => _entitlement;
set
{
_entitlement = value;
IsAppOwned = value.IsAppOwned;
}
}
private bool _developerMode;
///
/// Development-only override: ignore the output budget and allow every shipped tier.
///
/// There is no UI to reach this in a Release build — the panel that hosts the
/// checkbox is excluded from the Release compile — and the setter refuses the value
/// unless is true, so even a hand-edited settings
/// file cannot unlock it.
///
public bool DeveloperMode
{
get => _developerMode;
set
{
if (!DevBuild.IsDevelopment) return;
if (!SetProperty(ref _developerMode, value)) return;
OnPropertyChanged(nameof(HasProOutput));
}
}
}