Skip to content

Commit 2cdb4bd

Browse files
authored
ui: remove bip21q balance format
1 parent f8bc2ac commit 2cdb4bd

File tree

3 files changed

+34
-9
lines changed

3 files changed

+34
-9
lines changed

BDKSwiftExampleWallet/Model/BalanceDisplayFormat.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ enum BalanceDisplayFormat: String, CaseIterable, Codable {
1111
case bitcoinSats = "bitcoinSats"
1212
case bitcoin = "btc"
1313
case sats = "sats"
14-
case bip21q = "bip21q"
14+
// case bip21q = "bip21q"
1515
case fiat = "usd"
1616
case bip177 = "bip177"
1717

1818
var displayText: String {
1919
switch self {
2020
case .sats, .bitcoinSats: return "sats"
2121
case .bitcoin, .bip177: return ""
22-
case .bip21q: return ""
22+
// case .bip21q: return "₿"
2323
case .fiat: return "USD"
2424
}
2525
}

BDKSwiftExampleWallet/Resources/Localizable.xcstrings

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@
266266
}
267267
},
268268
"%llu sats" : {
269-
"extractionState" : "stale",
270269
"localizations" : {
271270
"fr" : {
272271
"stringUnit" : {

BDKSwiftExampleWallet/View/Home/BalanceView.swift

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct BalanceView: View {
3030
removal: .move(edge: .trailing).combined(with: .opacity)
3131
)
3232
)
33-
.opacity(format == .sats || format == .bip21q ? 0 : 1)
33+
.opacity(format == .sats ? 0 : 1)
3434
.id("symbol-\(format)")
3535
.animation(.spring(response: 0.3, dampingFraction: 0.7), value: format)
3636
}
@@ -44,8 +44,6 @@ struct BalanceView: View {
4444
return String(format: "%.8f", Double(balance) / 100_000_000)
4545
case .bitcoinSats:
4646
return balance.formattedSatoshis()
47-
case .bip21q:
48-
return balance.formatted(.number)
4947
case .fiat:
5048
return satsPrice.formatted(.number.precision(.fractionLength(2)))
5149
case .bip177:
@@ -102,7 +100,7 @@ struct BalanceView: View {
102100
private func buildBalance() -> some View {
103101
VStack(spacing: 10) {
104102
HStack(spacing: 15) {
105-
if format != .sats && format != .bip21q {
103+
if format != .sats {
106104
currencySymbol
107105
}
108106
balanceText
@@ -120,9 +118,37 @@ struct BalanceView: View {
120118
}
121119

122120
#if DEBUG
123-
#Preview {
121+
#Preview("bip177") {
122+
BalanceView(
123+
format: .bip177,
124+
balance: 5000,
125+
fiatPrice: 89000
126+
)
127+
}
128+
#Preview("bitcoin") {
129+
BalanceView(
130+
format: .bitcoin,
131+
balance: 5000,
132+
fiatPrice: 89000
133+
)
134+
}
135+
#Preview("sats") {
136+
BalanceView(
137+
format: .sats,
138+
balance: 5000,
139+
fiatPrice: 89000
140+
)
141+
}
142+
#Preview("bitcoinSats") {
143+
BalanceView(
144+
format: .bitcoinSats,
145+
balance: 5000,
146+
fiatPrice: 89000
147+
)
148+
}
149+
#Preview("fiat") {
124150
BalanceView(
125-
format: .bip21q,
151+
format: .fiat,
126152
balance: 5000,
127153
fiatPrice: 89000
128154
)

0 commit comments

Comments
 (0)