-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11644 from ichthus1604/UI-Decoupling50
[VDG] UI Decoupling #50
- Loading branch information
Showing
27 changed files
with
726 additions
and
671 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System.Collections.Generic; | ||
using System.Reactive; | ||
using System.Reactive.Disposables; | ||
using System.Reactive.Linq; | ||
using DynamicData; | ||
#pragma warning disable CA2000 | ||
|
||
namespace WalletWasabi.Fluent.Helpers; | ||
|
||
public class SignaledFetcher<TObject, TKey> : IDisposable where TKey : notnull | ||
{ | ||
private readonly CompositeDisposable _disposable = new(); | ||
|
||
public SignaledFetcher(IObservable<Unit> retrieveSignal, Func<TObject, TKey> keySelector, Func<IEnumerable<TObject>> retrieve) | ||
{ | ||
var sourceCache = new SourceCache<TObject, TKey>(keySelector) | ||
.DisposeWith(_disposable); | ||
|
||
retrieveSignal | ||
.Select(_ => retrieve()).Do(items => sourceCache.Edit(updater => updater.Load(items))) | ||
.Subscribe() | ||
.DisposeWith(_disposable); | ||
|
||
Changes = sourceCache.Connect(); | ||
} | ||
|
||
public IObservable<IChangeSet<TObject, TKey>> Changes { get; } | ||
|
||
public void Dispose() => _disposable.Dispose(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
using NBitcoin; | ||
using ReactiveUI; | ||
using System.Collections.Generic; | ||
using WalletWasabi.Blockchain.Analysis.Clustering; | ||
using WalletWasabi.Blockchain.TransactionBuilding; | ||
using WalletWasabi.Blockchain.Transactions; | ||
using WalletWasabi.Wallets; | ||
|
||
namespace WalletWasabi.Fluent.Models.Wallets; | ||
|
||
public enum TransactionType | ||
{ | ||
Unknown, | ||
IncomingTransaction, | ||
OutgoingTransaction, | ||
SelfTransferTransaction, | ||
Coinjoin, | ||
CoinjoinGroup, | ||
Cancellation, | ||
CPFP | ||
} | ||
|
||
public enum TransactionStatus | ||
{ | ||
Unknown, | ||
Confirmed, | ||
Pending, | ||
SpeedUp, | ||
} | ||
|
||
public partial class TransactionModel : ReactiveObject | ||
{ | ||
private readonly List<TransactionModel> _children = new(); | ||
|
||
public int OrderIndex { get; init; } | ||
|
||
public uint256 Id { get; init; } | ||
|
||
public LabelsArray Labels { get; init; } | ||
|
||
public DateTimeOffset Date { get; set; } | ||
|
||
public string DateString { get; set; } | ||
|
||
public int Confirmations { get; init; } | ||
|
||
public string ConfirmedTooltip { get; set; } | ||
|
||
public TransactionType Type { get; init; } | ||
|
||
public TransactionStatus Status { get; set; } | ||
|
||
public TransactionSummary TransactionSummary { get; init; } | ||
|
||
public bool IsChild { get; set; } | ||
|
||
public Money? Balance { get; set; } | ||
|
||
public Money? IncomingAmount { get; set; } | ||
|
||
public Money? OutgoingAmount { get; set; } | ||
|
||
public Money? Fee { get; init; } | ||
|
||
public Money Amount => Math.Abs(IncomingAmount ?? OutgoingAmount ?? Money.Zero); | ||
|
||
public bool CanCancelTransaction { get; init; } | ||
|
||
public bool CanSpeedUpTransaction { get; init; } | ||
|
||
public IReadOnlyList<TransactionModel> Children => _children; | ||
|
||
public bool IsConfirmed => Status == TransactionStatus.Confirmed; | ||
|
||
public bool IsCoinjoin => Type is TransactionType.Coinjoin or TransactionType.CoinjoinGroup; | ||
|
||
public bool IsCoinjoinGroup => Type == TransactionType.CoinjoinGroup; | ||
|
||
public bool IsCancellation => Type == TransactionType.Cancellation; | ||
|
||
public void Add(TransactionModel child) | ||
{ | ||
_children.Add(child); | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return $"{Type} {Status} {DateString} {Amount} {Balance}"; | ||
} | ||
} |
Oops, something went wrong.