Keep the "currency to Sats" field visible, make it editable in Manual
Always render the field now (label included) with just its value empty when unknown, rather than hiding the whole field. In Manual source mode it's now a genuine input: typing into it recomputes the "BTC to currency" rate the same way typing into that field recomputes this one. Both edit the same underlying ManualExchangeRateSource.rate via the same self-inverse division (CurrencyConverter.satsPerCurrencyUnit of a rate gives Sats, and of a Sats amount gives a rate back), tracked as a new manualSatsPerCurrencyInput field alongside the existing manualRateInput. Wired through PriceViewModel, the iOS bridge/ConverterViewModel, and both UIs. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FXcrACM5sok3M1KQJ8kByy
This commit is contained in:
@@ -105,13 +105,22 @@ struct ContentView: View {
|
||||
}
|
||||
}
|
||||
|
||||
if !state.oneCurrencyToSats.isEmpty {
|
||||
HStack {
|
||||
Text(IosLocalizationKt.localizedFormattedString(
|
||||
resource: MR.strings.shared.currency_to_sats,
|
||||
args: [state.defaultCurrencyCode]
|
||||
))
|
||||
Spacer()
|
||||
HStack {
|
||||
Text(IosLocalizationKt.localizedFormattedString(
|
||||
resource: MR.strings.shared.currency_to_sats,
|
||||
args: [state.defaultCurrencyCode]
|
||||
))
|
||||
Spacer()
|
||||
if state.isManualSource {
|
||||
NumericField(
|
||||
placeholder: "",
|
||||
value: state.manualSatsPerCurrencyInput,
|
||||
keyboardType: .decimalPad,
|
||||
sanitize: sanitizeDecimalInput,
|
||||
onChange: { viewModel.onManualSatsPerCurrencyChanged($0) },
|
||||
alignment: .trailing
|
||||
)
|
||||
} else if !state.oneCurrencyToSats.isEmpty {
|
||||
Text(NumberFormatKt.groupDigits(value: state.oneCurrencyToSats))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,4 +46,8 @@ final class ConverterViewModel: ObservableObject {
|
||||
func onManualRateChanged(_ value: String) {
|
||||
bridge.onManualRateChanged(value: value)
|
||||
}
|
||||
|
||||
func onManualSatsPerCurrencyChanged(_ value: String) {
|
||||
bridge.onManualSatsPerCurrencyChanged(value: value)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user