Volume size info for sub content providers

This commit is contained in:
2023-09-05 23:12:20 +02:00
parent b998dc5b33
commit ba0b55c733
20 changed files with 92 additions and 41 deletions

View File

@@ -84,7 +84,7 @@ public class ContainerSizeSizeScanProvider : ContentProviderBase, IContainerSize
public override Task<bool> CanHandlePathAsync(NativePath path)
=> Task.FromResult(path.Path.StartsWith(ContentProviderName));
public override VolumeSizeInfo? GetVolumeSizeInfo(FullName path) => null;
public override ValueTask<VolumeSizeInfo?> GetVolumeSizeInfoAsync(FullName path) => ValueTask.FromResult<VolumeSizeInfo?>(null);
public override ValueTask<NativePath?> GetSupportedPathPart(NativePath nativePath)
=> ValueTask.FromResult<NativePath?>(nativePath);

View File

@@ -19,12 +19,12 @@ public class ItemPreviewService : IItemPreviewService
.Map(t => t?.CurrentSelectedItem)
.Switch()
.Debounce(TimeSpan.FromMilliseconds(250))
.Map(async (item, _) =>
.Map(async item =>
item == null
? null
: await Map(item)
)
.DistinctUntilChanged();
.DistinctUntilChanged()!;
}
private async Task<IItemPreviewViewModel?> Map(IItemViewModel itemViewModel)

View File

@@ -461,7 +461,7 @@ public class ItemManipulationUserCommandHandlerService : UserCommandHandlerServi
var deleteCommand = _serviceProvider.GetRequiredService<FileTime.Core.Command.Delete.DeleteCommand>();
deleteCommand.HardDelete = command.IsHardDelete;
deleteCommand.ItemsToDelete.AddRange(itemsToDelete!);
deleteCommand.ItemsToDelete.AddRange(itemsToDelete);
await AddCommandAsync(deleteCommand);
_selectedTab?.ClearMarkedItems();

View File

@@ -53,7 +53,7 @@ public abstract partial class ItemViewModel : IItemViewModel
var displayName = itemViewModelType switch
{
ItemViewModelType.Main => _appState.RapidTravelTextDebounced.Map(async (s, _) =>
ItemViewModelType.Main => _appState.RapidTravelTextDebounced.Map(async s =>
_appState.ViewMode.Value != Models.Enums.ViewMode.RapidTravel
&& _appState.SelectedTab.Value?.CurrentLocation.Value?.Provider is IItemNameConverterProvider nameConverterProvider
? (IReadOnlyList<ItemNamePart>) await nameConverterProvider.GetItemNamePartsAsync(item)

View File

@@ -70,13 +70,13 @@ public partial class TabViewModel : ITabViewModel
CurrentItems =
tab.CurrentItems
.Map((items, _) =>
.Map(items =>
Task.FromResult<ObservableCollection<IItemViewModel>?>(
items?.Selecting<IItem, IItemViewModel>(
i => MapItemToViewModel(i, ItemViewModelType.Main)
)
)
);
)!;
using var _ = Defer(
() => CurrentItems.Subscribe(c => UpdateConsumer(c, ref _currentItemsConsumer))
@@ -144,9 +144,9 @@ public partial class TabViewModel : ITabViewModel
SelectedsChildren.Subscribe(c => UpdateConsumer(c, ref _selectedsChildrenConsumer))
);
ParentsChildren = CurrentLocation.Map(async (item, _) =>
ParentsChildren = CurrentLocation.Map(async item =>
{
if (item is null || item.Parent is null) return (ObservableCollection<IItemViewModel>?) null;
if (item?.Parent is null) return (ObservableCollection<IItemViewModel>?) null;
var parent = (IContainer) await item.Parent.ResolveAsync();
var items = parent.Items
@@ -156,7 +156,7 @@ public partial class TabViewModel : ITabViewModel
.Selecting(i => MapItemToViewModel(i, ItemViewModelType.Parent));
return items;
});
})!;
using var ___ = Defer(() =>
ParentsChildren.Subscribe(c => UpdateConsumer(c, ref _parentsChildrenConsumer))
);

View File

@@ -79,7 +79,7 @@ public class SearchContentProvider : ContentProviderBase, ISearchContentProvider
=> Task.FromResult(null as byte[]);
public override Task<bool> CanHandlePathAsync(NativePath path) => Task.FromResult(path.Path.StartsWith(ContentProviderName));
public override VolumeSizeInfo? GetVolumeSizeInfo(FullName path) => null;
public override ValueTask<VolumeSizeInfo?> GetVolumeSizeInfoAsync(FullName path) => ValueTask.FromResult<VolumeSizeInfo?>(null);
public override ValueTask<NativePath?> GetSupportedPathPart(NativePath nativePath) => throw new NotImplementedException();
public async Task<ISearchTask> StartSearchAsync(ISearchMatcher matcher, IContainer searchIn)