@Override public void handleFailure(FxAccountClientRemoteException e) { if (e.isUpgradeRequired()) { Logger.error( LOG_TAG, "Got upgrade required from remote server; transitioning Firefox Account to Doghouse state."); final State state = fxAccount.getState(); fxAccount.setState(state.makeDoghouseState()); // The status activity will say that the user needs to upgrade. redirectToActivity(FxAccountStatusActivity.class); return; } showRemoteError(e, R.string.fxaccount_update_credentials_unknown_error); }
protected void showClientRemoteException(final FxAccountClientRemoteException e) { if (!e.isAccountLocked()) { remoteErrorTextView.setText(e.getErrorMessageStringResource()); return; } // This horrible bit of special-casing is because we want this error message // to contain a clickable, extra chunk of text, but we don't want to pollute // the exception class with Android specifics. final int messageId = e.getErrorMessageStringResource(); final int clickableId = R.string.fxaccount_resend_unlock_code_button_label; final Spannable span = Utils.interpolateClickableSpan( this, messageId, clickableId, new ClickableSpan() { @Override public void onClick(View widget) { // It would be best to capture the email address sent to the server // and use it here, but this will do for now. If the user modifies // the email address entered, the error text is hidden, so sending a // changed email address would be the result of an unusual race. final String email = emailEdit.getText().toString(); byte[] emailUTF8 = null; try { emailUTF8 = email.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { // It's okay, we'll fail in the code resender. } FxAccountUnlockCodeResender.resendUnlockCode( FxAccountAbstractSetupActivity.this, getAuthServerEndpoint(), emailUTF8); } }); remoteErrorTextView.setMovementMethod(LinkMovementMethod.getInstance()); remoteErrorTextView.setText(span); }