Restore code before master merge
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryItems/HistoryItemViewModelBase.cs
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryItems/HistoryItemViewModelBase.cs
@@ -55,4 +55,50 @@ public abstract partial class HistoryItemViewModelBase : ViewModelBase
}
public bool IsSimilar(HistoryItemViewModelBase item) => Id == item.Id;
+
+ public static Comparison<HistoryItemViewModelBase?> SortAscending<T>(Func<HistoryItemViewModelBase, T> selector)
+ {
+ return (x, y) =>
+ {
+ if (x is null && y is null)
+ {
+ return 0;
+ }
+ else if (x is null)
+ {
+ return -1;
+ }
+ else if (y is null)
+ {
+ return 1;
+ }
+ else
+ {
+ return Comparer<T>.Default.Compare(selector(x), selector(y));
+ }
+ };
+ }
+
+ public static Comparison<HistoryItemViewModelBase?> SortDescending<T>(Func<HistoryItemViewModelBase, T> selector)
+ {
+ return (x, y) =>
+ {
+ if (x is null && y is null)
+ {
+ return 0;
+ }
+ else if (x is null)
+ {
+ return 1;
+ }
+ else if (y is null)
+ {
+ return -1;
+ }
+ else
+ {
+ return Comparer<T>.Default.Compare(selector(y), selector(x));
+ }
+ };
+ }
}

Restore code before master merge