Skip to content

Conversation

@HashEngineering
Copy link
Collaborator

@HashEngineering HashEngineering commented Jul 30, 2025

Issue being fixed or feature implemented

Related PR's and Dependencies

Screenshots / Videos

How Has This Been Tested?

  • QA (Mobile Team)

Checklist:

  • I have performed a self-review of my own code and added comments where necessary
  • I have added or updated relevant unit/integration/functional/e2e tests

Summary by CodeRabbit

  • New Features

    • Introduced support for multiple gift card providers, including PiggyCards, alongside CTX, with new provider selection and filtering options throughout the ExploreDash feature.
    • Added PiggyCards integration, including user authentication, merchant and gift card browsing, purchasing, and order management.
    • Enhanced merchant details and filtering UI to allow selection and display of different gift card providers.
    • Migrated item details and related UI to Jetpack Compose for a more modern and responsive experience.
  • Improvements

    • Unified and generalized user authentication flows for all supported gift card providers.
    • Updated gift card purchasing, transaction metadata, and analytics to support and distinguish between multiple providers.
    • Enhanced filtering and sorting capabilities to allow users to filter merchants by provider and payment method.
    • Improved error handling and user feedback for gift card purchases and authentication.
  • Bug Fixes

    • Fixed issues related to transaction metadata and UI display for gift card transactions from different providers.
    • Improved handling of payment requests without URLs to prevent exceptions during coin sending.
  • Style

    • Updated and added vector drawable icons for new providers, payment methods, and improved visual consistency.
    • Refined color palette and UI elements for a more cohesive look.
  • Documentation

    • Updated string resources and layout files to reflect new provider options and user flows.
  • Chores

    • Updated build configurations, dependencies, and database schema to support new features and provider integration.
    • Adjusted test cases and proguard rules to accommodate new provider support and refactored codebase.
  • Refactor

    • Renamed classes, fragments, and view models for clarity and multi-provider support.
    • Modularized repository and data source logic for extensibility and maintainability.
    • Removed obsolete files and legacy implementations replaced by Compose or new provider logic.

Syn-McJ and others added 9 commits June 24, 2025 11:26
* feat: piggycards API draft

* chore: refactoring out of ResponseResource

* chore: renaming CTXSpend -> DashSpend

* feat: piggy cards API support

* feat: support for multiple gift card providers

* fix: country mock

* feat: errors & logged in state tracking

* chore: logout & fixes

* fix: PiggyCards email disclaimer

* chore: rename GiftCardService to GiftCardProvider

* chore: add logging

* fix: proguard for piggycards
* feat: UI and new Explore table

* feat: filtering by provider

* fix: fixed/flexible denoms for gift card providers

* fix: tests

* chore: disable pre-packaging explore.db

* chore: ignore missing explore db error

* chore: cleanup
* feat: UI and new Explore table

* feat: filtering by provider

* fix: fixed/flexible denoms for gift card providers

* fix: tests

* chore: disable pre-packaging explore.db

* chore: ignore missing explore db error

* feat: new merchant details UI draft

* chore: simplify itemdetails structure

* chore: UI fixes

* feat: merchant details UI

* fix: atm UI and filters

* fix: observe login state on page load

* fix: tests

* fix: crash in test

* fix: v4 explore DB

* fix: switching selected provider

* fix: namespace refactor & proguard

* fix: observing changes on page load

* chore: cleanup

* fix: 3 to 4 db migration
@HashEngineering HashEngineering self-assigned this Jul 30, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 30, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update introduces multi-provider support for DashSpend gift card features, adding PiggyCards alongside CTX. It refactors repositories, data models, and UI to support multiple providers, updates database schemas, expands filtering and selection logic, and migrates merchant detail views to Jetpack Compose. Numerous supporting models, DAOs, APIs, and configurations for PiggyCards are added, and navigation, resources, and Proguard rules are updated accordingly.

Changes

