Skip to content

Commit

Permalink
Merge pull request #1504 from p2p-org/fix/pwn-9378
Browse files Browse the repository at this point in the history
[PWN-9378] Observe "hide zero balances" toggle
  • Loading branch information
TrGiLong authored Jul 25, 2023
2 parents 6c6606e + 7e22618 commit ab77c9f
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import Wormhole
/// ViewModel of `CryptoAccounts` scene
final class CryptoAccountsViewModel: BaseViewModel, ObservableObject {

private var defaultsDisposables: [DefaultsDisposable] = []

// MARK: - Dependencies

private let solanaAccountsService: SolanaAccountsService
Expand Down Expand Up @@ -52,6 +54,10 @@ final class CryptoAccountsViewModel: BaseViewModel, ObservableObject {

super.init()

defaultsDisposables.append(Defaults.observe(\.hideZeroBalances) { [weak self] change in
self?.hideZeroBalance = change.newValue ?? false
})

self.bindAccounts()
}

Expand Down Expand Up @@ -84,11 +90,11 @@ final class CryptoAccountsViewModel: BaseViewModel, ObservableObject {
solanaAggregator.transform(input: (state.value, favourites, ignores, hideZeroBalance))
}

let homeAccountsAggregator = CryptoAccountsAggregator()
let cryptoAccountsAggregator = CryptoAccountsAggregator()
Publishers
.CombineLatest(solanaAccountsPublisher, ethereumAccountsPublisher)
.map { solanaAccounts, ethereumAccounts in
homeAccountsAggregator.transform(input: (solanaAccounts, ethereumAccounts))
cryptoAccountsAggregator.transform(input: (solanaAccounts, ethereumAccounts))
}
.receive(on: RunLoop.main)
.sink { transfer, primary, secondary in
Expand Down

0 comments on commit ab77c9f

Please sign in to comment.