Merge pull request #5425 from 21pages/ab

fix searching alias doesn't take effect in address book
This commit is contained in:
RustDesk
2023-08-17 19:24:13 +08:00
committed by GitHub
5 changed files with 42 additions and 30 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,
@@ -508,4 +516,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'));
}
});
}
}

View File

@@ -197,17 +197,18 @@ class ServerModel with ChangeNotifier {
_approveMode = approveMode;
update = true;
}
final oldPwdText = _serverPasswd.text;
if (_serverPasswd.text != temporaryPassword &&
temporaryPassword.isNotEmpty) {
_serverPasswd.text = temporaryPassword;
}
var stopped = option2bool(
"stop-service", await bind.mainGetOption(key: "stop-service"));
final oldPwdText = _serverPasswd.text;
if (stopped ||
verificationMethod == kUsePermanentPassword ||
_approveMode == 'click') {
_serverPasswd.text = '-';
} else {
if (_serverPasswd.text != temporaryPassword &&
temporaryPassword.isNotEmpty) {
_serverPasswd.text = temporaryPassword;
}
}
if (oldPwdText != _serverPasswd.text) {
update = true;