3636import com .firebase .ui .auth .FirebaseAuthAnonymousUpgradeException ;
3737import com .firebase .ui .auth .FirebaseUiException ;
3838import com .firebase .ui .auth .IdpResponse ;
39+ import com .firebase .ui .auth .KickoffActivity ;
3940import com .firebase .ui .auth .R ;
4041import com .firebase .ui .auth .data .model .FlowParameters ;
4142import com .firebase .ui .auth .data .model .PendingIntentRequiredException ;
@@ -218,8 +219,6 @@ private void attemptCredentialSignIn() {
218219 boolean willRequestCredentials = supportPasswords || !accountTypes .isEmpty ();
219220
220221 if (args .enableCredentials && willRequestCredentials ) {
221- // Show a progress indicator on the popup.
222- showProgress (R .string .fui_progress_dialog_signing_in );
223222 SignInClient signInClient = Identity .getSignInClient (getApplication ());
224223 BeginSignInRequest .Builder requestBuilder = BeginSignInRequest .builder ();
225224 if (supportPasswords ) {
@@ -280,9 +279,6 @@ private void attemptCredentialSignIn() {
280279 );
281280
282281 private void handleCredential (final SignInCredential credential ) {
283- SignInKickstarter viewModel = new ViewModelProvider (this )
284- .get (SignInKickstarter .class );
285-
286282 String id = credential .getId ();
287283 String password = credential .getPassword ();
288284 if (TextUtils .isEmpty (password )) {
@@ -291,16 +287,19 @@ private void handleCredential(final SignInCredential credential) {
291287 if (!TextUtils .isEmpty (googleIdToken )) {
292288 final IdpResponse response = new IdpResponse .Builder (
293289 new User .Builder (GoogleAuthProvider .PROVIDER_ID , id ).build ()).build ();
294- viewModel .setResult (Resource .forLoading ());
290+ KickoffActivity . mKickstarter .setResult (Resource .forLoading ());
295291 getAuth ().signInWithCredential (GoogleAuthProvider .getCredential (googleIdToken , null ))
296- .addOnSuccessListener (authResult -> viewModel .handleSuccess (response , authResult ));
292+ .addOnSuccessListener (authResult -> KickoffActivity . mKickstarter .handleSuccess (response , authResult ));
297293 }
298294 } else {
299295 final IdpResponse response = new IdpResponse .Builder (
300296 new User .Builder (EmailAuthProvider .PROVIDER_ID , id ).build ()).build ();
301- viewModel .setResult (Resource .forLoading ());
297+ KickoffActivity . mKickstarter .setResult (Resource .forLoading ());
302298 getAuth ().signInWithEmailAndPassword (id , password )
303- .addOnSuccessListener (authResult -> viewModel .handleSuccess (response , authResult ))
299+ .addOnSuccessListener (authResult -> {
300+ KickoffActivity .mKickstarter .handleSuccess (response , authResult );
301+ finish ();
302+ })
304303 .addOnFailureListener (e -> {
305304 if (e instanceof FirebaseAuthInvalidUserException ||
306305 e instanceof FirebaseAuthInvalidCredentialsException ) {
@@ -332,9 +331,6 @@ private List<String> getCredentialAccountTypes() {
332331 * This is called if the credentials attempt fails or isn’t applicable.
333332 */
334333 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.
338334 hideProgress ();
339335 }
340336
0 commit comments