sync ab alias

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2023-08-15 09:23:55 +08:00
parent b2f5e2f927
commit 57b8ec178c
4 changed files with 33 additions and 6 deletions

View File

@@ -197,6 +197,14 @@ class AbModel {
}).toList();
}
void changeAlias({required String id, required String alias}) {
final it = peers.where((element) => element.id == id);
if (it.isEmpty) {
return;
}
it.first.alias = alias;
}
Future<void> pushAb({bool toast = true}) async {
debugPrint("pushAb");
pushError.value = '';
@@ -332,7 +340,7 @@ class AbModel {
username: r.username.isEmpty ? p.username : r.username,
hostname: r.hostname.isEmpty ? p.hostname : r.hostname,
platform: r.platform.isEmpty ? p.platform : r.platform,
alias: r.alias,
alias: p.alias.isEmpty ? r.alias : p.alias,
tags: p.tags,
forceAlwaysRelay: r.forceAlwaysRelay,
rdpPort: r.rdpPort,
@@ -352,7 +360,8 @@ class AbModel {
return a.hash != b.hash ||
a.username != b.username ||
a.platform != b.platform ||
a.hostname != b.hostname;
a.hostname != b.hostname ||
a.alias != b.alias;
}
Future<List<Peer>> getRecentPeers() async {

View File

@@ -56,6 +56,7 @@ class Peer {
"username": username,
"hostname": hostname,
"platform": platform,
"alias": alias,
"tags": tags,
};
}