import pica data

This commit is contained in:
2024-12-01 18:06:19 +08:00
committed by nyne
parent 305ef9263d
commit a711335012
3 changed files with 173 additions and 57 deletions

View File

@@ -110,16 +110,23 @@ class _AppSettingsState extends State<AppSettings> {
title: "Import App Data".tl,
callback: () async {
var controller = showLoadingDialog(context);
var file = await selectFile(ext: ['venera']);
var file = await selectFile(ext: ['venera', 'picadata']);
if (file != null) {
var cacheFile = File(FilePath.join(App.cachePath, "temp.venera"));
var cacheFile = File(FilePath.join(App.cachePath, "import_data_temp"));
await file.saveTo(cacheFile.path);
try {
await importAppData(cacheFile);
if(file.name.endsWith('picadata')) {
await importPicaData(cacheFile);
} else {
await importAppData(cacheFile);
}
} catch (e, s) {
Log.error("Import data", e.toString(), s);
context.showMessage(message: "Failed to import data".tl);
}
finally {
cacheFile.deleteIgnoreError();
}
}
controller.close();
},