Repository navigation
feat(dashspend): support gift card quantities for piggycards - #1483
Conversation
There was a problem hiding this comment.
Actionable comments posted: 8
🧹 Nitpick comments (5)
features/exploredash/src/main/java/org/dash/wallet/features/exploredash/repository/PiggyCardsRepository.kt (1)
248-335: 🏗️ Heavy liftHeavy duplication with the existing
getMerchant(merchantId).This new overload re-implements ~80 lines that already exist in the original
getMerchant(merchantId)at lines 156–246 (brand lookup, disabled-card filtering, immediate/non-immediate split, option/range card handling, fallbackUpdatedMerchantDetails). The only material difference is the priority tree being pruned perDenominationType. Any future fix (e.g., disabled-merchant rules, discount math,quantitymap) now has to be made in two places and will drift.Consider consolidating: extract the brand+gift-card resolution and each card-shape branch (fixed / option / range / empty) into private helpers, and have both public entry points call them with a flag/type. At minimum, have the original
getMerchant(merchantId)delegate to this overload (e.g., tryingFixedthenMinMax) so the empty / disabled / discount logic lives in one spot.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@features/exploredash/src/main/java/org/dash/wallet/features/exploredash/repository/PiggyCardsRepository.kt` around lines 248 - 335, The two getMerchant overloads duplicate brand lookup, disabled-card filtering and card-shape handling; refactor by extracting helpers such as resolveBrandAndGiftCards(merchantId): Pair<Brand, List<GiftCard>> and handlers buildFixedMerchantDetails(...), buildOptionMerchantDetails(...), buildRangeMerchantDetails(... ) that encapsulate the common logic (use symbols giftCardMap, disabledGiftCards, disabledMerchants, SERVICE_FEE, UpdatedMerchantDetails), then have getMerchant(merchantId, type: DenominationType) call those helpers according to DenominationType.Fixed / MinMax and make the original getMerchant(merchantId) delegate to the overload (e.g., try Fixed then MinMax) so all filtering, discount math and enabled/productId logic live in one place.features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/PurchaseGiftCardConfirmDialog.kt (2)
491-507: 💤 Low value
giftCardIdparameter is unused.
showGiftCardDetailsDialogacceptsgiftCardId: Stringbut never reads it (both branches only usetxId). Either drop the parameter from the signature and the call site on Line 405, or pass it on toGiftCardOrderDetailsDialog.newInstance/GiftCardDetailsDialog.newInstanceif the index-aware flow needs it.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/PurchaseGiftCardConfirmDialog.kt` around lines 491 - 507, The function showGiftCardDetailsDialog(txId: Sha256Hash, giftCardId: String) declares giftCardId but never uses it; remove the unused parameter from the signature and update its callers (e.g., the call site noted in the review) to stop passing giftCardId, OR if the dialogs require the giftCardId for index-aware behavior, pass giftCardId into GiftCardOrderDetailsDialog.newInstance(...) and GiftCardDetailsDialog.newInstance(...) and adjust those constructors/factory methods accordingly (update newInstance signatures and any Dialog classes that consume it).
564-571: 💤 Low valueDrop the commented-out alternate Text block.
These eight commented-out lines duplicate what
EnterAmountnow renders. Leaving them in invites drift if the design evolves. Either delete or move to a code review note.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/PurchaseGiftCardConfirmDialog.kt` around lines 564 - 571, Remove the commented-out alternate Text block inside PurchaseGiftCardConfirmDialog (the eight commented lines that render uiState.purchaseValueText) because EnterAmount now provides that UI; delete those commented lines so the file only uses EnterAmount and avoid duplicated/obsolete code, keeping the dialog implementation clean and preventing drift.features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/PurchaseGiftCardFragmentV2.kt (2)
254-280: 💤 Low valueRemove the commented-out total/quantity blocks.
Lines 255-260 and 274-279 each preserve an earlier version of the order-info update logic that's now centralized elsewhere (the
setGiftCardOrderInfocall inonContinueforFlexibleSingle, and the directgiftCardOrderInfo.valuewrites for the multi-card paths). Leaving both copies risks someone re-enabling the dead version during a merge conflict. Drop them and rely on git history if needed.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/PurchaseGiftCardFragmentV2.kt` around lines 254 - 280, Remove the dead/commented blocks that compute total/qty from denominationQuantities and the earlier viewModel updates: in PurchaseGiftCardFragmentV2 (inside the onContinue lambda handling mode), delete the commented sections around lines where denominationQuantities.entries.sumOf { (d, q) -> d * q } and denominationQuantities.values.sum() are preserved so the code relies only on the existing FlexibleSingle path that parses amountText and calls viewModel.setGiftCardOrderInfo(fiat, 1) and the existing multi-card/fixed paths that set giftCardOrderInfo elsewhere; leave setGiftCardOrderInfo, amountText, and giftCardOrderInfo references intact and rely on git history if the old logic is needed.
144-196: ⚡ Quick winHoist the
2500cap into a named constant.
2500appears three times — twice as the gating value (Line 148 and Line 182) and once as the message argument (Line 183). If the cap ever changes, it's easy to miss one of these sites and ship a UI that says "$2,500" while actually accepting a different limit. Centralizing also makes the rule self-documenting.♻️ Proposed refactor
companion object { private val log = LoggerFactory.getLogger(PurchaseGiftCardFragmentV2::class.java) + private const val MAX_MULTIPLE_PURCHASE_USD = 2500.0 } @@ - totalDouble >= min && totalDouble < fiatBalance.toBigDecimal().toDouble() && !isBlockchainReplaying && totalDouble < 2500 && !exceedsInventory + totalDouble >= min && + totalDouble < fiatBalance.toBigDecimal().toDouble() && + !isBlockchainReplaying && + totalDouble < MAX_MULTIPLE_PURCHASE_USD && + !exceedsInventory @@ - } else if (totalDouble > 2500.0) { - getString(R.string.purchase_gift_card_max_multiple_error, Fiat.parseFiat(Constants.USD_CURRENCY, 2500.00.toString()).toFormattedString()) + } else if (totalDouble > MAX_MULTIPLE_PURCHASE_USD) { + getString( + R.string.purchase_gift_card_max_multiple_error, + Fiat.parseFiat(Constants.USD_CURRENCY, MAX_MULTIPLE_PURCHASE_USD.toString()) + .toFormattedString() + )Same comment applies to the duplicate cap inside
PurchaseGiftCardConfirmDialogif/when it lands there.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/PurchaseGiftCardFragmentV2.kt` around lines 144 - 196, Hoist the hard-coded 2500 into a named constant (e.g. GIFT_CARD_PURCHASE_CAP_USD) and replace all literal occurrences in this fragment: the gating check using totalDouble < 2500 (in the flexibleMultiple branch), the error branch totalDouble > 2500.0, and the Fiat.parseFiat call that builds the max message (used as the message argument). Define the constant in a clear scope (a companion object in PurchaseGiftCardFragmentV2 or a shared Constants file) and reference it where the code currently uses 2500/2500.0/2500.00.toString(); also apply the same constant to PurchaseGiftCardConfirmDialog when it’s updated to keep behavior and messaging consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.claude/agents/DEVELOPMENT-PATTERNS.md:
- Around line 1457-1460: Remove the stray trailing comma from the property
declaration in the GiftCardDetailsDialog example: locate the class
GiftCardDetailsDialog and the line that declares override val backgroundStyle =
R.style.PrimaryBackground, and change it to a valid Kotlin property declaration
without the comma so it matches the real implementation (also verify override
val forceExpand = true remains unchanged).
In
`@features/exploredash/src/main/java/org/dash/wallet/features/exploredash/repository/PiggyCardsRepository.kt`:
- Around line 385-401: The option-card branch only sets
thisOrder.first().productId, breaking multi-quantity orders; update the branch
where optionGiftcard != null to assign optionGiftcard.id to every order item
(iterate thisOrder and set orderItem.productId = optionGiftcard.id) so all
entries have the correct productId (symbols: optionGiftcard, thisOrder,
productId, orderItem).
- Around line 519-520: The assigned rate currently calls .toString() on a
nullable exchange rate (exchangeRateMap[data.orderId]?.exchangeRate.toString()
?: "0.0"), which yields the literal "null" and bypasses the ?: fallback; update
the rate expression to only call toString() when the exchangeRate is non-null
(e.g., use a safe-call on exchangeRate like
exchangeRateMap[data.orderId]?.exchangeRate?.toString() ?: "0.0" or use let to
map a non-null exchangeRate to its string), so GiftCardInfo.rate never becomes
the string "null".
- Around line 261-325: Add an explicit is DenominationType.MinMaxMajor -> branch
in the when(type) alongside the existing Fixed and MinMax cases (handle it
similarly to MinMax or with the specific denomination mapping required),
populate giftCardMap and return an UpdatedMerchantDetails with appropriate
denominations, denominationsType, discountPercentage (use SERVICE_FEE like the
other branches), redeemType, enabled check (quantity and disabledMerchants) and
productId; additionally, before the fallback else that currently returns an
empty UpdatedMerchantDetails, add a processLogger.warn (or logger.warn)
indicating the merchant id (it.id) and the missing/ mismatched card shape so
failures are visible; finally run ktlint and adjust formatting to satisfy
repository style.
In
`@features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/GiftCardDetailsDialog.kt`:
- Around line 493-508: The card number ListItem incorrectly uses the PIN copy
handler (onCopyPin), causing the clipboard label and analytics to say "card
pin"; update the call in GiftCardDetailsDialog (the ListItem block that now
calls onCopyPin(giftCard.number!!)) to use a dedicated card-number copy handler
(e.g., onCopyCardNumber or onCopyNumber) and implement/route that handler to
copy the value with the correct label (replace the "card pin" label in the copy
helper with "card number"); apply the same fix to the debug-only order row that
currently reuses onCopyPin so both places use the new/appropriate card-number
copy callback and label.
In
`@features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/PurchaseGiftCardConfirmDialog.kt`:
- Line 401: In PurchaseGiftCardConfirmDialog.kt, avoid the unsafe (!!) when
calling createSendingRequestFromDashUri with
data.first().paymentUrls?.get("DASH.DASH") by null-checking the payment URL
before calling createSendingRequestFromDashUri; e.g. retrieve the url with a
safe call/get, and if it's null show the existing error/user-facing dialog or
return early instead of proceeding, ensuring createSendingRequestFromDashUri is
only invoked with a non-null String.
- Around line 105-115: Rename the companion val currency to USD_CURRENCY and
update NumberFormat initializers (noCentsFormat and currencyFormat) to set
format.currency = USD_CURRENCY (and set minimumFractionDigits using
USD_CURRENCY.defaultFractionDigits where needed) so the formats use USD
regardless of locale; defensively access paymentUrls (replace
data.first().paymentUrls?.get("DASH.DASH")!! with a safe lookup like
data.first().paymentUrls?.get("DASH.DASH") ?: return/handleError to avoid NPE);
remove or use the unused giftCardId parameter in showGiftCardDetailsDialog
(either consume it or delete the parameter) and delete the dead commented-out
Text composable code to clean up the file.
In
`@features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/PurchaseGiftCardFragmentV2.kt`:
- Around line 323-338: In loadMerchant, avoid the two unsafe !! usages by
checking for nulls and early-returning/handling the error: read the providerName
with viewModel.selectedProvider?.name and if null popBackStack/return; after
getting updated from viewModel.updateMerchantDetails(merchant) safely find the
provider with updated.giftCardProviders.find { it.provider == providerName } and
if that result is null popBackStack or show an error and return; only call
viewModel.setIsFixedDenomination(...) when provider is non-null. Use the
existing viewModel methods (selectedProvider, updateMerchantDetails,
setGiftCardMerchant, setIsFixedDenomination) and updated.giftCardProviders to
locate the checks.
---
Nitpick comments:
In
`@features/exploredash/src/main/java/org/dash/wallet/features/exploredash/repository/PiggyCardsRepository.kt`:
- Around line 248-335: The two getMerchant overloads duplicate brand lookup,
disabled-card filtering and card-shape handling; refactor by extracting helpers
such as resolveBrandAndGiftCards(merchantId): Pair<Brand, List<GiftCard>> and
handlers buildFixedMerchantDetails(...), buildOptionMerchantDetails(...),
buildRangeMerchantDetails(... ) that encapsulate the common logic (use symbols
giftCardMap, disabledGiftCards, disabledMerchants, SERVICE_FEE,
UpdatedMerchantDetails), then have getMerchant(merchantId, type:
DenominationType) call those helpers according to DenominationType.Fixed /
MinMax and make the original getMerchant(merchantId) delegate to the overload
(e.g., try Fixed then MinMax) so all filtering, discount math and
enabled/productId logic live in one place.
In
`@features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/PurchaseGiftCardConfirmDialog.kt`:
- Around line 491-507: The function showGiftCardDetailsDialog(txId: Sha256Hash,
giftCardId: String) declares giftCardId but never uses it; remove the unused
parameter from the signature and update its callers (e.g., the call site noted
in the review) to stop passing giftCardId, OR if the dialogs require the
giftCardId for index-aware behavior, pass giftCardId into
GiftCardOrderDetailsDialog.newInstance(...) and
GiftCardDetailsDialog.newInstance(...) and adjust those constructors/factory
methods accordingly (update newInstance signatures and any Dialog classes that
consume it).
- Around line 564-571: Remove the commented-out alternate Text block inside
PurchaseGiftCardConfirmDialog (the eight commented lines that render
uiState.purchaseValueText) because EnterAmount now provides that UI; delete
those commented lines so the file only uses EnterAmount and avoid
duplicated/obsolete code, keeping the dialog implementation clean and preventing
drift.
In
`@features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/PurchaseGiftCardFragmentV2.kt`:
- Around line 254-280: Remove the dead/commented blocks that compute total/qty
from denominationQuantities and the earlier viewModel updates: in
PurchaseGiftCardFragmentV2 (inside the onContinue lambda handling mode), delete
the commented sections around lines where denominationQuantities.entries.sumOf {
(d, q) -> d * q } and denominationQuantities.values.sum() are preserved so the
code relies only on the existing FlexibleSingle path that parses amountText and
calls viewModel.setGiftCardOrderInfo(fiat, 1) and the existing multi-card/fixed
paths that set giftCardOrderInfo elsewhere; leave setGiftCardOrderInfo,
amountText, and giftCardOrderInfo references intact and rely on git history if
the old logic is needed.
- Around line 144-196: Hoist the hard-coded 2500 into a named constant (e.g.
GIFT_CARD_PURCHASE_CAP_USD) and replace all literal occurrences in this
fragment: the gating check using totalDouble < 2500 (in the flexibleMultiple
branch), the error branch totalDouble > 2500.0, and the Fiat.parseFiat call that
builds the max message (used as the message argument). Define the constant in a
clear scope (a companion object in PurchaseGiftCardFragmentV2 or a shared
Constants file) and reference it where the code currently uses
2500/2500.0/2500.00.toString(); also apply the same constant to
PurchaseGiftCardConfirmDialog when it’s updated to keep behavior and messaging
consistent.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: d4a7b6d4-3a2a-4240-bf2c-cccb9857206c
📒 Files selected for processing (14)
.claude/agents/DEVELOPMENT-PATTERNS.md.claude/agents/figma-to-compose.mdcommon/src/main/java/org/dash/wallet/common/ui/components/EnterAmount.ktcommon/src/main/res/drawable/ic_chevron_down_small.xmlfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ExploreSyncWorker.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/repository/PiggyCardsRepository.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/DashSpendViewModel.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/PurchaseGiftCardFragmentV2.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/PurchaseGiftCardScreenV2.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/GiftCardDetailsDialog.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/GiftCardDetailsViewModel.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/PurchaseGiftCardConfirmDialog.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/utils/PiggyCardsTestMerchantData.ktfeatures/exploredash/src/main/res/values/strings-explore-dash.xml
✅ Files skipped from review due to trivial changes (3)
- common/src/main/res/drawable/ic_chevron_down_small.xml
- features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ExploreSyncWorker.kt
- features/exploredash/src/main/res/values/strings-explore-dash.xml
🚧 Files skipped from review as they are similar to previous changes (4)
- features/exploredash/src/main/java/org/dash/wallet/features/exploredash/utils/PiggyCardsTestMerchantData.kt
- features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/DashSpendViewModel.kt
- features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/PurchaseGiftCardScreenV2.kt
- features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/GiftCardDetailsViewModel.kt
There was a problem hiding this comment.
Actionable comments posted: 7
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/PurchaseGiftCardConfirmDialog.kt (1)
381-408:⚠️ Potential issue | 🟠 Major | ⚡ Quick winHandle empty purchase responses before calling
first().
purchaseGiftCard()now returns a list, but this path assumes at least one element. If a provider ever returns200 OKwith an empty array, the dialog crashes ondata.first()instead of showing the existing purchase failure UX.Suggested fix
val totalAmount = Coin.valueOf( data.sumOf { if (!it.cryptoAmount.isNullOrEmpty()) { Coin.parseCoin(it.cryptoAmount).value } else { 0L } } ) + val firstCard = data.firstOrNull() + if (firstCard == null) { + hideLoading() + log.error("purchaseGiftCard: empty gift card response") + if (isAdded) { + AdaptiveDialog.create( + R.drawable.ic_error, + getString(R.string.gift_card_purchase_failed), + getString(R.string.gift_card_error), + getString(R.string.button_close) + ).show(requireActivity()) + } + return@launch + } if (!totalAmount.isZero && viewModel.needsCrowdNodeWarning(totalAmount)) { if (!isAdded) { hideLoading() return@launch @@ - val transactionId = createSendingRequestFromDashUri(data.first().paymentUrls?.get("DASH.DASH")!!) + val transactionId = createSendingRequestFromDashUri(firstCard.paymentUrls?.get("DASH.DASH")!!) transactionId?.let { enterAmountViewModel.clearSavedState() viewModel.saveGiftCardDummy(transactionId, data) - showGiftCardDetailsDialog(transactionId, data.first().id) + showGiftCardDetailsDialog(transactionId, firstCard.id) }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/PurchaseGiftCardConfirmDialog.kt` around lines 381 - 408, Before calling data.first() check for an empty list and bail out to the existing purchase-failure flow: if data.isEmpty() then hideLoading(), invoke the same purchase failure UI/handler used elsewhere in this class (the existing "purchase failure" UX or method) and return@launch; do this before the crowd-node warning and before calling createSendingRequestFromDashUri so you never call data.first() or dereference paymentUrls on an empty list (also guard the payment URL lookup or handle a missing "DASH.DASH" entry before passing it to createSendingRequestFromDashUri).
🧹 Nitpick comments (2)
features/exploredash/src/main/res/drawable/ic_stepper_minus.xml (1)
8-8: 💤 Low valueConsider using a theme color attribute instead of a hardcoded hex.
#191C1Fis hardcoded and won't adapt to dark mode or dynamic theming. Referencing a color resource (e.g.,@color/dash_gray_1or?attr/colorOnSurface) keeps the icon consistent with the app's theme system, especially important for a stepper control that appears in interactive UI.🎨 Suggested change
- android:strokeColor="#191C1F" + android:strokeColor="@color/dash_gray_1"(Apply the same fix to
ic_stepper_plus.xml.)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@features/exploredash/src/main/res/drawable/ic_stepper_minus.xml` at line 8, Replace the hardcoded stroke color android:strokeColor="#191C1F" in ic_stepper_minus.xml with a theme-aware color reference (e.g., use a color resource like `@color/dash_gray_1` or an attribute like ?attr/colorOnSurface) so the icon adapts to dark mode and dynamic themes; apply the same change to ic_stepper_plus.xml and ensure both XML drawables reference the chosen color attribute/resource instead of the hex literal.common/src/main/java/org/dash/wallet/common/ui/enter_amount/EnterAmountCompose.kt (1)
53-63: ⚡ Quick winGuard
processAmountKeyInput()against unsupported key values.Unknown
keyvalues currently fall intoelseand get appended to the amount string. That can introduce invalid amount states if this helper is reused outside this keypad. Prefer explicit key whitelisting and no-op on unsupported keys.Suggested diff
fun processAmountKeyInput(current: String, key: String, maxDecimalPlaces: Int = 2): String { + val isDigitKey = key.length == 1 && key[0].isDigit() return when (key) { "back" -> if (current.length > 1) current.dropLast(1) else "0" "back_long" -> "0" "." -> if (current.contains('.')) current else "$current." - else -> { + else -> if (isDigitKey) { val result = if (current == "0") key else current + key val dotIndex = result.indexOf('.') if (dotIndex != -1 && result.length - dotIndex - 1 > maxDecimalPlaces) current else result - } + } else current } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@common/src/main/java/org/dash/wallet/common/ui/enter_amount/EnterAmountCompose.kt` around lines 53 - 63, The function processAmountKeyInput currently treats any unknown key as a digit and appends it, which can create invalid amounts; update processAmountKeyInput to explicitly whitelist allowed keys (digits 0-9, ".", "back", "back_long") and treat any other key as a no-op returning the current value; implement the digit-path only when key.matches(0-9) and keep existing logic for "." and back/back_long and decimal-place checks so unsupported inputs no longer mutate the amount.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@common/src/main/java/org/dash/wallet/common/ui/components/TopIntroSend.kt`:
- Around line 281-285: Replace the hardcoded TalkBack strings in the
contentDescription for the eye-toggle with localized string resources: add
string keys (e.g., hide_balance and show_balance) to strings.xml and use
stringResource(...) in the TopIntroSend composable where contentDescription is
set (the conditional that checks isVisible) so the accessibility labels are
translated instead of being hardcoded.
In
`@common/src/main/java/org/dash/wallet/common/ui/enter_amount/EnterAmountCompose.kt`:
- Around line 119-123: The Icon shown for the backspace key in
EnterAmountCompose (inside the isBack branch rendering
painterResource(R.drawable.ic_delete_backward)) currently uses
contentDescription = null; update this to provide an accessible label by using a
localized string via contentDescription =
stringResource(R.string.accessibility_delete) (and add
R.string.accessibility_delete to your strings.xml if it doesn't exist), so
screen readers can announce the delete/backspace control.
In
`@features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/DashSpendViewModel.kt`:
- Around line 455-464: The PiggyCards test-merchant branch calls
(piggyCardsRepository as PiggyCardsRepository).getMerchant(...) but discards the
return value; capture the returned merchant/provider response and add it into
merchantResponseList and providerResponseList in the same way other branches do
so updateMerchantDetailsForAllProviders() sees the PiggyCards data. Locate the
branch guarded by SUPPORT_PIGGY_CARDS_TEST_MERCHANT and
PiggyCardsTestMerchants.ALL.find { it.merchantId == merchant.merchantId } and
after calling getMerchant(provider.sourceId, DenominationType.fromString(...))
append the non-null result into merchantResponseList and providerResponseList
(matching how other code paths populate those collections) so the subsequent
call to updateMerchantDetailsForAllProviders() includes the PiggyCards
test-merchant data.
- Around line 190-197: The public MutableStateFlow properties
isFixedDenominationMultiple and giftCardOrderInfo should be made private
MutableStateFlow-backed properties with public immutable StateFlow accessors
(use asStateFlow()), mirroring the pattern used for
_isFixedDenomination/isFixedDenomination; rename the mutables (e.g.,
_isFixedDenominationMultiple, _giftCardOrderInfo) and expose val
isFixedDenominationMultiple: StateFlow<Boolean?> and val giftCardOrderInfo:
StateFlow<Map<Double,Int>>; remove direct external mutation from
PurchaseGiftCardFragmentV2 by adding ViewModel update methods (e.g.,
setIsFixedDenominationMultiple(value: Boolean?) and updateGiftCardOrderInfo(...)
or specific add/remove methods) that encapsulate and validate state changes
before updating the private MutableStateFlow(s).
In
`@features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/PurchaseGiftCardFragmentV2.kt`:
- Around line 348-353: After calling viewModel.updateMerchantDetails(merchant)
the code checks the stale viewModel.giftCardMerchant.value; change the guard to
inspect the returned updated merchant instead (e.g., check updated?.active !=
true) and if it's inactive, popBackStack and return; only call
viewModel.setGiftCardMerchant(updated) after confirming updated is active.
Reference: updateMerchantDetails, updated, viewModel.giftCardMerchant,
viewModel.setGiftCardMerchant.
- Around line 160-167: The enablement logic for
GiftCardPurchaseMode.FlexibleMultiple and Fixed can become true with an empty
cart; add a check that at least one card is selected before allowing Continue.
In the branch handling GiftCardPurchaseMode.FlexibleMultiple and Fixed (look for
denominationQuantities, exceedsInventory, minFiat, totalDouble, fiatBalance,
isBlockchainReplaying and merchant), require denominationQuantities.any {
it.value > 0 } (or denominationQuantities.values.sum() > 0) as an additional AND
condition so the whole expression also ensures there is at least one selected
card.
- Around line 371-389: The generated denominations list in
PurchaseGiftCardFragmentV2.kt can contain duplicates or values outside the
merchant bounds; update the code that builds the denominations (the local
denominations list used to construct GiftCardPurchaseMode.FlexibleMultiple) to:
clamp each candidate value to the range [minimum, maximum], deduplicate them
(preserve order or sort) before creating the FlexibleMultiple, and apply the
same clamping/dedupe logic inside the PiggyCards test-merchant branch as well;
consider deduping doubles with a stable approach (e.g., round to cents or use a
LinkedHashSet of rounded values) so rows aren’t repeated and no denomination
exceeds merchant.maxCardPurchase.
---
Outside diff comments:
In
`@features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/PurchaseGiftCardConfirmDialog.kt`:
- Around line 381-408: Before calling data.first() check for an empty list and
bail out to the existing purchase-failure flow: if data.isEmpty() then
hideLoading(), invoke the same purchase failure UI/handler used elsewhere in
this class (the existing "purchase failure" UX or method) and return@launch; do
this before the crowd-node warning and before calling
createSendingRequestFromDashUri so you never call data.first() or dereference
paymentUrls on an empty list (also guard the payment URL lookup or handle a
missing "DASH.DASH" entry before passing it to createSendingRequestFromDashUri).
---
Nitpick comments:
In
`@common/src/main/java/org/dash/wallet/common/ui/enter_amount/EnterAmountCompose.kt`:
- Around line 53-63: The function processAmountKeyInput currently treats any
unknown key as a digit and appends it, which can create invalid amounts; update
processAmountKeyInput to explicitly whitelist allowed keys (digits 0-9, ".",
"back", "back_long") and treat any other key as a no-op returning the current
value; implement the digit-path only when key.matches(0-9) and keep existing
logic for "." and back/back_long and decimal-place checks so unsupported inputs
no longer mutate the amount.
In `@features/exploredash/src/main/res/drawable/ic_stepper_minus.xml`:
- Line 8: Replace the hardcoded stroke color android:strokeColor="#191C1F" in
ic_stepper_minus.xml with a theme-aware color reference (e.g., use a color
resource like `@color/dash_gray_1` or an attribute like ?attr/colorOnSurface) so
the icon adapts to dark mode and dynamic themes; apply the same change to
ic_stepper_plus.xml and ensure both XML drawables reference the chosen color
attribute/resource instead of the hex literal.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4fadd4b4-a1b5-40bf-be83-2917fd02bb2a
📒 Files selected for processing (9)
common/src/main/java/org/dash/wallet/common/ui/components/TopIntroSend.ktcommon/src/main/java/org/dash/wallet/common/ui/enter_amount/EnterAmountCompose.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/DashSpendViewModel.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/PurchaseGiftCardFragmentV2.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/PurchaseGiftCardScreenV2.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/PurchaseGiftCardConfirmDialog.ktfeatures/exploredash/src/main/res/drawable/ic_stepper_minus.xmlfeatures/exploredash/src/main/res/drawable/ic_stepper_plus.xmlfeatures/exploredash/src/main/res/values/strings-explore-dash.xml
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/PurchaseGiftCardConfirmDialog.kt (2)
381-405:⚠️ Potential issue | 🟠 Major | ⚡ Quick winGuard the purchase response before calling
first().
purchaseGiftCard()is an external call, but the success path assumesdatais non-empty. If the backend ever returns[], bothdata.first()calls crash instead of showing the existing failure UI.💡 Minimal fix
val data = try { viewModel.purchaseGiftCard() } catch (ex: CTXSpendException) { hideLoading() when { @@ } return@launch } + + if (data.isEmpty()) { + hideLoading() + log.error("purchaseGiftCard: empty response") + if (isAdded) { + AdaptiveDialog.create( + R.drawable.ic_error, + getString(R.string.gift_card_purchase_failed), + getString(R.string.gift_card_error), + getString(R.string.button_close) + ).show(requireActivity()) + } + return@launch + } val totalAmount = Coin.valueOf(🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/PurchaseGiftCardConfirmDialog.kt` around lines 381 - 405, The code assumes the purchase response list "data" is non-empty and calls data.first() which can crash; before using data.first() (and before computing totalAmount), guard the response by checking data.isNotEmpty() or using data.firstOrNull() and handle the empty case by calling hideLoading(), showing the existing failure UI/path and returning from the coroutine; update the block around the totalAmount computation, the needsCrowdNodeWarning check, and the createSendingRequestFromDashUri(...) call so they only run when data has at least one element (or handle null transactionId as now).
198-210:⚠️ Potential issue | 🟠 Major | ⚡ Quick winAdd a re-entrancy guard before starting the purchase flow.
This handler can be entered twice before
showLoading()runs inside the coroutine, which makes duplicate purchase submissions possible on a fast double-tap.💡 Minimal fix
private fun onConfirmButtonClicked() { + if (_uiState.value.isLoading) return + showLoading() viewLifecycleOwner.lifecycleScope.launch { // Double-check merchant is still available before proceeding if (viewModel.giftCardMerchant.value == null) { + hideLoading() log.warn("PurchaseGiftCardConfirmDialog: Merchant became null during confirmation, dismissing") dismiss() return@launch } - showLoading() if (!isAdded || authManager.authenticate(requireActivity()) == null) { hideLoading() return@launch }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/PurchaseGiftCardConfirmDialog.kt` around lines 198 - 210, The onConfirmButtonClicked handler can be entered twice causing duplicate purchases; add a re-entrancy guard (e.g., a boolean/atomic flag like isPurchasing) checked and set at the start of onConfirmButtonClicked (or immediately inside viewLifecycleOwner.lifecycleScope.launch before showLoading()) and cleared on all exit paths (after hideLoading/dismiss or on failure), so subsequent invocations return early; reference the onConfirmButtonClicked method, showLoading()/hideLoading(), and authManager.authenticate(...) when adding and clearing the guard to ensure duplicate submissions are prevented.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/GiftCardDetailsDialog.kt`:
- Around line 38-40: The file GiftCardDetailsDialog.kt has ktlint failures:
remove the unused Compose import (e.g., delete rememberScrollState import if
unused), remove the trailing comma in the previewState(...) call, break up or
shorten the overlong preview invocations so they fit line-length limits, ensure
the file ends with a newline, and reformat the file with ktlint/ktfmt (or run
the project's ktlintMainSourceSetCheck) to apply consistent formatting; adjust
references in previews and composables as needed (search for previewState(...)
and the preview functions) to satisfy the linter.
- Around line 219-223: The timeout log message is hardcoded to "after 10 tries"
and is out of sync with the actual threshold; update the onErrorLogged call in
the LaunchedEffect block (where uiState.error, uiState.queries,
waitLimitForError are checked) so the message uses the real threshold value
(e.g., interpolate waitLimitForError or the constant WAIT_LIMIT_FOR_ERROR)
instead of the literal "10" to keep logs accurate for support.
---
Outside diff comments:
In
`@features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/PurchaseGiftCardConfirmDialog.kt`:
- Around line 381-405: The code assumes the purchase response list "data" is
non-empty and calls data.first() which can crash; before using data.first() (and
before computing totalAmount), guard the response by checking data.isNotEmpty()
or using data.firstOrNull() and handle the empty case by calling hideLoading(),
showing the existing failure UI/path and returning from the coroutine; update
the block around the totalAmount computation, the needsCrowdNodeWarning check,
and the createSendingRequestFromDashUri(...) call so they only run when data has
at least one element (or handle null transactionId as now).
- Around line 198-210: The onConfirmButtonClicked handler can be entered twice
causing duplicate purchases; add a re-entrancy guard (e.g., a boolean/atomic
flag like isPurchasing) checked and set at the start of onConfirmButtonClicked
(or immediately inside viewLifecycleOwner.lifecycleScope.launch before
showLoading()) and cleared on all exit paths (after hideLoading/dismiss or on
failure), so subsequent invocations return early; reference the
onConfirmButtonClicked method, showLoading()/hideLoading(), and
authManager.authenticate(...) when adding and clearing the guard to ensure
duplicate submissions are prevented.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f6da1651-4976-4a03-a066-d88ab2052078
📒 Files selected for processing (3)
features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/GiftCardDetailsDialog.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/GiftCardOrderDetailsDialog.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/PurchaseGiftCardConfirmDialog.kt
There was a problem hiding this comment.
Actionable comments posted: 7
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.claude/agents/DEVELOPMENT-PATTERNS.md:
- Around line 1477-1480: The comment for ctxSpendViewModel is incorrect: it says
"Activity-scoped ViewModel..." but the property uses by
viewModels<DashSpendViewModel>() which creates a dialog/fragment-scoped
instance; either change the delegate to by
activityViewModels<DashSpendViewModel>() to make it truly activity-scoped, or
update the comment to explicitly state that ctxSpendViewModel uses by viewModels
and is dialog/fragment-scoped (and note intended usage/fire-and-forget behavior)
so readers aren’t misled.
In
`@features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/GiftCardDetailsDialog.kt`:
- Around line 793-795: Replace the hard-coded real-looking card PAN
"6006491727005748" used for the gift card number and barcode in
GiftCardDetailsDialog with an obviously fake test value (e.g., repeating digits
or all zeros) so static analysis won't flag it; update both places where the
variable/field named number and barcode are set to that literal, keeping the
same format as other examples in the file (ensure tests/previews use the new
clearly fake value).
- Around line 120-121: The DashSpendViewModel is being created with dialog scope
using viewModels() in GiftCardDetailsDialog; replace that with the nav-graph
scoped exploreViewModels<DashSpendViewModel>() so the dialog shares the same
DashSpendViewModel instance used by PurchaseGiftCardFragment,
DashSpendTermsDialog, PurchaseGiftCardConfirmDialog, SearchFragment, and so that
calls on ctxSpendViewModel.logError() and ctxSpendViewModel.createEmailIntent()
operate on the shared state. Locate the property declaration private val
ctxSpendViewModel by viewModels<DashSpendViewModel>() in GiftCardDetailsDialog
and change it to use exploreViewModels<DashSpendViewModel>().
In
`@features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/GiftCardDetailsViewModel.kt`:
- Around line 437-450: The dummy-card creation copies every field from
cardToCopy which preserves sensitive fields (number, pin, barcodeValue,
merchantUrl/redeemUrl); change the added creation so each new card only inherits
the index and explicitly clears sensitive fields (e.g., set number=null,
pin=null, barcodeValue=null, merchantUrl=null/redeemUrl=null as appropriate)
before calling giftCardDao.insertGiftCard and updating _uiState; also ensure the
updateGiftCard path that writes merchantUrl/redeemUrl explicitly clears
number/pin/barcodeValue for that index so DB entries cannot retain stale data.
- Around line 543-558: The code is indexing uiState.value.giftCards by the
loop/parameter "index" (a position) which can mismatch the GiftCard.index field
and cause OOB or corruption; update the code in functions like updateGiftCard
and the metadataProvider.updateGiftCardMetadata call to locate the card by its
GiftCard.index (e.g., find or first { it.index == index }) rather than using
giftCards[index], and when creating copies (the giftCard.copy(...) calls used to
update number/pin) do not reassign the index field—only copy number and pin (and
other mutable fields) so the stored .index is preserved; also handle the case
where the find returns null (guard or early return) to avoid crashes.
In
`@features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/PurchaseGiftCardFragmentV2.kt`:
- Around line 259-263: The try/catch around Fiat.parseFiat in
PurchaseGiftCardFragmentV2 (the fiatAmount assignment and the similar block
later) currently swallows the exception; update both blocks to catch the
exception but log the caught exception (at debug) before returning null so parse
failures are visible in logs during onContinue handling. Locate the
Fiat.parseFiat(...) calls in PurchaseGiftCardFragmentV2 (used to produce
fiatAmount) and add a debug log statement that includes the exception
message/stacktrace via your app's logger (e.g., Timber/Log/fragment logger)
inside the catch, then keep returning null to preserve behavior.
- Line 158: The boolean expression in PurchaseGiftCardFragmentV2 (the line
containing "amount > BigDecimal.ZERO && amount >= min && amount <= max && amount
< balanceMax && !isBlockchainReplaying") exceeds ktlint's 120-char limit; split
the chained conditions across multiple lines (one condition per line or grouped
logically) and align them with indentation so the expression remains under 120
chars, ensuring you keep the same logical order and use the same variable names
(amount, min, max, balanceMax, isBlockchainReplaying) and any surrounding
parentheses in the method where this check appears.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4b8f3afd-c886-4bf3-96ea-5e2cd970496b
📒 Files selected for processing (18)
.claude/agents/DEVELOPMENT-PATTERNS.mdfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ExploreSyncWorker.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/data/explore/GiftCardDao.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/repository/DashSpendRepository.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/repository/PiggyCardsRepository.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/DashSpendUserAuthFragment.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/DashSpendViewModel.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/PurchaseGiftCardFragment.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/PurchaseGiftCardFragmentV2.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/PurchaseGiftCardScreenV2.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/GiftCardDetailsDialog.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/GiftCardDetailsViewModel.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/GiftCardOrderDetailsDialog.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/GiftCardOrderDetailsViewModel.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/GiftCardViewModel.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/PurchaseGiftCardConfirmDialog.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/explore/SearchFragment.ktfeatures/exploredash/src/main/java/org/dash/wallet/features/exploredash/utils/PiggyCardsTestMerchantData.kt
✅ Files skipped from review due to trivial changes (2)
- features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/GiftCardViewModel.kt
- features/exploredash/src/main/java/org/dash/wallet/features/exploredash/utils/PiggyCardsTestMerchantData.kt
🚧 Files skipped from review as they are similar to previous changes (12)
- features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/explore/SearchFragment.kt
- features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/DashSpendUserAuthFragment.kt
- features/exploredash/src/main/java/org/dash/wallet/features/exploredash/repository/DashSpendRepository.kt
- features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ExploreSyncWorker.kt
- features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/PurchaseGiftCardFragment.kt
- features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/GiftCardOrderDetailsViewModel.kt
- features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/GiftCardOrderDetailsDialog.kt
- features/exploredash/src/main/java/org/dash/wallet/features/exploredash/data/explore/GiftCardDao.kt
- features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/dialogs/PurchaseGiftCardConfirmDialog.kt
- features/exploredash/src/main/java/org/dash/wallet/features/exploredash/repository/PiggyCardsRepository.kt
- features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/DashSpendViewModel.kt
- features/exploredash/src/main/java/org/dash/wallet/features/exploredash/ui/dashspend/PurchaseGiftCardScreenV2.kt
1. ignoring PC if logged into CTX 2. discount and fees for negative values 3. purchase confirmation dialog clipping buttons
|
|
||
| exploreConfig.saveExploreDatabasePrefs(databasePrefs) | ||
|
|
||
| addPiggyCardsTestMerchantIfNeeded() |
There was a problem hiding this comment.
seems like real users will see test merchants in master?
There was a problem hiding this comment.
The way it will work is that a release build for Google Play will be created with the fastlane process which defines a flag BUILD_PROD
# Strip PiggyCards test merchants from production release builds.
ENV['BUILD_PROD'] = '1'if this is defined, then in the build system
// Seed PiggyCards test merchants in any build except the production
// release pipeline (fastlane sets BUILD_PROD=1).
def supportPiggyCardsTestMerchant = System.getenv("BUILD_PROD") != "1"
buildConfigField "boolean", "PIGGY_CARDS_TEST_MERCHANT", supportPiggyCardsTestMerchant.toString()And this flag will cause the exclusion of the test merchants for release builds made for Google Play, but other builds will have the test merchants.
| val metadataItem = TransactionMetadataCacheItem( | ||
| metadata, | ||
| giftCard | ||
| giftCard.first() |
There was a problem hiding this comment.
.firstOrNull() as well here?
There was a problem hiding this comment.
@abaranouski good catch, this might crash the app for prevent saving of metadata when a transaction was not for purchasing a giftcard
… merchants for fastlane release
Issue being fixed or feature implemented
Related PR's and Dependencies
Screenshots / Videos
How Has This Been Tested?
Checklist:
Summary by CodeRabbit
New Features
Refactor
Bug Fixes / Data
Documentation