diff --git a/BDKSwiftExampleWallet/Model/BalanceDisplayFormat.swift b/BDKSwiftExampleWallet/Model/BalanceDisplayFormat.swift index 24eef3fb..1e7aa069 100644 --- a/BDKSwiftExampleWallet/Model/BalanceDisplayFormat.swift +++ b/BDKSwiftExampleWallet/Model/BalanceDisplayFormat.swift @@ -11,7 +11,7 @@ enum BalanceDisplayFormat: String, CaseIterable, Codable { case bitcoinSats = "bitcoinSats" case bitcoin = "btc" case sats = "sats" - case bip21q = "bip21q" + // case bip21q = "bip21q" case fiat = "usd" case bip177 = "bip177" @@ -19,7 +19,7 @@ enum BalanceDisplayFormat: String, CaseIterable, Codable { switch self { case .sats, .bitcoinSats: return "sats" case .bitcoin, .bip177: return "" - case .bip21q: return "₿" + // case .bip21q: return "₿" case .fiat: return "USD" } } diff --git a/BDKSwiftExampleWallet/Resources/Localizable.xcstrings b/BDKSwiftExampleWallet/Resources/Localizable.xcstrings index c6dfee6d..8729efd7 100644 --- a/BDKSwiftExampleWallet/Resources/Localizable.xcstrings +++ b/BDKSwiftExampleWallet/Resources/Localizable.xcstrings @@ -266,7 +266,6 @@ } }, "%llu sats" : { - "extractionState" : "stale", "localizations" : { "fr" : { "stringUnit" : { diff --git a/BDKSwiftExampleWallet/View/Home/BalanceView.swift b/BDKSwiftExampleWallet/View/Home/BalanceView.swift index 31374e65..4482872f 100644 --- a/BDKSwiftExampleWallet/View/Home/BalanceView.swift +++ b/BDKSwiftExampleWallet/View/Home/BalanceView.swift @@ -30,7 +30,7 @@ struct BalanceView: View { removal: .move(edge: .trailing).combined(with: .opacity) ) ) - .opacity(format == .sats || format == .bip21q ? 0 : 1) + .opacity(format == .sats ? 0 : 1) .id("symbol-\(format)") .animation(.spring(response: 0.3, dampingFraction: 0.7), value: format) } @@ -44,8 +44,6 @@ struct BalanceView: View { return String(format: "%.8f", Double(balance) / 100_000_000) case .bitcoinSats: return balance.formattedSatoshis() - case .bip21q: - return balance.formatted(.number) case .fiat: return satsPrice.formatted(.number.precision(.fractionLength(2))) case .bip177: @@ -102,7 +100,7 @@ struct BalanceView: View { private func buildBalance() -> some View { VStack(spacing: 10) { HStack(spacing: 15) { - if format != .sats && format != .bip21q { + if format != .sats { currencySymbol } balanceText @@ -120,9 +118,37 @@ struct BalanceView: View { } #if DEBUG - #Preview { + #Preview("bip177") { + BalanceView( + format: .bip177, + balance: 5000, + fiatPrice: 89000 + ) + } + #Preview("bitcoin") { + BalanceView( + format: .bitcoin, + balance: 5000, + fiatPrice: 89000 + ) + } + #Preview("sats") { + BalanceView( + format: .sats, + balance: 5000, + fiatPrice: 89000 + ) + } + #Preview("bitcoinSats") { + BalanceView( + format: .bitcoinSats, + balance: 5000, + fiatPrice: 89000 + ) + } + #Preview("fiat") { BalanceView( - format: .bip21q, + format: .fiat, balance: 5000, fiatPrice: 89000 )