429 copy uses the relay's Retry-After

RelayException.RateLimited has parsed the header all along; the relay
never sent it until today. The message now says "Try again in about
N minutes" when the clock is known, with the old copy as fallback.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Paul Hitt
2026-08-28 17:37:32 -04:00
co-authored by Claude Fable 5
parent 7885f55849
commit 4e6aedf5f0
@@ -1736,7 +1736,13 @@ class MessengerViewModel(app: Application) : AndroidViewModel(app) {
is RelayException.Unauthorized ->
"Your session expired. Sign out and back in to keep going."
is RelayException.NotFound -> "This server doesn't look like a Flamenet relay."
is RelayException.RateLimited -> "Too many attempts. Wait a few minutes."
// The relay now says WHEN (Retry-After); a refusal with a clock is
// the difference between a person who waits and one who hammers.
is RelayException.RateLimited -> failure.retryAfterSeconds?.let { s ->
val mins = ((s + 59) / 60).coerceAtLeast(1)
"Too many attempts. Try again in about $mins minute" +
if (mins == 1) "." else "s."
} ?: "Too many attempts. Wait a few minutes."
is Vault.Corrupt -> "This phone's stored keys could not be read."
else -> failure.message ?: "Something went wrong reaching that server."
}