From 7bde19fe5a329864e57d22ff44c89d9f95d53d55 Mon Sep 17 00:00:00 2001 From: Sebastian Hengst Date: Tue, 19 Sep 2017 20:07:39 +0200 Subject: [PATCH] Backed out changeset a3964204faf6 (bug 1398283) for failing android lint. r=backout --- .../base/locales/en-US/sync_strings.dtd | 15 ++++++++++++ .../fxa/FxAccountClientException.java | 23 +++++++++++++++++++ mobile/android/services/strings.xml.in | 10 ++++++++ 3 files changed, 48 insertions(+) diff --git a/mobile/android/base/locales/en-US/sync_strings.dtd b/mobile/android/base/locales/en-US/sync_strings.dtd index 23ae06862bc8..f5d00ab3ae8b 100644 --- a/mobile/android/base/locales/en-US/sync_strings.dtd +++ b/mobile/android/base/locales/en-US/sync_strings.dtd @@ -103,6 +103,21 @@ + + + + + + + + + + + + + diff --git a/mobile/android/services/src/main/java/org/mozilla/gecko/background/fxa/FxAccountClientException.java b/mobile/android/services/src/main/java/org/mozilla/gecko/background/fxa/FxAccountClientException.java index f0613158f9b9..28ee5630edbf 100644 --- a/mobile/android/services/src/main/java/org/mozilla/gecko/background/fxa/FxAccountClientException.java +++ b/mobile/android/services/src/main/java/org/mozilla/gecko/background/fxa/FxAccountClientException.java @@ -4,6 +4,7 @@ package org.mozilla.gecko.background.fxa; +import org.mozilla.gecko.R; import org.mozilla.gecko.sync.ExtendedJSONObject; import org.mozilla.gecko.sync.HTTPFailureException; import org.mozilla.gecko.sync.net.SyncStorageResponse; @@ -98,6 +99,28 @@ public class FxAccountClientException extends Exception { public boolean isAccountLocked() { return apiErrorNumber == FxAccountRemoteError.ACCOUNT_LOCKED; } + + public int getErrorMessageStringResource() { + if (isUpgradeRequired()) { + return R.string.fxaccount_remote_error_UPGRADE_REQUIRED; + } else if (isAccountAlreadyExists()) { + return R.string.fxaccount_remote_error_ATTEMPT_TO_CREATE_AN_ACCOUNT_THAT_ALREADY_EXISTS; + } else if (isAccountDoesNotExist()) { + return R.string.fxaccount_remote_error_ATTEMPT_TO_ACCESS_AN_ACCOUNT_THAT_DOES_NOT_EXIST; + } else if (isBadPassword()) { + return R.string.fxaccount_remote_error_INCORRECT_PASSWORD; + } else if (isUnverified()) { + return R.string.fxaccount_remote_error_ATTEMPT_TO_OPERATE_ON_AN_UNVERIFIED_ACCOUNT; + } else if (isTooManyRequests()) { + return R.string.fxaccount_remote_error_CLIENT_HAS_SENT_TOO_MANY_REQUESTS; + } else if (isServerUnavailable()) { + return R.string.fxaccount_remote_error_SERVICE_TEMPORARILY_UNAVAILABLE_TO_DUE_HIGH_LOAD; + } else if (isAccountLocked()) { + return R.string.fxaccount_remote_error_ACCOUNT_LOCKED; + } else { + return R.string.fxaccount_remote_error_UNKNOWN_ERROR; + } + } } public static class FxAccountClientMalformedResponseException extends FxAccountClientRemoteException { diff --git a/mobile/android/services/strings.xml.in b/mobile/android/services/strings.xml.in index 8d6f70a03e66..2d59efa147a4 100644 --- a/mobile/android/services/strings.xml.in +++ b/mobile/android/services/strings.xml.in @@ -61,6 +61,16 @@ &fxaccount_options_title; &fxaccount_options_configure_title; +&fxaccount_remote_error_UPGRADE_REQUIRED; +&fxaccount_remote_error_ATTEMPT_TO_CREATE_AN_ACCOUNT_THAT_ALREADY_EXISTS_2; +&fxaccount_remote_error_ATTEMPT_TO_ACCESS_AN_ACCOUNT_THAT_DOES_NOT_EXIST; +&fxaccount_remote_error_INCORRECT_PASSWORD; +&fxaccount_remote_error_ATTEMPT_TO_OPERATE_ON_AN_UNVERIFIED_ACCOUNT; +&fxaccount_remote_error_CLIENT_HAS_SENT_TOO_MANY_REQUESTS; +&fxaccount_remote_error_SERVICE_TEMPORARILY_UNAVAILABLE_TO_DUE_HIGH_LOAD; +&fxaccount_remote_error_UNKNOWN_ERROR; +&fxaccount_remote_error_ACCOUNT_LOCKED; + &fxaccount_sync_sign_in_error_notification_title2; &fxaccount_sync_sign_in_error_notification_text2;