Skip to content

feat: merge master 8.4.2 into piggcards - #733

Merged
bfoss765 merged 33 commits into
feature/piggycardsfrom
feature/piggycards-temp
Oct 7, 2025
Merged

bfoss765 merged 33 commits into
feature/piggycardsfrom
feature/piggycards-temp

Conversation

@bfoss765

@bfoss765 bfoss765 commented Oct 7, 2025

Copy link
Copy Markdown
Contributor

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

HashEngineering and others added 30 commits August 26, 2025 09:35
Fixed the post_install script to properly detect platform types and set the correct deployment targets:
- iOS targets: IPHONEOS_DEPLOYMENT_TARGET = '14.0'
- watchOS targets: WATCHOS_DEPLOYMENT_TARGET = '4.0'

This resolves build errors with CocoaPods 1.15.2 which is stricter about deployment target misconfigurations.

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

Co-Authored-By: Claude <[email protected]>
Added PIGGYCARDS_ENABLED feature flag to conditionally compile PiggyCards functionality.
When the flag is not defined, PiggyCards is completely hidden from the codebase while
maintaining the ability to easily re-enable it later.

Key changes:
- Added conditional compilation to GiftCardProvider enum and related switch statements
- Hidden PiggyCards from UI filters and spending options
- Conditionally compiled repository references in ViewModels using closure initialization
- Fixed SwiftUI ViewBuilder compatibility with helper computed properties
- Updated database queries to handle PiggyCards filtering conditionally

This allows merging PiggyCards branch into master with the feature hidden until ready.

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

Co-Authored-By: Claude <[email protected]>
…and feature flag patterns

Added comprehensive documentation from merchant-country-info branch and enhanced with learnings
from PiggyCards feature hiding implementation:

CLAUDE.md:
- Added critical CocoaPods deployment target configuration patterns
- Comprehensive conditional compilation best practices for Swift/SwiftUI
- Common build failure patterns and solutions
- Dictionary initialization and boolean expression safety patterns

ios-development-patterns.md:
- Gift card provider system architecture documentation
- Repository factory pattern with conditional compilation
- Feature flag implementation patterns across UI, database, and business logic
- Complete examples of problematic vs. correct conditional compilation patterns

ios-swift-safety-patterns.md:
- SwiftUI ViewBuilder compilation safety with conditional compilation
- Dictionary initialization safety patterns
- Boolean expression conditional compilation safety
- CocoaPods configuration safety (deployment targets, workspace usage)
- Comprehensive safety checklists and verification commands

These documentation enhancements provide concrete examples from real debugging sessions
and should prevent common build failures and crashes in future development.

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

Co-Authored-By: Claude <[email protected]>
Updated agent documentation to explicitly mandate SwiftUI-first architecture:

- CLAUDE.md: Added comprehensive SwiftUI-first policies with prohibited UIKit patterns
- ios-development-patterns.md: Enhanced with SwiftUI architecture patterns and examples
- ios-swift-safety-patterns.md: Added SwiftUI-specific safety patterns and compilation guidelines

All future AI assistance will prioritize SwiftUI Views with thin UIKit wrappers only when absolutely necessary.

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

Co-Authored-By: Claude <[email protected]>
…patterns

Added comprehensive agent documentation files from claude-agents-dashwallet-ios branch with critical enhancements:

New agent files:
- AI-DEVELOPMENT-GUIDE.md: Complete AI development workflow with SwiftUI-first policies
- EXTERNAL-INTEGRATIONS.md: External service integration patterns with SwiftUI architecture
- PROJECT-FUNCTIONS.md: Key APIs and functions reference with modern patterns

Enhanced existing file:
- ios-development-patterns.md: Added legacy integration patterns and comprehensive SwiftUI development guidelines

Key improvements based on current session learnings:
- Mandatory SwiftUI-first development policies with prohibited UIKit patterns
- Feature flag conditional compilation safety patterns from PiggyCards implementation
- CocoaPods deployment target fixes for multi-platform projects
- Real-world debugging patterns and compilation error solutions
- Comprehensive MVVM architecture patterns for SwiftUI
- Safe navigation and state management patterns
- Legacy codebase integration strategies

All future AI assistance will follow these comprehensive development patterns while maintaining compatibility with existing codebase.

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

Co-Authored-By: Claude <[email protected]>
Updated ExploreDatabaseSyncManager to dynamically select database based on current network:
- Mainnet: explore-v4.db (instead of always using testnet database)
- Testnet: explore-v4-testnet.db (preserves testnet functionality)

Fixed Swift initialization order issue by moving database path logic into init() method
instead of using computed property that accessed 'self' before initialization.

Uses DWEnvironment.sharedInstance().currentChain.isMainnet() for network detection,
following the same pattern used throughout the codebase.

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

Co-Authored-By: Claude <[email protected]>
…cManager

