[android] Ask for the account manager's account identifier

QI
3d ago
+188-1

Summary

The "Use account manager" screen always asked for User:, although account managers identify accounts either by email address (e.g. Science United) or by user name (e.g. BAM!). This is indicated by uses_username in the account manager's get_project_config reply, which the desktop Manager already honours.

Change

  • When the account manager URL changes (spinner selection or manual input, debounced), the Manager now fetches the account manager's project config on a background dispatcher via monitor.getProjectConfigPolling(url) and adapts the account identifier field once the reply matches the current URL:
    • Email address: with an email keyboard if the account manager identifies accounts by email address,
    • User name: if it sets uses_username,
    • the previous User: while the config is being fetched or if it could not be retrieved.
  • The "missing input" error matches the identifier ("Please enter Email address" / "Please enter user name").
  • The value is still sent as the account manager name, so the acct_mgr_rpc request does not change.
  • New string attachproject_acctmgr_header_username added to values and values-en (required by validate_android_translations.py). Email address: reuses the already translated attachproject_login_header_id_email. Other translations are not modified.
  • uses_username was already parsed into ProjectConfig.usesName, so the parser does not change.

Testing

  • New unit tests: AccountIdentifierInputTest (config missing or failed, email-based, user-name-based).
  • ./gradlew testDebugUnitTest assembleRelease passes.
  • python ci_tools/validate_android_translations.py passes, and so does git diff --check.
  • Not tested yet on a device or emulator against Science United / BAM!.

Fixes #5388


Summary by cubic

Fixes the "Use account manager" screen so it asks for the account identifier the selected account manager actually uses. The screen always asked for User:, but some account managers identify accounts by email address (e.g. Science United) while others use user names (e.g. BAM!).

The label now adapts to the account manager's uses_username setting: Email address: with an email keyboard for email-based managers, User name: for user-name-based ones, and the previous User: label while the config is fetched or fails. The "missing input" error matches the label. The account manager RPC request is unchanged.

Fixes #5388