add trusted flag to node model

This commit is contained in:
julian 2023-01-04 14:31:49 -06:00
parent 1e3a42fd9a
commit 0e5de0d890
2 changed files with 11 additions and 2 deletions

View file

@ -26,6 +26,8 @@ class NodeModel {
final bool isFailover;
// @HiveField(9)
final bool isDown;
// @HiveField(10)
final bool? trusted;
NodeModel({
required this.host,
@ -38,6 +40,7 @@ class NodeModel {
required this.isFailover,
required this.isDown,
this.loginName,
this.trusted,
});
NodeModel copyWith({
@ -50,6 +53,7 @@ class NodeModel {
String? coinName,
bool? isFailover,
bool? isDown,
bool? trusted,
}) {
return NodeModel(
host: host ?? this.host,
@ -62,6 +66,7 @@ class NodeModel {
coinName: coinName ?? this.coinName,
isFailover: isFailover ?? this.isFailover,
isDown: isDown ?? this.isDown,
trusted: trusted ?? this.trusted,
);
}
@ -82,6 +87,7 @@ class NodeModel {
map['coinName'] = coinName;
map['isFailover'] = isFailover;
map['isDown'] = isDown;
map['trusted'] = trusted;
return map;
}

View file

@ -26,14 +26,15 @@ class NodeModelAdapter extends TypeAdapter<NodeModel> {
loginName: fields[5] as String?,
coinName: fields[7] as String,
isFailover: fields[8] as bool,
isDown: fields[8] as bool,
isDown: fields[9] as bool,
trusted: fields[10] as bool?,
);
}
@override
void write(BinaryWriter writer, NodeModel obj) {
writer
..writeByte(10)
..writeByte(11)
..writeByte(0)
..write(obj.id)
..writeByte(1)
@ -54,6 +55,8 @@ class NodeModelAdapter extends TypeAdapter<NodeModel> {
..write(obj.isFailover)
..writeByte(9)
..write(obj.isDown);
..writeByte(10)
..write(obj.trusted);
}
@override