new: delete all servers btn

This commit is contained in:
lollipopkit
2023-07-27 13:04:49 +08:00
parent 08a4dba659
commit ed3201db6d
16 changed files with 82 additions and 26 deletions

View File

@@ -29,7 +29,7 @@ class ServerPrivateInfo {
required this.pwd,
this.pubKeyId,
this.tags,
}) : id = '$name<$user@$ip:$port>';
}) : id = '$user@$ip:$port';
ServerPrivateInfo.fromJson(Map<String, dynamic> json) {
name = json["name"].toString();

View File

@@ -167,6 +167,15 @@ class ServerProvider extends BusyProvider {
_serverStore.delete(id);
}
void deleteAll() {
_servers.clear();
_serverOrder.clear();
_settingStore.serverOrder.put(_serverOrder);
_updateTags();
notifyListeners();
_serverStore.deleteAll();
}
Future<void> updateServer(
ServerPrivateInfo old,
ServerPrivateInfo newSpi,

View File

@@ -2,8 +2,8 @@
class BuildData {
static const String name = "ServerBox";
static const int build = 387;
static const int build = 388;
static const String engine = "3.10.6";
static const String buildAt = "2023-07-21 18:06:24.239059";
static const int modifications = 2;
static const String buildAt = "2023-07-27 13:03:33.193528";
static const int modifications = 16;
}

View File

@@ -22,6 +22,10 @@ class ServerStore extends PersistentStore {
box.delete(id);
}
void deleteAll() {
box.clear();
}
void update(ServerPrivateInfo old, ServerPrivateInfo newInfo) {
if (!have(old)) {
throw Exception('Old spi: $old not found');

View File

@@ -95,7 +95,8 @@ class SettingStore extends PersistentStore {
StoreProperty<NetViewType> get netViewType =>
property('netViewType', defaultValue: NetViewType.speed);
// Only valid on iOS
StoreProperty<bool> get autoUpdateHomeWidget => property('autoUpdateHomeWidget', defaultValue: isIOS);
StoreProperty<bool> get autoUpdateHomeWidget =>
property('autoUpdateHomeWidget', defaultValue: isIOS);
}