mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-11-27 23:19:02 +08:00
ab: full check for adding peers from recent/batch operation
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
1e75b172d6
commit
6f8483aecd
@ -405,10 +405,18 @@ class _PeerTabPageState extends State<PeerTabPage>
|
||||
!gFFI.userModel.isLogin || model.currentTab == PeerTabIndex.ab.index,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
if (gFFI.abModel.isFull(true)) {
|
||||
return;
|
||||
}
|
||||
final peers = model.selectedPeers;
|
||||
gFFI.abModel.addPeers(peers);
|
||||
gFFI.abModel.pushAb();
|
||||
final future = gFFI.abModel.pushAb();
|
||||
model.setMultiSelectionMode(false);
|
||||
Future.delayed(Duration.zero, () async {
|
||||
await future;
|
||||
await Future.delayed(Duration(seconds: 2)); // toast
|
||||
gFFI.abModel.isFull(true);
|
||||
});
|
||||
},
|
||||
child: Tooltip(
|
||||
message: translate('Add to Address Book'),
|
||||
|
@ -163,10 +163,16 @@ class AbModel {
|
||||
}
|
||||
}
|
||||
|
||||
void addPeers(List<Peer> ps) {
|
||||
bool addPeers(List<Peer> ps) {
|
||||
bool allAdded = true;
|
||||
for (var p in ps) {
|
||||
addPeer(p);
|
||||
if (!isFull(false)) {
|
||||
addPeer(p);
|
||||
} else {
|
||||
allAdded = false;
|
||||
}
|
||||
}
|
||||
return allAdded;
|
||||
}
|
||||
|
||||
void addTag(String tag) async {
|
||||
@ -419,9 +425,11 @@ class AbModel {
|
||||
var r = recents[i];
|
||||
var index = peers.indexWhere((e) => e.id == r.id);
|
||||
if (index < 0) {
|
||||
peers.add(r);
|
||||
syncChanged = true;
|
||||
uiChanged = true;
|
||||
if (!isFull(false)) {
|
||||
peers.add(r);
|
||||
syncChanged = true;
|
||||
uiChanged = true;
|
||||
}
|
||||
} else {
|
||||
if (!r.equal(peers[index])) {
|
||||
uiChanged = true;
|
||||
|
Loading…
Reference in New Issue
Block a user