Skip to content

Conversation

@bfoss765
Copy link
Contributor

@bfoss765 bfoss765 commented Jan 5, 2026

Issue being fixed or feature implemented

What was done?

How Has This Been Tested?

Breaking Changes

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • Bug Fixes

    • Fixed button styling consistency for support contact options.
  • Refactor

    • Updated support button implementation to use dynamic text and improved internal structure.

✏️ Tip: You can customize this high-level summary in your review settings.

bfoss765 and others added 2 commits January 5, 2026 14:38
- Display "Contact PiggyCards Support" instead of "Contact CTX Support"
  when a PiggyCards purchase fails
- Style the support link in blue to make it appear clickable
- Clicking opens email to the correct provider's support address

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Jan 5, 2026

📝 Walkthrough

Walkthrough

These changes refactor the DashSpend UI layer by renaming the support contact method from contactCTXSupport() to contactSupport(), introducing a new computed property contactSupportButtonText for dynamic button labels, and standardizing negative button styling in ButtonsGroup to always use dashBlue.

Changes

Cohort / File(s) Summary
DashSpend refactoring
DashSpendPayViewModel.swift, DashSpendPayScreen.swift
Removes contactCTXSupport() method and adds contactSupport() method; introduces new computed property contactSupportButtonText: String that dynamically generates text using provider's displayName; updates screen to consume the new property and method call.
ButtonsGroup styling
ButtonsGroup.swift
Negative button foreground color now consistently set to dashBlue in both vertical and horizontal orientations, removing previous conditional logic based on positiveButtonText existence.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Poem

🐰✨ A button renamed, a text made bright,
Dynamic labels now feel just right!
Colors harmonized, consistent and true,
Our UI polish shines right through! 💙

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: fixing provider-specific support messaging (replacing hardcoded 'Contact CTX Support' with dynamic provider-specific text like 'Contact PiggyCards Support').
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 70de58e and bf7398f.

📒 Files selected for processing (3)
  • DashWallet/Sources/UI/Explore Dash/Views/DashSpend/DashSpendPayScreen.swift
  • DashWallet/Sources/UI/Explore Dash/Views/DashSpend/DashSpendPayViewModel.swift
  • DashWallet/Sources/UI/SwiftUI Components/ButtonsGroup.swift
🧰 Additional context used
📓 Path-based instructions (4)
**/*.swift

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.swift: Use SwiftUI for all new UI components. Do NOT create new UIKit ViewControllers, XIB files, or Storyboards. Use thin UIViewController wrappers only when integrating with existing UIKit navigation.
Always use guard statements instead of force unwrapping for optional coordinates (latitude, longitude). Never force unwrap latitude! or longitude! - use guard with error handling.
For generic type inference in Swift closures, add explicit return type annotations (e.g., { merchant -> MerchantAnnotation? in }) when compilation fails with generic parameter errors.
In SwiftUI conditional compilation, use computed properties instead of inline #if statements to avoid buildExpression errors. Move complex conditions into dedicated computed properties.
For dictionary initialization with conditional compilation, use closure-based initialization instead of inline conditionals to avoid syntax errors.
When removing debug print statements, ensure switch cases remain valid (add break if case becomes empty). Never leave empty switch cases.
Conditional compilation in Swift: use #if DASHPAY for DashPay features and #if PIGGYCARDS_ENABLED for PiggyCards features. Wrap all provider-specific code in appropriate flags.
Always use debug flags like #if DEBUG to wrap debug print statements. Remove debug logging before release commits. Search for print(" statements before any release.
Use emoji prefixes in debug logs for easy filtering: 🔍 for search, 📍 for location, 🗺️ for map, 🎯 for targeted debugging. This improves ability to filter console output.
Always validate CLLocationCoordinate2D.isValid before using coordinates. Implement fallback chains for CTX API data. Test coordinate edge cases thoroughly in unit tests.
Use os_log framework for production-safe logging instead of print statements. os_log messages are only logged in debug builds and stripped in release builds.

Files:

  • DashWallet/Sources/UI/Explore Dash/Views/DashSpend/DashSpendPayViewModel.swift
  • DashWallet/Sources/UI/SwiftUI Components/ButtonsGroup.swift
  • DashWallet/Sources/UI/Explore Dash/Views/DashSpend/DashSpendPayScreen.swift
**/*.{swift,m,h}

📄 CodeRabbit inference engine (CLAUDE.md)

Use 4-space indentation and 180-character line limit (100 recommended). Follow NYTimes Objective-C Style Guide for ObjC code. Use SwiftFormat/SwiftLint for Swift code formatting.

Files:

  • DashWallet/Sources/UI/Explore Dash/Views/DashSpend/DashSpendPayViewModel.swift
  • DashWallet/Sources/UI/SwiftUI Components/ButtonsGroup.swift
  • DashWallet/Sources/UI/Explore Dash/Views/DashSpend/DashSpendPayScreen.swift
**/DashSpend*.swift

📄 CodeRabbit inference engine (CLAUDE.md)

Use BIP70 payment URLs with sendCoinsService.payWithDashUrl() for CTX. Use direct dash address and sendCoinsService.sendCoins() for PiggyCards. Do NOT use payWithDashUrl for PiggyCards.

Files:

  • DashWallet/Sources/UI/Explore Dash/Views/DashSpend/DashSpendPayViewModel.swift
  • DashWallet/Sources/UI/Explore Dash/Views/DashSpend/DashSpendPayScreen.swift
