Skip to content

Remove all deprecated stuff #609

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jun 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 5 additions & 116 deletions auth/src/main/java/com/firebase/ui/auth/AuthUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Void> 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<Status> disableCredentialsTask = credentialsHelper.disableAutoSignIn();

// Google sign out
Task<Void> googleSignOutTask = taskHelper.getConnectedGoogleApiClient()
.continueWith(new Continuation<GoogleApiClient, Void>() {
@Override
public Void then(@NonNull Task<GoogleApiClient> 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<Void> 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.
*
Expand All @@ -241,16 +167,16 @@ public Task<Void> delete(@NonNull Activity activity) {
*/
public Task<Void> 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<Status> disableCredentialsTask = credentialsHelper.disableAutoSignIn();
Task<Status> disableCredentialsTask = signInHelper.disableAutoSignIn();

// Google sign out
Task<Status> signOutTask = credentialsHelper.signOut();
Task<Status> signOutTask = signInHelper.signOut();

// Facebook sign out
LoginManager.getInstance().logOut();
Expand All @@ -273,12 +199,8 @@ public Task<Void> signOut(@NonNull FragmentActivity activity) {
*/
public Task<Void> delete(@NonNull FragmentActivity activity) {
// Initialize SmartLock helper
CredentialTaskApi credentialHelper = GoogleSignInHelper.getInstance(activity);

return getDeleteTask(credentialHelper);
}
GoogleSignInHelper signInHelper = GoogleSignInHelper.getInstance(activity);

private Task<Void> getDeleteTask(CredentialTaskApi credentialHelper) {
FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
if (firebaseUser == null) {
// If the current user is null, return a failed task immediately
Expand All @@ -294,7 +216,7 @@ private Task<Void> getDeleteTask(CredentialTaskApi credentialHelper) {
// For each Credential in the list, create a task to delete it.
List<Task<?>> 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
Expand Down Expand Up @@ -549,39 +471,6 @@ public T setProviders(@NonNull List<IdpConfig> 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.
* <p>
* <p>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.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,7 @@ public class FacebookProvider implements IdpProvider, FacebookCallback<LoginResu
// DO NOT USE DIRECTLY: see onSuccess(String, LoginResult) and onFailure(Bundle) below
private IdpCallback mCallbackObject;

public FacebookProvider(Context context, AuthUI.IdpConfig idpConfig, @StyleRes int theme) {
Context appContext = context.getApplicationContext();

if (appContext.getResources().getIdentifier(
"facebook_permissions", "array", appContext.getPackageName()) != 0) {
Log.w(TAG, "DEVELOPER WARNING: You have defined R.array.facebook_permissions but that"
+ " is no longer respected as of FirebaseUI 1.0.0. Please see README for IDP"
+ " scope configuration instructions.");
}

public FacebookProvider(AuthUI.IdpConfig idpConfig, @StyleRes int theme) {
List<String> scopes = idpConfig.getScopes();
if (scopes == null) {
mScopes = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
20 changes: 0 additions & 20 deletions auth/src/main/java/com/firebase/ui/auth/ui/ResultCodes.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private void populateIdpList(List<IdpConfig> 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));
Expand Down

This file was deleted.

117 changes: 0 additions & 117 deletions auth/src/main/java/com/firebase/ui/auth/util/CredentialsApiHelper.java

This file was deleted.

Loading