Fixed critical issue where app was using incorrect database due to filename and UserDefaults key conflicts between mainnet and testnet configurations.

Key fixes:
- Use network-specific filenames (explore-mainnet vs explore-testnet) to prevent database file conflicts
- Implement network-specific UserDefaults keys for separate version tracking
- Ensure mainnet builds correctly download gs://dash-wallet-firebase.appspot.com/explore/explore-v4.db
- Ensure testnet builds correctly download gs://dash-wallet-firebase.appspot.com/explore/explore-v4-testnet.db

This resolves the issue where mainnet merchants like "EA 12 month (Xbox)" were not appearing in search results because the app was reusing an old testnet database file.

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

Co-Authored-By: Claude <[email protected]>
Added SWIFT_ACTIVE_COMPILATION_CONDITIONS with PIGGYCARDS_ENABLED flag to all main app build configurations:
- Debug: "DEBUG PIGGYCARDS_ENABLED"
- Release: "PIGGYCARDS_ENABLED"
- Testflight: "PIGGYCARDS_ENABLED"
- Testnet: "DEBUG PIGGYCARDS_ENABLED DASH_TESTNET"

This enables all PiggyCards functionality including:
- PiggyCards provider in GiftCardProvider enum
- PiggyCards repository initialization
- PiggyCards UI filters and authentication flows
- PiggyCards merchant data integration

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

Co-Authored-By: Claude <[email protected]>
Removed PIGGYCARDS_ENABLED compilation flags from all main app build configurations to hide PiggyCards data and features:
- Debug: Removed PIGGYCARDS_ENABLED (keeping DEBUG only)
- Release: Removed PIGGYCARDS_ENABLED
- Testflight: Removed PIGGYCARDS_ENABLED
- Testnet: Removed PIGGYCARDS_ENABLED (keeping DEBUG DASH_TESTNET)

This disables PiggyCards UI elements and functionality while preserving all database sync manager improvements for proper mainnet/testnet database handling.

The PiggyCards feature flag infrastructure remains in code for easy re-enabling in the future.

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

Co-Authored-By: Claude <[email protected]>
Adds database filter to prevent PiggyCards-only merchants from appearing in search results when PIGGYCARDS_ENABLED compilation flag is not defined. This completes the conditional compilation implementation for hiding PiggyCards features.

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

Co-Authored-By: Claude <[email protected]>
- Update provider info display to match new design with inline layout
- Show provider name, amount type, and discount in single row
- Add location count display to "Show all locations" button
- Implement proper bounds calculation for location counting
- Remove unused infoBox component
- Preserve SwiftUI components and architectural changes

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

Co-Authored-By: Claude <[email protected]>
…list views

This commit fixes a critical issue where the location count displayed in POI details
(e.g., "87 locations") didn't match the actual count in the "Show all locations" list
(e.g., only 11 locations shown). The issue manifested when users changed filter radius
from 20 to 50 miles.

Key fixes implemented:

**1. Race Condition Prevention**
- Fixed ExplorePointOfUseListViewController overriding AllMerchantLocationsViewController's bounds
- Added navigation stack check to prevent parent VC interference
- ExplorePointOfUseListViewController now skips bounds updates when AllMerchantLocationsViewController is active

**2. Parent VC Resolution**
- Fixed AllMerchantLocationsViewController to correctly identify POIDetailsViewController as parent
- Updated radius lookup from POIDetailsViewController.currentFilters instead of searchRadius fallback
- Added comprehensive navigation stack debugging

**3. Filter State Propagation**
- Made POIDetailsViewController.currentFilters accessible to child views
- Added debug logging to track filter state throughout navigation chain
- Fixed AllMerchantLocationsDataProvider to properly handle filters parameter

**4. Data Fetch Triggers**
- Added missing model.refreshItems() calls in AllMerchantLocationsViewController
- Fixed viewDidLoad() and viewWillAppear() to trigger data fetch after bounds update
- Ensured AllMerchantLocationsDataProvider actually executes fetch requests

**5. Comprehensive Debug Logging**
- Added model instance tracking to identify sharing vs separate models
- Enhanced bounds calculation logging with MKCircle details
- Added filter propagation tracing throughout the navigation flow

**Results:**
- POI details and location list now show consistent counts (87 locations)
- Filter radius changes properly update both detail view and list view
- AllMerchantLocationsViewController correctly uses separate model instance
- No more stale bounds or missing data fetch issues

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

Co-Authored-By: Claude <[email protected]>
- **Merchant distance accuracy**: Replaced flawed GROUP BY/HAVING SQL logic with proper closest location selection using Swift post-processing
- **All tab behavior**: Properly detect infinite radius (Double.greatestFiniteMagnitude) to show all merchant locations without distance restrictions
- **Per-tab filter persistence**: Implement segment-specific filter storage so each tab (Online/Nearby/All) maintains its own filter state
- **Location permission timing**: Request location permission immediately when switching to Nearby tab instead of waiting for second visit
- **Distance formatting**: Update MeasurementFormatter to show 1 decimal place for better distance readability
- **Enhanced debugging**: Add comprehensive logging for MerchantDAO closest location processing and Famous Dave's location selection

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

