Conversation
PR SummaryAdded support for ERC-1155 NFT transfers with amount selection functionality. Implemented amount controls in NFT detail and send confirmation screens, allowing users to specify transfer quantities for ERC-1155 tokens. Updated NFT models and UI components to handle and display token amounts. Changes
autogenerated by presubmit.ai |
There was a problem hiding this comment.
🚨 Pull request needs attention.
Review Summary
Commits Considered (1)
- 9e2dc0b: feat: add erc-1155 nft transfer amount
Files Processed (14)
- app/src/main/java/com/flowfoundation/wallet/manager/config/NftCollectionConfig.kt (3 hunks)
- app/src/main/java/com/flowfoundation/wallet/network/model/NFTContractType.kt (1 hunk)
- app/src/main/java/com/flowfoundation/wallet/network/model/NFTListResponse.kt (2 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/nft/nftdetail/presenter/NftDetailPresenter.kt (1 hunk)
- app/src/main/java/com/flowfoundation/wallet/page/nft/nftlist/presenter/NFTListItemPresenter.kt (1 hunk)
- app/src/main/java/com/flowfoundation/wallet/page/send/nft/confirm/NftSendConfirmViewModel.kt (4 hunks)
- app/src/main/java/com/flowfoundation/wallet/page/send/nft/confirm/presenter/NftSendConfirmPresenter.kt (5 hunks)
- app/src/main/res/drawable/ic_amount_minus.xml (1 hunk)
- app/src/main/res/drawable/ic_amount_plus.xml (1 hunk)
- app/src/main/res/layout/activity_nft_detail.xml (3 hunks)
- app/src/main/res/layout/dialog_send_confirm.xml (1 hunk)
- app/src/main/res/layout/item_nft_list.xml (1 hunk)
- app/src/main/res/values/strings.xml (1 hunk)
- gradle.properties (1 hunk)
Actionable Comments (2)
-
app/src/main/java/com/flowfoundation/wallet/page/send/nft/confirm/NftSendConfirmViewModel.kt [54-54]
possible bug: "Potential integer overflow when parsing amount"
-
app/src/main/java/com/flowfoundation/wallet/page/send/nft/confirm/presenter/NftSendConfirmPresenter.kt [83-83]
possible bug: "Potential crash when parsing empty amount input"
Skipped Comments (1)
-
app/src/main/java/com/flowfoundation/wallet/network/model/NFTContractType.kt [10-16]
enhancement: "Improve enum handling with default value"
| this.sendModel = nft | ||
| fun bindSendModel(model: NftSendModel) { | ||
| this.sendModel = model | ||
| maxAmount = model.nft.amount?.toInt()?: 1 |
There was a problem hiding this comment.
The toInt() call on the nullable string amount could throw a NumberFormatException or cause integer overflow for large values. Consider adding proper error handling and validation of the input string value.
| override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {} | ||
| override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {} | ||
| override fun afterTextChanged(s: Editable?) { | ||
| val inputAmount = s.toString().toIntOrNull() ?: 0 |
There was a problem hiding this comment.
The toIntOrNull() call could return null for empty or invalid input, which would then be used as 0. This could lead to invalid state. Consider adding input validation and proper error handling for invalid amount values.
Related Issue
Closes #1241
Summary of Changes
Need Regression Testing
Risk Assessment
Additional Notes
Screenshots (if applicable)