Cohort / File(s) Change Summary
Gift Card Multi-Provider Core
features/exploredash/src/main/java/org/dash/wallet/features/exploredash/repository/CTXSpendRepository.kt, .../repository/DashSpendRepository.kt, .../repository/DashSpendRepositoryFactory.kt, .../repository/PiggyCardsRepository.kt, .../data/dashspend/GiftCardProviderType.kt, .../data/dashspend/GiftCardProvider.kt, .../data/dashspend/GiftCardProviderDao.kt, .../data/dashspend/model/GiftCardInfo.kt, .../data/dashspend/model/UpdatedMerchantDetails.kt, .../data/dashspend/GiftCardService.kt
Introduces PiggyCards provider alongside CTX for DashSpend. Adds new repository, data models, provider type enum, Room entity and DAO, and service definitions. Refactors CTXSpendRepository, creates DashSpendRepository interface and factory, and implements PiggyCardsRepository.
PiggyCards API & Models
.../data/dashspend/piggycards/model/*, .../network/service/piggycards/PiggyCardsApi.kt, .../network/PiggyCardsRemoteDataSource.kt, .../network/interceptor/PiggyCardsHeadersInterceptor.kt, .../utils/PiggyCardsConfig.kt, .../utils/PiggyCardsConstants.kt
Adds Retrofit API, OkHttp interceptor, config, and all PiggyCards data models for authentication, merchant, gift card, order, and exchange rate.
Database & Migrations
.../ExploreDatabase.kt, .../ExploreDatabaseMigrations.kt, .../schemas/org.dash.wallet.features.exploredash.ExploreDatabase/4.json, .../di/ExploreDatabaseModule.kt, wallet/src/de/schildbach/wallet/Constants.java
Upgrades Explore database to version 4, adds GiftCardProvider entity and DAO, updates migrations, and adjusts DB file paths.
Merchant Filtering & Data Source
.../data/explore/ExploreDataSource.kt, .../data/explore/MerchantDao.kt, .../data/explore/model/Merchant.kt, .../data/explore/model/SearchResult.kt, .../ui/explore/ExploreViewModel.kt, .../ui/explore/SearchFragment.kt, .../ui/explore/ItemDetails.kt, .../ui/explore/dialogs/FiltersDialog.kt, .../test/java/org/dash/wallet/features/exploredash/ExploreViewModelTest.kt, .../test/java/org/dash/wallet/features/exploredash/MerchantAtmDataSourceTest.kt
Adds provider parameter to merchant queries, updates DAO and data source logic, expands filtering and paging, and updates tests. Refactors merchant details UI to Compose, adds provider selection and login state, and updates filtering dialog for multi-provider support.
DashSpend UI Refactor
.../ui/dashspend/DashSpendViewModel.kt, .../ui/dashspend/DashSpendUserAuthFragment.kt, .../ui/dashspend/dialogs/DashSpendLoginInfoDialog.kt, .../ui/dashspend/dialogs/DashSpendTermsDialog.kt, .../ui/dashspend/dialogs/GiftCardDetailsDialog.kt, .../ui/dashspend/dialogs/GiftCardDetailsViewModel.kt, .../ui/dashspend/dialogs/PurchaseGiftCardConfirmDialog.kt, .../ui/dashspend/MerchantDenominations.kt, .../ui/dashspend/PurchaseGiftCardFragment.kt
Refactors CTXSpend UI and ViewModel to DashSpend, supporting multiple providers, new dialogs, Compose-based merchant details, and improved error handling. Adds new ViewModel for gift card details with polling and analytics.
Explore Navigation & Resources
.../res/navigation/nav_explore.xml, .../res/values/strings-explore-dash.xml, .../res/layout/dialog_filters.xml, .../res/layout/fragment_search.xml, .../res/layout/dialog_gift_card_details.xml, .../res/layout/dialog_dash_spend_login_info.xml, .../res/layout/dialog_dashspend_terms.xml, .../res/layout/fragment_dash_spend_user_auth.xml, .../res/layout/fragment_purchase_ctxspend_gift_card.xml
Updates navigation for DashSpend, adds provider arguments, updates and expands string resources for PiggyCards and provider selection, updates layouts for new dialogs, Compose integration, and UI tweaks.
Drawable & Icon Resources
.../res/drawable/ic_ctx_logo_small.xml, .../res/drawable/ic_gift_card.xml, .../res/drawable/ic_gift_card_black.xml, .../res/drawable/ic_percentage.xml, .../res/drawable/ic_piggy_cards_small.xml, .../res/drawable/ic_piggycards_logo.xml, .../res/drawable/logo_ionia.xml
Adds new icons for PiggyCards and CTX, updates gift card icons, and removes old Ionia logo.
Build Config & Proguard
build.gradle, features/exploredash/build.gradle, wallet/proguard.cfg
Updates Room version, adds KSP schema location, adds Coil Compose dependency, and updates Proguard rules for new models and APIs.
Wallet Integration & Transaction Metadata
wallet/src/de/schildbach/wallet/ui/TransactionResultViewModel.kt, wallet/src/de/schildbach/wallet/service/WalletTransactionMetadataProvider.kt, wallet/src/de/schildbach/wallet/ui/transactions/TransactionResultViewBinder.kt, wallet/src/de/schildbach/wallet/ui/transactions/TransactionRowView.kt, wallet/src/de/schildbach/wallet/ui/main/WalletTransactionsFragment.kt
Expands transaction metadata logic to support multiple DashSpend services, updates UI and metadata provider to use new service identification, and adjusts icon logic.
CTXSpend Model & API Package Refactor
.../data/dashspend/ctx/model/*, .../network/service/ctxspend/CTXSpendApi.kt, .../network/service/ctxspend/CTXSpendTokenApi.kt, .../network/authenticator/TokenAuthenticator.kt
Moves CTXSpend models to new package, updates API imports, and simplifies token refresh logic.
Miscellaneous
common/src/main/java/org/dash/wallet/common/data/ResponseResource.kt, common/src/main/java/org/dash/wallet/common/data/ServiceName.kt, common/src/main/java/org/dash/wallet/common/services/SendPaymentService.kt, common/src/main/java/org/dash/wallet/common/services/TransactionMetadataProvider.kt, common/src/main/java/org/dash/wallet/common/transactions/TransactionObserver.kt, common/src/main/java/org/dash/wallet/common/ui/components/MyTheme.kt, common/src/main/java/org/dash/wallet/common/ui/enter_amount/EnterAmountViewModel.kt, wallet/src/de/schildbach/wallet/payments/SendCoinsTaskRunner.kt
Removes unused ResponseResource.unwrap, updates ServiceName for multi-provider, adds transaction metadata parameter, tweaks coroutine handling, adds colors, and minor logic improvements.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI (Compose)
    participant DashSpendViewModel
    participant DashSpendRepositoryFactory
    participant CTXSpendRepository
    participant PiggyCardsRepository
    participant PiggyCardsApi
    participant CTXSpendApi

    User->>UI (Compose): Selects merchant, chooses provider
    UI (Compose)->>DashSpendViewModel: onBuyGiftCardButtonClicked(provider)
    DashSpendViewModel->>DashSpendRepositoryFactory: create(provider)
    alt provider == CTX
        DashSpendRepositoryFactory->>CTXSpendRepository: createCTXSpend()
        DashSpendViewModel->>CTXSpendRepository: orderGiftcard(...)
        CTXSpendRepository->>CTXSpendApi: purchaseGiftCard(...)
        CTXSpendApi-->>CTXSpendRepository: GiftCardResponse
        CTXSpendRepository-->>DashSpendViewModel: GiftCardInfo
    else provider == PiggyCards
        DashSpendRepositoryFactory->>PiggyCardsRepository: createPiggyCardsRepository()
        DashSpendViewModel->>PiggyCardsRepository: orderGiftcard(...)
        PiggyCardsRepository->>PiggyCardsApi: createOrder(...)
        PiggyCardsApi-->>PiggyCardsRepository: OrderResponse
        PiggyCardsRepository->>PiggyCardsApi: getOrderStatus(...)
        PiggyCardsApi-->>PiggyCardsRepository: OrderStatusResponse
        PiggyCardsRepository-->>DashSpendViewModel: GiftCardInfo
    end
    DashSpendViewModel-->>UI (Compose): Update UI with GiftCardInfo
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~90+ minutes

Possibly related PRs

Poem

Two bunnies hopped with code so bright,
Adding PiggyCards to Dash’s delight.
Compose replaced old XML views,
Now merchants shine with multi-provider hues!
New icons sparkle, filters refined—
Gift card choices, all aligned.
🐰💳 The wallet hops ahead, one feature at a time!

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat-Add-purchase-support-for-piggy-cards

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@HashEngineering HashEngineering deleted the feat-Add-purchase-support-for-piggy-cards branch August 6, 2025 16:26
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