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 13:13:49 +01:00 committed by GitHub
parent 8747d2fe59
commit 3b073d9751
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 22 deletions

View file

@ -1,10 +1,9 @@
import 'dart:async'; import 'dart:async';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/sync_status.dart'; import 'package:cw_core/sync_status.dart';
import 'package:cake_wallet/store/settings_store.dart'; import 'package:cake_wallet/store/settings_store.dart';
import 'package:connectivity/connectivity.dart';
Timer? _checkConnectionTimer; Timer? _checkConnectionTimer;
void startCheckConnectionReaction( void startCheckConnectionReaction(

View file

@ -43,26 +43,24 @@ class TotpAuthCodePageState extends State<TotpAuthCodePage> {
@override @override
void initState() { void initState() {
_reaction ??= reaction((_) => widget.setup2FAViewModel.state, (ExecutionState state) { if(widget.totpArguments.onTotpAuthenticationFinished != null) {
if (state is ExecutedSuccessfullyState) { _reaction ??= reaction((_) => widget.setup2FAViewModel.state, (ExecutionState state) {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
widget.totpArguments.onTotpAuthenticationFinished!(true, this); if (state is ExecutedSuccessfullyState) {
}); widget.totpArguments.onTotpAuthenticationFinished!(true, this);
} }
if (state is FailureState) { if (state is FailureState) {
print(state.error); print(state.error);
WidgetsBinding.instance.addPostFrameCallback((_) { widget.totpArguments.onTotpAuthenticationFinished!(false, this);
widget.totpArguments.onTotpAuthenticationFinished!(false, this); }
});
}
if (state is AuthenticationBanned) { if (state is AuthenticationBanned) {
WidgetsBinding.instance.addPostFrameCallback((_) { widget.totpArguments.onTotpAuthenticationFinished!(false, this);
widget.totpArguments.onTotpAuthenticationFinished!(false, this); }
}); });
}
}); });
}
super.initState(); super.initState();
} }

View file

@ -580,7 +580,6 @@ abstract class SettingsStoreBase with Store {
if (Platform.isAndroid) { if (Platform.isAndroid) {
final androidInfo = await deviceInfoPlugin.androidInfo; final androidInfo = await deviceInfoPlugin.androidInfo;
deviceName = '${androidInfo.brand}%20${androidInfo.manufacturer}%20${androidInfo.model}'; deviceName = '${androidInfo.brand}%20${androidInfo.manufacturer}%20${androidInfo.model}';
print(deviceName);
} else if (Platform.isIOS) { } else if (Platform.isIOS) {
final iosInfo = await deviceInfoPlugin.iosInfo; final iosInfo = await deviceInfoPlugin.iosInfo;
deviceName = iosInfo.model; deviceName = iosInfo.model;

View file

@ -5,7 +5,7 @@
import FlutterMacOS import FlutterMacOS
import Foundation import Foundation
import connectivity_macos import connectivity_plus_macos
import cw_monero import cw_monero
import device_info_plus import device_info_plus
import devicelocale import devicelocale

View file

@ -56,8 +56,8 @@ dependencies:
# password: ^1.0.0 # password: ^1.0.0
basic_utils: ^4.3.0 basic_utils: ^4.3.0
get_it: ^7.2.0 get_it: ^7.2.0
connectivity: ^3.0.3 # connectivity: ^3.0.3
# connectivity_plus: ^2.3.5 connectivity_plus: ^2.3.5
keyboard_actions: ^4.0.1 keyboard_actions: ^4.0.1
another_flushbar: ^1.12.29 another_flushbar: ^1.12.29
archive: ^3.3.0 archive: ^3.3.0