Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PWN-9234] Remove 'Hide zero balances' switch #1516

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ struct CryptoSolanaAccountsAggregator: DataAggregator {
input: (
accounts: [SolanaAccount],
favourites: [String],
ignores: [String],
hideZeroBalance: Bool
ignores: [String]
)
) -> [RenderableSolanaAccount] {
let (accounts, favourites, ignores, hideZeroBalance) = input
let (accounts, favourites, ignores) = input

return accounts
.filter { !$0.isNFTToken && !$0.isUSDC }
Expand All @@ -27,7 +26,7 @@ struct CryptoSolanaAccountsAggregator: DataAggregator {
tags.insert(.favourite)
} else if ignores.contains(account.address) {
tags.insert(.ignore)
} else if hideZeroBalance, account.lamports == 0 {
} else if account.lamports == 0 {
tags.insert(.ignore)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import Wormhole
/// ViewModel of `CryptoAccounts` scene
final class CryptoAccountsViewModel: BaseViewModel, ObservableObject {

private var defaultsDisposables: [DefaultsDisposable] = []

// MARK: - Dependencies

private let analyticsManager: AnalyticsManager
Expand All @@ -27,7 +25,6 @@ final class CryptoAccountsViewModel: BaseViewModel, ObservableObject {
// MARK: - Properties

@Published private(set) var scrollOnTheTop = true
@Published private(set) var hideZeroBalance: Bool = Defaults.hideZeroBalances

/// Accounts for claiming transfers.
@Published var transferAccounts: [any RenderableAccount] = []
Expand Down Expand Up @@ -57,10 +54,6 @@ final class CryptoAccountsViewModel: BaseViewModel, ObservableObject {

super.init()

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

self.bindAccounts()
}

Expand All @@ -83,14 +76,13 @@ final class CryptoAccountsViewModel: BaseViewModel, ObservableObject {
// Solana accounts
let solanaAggregator = CryptoSolanaAccountsAggregator()
let solanaAccountsPublisher = Publishers
.CombineLatest4(
.CombineLatest3(
solanaAccountsService.statePublisher,
favouriteAccountsStore.$favourites,
favouriteAccountsStore.$ignores,
$hideZeroBalance
favouriteAccountsStore.$ignores
)
.map { state, favourites, ignores, hideZeroBalance in
solanaAggregator.transform(input: (state.value, favourites, ignores, hideZeroBalance))
.map { state, favourites, ignores in
solanaAggregator.transform(input: (state.value, favourites, ignores))
}

let cryptoAccountsAggregator = CryptoAccountsAggregator()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ struct SettingsView: View {
Group {
profileSection
securitySection
appearanceSection
communitySection
appVersionSection
#if !RELEASE
Expand Down Expand Up @@ -133,16 +132,6 @@ struct SettingsView: View {
}
}

private var appearanceSection: some View {
Section(header: headerText(L10n.appearance)) {
cellView(image: .hideZeroBalance, title: L10n.hideZeroBalances) {
Toggle("", isOn: $viewModel.zeroBalancesIsHidden)
.toggleStyle(SwitchToggleStyle(tint: Color(Asset.Colors.night.color)))
.labelsHidden()
}
}
}

private var communitySection: some View {
Section(header: headerText("community")) {
Button(
Expand Down
Loading