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:
21pages
2023-08-17 18:21:37 +08:00
parent 6045b5fead
commit d7f0acd96d
3 changed files with 35 additions and 24 deletions

View File

@@ -212,6 +212,14 @@ class AbModel {
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(
{bool toastIfFail = true,
bool toastIfSucc = true,
@@ -507,4 +515,17 @@ class AbModel {
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'));
}
});
}
}