Files
Libation/Source/LibationUiBase/AudibleAppLinkMessage.cs
Dominik Opwis deb83d13af Explain audible:// sign-in links instead of ignoring them
Audible's Android sign-in page links "Sign in with an Audible Username"
to audible://view?section=authportal&pageType=private, which only the
Audible app opens. In the embedded browser the click did nothing, so
username accounts set to a normal region had no way forward (#2169).

Both login dialogs now cancel audible:// navigations and tell the user
to switch the account to a pre-amazon locale, or back to a normal one
for the reverse link. The prefill script also fills the pre-amazon
username field (#ap_email), which it missed before, and no longer
overwrites a field that already has a value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 19:37:01 +01:00

33 lines
1.5 KiB
C#

using System;
namespace LibationUiBase;
/// <summary>
/// Audible's Android sign-in pages switch between Amazon and Audible-username sign-in through audible:// links,
/// which only the Audible app can open. In the embedded browser those clicks do nothing, so both login dialogs
/// cancel the navigation and show this message. In Libation the switch is the account's locale instead.
/// </summary>
public static class AudibleAppLinkMessage
{
public const string Caption = "Change the account's locale to switch sign-in";
private const string ToUsername =
"Audible usernames can't sign in on this page. It only accepts Amazon accounts.\r\n\r\n"
+ "Close this window, open Settings > Accounts, and set this account's Locale to the matching pre-amazon locale "
+ "(pre-amazon - us, pre-amazon - uk or pre-amazon - germany). Put your Audible username in \"Audible email/login\". "
+ "Then scan the library again.";
private const string ToAmazon =
"This page only accepts Audible usernames.\r\n\r\n"
+ "To sign in with an Amazon account, close this window, open Settings > Accounts, and set this account's Locale "
+ "to one that doesn't start with pre-amazon. Then scan the library again.";
/// <returns>The message to show instead of navigating to <paramref name="uri"/>, or null if it isn't an audible:// link.</returns>
public static string? ForNavigation(Uri? uri)
{
if (uri?.Scheme != "audible")
return null;
return uri.Query.Contains("pageType=public", StringComparison.OrdinalIgnoreCase) ? ToAmazon : ToUsername;
}
}