Skip to content

Commit aa63079

Browse files
committed
Merge branch 'version-2.0.0-dev' into phone-auth
Change-Id: Ib18e49c565e39c30bba83333aa8188fc853e1775
2 parents fbbd014 + b9e3f8b commit aa63079

File tree

16 files changed

+20
-737
lines changed

16 files changed

+20
-737
lines changed

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

Lines changed: 5 additions & 123 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;
@@ -168,81 +162,6 @@ public static int getDefaultTheme() {
168162
return R.style.FirebaseUI;
169163
}
170164

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

258177
// Firebase Sign out
259178
mAuth.signOut();
260179

261180
// Disable credentials auto sign-in
262-
Task<Status> disableCredentialsTask = credentialsHelper.disableAutoSignIn();
181+
Task<Status> disableCredentialsTask = signInHelper.disableAutoSignIn();
263182

264183
// Google sign out
265-
Task<Status> signOutTask = credentialsHelper.signOut();
184+
Task<Status> signOutTask = signInHelper.signOut();
266185

267186
// Facebook sign out
268187
try {
@@ -291,12 +210,8 @@ public Task<Void> signOut(@NonNull FragmentActivity activity) {
291210
*/
292211
public Task<Void> delete(@NonNull FragmentActivity activity) {
293212
// Initialize SmartLock helper
294-
CredentialTaskApi credentialHelper = GoogleSignInHelper.getInstance(activity);
295-
296-
return getDeleteTask(credentialHelper);
297-
}
213+
GoogleSignInHelper signInHelper = GoogleSignInHelper.getInstance(activity);
298214

299-
private Task<Void> getDeleteTask(CredentialTaskApi credentialHelper) {
300215
FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
301216
if (firebaseUser == null) {
302217
// If the current user is null, return a failed task immediately
@@ -312,7 +227,7 @@ private Task<Void> getDeleteTask(CredentialTaskApi credentialHelper) {
312227
// For each Credential in the list, create a task to delete it.
313228
List<Task<?>> credentialTasks = new ArrayList<>();
314229
for (Credential credential : credentials) {
315-
credentialTasks.add(credentialHelper.delete(credential));
230+
credentialTasks.add(signInHelper.delete(credential));
316231
}
317232

318233
// Create a combined task that will succeed when all credential delete operations
@@ -588,39 +503,6 @@ public T setProviders(@NonNull List<IdpConfig> idpConfigs) {
588503
return (T) this;
589504
}
590505

591-
/**
592-
* Specifies the set of supported authentication providers. At least one provider
593-
* must be specified, and the set of providers must be a subset of
594-
* {@link #SUPPORTED_PROVIDERS}. There may only be one instance of each provider.
595-
* <p>
596-
* <p>If no providers are explicitly specified by calling this method, then
597-
* {@link #EMAIL_PROVIDER email} is the default supported provider.
598-
*
599-
* @see #EMAIL_PROVIDER
600-
* @see #FACEBOOK_PROVIDER
601-
* @see #GOOGLE_PROVIDER
602-
*/
603-
@Deprecated
604-
public T setProviders(@NonNull String... providers) {
605-
mProviders.clear(); // clear the default email provider
606-
for (String provider : providers) {
607-
if (isIdpAlreadyConfigured(provider)) {
608-
throw new IllegalArgumentException("Provider already configured: " + provider);
609-
}
610-
mProviders.add(new IdpConfig.Builder(provider).build());
611-
}
612-
return (T) this;
613-
}
614-
615-
private boolean isIdpAlreadyConfigured(@NonNull String providerId) {
616-
for (IdpConfig config : mProviders) {
617-
if (config.getProviderId().equals(providerId)) {
618-
return true;
619-
}
620-
}
621-
return false;
622-
}
623-
624506
/**
625507
* Enables or disables the use of Smart Lock for Passwords in the sign in flow.
626508
* To (en)disable hint selector and credential selector independently

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
@@ -96,7 +96,7 @@ private void populateIdpList(List<IdpConfig> providers) {
9696
break;
9797
case AuthUI.FACEBOOK_PROVIDER:
9898
mProviders.add(new FacebookProvider(
99-
this, idpConfig, mActivityHelper.getFlowParams().themeId));
99+
idpConfig, mActivityHelper.getFlowParams().themeId));
100100
break;
101101
case AuthUI.TWITTER_PROVIDER:
102102
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)