Skip to content

Commit b3226b3

Browse files
committed
feat. trigger amount send event
1 parent 048a7dc commit b3226b3

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

app/src/main/java/to/bitkit/ui/screens/wallets/send/SendAmountScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ fun SendAmountScreen(
7474
}
7575
}
7676

77-
LaunchedEffect(Unit) {
77+
LaunchedEffect(input) {
7878
val sats: String = when(currencyUiState.primaryDisplay) {
7979
PrimaryDisplay.BITCOIN -> {
8080
if (currencyUiState.displayUnit == BitcoinDisplayUnit.MODERN) input else (input.toLongOrDefault(0L) * 100_000_000).toString()

app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ class AppViewModel @Inject constructor(
235235

236236
SendEvent.SpeedAndFee -> toast(Exception("Coming soon: Speed and Fee"))
237237
SendEvent.SwipeToPay -> onPay()
238-
SendEvent.BackSpaceClick -> onClickBackspace()
239238
}
240239
}
241240
}
@@ -277,21 +276,10 @@ class AppViewModel @Inject constructor(
277276
}
278277

279278
private fun onAmountChange(value: String) {
280-
val newInput = if (_sendUiState.value.amountInput == "0") value else _sendUiState.value.amountInput + value
281279
_sendUiState.update {
282280
it.copy(
283-
amountInput = newInput,
284-
isAmountInputValid = validateAmount(newInput)
285-
)
286-
}
287-
}
288-
289-
private fun onClickBackspace() {
290-
val newInput = if (_sendUiState.value.amountInput.length <= 1) "0" else _sendUiState.value.amountInput.dropLast(1)
291-
_sendUiState.update {
292-
it.copy(
293-
amountInput = newInput,
294-
isAmountInputValid = validateAmount(newInput)
281+
amountInput = value,
282+
isAmountInputValid = validateAmount(value)
295283
)
296284
}
297285
}
@@ -786,7 +774,6 @@ sealed class SendEvent {
786774
data object AmountReset : SendEvent()
787775
data class AmountContinue(val amount: String) : SendEvent()
788776
data class AmountChange(val value: String) : SendEvent()
789-
data object BackSpaceClick : SendEvent()
790777

791778
data object SwipeToPay : SendEvent()
792779
data object SpeedAndFee : SendEvent()

0 commit comments

Comments
 (0)