Merge pull request #646 from ericszimmermann/ez_backup-restore
Backup and Restore functionality
This commit is contained in:
42 files changed
+7629
-251
No files matched your search
@@ -143,18 +143,25 @@ class TranslationService extends ChangeNotifier {
|
||||
return availableModels.isNotEmpty ? availableModels.first : null;
|
||||
}
|
||||
|
||||
Future<void> refreshDownloadedModels() async {
|
||||
Future<void> refreshDownloadedModels({bool clearMissing = false}) async {
|
||||
if (_isDownloading) return;
|
||||
final scanned = await _fileStore.scanDownloadedModels();
|
||||
if (scanned.isEmpty && !clearMissing) return;
|
||||
if (scanned.isEmpty) {
|
||||
await _appSettingsService.setTranslationDownloadedModels(const []);
|
||||
return;
|
||||
}
|
||||
final existingByPath = {
|
||||
for (final model in _settings.translationDownloadedModels)
|
||||
model.localPath: model,
|
||||
};
|
||||
final existingByName = {
|
||||
for (final model in _settings.translationDownloadedModels)
|
||||
model.name: model,
|
||||
};
|
||||
final merged = scanned.map((model) {
|
||||
final existing = existingByPath[model.localPath];
|
||||
final existing =
|
||||
existingByPath[model.localPath] ?? existingByName[model.name];
|
||||
if (existing == null) {
|
||||
return model;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user