Skip to content

Commit

Permalink
fix: reload after restoring
Browse files Browse the repository at this point in the history
  • Loading branch information
lollipopkit committed Dec 4, 2023
1 parent 22901bb commit 5a982ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
6 changes: 6 additions & 0 deletions lib/data/model/app/backup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import 'package:toolbox/data/model/server/server_private_info.dart';
import 'package:toolbox/data/model/server/snippet.dart';
import 'package:toolbox/data/res/logger.dart';
import 'package:toolbox/data/res/path.dart';
import 'package:toolbox/data/res/provider.dart';
import 'package:toolbox/data/res/rebuild.dart';
import 'package:toolbox/data/res/store.dart';

const backupFormatVersion = 1;
Expand Down Expand Up @@ -103,6 +105,10 @@ class Backup {
Stores.docker.put(k, val);
}
}

Pros.reload();
RebuildNodes.app.rebuild();

return true;
}

Expand Down
12 changes: 0 additions & 12 deletions lib/view/page/backup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import 'package:toolbox/core/utils/sync/webdav.dart';
import 'package:toolbox/data/model/app/backup.dart';
import 'package:toolbox/data/res/logger.dart';
import 'package:toolbox/data/res/path.dart';
import 'package:toolbox/data/res/provider.dart';
import 'package:toolbox/data/res/rebuild.dart';
import 'package:toolbox/data/res/store.dart';
import 'package:toolbox/view/widget/expand_tile.dart';
import 'package:toolbox/view/widget/cardx.dart';
Expand Down Expand Up @@ -120,7 +118,6 @@ class BackupPage extends StatelessWidget {
onPressed: () async {
await backup.restore(force: true);
context.pop();
_reload();
},
child: Text(l10n.ok),
),
Expand Down Expand Up @@ -162,7 +159,6 @@ class BackupPage extends StatelessWidget {
icloudLoading.value = true;
await ICloud.sync();
icloudLoading.value = false;
_reload();
}
},
),
Expand Down Expand Up @@ -202,7 +198,6 @@ class BackupPage extends StatelessWidget {
await compute(Backup.fromJsonString, dlFile);
await dlBak.restore(force: true);
icloudLoading.value = false;
_reload();
},
child: Text(l10n.download),
),
Expand Down Expand Up @@ -329,7 +324,6 @@ class BackupPage extends StatelessWidget {
webdavLoading.value = true;
await Webdav.sync();
webdavLoading.value = false;
_reload();
}
},
),
Expand Down Expand Up @@ -370,7 +364,6 @@ class BackupPage extends StatelessWidget {
await compute(Backup.fromJsonString, dlFile);
await dlBak.restore(force: true);
webdavLoading.value = false;
_reload();
},
child: Text(l10n.download),
),
Expand Down Expand Up @@ -400,9 +393,4 @@ class BackupPage extends StatelessWidget {
),
);
}

void _reload() {
Pros.reload();
RebuildNodes.app.rebuild();
}
}

0 comments on commit 5a982ae

Please sign in to comment.