Co-Authored-By: Claude <[email protected]>
- Added debug logging to show all Famous Dave's locations in DB before filtering
- Added redemption type filter testing to isolate the cause of missing 10.9-mile location
- Enhanced existing debug output to include redemption type information
- This will help identify which SQL filter is excluding the closer Famous Dave's location

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

Co-Authored-By: Claude <[email protected]>
… filtering

Root cause: The main merchant search filtered out merchants with redeemType='url'
but the allLocations method didn't apply the same filter, causing inconsistency.

The 10.9-mile Famous Dave's location has redeemType='url' which was:
- Filtered OUT by main merchant search (showed 17.7-mile location)
- NOT filtered by 'Show All Locations' (correctly showed 10.9-mile location)

Fix: Added the same redemption type filter to allLocations method for consistency.
Now both queries will exclude URL-based redemption merchants consistently.

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

Co-Authored-By: Claude <[email protected]>
…in DB

Investigation revealed:
- The database schema doesn't contain a redeemType column
- The SQL filter '(redeemType IS NULL OR redeemType != 'url')' always evaluates to true
- No Famous Dave's locations exist in current local database
- App likely loads merchant data from remote Firebase Storage
- Previous fix was based on incorrect analysis

Need to investigate actual data source and filtering logic.

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

Co-Authored-By: Claude <[email protected]>
…cular distance filtering

Problem: Nearby tab with 20-mile filter was showing locations up to 26 miles away.

Root cause:
- Bounds filtering used MKCircle.boundingMapRect which creates a square bounding box
- Merchants in the corners of the rectangle were up to radius × √2 = 28.28 miles away
- SQL query used rectangular bounds: lat/lng > min AND lat/lng < max

Solution:
- Added circular distance filtering after rectangular bounds filtering
- Calculate estimated radius from bounds dimensions
- Filter locations by actual CLLocation.distance from user
- This ensures true circular radius filtering instead of rectangular approximation

The rectangular bounds are still used for initial broad SQL filtering for performance,
then circular filtering is applied in post-processing for accuracy.

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

Co-Authored-By: Claude <[email protected]>
Two issues fixed:

1. AllMerchantLocationsViewController now ALWAYS shows all merchant locations
   - Previously applied radius filtering when coming from Nearby tab
   - Now removes bounds completely for true 'show all locations' behavior
   - Fixes incorrect location count totals

2. Improved circular distance filtering accuracy
   - Now uses exact filter radius (32000m = 20 miles) instead of estimating from bounds
   - Eliminates small calculation errors that showed ~19.96 miles instead of 20 miles
   - Ensures precise 20-mile radius filtering

Result:
- Nearby tab will show only locations within exactly 20 miles
- 'Show All Locations' will show ALL locations for that merchant regardless of distance
- Location counts will be accurate and consistent

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

Co-Authored-By: Claude <[email protected]>
- Fixed AllMerchantLocationsViewController to preserve radius filter for Nearby tab requests
- Only removes radius filter for All tab (infinite radius) requests
- Added MapKit import to AllMerchantLocationsDataProvider for MKCircle bounds generation
- Nearby tab 'Show all locations' now shows radius-filtered locations instead of all locations globally
- All tab continues to show all locations globally as expected

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

Co-Authored-By: Claude <[email protected]>
- Fixed MerchantDAO.allLocations to apply circular distance filtering
- Previously only used rectangular bounds, causing locations outside
  the true radius to be incorrectly included
- Added comprehensive documentation in agent files about the two-stage
  filtering pattern (rectangular bounds + circular distance)
- Updated CLAUDE.md with critical distance filtering pattern
- Added location-mapping-patterns.md for future reference

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

Co-Authored-By: Claude <[email protected]>
- Expand rectangular bounds by 50% to prevent excluding locations within circular radius
- Remove all debug print statements with magnifying glass emoji for production readiness
- Fix empty switch case syntax error in AllMerchantLocationsDataProvider
- Preserve all existing functionality while improving performance

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

Co-Authored-By: Claude <[email protected]>
The All tab was missing online-only and Dash merchants due to incorrect
location filtering. This commit fixes the issue by ensuring the All tab
never filters by bounds or user location.

Key changes:
- AllMerchantsDataProvider now passes nil for both bounds and userPoint
  parameters to avoid location-based filtering
- This ensures SQL-based sorting is used instead of in-memory grouping
- MerchantDAO bounds filtering logic improved to handle online merchants
- In-memory grouping now correctly includes merchants without coordinates
- Updated CLAUDE.md with architectural lessons learned

