Fix new update pathway not actually being used

This commit is contained in:
Dean Herbert 2022-07-26 17:58:09 +09:00
parent 7f75184a01
commit 9173271900
1 changed files with 7 additions and 3 deletions

View File

@ -67,11 +67,15 @@ protected bool Download(T model, bool minimiseDownloadSize, TModel? originalMode
{
Task.Factory.StartNew(async () =>
{
// This gets scheduled back to the update thread, but we want the import to run in the background.
var imported = await importer.Import(notification, new ImportTask(filename)).ConfigureAwait(false);
bool importSuccessful;
if (originalModel != null)
importSuccessful = (await importer.ImportAsUpdate(notification, new ImportTask(filename), originalModel)) != null;
else
importSuccessful = (await importer.Import(notification, new ImportTask(filename))).Any();
// for now a failed import will be marked as a failed download for simplicity.
if (!imported.Any())
if (!importSuccessful)
DownloadFailed?.Invoke(request);
CurrentDownloads.Remove(request);