mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
fix: Node Issues (#2498)
- Allow adding new nodes without port - Replace default port number for empty string when there's no port added
This commit is contained in:
@@ -4,8 +4,10 @@ import 'package:cake_wallet/core/validator.dart';
|
||||
class NodePortValidator extends TextValidator {
|
||||
NodePortValidator()
|
||||
: super(
|
||||
errorMessage: S.current.error_text_node_port,
|
||||
minLength: 0,
|
||||
maxLength: 5,
|
||||
pattern: '^[0-9]');
|
||||
errorMessage: S.current.error_text_node_port,
|
||||
minLength: 0,
|
||||
maxLength: 5,
|
||||
pattern: '^[0-9]',
|
||||
isAutovalidate: true,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,10 @@ class NodeForm extends StatelessWidget {
|
||||
this.type,
|
||||
}) : _addressController = TextEditingController(text: editingNode?.uri.host.toString()),
|
||||
_pathController = TextEditingController(text: editingNode?.path.toString()),
|
||||
_portController = TextEditingController(text: editingNode?.uri.port.toString()),
|
||||
_portController = TextEditingController(
|
||||
text: (editingNode != null && editingNode.uri.hasPort)
|
||||
? editingNode.uri.port.toString()
|
||||
: ''),
|
||||
_loginController = TextEditingController(text: editingNode?.login),
|
||||
_passwordController = TextEditingController(text: editingNode?.password),
|
||||
_socksAddressController = TextEditingController(text: editingNode?.socksProxyAddress) {
|
||||
@@ -27,7 +30,7 @@ class NodeForm extends StatelessWidget {
|
||||
nodeViewModel
|
||||
..setAddress((editingNode!.uri.host.toString()))
|
||||
..setPath((editingNode!.path.toString()))
|
||||
..setPort((editingNode!.uri.port.toString()))
|
||||
..setPort((editingNode!.uri.hasPort ? editingNode!.uri.port.toString() : ''))
|
||||
..setPassword((editingNode!.password ?? ''))
|
||||
..setLogin((editingNode!.login ?? ''))
|
||||
..setSSL((editingNode!.isSSL))
|
||||
|
||||
@@ -71,8 +71,7 @@ abstract class NodeCreateOrEditViewModelBase with Store {
|
||||
|
||||
@computed
|
||||
bool get isReady =>
|
||||
(address.isNotEmpty && port.isNotEmpty) ||
|
||||
_walletType == WalletType.decred; // Allow an empty address.
|
||||
(address.isNotEmpty) || _walletType == WalletType.decred; // Allow an empty address.
|
||||
|
||||
bool get hasAuthCredentials =>
|
||||
_walletType == WalletType.monero || _walletType == WalletType.wownero || _walletType == WalletType.haven;
|
||||
|
||||
Reference in New Issue
Block a user