diff --git a/mobile/android/base/android-services.mozbuild b/mobile/android/base/android-services.mozbuild index 3c9478dd8df1..ab2daafb7e5b 100644 --- a/mobile/android/base/android-services.mozbuild +++ b/mobile/android/base/android-services.mozbuild @@ -895,11 +895,6 @@ sync_java_files = [TOPSRCDIR + '/mobile/android/services/src/main/java/org/mozil 'fxa/sync/FxAccountSyncStatusHelper.java', 'fxa/sync/SchedulePolicy.java', 'fxa/SyncStatusListener.java', - 'fxa/tasks/FxAccountCodeResender.java', - 'fxa/tasks/FxAccountCreateAccountTask.java', - 'fxa/tasks/FxAccountSetupTask.java', - 'fxa/tasks/FxAccountSignInTask.java', - 'fxa/tasks/FxAccountUnlockCodeResender.java', 'sync/AlreadySyncingException.java', 'sync/BackoffHandler.java', 'sync/BadRequiredFieldJSONException.java', diff --git a/mobile/android/base/home/RemoteTabsStaticFragment.java b/mobile/android/base/home/RemoteTabsStaticFragment.java index bbf729ac2d75..54014f4a9346 100644 --- a/mobile/android/base/home/RemoteTabsStaticFragment.java +++ b/mobile/android/base/home/RemoteTabsStaticFragment.java @@ -107,8 +107,9 @@ public class RemoteTabsStaticFragment extends HomeFragment implements OnClickLis final EnumSet flags = EnumSet.noneOf(OnUrlOpenListener.Flags.class); mUrlOpenListener.onUrlOpen(url, flags); } else if (id == R.id.remote_tabs_needs_verification_resend_email) { - // Send a fresh email; this displays a toast, so the user gets feedback. - FirefoxAccounts.resendVerificationEmail(getActivity()); + final Intent intent = new Intent(FxAccountConstants.ACTION_FXA_CONFIRM_ACCOUNT); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); } else if (id == R.id.remote_tabs_needs_verification_help) { // Don't allow switch-to-tab. final EnumSet flags = EnumSet.noneOf(OnUrlOpenListener.Flags.class); diff --git a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/FirefoxAccounts.java b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/FirefoxAccounts.java index 5917d585bcc4..4dddd6d78cb4 100644 --- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/FirefoxAccounts.java +++ b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/FirefoxAccounts.java @@ -17,7 +17,6 @@ import org.mozilla.gecko.fxa.authenticator.AndroidFxAccount; import org.mozilla.gecko.fxa.login.State; import org.mozilla.gecko.fxa.sync.FxAccountSyncAdapter; import org.mozilla.gecko.fxa.sync.FxAccountSyncStatusHelper; -import org.mozilla.gecko.fxa.tasks.FxAccountCodeResender; import org.mozilla.gecko.sync.ThreadPool; import org.mozilla.gecko.sync.Utils; @@ -26,7 +25,6 @@ import android.accounts.AccountManager; import android.content.ContentResolver; import android.content.Context; import android.content.res.Resources; -import android.os.AsyncTask; import android.os.Bundle; /** @@ -303,26 +301,4 @@ public class FirefoxAccounts { final String LOCALE = Utils.getLanguageTag(locale); return res.getString(R.string.fxaccount_link_old_firefox, VERSION, OS, LOCALE); } - - /** - * Resends the account verification email, and displays an appropriate - * toast on both send success and failure. Note that because the underlying implementation - * uses {@link AsyncTask}, the provided context must be UI-capable, and this - * method called from the UI thread (see - * {@link org.mozilla.gecko.fxa.tasks.FxAccountCodeResender#resendCode(Context, AndroidFxAccount)} - * for more). - * - * @param context a UI-capable Android context. - * @return true if an account exists, false otherwise. - */ - public static boolean resendVerificationEmail(final Context context) { - final Account account = getFirefoxAccount(context); - if (account == null) { - return false; - } - - final AndroidFxAccount fxAccount = new AndroidFxAccount(context, account); - FxAccountCodeResender.resendCode(context, fxAccount); - return true; - } } diff --git a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/activities/FxAccountAbstractSetupActivity.java b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/activities/FxAccountAbstractSetupActivity.java index ff035676f49f..6a2a950e6b50 100644 --- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/activities/FxAccountAbstractSetupActivity.java +++ b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/activities/FxAccountAbstractSetupActivity.java @@ -4,66 +4,7 @@ package org.mozilla.gecko.fxa.activities; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.mozilla.gecko.AppConstants; -import org.mozilla.gecko.R; -import org.mozilla.gecko.background.common.log.Logger; -import org.mozilla.gecko.background.fxa.FxAccountClient10.RequestDelegate; -import org.mozilla.gecko.background.fxa.FxAccountClient20.LoginResponse; -import org.mozilla.gecko.background.fxa.FxAccountClientException.FxAccountClientRemoteException; -import org.mozilla.gecko.background.fxa.FxAccountUtils; -import org.mozilla.gecko.background.fxa.PasswordStretcher; -import org.mozilla.gecko.background.fxa.QuickPasswordStretcher; -import org.mozilla.gecko.fxa.FxAccountConstants; -import org.mozilla.gecko.fxa.authenticator.AndroidFxAccount; -import org.mozilla.gecko.fxa.login.Engaged; -import org.mozilla.gecko.fxa.login.State; -import org.mozilla.gecko.fxa.tasks.FxAccountSetupTask.ProgressDisplay; -import org.mozilla.gecko.fxa.tasks.FxAccountUnlockCodeResender; -import org.mozilla.gecko.sync.ExtendedJSONObject; -import org.mozilla.gecko.sync.SyncConfiguration; -import org.mozilla.gecko.sync.Utils; -import org.mozilla.gecko.sync.setup.Constants; -import org.mozilla.gecko.sync.setup.activities.ActivityUtils; -import org.mozilla.gecko.util.ColorUtils; - -import android.accounts.Account; -import android.accounts.AccountManager; -import android.animation.LayoutTransition; -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.Intent; -import android.os.AsyncTask; -import android.os.Bundle; -import android.text.Editable; -import android.text.Spannable; -import android.text.TextWatcher; -import android.text.method.LinkMovementMethod; -import android.text.method.PasswordTransformationMethod; -import android.text.method.SingleLineTransformationMethod; -import android.text.style.ClickableSpan; -import android.util.Patterns; -import android.view.KeyEvent; -import android.view.View; -import android.view.View.OnClickListener; -import android.view.View.OnFocusChangeListener; -import android.view.ViewGroup; -import android.widget.ArrayAdapter; -import android.widget.AutoCompleteTextView; -import android.widget.Button; -import android.widget.EditText; -import android.widget.ProgressBar; -import android.widget.TextView; -import android.widget.TextView.OnEditorActionListener; - -abstract public class FxAccountAbstractSetupActivity extends FxAccountAbstractActivity implements ProgressDisplay { +abstract public class FxAccountAbstractSetupActivity extends FxAccountAbstractActivity { public static final String EXTRA_EMAIL = "email"; public static final String EXTRA_PASSWORD = "password"; public static final String EXTRA_PASSWORD_SHOWN = "password_shown"; diff --git a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/activities/FxAccountStatusFragment.java b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/activities/FxAccountStatusFragment.java index fe1e64643293..03cfbdb2165c 100644 --- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/activities/FxAccountStatusFragment.java +++ b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/activities/FxAccountStatusFragment.java @@ -38,7 +38,6 @@ import org.mozilla.gecko.fxa.authenticator.AndroidFxAccount; import org.mozilla.gecko.fxa.login.Married; import org.mozilla.gecko.fxa.login.State; import org.mozilla.gecko.fxa.sync.FxAccountSyncStatusHelper; -import org.mozilla.gecko.fxa.tasks.FxAccountCodeResender; import org.mozilla.gecko.sync.ExtendedJSONObject; import org.mozilla.gecko.sync.SharedPreferencesClientsDataDelegate; import org.mozilla.gecko.sync.SyncConfiguration; diff --git a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/tasks/FxAccountCodeResender.java b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/tasks/FxAccountCodeResender.java deleted file mode 100644 index d98e97f0804c..000000000000 --- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/tasks/FxAccountCodeResender.java +++ /dev/null @@ -1,109 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -package org.mozilla.gecko.fxa.tasks; - -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; - -import org.mozilla.gecko.R; -import org.mozilla.gecko.background.common.log.Logger; -import org.mozilla.gecko.background.fxa.FxAccountClient; -import org.mozilla.gecko.background.fxa.FxAccountClient10.RequestDelegate; -import org.mozilla.gecko.background.fxa.FxAccountClient20; -import org.mozilla.gecko.background.fxa.FxAccountClientException.FxAccountClientRemoteException; -import org.mozilla.gecko.fxa.authenticator.AndroidFxAccount; -import org.mozilla.gecko.fxa.login.Engaged; - -import android.content.Context; -import android.os.AsyncTask; -import android.widget.Toast; - -/** - * A helper class that provides a simple interface for requesting - * a Firefox Account verification email to be resent. - */ -public class FxAccountCodeResender { - private static final String LOG_TAG = FxAccountCodeResender.class.getSimpleName(); - - private static class FxAccountResendCodeTask extends FxAccountSetupTask { - protected static final String LOG_TAG = FxAccountResendCodeTask.class.getSimpleName(); - - protected final byte[] sessionToken; - - public FxAccountResendCodeTask(Context context, byte[] sessionToken, FxAccountClient client, RequestDelegate delegate) { - super(context, null, client, null, delegate); - this.sessionToken = sessionToken; - } - - @Override - protected InnerRequestDelegate doInBackground(Void... arg0) { - try { - client.resendCode(sessionToken, innerDelegate); - latch.await(); - return innerDelegate; - } catch (Exception e) { - Logger.error(LOG_TAG, "Got exception signing in.", e); - delegate.handleError(e); - } - return null; - } - } - - private static class ResendCodeDelegate implements RequestDelegate { - public final Context context; - - public ResendCodeDelegate(Context context) { - this.context = context; - } - - @Override - public void handleError(Exception e) { - Logger.warn(LOG_TAG, "Got exception requesting fresh confirmation link; ignoring.", e); - Toast.makeText(context, R.string.fxaccount_confirm_account_verification_link_not_sent, Toast.LENGTH_LONG).show(); - } - - @Override - public void handleFailure(FxAccountClientRemoteException e) { - handleError(e); - } - - @Override - public void handleSuccess(Void result) { - Toast.makeText(context, R.string.fxaccount_confirm_account_verification_link_sent, Toast.LENGTH_SHORT).show(); - } - } - - /** - * Resends the account verification email, and displays an appropriate - * toast on both send success and failure. Note that because the underlying implementation - * uses {@link AsyncTask}, the provided context must be UI-capable and - * this method called from the UI thread. - * - * Note that it may actually be possible to run this (and the {@link AsyncTask}) method - * from a background thread - but this hasn't been tested. - * - * @param context A UI-capable Android context. - * @param fxAccount The Firefox Account to resend the code to. - */ - public static void resendCode(Context context, AndroidFxAccount fxAccount) { - RequestDelegate delegate = new ResendCodeDelegate(context); - - byte[] sessionToken; - try { - sessionToken = ((Engaged) fxAccount.getState()).getSessionToken(); - } catch (Exception e) { - delegate.handleError(e); - return; - } - if (sessionToken == null) { - delegate.handleError(new IllegalStateException("sessionToken should not be null")); - return; - } - - Executor executor = Executors.newSingleThreadExecutor(); - FxAccountClient client = new FxAccountClient20(fxAccount.getAccountServerURI(), executor); - new FxAccountResendCodeTask(context, sessionToken, client, delegate).execute(); - } -} diff --git a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/tasks/FxAccountCreateAccountTask.java b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/tasks/FxAccountCreateAccountTask.java deleted file mode 100644 index cf1c74e9490d..000000000000 --- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/tasks/FxAccountCreateAccountTask.java +++ /dev/null @@ -1,42 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -package org.mozilla.gecko.fxa.tasks; - -import java.io.UnsupportedEncodingException; -import java.util.Map; - -import org.mozilla.gecko.background.common.log.Logger; -import org.mozilla.gecko.background.fxa.FxAccountClient; -import org.mozilla.gecko.background.fxa.FxAccountClient10.RequestDelegate; -import org.mozilla.gecko.background.fxa.FxAccountClient20.LoginResponse; -import org.mozilla.gecko.background.fxa.PasswordStretcher; - -import android.content.Context; - -public class FxAccountCreateAccountTask extends FxAccountSetupTask { - private static final String LOG_TAG = FxAccountCreateAccountTask.class.getSimpleName(); - - protected final byte[] emailUTF8; - protected final PasswordStretcher passwordStretcher; - - public FxAccountCreateAccountTask(Context context, ProgressDisplay progressDisplay, String email, PasswordStretcher passwordStretcher, FxAccountClient client, Map queryParameters, RequestDelegate delegate) throws UnsupportedEncodingException { - super(context, progressDisplay, client, queryParameters, delegate); - this.emailUTF8 = email.getBytes("UTF-8"); - this.passwordStretcher = passwordStretcher; - } - - @Override - protected InnerRequestDelegate doInBackground(Void... arg0) { - try { - client.createAccountAndGetKeys(emailUTF8, passwordStretcher, queryParameters, innerDelegate); - latch.await(); - return innerDelegate; - } catch (Exception e) { - Logger.error(LOG_TAG, "Got exception logging in.", e); - delegate.handleError(e); - } - return null; - } -} diff --git a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/tasks/FxAccountSetupTask.java b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/tasks/FxAccountSetupTask.java deleted file mode 100644 index c5c9c429c288..000000000000 --- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/tasks/FxAccountSetupTask.java +++ /dev/null @@ -1,121 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -package org.mozilla.gecko.fxa.tasks; - -import java.util.Map; -import java.util.concurrent.CountDownLatch; - -import org.mozilla.gecko.background.common.log.Logger; -import org.mozilla.gecko.background.fxa.FxAccountClient; -import org.mozilla.gecko.background.fxa.FxAccountClient10.RequestDelegate; -import org.mozilla.gecko.background.fxa.FxAccountClientException.FxAccountClientRemoteException; -import org.mozilla.gecko.fxa.tasks.FxAccountSetupTask.InnerRequestDelegate; - -import android.content.Context; -import android.os.AsyncTask; - -/** - * An AsyncTask wrapper around signing up for, and signing in to, a - * Firefox Account. - *

- * It's strange to add explicit blocking to callback-threading code, but we do - * it here to take advantage of Android's built in support for background work. - * We really want to avoid making a threading mistake that brings down the whole - * process. - */ -public abstract class FxAccountSetupTask extends AsyncTask> { - private static final String LOG_TAG = FxAccountSetupTask.class.getSimpleName(); - - public interface ProgressDisplay { - public void showProgress(); - public void dismissProgress(); - } - - protected final Context context; - protected final FxAccountClient client; - protected final ProgressDisplay progressDisplay; - - // Initialized lazily. - protected byte[] quickStretchedPW; - - // AsyncTask's are one-time-use, so final members are fine. - protected final CountDownLatch latch = new CountDownLatch(1); - protected final InnerRequestDelegate innerDelegate = new InnerRequestDelegate(latch); - - protected final Map queryParameters; - - protected final RequestDelegate delegate; - - public FxAccountSetupTask(Context context, ProgressDisplay progressDisplay, FxAccountClient client, Map queryParameters, RequestDelegate delegate) { - this.context = context; - this.client = client; - this.delegate = delegate; - this.progressDisplay = progressDisplay; - this.queryParameters = queryParameters; - } - - @Override - protected void onPreExecute() { - if (progressDisplay != null) { - progressDisplay.showProgress(); - } - } - - @Override - protected void onPostExecute(InnerRequestDelegate result) { - if (progressDisplay != null) { - progressDisplay.dismissProgress(); - } - - // We are on the UI thread, and need to invoke these callbacks here to allow UI updating. - if (innerDelegate.failure != null) { - delegate.handleFailure(innerDelegate.failure); - } else if (innerDelegate.exception != null) { - delegate.handleError(innerDelegate.exception); - } else { - delegate.handleSuccess(result.response); - } - } - - @Override - protected void onCancelled(InnerRequestDelegate result) { - if (progressDisplay != null) { - progressDisplay.dismissProgress(); - } - delegate.handleError(new IllegalStateException("Task was cancelled.")); - } - - protected static class InnerRequestDelegate implements RequestDelegate { - protected final CountDownLatch latch; - public T response; - public Exception exception; - public FxAccountClientRemoteException failure; - - protected InnerRequestDelegate(CountDownLatch latch) { - this.latch = latch; - } - - @Override - public void handleError(Exception e) { - Logger.error(LOG_TAG, "Got exception."); - this.exception = e; - latch.countDown(); - } - - @Override - public void handleFailure(FxAccountClientRemoteException e) { - Logger.warn(LOG_TAG, "Got failure."); - this.failure = e; - latch.countDown(); - } - - @Override - public void handleSuccess(T result) { - Logger.info(LOG_TAG, "Got success."); - this.response = result; - latch.countDown(); - } - } -} diff --git a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/tasks/FxAccountSignInTask.java b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/tasks/FxAccountSignInTask.java deleted file mode 100644 index dd5ae0d5e937..000000000000 --- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/tasks/FxAccountSignInTask.java +++ /dev/null @@ -1,42 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -package org.mozilla.gecko.fxa.tasks; - -import java.io.UnsupportedEncodingException; -import java.util.Map; - -import org.mozilla.gecko.background.common.log.Logger; -import org.mozilla.gecko.background.fxa.FxAccountClient; -import org.mozilla.gecko.background.fxa.FxAccountClient10.RequestDelegate; -import org.mozilla.gecko.background.fxa.FxAccountClient20.LoginResponse; -import org.mozilla.gecko.background.fxa.PasswordStretcher; - -import android.content.Context; - -public class FxAccountSignInTask extends FxAccountSetupTask { - protected static final String LOG_TAG = FxAccountSignInTask.class.getSimpleName(); - - protected final byte[] emailUTF8; - protected final PasswordStretcher passwordStretcher; - - public FxAccountSignInTask(Context context, ProgressDisplay progressDisplay, String email, PasswordStretcher passwordStretcher, FxAccountClient client, Map queryParameters, RequestDelegate delegate) throws UnsupportedEncodingException { - super(context, progressDisplay, client, queryParameters, delegate); - this.emailUTF8 = email.getBytes("UTF-8"); - this.passwordStretcher = passwordStretcher; - } - - @Override - protected InnerRequestDelegate doInBackground(Void... arg0) { - try { - client.loginAndGetKeys(emailUTF8, passwordStretcher, queryParameters, innerDelegate); - latch.await(); - return innerDelegate; - } catch (Exception e) { - Logger.error(LOG_TAG, "Got exception signing in.", e); - delegate.handleError(e); - } - return null; - } -} diff --git a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/tasks/FxAccountUnlockCodeResender.java b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/tasks/FxAccountUnlockCodeResender.java deleted file mode 100644 index 0f32f3e22272..000000000000 --- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/tasks/FxAccountUnlockCodeResender.java +++ /dev/null @@ -1,105 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -package org.mozilla.gecko.fxa.tasks; - -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; - -import org.mozilla.gecko.R; -import org.mozilla.gecko.background.common.log.Logger; -import org.mozilla.gecko.background.fxa.FxAccountClient; -import org.mozilla.gecko.background.fxa.FxAccountClient10.RequestDelegate; -import org.mozilla.gecko.background.fxa.FxAccountClient20; -import org.mozilla.gecko.background.fxa.FxAccountClientException.FxAccountClientRemoteException; - -import android.content.Context; -import android.os.AsyncTask; -import android.widget.Toast; - -/** - * A helper class that provides a simple interface for requesting a Firefox - * Account unlock account email be (re)-sent. - */ -public class FxAccountUnlockCodeResender { - private static final String LOG_TAG = FxAccountUnlockCodeResender.class.getSimpleName(); - - private static class FxAccountUnlockCodeTask extends FxAccountSetupTask { - protected static final String LOG_TAG = FxAccountUnlockCodeTask.class.getSimpleName(); - - protected final byte[] emailUTF8; - - public FxAccountUnlockCodeTask(Context context, byte[] emailUTF8, FxAccountClient client, RequestDelegate delegate) { - super(context, null, client, null, delegate); - this.emailUTF8 = emailUTF8; - } - - @Override - protected InnerRequestDelegate doInBackground(Void... arg0) { - try { - client.resendUnlockCode(emailUTF8, innerDelegate); - latch.await(); - return innerDelegate; - } catch (Exception e) { - Logger.error(LOG_TAG, "Got exception signing in.", e); - delegate.handleError(e); - } - return null; - } - } - - private static class ResendUnlockCodeDelegate implements RequestDelegate { - public final Context context; - - public ResendUnlockCodeDelegate(Context context) { - this.context = context; - } - - @Override - public void handleError(Exception e) { - Logger.warn(LOG_TAG, "Got exception requesting fresh unlock code; ignoring.", e); - Toast.makeText(context, R.string.fxaccount_unlock_code_not_sent, Toast.LENGTH_LONG).show(); - } - - @Override - public void handleFailure(FxAccountClientRemoteException e) { - handleError(e); - } - - @Override - public void handleSuccess(Void result) { - Toast.makeText(context, R.string.fxaccount_unlock_code_sent, Toast.LENGTH_SHORT).show(); - } - } - - /** - * Resends the account unlock email, and displays an appropriate toast on both - * send success and failure. Note that because the underlying implementation - * uses {@link AsyncTask}, the provided context must be UI-capable and this - * method called from the UI thread. - * - * Note that it may actually be possible to run this (and the - * {@link AsyncTask}) method from a background thread - but this hasn't been - * tested. - * - * @param context - * A UI-capable Android context. - * @param authServerURI - * to send request to. - * @param emailUTF8 - * bytes of email address identifying account; null indicates a local failure. - */ - public static void resendUnlockCode(Context context, String authServerURI, byte[] emailUTF8) { - RequestDelegate delegate = new ResendUnlockCodeDelegate(context); - - if (emailUTF8 == null) { - delegate.handleError(new IllegalArgumentException("emailUTF8 must not be null")); - return; - } - - final Executor executor = Executors.newSingleThreadExecutor(); - final FxAccountClient client = new FxAccountClient20(authServerURI, executor); - new FxAccountUnlockCodeTask(context, emailUTF8, client, delegate).execute(); - } -}