merge info from group when add id to addressbook
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
462fa5999f
commit
51b62ea467
@ -132,6 +132,7 @@ class AbModel {
|
|||||||
'alias': alias,
|
'alias': alias,
|
||||||
'tags': tags,
|
'tags': tags,
|
||||||
});
|
});
|
||||||
|
_mergePeerFromGroup(peer);
|
||||||
peers.add(peer);
|
peers.add(peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,4 +574,18 @@ class AbModel {
|
|||||||
peers.clear();
|
peers.clear();
|
||||||
await bind.mainClearAb();
|
await bind.mainClearAb();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_mergePeerFromGroup(Peer p) {
|
||||||
|
final g = gFFI.groupModel.peers.firstWhereOrNull((e) => p.id == e.id);
|
||||||
|
if (g == null) return;
|
||||||
|
if (p.username.isEmpty) {
|
||||||
|
p.username = g.username;
|
||||||
|
}
|
||||||
|
if (p.hostname.isEmpty) {
|
||||||
|
p.hostname = g.hostname;
|
||||||
|
}
|
||||||
|
if (p.platform.isEmpty) {
|
||||||
|
p.platform = g.platform;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user