@@ -234,7 +234,7 @@ class StateMachineBloc
234
234
allowedMfaTypes: result.nextStep.allowedMfaTypes,
235
235
);
236
236
case AuthSignInStep .continueSignInWithMfaSetupSelection:
237
- await _handleMfaSetupSelection (result);
237
+ yield await _handleMfaSetupSelection (result);
238
238
case AuthSignInStep .continueSignInWithTotpSetup:
239
239
assert (
240
240
result.nextStep.totpSetupDetails != null ,
@@ -340,7 +340,7 @@ class StateMachineBloc
340
340
),
341
341
);
342
342
case AuthSignInStep .continueSignInWithMfaSetupSelection:
343
- await _handleMfaSetupSelection (result);
343
+ _emit ( await _handleMfaSetupSelection (result) );
344
344
case AuthSignInStep .continueSignInWithEmailMfaSetup:
345
345
_emit (UnauthenticatedState .continueSignInWithEmailMfaSetup);
346
346
case AuthSignInStep .confirmSignInWithTotpMfaCode:
@@ -543,7 +543,7 @@ class StateMachineBloc
543
543
yield * const Stream .empty ();
544
544
}
545
545
546
- Future <void > _handleMfaSetupSelection (SignInResult result) async {
546
+ Future <UnauthenticatedState > _handleMfaSetupSelection (SignInResult result) async {
547
547
final allowedMfaTypes = result.nextStep.allowedMfaTypes;
548
548
549
549
if (allowedMfaTypes == null ) {
@@ -556,12 +556,7 @@ class StateMachineBloc
556
556
final mfaTypesForSetup = allowedMfaTypes.toSet ()..remove (MfaType .sms);
557
557
558
558
if (mfaTypesForSetup.length != 1 ) {
559
- _emit (
560
- ContinueSignInWithMfaSetupSelection (
561
- allowedMfaTypes: allowedMfaTypes,
562
- ),
563
- );
564
- return ;
559
+ return ContinueSignInWithMfaSetupSelection (allowedMfaTypes: allowedMfaTypes);
565
560
}
566
561
567
562
final mfaType = mfaTypesForSetup.first;
@@ -572,15 +567,13 @@ class StateMachineBloc
572
567
result.nextStep.totpSetupDetails != null ,
573
568
'Sign In Result should have totpSetupDetails' ,
574
569
);
575
- _emit (
576
- await ContinueSignInTotpSetup .setupURI (
577
- result.nextStep.totpSetupDetails! ,
578
- totpOptions,
579
- ),
570
+ return ContinueSignInTotpSetup .setupURI (
571
+ result.nextStep.totpSetupDetails! ,
572
+ totpOptions,
580
573
);
581
574
582
575
case MfaType .email:
583
- _emit ( UnauthenticatedState .continueSignInWithEmailMfaSetup) ;
576
+ return UnauthenticatedState .continueSignInWithEmailMfaSetup;
584
577
585
578
default :
586
579
throw InvalidUserPoolConfigurationException (
0 commit comments