Backed out changeset a3964204faf6 (bug 1398283) for failing android lint. r=backout

This commit is contained in:
Sebastian Hengst 2017-09-19 20:07:39 +02:00
Родитель 734fdf1202
Коммит 7bde19fe5a
3 изменённых файлов: 48 добавлений и 0 удалений

Просмотреть файл

@ -103,6 +103,21 @@
<!ENTITY fxaccount_options_title '&syncBrand.shortName.label; Options'> <!ENTITY fxaccount_options_title '&syncBrand.shortName.label; Options'>
<!ENTITY fxaccount_options_configure_title 'Configure &syncBrand.shortName.label;'> <!ENTITY fxaccount_options_configure_title 'Configure &syncBrand.shortName.label;'>
<!-- Localization note: these error messages are shown after a request
has been made to the remote server, and an error of some type has
been returned. -->
<!ENTITY fxaccount_remote_error_UPGRADE_REQUIRED 'You need to upgrade Firefox'>
<!-- Localization note: the format string will be fxaccount_sign_in_button_label, linkified. -->
<!ENTITY fxaccount_remote_error_ATTEMPT_TO_CREATE_AN_ACCOUNT_THAT_ALREADY_EXISTS_2 'Account already exists. &formatS1;'>
<!ENTITY fxaccount_remote_error_ATTEMPT_TO_ACCESS_AN_ACCOUNT_THAT_DOES_NOT_EXIST 'Invalid email or password'>
<!ENTITY fxaccount_remote_error_INCORRECT_PASSWORD 'Invalid email or password'>
<!ENTITY fxaccount_remote_error_ATTEMPT_TO_OPERATE_ON_AN_UNVERIFIED_ACCOUNT 'Account is not verified'>
<!ENTITY fxaccount_remote_error_CLIENT_HAS_SENT_TOO_MANY_REQUESTS 'Server busy, try again soon'>
<!ENTITY fxaccount_remote_error_SERVICE_TEMPORARILY_UNAVAILABLE_TO_DUE_HIGH_LOAD 'Server busy, try again soon'>
<!ENTITY fxaccount_remote_error_UNKNOWN_ERROR 'There was a problem'>
<!ENTITY fxaccount_remote_error_ACCOUNT_LOCKED 'Account is locked. &formatS1;'>
<!ENTITY fxaccount_sync_sign_in_error_notification_title2 '&syncBrand.shortName.label; is not connected'> <!ENTITY fxaccount_sync_sign_in_error_notification_title2 '&syncBrand.shortName.label; is not connected'>
<!-- Localization note: the format string below will be replaced <!-- Localization note: the format string below will be replaced
with the Firefox Account's email address. --> with the Firefox Account's email address. -->

Просмотреть файл

@ -4,6 +4,7 @@
package org.mozilla.gecko.background.fxa; package org.mozilla.gecko.background.fxa;
import org.mozilla.gecko.R;
import org.mozilla.gecko.sync.ExtendedJSONObject; import org.mozilla.gecko.sync.ExtendedJSONObject;
import org.mozilla.gecko.sync.HTTPFailureException; import org.mozilla.gecko.sync.HTTPFailureException;
import org.mozilla.gecko.sync.net.SyncStorageResponse; import org.mozilla.gecko.sync.net.SyncStorageResponse;
@ -98,6 +99,28 @@ public class FxAccountClientException extends Exception {
public boolean isAccountLocked() { public boolean isAccountLocked() {
return apiErrorNumber == FxAccountRemoteError.ACCOUNT_LOCKED; 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 { public static class FxAccountClientMalformedResponseException extends FxAccountClientRemoteException {

Просмотреть файл

@ -61,6 +61,16 @@
<string name="fxaccount_options_title">&fxaccount_options_title;</string> <string name="fxaccount_options_title">&fxaccount_options_title;</string>
<string name="fxaccount_options_configure_title">&fxaccount_options_configure_title;</string> <string name="fxaccount_options_configure_title">&fxaccount_options_configure_title;</string>
<string name="fxaccount_remote_error_UPGRADE_REQUIRED">&fxaccount_remote_error_UPGRADE_REQUIRED;</string>
<string name="fxaccount_remote_error_ATTEMPT_TO_CREATE_AN_ACCOUNT_THAT_ALREADY_EXISTS">&fxaccount_remote_error_ATTEMPT_TO_CREATE_AN_ACCOUNT_THAT_ALREADY_EXISTS_2;</string>
<string name="fxaccount_remote_error_ATTEMPT_TO_ACCESS_AN_ACCOUNT_THAT_DOES_NOT_EXIST">&fxaccount_remote_error_ATTEMPT_TO_ACCESS_AN_ACCOUNT_THAT_DOES_NOT_EXIST;</string>
<string name="fxaccount_remote_error_INCORRECT_PASSWORD">&fxaccount_remote_error_INCORRECT_PASSWORD;</string>
<string name="fxaccount_remote_error_ATTEMPT_TO_OPERATE_ON_AN_UNVERIFIED_ACCOUNT">&fxaccount_remote_error_ATTEMPT_TO_OPERATE_ON_AN_UNVERIFIED_ACCOUNT;</string>
<string name="fxaccount_remote_error_CLIENT_HAS_SENT_TOO_MANY_REQUESTS">&fxaccount_remote_error_CLIENT_HAS_SENT_TOO_MANY_REQUESTS;</string>
<string name="fxaccount_remote_error_SERVICE_TEMPORARILY_UNAVAILABLE_TO_DUE_HIGH_LOAD">&fxaccount_remote_error_SERVICE_TEMPORARILY_UNAVAILABLE_TO_DUE_HIGH_LOAD;</string>
<string name="fxaccount_remote_error_UNKNOWN_ERROR">&fxaccount_remote_error_UNKNOWN_ERROR;</string>
<string name="fxaccount_remote_error_ACCOUNT_LOCKED">&fxaccount_remote_error_ACCOUNT_LOCKED;</string>
<string name="fxaccount_sync_sign_in_error_notification_title">&fxaccount_sync_sign_in_error_notification_title2;</string> <string name="fxaccount_sync_sign_in_error_notification_title">&fxaccount_sync_sign_in_error_notification_title2;</string>
<string name="fxaccount_sync_sign_in_error_notification_text">&fxaccount_sync_sign_in_error_notification_text2;</string> <string name="fxaccount_sync_sign_in_error_notification_text">&fxaccount_sync_sign_in_error_notification_text2;</string>