mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 15:57:25 +00:00
improve downloading data
This commit is contained in:
@@ -176,8 +176,11 @@ class DataSync with ChangeNotifier {
|
||||
var files = await client.readDir('/');
|
||||
files.sort((a, b) => b.name!.compareTo(a.name!));
|
||||
var file = files.firstWhereOrNull((e) => e.name!.endsWith('.venera'));
|
||||
if (file == null) {
|
||||
throw 'No data file found';
|
||||
}
|
||||
var version =
|
||||
file!.name!.split('-').elementAtOrNull(1)?.split('.').first;
|
||||
file.name!.split('-').elementAtOrNull(1)?.split('.').first;
|
||||
if (version != null && int.tryParse(version) != null) {
|
||||
var currentVersion = appdata.settings['dataVersion'];
|
||||
if (currentVersion != null && int.parse(version) <= currentVersion) {
|
||||
|
Reference in New Issue
Block a user