Cw-410 Null Issue With 2FA (#960)

* chore: Setup

* hotfix: null check operator used when totp arguments are null causing issues

* hotfix: null check operator used when totp arguments are null causing issues

* hotfix: null check operator used when totp arguments are null causing issues

* hotfix: null check operator used when totp arguments are null causing issues

* fix: Review changes

---------

Co-authored-by: David Adegoke <blazebrain@Davids-MacBook-Pro.local>
This commit is contained in:
Adegoke David
2023-06-06 15:13:49 +03:00
committed by GitHub
co-authored by David Adegoke
parent 8747d2fe59
commit 3b073d9751
5 changed files with 18 additions and 22 deletions
@@ -43,26 +43,24 @@ class TotpAuthCodePageState extends State<TotpAuthCodePage> {
@override
void initState() {
_reaction ??= reaction((_) => widget.setup2FAViewModel.state, (ExecutionState state) {
if (state is ExecutedSuccessfullyState) {
if(widget.totpArguments.onTotpAuthenticationFinished != null) {
_reaction ??= reaction((_) => widget.setup2FAViewModel.state, (ExecutionState state) {
WidgetsBinding.instance.addPostFrameCallback((_) {
widget.totpArguments.onTotpAuthenticationFinished!(true, this);
});
}
if (state is ExecutedSuccessfullyState) {
widget.totpArguments.onTotpAuthenticationFinished!(true, this);
}
if (state is FailureState) {
print(state.error);
WidgetsBinding.instance.addPostFrameCallback((_) {
widget.totpArguments.onTotpAuthenticationFinished!(false, this);
});
}
if (state is FailureState) {
print(state.error);
widget.totpArguments.onTotpAuthenticationFinished!(false, this);
}
if (state is AuthenticationBanned) {
WidgetsBinding.instance.addPostFrameCallback((_) {
widget.totpArguments.onTotpAuthenticationFinished!(false, this);
});
}
if (state is AuthenticationBanned) {
widget.totpArguments.onTotpAuthenticationFinished!(false, this);
}
});
});
}
super.initState();
}