diff --git a/RadixWallet/Features/AssetsFeature/AssetsView+Reducer.swift b/RadixWallet/Features/AssetsFeature/AssetsView+Reducer.swift index e98f731d27..5f7ab02c57 100644 --- a/RadixWallet/Features/AssetsFeature/AssetsView+Reducer.swift +++ b/RadixWallet/Features/AssetsFeature/AssetsView+Reducer.swift @@ -476,3 +476,9 @@ extension NonFungibleTokensPerResourceProvider { ) } } + +extension SpecificAddress { + var isOnMainnet: Bool { + networkID == NetworkID.mainnet + } +} diff --git a/RadixWallet/Features/AssetsFeature/AssetsView+View.swift b/RadixWallet/Features/AssetsFeature/AssetsView+View.swift index 1f25c2c9b1..2fd963e0f6 100644 --- a/RadixWallet/Features/AssetsFeature/AssetsView+View.swift +++ b/RadixWallet/Features/AssetsFeature/AssetsView+View.swift @@ -68,6 +68,9 @@ extension AssetsView { } } } + #if !DEBUG + .environment(\.resourceBalanceHideFiatValue, !viewStore.account.address.isOnMainnet) + #endif .buttonStyle(.plain) .scrollContentBackground(.hidden) .listStyle(.insetGrouped) diff --git a/RadixWallet/Features/AssetsFeature/Components/DetailsContainerWithHeaderView.swift b/RadixWallet/Features/AssetsFeature/Components/DetailsContainerWithHeaderView.swift index c237b9dba4..577ef4152d 100644 --- a/RadixWallet/Features/AssetsFeature/Components/DetailsContainerWithHeaderView.swift +++ b/RadixWallet/Features/AssetsFeature/Components/DetailsContainerWithHeaderView.swift @@ -22,6 +22,7 @@ extension DetailsContainerWithHeaderViewState { // MARK: - DetailsContainerWithHeaderView struct DetailsContainerWithHeaderView: View { + @Environment(\.resourceBalanceHideFiatValue) var resourceBalanceHideFiatValue let viewState: DetailsContainerWithHeaderViewState let closeButtonAction: () -> Void @@ -70,7 +71,7 @@ struct DetailsContainerWithHeaderView: V } } - if let currencyWorth = viewState.currencyWorth { + if !resourceBalanceHideFiatValue, let currencyWorth = viewState.currencyWorth { Text(currencyWorth) .textStyle(.body2HighImportance) .foregroundStyle(.app.gray2) diff --git a/RadixWallet/Features/AssetsFeature/Components/HelperViews/ResourceBalance/ResourceBalanceView+Helpers.swift b/RadixWallet/Features/AssetsFeature/Components/HelperViews/ResourceBalance/ResourceBalanceView+Helpers.swift index 9fc163d361..2acfeb941f 100644 --- a/RadixWallet/Features/AssetsFeature/Components/HelperViews/ResourceBalance/ResourceBalanceView+Helpers.swift +++ b/RadixWallet/Features/AssetsFeature/Components/HelperViews/ResourceBalance/ResourceBalanceView+Helpers.swift @@ -73,3 +73,15 @@ extension EnvironmentValues { private struct ResourceBalanceHideDetailsKey: EnvironmentKey { static let defaultValue: Bool = false } + +extension EnvironmentValues { + var resourceBalanceHideFiatValue: Bool { + get { self[ResourceBalanceHideFiatValue.self] } + set { self[ResourceBalanceHideFiatValue.self] = newValue } + } +} + +// MARK: - ResourceBalanceHideFiatValue +private struct ResourceBalanceHideFiatValue: EnvironmentKey { + static let defaultValue: Bool = false +} diff --git a/RadixWallet/Features/AssetsFeature/Components/HelperViews/ResourceBalance/ResourceBalanceView.swift b/RadixWallet/Features/AssetsFeature/Components/HelperViews/ResourceBalance/ResourceBalanceView.swift index 26d35f6e04..3a02d61866 100644 --- a/RadixWallet/Features/AssetsFeature/Components/HelperViews/ResourceBalance/ResourceBalanceView.swift +++ b/RadixWallet/Features/AssetsFeature/Components/HelperViews/ResourceBalance/ResourceBalanceView.swift @@ -451,6 +451,9 @@ extension ResourceBalanceView { .padding(.leading, isSelected != nil ? .small2 : 0) if let isSelected { + if !useSpacer, caption1 == nil { + Spacer(minLength: .small2) + } CheckmarkView(appearance: .dark, isChecked: isSelected) } } @@ -465,7 +468,7 @@ extension ResourceBalanceView { } private var useSpacer: Bool { - amount != nil || fallback != nil || caption1 == nil + amount != nil || fallback != nil } } @@ -527,6 +530,7 @@ extension ResourceBalanceView { } struct AmountView: View { + @Environment(\.resourceBalanceHideFiatValue) var resourceBalanceHideFiatValue let amount: ResourceBalance.Amount? let fallback: String? let compact: Bool @@ -554,7 +558,7 @@ extension ResourceBalanceView { Text(amount.amount.nominalAmount.formatted()) .textStyle(amountTextStyle) .foregroundColor(.app.gray1) - if let fiatWorth = amount.amount.fiatWorth?.currencyFormatted(applyCustomFont: false) { + if !resourceBalanceHideFiatValue, let fiatWorth = amount.amount.fiatWorth?.currencyFormatted(applyCustomFont: false) { Text(fiatWorth) .textStyle(.body2HighImportance) .foregroundStyle(.app.gray2) @@ -575,7 +579,7 @@ extension ResourceBalanceView { .textStyle(.secondaryHeader) .foregroundColor(.app.gray1) - if let fiatWorth = amount.amount.fiatWorth?.currencyFormatted(applyCustomFont: false) { + if !resourceBalanceHideFiatValue, let fiatWorth = amount.amount.fiatWorth?.currencyFormatted(applyCustomFont: false) { Text(fiatWorth) .textStyle(.body2HighImportance) .foregroundStyle(.app.gray2) diff --git a/RadixWallet/Features/AssetsFeature/Components/StakeUnitList/Components/StakeSummaryView.swift b/RadixWallet/Features/AssetsFeature/Components/StakeUnitList/Components/StakeSummaryView.swift index 85fdf6e51d..4419feeeb5 100644 --- a/RadixWallet/Features/AssetsFeature/Components/StakeUnitList/Components/StakeSummaryView.swift +++ b/RadixWallet/Features/AssetsFeature/Components/StakeUnitList/Components/StakeSummaryView.swift @@ -15,6 +15,7 @@ public struct StakeSummaryView: View { } } + @Environment(\.resourceBalanceHideFiatValue) var resourceBalanceHideFiatValue public let viewState: ViewState public let onReadyToClaimTapped: () -> Void @@ -77,7 +78,7 @@ extension StakeSummaryView { Text("\(amount.nominalAmount.formatted()) XRD") .textStyle(.body2HighImportance) .foregroundColor(amountTextColor) - if let fiatWorth = amount.fiatWorth?.currencyFormatted(applyCustomFont: false) { + if !resourceBalanceHideFiatValue, let fiatWorth = amount.fiatWorth?.currencyFormatted(applyCustomFont: false) { Text(fiatWorth) .textStyle(.body2HighImportance) .foregroundStyle(.app.gray2)