Skip to content

Commit b9e3f8b

Browse files
SUPERCILEXsamtstern
authored andcommitted
Remove all deprecated stuff (#609)
1 parent 2435b77 commit b9e3f8b

File tree

14 files changed

+16
-464
lines changed

14 files changed

+16
-464
lines changed

auth/src/main/java/com/firebase/ui/auth/AuthUI.java

Lines changed: 5 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,10 @@
3030
import com.firebase.ui.auth.provider.TwitterProvider;
3131
import com.firebase.ui.auth.ui.FlowParameters;
3232
import com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity;
33-
import com.firebase.ui.auth.util.CredentialTaskApi;
34-
import com.firebase.ui.auth.util.CredentialsApiHelper;
35-
import com.firebase.ui.auth.util.GoogleApiClientTaskHelper;
3633
import com.firebase.ui.auth.util.GoogleSignInHelper;
3734
import com.firebase.ui.auth.util.Preconditions;
3835
import com.firebase.ui.auth.util.signincontainer.SmartLockBase;
39-
import com.google.android.gms.auth.api.Auth;
4036
import com.google.android.gms.auth.api.credentials.Credential;
41-
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
42-
import com.google.android.gms.common.api.GoogleApiClient;
4337
import com.google.android.gms.common.api.Status;
4438
import com.google.android.gms.tasks.Continuation;
4539
import com.google.android.gms.tasks.Task;
@@ -163,74 +157,6 @@ public static int getDefaultTheme() {
163157
return R.style.FirebaseUI;
164158
}
165159

166-
/**
167-
* Signs the current user out, if one is signed in.
168-
*
169-
* @param activity The activity requesting the user be signed out.
170-
* @return a task which, upon completion, signals that the user has been signed out ({@code
171-
* result.isSuccess()}, or that the sign-out attempt failed unexpectedly ({@code
172-
* !result.isSuccess()}).
173-
* @deprecated use {@link #signOut(FragmentActivity)} instead
174-
*/
175-
@Deprecated
176-
public Task<Void> signOut(@NonNull Activity activity) {
177-
// Get helper for Google Sign In and Credentials API
178-
GoogleApiClientTaskHelper taskHelper = GoogleApiClientTaskHelper.getInstance(activity);
179-
taskHelper.getBuilder()
180-
.addApi(Auth.CREDENTIALS_API)
181-
.addApi(Auth.GOOGLE_SIGN_IN_API, GoogleSignInOptions.DEFAULT_SIGN_IN);
182-
183-
// Get Credentials Helper
184-
CredentialTaskApi credentialsHelper = CredentialsApiHelper.getInstance(taskHelper);
185-
186-
// Firebase Sign out
187-
mAuth.signOut();
188-
189-
// Disable credentials auto sign-in
190-
Task<Status> disableCredentialsTask = credentialsHelper.disableAutoSignIn();
191-
192-
// Google sign out
193-
Task<Void> googleSignOutTask = taskHelper.getConnectedGoogleApiClient()
194-
.continueWith(new Continuation<GoogleApiClient, Void>() {
195-
@Override
196-
public Void then(@NonNull Task<GoogleApiClient> task) throws Exception {
197-
if (task.isSuccessful()) {
198-
Auth.GoogleSignInApi.signOut(task.getResult());
199-
}
200-
return null;
201-
}
202-
});
203-
204-
// Facebook sign out
205-
LoginManager.getInstance().logOut();
206-
207-
// Twitter sign out
208-
if (!Fabric.isInitialized()) TwitterProvider.initialize(activity);
209-
Twitter.logOut();
210-
211-
// Wait for all tasks to complete
212-
return Tasks.whenAll(disableCredentialsTask, googleSignOutTask);
213-
}
214-
215-
/**
216-
* Delete the use from FirebaseAuth and delete any associated credentials from the Credentials
217-
* API. Returns a {@code Task} that succeeds if the Firebase Auth user deletion succeeds and
218-
* fails if the Firebase Auth deletion fails. Credentials deletion failures are handled
219-
* silently.
220-
*
221-
* @param activity the calling {@link Activity}.
222-
* @deprecated use {@link #delete(FragmentActivity)} instead
223-
*/
224-
@Deprecated
225-
public Task<Void> delete(@NonNull Activity activity) {
226-
// Initialize SmartLock helper
227-
GoogleApiClientTaskHelper gacHelper = GoogleApiClientTaskHelper.getInstance(activity);
228-
gacHelper.getBuilder().addApi(Auth.CREDENTIALS_API);
229-
CredentialTaskApi credentialHelper = CredentialsApiHelper.getInstance(gacHelper);
230-
231-
return getDeleteTask(credentialHelper);
232-
}
233-
234160
/**
235161
* Signs the current user out, if one is signed in.
236162
*
@@ -241,16 +167,16 @@ public Task<Void> delete(@NonNull Activity activity) {
241167
*/
242168
public Task<Void> signOut(@NonNull FragmentActivity activity) {
243169
// Get Credentials Helper
244-
GoogleSignInHelper credentialsHelper = GoogleSignInHelper.getInstance(activity);
170+
GoogleSignInHelper signInHelper = GoogleSignInHelper.getInstance(activity);
245171

246172
// Firebase Sign out
247173
mAuth.signOut();
248174

249175
// Disable credentials auto sign-in
250-
Task<Status> disableCredentialsTask = credentialsHelper.disableAutoSignIn();
176+
Task<Status> disableCredentialsTask = signInHelper.disableAutoSignIn();
251177

252178
// Google sign out
253-
Task<Status> signOutTask = credentialsHelper.signOut();
179+
Task<Status> signOutTask = signInHelper.signOut();
254180

255181
// Facebook sign out
256182
LoginManager.getInstance().logOut();
@@ -273,12 +199,8 @@ public Task<Void> signOut(@NonNull FragmentActivity activity) {
273199
*/
274200
public Task<Void> delete(@NonNull FragmentActivity activity) {
275201
// Initialize SmartLock helper
276-
CredentialTaskApi credentialHelper = GoogleSignInHelper.getInstance(activity);
277-
278-
return getDeleteTask(credentialHelper);
279-
}
202+
GoogleSignInHelper signInHelper = GoogleSignInHelper.getInstance(activity);
280203

281-
private Task<Void> getDeleteTask(CredentialTaskApi credentialHelper) {
282204
FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
283205
if (firebaseUser == null) {
284206
// If the current user is null, return a failed task immediately
@@ -294,7 +216,7 @@ private Task<Void> getDeleteTask(CredentialTaskApi credentialHelper) {
294216
// For each Credential in the list, create a task to delete it.
295217
List<Task<?>> credentialTasks = new ArrayList<>();
296218
for (Credential credential : credentials) {
297-
credentialTasks.add(credentialHelper.delete(credential));
219+
credentialTasks.add(signInHelper.delete(credential));
298220
}
299221

300222
// Create a combined task that will succeed when all credential delete operations
@@ -549,39 +471,6 @@ public T setProviders(@NonNull List<IdpConfig> idpConfigs) {
549471
return (T) this;
550472
}
551473

552-
/**
553-
* Specifies the set of supported authentication providers. At least one provider
554-
* must be specified, and the set of providers must be a subset of
555-
* {@link #SUPPORTED_PROVIDERS}. There may only be one instance of each provider.
556-
* <p>
557-
* <p>If no providers are explicitly specified by calling this method, then
558-
* {@link #EMAIL_PROVIDER email} is the default supported provider.
559-
*
560-
* @see #EMAIL_PROVIDER
561-
* @see #FACEBOOK_PROVIDER
562-
* @see #GOOGLE_PROVIDER
563-
*/
564-
@Deprecated
565-
public T setProviders(@NonNull String... providers) {
566-
mProviders.clear(); // clear the default email provider
567-
for (String provider : providers) {
568-
if (isIdpAlreadyConfigured(provider)) {
569-
throw new IllegalArgumentException("Provider already configured: " + provider);
570-
}
571-
mProviders.add(new IdpConfig.Builder(provider).build());
572-
}
573-
return (T) this;
574-
}
575-
576-
private boolean isIdpAlreadyConfigured(@NonNull String providerId) {
577-
for (IdpConfig config : mProviders) {
578-
if (config.getProviderId().equals(providerId)) {
579-
return true;
580-
}
581-
}
582-
return false;
583-
}
584-
585474
/**
586475
* Enables or disables the use of Smart Lock for Passwords in the sign in flow.
587476
* <p>

auth/src/main/java/com/firebase/ui/auth/KickoffActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected void onCreate(Bundle savedInstance) {
3434
if (savedInstance == null || savedInstance.getBoolean(IS_WAITING_FOR_PLAY_SERVICES)) {
3535
if (isOffline()) {
3636
Log.d(TAG, "No network connection");
37-
finish(ErrorCodes.NO_NETWORK,
37+
finish(ResultCodes.CANCELED,
3838
IdpResponse.getErrorCodeIntent(ErrorCodes.NO_NETWORK));
3939
return;
4040
}

auth/src/main/java/com/firebase/ui/auth/provider/FacebookProvider.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,7 @@ public class FacebookProvider implements IdpProvider, FacebookCallback<LoginResu
5757
// DO NOT USE DIRECTLY: see onSuccess(String, LoginResult) and onFailure(Bundle) below
5858
private IdpCallback mCallbackObject;
5959

60-
public FacebookProvider(Context context, AuthUI.IdpConfig idpConfig, @StyleRes int theme) {
61-
Context appContext = context.getApplicationContext();
62-
63-
if (appContext.getResources().getIdentifier(
64-
"facebook_permissions", "array", appContext.getPackageName()) != 0) {
65-
Log.w(TAG, "DEVELOPER WARNING: You have defined R.array.facebook_permissions but that"
66-
+ " is no longer respected as of FirebaseUI 1.0.0. Please see README for IDP"
67-
+ " scope configuration instructions.");
68-
}
69-
60+
public FacebookProvider(AuthUI.IdpConfig idpConfig, @StyleRes int theme) {
7061
List<String> scopes = idpConfig.getScopes();
7162
if (scopes == null) {
7263
mScopes = new ArrayList<>();

auth/src/main/java/com/firebase/ui/auth/provider/GoogleProvider.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,6 @@ private GoogleSignInOptions getSignInOptions(@Nullable String email) {
8080
.requestEmail()
8181
.requestIdToken(clientId);
8282

83-
if (mActivity.getResources().getIdentifier(
84-
"google_permissions", "array", mActivity.getPackageName()) != 0) {
85-
Log.w(TAG, "DEVELOPER WARNING: You have defined R.array.google_permissions but that is"
86-
+ " no longer respected as of FirebaseUI 1.0.0. Please see README for IDP scope"
87-
+ " configuration instructions.");
88-
}
89-
9083
// Add additional scopes
9184
for (String scopeString : mIdpConfig.getScopes()) {
9285
builder.requestScopes(new Scope(scopeString));

auth/src/main/java/com/firebase/ui/auth/ui/ResultCodes.java

Lines changed: 0 additions & 20 deletions
This file was deleted.

auth/src/main/java/com/firebase/ui/auth/ui/accountlink/WelcomeBackIdpPrompt.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ protected void onCreate(Bundle savedInstanceState) {
8989
break;
9090
case FacebookAuthProvider.PROVIDER_ID:
9191
mIdpProvider = new FacebookProvider(
92-
this, idpConfig, mActivityHelper.getFlowParams().themeId);
92+
idpConfig, mActivityHelper.getFlowParams().themeId);
9393
break;
9494
case TwitterAuthProvider.PROVIDER_ID:
9595
mIdpProvider = new TwitterProvider(this);

auth/src/main/java/com/firebase/ui/auth/ui/idp/AuthMethodPickerActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ private void populateIdpList(List<IdpConfig> providers) {
9292
break;
9393
case AuthUI.FACEBOOK_PROVIDER:
9494
mProviders.add(new FacebookProvider(
95-
this, idpConfig, mActivityHelper.getFlowParams().themeId));
95+
idpConfig, mActivityHelper.getFlowParams().themeId));
9696
break;
9797
case AuthUI.TWITTER_PROVIDER:
9898
mProviders.add(new TwitterProvider(this));

auth/src/main/java/com/firebase/ui/auth/util/CredentialTaskApi.java

Lines changed: 0 additions & 11 deletions
This file was deleted.

auth/src/main/java/com/firebase/ui/auth/util/CredentialsApiHelper.java

Lines changed: 0 additions & 117 deletions
This file was deleted.

0 commit comments

Comments
 (0)