MCDO fixes 2
implement RestoreThenUpload for charadata cleanup, actually show success/failure actually sort chara data list lmao add shared character data sets display to main ui (partial) increase size of mcdo table slightly fix selecting last new entry
This commit is contained in:
@@ -103,7 +103,7 @@ public sealed partial class CharaDataManager : DisposableMediatorSubscriberBase
|
||||
public IDictionary<UserData, List<CharaDataMetaInfoExtendedDto>> SharedWithYouData => _sharedWithYouData;
|
||||
public Task? UiBlockingComputation { get; private set; }
|
||||
public ValueProgress<string>? UploadProgress { get; private set; }
|
||||
public Task<(string Output, bool Success)>? UploadTask { get; private set; }
|
||||
public Task<(string Output, bool Success)>? UploadTask { get; set; }
|
||||
public bool BrioAvailable => _ipcManager.Brio.APIAvailable;
|
||||
|
||||
public Task ApplyCharaData(CharaDataMetaInfoDto dataMetaInfoDto, string charaName)
|
||||
@@ -581,8 +581,31 @@ public sealed partial class CharaDataManager : DisposableMediatorSubscriberBase
|
||||
var hasDto = _ownCharaData.TryGetValue(id, out var dto);
|
||||
if (!hasDto || dto == null) return;
|
||||
|
||||
var missingFileList = dto.MissingFiles.ToList();
|
||||
UiBlockingComputation = UploadTask = UploadFiles(missingFileList, async () =>
|
||||
UiBlockingComputation = UploadTask = RestoreThenUpload(dto);
|
||||
}
|
||||
|
||||
private async Task<(string Output, bool Success)> RestoreThenUpload(CharaDataFullExtendedDto dto)
|
||||
{
|
||||
var newDto = await _apiController.CharaDataAttemptRestore(dto.Id).ConfigureAwait(false);
|
||||
if (newDto == null)
|
||||
{
|
||||
_ownCharaData.Remove(dto.Id);
|
||||
_metaInfoCache.Remove(dto.FullId, out _);
|
||||
UiBlockingComputation = null;
|
||||
return ("No such DTO found", false);
|
||||
}
|
||||
|
||||
await AddOrUpdateDto(newDto).ConfigureAwait(false);
|
||||
_ = _ownCharaData.TryGetValue(dto.Id, out var extendedDto);
|
||||
|
||||
if (!extendedDto!.HasMissingFiles)
|
||||
{
|
||||
UiBlockingComputation = null;
|
||||
return ("Restored successfully", true);
|
||||
}
|
||||
|
||||
var missingFileList = extendedDto!.MissingFiles.ToList();
|
||||
var result = await UploadFiles(missingFileList, async () =>
|
||||
{
|
||||
var newFilePaths = dto.FileGamePaths;
|
||||
foreach (var missing in missingFileList)
|
||||
@@ -595,7 +618,10 @@ public sealed partial class CharaDataManager : DisposableMediatorSubscriberBase
|
||||
};
|
||||
var res = await _apiController.CharaDataUpdate(updateDto).ConfigureAwait(false);
|
||||
await AddOrUpdateDto(res).ConfigureAwait(false);
|
||||
});
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
UiBlockingComputation = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
internal void ApplyDataToSelf(CharaDataFullExtendedDto dataDto)
|
||||
@@ -926,8 +952,7 @@ public sealed partial class CharaDataManager : DisposableMediatorSubscriberBase
|
||||
}
|
||||
finally
|
||||
{
|
||||
UploadTask = null;
|
||||
UploadProgress = null;
|
||||
UiBlockingComputation = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user