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>

Adegoke David committed Jun 6, 2023 at 13:13 UTC 3b073d9751006103e442cdd2ee73d155258ea3cf
5 files changed +20 -24
lib/reactions/check_connection.dart
+1 -2
@@ -1,10 +1,9 @@
1 import 'dart:async';
2
3 +import 'package:connectivity_plus/connectivity_plus.dart';
4 import 'package:cw_core/wallet_base.dart';
5 import 'package:cw_core/sync_status.dart';
6 import 'package:cake_wallet/store/settings_store.dart';
6 -import 'package:connectivity/connectivity.dart';
7 -
7 Timer? _checkConnectionTimer;
8
9 void startCheckConnectionReaction(
lib/src/screens/setup_2fa/setup_2fa_enter_code_page.dart
+16 -18
@@ -43,26 +43,24 @@ class TotpAuthCodePageState extends State<TotpAuthCodePage> {
43
44 @override
45 void initState() {
46 - _reaction ??= reaction((_) => widget.setup2FAViewModel.state, (ExecutionState state) {
47 - if (state is ExecutedSuccessfullyState) {
46 + if(widget.totpArguments.onTotpAuthenticationFinished != null) {
47 + _reaction ??= reaction((_) => widget.setup2FAViewModel.state, (ExecutionState state) {
48 WidgetsBinding.instance.addPostFrameCallback((_) {
49 - widget.totpArguments.onTotpAuthenticationFinished!(true, this);
50 - });
51 - }
52 -
53 - if (state is FailureState) {
54 - print(state.error);
55 - WidgetsBinding.instance.addPostFrameCallback((_) {
56 - widget.totpArguments.onTotpAuthenticationFinished!(false, this);
57 - });
58 - }
59 -
60 - if (state is AuthenticationBanned) {
61 - WidgetsBinding.instance.addPostFrameCallback((_) {
62 - widget.totpArguments.onTotpAuthenticationFinished!(false, this);
63 - });
64 - }
49 + if (state is ExecutedSuccessfullyState) {
50 + widget.totpArguments.onTotpAuthenticationFinished!(true, this);
51 + }
52 +
53 + if (state is FailureState) {
54 + print(state.error);
55 + widget.totpArguments.onTotpAuthenticationFinished!(false, this);
56 + }
57 +
58 + if (state is AuthenticationBanned) {
59 + widget.totpArguments.onTotpAuthenticationFinished!(false, this);
60 + }
61 + });
62 });
63 + }
64
65 super.initState();
66 }
lib/store/settings_store.dart
-1
@@ -580,7 +580,6 @@ abstract class SettingsStoreBase with Store {
580 if (Platform.isAndroid) {
581 final androidInfo = await deviceInfoPlugin.androidInfo;
582 deviceName = '${androidInfo.brand}%20${androidInfo.manufacturer}%20${androidInfo.model}';
583 - print(deviceName);
583 } else if (Platform.isIOS) {
584 final iosInfo = await deviceInfoPlugin.iosInfo;
585 deviceName = iosInfo.model;
macos/Flutter/GeneratedPluginRegistrant.swift
+1 -1
@@ -5,7 +5,7 @@
5 import FlutterMacOS
6 import Foundation
7
8 -import connectivity_macos
8 +import connectivity_plus_macos
9 import cw_monero
10 import device_info_plus
11 import devicelocale
pubspec_base.yaml
+2 -2
@@ -56,8 +56,8 @@ dependencies:
56 # password: ^1.0.0
57 basic_utils: ^4.3.0
58 get_it: ^7.2.0
59 - connectivity: ^3.0.3
60 - # connectivity_plus: ^2.3.5
59 + # connectivity: ^3.0.3
60 + connectivity_plus: ^2.3.5
61 keyboard_actions: ^4.0.1
62 another_flushbar: ^1.12.29
63 archive: ^3.3.0