Incremental item loading, movement does not respect order
This commit is contained in:
@@ -22,7 +22,6 @@ public interface IContentProvider : IContainer, IOnContainerEnter
|
||||
AbsolutePathType forceResolvePathType = AbsolutePathType.Unknown,
|
||||
ItemInitializationSettings itemInitializationSettings = default);
|
||||
|
||||
Task<List<AbsolutePath>> GetItemsByContainerAsync(FullName fullName, PointInTime pointInTime);
|
||||
NativePath GetNativePath(FullName fullName);
|
||||
|
||||
Task<byte[]?> GetContentAsync(IElement element, int? maxLength = null, CancellationToken cancellationToken = default);
|
||||
|
||||
@@ -78,7 +78,6 @@ public abstract class ContentProviderBase : IContentProvider
|
||||
AbsolutePathType forceResolvePathType = AbsolutePathType.Unknown,
|
||||
ItemInitializationSettings itemInitializationSettings = default);
|
||||
|
||||
public abstract Task<List<AbsolutePath>> GetItemsByContainerAsync(FullName fullName, PointInTime pointInTime);
|
||||
public abstract NativePath GetNativePath(FullName fullName);
|
||||
|
||||
public abstract Task<byte[]?> GetContentAsync(IElement element,
|
||||
|
||||
@@ -26,7 +26,14 @@ public record Container(
|
||||
ReadOnlyExtensionCollection Extensions,
|
||||
IObservable<IObservable<IChangeSet<AbsolutePath, string>>?> Items) : IContainer
|
||||
{
|
||||
BehaviorSubject<bool> IsLoading { get; } = new(false);
|
||||
private readonly CancellationTokenSource _loadingCancellationTokenSource = new();
|
||||
public CancellationToken LoadingCancellationToken => _loadingCancellationTokenSource.Token;
|
||||
public BehaviorSubject<bool> IsLoading { get; } = new(false);
|
||||
IObservable<bool> IContainer.IsLoading => IsLoading.AsObservable();
|
||||
public AbsolutePathType Type => AbsolutePathType.Container;
|
||||
|
||||
public void CancelLoading()
|
||||
{
|
||||
_loadingCancellationTokenSource.Cancel();
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ using System.Reactive.Linq;
|
||||
using System.Reactive.Subjects;
|
||||
using DynamicData;
|
||||
using DynamicData.Alias;
|
||||
using DynamicData.Binding;
|
||||
using FileTime.Core.Helper;
|
||||
using FileTime.Core.Models;
|
||||
using FileTime.Core.Timeline;
|
||||
@@ -52,7 +53,11 @@ public class Tab : ITab
|
||||
.Switch()
|
||||
.Select(items => items?.TransformAsync(MapItem)),
|
||||
_itemFilters.Connect().StartWithEmpty().ToCollection(),
|
||||
(items, filters) => items?.Where(i => filters.All(f => f.Filter(i)))),
|
||||
(items, filters) =>
|
||||
items
|
||||
?.Where(i => filters.All(f => f.Filter(i)))
|
||||
.Sort(SortItems())
|
||||
),
|
||||
CurrentLocation
|
||||
.Where(c => c is null)
|
||||
.Select(_ => (IObservable<IChangeSet<IItem, string>>?)null)
|
||||
@@ -89,6 +94,12 @@ public class Tab : ITab
|
||||
});
|
||||
}
|
||||
|
||||
private static SortExpressionComparer<IItem> SortItems()
|
||||
//TODO: Order
|
||||
=> SortExpressionComparer<IItem>
|
||||
.Ascending(i => i.Type)
|
||||
.ThenByAscending(i => i.DisplayName?.ToLower() ?? "");
|
||||
|
||||
private async Task<IItem> MapItem(AbsolutePath item) => await item.ResolveAsync(true);
|
||||
|
||||
public void Init(IContainer currentLocation)
|
||||
|
||||
Reference in New Issue
Block a user