[import data] proxy settings should be kept

This commit is contained in:
2024-11-11 17:46:11 +08:00
parent a0e3cc720a
commit e1df69e785

View File

@@ -65,9 +65,13 @@ Future<void> importAppData(File file, [bool checkVersion = false]) async {
LocalFavoritesManager().init(); LocalFavoritesManager().init();
} }
if(await appdataFile.exists()) { if(await appdataFile.exists()) {
// proxy settings should be kept
var proxySettings = appdata.settings["proxy"];
File(FilePath.join(App.dataPath, "appdata.json")).deleteIfExistsSync(); File(FilePath.join(App.dataPath, "appdata.json")).deleteIfExistsSync();
appdataFile.renameSync(FilePath.join(App.dataPath, "appdata.json")); appdataFile.renameSync(FilePath.join(App.dataPath, "appdata.json"));
appdata.init(); await appdata.init();
appdata.settings["proxy"] = proxySettings;
appdata.saveData();
} }
var comicSourceDir = FilePath.join(cacheDirPath, "comic_source"); var comicSourceDir = FilePath.join(cacheDirPath, "comic_source");
if(Directory(comicSourceDir).existsSync()) { if(Directory(comicSourceDir).existsSync()) {