Result: All tab now correctly displays all merchants (online, physical,
and both types) sorted alphabetically, with "1-800-Baskets" appearing
first as expected.

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

Co-Authored-By: Claude <[email protected]>
This commit addresses several code safety and quality issues:

Documentation fixes:
- Fixed PROJECTFUNCTIONS.md references in AI-DEVELOPMENT-GUIDE.md to use
  correct hyphenated filename and .claude/agents/ path
- Fixed async/await example in EXTERNAL-INTEGRATIONS.md to properly wrap
  await call in Task block

Safety improvements:
- Replaced force-unwrapped URL in DashSpendTermsScreen.swift with safe
  guard/canOpenURL checks and completion handler
- Added database connection guards in MerchantDAO.swift to prevent crashes
  when db is nil (two locations)
- Changed DashSpendError.errorDescription from public to internal to fix
  SwiftLint lower_acl_than_parent violation

Concurrency improvements:
- Added @mainactor annotation to DashSpendRepository protocol to ensure
  ObservableObject state mutations occur on main actor

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

Co-Authored-By: Claude <[email protected]>
SwiftUI Views are structs (value types), not classes, so they cannot use
[weak self] capture lists. Removed the incorrect weak capture from the
linkAction closure in DashSpendTermsScreen.

This fixes the build error: "'weak' may only be applied to class and
class-bound protocol types, not 'DashSpendTermsScreen'"

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

Co-Authored-By: Claude <[email protected]>
- Fix map centering to use GPS location (Ashby, MA) on initial load
- Fix map to preserve panned location when returning from merchant detail
- Fix distance calculations to use map center instead of GPS when panning
- Add searchCenterCoordinate tracking throughout the merchant flow
- Implement region stabilization to prevent MKMapView auto-adjustments
- Pass search center to cells for accurate distance display
- Clear search center only when actually leaving the screen

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

Co-Authored-By: Claude <[email protected]>
Update version number across all targets:
- DashWallet
- DashPay
- TodayExtension
- WatchApp and WatchApp Extension
- Test targets

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

Co-Authored-By: Claude <[email protected]>
- Fix phone number format to display +1 country code prefix for US numbers
- Fix gift card button behavior when navigating from show all locations screen
- Fix CTX provider label, card type, and discount info display for gift card merchants in all locations view

The allLocations() query was missing gift card provider data fetching,
causing gift card merchants to appear as regular Dash merchants when
viewed from the "Show All Locations" screen. Added provider information
retrieval logic matching the main merchant query.

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

Co-Authored-By: Claude <[email protected]>
- Update MARKETING_VERSION from 8.5.0 to 8.4.2 across all build configurations
- Add documentation for files that get unintentionally modified
- Document proper version management using MARKETING_VERSION build setting
- Add guidelines for handling DWUpholdMainnetConstants.m whitespace changes
- Add guidelines for Info.plist version management

This ensures the About screen displays the correct version number and
provides guidance for future version updates and common git issues.

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

Co-Authored-By: Claude <[email protected]>
HashEngineering and others added 2 commits October 2, 2025 14:05
docs: add Bad CPU type issue resolution
Added SWIFT_ACTIVE_COMPILATION_CONDITIONS with PIGGYCARDS_ENABLED flag to all main app build configurations:
- Debug: "DEBUG PIGGYCARDS_ENABLED"
- Release: "PIGGYCARDS_ENABLED"
- Testflight: "PIGGYCARDS_ENABLED"
- Testnet: "DEBUG PIGGYCARDS_ENABLED DASH_TESTNET"

This enables all PiggyCards functionality including:
- PiggyCards provider in GiftCardProvider enum
- PiggyCards repository initialization
- PiggyCards UI filters and authentication flows
- PiggyCards merchant data integration

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

Co-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 7, 2025

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/piggycards-temp

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.

@HashEngineering HashEngineering left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove these files:

DashWallet/explore.db-shm
DashWallet/explore.db-wal

Also add these files to .gitignore so they never get committed again.

- Remove explore.db-shm and explore.db-wal from git tracking
- Add *.db-shm and *.db-wal to .gitignore to prevent future commits

These are SQLite Write-Ahead Log (WAL) files that should not be tracked in version control.

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

Co-Authored-By: Claude <[email protected]>
@bfoss765 bfoss765 changed the title Feat: merge master 8.4.2 into piggcards feat: merge master 8.4.2 into piggcards Oct 7, 2025

@HashEngineering HashEngineering left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good. I checked that the piggy card build flags are ON.

@bfoss765
bfoss765 merged commit 35309b1 into feature/piggycards Oct 7, 2025
@bfoss765
bfoss765 deleted the feature/piggycards-temp branch October 7, 2025 18:02
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.

2 participants