add: peer rename

Signed-off-by: Kingtous <kingtous@qq.com>
This commit is contained in:
Kingtous
2022-07-29 12:03:24 +08:00
parent a81f4c0124
commit 6b99d4d82e
5 changed files with 168 additions and 199 deletions

View File

@@ -141,6 +141,16 @@ class AbModel with ChangeNotifier {
}
}
void setPeerOption(String id, String key, String value) {
final it = peers.where((p0) => p0['id'] == id);
if (it.isEmpty) {
debugPrint("${id} is not exists");
return;
} else {
it.first[key] = value;
}
}
void clear() {
peers.clear();
tags.clear();

View File

@@ -1010,6 +1010,14 @@ class FFI {
return bind.mainSetLocalOption(key: key, value: value);
}
Future<String> getPeerOption(String id, String key) {
return bind.mainGetPeerOption(id: id, key: key);
}
Future<void> setPeerOption(String id, String key, String value) {
return bind.mainSetPeerOption(id: id, key: key, value: value);
}
void setOption(String name, String value) {
Map<String, String> res = Map()
..["name"] = name