Update branch to null safety

Fix Conflicts with main
This commit is contained in:
OmarHatem
2022-11-09 17:53:50 +02:00
parent 6210d8fba6
commit ba783982e4
6 changed files with 25 additions and 28 deletions
@@ -1,7 +1,6 @@
import 'package:cake_wallet/core/execution_state.dart';
import 'package:hive/hive.dart';
import 'package:mobx/mobx.dart';
import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/node.dart';
import 'package:cw_core/wallet_type.dart';
@@ -11,7 +10,7 @@ class NodeCreateOrEditViewModel = NodeCreateOrEditViewModelBase
with _$NodeCreateOrEditViewModel;
abstract class NodeCreateOrEditViewModelBase with Store {
NodeCreateOrEditViewModelBase(this._nodeSource, this._wallet)
NodeCreateOrEditViewModelBase(this._nodeSource, this._walletType)
: state = InitialExecutionState(),
connectionState = InitialExecutionState(),
useSSL = false,
@@ -49,8 +48,8 @@ abstract class NodeCreateOrEditViewModelBase with Store {
bool get isReady =>
address.isNotEmpty && port.isNotEmpty;
bool get hasAuthCredentials => _wallet.type == WalletType.monero ||
_wallet.type == WalletType.haven;
bool get hasAuthCredentials => _walletType == WalletType.monero ||
_walletType == WalletType.haven;
String get uri {
var uri = address;
@@ -62,7 +61,7 @@ abstract class NodeCreateOrEditViewModelBase with Store {
return uri;
}
final WalletBase _wallet;
final WalletType _walletType;
final Box<Node> _nodeSource;
@action
@@ -80,7 +79,7 @@ abstract class NodeCreateOrEditViewModelBase with Store {
try {
state = IsExecutingState();
final node =
Node(uri: uri, type: _wallet.type, login: login, password: password,
Node(uri: uri, type: _walletType, login: login, password: password,
useSSL: useSSL, trusted: trusted);
await _nodeSource.add(node);
state = ExecutedSuccessfullyState();
@@ -94,7 +93,7 @@ abstract class NodeCreateOrEditViewModelBase with Store {
try {
connectionState = IsExecutingState();
final node =
Node(uri: uri, type: _wallet.type, login: login, password: password);
Node(uri: uri, type: _walletType, login: login, password: password);
final isAlive = await node.requestNode();
connectionState = ExecutedSuccessfullyState(payload: isAlive);
} catch (e) {
@@ -9,13 +9,13 @@ class PrivacySettingsViewModel = PrivacySettingsViewModelBase
with _$PrivacySettingsViewModel;
abstract class PrivacySettingsViewModelBase with Store {
PrivacySettingsViewModelBase(this.type) {
_disableFiat = false;
_disableExchange = false;
_addCustomNode = false;
PrivacySettingsViewModelBase(this.type)
: _disableFiat = false,
_disableExchange = false,
_addCustomNode = false {
settings = [
SwitcherListItem(
// TODO: replace when Disable Fiat PR is merged
title: "Disable Fiat API",
// title: S.current.disable_fiat,
value: () => _disableFiat,
@@ -36,16 +36,16 @@ abstract class PrivacySettingsViewModelBase with Store {
];
}
List<SwitcherListItem> settings;
late List<SwitcherListItem> settings;
@observable
bool _disableFiat;
bool _disableFiat = false;
@observable
bool _disableExchange;
bool _disableExchange = false;
@observable
bool _addCustomNode;
bool _addCustomNode = false;
final WalletType type;