-
Notifications
You must be signed in to change notification settings - Fork 1
refactor: custom numberpad #370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
8209f6d to
28a4aea
Compare
app/src/main/java/to/bitkit/ui/screens/wallets/receive/ReceiveAmountScreen.kt
Fixed
Show fixed
Hide fixed
28a4aea to
83b533b
Compare
83b533b to
5bfc25a
Compare
5bfc25a to
3bec3ff
Compare
# Conflicts: # app/src/main/java/to/bitkit/ui/screens/wallets/send/SendAmountScreen.kt # app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nice!
| fun getCurrentRate(currency: String): FxRate { | ||
| val rates = _currencyState.value.rates | ||
| val rate = rates.firstOrNull { it.quote == currency } | ||
|
|
||
| fun getCurrentRate(currency: String): FxRate? { | ||
| return _currencyState.value.rates.firstOrNull { it.quote == currency } | ||
| return checkNotNull(rate) { | ||
| "Rate not found for currency: $currency in: ${rates.joinToString { it.quote }}" | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This could cause a crash if not inside a method with exception handling, but I saw that it is handled in all called places
- Could also be private, but I see it has been used in tests
So, it is OK for me to keep like this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could cause a crash if not inside a method with exception handling, but I saw that it is handled in all called places
TY 👍🏻
Would make sense to make it private or expose only for testing; then it should be ok for it to throw.
jvsena42
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice refactor!
Tested the same flows + starting the app offline to check for crashes in a Mi A2
optional for future: could add a long press action to the NumberPadDeleteButton button
Closes: #309
Closes: #310
This PR refactors the custom numeric keyboard and its associated view for amount display.
Description
Keyboardcomponent with newNumberPadwritten from scratchNext steps:
AmountInputusages with the newNumberPad(ie. replace OS keyboard with custom one)NumberPadSimpleused to for pin input withNumberPad(type = NumberPadType.SIMPLE)Preview
modernSend.mp4
classicTransfer.mp4
QA Notes
AmountInputViewModelTestTests
0.00✓0., tap delete twice → entire input value deleted ✓.→ input value =0.✓0., tap delete twice → expect entire value deleted.→ expect0.as valueregression: numpad in each flow:SendAmountScreen: send > amountReceiveAmountScreen: on wallet wo. LN >receive > tap receive on LN switchEditInvoiceScreen: receive > editSpendingAmountScreen: transfer to spendingregression: edit invoice:regression: pin input::