Skip to content

Commit a0794ab

Browse files
committed
Address review feedback
Signed-off-by: Alex Saveau <[email protected]>
1 parent b1c958b commit a0794ab

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

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

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -283,31 +283,22 @@ public static int getDefaultTheme() {
283283
*/
284284
@NonNull
285285
public Task<AuthResult> silentSignIn(@NonNull Context context,
286-
@NonNull List<IdpConfig> desiredConfigs) {
286+
@NonNull List<IdpConfig> configs) {
287287
if (mAuth.getCurrentUser() != null) {
288288
throw new IllegalArgumentException("User already signed in!");
289289
}
290290

291-
List<IdpConfig> configs = new ArrayList<>();
292-
for (IdpConfig config : desiredConfigs) {
293-
String provider = config.getProviderId();
294-
if (provider.equals(EmailAuthProvider.PROVIDER_ID)
295-
|| provider.equals(GoogleAuthProvider.PROVIDER_ID)) {
296-
configs.add(config);
297-
}
298-
}
299-
300-
if (configs.isEmpty()) {
301-
throw new IllegalArgumentException("No supported providers were supplied. " +
302-
"Add either Google or email support.");
303-
}
304-
305291
final Context appContext = context.getApplicationContext();
306292
final IdpConfig google =
307293
ProviderUtils.getConfigFromIdps(configs, GoogleAuthProvider.PROVIDER_ID);
308294
final IdpConfig email =
309295
ProviderUtils.getConfigFromIdps(configs, EmailAuthProvider.PROVIDER_ID);
310296

297+
if (google == null && email == null) {
298+
throw new IllegalArgumentException("No supported providers were supplied. " +
299+
"Add either Google or email support.");
300+
}
301+
311302
GoogleSignInOptions googleOptions = null;
312303
if (google != null) {
313304
GoogleSignInAccount last = GoogleSignIn.getLastSignedInAccount(appContext);

0 commit comments

Comments
 (0)