diff --git a/auth/src/main/java/com/firebase/ui/auth/AuthUI.java b/auth/src/main/java/com/firebase/ui/auth/AuthUI.java index 3a2b5f7d0..a81ab3296 100644 --- a/auth/src/main/java/com/firebase/ui/auth/AuthUI.java +++ b/auth/src/main/java/com/firebase/ui/auth/AuthUI.java @@ -30,16 +30,10 @@ import com.firebase.ui.auth.provider.TwitterProvider; import com.firebase.ui.auth.ui.FlowParameters; import com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity; -import com.firebase.ui.auth.util.CredentialTaskApi; -import com.firebase.ui.auth.util.CredentialsApiHelper; -import com.firebase.ui.auth.util.GoogleApiClientTaskHelper; import com.firebase.ui.auth.util.GoogleSignInHelper; import com.firebase.ui.auth.util.Preconditions; import com.firebase.ui.auth.util.signincontainer.SmartLockBase; -import com.google.android.gms.auth.api.Auth; import com.google.android.gms.auth.api.credentials.Credential; -import com.google.android.gms.auth.api.signin.GoogleSignInOptions; -import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.common.api.Status; import com.google.android.gms.tasks.Continuation; import com.google.android.gms.tasks.Task; @@ -163,74 +157,6 @@ public static int getDefaultTheme() { return R.style.FirebaseUI; } - /** - * Signs the current user out, if one is signed in. - * - * @param activity The activity requesting the user be signed out. - * @return a task which, upon completion, signals that the user has been signed out ({@code - * result.isSuccess()}, or that the sign-out attempt failed unexpectedly ({@code - * !result.isSuccess()}). - * @deprecated use {@link #signOut(FragmentActivity)} instead - */ - @Deprecated - public Task signOut(@NonNull Activity activity) { - // Get helper for Google Sign In and Credentials API - GoogleApiClientTaskHelper taskHelper = GoogleApiClientTaskHelper.getInstance(activity); - taskHelper.getBuilder() - .addApi(Auth.CREDENTIALS_API) - .addApi(Auth.GOOGLE_SIGN_IN_API, GoogleSignInOptions.DEFAULT_SIGN_IN); - - // Get Credentials Helper - CredentialTaskApi credentialsHelper = CredentialsApiHelper.getInstance(taskHelper); - - // Firebase Sign out - mAuth.signOut(); - - // Disable credentials auto sign-in - Task disableCredentialsTask = credentialsHelper.disableAutoSignIn(); - - // Google sign out - Task googleSignOutTask = taskHelper.getConnectedGoogleApiClient() - .continueWith(new Continuation() { - @Override - public Void then(@NonNull Task task) throws Exception { - if (task.isSuccessful()) { - Auth.GoogleSignInApi.signOut(task.getResult()); - } - return null; - } - }); - - // Facebook sign out - LoginManager.getInstance().logOut(); - - // Twitter sign out - if (!Fabric.isInitialized()) TwitterProvider.initialize(activity); - Twitter.logOut(); - - // Wait for all tasks to complete - return Tasks.whenAll(disableCredentialsTask, googleSignOutTask); - } - - /** - * Delete the use from FirebaseAuth and delete any associated credentials from the Credentials - * API. Returns a {@code Task} that succeeds if the Firebase Auth user deletion succeeds and - * fails if the Firebase Auth deletion fails. Credentials deletion failures are handled - * silently. - * - * @param activity the calling {@link Activity}. - * @deprecated use {@link #delete(FragmentActivity)} instead - */ - @Deprecated - public Task delete(@NonNull Activity activity) { - // Initialize SmartLock helper - GoogleApiClientTaskHelper gacHelper = GoogleApiClientTaskHelper.getInstance(activity); - gacHelper.getBuilder().addApi(Auth.CREDENTIALS_API); - CredentialTaskApi credentialHelper = CredentialsApiHelper.getInstance(gacHelper); - - return getDeleteTask(credentialHelper); - } - /** * Signs the current user out, if one is signed in. * @@ -241,16 +167,16 @@ public Task delete(@NonNull Activity activity) { */ public Task signOut(@NonNull FragmentActivity activity) { // Get Credentials Helper - GoogleSignInHelper credentialsHelper = GoogleSignInHelper.getInstance(activity); + GoogleSignInHelper signInHelper = GoogleSignInHelper.getInstance(activity); // Firebase Sign out mAuth.signOut(); // Disable credentials auto sign-in - Task disableCredentialsTask = credentialsHelper.disableAutoSignIn(); + Task disableCredentialsTask = signInHelper.disableAutoSignIn(); // Google sign out - Task signOutTask = credentialsHelper.signOut(); + Task signOutTask = signInHelper.signOut(); // Facebook sign out LoginManager.getInstance().logOut(); @@ -273,12 +199,8 @@ public Task signOut(@NonNull FragmentActivity activity) { */ public Task delete(@NonNull FragmentActivity activity) { // Initialize SmartLock helper - CredentialTaskApi credentialHelper = GoogleSignInHelper.getInstance(activity); - - return getDeleteTask(credentialHelper); - } + GoogleSignInHelper signInHelper = GoogleSignInHelper.getInstance(activity); - private Task getDeleteTask(CredentialTaskApi credentialHelper) { FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser(); if (firebaseUser == null) { // If the current user is null, return a failed task immediately @@ -294,7 +216,7 @@ private Task getDeleteTask(CredentialTaskApi credentialHelper) { // For each Credential in the list, create a task to delete it. List> credentialTasks = new ArrayList<>(); for (Credential credential : credentials) { - credentialTasks.add(credentialHelper.delete(credential)); + credentialTasks.add(signInHelper.delete(credential)); } // Create a combined task that will succeed when all credential delete operations @@ -549,39 +471,6 @@ public T setProviders(@NonNull List idpConfigs) { return (T) this; } - /** - * Specifies the set of supported authentication providers. At least one provider - * must be specified, and the set of providers must be a subset of - * {@link #SUPPORTED_PROVIDERS}. There may only be one instance of each provider. - *

- *

If no providers are explicitly specified by calling this method, then - * {@link #EMAIL_PROVIDER email} is the default supported provider. - * - * @see #EMAIL_PROVIDER - * @see #FACEBOOK_PROVIDER - * @see #GOOGLE_PROVIDER - */ - @Deprecated - public T setProviders(@NonNull String... providers) { - mProviders.clear(); // clear the default email provider - for (String provider : providers) { - if (isIdpAlreadyConfigured(provider)) { - throw new IllegalArgumentException("Provider already configured: " + provider); - } - mProviders.add(new IdpConfig.Builder(provider).build()); - } - return (T) this; - } - - private boolean isIdpAlreadyConfigured(@NonNull String providerId) { - for (IdpConfig config : mProviders) { - if (config.getProviderId().equals(providerId)) { - return true; - } - } - return false; - } - /** * Enables or disables the use of Smart Lock for Passwords in the sign in flow. *

diff --git a/auth/src/main/java/com/firebase/ui/auth/KickoffActivity.java b/auth/src/main/java/com/firebase/ui/auth/KickoffActivity.java index a11369079..ff33ea219 100644 --- a/auth/src/main/java/com/firebase/ui/auth/KickoffActivity.java +++ b/auth/src/main/java/com/firebase/ui/auth/KickoffActivity.java @@ -34,7 +34,7 @@ protected void onCreate(Bundle savedInstance) { if (savedInstance == null || savedInstance.getBoolean(IS_WAITING_FOR_PLAY_SERVICES)) { if (isOffline()) { Log.d(TAG, "No network connection"); - finish(ErrorCodes.NO_NETWORK, + finish(ResultCodes.CANCELED, IdpResponse.getErrorCodeIntent(ErrorCodes.NO_NETWORK)); return; } diff --git a/auth/src/main/java/com/firebase/ui/auth/provider/FacebookProvider.java b/auth/src/main/java/com/firebase/ui/auth/provider/FacebookProvider.java index c8de93d7d..c7c1dba91 100644 --- a/auth/src/main/java/com/firebase/ui/auth/provider/FacebookProvider.java +++ b/auth/src/main/java/com/firebase/ui/auth/provider/FacebookProvider.java @@ -57,16 +57,7 @@ public class FacebookProvider implements IdpProvider, FacebookCallback scopes = idpConfig.getScopes(); if (scopes == null) { mScopes = new ArrayList<>(); diff --git a/auth/src/main/java/com/firebase/ui/auth/provider/GoogleProvider.java b/auth/src/main/java/com/firebase/ui/auth/provider/GoogleProvider.java index 2b978ac1b..c7cc79ec4 100644 --- a/auth/src/main/java/com/firebase/ui/auth/provider/GoogleProvider.java +++ b/auth/src/main/java/com/firebase/ui/auth/provider/GoogleProvider.java @@ -80,13 +80,6 @@ private GoogleSignInOptions getSignInOptions(@Nullable String email) { .requestEmail() .requestIdToken(clientId); - if (mActivity.getResources().getIdentifier( - "google_permissions", "array", mActivity.getPackageName()) != 0) { - Log.w(TAG, "DEVELOPER WARNING: You have defined R.array.google_permissions but that is" - + " no longer respected as of FirebaseUI 1.0.0. Please see README for IDP scope" - + " configuration instructions."); - } - // Add additional scopes for (String scopeString : mIdpConfig.getScopes()) { builder.requestScopes(new Scope(scopeString)); diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/ResultCodes.java b/auth/src/main/java/com/firebase/ui/auth/ui/ResultCodes.java deleted file mode 100644 index 41143c623..000000000 --- a/auth/src/main/java/com/firebase/ui/auth/ui/ResultCodes.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.firebase.ui.auth.ui; - -import com.firebase.ui.auth.AuthUI; - -/** - * Result codes returned when using {@link AuthUI.SignInIntentBuilder#build()} with - * {@code startActivityForResult}. - */ -@Deprecated -public class ResultCodes { - - /** - * Sign in failed due to lack of network connection - * - * @deprecated Please use {@link com.firebase.ui.auth.ErrorCodes#NO_NETWORK} - **/ - @Deprecated - public static final int RESULT_NO_NETWORK = com.firebase.ui.auth.ErrorCodes.NO_NETWORK; - -} diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/accountlink/WelcomeBackIdpPrompt.java b/auth/src/main/java/com/firebase/ui/auth/ui/accountlink/WelcomeBackIdpPrompt.java index 362759666..b73575228 100644 --- a/auth/src/main/java/com/firebase/ui/auth/ui/accountlink/WelcomeBackIdpPrompt.java +++ b/auth/src/main/java/com/firebase/ui/auth/ui/accountlink/WelcomeBackIdpPrompt.java @@ -89,7 +89,7 @@ protected void onCreate(Bundle savedInstanceState) { break; case FacebookAuthProvider.PROVIDER_ID: mIdpProvider = new FacebookProvider( - this, idpConfig, mActivityHelper.getFlowParams().themeId); + idpConfig, mActivityHelper.getFlowParams().themeId); break; case TwitterAuthProvider.PROVIDER_ID: mIdpProvider = new TwitterProvider(this); diff --git a/auth/src/main/java/com/firebase/ui/auth/ui/idp/AuthMethodPickerActivity.java b/auth/src/main/java/com/firebase/ui/auth/ui/idp/AuthMethodPickerActivity.java index 6c458f119..baab9072b 100644 --- a/auth/src/main/java/com/firebase/ui/auth/ui/idp/AuthMethodPickerActivity.java +++ b/auth/src/main/java/com/firebase/ui/auth/ui/idp/AuthMethodPickerActivity.java @@ -92,7 +92,7 @@ private void populateIdpList(List providers) { break; case AuthUI.FACEBOOK_PROVIDER: mProviders.add(new FacebookProvider( - this, idpConfig, mActivityHelper.getFlowParams().themeId)); + idpConfig, mActivityHelper.getFlowParams().themeId)); break; case AuthUI.TWITTER_PROVIDER: mProviders.add(new TwitterProvider(this)); diff --git a/auth/src/main/java/com/firebase/ui/auth/util/CredentialTaskApi.java b/auth/src/main/java/com/firebase/ui/auth/util/CredentialTaskApi.java deleted file mode 100644 index dd60131e5..000000000 --- a/auth/src/main/java/com/firebase/ui/auth/util/CredentialTaskApi.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.firebase.ui.auth.util; - -import com.google.android.gms.auth.api.credentials.Credential; -import com.google.android.gms.common.api.Status; -import com.google.android.gms.tasks.Task; - -public interface CredentialTaskApi { - Task disableAutoSignIn(); - - Task delete(Credential credential); -} diff --git a/auth/src/main/java/com/firebase/ui/auth/util/CredentialsApiHelper.java b/auth/src/main/java/com/firebase/ui/auth/util/CredentialsApiHelper.java deleted file mode 100644 index 17a1bb069..000000000 --- a/auth/src/main/java/com/firebase/ui/auth/util/CredentialsApiHelper.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2016 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the - * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.firebase.ui.auth.util; - -import android.app.Activity; -import android.support.annotation.NonNull; - -import com.google.android.gms.auth.api.Auth; -import com.google.android.gms.auth.api.credentials.Credential; -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.Result; -import com.google.android.gms.common.api.ResultCallback; -import com.google.android.gms.common.api.Status; -import com.google.android.gms.tasks.Continuation; -import com.google.android.gms.tasks.Task; -import com.google.android.gms.tasks.TaskCompletionSource; - -/** - * A {@link com.google.android.gms.tasks.Task Task} based wrapper for the Smart Lock for Passwords - * API. - */ -@Deprecated -public class CredentialsApiHelper implements CredentialTaskApi { - @NonNull - private final GoogleApiClientTaskHelper mClientHelper; - - private CredentialsApiHelper(GoogleApiClientTaskHelper gacHelper) { - mClientHelper = gacHelper; - } - - public static CredentialsApiHelper getInstance(Activity activity) { - // Get a task helper with the Credentials Api - GoogleApiClientTaskHelper taskHelper = GoogleApiClientTaskHelper.getInstance(activity); - taskHelper.getBuilder().addApi(Auth.CREDENTIALS_API); - - return getInstance(taskHelper); - } - - public static CredentialsApiHelper getInstance(GoogleApiClientTaskHelper taskHelper) { - return new CredentialsApiHelper(taskHelper); - } - - @Override - public Task delete(final Credential credential) { - return mClientHelper.getConnectedGoogleApiClient().continueWithTask( - new ExceptionForwardingContinuation() { - @Override - protected void process( - GoogleApiClient client, - TaskCompletionSource source) { - Auth.CredentialsApi.delete(client, credential) - .setResultCallback(new TaskResultCaptor<>(source)); - } - }); - } - - @Override - public Task disableAutoSignIn() { - return mClientHelper.getConnectedGoogleApiClient().continueWithTask( - new ExceptionForwardingContinuation() { - @Override - protected void process( - final GoogleApiClient client, - final TaskCompletionSource source) { - Auth.CredentialsApi.disableAutoSignIn(client) - .setResultCallback(new ResultCallback() { - @Override - public void onResult(@NonNull Status status) { - source.setResult(status); - } - }); - } - }); - } - - private abstract static class ExceptionForwardingContinuation - implements Continuation> { - - @Override - public final Task then(@NonNull Task task) throws Exception { - TaskCompletionSource source = new TaskCompletionSource<>(); - // calling task.getResult() will implicitly re-throw the exception of the original - // task, which will be returned as the result for the output task. Similarly, - // if process() throws an exception, this will be turned into the task result. - process(task.getResult(), source); - return source.getTask(); - } - - protected abstract void process(TIn in, TaskCompletionSource result); - } - - private static final class TaskResultCaptor implements ResultCallback { - - private TaskCompletionSource mSource; - - public TaskResultCaptor(TaskCompletionSource source) { - mSource = source; - } - - @Override - public void onResult(@NonNull R result) { - mSource.setResult(result); - } - } -} diff --git a/auth/src/main/java/com/firebase/ui/auth/util/GoogleApiClientTaskHelper.java b/auth/src/main/java/com/firebase/ui/auth/util/GoogleApiClientTaskHelper.java deleted file mode 100644 index fc27ee528..000000000 --- a/auth/src/main/java/com/firebase/ui/auth/util/GoogleApiClientTaskHelper.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright 2016 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the - * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.firebase.ui.auth.util; - -import android.app.Activity; -import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; - -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.tasks.Task; -import com.google.android.gms.tasks.TaskCompletionSource; - -import java.io.IOException; -import java.util.IdentityHashMap; -import java.util.concurrent.atomic.AtomicReference; - -/** - * A {@link com.google.android.gms.tasks.Task Task} based wrapper for acquiring a connected - * {@link com.google.android.gms.common.api.GoogleApiClient} instance, which manages a single - * instance per activity. - */ -@Deprecated -public class GoogleApiClientTaskHelper { - - private static final IdentityHashMap INSTANCES - = new IdentityHashMap<>(); - - @NonNull - private final Activity mActivity; - - @NonNull - private final AtomicReference mClientRef; - - @NonNull - private final AtomicReference> mConnectTaskRef; - - @NonNull - private final GoogleApiClient.Builder mBuilder; - - private GoogleApiClientTaskHelper(@NonNull Activity activity) { - if (activity == null) { - throw new IllegalArgumentException("activity must not be null"); - } - - mActivity = activity; - mBuilder = new GoogleApiClient.Builder(mActivity); - - mClientRef = new AtomicReference<>(); - mConnectTaskRef = new AtomicReference<>(); - - // ensure that when the activity is stopped, we release the reference to the - // GoogleApiClient completion task, so that it can be garbage collected - activity.getApplication().registerActivityLifecycleCallbacks(new GacLifecycleCallbacks()); - } - - /** - * Retrieve the instance for the specified activity, reusing an instance if it exists, - * otherwise creates a new one. - */ - public static GoogleApiClientTaskHelper getInstance(Activity activity) { - GoogleApiClientTaskHelper helper; - synchronized (INSTANCES) { - helper = INSTANCES.get(activity); - if (helper == null) { - helper = new GoogleApiClientTaskHelper(activity); - INSTANCES.put(activity, helper); - } - } - return helper; - } - - private static void clearInstance(Activity activity) { - synchronized (INSTANCES) { - INSTANCES.remove(activity); - } - } - - public Task getConnectedGoogleApiClient() { - final TaskCompletionSource source = new TaskCompletionSource<>(); - if (!mConnectTaskRef.compareAndSet(null, source)) { - // mConnectTaskRef Task was not null, return Task - return mConnectTaskRef.get().getTask(); - } - - final GoogleApiClient client = mBuilder - .addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() { - @Override - public void onConnected(@Nullable Bundle bundle) { - source.setResult(mClientRef.get()); - if (mClientRef.get() != null) { - mClientRef.get().unregisterConnectionCallbacks(this); - } - } - - @Override - public void onConnectionSuspended(int i) {} - }) - .addOnConnectionFailedListener(new GoogleApiClient.OnConnectionFailedListener() { - @Override - public void onConnectionFailed(@NonNull ConnectionResult connectionResult) { - source.setException(new IOException( - "Failed to connect GoogleApiClient: " - + connectionResult.getErrorMessage())); - if (mClientRef.get() != null) { - mClientRef.get().unregisterConnectionFailedListener(this); - } - } - }).build(); - - mClientRef.set(client); - client.connect(); - - return source.getTask(); - } - - @NonNull - public GoogleApiClient.Builder getBuilder() { - return mBuilder; - } - - private final class GacLifecycleCallbacks extends AbstractActivityLifecycleCallbacks { - - @Override - public void onActivityStarted(Activity activity) { - if (mActivity.equals(activity)) { - GoogleApiClient client = mClientRef.get(); - if (client != null) { - client.connect(); - } - } - } - - @Override - public void onActivityStopped(Activity activity) { - if (mActivity.equals(activity)) { - GoogleApiClient client = mClientRef.get(); - if (client != null) { - client.disconnect(); - } - } - } - - @Override - public void onActivityDestroyed(Activity activity) { - activity.getApplication().unregisterActivityLifecycleCallbacks(this); - clearInstance(activity); - } - } -} diff --git a/auth/src/main/java/com/firebase/ui/auth/util/GoogleSignInHelper.java b/auth/src/main/java/com/firebase/ui/auth/util/GoogleSignInHelper.java index 8ae81c596..53e9e1d99 100644 --- a/auth/src/main/java/com/firebase/ui/auth/util/GoogleSignInHelper.java +++ b/auth/src/main/java/com/firebase/ui/auth/util/GoogleSignInHelper.java @@ -12,7 +12,7 @@ import com.google.android.gms.tasks.Task; import com.google.android.gms.tasks.TaskCompletionSource; -public class GoogleSignInHelper extends GoogleApiHelper implements CredentialTaskApi { +public class GoogleSignInHelper extends GoogleApiHelper { protected GoogleSignInHelper(FragmentActivity activity, GoogleApiClient.Builder builder) { super(activity, builder); } @@ -38,7 +38,6 @@ public void onSuccess(Bundle status) { return statusTask.getTask(); } - @Override public Task disableAutoSignIn() { final TaskCompletionSource statusTask = new TaskCompletionSource<>(); getConnectedApiTask().addOnCompleteListener(new ExceptionForwarder<>( @@ -53,7 +52,6 @@ public void onSuccess(Bundle status) { return statusTask.getTask(); } - @Override public Task delete(final Credential credential) { final TaskCompletionSource statusTask = new TaskCompletionSource<>(); getConnectedApiTask().addOnCompleteListener(new ExceptionForwarder<>( diff --git a/auth/src/main/java/com/firebase/ui/auth/util/signincontainer/IdpSignInContainer.java b/auth/src/main/java/com/firebase/ui/auth/util/signincontainer/IdpSignInContainer.java index 640afbd8b..dd38806dd 100644 --- a/auth/src/main/java/com/firebase/ui/auth/util/signincontainer/IdpSignInContainer.java +++ b/auth/src/main/java/com/firebase/ui/auth/util/signincontainer/IdpSignInContainer.java @@ -109,8 +109,7 @@ public void onCreate(@Nullable Bundle savedInstanceState) { providerConfig, user.getEmail()); } else if (provider.equalsIgnoreCase(FacebookAuthProvider.PROVIDER_ID)) { - mIdpProvider = new FacebookProvider( - getContext(), providerConfig, mHelper.getFlowParams().themeId); + mIdpProvider = new FacebookProvider(providerConfig, mHelper.getFlowParams().themeId); } else if (provider.equalsIgnoreCase(TwitterAuthProvider.PROVIDER_ID)) { mIdpProvider = new TwitterProvider(getContext()); } diff --git a/auth/src/test/java/com/firebase/ui/auth/AuthUITest.java b/auth/src/test/java/com/firebase/ui/auth/AuthUITest.java index 0624d7859..3c41d8290 100644 --- a/auth/src/test/java/com/firebase/ui/auth/AuthUITest.java +++ b/auth/src/test/java/com/firebase/ui/auth/AuthUITest.java @@ -43,18 +43,6 @@ public void setUp() { mFirebaseApp = TestHelper.initializeApp(RuntimeEnvironment.application); } - @Test - public void testCreateStartIntent_deprecatedSetProvidersShouldStillWork() { - FlowParameters flowParameters = AuthUI - .getInstance(mFirebaseApp) - .createSignInIntentBuilder() - .setProviders(new String[]{AuthUI.EMAIL_PROVIDER, AuthUI.TWITTER_PROVIDER}) - .build() - .getParcelableExtra(ExtraConstants.EXTRA_FLOW_PARAMS); - assertEquals(2, flowParameters.providerInfo.size()); - assertEquals(AuthUI.EMAIL_PROVIDER, flowParameters.providerInfo.get(0).getProviderId()); - } - @Test public void testCreateStartIntent_shouldHaveEmailAsDefaultProvider() { FlowParameters flowParameters = AuthUI diff --git a/auth/upgrade-guide.md b/auth/upgrade-guide.md new file mode 100644 index 000000000..8bfad5542 --- /dev/null +++ b/auth/upgrade-guide.md @@ -0,0 +1,5 @@ +# Removals + +- `AuthUI#signOut(Activity)` and `AuthUI#delete(Activity)` -> `AuthUI#signOut(AppCompatActivity)` and `AuthUI#delete(AppCompatActivity)` +- `AuthUI.SignInIntentBuilder#setProviders(String...)` -> `AuthUI.SignInIntentBuilder#setProviders(List)` +- `com.firebase.ui.auth.ui.ResultCodes` -> Check for `Activity#RESULT_CANCELLED` and use `IdpResponse#getErrorCode()`