Cw 602 nano bad rep (#1356)

* add support for paths in node settings

* update translations and fixes

* fix node path

* add rep warning flag

* update translations

* code cleanup [skip ci]

* add additional node options

* add migration

* update transaction history rpc to be under the limit

* review fixes [skip ci]

* [skip ci] updates

* move n2_node.dart

* minor code improvements

* more minor code cleanup
This commit is contained in:
Matthew Fosse
2024-04-12 14:36:42 +02:00
committed by GitHub
parent 7abe5735c0
commit fce6394bca
46 changed files with 881 additions and 264 deletions
@@ -12,16 +12,15 @@ import 'package:permission_handler/permission_handler.dart';
part 'node_create_or_edit_view_model.g.dart';
class NodeCreateOrEditViewModel = NodeCreateOrEditViewModelBase
with _$NodeCreateOrEditViewModel;
class NodeCreateOrEditViewModel = NodeCreateOrEditViewModelBase with _$NodeCreateOrEditViewModel;
abstract class NodeCreateOrEditViewModelBase with Store {
NodeCreateOrEditViewModelBase(
this._nodeSource, this._walletType, this._settingsStore)
NodeCreateOrEditViewModelBase(this._nodeSource, this._walletType, this._settingsStore)
: state = InitialExecutionState(),
connectionState = InitialExecutionState(),
useSSL = false,
address = '',
path = '',
port = '',
login = '',
password = '',
@@ -35,6 +34,9 @@ abstract class NodeCreateOrEditViewModelBase with Store {
@observable
String address;
@observable
String path;
@observable
String port;
@@ -84,6 +86,7 @@ abstract class NodeCreateOrEditViewModelBase with Store {
@action
void reset() {
address = '';
path = '';
port = '';
login = '';
password = '';
@@ -99,6 +102,9 @@ abstract class NodeCreateOrEditViewModelBase with Store {
@action
void setAddress(String val) => address = val;
@action
void setPath(String val) => path = val;
@action
void setLogin(String val) => login = val;
@@ -121,6 +127,7 @@ abstract class NodeCreateOrEditViewModelBase with Store {
Future<void> save({Node? editingNode, bool saveAsCurrent = false}) async {
final node = Node(
uri: uri,
path: path,
type: _walletType,
login: login,
password: password,
@@ -151,6 +158,7 @@ abstract class NodeCreateOrEditViewModelBase with Store {
Future<void> connect() async {
final node = Node(
uri: uri,
path: path,
type: _walletType,
login: login,
password: password,
@@ -183,7 +191,7 @@ abstract class NodeCreateOrEditViewModelBase with Store {
Future<void> scanQRCodeForNewNode(BuildContext context) async {
try {
bool isCameraPermissionGranted =
await PermissionHandler.checkPermission(Permission.camera, context);
await PermissionHandler.checkPermission(Permission.camera, context);
if (!isCameraPermissionGranted) return;
String code = await presentQRScanner();
@@ -198,7 +206,7 @@ abstract class NodeCreateOrEditViewModelBase with Store {
}
final userInfo = uri.userInfo.split(':');
if (userInfo.length < 2) {
throw Exception('Unexpected scan QR code value: Value is invalid');
}
@@ -207,8 +215,11 @@ abstract class NodeCreateOrEditViewModelBase with Store {
final rpcPassword = userInfo[1];
final ipAddress = uri.host;
final port = uri.port.toString();
final path = uri.path;
setAddress(ipAddress);
setPath(path);
setPassword(rpcPassword);
setLogin(rpcUser);
setPort(port);