mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-06-07 18:02:48 +08:00
ab: unremember password in ab also unremember password in recent, and set alias also sync to recent
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
6045b5fead
commit
d7f0acd96d
@ -659,6 +659,7 @@ abstract class BasePeerCard extends StatelessWidget {
|
|||||||
if (newName != oldName) {
|
if (newName != oldName) {
|
||||||
if (tab == PeerTabIndex.ab) {
|
if (tab == PeerTabIndex.ab) {
|
||||||
gFFI.abModel.changeAlias(id: id, alias: newName);
|
gFFI.abModel.changeAlias(id: id, alias: newName);
|
||||||
|
await bind.mainSetPeerAlias(id: id, alias: newName);
|
||||||
gFFI.abModel.pushAb();
|
gFFI.abModel.pushAb();
|
||||||
} else {
|
} else {
|
||||||
await bind.mainSetPeerAlias(id: id, alias: newName);
|
await bind.mainSetPeerAlias(id: id, alias: newName);
|
||||||
@ -713,16 +714,8 @@ abstract class BasePeerCard extends StatelessWidget {
|
|||||||
case PeerTabIndex.ab:
|
case PeerTabIndex.ab:
|
||||||
gFFI.abModel.deletePeer(id);
|
gFFI.abModel.deletePeer(id);
|
||||||
final future = gFFI.abModel.pushAb();
|
final future = gFFI.abModel.pushAb();
|
||||||
if (shouldSyncAb() && await bind.mainPeerExists(id: peer.id)) {
|
if (await bind.mainPeerExists(id: peer.id)) {
|
||||||
Future.delayed(Duration.zero, () async {
|
gFFI.abModel.reSyncToast(future);
|
||||||
final succ = await future;
|
|
||||||
if (succ) {
|
|
||||||
await Future.delayed(Duration(seconds: 2)); // success msg
|
|
||||||
BotToast.showText(
|
|
||||||
contentColor: Colors.lightBlue,
|
|
||||||
text: translate('synced_peer_readded_tip'));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PeerTabIndex.group:
|
case PeerTabIndex.group:
|
||||||
@ -748,9 +741,15 @@ abstract class BasePeerCard extends StatelessWidget {
|
|||||||
translate('Unremember Password'),
|
translate('Unremember Password'),
|
||||||
style: style,
|
style: style,
|
||||||
),
|
),
|
||||||
proc: () {
|
proc: () async {
|
||||||
bind.mainForgetPassword(id: id);
|
if (tab == PeerTabIndex.ab) {
|
||||||
showToast(translate('Successful'));
|
gFFI.abModel.unrememberPassword(id);
|
||||||
|
await bind.mainForgetPassword(id: id);
|
||||||
|
gFFI.abModel.pushAb();
|
||||||
|
} else {
|
||||||
|
bind.mainForgetPassword(id: id);
|
||||||
|
showToast(translate('Successful'));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
padding: menuPadding,
|
padding: menuPadding,
|
||||||
dismissOnClicked: true,
|
dismissOnClicked: true,
|
||||||
@ -1046,7 +1045,7 @@ class AddressBookPeerCard extends BasePeerCard {
|
|||||||
}
|
}
|
||||||
menuItems.add(MenuEntryDivider());
|
menuItems.add(MenuEntryDivider());
|
||||||
menuItems.add(_renameAction(peer.id));
|
menuItems.add(_renameAction(peer.id));
|
||||||
if (await bind.mainPeerHasPassword(id: peer.id)) {
|
if (peer.hash.isNotEmpty) {
|
||||||
menuItems.add(_unrememberPasswordAction(peer.id));
|
menuItems.add(_unrememberPasswordAction(peer.id));
|
||||||
}
|
}
|
||||||
if (gFFI.abModel.tags.isNotEmpty) {
|
if (gFFI.abModel.tags.isNotEmpty) {
|
||||||
|
@ -345,16 +345,7 @@ class _PeerTabPageState extends State<PeerTabPage>
|
|||||||
gFFI.abModel.deletePeers(peers.map((p) => p.id).toList());
|
gFFI.abModel.deletePeers(peers.map((p) => p.id).toList());
|
||||||
final future = gFFI.abModel.pushAb();
|
final future = gFFI.abModel.pushAb();
|
||||||
if (hasSynced) {
|
if (hasSynced) {
|
||||||
Future.delayed(Duration.zero, () async {
|
gFFI.abModel.reSyncToast(future);
|
||||||
final succ = await future;
|
|
||||||
if (succ) {
|
|
||||||
await Future.delayed(
|
|
||||||
Duration(seconds: 2)); // success msg
|
|
||||||
BotToast.showText(
|
|
||||||
contentColor: Colors.lightBlue,
|
|
||||||
text: translate('synced_peer_readded_tip'));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -212,6 +212,14 @@ class AbModel {
|
|||||||
it.first.alias = alias;
|
it.first.alias = alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void unrememberPassword(String id) {
|
||||||
|
final it = peers.where((element) => element.id == id);
|
||||||
|
if (it.isEmpty) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
it.first.hash = '';
|
||||||
|
}
|
||||||
|
|
||||||
Future<bool> pushAb(
|
Future<bool> pushAb(
|
||||||
{bool toastIfFail = true,
|
{bool toastIfFail = true,
|
||||||
bool toastIfSucc = true,
|
bool toastIfSucc = true,
|
||||||
@ -507,4 +515,17 @@ class AbModel {
|
|||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reSyncToast(Future<bool> future) {
|
||||||
|
if (!shouldSyncAb()) return;
|
||||||
|
Future.delayed(Duration.zero, () async {
|
||||||
|
final succ = await future;
|
||||||
|
if (succ) {
|
||||||
|
await Future.delayed(Duration(seconds: 2)); // success msg
|
||||||
|
BotToast.showText(
|
||||||
|
contentColor: Colors.lightBlue,
|
||||||
|
text: translate('synced_peer_readded_tip'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user