mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-22 06:28:39 +02:00
CAKE-169 | added NodeSSL class with getter useSSl; applied useSSL in the connectToNode() method in the monero_wallet.dart; added dynamic parameter to ExecutedSuccessfullyState class; applied ExecuteState class to connect() method in the node_create_or_edit_view_model.dart; deleted connection_state.dart; deleted _isEffectsInstalled parameter from node_create_or_edit_page.dart
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
abstract class ConnectionToNodeState {}
|
||||
|
||||
class InitialConnectionState extends ConnectionToNodeState {}
|
||||
|
||||
class IsConnectingState extends ConnectionToNodeState {}
|
||||
|
||||
class ConnectedSuccessfullyState extends ConnectionToNodeState {
|
||||
ConnectedSuccessfullyState(this.isAlive);
|
||||
|
||||
final bool isAlive;
|
||||
}
|
||||
|
||||
class FailureConnectedState extends ConnectionToNodeState {
|
||||
FailureConnectedState(this.error);
|
||||
|
||||
final String error;
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:cake_wallet/core/execution_state.dart';
|
||||
import 'package:cake_wallet/view_model/node_list/connection_state.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:cake_wallet/core/wallet_base.dart';
|
||||
@@ -14,7 +13,7 @@ class NodeCreateOrEditViewModel = NodeCreateOrEditViewModelBase
|
||||
abstract class NodeCreateOrEditViewModelBase with Store {
|
||||
NodeCreateOrEditViewModelBase(this._nodeSource, this._wallet)
|
||||
: state = InitialExecutionState(),
|
||||
connectionState = InitialConnectionState(),
|
||||
connectionState = InitialExecutionState(),
|
||||
useSSL = false;
|
||||
|
||||
@observable
|
||||
@@ -33,7 +32,7 @@ abstract class NodeCreateOrEditViewModelBase with Store {
|
||||
String password;
|
||||
|
||||
@observable
|
||||
ConnectionToNodeState connectionState;
|
||||
ExecutionState connectionState;
|
||||
|
||||
@observable
|
||||
bool useSSL;
|
||||
@@ -83,13 +82,13 @@ abstract class NodeCreateOrEditViewModelBase with Store {
|
||||
@action
|
||||
Future<void> connect() async {
|
||||
try {
|
||||
connectionState = IsConnectingState();
|
||||
connectionState = IsExecutingState();
|
||||
final node =
|
||||
Node(uri: uri, type: _wallet.type, login: login, password: password);
|
||||
final isAlive = await node.requestNode();
|
||||
connectionState = ConnectedSuccessfullyState(isAlive);
|
||||
connectionState = ExecutedSuccessfullyState(payload: isAlive);
|
||||
} catch (e) {
|
||||
connectionState = FailureConnectedState(e.toString());
|
||||
connectionState = FailureState(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user