Add warning when BTC and sats exceed the maximum

This commit is contained in:
2024-09-07 06:05:20 +03:00
parent edb10c48e6
commit 3560b12c24
4 changed files with 22 additions and 1 deletions

View File

@@ -88,6 +88,10 @@ public struct ContentView: View {
#endif
} header: {
Text("Sats")
} footer: {
if satsViewModel.exceedsMaximum {
Text("2100000000000000 sats is the maximum.")
}
}
Section {
@@ -97,6 +101,10 @@ public struct ContentView: View {
#endif
} header: {
Text("BTC")
} footer: {
if satsViewModel.exceedsMaximum {
Text("21000000 BTC is the maximum.")
}
}
Section {

View File

@@ -16,6 +16,12 @@
},
"1 BTC to %@" : {
},
"21000000 BTC is the maximum." : {
},
"2100000000000000 sats is the maximum." : {
},
"BTC" : {

View File

@@ -190,6 +190,13 @@ class SatsViewModel: ObservableObject {
}
#endif
}
var exceedsMaximum: Bool {
if let btc, btc > Decimal(21000000) {
return true
}
return false
}
}
extension Decimal {