Skip to content

Commit

Permalink
make sure coins are updated when selecting a wallet (WalletWasabi#13222)
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandUI authored Jul 5, 2024
1 parent f51b34f commit f1f7ad8
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions WalletWasabi.Fluent/Models/Wallets/CoinListModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ public CoinListModel(Wallet wallet, IWalletModel walletModel)
var transactionProcessed = walletModel.Transactions.TransactionProcessed;
var anonScoreTargetChanged = this.WhenAnyValue(x => x.WalletModel.Settings.AnonScoreTarget).Skip(1).ToSignal();
var isCoinjoinRunningChanged = walletModel.Coinjoin.IsRunning.ToSignal();
var isSelected = this.WhenAnyValue(x => x.WalletModel.IsSelected).Skip(1).ToSignal();

var signals =
transactionProcessed
.Merge(anonScoreTargetChanged)
.Merge(isCoinjoinRunningChanged)
.Merge(isSelected)
.Publish();

Pockets = signals.Fetch(GetPockets, x => x.Labels).DisposeWith(_disposables);
Expand Down
1 change: 1 addition & 0 deletions WalletWasabi.Fluent/Models/Wallets/WalletModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public partial class WalletModel : ReactiveObject

[AutoNotify] private bool _isLoggedIn;
[AutoNotify] private bool _isLoaded;
[AutoNotify] private bool _isSelected;

public WalletModel(Wallet wallet, IAmountProvider amountProvider)
{
Expand Down
4 changes: 4 additions & 0 deletions WalletWasabi.Fluent/ViewModels/Wallets/WalletPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ private WalletPageViewModel(IWalletModel walletModel)
.BindTo(this, x => x.Title)
.DisposeWith(_disposables);

this.WhenAnyValue(x => x.IsSelected)
.Do(value => WalletModel.IsSelected = value)
.Subscribe();

SetIcon();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public string Name

public bool IsLoaded { get; set; }

public bool IsSelected { get; set; }

public IAddress GetNextReceiveAddress(IEnumerable<string> destinationLabels)
{
throw new NotSupportedException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ public string Name

public bool IsLoaded { get; set; }

public bool IsSelected { get; set; }

public IAddress GetNextReceiveAddress(IEnumerable<string> destinationLabels)
{
throw new NotSupportedException();
Expand Down

0 comments on commit f1f7ad8

Please sign in to comment.