36
36
import com .firebase .ui .auth .FirebaseAuthAnonymousUpgradeException ;
37
37
import com .firebase .ui .auth .FirebaseUiException ;
38
38
import com .firebase .ui .auth .IdpResponse ;
39
+ import com .firebase .ui .auth .KickoffActivity ;
39
40
import com .firebase .ui .auth .R ;
40
41
import com .firebase .ui .auth .data .model .FlowParameters ;
41
42
import com .firebase .ui .auth .data .model .PendingIntentRequiredException ;
@@ -218,8 +219,6 @@ private void attemptCredentialSignIn() {
218
219
boolean willRequestCredentials = supportPasswords || !accountTypes .isEmpty ();
219
220
220
221
if (args .enableCredentials && willRequestCredentials ) {
221
- // Show a progress indicator on the popup.
222
- showProgress (R .string .fui_progress_dialog_signing_in );
223
222
SignInClient signInClient = Identity .getSignInClient (getApplication ());
224
223
BeginSignInRequest .Builder requestBuilder = BeginSignInRequest .builder ();
225
224
if (supportPasswords ) {
@@ -280,9 +279,6 @@ private void attemptCredentialSignIn() {
280
279
);
281
280
282
281
private void handleCredential (final SignInCredential credential ) {
283
- SignInKickstarter viewModel = new ViewModelProvider (this )
284
- .get (SignInKickstarter .class );
285
-
286
282
String id = credential .getId ();
287
283
String password = credential .getPassword ();
288
284
if (TextUtils .isEmpty (password )) {
@@ -291,16 +287,19 @@ private void handleCredential(final SignInCredential credential) {
291
287
if (!TextUtils .isEmpty (googleIdToken )) {
292
288
final IdpResponse response = new IdpResponse .Builder (
293
289
new User .Builder (GoogleAuthProvider .PROVIDER_ID , id ).build ()).build ();
294
- viewModel .setResult (Resource .forLoading ());
290
+ KickoffActivity . mKickstarter .setResult (Resource .forLoading ());
295
291
getAuth ().signInWithCredential (GoogleAuthProvider .getCredential (googleIdToken , null ))
296
- .addOnSuccessListener (authResult -> viewModel .handleSuccess (response , authResult ));
292
+ .addOnSuccessListener (authResult -> KickoffActivity . mKickstarter .handleSuccess (response , authResult ));
297
293
}
298
294
} else {
299
295
final IdpResponse response = new IdpResponse .Builder (
300
296
new User .Builder (EmailAuthProvider .PROVIDER_ID , id ).build ()).build ();
301
- viewModel .setResult (Resource .forLoading ());
297
+ KickoffActivity . mKickstarter .setResult (Resource .forLoading ());
302
298
getAuth ().signInWithEmailAndPassword (id , password )
303
- .addOnSuccessListener (authResult -> viewModel .handleSuccess (response , authResult ))
299
+ .addOnSuccessListener (authResult -> {
300
+ KickoffActivity .mKickstarter .handleSuccess (response , authResult );
301
+ finish ();
302
+ })
304
303
.addOnFailureListener (e -> {
305
304
if (e instanceof FirebaseAuthInvalidUserException ||
306
305
e instanceof FirebaseAuthInvalidCredentialsException ) {
@@ -332,9 +331,6 @@ private List<String> getCredentialAccountTypes() {
332
331
* This is called if the credentials attempt fails or isn’t applicable.
333
332
*/
334
333
private void showAuthMethodPicker () {
335
- // Ensure that the provider list is visible.
336
- // (If you already inflated it, you might not need to do anything here.)
337
- // Optionally hide any progress indicators.
338
334
hideProgress ();
339
335
}
340
336
0 commit comments