**/*ViewModel.swift

📄 CodeRabbit inference engine (CLAUDE.md)

**/*ViewModel.swift: Format discounts with 1 decimal place for values < 1% (e.g., -0.5%), and whole numbers for 1% and above (e.g., -10%). Use .doubleValue, not .intValue, to preserve decimal precision.
For claim link (online redemption) gift cards, store the URL in the card 'number' field and display as tappable link instead of barcode. Detect URLs by checking if number starts with 'http'.
After updating barcode in database, always call await loadGiftCard() to reload UI. Don't rely on automatic updates - explicitly reload after database changes.
MVVM Pattern: Use ViewModels for SwiftUI components and modern controllers. ViewModels should contain business logic, Views should be lightweight display only.

Files:

  • DashWallet/Sources/UI/Explore Dash/Views/DashSpend/DashSpendPayViewModel.swift
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
Repo: dashpay/dashwallet-ios PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-17T21:42:15.776Z
Learning: Applies to **/DashSpend*.swift : Use BIP70 payment URLs with `sendCoinsService.payWithDashUrl()` for CTX. Use direct dash address and `sendCoinsService.sendCoins()` for PiggyCards. Do NOT use payWithDashUrl for PiggyCards.
📚 Learning: 2025-12-17T21:42:15.776Z
Learnt from: CR
Repo: dashpay/dashwallet-ios PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-17T21:42:15.776Z
Learning: Applies to **/DashSpend*.swift : Use BIP70 payment URLs with `sendCoinsService.payWithDashUrl()` for CTX. Use direct dash address and `sendCoinsService.sendCoins()` for PiggyCards. Do NOT use payWithDashUrl for PiggyCards.

Applied to files:

  • DashWallet/Sources/UI/Explore Dash/Views/DashSpend/DashSpendPayViewModel.swift
  • DashWallet/Sources/UI/Explore Dash/Views/DashSpend/DashSpendPayScreen.swift
📚 Learning: 2025-12-17T21:42:15.776Z
Learnt from: CR
Repo: dashpay/dashwallet-ios PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-17T21:42:15.776Z
Learning: Applies to DashWallet/Sources/Models/Uphold/DWUpholdMainnetConstants.m : The DWUpholdMainnetConstants.m file gets automatically formatted by the clang-format build phase script, adding unwanted blank lines. Restore this file before committing if it only has whitespace changes.

Applied to files:

  • DashWallet/Sources/UI/Explore Dash/Views/DashSpend/DashSpendPayViewModel.swift
📚 Learning: 2025-12-17T21:42:15.776Z
Learnt from: CR
Repo: dashpay/dashwallet-ios PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-17T21:42:15.776Z
Learning: Applies to **/*ViewModel.swift : For claim link (online redemption) gift cards, store the URL in the card 'number' field and display as tappable link instead of barcode. Detect URLs by checking if number starts with 'http'.

Applied to files:

  • DashWallet/Sources/UI/Explore Dash/Views/DashSpend/DashSpendPayViewModel.swift
📚 Learning: 2025-12-17T21:42:15.776Z
Learnt from: CR
Repo: dashpay/dashwallet-ios PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-17T21:42:15.776Z
Learning: Applies to **/*.swift : Conditional compilation in Swift: use `#if DASHPAY` for DashPay features and `#if PIGGYCARDS_ENABLED` for PiggyCards features. Wrap all provider-specific code in appropriate flags.

Applied to files:

  • DashWallet/Sources/UI/SwiftUI Components/ButtonsGroup.swift
🧬 Code graph analysis (2)
DashWallet/Sources/UI/SwiftUI Components/ButtonsGroup.swift (1)
DashWallet/Sources/UI/SwiftUI Components/Button.swift (1)
  • overrideForegroundColor (235-237)
DashWallet/Sources/UI/Explore Dash/Views/DashSpend/DashSpendPayScreen.swift (1)
DashWallet/Sources/UI/Explore Dash/Views/DashSpend/DashSpendPayViewModel.swift (1)
  • contactSupport (286-310)
🔇 Additional comments (4)
DashWallet/Sources/UI/SwiftUI Components/ButtonsGroup.swift (1)

71-71: LGTM! Consistent negative button styling.

The change standardizes the negative button color to always use .dashBlue, removing the conditional logic based on positiveButtonText existence. This aligns with the PR objective to style support links in blue and improves UI consistency.

Also applies to: 77-77

DashWallet/Sources/UI/Explore Dash/Views/DashSpend/DashSpendPayScreen.swift (1)

231-231: LGTM! Provider-agnostic support contact.

The changes replace the hardcoded support button text and CTX-specific method with dynamic, provider-aware properties from the view model. This properly supports multiple gift card providers (CTX and PiggyCards) as intended by the PR.

Also applies to: 234-234

DashWallet/Sources/UI/Explore Dash/Views/DashSpend/DashSpendPayViewModel.swift (2)

282-284: LGTM! Dynamic provider-specific button text.

The computed property correctly generates localized button text using the provider's display name, making the support contact mechanism provider-agnostic.


286-310: LGTM! Well-structured provider-agnostic support contact method.

The refactored method correctly:

  • Uses provider-specific display name and support email
  • Includes comprehensive merchant, purchase, and device details in the email body
  • Properly encodes URL parameters for the mailto link

The method successfully replaces the CTX-specific implementation with a generic, multi-provider solution. The provider.supportEmail property is a computed property that exhaustively covers all enum cases (ctx and piggyCards), always returning a valid, non-empty email string, so no additional validation is needed.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@HashEngineering HashEngineering left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. very simple

@bfoss765 bfoss765 merged commit a3ec62f into master Jan 7, 2026
3 checks passed
@bfoss765 bfoss765 deleted the PC-support-msg branch January 7, 2026 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants