Ask users to clear the accounts when enabling widevine (#1249)

This commit is contained in:
Michael Bucari-Tovo 2025-05-09 17:51:48 -06:00
parent f35c82d59d
commit ef67ae9d6a
3 changed files with 44 additions and 7 deletions

View File

@ -31,10 +31,29 @@ namespace LibationAvalonia.Controls.Settings
if (!accounts.AccountsSettings.Accounts.Any(a => a.IdentityTokens.DeviceType == AudibleApi.Resources.DeviceType))
{
if (VisualRoot is Window parent)
await MessageBox.Show(parent,
"Your must remove account(s) from Libation and then re-add them to enable widwvine content.",
{
var choice = await MessageBox.Show(parent,
"In order to enable widevine content, Libation will need to log into your accounts again.\r\n\r\n" +
"Do you want Libation to clear your current account settings and prompt you to login before the next download?",
"Widevine Content Unavailable",
MessageBoxButtons.OK);
MessageBoxButtons.YesNo,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2);
if (choice == DialogResult.Yes)
{
foreach (var account in accounts.AccountsSettings.Accounts.ToArray())
{
if (account.IdentityTokens.DeviceType != AudibleApi.Resources.DeviceType)
{
accounts.AccountsSettings.Delete(account);
var acc = accounts.AccountsSettings.Upsert(account.AccountId, account.Locale.Name);
acc.AccountName = account.AccountName;
}
}
return;
}
}
_viewModel.UseWidevine = false;
}

View File

@ -257,7 +257,7 @@ namespace LibationFileManager
}
[Description("Use widevine DRM")]
public bool UseWidevine { get => GetNonString(defaultValue: true); set => SetNonString(value); }
public bool UseWidevine { get => GetNonString(defaultValue: false); set => SetNonString(value); }
[Description("Request Spatial Audio")]
public bool RequestSpatial { get => GetNonString(defaultValue: true); set => SetNonString(value); }

View File

@ -206,10 +206,28 @@ namespace LibationWinForms.Dialogs
if (!accounts.AccountsSettings.Accounts.Any(a => a.IdentityTokens.DeviceType == AudibleApi.Resources.DeviceType))
{
MessageBox.Show(this,
"Your must remove account(s) from Libation and then re-add them to enable widwvine content.",
var choice = MessageBox.Show(this,
"In order to enable widevine content, Libation will need to log into your accounts again.\r\n\r\n" +
"Do you want Libation to clear your current account settings and prompt you to login before the next download?",
"Widevine Content Unavailable",
MessageBoxButtons.OK);
MessageBoxButtons.YesNo,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2);
if (choice == DialogResult.Yes)
{
foreach (var account in accounts.AccountsSettings.Accounts.ToArray())
{
if (account.IdentityTokens.DeviceType != AudibleApi.Resources.DeviceType)
{
accounts.AccountsSettings.Delete(account);
var acc = accounts.AccountsSettings.Upsert(account.AccountId, account.Locale.Name);
acc.AccountName = account.AccountName;
}
}
return;
}
useWidevineCbox.Checked = false;
return;