Repository navigation
feat: UI improvements - #732
Conversation
feat(dashspend): piggycards terms and conditions
Feat/piggycards login
feat(dashspend): gift card provider picker
feat(dashspend): piggycards filters
- Merged latest localization updates from PR 728 - Preserved version 8.5.0 for piggycards branch - Includes security menu and settings updates from master 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
feat: merge master into feature/piggycards
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]>
There was a problem hiding this comment.
Actionable comments posted: 53
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (6)
DashWallet/hu.lproj/Localizable.strings (1)
953-2370: Restore proper Hungarian translations for new DashSpend keysSeveral other additions (“Fixed amounts”, “I accept %@ terms and conditions”, “Invalid email or password.”, “Phone”, “PiggyCards gift card(s)”, “Provider”, “Select gift card provider”, “Show all locations”, “Spending options”, “Paste link here”, etc.) also remain in English. These will render untranslated in the Hungarian UI. Please provide the Hungarian equivalents (ideally via the Transifex flow) so the locale stays consistent.
Based on learningsDashWallet/Sources/Models/Explore Dash/Services/DashSpend/CTX/CTXSpendAPI.swift (1)
95-103: Crash risk: force‑unwrapping weak provider in closureThe accessTokenProvider closure force‑unwraps a weak capture; if the provider deallocates, this will crash. Use optional chaining.
- private func initialize(with ctxSpendAPIAccessTokenProvider: CTXSpendTokenProvider) { - accessTokenProvider = { [weak ctxSpendAPIAccessTokenProvider] in - ctxSpendAPIAccessTokenProvider!.accessToken - } + private func initialize(with ctxSpendAPIAccessTokenProvider: CTXSpendTokenProvider) { + accessTokenProvider = { [weak ctxSpendAPIAccessTokenProvider] in + ctxSpendAPIAccessTokenProvider?.accessToken + } self.ctxSpendAPIAccessTokenProvider = ctxSpendAPIAccessTokenProviderDashWallet/Sources/Models/Explore Dash/Services/DashSpend/CTX/CTXSpendTokenService.swift (1)
41-80: Data race on tokenRefreshTask; refresh dedup can run twice under contention.
tokenRefreshTaskis read/written from arbitrary executors without isolation. Two callers can both seeniland spawn duplicate refresh tasks.Apply this diff to isolate access via MainActor and ensure single-flight semantics:
- func refreshAccessToken() async throws { - // If there's already a refresh task running, wait for it - if let task = tokenRefreshTask { - try await task.value - return - } - - guard let tokenProvider = tokenProvider, - let refreshToken = tokenProvider.refreshToken, - !refreshToken.isEmpty else { - return - } - - tokenRefreshTask = Task { - defer { - tokenRefreshTask = nil - } - - DSLogger.log("CTXSpend: Attempting to refresh access token") - - do { - let request = RefreshTokenRequest(refreshToken: refreshToken) - let response: RefreshTokenResponse = try await CTXSpendAPI.shared.requestDirectly(.refreshToken(request)) - - // Update tokens through the service - tokenProvider.updateTokens(accessToken: response.accessToken, refreshToken: response.refreshToken) - - DSLogger.log("CTXSpend: Token refresh successful") - } catch { - DSLogger.log("CTXSpend: Token refresh failed: \(error)") - - // Clear tokens on refresh failure - tokenProvider.clearTokensOnRefreshFailure() - - throw DashSpendError.tokenRefreshFailed - } - } - - try await tokenRefreshTask!.value - } + func refreshAccessToken() async throws { + guard let tokenProvider = self.tokenProvider, + let refreshToken = tokenProvider.refreshToken, + !refreshToken.isEmpty else { + return + } + + // Ensure only one refresh task exists at a time + let task: Task<Void, Error> = await MainActor.run { + if let t = self.tokenRefreshTask { return t } + let newTask = Task { + defer { await MainActor.run { self.tokenRefreshTask = nil } } + + DSLogger.log("CTXSpend: Attempting to refresh access token") + do { + let request = RefreshTokenRequest(refreshToken: refreshToken) + let response: RefreshTokenResponse = try await CTXSpendAPI.shared.requestDirectly(.refreshToken(request)) + tokenProvider.updateTokens(accessToken: response.accessToken, refreshToken: response.refreshToken) + DSLogger.log("CTXSpend: Token refresh successful") + } catch { + DSLogger.log("CTXSpend: Token refresh failed: \(error)") + tokenProvider.clearTokensOnRefreshFailure() + throw DashSpendError.tokenRefreshFailed + } + } + self.tokenRefreshTask = newTask + return newTask + } + + try await task.value + }DashWallet/Sources/Models/Transactions/SendCoinsService.swift (1)
76-87: Replace remaining CTXSpendError references with DashSpendError
- DashWallet/Sources/UI/Explore Dash/Views/DashSpend/DashSpendPayScreen.swift:295
- DashWallet/Sources/Models/Explore Dash/Services/DashSpend/CTX/CTXSpendRepository.swift:146, 212
DashWallet/Sources/UI/Explore Dash/Views/DashSpend/DashSpendPayScreen.swift (1)
218-222: Don’t hardcode CTX support for all providersNow that
DashSpendPayScreenis parameterized byGiftCardProvider, this dialog still renders “Contact CTX Support” and callscontactCTXSupport()unconditionally. For providers like PiggyCards this presents the wrong CTA and routes users to the wrong help channel. Please drive both the label and action off the selected provider so each flow lands on the correct support endpoint. A simple way is to expose a provider-awaresupportButtonTitle/contactSupport()on the view model and use that here.- negativeButtonText: NSLocalizedString("Contact CTX Support", comment: "DashSpend"), - negativeButtonAction: { - showCustomErrorDialog = false - viewModel.contactCTXSupport() - } + negativeButtonText: viewModel.supportButtonTitle, + negativeButtonAction: { + showCustomErrorDialog = false + viewModel.contactSupport() + }DashWallet/Sources/UI/Explore Dash/Views/DashSpend/DashSpendPayViewModel.swift (1)
264-303: Provider selection still hardwired to CTX repositoryLine 268 and Line 297 still call
ctxSpendRepositorydirectly, so whenprovideris anything other than.ctx(e.g., PiggyCards) we ignore the repository map you introduced and hit the wrong backend. That will reject the request with unauthorized/invalid-merchant responses, effectively breaking every non-CTX flow. Please resolve the repository fromrepository[provider](or the factory) for both merchant refresh and purchase, and drop the dedicatedctxSpendRepositoryfield so the new provider logic actually executes.
🧹 Nitpick comments (66)
.claude/agents/AI-DEVELOPMENT-GUIDE.md (1)
361-366: Promote the PiggyCards note to a heading.Markdownlint flags Line 361 for using bold text in place of a heading, which will keep failing the lint gate. Converting it into an actual heading clears the warning without changing the intent.
-**Based on PiggyCards implementation experience** +#### Based on PiggyCards implementation experienceDashWallet.xcodeproj/project.pbxproj (2)
445-445: Old POIDetailsViewController coexists with new SwiftUI POIDetailsView/ViewModel — confirm intent or remove legacy VC.Both the legacy UIKit controller and the new SwiftUI stack are compiled into targets. If the SwiftUI version fully replaces the VC, drop POIDetailsViewController from app targets to avoid dead code, duplicated logic, and app size bloat. If you need it temporarily, ensure only one path is reachable at runtime.
Based on learnings
Also applies to: 1249-1249, 8786-8786, 9554-9554, 5806-5807, 5726-5727
5725-5727: Details group now contains both legacy VC and SwiftUI view/model — prefer one canonical path.To reduce maintenance debt, consider moving the old VC to a “Deprecated” or excluding it from app targets once the SwiftUI flow is fully migrated.
Based on learnings
Also applies to: 5806-5808
DashWallet/Sources/Models/Explore Dash/Infrastructure/Database Connection/ExploreDatabaseConnection.swift (4)
34-34: Avoid IUO and narrow write access for dbReplace implicitly unwrapped optional with an optional and prevent external mutation. This addresses the SwiftLint warning and reduces crash risk.
-class ExploreDatabaseConnection { - var db: Connection! +class ExploreDatabaseConnection { + private(set) var db: Connection?
36-41: Retain and remove the notification observerThe block-based observer isn’t stored, so you can’t remove it; over time this can lead to duplicate connects or leaks if multiple instances are created. Store the token and remove it in deinit.
class ExploreDatabaseConnection { + private var dbUpdateObserver: NSObjectProtocol? init() { - NotificationCenter.default.addObserver(forName: ExploreDatabaseSyncManager.databaseHasBeenUpdatedNotification, - object: nil, queue: .main) { [weak self] _ in - try? self?.connect() - } + dbUpdateObserver = NotificationCenter.default.addObserver( + forName: ExploreDatabaseSyncManager.databaseHasBeenUpdatedNotification, + object: nil, + queue: .main + ) { [weak self] _ in + try? self?.connect() + } } + deinit { + if let observer = dbUpdateObserver { + NotificationCenter.default.removeObserver(observer) + } + }
62-79: Thread-safety for db swapsconnect() swaps db on the main queue via a notification while execute() may be called from other threads. Consider serializing access (e.g., via an actor or a dedicated serial DispatchQueue) to avoid races.
87-105: Swallowed errors and throws contractexecute(...) is marked throws but always returns [] on failure, which can hide defects. Either remove throws or propagate errors (and log with OSLog instead of print).
Also applies to: 107-117
DashWallet/cs.lproj/Localizable.strings (4)
952-954: “Fixed amounts” vs “Fixed denominated amounts” duplicationYou now have both “Fixed amounts” and “Fixed denominated amounts”. Consider consolidating to one term for consistency in UI.
1740-1741: Paste link string updatedLGTM. Ensure any previous key (“Past link here”) is removed from code to avoid dead keys.
1818-1825: Brand name consistency: “Piggy Cards” vs “PiggyCards”Two variants are introduced (“Piggy Cards gift cards” and “PiggyCards gift card”). Align on a single brand spelling to avoid UI inconsistency.
1-3182: Process note: manage translations via TransifexThis file is managed by Transifex; manual edits may be overwritten. Ensure changes flow through translation management.
Based on learnings
DashWallet/Sources/Models/Explore Dash/Services/DashSpend/CTX/CTXSpendAPI.swift (3)
22-22: Avoid IUO for weak provider referenceIUO on a weak var is risky and flagged by SwiftLint. Make it optional.
- weak var ctxSpendAPIAccessTokenProvider: CTXSpendTokenProvider! + weak var ctxSpendAPIAccessTokenProvider: CTXSpendTokenProvider?
101-105: Redundant type check in configure(with:)The as? CTXSpendTokenProvider check is redundant; the argument is already that type.
- // Configure the token service - if let tokenProvider = ctxSpendAPIAccessTokenProvider as? CTXSpendTokenProvider { - CTXSpendTokenService.shared.configure(with: tokenProvider) - } + // Configure the token service + CTXSpendTokenService.shared.configure(with: ctxSpendAPIAccessTokenProvider)
66-77: Post‑refresh token source alignmentAfter refresh, you set accessTokenProvider to read from ctxSpendAPIAccessTokenProvider. Consider always sourcing from CTXSpendTokenService.shared.accessToken to centralize token state and avoid weak ref pitfalls.
- // Update the access token provider after refresh - accessTokenProvider = { [weak self] in - self?.ctxSpendAPIAccessTokenProvider?.accessToken - } + // Tokens should always come from the token service + accessTokenProvider = { + CTXSpendTokenService.shared.accessToken + }DashWallet/sl_SI.lproj/Localizable.strings (2)
1115-1115: Use positional specifiers for format strings.To support word-order changes in non-English languages, prefer indexed placeholders in values.
Apply this diff:
-"I accept %@ terms and conditions" = "I accept %@ terms and conditions"; +"I accept %@ terms and conditions" = "I accept %1$@ terms and conditions";
1821-1825: Unify brand naming: “PiggyCards” vs “Piggy Cards”.Keep the displayed brand consistent. Suggest “PiggyCards” (no space) in values.
Apply this diff:
-"Piggy Cards gift cards" = "Piggy Cards gift cards"; +"Piggy Cards gift cards" = "PiggyCards gift cards";DashWallet/Sources/Models/Transactions/SendCoinsService.swift (1)
131-140: Consider emitting DashSpendError consistently from delegate failures.
didFailWithErrorcurrently bubbles an NSError. For uniform UX and localization, map toDashSpendError.paymentProcessingError(message).Example:
public func paymentProcessor(_ processor: DWPaymentProcessor, didFailWithError error: Swift.Error?, title: String?, message: String?) { let msg = message ?? title ?? NSLocalizedString("Payment failed", comment: "") completePayment(transaction: nil, error: DashSpendError.paymentProcessingError(msg)) }DashWallet/Sources/Models/Explore Dash/Services/ExploreDatabaseSyncManager.swift (4)
199-207: Fix accessor order to satisfy SwiftLint (computed_accessors_order).Getter should precede setter.
As per coding guidelines
Apply this diff:- var exploreDatabaseLastSyncTimestamp: TimeInterval { - set { - UserDefaults.standard.setValue(newValue, forKey: syncTimestampKey) - } - get { - let value = UserDefaults.standard.double(forKey: syncTimestampKey) - return value == 0 ? bundleExploreDatabaseSyncTime : value - } - } + var exploreDatabaseLastSyncTimestamp: TimeInterval { + get { + let value = UserDefaults.standard.double(forKey: syncTimestampKey) + return value == 0 ? bundleExploreDatabaseSyncTime : value + } + set { + UserDefaults.standard.setValue(newValue, forKey: syncTimestampKey) + } + }
209-217: Fix accessor order (second property).Mirror the same getter-before-setter ordering.
As per coding guidelines
Apply this diff:- var exploreDatabaseLastVersion: TimeInterval { - set { - UserDefaults.standard.setValue(newValue, forKey: versionKey) - } - get { - let value = UserDefaults.standard.double(forKey: versionKey) - return value == 0 ? bundleExploreDatabaseSyncTime : value - } - } + var exploreDatabaseLastVersion: TimeInterval { + get { + let value = UserDefaults.standard.double(forKey: versionKey) + return value == 0 ? bundleExploreDatabaseSyncTime : value + } + set { + UserDefaults.standard.setValue(newValue, forKey: versionKey) + } + }
114-117: Avoid potential crash if timer is nil in deinit.
timeris IUO and may be nil ifstart()was never called.Apply this diff:
- deinit { - timer.invalidate() - timer = nil - } + deinit { + timer?.invalidate() + timer = nil + }
22-26: Remove unused private constants
fileName,kExploreDatabaseLastSyncTimestampKeyandkExploreDatabaseLastVersionin ExploreDatabaseSyncManager.swift are never referenced and can be removed.DashWallet/Sources/Models/Explore Dash/Model/DashSpend/GiftCardProvider.swift (1)
48-56: Centralize PiggyCards terms URL in the constants struct
termsUrlhardcodes the Piggy Cards URL even though we already introducedPiggyCardsConstants.termsAndConditionsUrl. Please wire the enum through that constant to keep all provider-specific URLs in one place and avoid future drift.Apply this diff:
case .ctx: return CTXConstants.termsAndConditionsUrl #if PIGGYCARDS_ENABLED case .piggyCards: - return "https://piggy.cards/index.php?route=information/information&information_id=5" + return PiggyCardsConstants.termsAndConditionsUrl #endif } }DashWallet/da.lproj/Localizable.strings (1)
1115-1115: Use positional format specifiers for translatability.To allow reordering in some languages, prefer %1$@ in format strings.
-"I accept %@ terms and conditions" = "I accept %@ terms and conditions"; +"I accept %1$@ terms and conditions" = "I accept %1$@ terms and conditions";DashWallet/Sources/UI/Explore Dash/Views/DashSpend/DashSpendTermsScreen.swift (1)
20-27: Prefer @Environment(\.dismiss) over presentationMode.
presentationModeis legacy;dismissis the modern API.-struct DashSpendTermsScreen: View { - @Environment(\.presentationMode) private var presentationMode +struct DashSpendTermsScreen: View { + @Environment(\.dismiss) private var dismissAnd update usage:
- presentationMode.wrappedValue.dismiss() + dismiss()DashWallet/Sources/Models/Explore Dash/Services/DashSpend/DashSpendError.swift (2)
43-45: Rename NSLocalizedString comment context.Context still references CTX; use “DashSpend” for consistency.
- return NSLocalizedString("Invalid verification code. Please try again.", comment: "CTXSpend error") + return NSLocalizedString("Invalid verification code. Please try again.", comment: "DashSpend")
61-61: Avoid provider-specific branding in a generic error.Message mentions “CTX Support” but this error is shared across providers. Make it provider-agnostic.
- return NSLocalizedString("The purchase limits for this merchant have changed. Please contact CTX Support for more information.", comment: "DashSpend") + return NSLocalizedString("The purchase limits for this merchant have changed. Please contact support for more information.", comment: "DashSpend")DashWallet/eo.lproj/Localizable.strings (2)
641-646: Translations should be synced from Transifex, not edited directly.Please revert manual changes and import updates via the TX pipeline to keep keys/values aligned across locales. Based on learnings
You can reuse the verification script from the DA locale comment to check for key coverage.
Also applies to: 752-752, 953-953, 1115-1115, 1247-1247, 1740-1740, 1818-1819, 1821-1825, 1938-1939, 2191-2191, 2306-2306, 2369-2370
1115-1115: Enable reordering with positional specifiers.Use %1$@ in format strings for better i18n.
-"I accept %@ terms and conditions" = "I accept %@ terms and conditions"; +"I accept %1$@ terms and conditions" = "I accept %1$@ terms and conditions";DashWallet/Sources/Models/Explore Dash/Model/Entites/PiggyCardsModels.swift (1)
83-86: Simplify redundant string enum value.The
userIdenum case has a redundant string value that matches the case name.Apply this diff to simplify:
enum CodingKeys: String, CodingKey { - case userId = "userId" + case userId }Based on SwiftLint static analysis.
DashWallet/Sources/Models/Explore Dash/Services/DashSpend/PiggyCards/PiggyCardsAPI.swift (1)
65-75: Consider using exhaustive switch for better maintainability.The access token check uses a switch with a default case, which could hide new endpoints that might need authentication.
Consider making the switch exhaustive to ensure all new endpoints are explicitly handled:
private func checkAccessTokenIfNeeded(for target: PiggyCardsEndpoint) throws { switch target { case .signup, .login, .verifyOtp: return - default: + case .purchaseGiftCard, .getGiftCard, .getMerchants, .getMerchant: if PiggyCardsTokenService.shared.accessToken == nil { DSLogger.log("PiggyCards: No access token available for protected endpoint") throw DashSpendError.unauthorized } } }This ensures that when new endpoints are added, the compiler will force you to explicitly decide whether they need authentication.
DashWallet/Sources/Models/Explore Dash/Services/DashSpend/DashSpendRepositoryFactory.swift (1)
36-44: Consider lazy initialization for repositories.The helper methods always return shared singletons. If repositories have expensive initialization, consider lazy loading.
If initialization overhead becomes a concern, consider lazy initialization:
private func createCTXSpendRepository() -> CTXSpendRepository { + // Could check if already initialized before accessing return CTXSpendRepository.shared }DashWallet/Sources/Models/Explore Dash/Services/DashSpend/PiggyCards/PiggyCardsTokenService.swift (1)
50-64: Consider validating token expiry before use.The function saves the token expiry time but doesn't validate it before returning success.
Consider checking if the token is already expired:
func performAutoLogin() async throws -> Bool { let userId = KeychainService.load(key: PiggyCardsRepository.Keys.userId) let password = KeychainService.load(key: PiggyCardsRepository.Keys.password) if let userId = userId, let password = password { let response: PiggyCardsLoginResponse = try await PiggyCardsAPI.shared.request(.login(userId: userId, password: password)) KeychainService.save(key: PiggyCardsRepository.Keys.accessToken, data: response.accessToken) let expiresAt = Date().addingTimeInterval(TimeInterval(response.expiresIn)) UserDefaults.standard.set(expiresAt.timeIntervalSince1970, forKey: PiggyCardsRepository.Keys.tokenExpiresAt) + // Verify the token isn't already expired + if expiresAt <= Date() { + DSLogger.log("PiggyCards: Received token is already expired") + return false + } + return !response.accessToken.isEmpty } else { return false } }DashWallet/sq.lproj/Localizable.strings (2)
641-646: Avoid manual edits to .strings; push base keys and sync via TransifexThis repo manages translations via Transifex. New keys like “CTX gift card(s)” should be added to the base (English) strings and then pulled into locale files via Transifex, not edited directly here. Please revert locale changes and update via the translation pipeline. Based on learnings
1821-1825: Unify brand spelling: “PiggyCards” vs “Piggy Cards”Keys/values mix “Piggy Cards gift cards” and “PiggyCards gift card”. This inconsistency will surface in UI. Align on one spelling (project code hints at PiggyCards without space).
Apply this diff to align the displayed values (safe for locale values without changing keys):
-"Piggy Cards gift cards" = "Piggy Cards gift cards"; +"Piggy Cards gift cards" = "PiggyCards gift cards"; -"PiggyCards gift card" = "PiggyCards gift card"; +"PiggyCards gift card" = "PiggyCards gift card";DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsView.swift (7)
285-305: Stable ordering for provider listIterating dictionary keys yields nondeterministic order. Sort by displayName (or discount).
- ForEach(Array(viewModel.supportedProviders.keys), id: \.self) { provider in + ForEach(Array(viewModel.supportedProviders.keys).sorted { $0.displayName < $1.displayName }, id: \.self) { provider in
347-356: Move @ViewBuilder onto the same line and make restriction text dynamicFix SwiftLint attribute style and avoid hard-coded US-only text; source from provider/merchant metadata if available.
- @ViewBuilder - private var countryRestrictionView: some View { - if case .merchant(let m) = merchant.category, m.paymentMethod == .giftCard { - Text(NSLocalizedString("This card works only in the United States.", comment: "DashSpend")) + @ViewBuilder private var countryRestrictionView: some View { + if case .merchant(let m) = merchant.category, m.paymentMethod == .giftCard, + let restriction = viewModel.countryRestrictionText { + Text(restriction) .font(.system(size: 13)) .foregroundColor(.secondaryText) .multilineTextAlignment(.center) .padding(.bottom, 8) } }If viewModel.countryRestrictionText doesn’t exist, expose a provider-aware optional string.
374-399: SwiftLint: place @ViewBuilder on the same line for propertiesSilences the “attributes” rule.
- @ViewBuilder - private var loginStatusView: some View { + @ViewBuilder private var loginStatusView: some View {
250-272: SwiftLint: avoid trailing closure with multiple closures in ButtonLabel the second closure explicitly.
- Button(action: { + Button(action: { showAllLocationsActionBlock?() - }) { + }, label: { HStack { Text(viewModel.locationCount > 0 ? "\(NSLocalizedString("Show all locations", comment: "Explore Dash")) (\(viewModel.locationCount))" : NSLocalizedString("Show all locations", comment: "Explore Dash")) .font(.system(size: 13, weight: .medium)) .foregroundColor(.primaryText) Spacer() Image(systemName: "chevron.right") .font(.system(size: 13)) .foregroundColor(.secondaryText) } .padding(.horizontal, 16) .padding(.vertical, 20) .background(Color.secondaryBackground) .cornerRadius(12) .shadow(color: Color.black.opacity(0.05), radius: 10, x: 0, y: 5) - } + }) .buttonStyle(PlainButtonStyle())
541-545: Whitespace and readability: operator spacingAdd spaces around division operator for SwiftLint.
- .frame(height: 1/UIScreen.main.scale) + .frame(height: 1 / UIScreen.main.scale)
486-493: SwiftLint: dictionary colon spacingRemove the space before the colon.
- mapItem.openInMaps(launchOptions: [MKLaunchOptionsDirectionsModeKey : MKLaunchOptionsDirectionsModeDriving]) + mapItem.openInMaps(launchOptions: [MKLaunchOptionsDirectionsModeKey: MKLaunchOptionsDirectionsModeDriving])
18-21: Sort imports to satisfy SwiftLintAlphabetical: MapKit, SDWebImageSwiftUI, SwiftUI.
-import SwiftUI -import MapKit -import SDWebImageSwiftUI +import MapKit +import SDWebImageSwiftUI +import SwiftUIDashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/PointOfUseListModel.swift (4)
157-167: Gate verbose prints behind DEBUG (or use a logger)These prints will spam production logs.
- if let location = location { - print("🔍🔍🔍 PointOfUseListModel.userCoordinates: \(String(describing: coords))") - print("🔍🔍🔍 PointOfUseListModel.userCoordinates: accuracy=\(location.horizontalAccuracy)m, age=\(location.timestamp.timeIntervalSinceNow)s") - } else { - print("🔍🔍🔍 PointOfUseListModel.userCoordinates: nil") - } + #if DEBUG + if let location = location { + print("🔍🔍🔍 PointOfUseListModel.userCoordinates: \(String(describing: coords))") + print("🔍🔍🔍 PointOfUseListModel.userCoordinates: accuracy=\(location.horizontalAccuracy)m, age=\(location.timestamp.timeIntervalSinceNow)s") + } else { + print("🔍🔍🔍 PointOfUseListModel.userCoordinates: nil") + } + #endif
215-235: Gate apply(filters:) diagnostics behind DEBUGSame rationale as above.
- print("🔍🔍🔍 PointOfUseListModel.apply: CALLED with filters=\(String(describing: filters))") - print("🔍🔍🔍 PointOfUseListModel.apply: filters?.sortBy=\(String(describing: filters?.sortBy))") - print("🔍🔍🔍 PointOfUseListModel.apply: currentSegment.tag=\(currentSegment.tag), title='\(currentSegment.title)'") - if let existingFilters = self.filters { - print("🔍🔍🔍 PointOfUseListModel.apply: REPLACING existing filters sortBy=\(String(describing: existingFilters.sortBy))") - } else { - print("🔍🔍🔍 PointOfUseListModel.apply: NO existing filters to replace") - } + #if DEBUG + print("🔍🔍🔍 PointOfUseListModel.apply: CALLED with filters=\(String(describing: filters))") + print("🔍🔍🔍 PointOfUseListModel.apply: filters?.sortBy=\(String(describing: filters?.sortBy))") + print("🔍🔍🔍 PointOfUseListModel.apply: currentSegment.tag=\(currentSegment.tag), title='\(currentSegment.title)'") + if let existingFilters = self.filters { + print("🔍🔍🔍 PointOfUseListModel.apply: REPLACING existing filters sortBy=\(String(describing: existingFilters.sortBy))") + } else { + print("🔍🔍🔍 PointOfUseListModel.apply: NO existing filters to replace") + } + #endif ... - if let updatedFilters = self.filters { - print("🔍🔍🔍 PointOfUseListModel.apply: SET filters sortBy=\(String(describing: updatedFilters.sortBy))") - } else { - print("🔍🔍🔍 PointOfUseListModel.apply: SET filters to nil") - } - print("🔍🔍🔍 PointOfUseListModel.apply: About to call refreshItems()") + #if DEBUG + if let updatedFilters = self.filters { + print("🔍🔍🔍 PointOfUseListModel.apply: SET filters sortBy=\(String(describing: updatedFilters.sortBy))") + } else { + print("🔍🔍🔍 PointOfUseListModel.apply: SET filters to nil") + } + print("🔍🔍🔍 PointOfUseListModel.apply: About to call refreshItems()") + #endif
249-251: Gate refreshItems() diagnostic behind DEBUG- print("🔍 PointOfUseListModel.refreshItems: Called with bounds=\(String(describing: currentMapBounds))") + #if DEBUG + print("🔍 PointOfUseListModel.refreshItems: Called with bounds=\(String(describing: currentMapBounds))") + #endif
261-263: Gate _fetch diagnostics behind DEBUG- print("🔍 PointOfUseListModel._fetch: Using bounds=\(String(describing: currentMapBounds)) on model \(Unmanaged.passUnretained(self).toOpaque())") - print("🔍 PointOfUseListModel._fetch: Using filters.radius=\(String(describing: filters?.radius))") + #if DEBUG + print("🔍 PointOfUseListModel._fetch: Using bounds=\(String(describing: currentMapBounds)) on model \(Unmanaged.passUnretained(self).toOpaque())") + print("🔍 PointOfUseListModel._fetch: Using filters.radius=\(String(describing: filters?.radius))") + #endifDashWallet/Sources/Models/Explore Dash/Services/DashSpend/PiggyCards/PiggyCardsEndpoint.swift (2)
70-86: Usecase letpattern once per case to satisfy SwiftLint.This removes repeated
letbindings inside tuples.[Based on static analysis hints]
- case .signup(let firstName, let lastName, let email, let country, let state): + case let .signup(firstName, lastName, email, country, state): let signupRequest = PiggyCardsSignupRequest(firstName: firstName, lastName: lastName, email: email, country: country, state: state) return .requestJSONEncodable(signupRequest) - case .login(let userId, let password): + case let .login(userId, password): let loginRequest = PiggyCardsLoginRequest(userId: userId, password: password) return .requestJSONEncodable(loginRequest) - case .verifyOtp(let email, let otp): + case let .verifyOtp(email, otp): let verifyRequest = PiggyCardsVerifyOtpRequest(email: email, otp: otp) return .requestJSONEncodable(verifyRequest) - case .purchaseGiftCard(let request): + case let .purchaseGiftCard(request): return .requestJSONEncodable(request)
91-96: Prefer full locale in Accept‑Language.Locale.current.languageCode returns “en”; servers often expect “en-US”. Use preferredLanguages first value.
- if let lang = Locale.current.languageCode { - headers["Accept-Language"] = lang - } + if let lang = Locale.preferredLanguages.first { + headers["Accept-Language"] = lang + }DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Filters/MerchantFiltersView.swift (3)
66-67: Fix typo in comment.“multipele” → “multiple”.
- // Sort By Section - Only show if there are multipele options + // Sort By Section - Only show if there are multiple options
51-60: Simplify and make gift card type visibility logic symmetric.Single expression is clearer and avoids duplication across providers.
- private var shouldShowGiftCardTypes: Bool { - if viewModel.showGiftCardTypes && viewModel.ctxGiftCards { - return true - } - #if PIGGYCARDS_ENABLED - return viewModel.showGiftCardTypes && viewModel.piggyGiftCards - #else - return false - #endif - } + private var shouldShowGiftCardTypes: Bool { + #if PIGGYCARDS_ENABLED + return viewModel.showGiftCardTypes && (viewModel.ctxGiftCards || viewModel.piggyGiftCards) + #else + return viewModel.showGiftCardTypes && viewModel.ctxGiftCards + #endif + }
207-208: Avoid stacking multiple .animation modifiers on the same view.Prefer driving animations from actions (withAnimation) or a single .animation to reduce surprises.
- .animation(.easeInOut(duration: 0.3), value: viewModel.ctxGiftCards) - .animation(.easeInOut(duration: 0.3), value: viewModel.sortOptions) + .animation(.easeInOut(duration: 0.3), value: viewModel.ctxGiftCards)Or move animations into the toggle handlers with withAnimation.
DashWallet/Sources/UI/Explore Dash/Views/DashSpend/DashSpendUserAuthScreen.swift (2)
48-55: Rename OTP input hint for clarity.“Password” is misleading; it’s a verification code.
- case .otp: - return NSLocalizedString("Password", comment: "DashSpend") + case .otp: + return NSLocalizedString("Verification code", comment: "DashSpend")
120-131: Hide the disabled text field on OTP screen to avoid duplicate inputs.The numeric keyboard is the sole input; the disabled TextInput adds noise.
- VStack(spacing: 4) { - TextInput( - label: authType.textInputHint, - text: $viewModel.input, - keyboardType: .emailAddress, - autocapitalization: .never, - isEnabled: authType != .otp, - onSubmit: { - viewModel.onContinue() - } - ).focused($isTextFieldFocused) + VStack(spacing: 4) { + if authType != .otp { + TextInput( + label: authType.textInputHint, + text: $viewModel.input, + keyboardType: .emailAddress, + autocapitalization: .never, + isEnabled: true, + onSubmit: { + viewModel.onContinue() + } + ).focused($isTextFieldFocused) + }DashWallet/Sources/Models/Explore Dash/Services/DashSpend/PiggyCards/PiggyCardsRepository.swift (4)
33-33: Drop redundant nil initialization.
@Published private(set) var userEmail: String? = nil→String?defaults to nil.As per SwiftLint hints.
94-151: Complex error parser: split for readability and testability.
parseErroris doing many things (status buckets, two formats, message heuristics). Extract helpers per status family and per payload format to reduce complexity and ease unit testing.As per SwiftLint hints.
68-73: Hard-coded country/state.
"US", "AZ"are hard-coded; consider passing via config/feature flags or deriving from app settings/locale.
237-238: Add trailing newline.Missing final newline breaks some tooling.
As per SwiftLint hints.
DashWallet/Sources/Models/Explore Dash/Infrastructure/DAO Impl/MerchantDAO.swift (2)
166-231: Avoid N+1 queries for gift card providers.Fetching providers per merchant scales poorly. Fetch providers for all relevant
merchantIds in a single query and group in-memory.Also applies to: 395-461
151-161: Gate verbose prints behind DEBUG or remove.The numerous
#if DEBUGor replace with a structured logger at.debuglevel.Also applies to: 241-255, 298-336, 479-486, 540-566
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/POIDetailsViewController.swift (2)
236-236: Fix MARK format.Use the standard MARK syntax.
-// Mark: DashSpend +// MARK: - DashSpendAs per SwiftLint hints.
53-58: Remove no-op override.
viewDidLayoutSubviewsonly calls super. Drop it to reduce noise.As per SwiftLint hints.
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsViewModel.swift (6)
43-43: Avoid implicitly unwrapped optional and guard stopNetworkMonitoringIUO risks a crash; also guard the stop if the observer is not set.
Apply this diff:
- var reachabilityObserver: Any! + var reachabilityObserver: Any?deinit { syncMonitor.remove(observer: self) - stopNetworkMonitoring() + if reachabilityObserver != nil { + stopNetworkMonitoring() + } DWLocationManager.shared.remove(observer: self) }Reference: stopNetworkMonitoring force-unwraps the observer (BaseViewController+NetworkReachability.swift). Guarding avoids a crash if init exits early.
Also applies to: 115-119
18-22: Address SwiftLint warnings (imports, Void return, redundant nils)Minor cleanup to satisfy lint.
Apply this diff:
-import Combine -import Foundation -import CoreLocation -import MapKit +import Combine +import CoreLocation +import Foundation +import MapKit- var networkStatusDidChange: ((NetworkStatus) -> ())? + var networkStatusDidChange: ((NetworkStatus) -> Void)?- @Published private(set) var userEmail: String? = nil + @Published private(set) var userEmail: String?- @Published private(set) var distanceText: String? = nil + @Published private(set) var distanceText: String?- @Published private(set) var selectedProvider: GiftCardProvider? = nil + @Published private(set) var selectedProvider: GiftCardProvider?As per SwiftLint hints.
Also applies to: 42-42, 45-45, 49-49, 51-51
171-177: Prefer a deterministic default provider with available repositoryAvoid non-deterministic Dictionary.first and prefer providers that have repositories compiled in.
Apply this diff:
- // Select the first available provider - selectedProvider = supportedProviders.keys.first - - // Start observing the selected provider - if let selectedProvider = selectedProvider { - observeDashSpendState(provider: selectedProvider) - } + // Select provider that has a repository; fall back to any + if let available = supportedProviders.keys.first(where: { repositories[$0] != nil }) { + selectedProvider = available + } else { + selectedProvider = supportedProviders.keys.first + } + if let selectedProvider = selectedProvider { + observeDashSpendState(provider: selectedProvider) + }
158-166: Batch set supportedProviders to reduce Published churnAccumulate into a local map and assign once to avoid multiple published updates.
Apply this diff:
- // Get gift card providers from the merchant data - for providerInfo in m.giftCardProviders { - guard let provider = providerInfo.provider else { continue } - - let isFixed = providerInfo.denominationsType == DenominationType.Fixed.rawValue - let discount = providerInfo.savingsPercentage - - supportedProviders[provider] = (isFixed: isFixed, discount: discount) - } + // Get gift card providers from the merchant data + var map: [GiftCardProvider: (isFixed: Bool, discount: Int)] = [:] + for providerInfo in m.giftCardProviders { + guard let provider = providerInfo.provider else { continue } + let isFixed = providerInfo.denominationsType == DenominationType.Fixed.rawValue + let discount = providerInfo.savingsPercentage + map[provider] = (isFixed: isFixed, discount: discount) + } + supportedProviders = map
111-113: Reset local auth state on logout to avoid stale UIImmediately reflect logout in the UI; repository will emit definitive state later.
Apply this diff:
func logout(provider: GiftCardProvider) { repositories[provider]?.logout() + isUserSignedIn = false + userEmail = nil }
188-201: Gate verbose prints behind DEBUG or use a loggerThese prints are useful for dev but noisy in production. Prefer a logger with levels or wrap in #if DEBUG.
Also applies to: 211-213, 218-219, 226-230
HashEngineering
left a comment
There was a problem hiding this comment.
These files should be removed:
- DashWallet/explore.db-shm
- DashWallet/explore.db-wal
perhaps added to .gitignore
- 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]>
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (32)
DashWallet/Sources/UI/Explore Dash/Views/DashSpend/DashSpendTermsScreen.swift (1)
128-134: Consider removing the unnecessary Group wrapper.The
Groupwrapper aroundDashSpendUserAuthScreenserves no functional purpose here. You can simplify by directly using the view as the destination.Apply this diff to simplify:
NavigationLink( - destination: Group { - DashSpendUserAuthScreen( - authType: .createAccount, - provider: provider, - onAuthSuccess: onAuthSuccess - ).navigationBarHidden(true) - }, + destination: DashSpendUserAuthScreen( + authType: .createAccount, + provider: provider, + onAuthSuccess: onAuthSuccess + ).navigationBarHidden(true), isActive: $navigateToCreateAccount ) { EmptyView() }CLAUDE.md (4)
309-313: Address markdown linting issueThe fenced code block lacks a language specifier, which reduces readability and syntax highlighting support.
Apply this diff:
-``` +```text ../DashSync/ # Core Dash protocol library ../dapi-grpc/ # gRPC API definitions ../dashwallet-ios/ # This repository--- `379-388`: **SwiftUI ViewBuilder conditional compilation example may confuse developers** The "problematic" example shows `if condition` followed by a conditional compilation directive, but this pattern can work in some contexts (it fails specifically when the conditional compilation splits a boolean expression). The comment "This causes 'buildExpression unavailable' errors" is overly broad—it should specify that this occurs when conditional compilation interrupts SwiftUI's result builder logic. Consider clarifying: ```diff -#### ❌ Problematic: Conditional Compilation in ViewBuilder +#### ❌ Problematic: Conditional Compilation Splitting ViewBuilder Expression ```swift -// This causes "buildExpression unavailable" errors +// This causes "buildExpression unavailable" errors when conditional compilation +// interrupts SwiftUI's result builder transformation if condition #if FEATURE_ENABLED || otherCondition
412-421: Dictionary initialization pattern is misleadingThe "problematic" example shows a trailing comma issue, but the real problem is that when
FEATURE_ENABLEDis undefined, the dictionary ends with a trailing comma before the closing bracket. This is a syntax error in Swift, not a conditional compilation issue per se.Consider revising the explanation:
#### ❌ Problematic: Inline Conditional Compilation ```swift -// This causes syntax errors when flag is undefined +// When FEATURE_ENABLED is undefined, this leaves a trailing comma, +// causing a syntax error let dict = [ .key1: value1, #if FEATURE_ENABLED .key2: value2 #endif ]--- `536-550`: **Bounds expansion calculation doesn't preserve center correctly** Lines 540-541 calculate `latSpan` and `lonSpan` by multiplying the original span by 1.5, but this is then used to calculate new min/max values from the center. The math here expands correctly, but the comment "50% buffer" is misleading—multiplying by 1.5 gives a 50% increase in radius (25% on each side), not a 50% buffer zone around the original bounds. Clarify the comment: ```diff - let latSpan = (bounds.maxLatitude - bounds.minLatitude) * 1.5 // 50% buffer - let lonSpan = (bounds.maxLongitude - bounds.minLongitude) * 1.5 // 50% buffer + let latSpan = (bounds.maxLatitude - bounds.minLatitude) * 1.5 // 1.5x original span + let lonSpan = (bounds.maxLongitude - bounds.minLongitude) * 1.5 // 1.5x original span.claude/agents/EXTERNAL-INTEGRATIONS.md (3)
63-76: Authentication flow example is oversimplifiedThe
authenticate()method showsawait presentWebAuth(authURL)as if it's an async function, but OAuth flows typically involve callback URLs and app delegate handling. This example may mislead developers into thinking OAuth is a simple async/await call.Consider adding a note about the actual complexity:
func authenticate() async throws -> CoinbaseToken { // Note: Actual OAuth flow involves: // 1. Opening Safari/ASWebAuthenticationSession // 2. User completes auth in browser // 3. Callback URL redirects to app // 4. App delegate handles URL and extracts auth code let authURL = buildAuthURL() let authCode = try await presentWebAuth(authURL) // Simplified - see OAuth wrapper pattern below let token = try await exchangeCodeForToken(authCode) try await tokenStorage.store(token) return token }
276-298: Database migration pattern uses forced unwrappingLine 295 uses
db!to force unwrap the database connection. This can crash ifdbis nil (though unlikely afterconnect()succeeds). Consider using guard or if-let for safer unwrapping.Apply this diff:
private func migrateIfNeeded() throws { + guard let database = db else { + throw DatabaseError.notConnected + } + guard let migrationsBundle = Bundle.main.url(forResource: "Migrations", withExtension: "bundle"), let bundle = Bundle(url: migrationsBundle) else { throw DatabaseError.migrationsNotFound } - let migrationManager = SQLiteMigrationManager(db: db!, migrationsBundle: bundle) + let migrationManager = SQLiteMigrationManager(db: database, migrationsBundle: bundle) try migrationManager.migrateDatabase() }
315-327: JWT validation example uses undefinedpublicKeyDataLine 319 references
publicKeyDatawithout showing where it comes from. This could confuse developers implementing JWT validation.Add a property or parameter:
class JWTManager { + private let publicKeyData: Data + + init(publicKeyData: Data) { + self.publicKeyData = publicKeyData + } + func validateToken(_ tokenString: String) throws -> TokenClaims { let jwt = try JWT<TokenClaims>(jwtString: tokenString) // Verify signature (implementation depends on key type) let verifier = JWTVerifier.rs256(publicKey: publicKeyData)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/AllMerchantLocationsViewController.swift (3)
75-75: Remove vertical whitespace after opening brace.SwiftLint flags the empty line after the opening brace on line 74.
Apply this diff:
if let filters = currentFilters { - // Determine if we should remove radius filter based on source tab
75-75: Remove vertical whitespace after opening brace.Minor style issue flagged by SwiftLint.
if let filters = currentFilters { - // Determine if we should remove radius filter based on source tab
74-75: Remove empty line after opening brace.SwiftLint flagged an empty line after the opening brace on line 75. Remove the blank line for consistency.
Apply this diff:
if let filters = currentFilters { - // Determine if we should remove radius filter based on source tabDashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/AllMerchantLocationsDataProvider.swift (4)
91-97: Consider refactoring to reduce parameter count.The
fetchmethod now has 6 parameters, which exceeds the recommended limit. Consider encapsulating related parameters (e.g., bounds, userPoint, filters) into a request object to improve readability and maintainability.Example refactor:
struct FetchRequest { let query: String? let bounds: ExploreMapBounds? let userPoint: CLLocationCoordinate2D? let filters: PointOfUseListFilters? let offset: Int } private func fetch(_ request: FetchRequest, completion: @escaping (Swift.Result<PaginationResult<ExplorePointOfUse>, Error>) -> Void) { dataSource.allLocations(for: pointOfUse.pointOfUseId, in: request.bounds, userPoint: request.userPoint) { result in completion(result) } }
93-93: Remove the empty line after the opening brace.SwiftLint flags vertical whitespace after opening braces as a style issue.
Apply this diff:
private func fetch(by query: String?, in bounds: ExploreMapBounds?, userPoint: CLLocationCoordinate2D?, with filters: PointOfUseListFilters?, offset: Int, completion: @escaping (Swift.Result<PaginationResult<ExplorePointOfUse>, Error>) -> Void) { - dataSource.allLocations(for: pointOfUse.pointOfUseId, in: bounds, userPoint: userPoint) { result in completion(result) } }
36-68: Complex bounds/userPoint logic needs verification.The logic handles three scenarios:
- Radius filter with no bounds (
isShowAllLocationsWithRadius): Creates circular bounds from radius- No bounds, no radius (
isShowAllLocationsGlobally): KeepsuserPointonly for distance sorting- Other cases: Original authorization/permission logic
Concerns:
- The logic is complex and deeply nested, making it hard to follow
- The three scenarios may overlap or conflict in edge cases
- The conditional flow depends on
bounds == nilcombined with filter state, which may be fragileConsider extracting the three scenario handlers into separate private methods:
private func handleRadiusFilteredAllLocations(...) private func handleGlobalAllLocations(...) private func handleStandardLocations(...)This would improve readability and testability. Each method would return the computed
(bounds, userPoint)tuple.
91-96: Address static analysis warnings.SwiftLint flags:
- 6 parameters: The
fetchmethod has 6 parameters, exceeding the recommended 5- Vertical whitespace: Empty line after opening brace (line 93)
Option 1: Group related parameters into a struct:
struct FetchContext { let query: String? let bounds: ExploreMapBounds? let userPoint: CLLocationCoordinate2D? let filters: PointOfUseListFilters? let offset: Int } private func fetch(context: FetchContext, completion: @escaping ...)Option 2: Remove the empty line at line 93 to fix the formatting warning.
Based on learnings
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/POIDetailsViewController.swift (8)
164-192: Consider simplifying radius resolution logic.The radius resolution has multiple fallback paths and checks the parent VC twice (lines 169 and 182). This logic is correct but could be more maintainable.
Consider extracting to a helper method:
private func resolveEffectiveRadius() -> (radius: Double, isFromAllTab: Bool) { // Check if explicit infinite radius is passed (from All tab) if let searchRadius = searchRadius, searchRadius == Double.greatestFiniteMagnitude { return (searchRadius, true) } // Try to get from parent controller if let parentVC = navigationController?.viewControllers.dropLast().last as? ExplorePointOfUseListViewController { let isFromAllTab = parentVC.currentSegment.tag == 2 let radius = parentVC.model.filters?.currentRadius ?? searchRadius ?? kDefaultRadius return (radius, isFromAllTab) } // Fallback to explicit or default return (searchRadius ?? kDefaultRadius, false) }Then use it:
let (effectiveRadius, isFromAllTab) = resolveEffectiveRadius() var detailsView = POIDetailsView(merchant: pointOfUse, isShowAllHidden: isShowAllHidden, searchRadius: effectiveRadius) // ... later ... let searchRadiusToUse = isFromAllTab ? Double.greatestFiniteMagnitude : effectiveRadius
51-55: Remove empty override.This override adds no functionality and can be removed.
- override func viewDidLayoutSubviews() { - super.viewDidLayoutSubviews() - - // Map inset is now handled by the bottom sheet - }As per SwiftLint hints.
30-32: Fix return type syntax per SwiftLint.The return arrow spacing is inconsistent with Swift conventions.
Apply this diff:
- @objc public var payWithDashHandler: (()->())? - @objc var sellDashHandler: (()->())? - @objc var onGiftCardPurchased: ((Data)->())? + @objc public var payWithDashHandler: (() -> Void)? + @objc var sellDashHandler: (() -> Void)? + @objc var onGiftCardPurchased: ((Data) -> Void)?As per SwiftLint hints.
34-35: Consider explicit optionals over implicitly unwrapped.These properties are initialized in
prepareContentView()andshowMapIfNeeded(), but using!risks crashes if accessed before initialization.Apply this diff:
- private var contentView: UIView! - private var mapView: ExploreMapView! + private var contentView: UIView? + private var mapView: ExploreMapView?Then guard-unwrap where used (e.g.,
guard let mapView = mapView else { return }).As per SwiftLint hints.
47-49: Mark unimplemented init as unavailable.The required initializer from storyboards is never used and will crash if called.
Apply this diff:
- required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + }As per SwiftLint hints.
51-55: Remove empty override.This override does nothing and can be deleted.
Apply this diff:
- override func viewDidLayoutSubviews() { - super.viewDidLayoutSubviews() - - // Map inset is now handled by the bottom sheet - }As per SwiftLint hints.
165-173: Simplify radius fallback logic.The nested conditionals for
effectiveRadiuscan be streamlined.Consider this approach:
- let effectiveRadius: Double - if let searchRadius = searchRadius, searchRadius == Double.greatestFiniteMagnitude { - // If explicit infinite radius is passed (from All tab), use that - effectiveRadius = searchRadius - } else if let parentVC = navigationController?.viewControllers.dropLast().last as? ExplorePointOfUseListViewController { - effectiveRadius = parentVC.model.filters?.currentRadius ?? searchRadius ?? kDefaultRadius - } else { - effectiveRadius = searchRadius ?? kDefaultRadius - } + let effectiveRadius = searchRadius ?? (navigationController?.viewControllers.dropLast().last as? ExplorePointOfUseListViewController)?.model.filters?.currentRadius ?? kDefaultRadiusThis reduces nesting while preserving the logic.
230-230: Fix MARK comment format.The MARK comment is missing a dash.
Apply this diff:
-// Mark: DashSpend +// MARK: - DashSpendAs per SwiftLint hints.
DashWallet/Sources/Models/Explore Dash/Infrastructure/DAO Impl/MerchantDAO.swift (4)
177-247: Extract duplicated provider enrichment logic.The gift card provider enrichment code is duplicated in both the post-processing path (lines 177-247) and the SQL-based path (lines 400-470). This makes maintenance harder.
Extract to a helper method:
private func enrichWithProviders(_ items: [ExplorePointOfUse]) throws -> [ExplorePointOfUse] { guard let db = connection.db else { print("Error: Database connection is nil") return items } var enrichedItems = items for (index, item) in enrichedItems.enumerated() { guard let merchant = item.merchant, merchant.paymentMethod == .giftCard else { continue } let providersQuery = """ SELECT provider, savingsPercentage, denominationsType FROM gift_card_providers WHERE merchantId = '\(merchant.merchantId)' """ do { let rows = try db.prepare(providersQuery) var providers: [ExplorePointOfUse.Merchant.GiftCardProviderInfo] = [] for row in rows { if let providerId = row[0] as? String, let savingsPercentage = row[1] as? Int64, let denominationsType = row[2] as? String { providers.append(ExplorePointOfUse.Merchant.GiftCardProviderInfo( providerId: providerId, savingsPercentage: Int(savingsPercentage), denominationsType: denominationsType )) } } if !providers.isEmpty { let updatedMerchant = ExplorePointOfUse.Merchant( merchantId: merchant.merchantId, paymentMethod: merchant.paymentMethod, type: merchant.type, deeplink: merchant.deeplink, savingsBasisPoints: merchant.savingsBasisPoints, denominationsType: merchant.denominationsType, denominations: merchant.denominations, redeemType: merchant.redeemType, giftCardProviders: providers ) let updatedItem = ExplorePointOfUse( id: item.id, name: item.name, category: .merchant(updatedMerchant), active: item.active, city: item.city, territory: item.territory, address1: item.address1, address2: item.address2, address3: item.address3, address4: item.address4, latitude: item.latitude, longitude: item.longitude, website: item.website, phone: item.phone, logoLocation: item.logoLocation, coverImage: item.coverImage, source: item.source ) enrichedItems[index] = updatedItem } } catch { print("Error fetching gift card providers for merchant \(merchant.merchantId): \(error)") } } return enrichedItems }Then replace both duplicated blocks with:
allItems = try wSelf.enrichWithProviders(allItems)and
items = try wSelf.enrichWithProviders(items)Also applies to: 400-470
284-286: Consider guarding coordinate unwraps.While online merchants are filtered out earlier, adding guards would make the code more robust.
- let lat = item.latitude! - let lon = item.longitude! + guard let lat = item.latitude, let lon = item.longitude else { continue }Note: SwiftLint flags force unwrapping.
177-247: Consider extracting provider enrichment.The gift card provider enrichment logic is duplicated in two branches (closest-location and non-closest). Extract to a helper method to reduce duplication.
Example:
private func enrichGiftCardProviders(for items: inout [ExplorePointOfUse], connection: ExploreDatabaseConnection) throws { // Move lines 177-247 logic here }Also applies to: 399-470
570-583: Debug prints in production code.The debug prints (e.g., lines 570, 578, 583) with emoji prefixes are helpful for development but should ideally be behind a debug flag or removed before release.
Consider guarding these with:
#if DEBUG print("🎯 MerchantDAO.allLocations: ...") #endifOr use a configurable logger (e.g.,
OSLog).DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift (1)
522-573: Filter validation logic ensures segment-compatible sort options.The
showFilters()method:
- Validates current sort against segment's
sortOptions- Falls back to segment default (distance for nearby, name otherwise) if invalid
- Applies default sort if none is set
Potential issue: The logic has nested conditionals that could be simplified. Consider this flow:
var effectiveFilters = model.filters ?? PointOfUseListFilters() let segmentSortOptions = currentSegment.sortOptions let defaultSortBy: PointOfUseListFilters.SortBy = ... if effectiveFilters.sortBy == nil || !segmentSortOptions.contains(effectiveFilters.sortBy!) { effectiveFilters = PointOfUseListFilters( sortBy: defaultSortBy, merchantPaymentTypes: effectiveFilters.merchantPaymentTypes, radius: effectiveFilters.radius, territory: effectiveFilters.territory, denominationType: effectiveFilters.denominationType ) }This flattens the nested structure and handles both cases (invalid/nil) uniformly.
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsViewModel.swift (4)
97-109: Consider refreshing location count on location changes.A past review suggested calling
fetchLocationCount()in these handlers. WhileupdateDistance()is called, the location count might become stale until the radius changes.nonisolated func locationManagerDidChangeCurrentLocation(_ manager: DWLocationManager, location: CLLocation) { Task { @MainActor in self.updateDistance() + self.fetchLocationCount() } } nonisolated func locationManagerDidChangeServiceAvailability(_ manager: DWLocationManager) { Task { @MainActor in self.updateDistance() + self.fetchLocationCount() } }Based on past review comments.
18-21: Sort imports per SwiftLint.Imports should be alphabetically sorted.
Apply this diff:
import Combine -import Foundation import CoreLocation +import Foundation import MapKitAs per SwiftLint hints.
42-43: Fix return type and optional declaration.Line 42 should use
-> Voidinstead of-> (), and line 43's implicitly unwrapped optional should be explicit.Apply this diff:
- var networkStatusDidChange: ((NetworkStatus) -> ())? - var reachabilityObserver: Any! + var networkStatusDidChange: ((NetworkStatus) -> Void)? + var reachabilityObserver: Any?As per SwiftLint hints.
45-53: Remove redundant nil initializers.Lines 45, 49, and 51 initialize optionals with
nil, which is redundant.Apply this diff:
- @Published private(set) var userEmail: String? = nil + @Published private(set) var userEmail: String? @Published private(set) var isUserSignedIn = false @Published private(set) var networkStatus: NetworkStatus = .offline @Published private(set) var syncState: SyncingActivityMonitor.State = .unknown - @Published private(set) var distanceText: String? = nil + @Published private(set) var distanceText: String? @Published private(set) var supportedProviders: [GiftCardProvider: (isFixed: Bool, discount: Int)] = [:] - @Published private(set) var selectedProvider: GiftCardProvider? = nil + @Published private(set) var selectedProvider: GiftCardProvider? @Published private(set) var showProviderPicker: Bool = false @Published private(set) var locationCount: Int = 0As per SwiftLint hints.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (16)
.claude/agents/AI-DEVELOPMENT-GUIDE.md(1 hunks).claude/agents/EXTERNAL-INTEGRATIONS.md(1 hunks)CLAUDE.md(1 hunks)DashWallet/Sources/Models/Explore Dash/Infrastructure/DAO Impl/MerchantDAO.swift(7 hunks)DashWallet/Sources/Models/Explore Dash/Services/DWLocationManager.swift(1 hunks)DashWallet/Sources/Models/Explore Dash/Services/DashSpend/DashSpendError.swift(1 hunks)DashWallet/Sources/Models/Explore Dash/Services/DashSpend/DashSpendRepository.swift(1 hunks)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/POIDetailsViewController.swift(1 hunks)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsViewModel.swift(1 hunks)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/AllMerchantLocationsViewController.swift(2 hunks)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift(7 hunks)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/MerchantListViewController.swift(4 hunks)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/AllMerchantLocationsDataProvider.swift(2 hunks)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/MerchantsDataProvider.swift(4 hunks)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/PointOfUseListModel.swift(3 hunks)DashWallet/Sources/UI/Explore Dash/Views/DashSpend/DashSpendTermsScreen.swift(4 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- .claude/agents/AI-DEVELOPMENT-GUIDE.md
- DashWallet/Sources/Models/Explore Dash/Services/DashSpend/DashSpendRepository.swift
👮 Files not reviewed due to content moderation or server errors (11)
- DashWallet/Sources/Models/Explore Dash/Services/DashSpend/DashSpendError.swift
- DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/PointOfUseListModel.swift
- DashWallet/Sources/Models/Explore Dash/Services/DWLocationManager.swift
- DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/MerchantsDataProvider.swift
- DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/AllMerchantLocationsViewController.swift
- DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/MerchantListViewController.swift
- DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/AllMerchantLocationsDataProvider.swift
- DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift
- DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/POIDetailsViewController.swift
- DashWallet/Sources/Models/Explore Dash/Infrastructure/DAO Impl/MerchantDAO.swift
- DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsViewModel.swift
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-09-05T18:32:21.463Z
Learnt from: HashEngineering
PR: dashpay/dashwallet-ios#729
File: DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift:67-67
Timestamp: 2025-09-05T18:32:21.463Z
Learning: The radius property in ExplorePointOfUseListViewController is confirmed unused after code analysis. Radius functionality is properly handled through model.currentRadius and filters?.currentRadius, making the controller property redundant and safe to remove.
Applied to files:
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swiftDashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/POIDetailsViewController.swiftDashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/AllMerchantLocationsViewController.swiftDashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/MerchantListViewController.swift
📚 Learning: 2025-09-05T18:32:21.463Z
Learnt from: HashEngineering
PR: dashpay/dashwallet-ios#729
File: DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift:67-67
Timestamp: 2025-09-05T18:32:21.463Z
Learning: The radius property in ExplorePointOfUseListViewController is unused and should be removed. Radius functionality is handled through the model.currentRadius and filters system instead of a controller-level property.
Applied to files:
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swiftDashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/AllMerchantLocationsViewController.swiftDashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/MerchantListViewController.swift
📚 Learning: 2025-09-27T15:37:44.423Z
Learnt from: bfoss765
PR: dashpay/dashwallet-ios#732
File: DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/POIDetailsViewController.swift:94-96
Timestamp: 2025-09-27T15:37:44.423Z
Learning: User bfoss765 prefers to defer fixing force unwrapping warnings until crashes are observed during testing, rather than proactively addressing them.
Applied to files:
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/POIDetailsViewController.swift
📚 Learning: 2025-09-27T15:36:10.761Z
Learnt from: bfoss765
PR: dashpay/dashwallet-ios#732
File: DashWallet/Sources/Models/Explore Dash/Services/DashSpend/PiggyCards/PiggyCardsRepository.swift:21-23
Timestamp: 2025-09-27T15:36:10.761Z
Learning: In PiggyCardsRepository.swift, there's an ACL mismatch (public static let shared in an internal class) and potential thread safety concerns that will be addressed during dedicated PiggyCards development rather than in the current UI improvements PR.
Applied to files:
DashWallet/Sources/Models/Explore Dash/Services/DashSpend/DashSpendError.swiftDashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsViewModel.swift
🧬 Code graph analysis (10)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/MerchantsDataProvider.swift (4)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/AllMerchantLocationsDataProvider.swift (2)
fetch(91-97)nextPage(85-89)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/PointOfUseListModel.swift (3)
fetch(226-229)handle(76-92)nextPage(72-74)DashWallet/Sources/Models/Explore Dash/Infrastructure/DAO Impl/MerchantDAO.swift (3)
allMerchants(500-505)nearbyMerchants(493-498)onlineMerchants(482-491)DashWallet/Sources/Models/Explore Dash/ExploreDash.swift (3)
allMerchants(183-189)nearbyMerchants(177-181)onlineMerchants(171-175)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift (6)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Views/ExploreMapView.swift (7)
mapView(239-244)mapView(246-256)mapView(272-278)setCenter(171-179)mapBounds(112-114)showUserLocationInCenter(181-185)show(138-169)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/MerchantsDataProvider.swift (3)
fetch(47-55)fetch(93-99)fetch(129-136)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/PointOfUseListModel.swift (2)
fetch(226-229)apply(206-209)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/MerchantListViewController.swift (1)
show(190-201)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Views/PointOfUseLocationServicePopup.swift (2)
show(123-133)show(135-139)DashWallet/Sources/Models/Explore Dash/Services/DWLocationManager.swift (1)
requestAuthorization(93-96)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/PointOfUseListModel.swift (5)
DashWallet/Sources/Models/Explore Dash/Infrastructure/DAO Impl/MerchantDAO.swift (2)
items(38-39)items(42-478)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/MerchantsDataProvider.swift (3)
items(24-37)items(61-84)items(105-120)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/AllMerchantLocationsDataProvider.swift (1)
items(30-83)DashWallet/Sources/Models/Explore Dash/Infrastructure/DAO Impl/AtmDAO.swift (1)
items(35-92)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/AtmDataProvider.swift (1)
items(26-56)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/POIDetailsViewController.swift (6)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift (3)
viewDidLoad(171-215)configureHierarchy(361-517)show(143-150)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/MerchantListViewController.swift (3)
viewDidLoad(277-303)configureHierarchy(269-275)show(190-201)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsView.swift (3)
payAction(500-514)callAction(480-484)websiteAction(495-498)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Views/ExploreMapView.swift (2)
setContentInsets(187-196)setCenter(171-179)DashWallet/Sources/Categories/UIHostingController+DashWallet.swift (1)
setDetent(21-31)DashWallet/Sources/Models/Explore Dash/Services/DashSpend/CTX/CTXSpendRepository.swift (1)
refreshToken(129-131)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/AllMerchantLocationsViewController.swift (2)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift (2)
apply(864-873)refreshView(875-879)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/PointOfUseListModel.swift (3)
apply(206-209)refreshItems(222-224)clearCache(53-60)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/AllMerchantLocationsDataProvider.swift (3)
DashWallet/Sources/Models/Explore Dash/Infrastructure/DAO Impl/MerchantDAO.swift (3)
items(38-39)items(42-478)allLocations(507-592)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/MerchantsDataProvider.swift (6)
items(24-37)items(61-84)items(105-120)fetch(47-55)fetch(93-99)fetch(129-136)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/AtmDataProvider.swift (2)
items(26-56)fetch(65-70)
DashWallet/Sources/Models/Explore Dash/Services/DWLocationManager.swift (3)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsViewModel.swift (1)
locationManagerDidChangeCurrentLocation(97-101)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift (1)
locationManagerDidChangeCurrentLocation(284-299)DashWallet/Sources/UI/Buy Sell/BuySellPortalViewController.swift (1)
locationManagerDidChangeCurrentLocation(226-238)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/MerchantListViewController.swift (3)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift (2)
apply(864-873)updateAppliedFiltersView(575-581)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/PointOfUseListModel.swift (1)
apply(206-209)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/AllMerchantLocationsViewController.swift (1)
viewWillAppear(114-127)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsViewModel.swift (6)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift (2)
locationManagerDidChangeCurrentLocation(284-299)locationManagerDidChangeServiceAvailability(301-317)DashWallet/Sources/Models/Explore Dash/Services/DWLocationManager.swift (2)
remove(105-108)add(98-103)DashWallet/Sources/UI/Views/BaseController/BaseViewController+NetworkReachability.swift (2)
stopNetworkMonitoring(52-54)startNetworkMonitoring(36-50)DashWallet/Sources/Models/Explore Dash/Infrastructure/DAO Impl/MerchantDAO.swift (3)
allLocations(507-592)items(38-39)items(42-478)DashWallet/Sources/Models/Explore Dash/ExploreDash.swift (1)
allLocations(191-194)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/AllMerchantLocationsDataProvider.swift (1)
items(30-83)
DashWallet/Sources/Models/Explore Dash/Infrastructure/DAO Impl/MerchantDAO.swift (4)
DashWallet/Sources/Models/Explore Dash/Infrastructure/Database Connection/ExploreDatabaseConnection.swift (2)
execute(87-105)execute(107-117)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/MerchantsDataProvider.swift (3)
items(24-37)items(61-84)items(105-120)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/AllMerchantLocationsDataProvider.swift (1)
items(30-83)DashWallet/Sources/Models/Explore Dash/ExploreDash.swift (2)
nearbyMerchants(177-181)allMerchants(183-189)
🪛 markdownlint-cli2 (0.18.1)
CLAUDE.md
309-309: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🪛 SwiftLint (0.57.0)
DashWallet/Sources/UI/Explore Dash/Views/DashSpend/DashSpendTermsScreen.swift
[Warning] 21-21: Attributes with arguments or inside always_on_line_above must be on a new line instead of the same line
(attributes)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/POIDetailsViewController.swift
[Warning] 475-475: Attributes should be on their own lines in functions and types, but on the same line as variables and imports
(attributes)
[Warning] 92-92: Force unwrapping should be avoided
(force_unwrapping)
[Warning] 92-92: Force unwrapping should be avoided
(force_unwrapping)
[Warning] 247-247: Force unwrapping should be avoided
(force_unwrapping)
[Warning] 34-34: Implicitly unwrapped optionals should be avoided when possible
(implicitly_unwrapped_optional)
[Warning] 35-35: Implicitly unwrapped optionals should be avoided when possible
(implicitly_unwrapped_optional)
[Warning] 391-391: Implicitly unwrapped optionals should be avoided when possible
(implicitly_unwrapped_optional)
[Warning] 394-394: Implicitly unwrapped optionals should be avoided when possible
(implicitly_unwrapped_optional)
[Warning] 395-395: Implicitly unwrapped optionals should be avoided when possible
(implicitly_unwrapped_optional)
[Warning] 396-396: Implicitly unwrapped optionals should be avoided when possible
(implicitly_unwrapped_optional)
[Warning] 397-397: Implicitly unwrapped optionals should be avoided when possible
(implicitly_unwrapped_optional)
[Warning] 30-30: Ensure declarations have a lower access control level than their enclosing parent
(lower_acl_than_parent)
[Warning] 38-38: Ensure declarations have a lower access control level than their enclosing parent
(lower_acl_than_parent)
[Warning] 230-230: MARK comment should be in valid format. e.g. '// MARK: ...' or '// MARK: - ...'
(mark)
[Warning] 424-424: Prefer object literals over image and color inits
(object_literal)
[Warning] 30-30: Return arrow and return type should be separated by a single space or on a separate line
(return_arrow_whitespace)
[Warning] 31-31: Return arrow and return type should be separated by a single space or on a separate line
(return_arrow_whitespace)
[Warning] 32-32: Return arrow and return type should be separated by a single space or on a separate line
(return_arrow_whitespace)
[Warning] 20-20: Imports should be sorted
(sorted_imports)
[Warning] 47-47: Unimplemented functions should be marked as unavailable
(unavailable_function)
[Warning] 51-51: Remove overridden functions that don't do anything except call their super
(unneeded_override)
[Warning] 63-63: Don't include vertical whitespace (empty line) before closing braces
(vertical_whitespace_closing_braces)
[Warning] 30-30: Prefer -> Void over -> ()
(void_return)
[Warning] 31-31: Prefer -> Void over -> ()
(void_return)
[Warning] 32-32: Prefer -> Void over -> ()
(void_return)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/AllMerchantLocationsViewController.swift
[Warning] 75-75: Don't include vertical whitespace (empty line) after opening braces
(vertical_whitespace_opening_braces)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/AllMerchantLocationsDataProvider.swift
[Warning] 91-91: Function should have 5 parameters or less: it currently has 6
(function_parameter_count)
[Warning] 93-93: Don't include vertical whitespace (empty line) after opening braces
(vertical_whitespace_opening_braces)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsViewModel.swift
[Warning] 43-43: Implicitly unwrapped optionals should be avoided when possible
(implicitly_unwrapped_optional)
[Warning] 45-45: Initializing an optional variable with nil is redundant
(redundant_optional_initialization)
[Warning] 49-49: Initializing an optional variable with nil is redundant
(redundant_optional_initialization)
[Warning] 51-51: Initializing an optional variable with nil is redundant
(redundant_optional_initialization)
[Warning] 20-20: Imports should be sorted
(sorted_imports)
[Warning] 42-42: Prefer -> Void over -> ()
(void_return)
DashWallet/Sources/Models/Explore Dash/Infrastructure/DAO Impl/MerchantDAO.swift
[Warning] 284-284: Force unwrapping should be avoided
(force_unwrapping)
[Warning] 285-285: Force unwrapping should be avoided
(force_unwrapping)
[Warning] 493-493: Function should have 5 parameters or less: it currently has 8
(function_parameter_count)
[Warning] 500-500: Function should have 5 parameters or less: it currently has 8
(function_parameter_count)
[Warning] 570-570: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 578-578: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 578-578: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
- 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]>
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)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/MerchantsDataProvider.swift (1)
106-111: Crash risk: force-unwrapping lastBounds in nextPage.nextPage force-unwraps lastBounds; if called before a successful items() load, this will crash. Guard and early-return.
- fetch(by: lastQuery, in: lastBounds!, userPoint: lastUserPoint, with: lastFilters, + guard let bounds = lastBounds, let userPoint = lastUserPoint else { + completion(.success([])) + return + } + fetch(by: lastQuery, in: bounds, userPoint: userPoint, with: lastFilters, offset: nextOffset) { [weak self] result inDashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/MerchantListViewController.swift (1)
110-113: Typo in user-facing string (“redius”)Fix spelling to “radius”.
- NSLocalizedString("Your location is used to show your position on the map, merchants in the selected redius and improve search results.", + NSLocalizedString("Your location is used to show your position on the map, merchants in the selected radius and improve search results.",
♻️ Duplicate comments (13)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsViewModel.swift (3)
242-253: Fix US phone formatting (“+” denotes country code).Render as +1 (US) with standard grouping; consider CNPhoneNumberFormatter for locale-aware output.
- // Format as US phone number if it has 10 digits + // Format as US phone number (assume +1) when possible if digits.count == 10 { let areaCode = String(digits.prefix(3)) let exchange = String(digits.dropFirst(3).prefix(3)) let number = String(digits.suffix(4)) - return "+\(areaCode) \(exchange) \(number)" + return "+1 (\(areaCode)) \(exchange)-\(number)" } else if digits.count == 11 && digits.hasPrefix("1") { let areaCode = String(digits.dropFirst().prefix(3)) let exchange = String(digits.dropFirst(4).prefix(3)) let number = String(digits.suffix(4)) - return "+\(areaCode) \(exchange) \(number)" + return "+1 (\(areaCode)) \(exchange)-\(number)" }
79-90: Ensure Combine updates hop to the main thread.Sinks assign to @published UI state; add receive(on:) to avoid main-actor violations.
- repository.isUserSignedInPublisher + repository.isUserSignedInPublisher + .receive(on: DispatchQueue.main) .sink { [weak self] isSignedIn in self?.isUserSignedIn = isSignedIn } .store(in: &cancellableBag) - repository.userEmailPublisher + repository.userEmailPublisher + .receive(on: DispatchQueue.main) .sink { [weak self] email in self?.userEmail = email } .store(in: &cancellableBag)
99-111: Update locationCount when location/service changes.Distance updates alone leave a stale count; refresh alongside.
nonisolated func locationManagerDidChangeCurrentLocation(_ manager: DWLocationManager, location: CLLocation) { Task { @MainActor in self.updateDistance() + self.fetchLocationCount() } } ... nonisolated func locationManagerDidChangeServiceAvailability(_ manager: DWLocationManager) { Task { @MainActor in self.updateDistance() + self.fetchLocationCount() } }DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/POIDetailsViewController.swift (2)
94-96: Avoid force-unwrapping latitude/longitude when centering the map.Guard lat/lon to prevent a crash on missing coordinates.
- mapView.initialCenterLocation = .init(latitude: pointOfUse.latitude!, longitude: pointOfUse.longitude!) + guard let lat = pointOfUse.latitude, let lon = pointOfUse.longitude else { return } + mapView.initialCenterLocation = .init(latitude: lat, longitude: lon)
249-250: Avoid force-unwrapping Terms URL.Validate before opening to prevent a crash.
- UIApplication.shared.open(URL(string: provider.termsUrl)!, options: [:], completionHandler: nil) + if let url = URL(string: provider.termsUrl) { + UIApplication.shared.open(url, options: [:], completionHandler: nil) + }DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsView.swift (6)
85-87: Guard against empty/whitespace website strings before rendering cardAvoid showing a non-functional button for empty values.
- if merchant.website != nil { + if let website = merchant.website, + !website.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { websiteCardView }
146-148: Remove force unwrap in hasContactInfoUse safe optional checks to prevent crashes and satisfy SwiftLint.
- private var hasContactInfo: Bool { - (merchant.phone != nil && !merchant.phone!.isEmpty) || merchant.website != nil - } + private var hasContactInfo: Bool { + (merchant.phone?.isEmpty == false) || (merchant.website?.isEmpty == false) + }
443-451: Disable “Buy a Gift Card” until a provider is selectedPrevents enabled CTA with no provider chosen.
private var isButtonEnabled: Bool { guard case .merchant(let m) = merchant.category, m.paymentMethod == .giftCard else { return true } - - return merchant.active && - viewModel.networkStatus == .online && - viewModel.syncState == .syncDone + + let hasSelection = !viewModel.showProviderPicker || (viewModel.selectedProvider != nil) + return merchant.active && + viewModel.networkStatus == .online && + viewModel.syncState == .syncDone && + hasSelection }
482-486: Sanitize phone and use tel:// schemeSpaces/symbols break telprompt URLs; sanitize and switch to tel.
- private func callAction() { - guard let phone = merchant.phone, !phone.isEmpty else { return } - guard let url = URL(string: "telprompt://\(phone)") else { return } - UIApplication.shared.open(url) - } + private func callAction() { + guard let phone = merchant.phone, !phone.isEmpty else { return } + let trimmed = phone.trimmingCharacters(in: .whitespacesAndNewlines) + let sanitized: String = { + if trimmed.hasPrefix("+") { + return "+" + trimmed.dropFirst().filter(\.isNumber) + } else { + return trimmed.filter(\.isNumber) + } + }() + guard let url = URL(string: "tel://\(sanitized)") else { return } + UIApplication.shared.open(url) + }
497-500: Sanitize website URL (prepend https:// if missing)Raw domains without scheme won’t open.
- private func websiteAction() { - guard let website = merchant.website, let url = URL(string: website) else { return } - UIApplication.shared.open(url) - } + private func websiteAction() { + guard var website = merchant.website, !website.isEmpty else { return } + website = website.trimmingCharacters(in: .whitespacesAndNewlines) + let lower = website.lowercased() + if !lower.hasPrefix("http://") && !lower.hasPrefix("https://") { + website = "https://\(website)" + } + guard let url = URL(string: website) else { return } + UIApplication.shared.open(url) + }
502-516: Guard gift-card pay path when no provider is selectedAvoid falling through to payWithDash for gift-card merchants without a provider.
- } else if case .merchant(let m) = merchant.category, m.paymentMethod == .giftCard, - let selectedProvider = viewModel.selectedProvider { - if viewModel.isUserSignedIn { - buyGiftCardHandler?(selectedProvider) - } else { - dashSpendAuthHandler?(selectedProvider) - } + } else if case .merchant(let m) = merchant.category, m.paymentMethod == .giftCard { + guard let selectedProvider = viewModel.selectedProvider else { return } + if viewModel.isUserSignedIn { + buyGiftCardHandler?(selectedProvider) + } else { + dashSpendAuthHandler?(selectedProvider) + } } else { payWithDashHandler?() }DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/AllMerchantLocationsViewController.swift (1)
97-105: Preserve all filter fields when forwarding to detail screenReconstructing a new struct drops newer fields (e.g., spending options/provider selections). Start from the incoming filters and override only sort/radius.
- let modifiedFilters = PointOfUseListFilters( - sortBy: sortBy, - merchantPaymentTypes: filters.merchantPaymentTypes, - radius: shouldRemoveRadius ? nil : filters.radius, // Only remove radius for All tab - territory: filters.territory, - denominationType: filters.denominationType - ) - model.apply(filters: modifiedFilters) + var modifiedFilters = filters + modifiedFilters.sortBy = sortBy + if shouldRemoveRadius { modifiedFilters.radius = nil } + model.apply(filters: modifiedFilters)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/MerchantListViewController.swift (1)
193-197: Don’t use Double.greatestFiniteMagnitude for searchRadius (map overflow risk)Passing this value can overflow MKMapRect when any consumer builds an MKCircle with it, leading to blank/NaN maps. Use nil (unbounded) and ensure downstream treats nil as “no radius” without creating an MKCircle.
Apply this diff:
- let isAllTab = currentSegment.tag == 2 - let searchRadius: Double? = isAllTab ? Double.greatestFiniteMagnitude : model.filters?.currentRadius + let isAllTab = currentSegment.tag == 2 + let searchRadius: Double? = isAllTab ? nil : model.filters?.currentRadiusAlso prefer avoiding magic numbers:
- let isAllTab = currentSegment.tag == 2 + let isAllTab = (currentSegment == MerchantsListSegment.all)
🧹 Nitpick comments (29)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Views/ExploreMapAnnotationView.swift (1)
31-34: UseHasherfor computing hash value.The direct use of
.hashValueis deprecated in modern Swift. For NSObject subclasses overriding thehashproperty, construct aHasher, combine the relevant properties, and finalize it.Apply this diff:
- // Override hash to use merchant ID for consistent hashing - override var hash: Int { - merchant.id.hashValue - } + // Override hash to use merchant ID for consistent hashing + override var hash: Int { + var hasher = Hasher() + hasher.combine(merchant.id) + return hasher.finalize() + }DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/MerchantsDataProvider.swift (2)
72-77: Gate verbose debug prints behind DEBUG (avoid noisy logs in release).Wrap these with #if DEBUG or use os.Logger with appropriate level.
- print("🔍 NEARBY: Checking cache...") + #if DEBUG + print("🔍 NEARBY: Checking cache...") print("🔍 NEARBY: lastBounds == bounds? \(String(describing: lastBounds == bounds))") print("🔍 NEARBY: lastQuery == query? \(lastQuery == query)") print("🔍 NEARBY: !items.isEmpty? \(!items.isEmpty)") print("🔍 NEARBY: lastFilters == filters? \(String(describing: lastFilters == filters))") + #endif
84-101: Release logging of precise coordinates.Coordinates can be sensitive; gate these prints or reduce precision in release builds.
- print("🔍 NEARBY: Bounds - NE=(\(bounds.neCoordinate.latitude), \(bounds.neCoordinate.longitude)), SW=(\(bounds.swCoordinate.latitude), \(bounds.swCoordinate.longitude))") - print("🔍 NEARBY: User location = \(userLocation.latitude), \(userLocation.longitude)") + #if DEBUG + print("🔍 NEARBY: Bounds and user location set") + #endifDashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/POIDetailsViewController.swift (4)
232-232: Fix MARK format.Use “// MARK: - …” to satisfy SwiftLint.
-// Mark: DashSpend +// MARK: - DashSpend
53-58: Remove no-op override of viewDidLayoutSubviews.It only calls super and a comment; delete to appease SwiftLint “unneeded_override”.
35-36: Prefer avoiding implicitly unwrapped optionals for views.Switch to optionals with guarded use or lazy properties to avoid IUO risks.
- private var contentView: UIView! - private var mapView: ExploreMapView! + private var contentView: UIView? + private var mapView: ExploreMapView?Follow-up: add guards at use sites.
259-263: Capture self weakly in SwiftUI callback to avoid retain cycles.Be consistent with other handlers.
- rootView: DashSpendTermsScreen(provider: provider) { - self.navigationController?.popToViewController(ofType: POIDetailsViewController.self, animated: false) - self.showDashSpendPayScreen(provider: provider, justAuthenticated: true) - } + rootView: DashSpendTermsScreen(provider: provider) { [weak self] in + self?.navigationController?.popToViewController(ofType: POIDetailsViewController.self, animated: false) + self?.showDashSpendPayScreen(provider: provider, justAuthenticated: true) + }DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsViewModel.swift (1)
46-55: Minor: redundant “= nil” initializers on optionals.You can drop explicit “= nil” on @published optionals for brevity.
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsView.swift (5)
494-494: Fix SwiftLint colon spacing in launchOptionsRemove the space before the colon key.
- mapItem.openInMaps(launchOptions: [MKLaunchOptionsDirectionsModeKey : MKLaunchOptionsDirectionsModeDriving]) + mapItem.openInMaps(launchOptions: [MKLaunchOptionsDirectionsModeKey: MKLaunchOptionsDirectionsModeDriving])As per SwiftLint hints.
18-21: Sort imports alphabetically (SwiftLint: sorted_imports)Reorder to MapKit, SDWebImageSwiftUI, SwiftUI (or your project’s convention).
-import SwiftUI -import MapKit -import SDWebImageSwiftUI +import MapKit +import SDWebImageSwiftUI +import SwiftUIAs per SwiftLint hints.
349-358: Place @ViewBuilder on the same line as the property (SwiftLint: attributes)Conforms to rule for variables.
- @ViewBuilder - private var countryRestrictionView: some View { + @ViewBuilder private var countryRestrictionView: some View { if case .merchant(let m) = merchant.category, m.paymentMethod == .giftCard { Text(NSLocalizedString("This card works only in the United States.", comment: "DashSpend")) .font(.system(size: 13)) .foregroundColor(.secondaryText) .multilineTextAlignment(.center) .padding(.bottom, 8) } }As per SwiftLint hints.
376-401: Ditto: move @ViewBuilder onto the same line for loginStatusViewKeeps attribute placement consistent.
- @ViewBuilder - private var loginStatusView: some View { + @ViewBuilder private var loginStatusView: some View { if case .merchant(let m) = merchant.category, m.paymentMethod == .giftCard, viewModel.isUserSignedIn { HStack(spacing: 6) { Text(providerLoginText) .font(.system(size: 13)) .foregroundColor(.secondaryText) .lineLimit(1) .truncationMode(.head) Button(action: { if let selectedProvider = viewModel.selectedProvider { viewModel.logout(provider: selectedProvider) } }) { Text(NSLocalizedString("Log Out", comment: "Log out button")) .font(.system(size: 13)) .foregroundColor(.secondaryText) .underline() } } .frame(height: 20) } }As per SwiftLint hints.
349-358: Text on country restriction is hardcoded to US—verify business ruleIf providers differ by region or feature flags, this should be sourced from provider metadata or feature config.
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/PointOfUseListModel.swift (2)
159-169: Gate verbose debug prints behind DEBUGThese prints will spam logs in production. Wrap with #if DEBUG or a logger with levels.
- if let searchCenter = searchCenterCoordinate { - print("🔍 MODEL: Using searchCenterCoordinate = \(searchCenter.latitude), \(searchCenter.longitude)") + if let searchCenter = searchCenterCoordinate { + #if DEBUG + print("🔍 MODEL: Using searchCenterCoordinate = \(searchCenter.latitude), \(searchCenter.longitude)") + #endif return searchCenter } let location = DWLocationManager.shared.currentLocation - print("🔍 MODEL: Using device GPS location = \(location?.coordinate.latitude ?? 0), \(location?.coordinate.longitude ?? 0)") + #if DEBUG + print("🔍 MODEL: Using device GPS location = \(location?.coordinate.latitude ?? 0), \(location?.coordinate.longitude ?? 0)") + #endif return location?.coordinate
53-61: clearCache addition is useful—consider exposing on model to fan out to providerYou already call provider.clearCache() from a VC; adding a model-level convenience that delegates to currentDataProvider can reduce coupling to segment internals.
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/AllMerchantLocationsViewController.swift (4)
125-131: Call clearCache via currentDataProvider, not segment copyAvoid going through the struct property on currentSegment; use the model’s provider to prevent accidental drift if segments change.
- model.currentSegment.dataProvider.clearCache() + model.currentDataProvider?.clearCache()
119-132: Avoid duplicate fetches on appearYou fetch in viewDidLoad and again in viewWillAppear; this doubles work. Pick one lifecycle point after bounds are set (likely viewWillAppear).
- // Trigger initial data fetch - model.refreshItems() + // Initial fetch is done on viewWillAppear after updating bounds
81-95: Sentinel for “All tab” via exact Double.greatestFiniteMagnitude is brittlePrefer an explicit boolean parameter (e.g., isFromAllTab) or a domain constant, or compare with a tolerance/flag rather than exact double equality.
85-95: Gate prints behind DEBUGThe controller is quite chatty; wrap with #if DEBUG or unify via a logger.
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Views/ExploreMapView.swift (3)
218-229: Tons of debug prints—wrap with DEBUG or a loggerThe map view is extremely verbose; gate logs to avoid performance/noise in production.
Example:
- print("🔍 MAP: setCenter called with \(location.coordinate.latitude), \(location.coordinate.longitude)") + #if DEBUG + print("🔍 MAP: setCenter called with \(location.coordinate.latitude), \(location.coordinate.longitude)") + #endifAlso applies to: 246-257, 343-351, 368-399, 406-430
224-249: Operator spacing (SwiftLint)Add spaces around operators (e.g., miles / 69.0).
- let span = MKCoordinateSpan(latitudeDelta: miles/69.0, longitudeDelta: miles/(scalingFactor*69.0)) + let span = MKCoordinateSpan(latitudeDelta: miles / 69.0, longitudeDelta: miles / (scalingFactor * 69.0))Apply similarly throughout. As per SwiftLint hints.
Also applies to: 347-350, 379-383, 421-424
406-430: Invalidate stabilization timer on deinitAvoid stray timers.
class ExploreMapView: UIView { @@ private func checkRegionStabilization() { ... } + + deinit { + regionStabilizationTimer?.invalidate() + }DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/MerchantListViewController.swift (2)
263-306: Gate verbose prints and avoid force unwrap in logConvert these prints to a debug-only logger and avoid
!onsearchCenterCoordinate.- print("🔍 VIEW: viewWillAppear called") - print("🔍 VIEW: Current GPS location = \(DWLocationManager.shared.currentLocation?.coordinate.latitude ?? 0), \(DWLocationManager.shared.currentLocation?.coordinate.longitude ?? 0)") - print("🔍 VIEW: Current searchCenterCoordinate = \(model.searchCenterCoordinate?.latitude ?? 0), \(model.searchCenterCoordinate?.longitude ?? 0)") + #if DEBUG + print("🔍 VIEW: viewWillAppear called") + print("🔍 VIEW: Current GPS location = \(DWLocationManager.shared.currentLocation?.coordinate.latitude ?? 0), \(DWLocationManager.shared.currentLocation?.coordinate.longitude ?? 0)") + let scc = model.searchCenterCoordinate + print("🔍 VIEW: Current searchCenterCoordinate = \(scc?.latitude ?? 0), \(scc?.longitude ?? 0)") + #endif @@ - } else { - print("🔍 VIEW: Returning from within flow, preserving panned location at (\(model.searchCenterCoordinate!.latitude), \(model.searchCenterCoordinate!.longitude))") - } + } else { + #if DEBUG + if let coord = model.searchCenterCoordinate { + print("🔍 VIEW: Returning from within flow, preserving panned location at (\(coord.latitude), \(coord.longitude))") + } + #endif + }
308-318: Gate prints here as wellKeep these logs under DEBUG to avoid noisy production logs.
- print("🔍 VIEW: viewWillDisappear - leaving screen, clearing searchCenterCoordinate") + #if DEBUG + print("🔍 VIEW: viewWillDisappear - leaving screen, clearing searchCenterCoordinate") + #endif @@ - print("🔍 VIEW: viewWillDisappear - navigating to child view, preserving searchCenterCoordinate") + #if DEBUG + print("🔍 VIEW: viewWillDisappear - navigating to child view, preserving searchCenterCoordinate") + #endifDashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift (5)
285-312: Throttle location-driven refreshes and gate logsLocation updates can arrive frequently; coalesce refreshes to avoid request storms and UI churn. Also guard prints under DEBUG.
- print("🔍 LOCATION: GPS location changed to \(location.coordinate.latitude), \(location.coordinate.longitude)") + #if DEBUG + print("🔍 LOCATION: GPS location changed to \(location.coordinate.latitude), \(location.coordinate.longitude)") + #endif @@ - print("🔍 LOCATION: Set map center to GPS location") + #if DEBUG + print("🔍 LOCATION: Set map center to GPS location") + #endif @@ - print("🔍 LOCATION: Cleared searchCenterCoordinate - will use GPS") + #if DEBUG + print("🔍 LOCATION: Cleared searchCenterCoordinate - will use GPS") + #endif @@ - print("🔍 LOCATION: Updated map bounds with radius \(radiusToUse)") + #if DEBUG + print("🔍 LOCATION: Updated map bounds with radius \(radiusToUse)") + #endif @@ - print("🔍 LOCATION: Fetching merchants for new GPS location") - model.fetch(query: nil) + #if DEBUG + print("🔍 LOCATION: Fetching merchants for new GPS location") + #endif + // Debounce frequent updates (~400ms) + locationUpdateDebounceWorkItem?.cancel() + let work = DispatchWorkItem { [weak model] in model?.fetch(query: nil) } + locationUpdateDebounceWorkItem = work + DispatchQueue.main.asyncAfter(deadline: .now() + 0.4, execute: work)Add to class (outside this hunk):
private var locationUpdateDebounceWorkItem: DispatchWorkItem?
319-329: Avoid redundant fetch on availability changesYou already fetch on current-location updates; consider fetching only when authorized+location available, else wait for location callback.
- if manager.isAuthorized { - if let currentLocation = manager.currentLocation { - model.fetch(query: nil) - } else { - // Location will be updated via locationManagerDidChangeCurrentLocation which will trigger the fetch - } - } else { - model.fetch(query: nil) - } + if manager.isAuthorized, manager.currentLocation != nil { + model.fetch(query: nil) + }
640-659: On segment switch, normalize sort if incompatible (not only in filters UI)If current sort isn’t offered by the new segment, normalize immediately to avoid confusing results.
model.currentSegment = segment - if model.filters == nil { + if model.filters == nil { resetFiltersToDefaults(for: segment) } else { - // Just refresh the view with existing filters for this segment - refreshView() + var filters = model.filters + let allowed = segment.sortOptions + let defaultSort: PointOfUseListFilters.SortBy = (segment.tag == MerchantsListSegment.nearby.rawValue) ? .distance : .name + if let s = filters?.sortBy, !allowed.contains(s) { + filters = PointOfUseListFilters( + sortBy: defaultSort, + merchantPaymentTypes: filters?.merchantPaymentTypes, + radius: filters?.radius, + territory: filters?.territory, + denominationType: filters?.denominationType + ) + apply(filters: filters) + } else { + refreshView() + } }
689-715: Debounce map-region refreshesEvery region change triggers a fetch; add a short debounce to reduce load while panning.
- model.currentMapBounds = newBounds - print("🔍 MAP: Calling refreshItems()") - model.refreshItems() + model.currentMapBounds = newBounds + #if DEBUG + print("🔍 MAP: Scheduling refreshItems()") + #endif + regionChangeDebounceTimer?.invalidate() + regionChangeDebounceTimer = Timer.scheduledTimer(withTimeInterval: 0.35, repeats: false) { [weak model] _ in + model?.refreshItems() + }Add to class (outside this hunk):
private var regionChangeDebounceTimer: Timer?
67-67: Unused radius property can be removedThis controller-level radius is redundant with model.currentRadius/filters and should be deleted. Based on learnings.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (12)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/POIDetailsViewController.swift(1 hunks)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsView.swift(1 hunks)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsViewModel.swift(1 hunks)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/AllMerchantLocationsViewController.swift(2 hunks)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Cells/MerchantItemCell.swift(1 hunks)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Cells/PointOfUseItemCell.swift(1 hunks)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift(8 hunks)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/MerchantListViewController.swift(4 hunks)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/MerchantsDataProvider.swift(5 hunks)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/PointOfUseListModel.swift(3 hunks)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Views/ExploreMapAnnotationView.swift(1 hunks)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Views/ExploreMapView.swift(5 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-09-05T18:32:21.463Z
Learnt from: HashEngineering
PR: dashpay/dashwallet-ios#729
File: DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift:67-67
Timestamp: 2025-09-05T18:32:21.463Z
Learning: The radius property in ExplorePointOfUseListViewController is unused and should be removed. Radius functionality is handled through the model.currentRadius and filters system instead of a controller-level property.
Applied to files:
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swiftDashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/MerchantListViewController.swift
📚 Learning: 2025-09-05T18:32:21.463Z
Learnt from: HashEngineering
PR: dashpay/dashwallet-ios#729
File: DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift:67-67
Timestamp: 2025-09-05T18:32:21.463Z
Learning: The radius property in ExplorePointOfUseListViewController is confirmed unused after code analysis. Radius functionality is properly handled through model.currentRadius and filters?.currentRadius, making the controller property redundant and safe to remove.
Applied to files:
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swiftDashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/MerchantListViewController.swift
📚 Learning: 2025-09-27T15:37:44.449Z
Learnt from: bfoss765
PR: dashpay/dashwallet-ios#732
File: DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/POIDetailsViewController.swift:94-96
Timestamp: 2025-09-27T15:37:44.449Z
Learning: User bfoss765 prefers to defer fixing force unwrapping warnings until crashes are observed during testing, rather than proactively addressing them.
Applied to files:
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/POIDetailsViewController.swift
🧬 Code graph analysis (9)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift (6)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Views/ExploreMapView.swift (7)
mapView(330-353)mapView(355-365)mapView(441-447)setCenter(217-270)mapBounds(115-117)showUserLocationInCenter(272-276)show(162-173)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/MerchantsDataProvider.swift (3)
fetch(47-55)fetch(113-119)fetch(149-156)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/PointOfUseListModel.swift (2)
fetch(236-239)apply(216-219)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/MerchantListViewController.swift (1)
show(190-201)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Views/PointOfUseLocationServicePopup.swift (2)
show(123-133)show(135-139)DashWallet/Sources/Models/Explore Dash/Services/DWLocationManager.swift (1)
requestAuthorization(93-96)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Views/ExploreMapAnnotationView.swift (1)
DashWallet/Sources/Models/Explore Dash/Model/Entites/ExplorePointOfUse.swift (1)
hash(29-31)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/PointOfUseListModel.swift (3)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/MerchantsDataProvider.swift (3)
items(24-37)items(61-104)items(125-140)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/AllMerchantLocationsDataProvider.swift (1)
items(30-83)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/AtmDataProvider.swift (1)
items(26-56)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/MerchantsDataProvider.swift (5)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/PointOfUseListModel.swift (4)
fetch(236-239)handle(76-92)nextPage(72-74)items(66-69)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/AllMerchantLocationsDataProvider.swift (3)
fetch(91-97)nextPage(85-89)items(30-83)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/AtmDataProvider.swift (3)
fetch(65-70)nextPage(58-63)items(26-56)DashWallet/Sources/Models/Explore Dash/ExploreDash.swift (3)
allMerchants(183-189)nearbyMerchants(177-181)onlineMerchants(171-175)DashWallet/Sources/Models/Explore Dash/Infrastructure/DAO Impl/MerchantDAO.swift (5)
allMerchants(500-505)items(38-39)items(42-478)nearbyMerchants(493-498)onlineMerchants(482-491)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/MerchantListViewController.swift (5)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/AllMerchantLocationsViewController.swift (1)
viewWillAppear(119-132)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift (3)
showMap(109-120)updateAppliedFiltersView(588-594)viewWillDisappear(162-169)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Views/ExploreMapView.swift (4)
mapView(330-353)mapView(355-365)mapView(441-447)setCenter(217-270)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/MerchantsDataProvider.swift (3)
fetch(47-55)fetch(113-119)fetch(149-156)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/PointOfUseListModel.swift (1)
fetch(236-239)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsViewModel.swift (4)
DashWallet/Sources/Models/Explore Dash/Services/DWLocationManager.swift (2)
remove(105-108)add(98-103)DashWallet/Sources/UI/Views/BaseController/BaseViewController+NetworkReachability.swift (2)
stopNetworkMonitoring(52-54)startNetworkMonitoring(36-50)DashWallet/Sources/Models/Explore Dash/ExploreDash.swift (1)
allLocations(191-194)DashWallet/Sources/Models/Explore Dash/Infrastructure/DAO Impl/MerchantDAO.swift (3)
allLocations(507-592)items(38-39)items(42-478)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/POIDetailsViewController.swift (5)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Views/ExploreMapView.swift (7)
mapView(330-353)mapView(355-365)mapView(441-447)configureHierarchy(294-324)show(162-173)setContentInsets(278-287)setCenter(217-270)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift (2)
configureHierarchy(374-530)show(143-150)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/MerchantListViewController.swift (2)
configureHierarchy(321-327)show(190-201)DashWallet/Sources/Categories/UIHostingController+DashWallet.swift (1)
setDetent(21-31)DashWallet/Sources/Models/Explore Dash/Services/DashSpend/CTX/CTXSpendRepository.swift (1)
refreshToken(129-131)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsView.swift (3)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/POIDetailsViewController.swift (3)
callAction(74-80)websiteAction(82-86)payAction(69-72)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsViewModel.swift (2)
selectProvider(92-95)logout(113-115)DashWallet/Sources/UI/SwiftUI Components/Button.swift (1)
overrideBackgroundColor(239-241)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/AllMerchantLocationsViewController.swift (3)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift (3)
apply(894-907)viewDidLoad(171-215)refreshView(909-913)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/PointOfUseListModel.swift (3)
apply(216-219)refreshItems(232-234)clearCache(53-60)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/MerchantListViewController.swift (2)
viewDidLoad(329-355)viewWillAppear(263-306)
🪛 SwiftLint (0.57.0)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Views/ExploreMapView.swift
[Warning] 184-184: Force unwrapping should be avoided
(force_unwrapping)
[Warning] 184-184: Force unwrapping should be avoided
(force_unwrapping)
[Warning] 194-194: Force unwrapping should be avoided
(force_unwrapping)
[Warning] 194-194: Force unwrapping should be avoided
(force_unwrapping)
[Warning] 222-222: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 222-222: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 224-224: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 224-224: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 224-224: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 246-246: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 246-246: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 247-247: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 247-247: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 247-247: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 347-347: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 347-347: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 348-348: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 348-348: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 348-348: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 379-379: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 379-379: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 380-380: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 380-380: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 380-380: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 421-421: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 421-421: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 422-422: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 422-422: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 422-422: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Cells/MerchantItemCell.swift
[Warning] 47-47: Force unwrapping should be avoided
(force_unwrapping)
[Warning] 47-47: Force unwrapping should be avoided
(force_unwrapping)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/MerchantListViewController.swift
[Warning] 301-301: Force unwrapping should be avoided
(force_unwrapping)
[Warning] 301-301: Force unwrapping should be avoided
(force_unwrapping)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsViewModel.swift
[Warning] 44-44: Implicitly unwrapped optionals should be avoided when possible
(implicitly_unwrapped_optional)
[Warning] 46-46: Initializing an optional variable with nil is redundant
(redundant_optional_initialization)
[Warning] 50-50: Initializing an optional variable with nil is redundant
(redundant_optional_initialization)
[Warning] 52-52: Initializing an optional variable with nil is redundant
(redundant_optional_initialization)
[Warning] 20-20: Imports should be sorted
(sorted_imports)
[Warning] 43-43: Prefer -> Void over -> ()
(void_return)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/POIDetailsViewController.swift
[Warning] 477-477: Attributes should be on their own lines in functions and types, but on the same line as variables and imports
(attributes)
[Warning] 94-94: Force unwrapping should be avoided
(force_unwrapping)
[Warning] 94-94: Force unwrapping should be avoided
(force_unwrapping)
[Warning] 249-249: Force unwrapping should be avoided
(force_unwrapping)
[Warning] 35-35: Implicitly unwrapped optionals should be avoided when possible
(implicitly_unwrapped_optional)
[Warning] 36-36: Implicitly unwrapped optionals should be avoided when possible
(implicitly_unwrapped_optional)
[Warning] 393-393: Implicitly unwrapped optionals should be avoided when possible
(implicitly_unwrapped_optional)
[Warning] 396-396: Implicitly unwrapped optionals should be avoided when possible
(implicitly_unwrapped_optional)
[Warning] 397-397: Implicitly unwrapped optionals should be avoided when possible
(implicitly_unwrapped_optional)
[Warning] 398-398: Implicitly unwrapped optionals should be avoided when possible
(implicitly_unwrapped_optional)
[Warning] 399-399: Implicitly unwrapped optionals should be avoided when possible
(implicitly_unwrapped_optional)
[Warning] 31-31: Ensure declarations have a lower access control level than their enclosing parent
(lower_acl_than_parent)
[Warning] 39-39: Ensure declarations have a lower access control level than their enclosing parent
(lower_acl_than_parent)
[Warning] 232-232: MARK comment should be in valid format. e.g. '// MARK: ...' or '// MARK: - ...'
(mark)
[Warning] 426-426: Prefer object literals over image and color inits
(object_literal)
[Warning] 31-31: Return arrow and return type should be separated by a single space or on a separate line
(return_arrow_whitespace)
[Warning] 32-32: Return arrow and return type should be separated by a single space or on a separate line
(return_arrow_whitespace)
[Warning] 33-33: Return arrow and return type should be separated by a single space or on a separate line
(return_arrow_whitespace)
[Warning] 20-20: Imports should be sorted
(sorted_imports)
[Warning] 49-49: Unimplemented functions should be marked as unavailable
(unavailable_function)
[Warning] 53-53: Remove overridden functions that don't do anything except call their super
(unneeded_override)
[Warning] 65-65: Don't include vertical whitespace (empty line) before closing braces
(vertical_whitespace_closing_braces)
[Warning] 31-31: Prefer -> Void over -> ()
(void_return)
[Warning] 32-32: Prefer -> Void over -> ()
(void_return)
[Warning] 33-33: Prefer -> Void over -> ()
(void_return)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsView.swift
[Warning] 350-350: Attributes should be on their own lines in functions and types, but on the same line as variables and imports
(attributes)
[Warning] 377-377: Attributes should be on their own lines in functions and types, but on the same line as variables and imports
(attributes)
[Warning] 494-494: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals
(colon)
[Warning] 147-147: Force unwrapping should be avoided
(force_unwrapping)
[Warning] 255-255: Trailing closure syntax should not be used when passing more than one closure argument
(multiple_closures_with_trailing_closure)
[Warning] 392-392: Trailing closure syntax should not be used when passing more than one closure argument
(multiple_closures_with_trailing_closure)
[Warning] 546-546: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 19-19: Imports should be sorted
(sorted_imports)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/AllMerchantLocationsViewController.swift
[Warning] 80-80: Don't include vertical whitespace (empty line) after opening braces
(vertical_whitespace_opening_braces)
🔇 Additional comments (21)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Views/ExploreMapAnnotationView.swift (1)
36-42: LGTM! Correct NSObject equality pattern.The
isEqualimplementation correctly follows Cocoa conventions: safe type casting, consistent comparison bymerchant.id, and aligns with thehashimplementation for Set/Dictionary compatibility.DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/MerchantsDataProvider.swift (8)
32-36: All tab: correct to avoid bounds/location (keeps online merchants).Passing nil for bounds/userPoint prevents the in-memory grouping path from filtering out online-only merchants. LGTM.
39-45: All tab pagination: consistent with initial fetch.Keeping bounds/userPoint nil across pages preserves the “show all” behavior. LGTM.
50-54: AllMerchants passthrough looks good.Directly forwarding to dataSource with filters/territory/denomination maintains DAO semantics.
64-70: Nearby: good early exit when no bounds/location/auth.Returns empty without hitting the DAO; consistent with expected UX.
78-82: Cache key may miss user location changes.If userPoint changes within same bounds/query/filters, ordering may differ; consider including lastUserPoint (or its lat/lon) in the cache key.
116-118: Nearby fetch passthrough: OK.Parameters line up with DAO signature; completion passthrough is fine.
137-147: Online tab: enforcing onlineOnly across pages is correct.Ensures pure-online results consistently.
152-155: Online fetch passthrough: OK.Forwarding paymentMethods/sort/userPoint is appropriate for DAO sorting.
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Cells/PointOfUseItemCell.swift (1)
30-30: searchCenterCoordinate addition looks good.Matches upstream distance logic needs in MerchantItemCell.
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/PointOfUseListModel.swift (1)
131-144: Per-segment filters map looks good—ensure segment tags are uniqueSince equality/hash rely solely on tag, duplicate tags would collide and mix filters. Confirm tag uniqueness across segments.
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Views/ExploreMapView.swift (1)
23-27: CLLocationCoordinate2D Equatable conformance—verify SDK overlapRecent SDKs may already conform; if so, this extension becomes redundant. Consider guarding with availability or removing if unnecessary.
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/MerchantListViewController.swift (3)
64-65: All segment sort options look goodRestricting to [.name, .discount] matches the All use case.
90-91: All segment filter groups trimmed appropriatelyRemoving territory/radius/locationService aligns with a global “All” listing.
231-261: Ensure PIGGYCARDS_ENABLED is actually defined in your build configurations
I didn’t find any occurrences ofPIGGYCARDS_ENABLEDin.xcconfigor.pbxprojfiles—please confirm the flag is added to all relevant targets’ Build Settings or config files so the guarded code compiles as expected.DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift (6)
144-146: Passing currentRadius into details is correctKeeps details in sync with active filter radius.
399-399: showFilters action wiring is cleanSelector hookup and dedicated handler look good.
Also applies to: 601-605
535-569: Sort fallback logic is solidEnsures segment-appropriate default sort without surprising the user.
588-594: Always-show toolbar: verify UX across screensUnhiding the toolbar here affects all inheritors. Confirm no screens rely on it being hidden initially.
895-906: Applying filters updates map bounds first: goodPrecomputing bounds and then applying filters keeps data and map in sync.
791-792: Confirm cell API availabilityPointOfUseItemCell unconditionally defines
searchCenterCoordinate(PointOfUseItemCell.swift:30); approving code changes.
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]>
There was a problem hiding this comment.
Actionable comments posted: 6
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
DashPay/dashpay-info.plist(1 hunks)DashWallet/Info.plist(1 hunks)DashWalletScreenshotsUITests/Info.plist(1 hunks)DashWalletTests/Info.plist(1 hunks)TodayExtension/Info.plist(1 hunks)WatchApp Extension/Info.plist(1 hunks)WatchApp/Info.plist(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- DashWalletScreenshotsUITests/Info.plist
- 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]>
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (2)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsViewModel.swift (2)
79-90: Critical: Add .receive(on: DispatchQueue.main) before sinksPublishers from repositories may emit off the main thread. Without explicit scheduling, assignments to @published properties can cause data races despite @mainactor isolation.
Apply this diff:
repository.isUserSignedInPublisher + .receive(on: DispatchQueue.main) .sink { [weak self] isSignedIn in self?.isUserSignedIn = isSignedIn } .store(in: &cancellableBag) repository.userEmailPublisher + .receive(on: DispatchQueue.main) .sink { [weak self] email in self?.userEmail = email } .store(in: &cancellableBag)
99-111: Update locationCount when location changesLocation changes affect which locations fall within the search radius. Without calling
fetchLocationCount(), the UI displays stale counts until the user manually adjusts the radius.Apply this diff to both handlers:
nonisolated func locationManagerDidChangeCurrentLocation(_ manager: DWLocationManager, location: CLLocation) { Task { @MainActor in self.updateDistance() + self.fetchLocationCount() } } nonisolated func locationManagerDidChangeServiceAvailability(_ manager: DWLocationManager) { Task { @MainActor in self.updateDistance() + self.fetchLocationCount() } }
🧹 Nitpick comments (6)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsViewModel.swift (1)
238-257: Phone formatting is now correct; consider parentheses for readabilityThe critical issue flagged in the previous review (missing country code) has been fixed—the code now correctly includes "+1". For improved readability, consider standard US formatting with parentheses and hyphens:
+1 (415) 555-1212.Apply this diff for enhanced formatting:
if digits.count == 10 { let areaCode = String(digits.prefix(3)) let exchange = String(digits.dropFirst(3).prefix(3)) let number = String(digits.suffix(4)) - return "+1 \(areaCode) \(exchange) \(number)" + return "+1 (\(areaCode)) \(exchange)-\(number)" } else if digits.count == 11 && digits.hasPrefix("1") { let areaCode = String(digits.dropFirst().prefix(3)) let exchange = String(digits.dropFirst(4).prefix(3)) let number = String(digits.suffix(4)) - return "+1 \(areaCode) \(exchange) \(number)" + return "+1 (\(areaCode)) \(exchange)-\(number)" }DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift (3)
67-67: Remove unused radius property.Per learnings, radius functionality is handled through
model.currentRadiusand the filters system. This property is unused and should be removed.Based on learnings.
- internal var radius = 20 // In miles //Move to model
284-312: Consider removing or gating debug print statements.Multiple print statements (lines 285, 289, 293, 299, 304, 309) should be removed or moved behind a debug flag/logger to avoid shipping verbose logs in production.
Otherwise, the location update logic correctly centers the map, clears search overrides, updates bounds, and refreshes nearby merchants.
- print("🔍 LOCATION: GPS location changed to \(location.coordinate.latitude), \(location.coordinate.longitude)") - // Set the map center first mapView.setCenter(location, animated: false) - print("🔍 LOCATION: Set map center to GPS location") - // Clear search center to use actual GPS location model.searchCenterCoordinate = nil - print("🔍 LOCATION: Cleared searchCenterCoordinate - will use GPS") - // Update the model's map bounds to match the new center if model.showMap { let radiusToUse = model.filters?.currentRadius ?? kDefaultRadius - // Update the map view's search radius mapView.searchRadius = radiusToUse - let newBounds = mapView.mapBounds(with: radiusToUse) model.currentMapBounds = newBounds - print("🔍 LOCATION: Updated map bounds with radius \(radiusToUse)") } - // If we're on the nearby tab and the model shows map, refresh the search with the new location if currentSegment.tag == MerchantsListSegment.nearby.rawValue && model.showMap { - print("🔍 LOCATION: Fetching merchants for new GPS location") model.fetch(query: nil) }
689-715: Guard prevents interference with AllMerchantLocations; consider removing debug prints.The guard (lines 690-694) correctly prevents bounds updates when
AllMerchantLocationsViewControlleris active, preserving the "show all locations" flow. The logic properly uses the map center as the search center for user-dragged map positions.However, debug print statements (lines 696-698, 710, 713) should be removed or gated behind a debug flag/logger.
- print("🔍 MAP: Map region changed") - print("🔍 MAP: Center = \(mapView.centerCoordinate.latitude), \(mapView.centerCoordinate.longitude)") - print("🔍 MAP: Current radius = \(model.currentRadius) meters") - refreshFilterCell() - // Update the search radius on the map view to match current filter mapView.searchRadius = model.currentRadius - // Update the search center to the map center (not the device GPS location) model.searchCenterCoordinate = mapView.centerCoordinate - // Get bounds based on the current filter radius and new center location let newBounds = mapView.mapBounds(with: model.currentRadius) - print("🔍 MAP: New bounds NE=(\(newBounds.neCoordinate.latitude), \(newBounds.neCoordinate.longitude)), SW=(\(newBounds.swCoordinate.latitude), \(newBounds.swCoordinate.longitude))") - model.currentMapBounds = newBounds - print("🔍 MAP: Calling refreshItems()") model.refreshItems()DashWallet/Sources/Models/Explore Dash/Infrastructure/DAO Impl/MerchantDAO.swift (2)
507-665: All locations logic correctly applies bounds expansion, circular filtering, and provider enrichment.The
allLocationsmethod (lines 507-665) correctly:
- Expands bounds by 50% to reduce false exclusions (lines 519-537).
- Applies circular distance filtering when bounds and userPoint exist (lines 558-584).
- Enriches gift-card merchants with provider information (lines 586-657).
- Guards database connection before calling
prepare(lines 595-598).Minor: Static analysis warns about operator spacing on lines 570 and 578 (e.g.,
distance/1609.34should bedistance / 1609.34). Consider applying consistent spacing for readability.- let boundsRadius = min(latDiff, lonDiff) * 111000 / 2 // Convert degrees to meters, divide by 2 + let boundsRadius = min(latDiff, lonDiff) * 111000 / 2 // Convert degrees to meters, divide by 2
178-247: Enforce parameterized queries for gift-card provider enrichment
Gift-card provider enrichment correctly guards the database connection, but the SQL uses raw interpolation ofmerchantIdwithout any sanitization. No validation or sanitization formerchantIdwas found in the codebase, so switch to parameterized queries (e.g.,db.prepare(sql, merchant.merchantId)) to eliminate SQL injection risk.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
DashWallet/Sources/Models/Explore Dash/Infrastructure/DAO Impl/MerchantDAO.swift(7 hunks)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsViewModel.swift(1 hunks)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift(8 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-09-05T18:32:21.463Z
Learnt from: HashEngineering
PR: dashpay/dashwallet-ios#729
File: DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift:67-67
Timestamp: 2025-09-05T18:32:21.463Z
Learning: The radius property in ExplorePointOfUseListViewController is unused and should be removed. Radius functionality is handled through the model.currentRadius and filters system instead of a controller-level property.
Applied to files:
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift
📚 Learning: 2025-09-05T18:32:21.463Z
Learnt from: HashEngineering
PR: dashpay/dashwallet-ios#729
File: DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift:67-67
Timestamp: 2025-09-05T18:32:21.463Z
Learning: The radius property in ExplorePointOfUseListViewController is confirmed unused after code analysis. Radius functionality is properly handled through model.currentRadius and filters?.currentRadius, making the controller property redundant and safe to remove.
Applied to files:
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift
🧬 Code graph analysis (3)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsViewModel.swift (6)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift (1)
locationManagerDidChangeCurrentLocation(284-312)DashWallet/Sources/Models/Explore Dash/Services/DWLocationManager.swift (2)
remove(105-108)add(98-103)DashWallet/Sources/UI/Views/BaseController/BaseViewController+NetworkReachability.swift (2)
stopNetworkMonitoring(52-54)startNetworkMonitoring(36-50)DashWallet/Sources/Models/Explore Dash/Infrastructure/DAO Impl/MerchantDAO.swift (3)
allLocations(507-665)items(38-39)items(42-478)DashWallet/Sources/Models/Explore Dash/ExploreDash.swift (1)
allLocations(191-194)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/AllMerchantLocationsDataProvider.swift (1)
items(30-83)
DashWallet/Sources/Models/Explore Dash/Infrastructure/DAO Impl/MerchantDAO.swift (5)
DashWallet/Sources/Models/Explore Dash/Infrastructure/Database Connection/ExploreDatabaseConnection.swift (2)
execute(87-105)execute(107-117)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/MerchantsDataProvider.swift (3)
items(24-37)items(61-104)items(125-140)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/AllMerchantLocationsDataProvider.swift (1)
items(30-83)DashWallet/Sources/Models/Explore Dash/Infrastructure/DAO Impl/AtmDAO.swift (1)
items(35-92)DashWallet/Sources/Models/Explore Dash/ExploreDash.swift (2)
nearbyMerchants(177-181)allMerchants(183-189)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift (6)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Views/ExploreMapView.swift (7)
mapView(330-353)mapView(355-365)mapView(441-447)setCenter(217-270)mapBounds(115-117)showUserLocationInCenter(272-276)show(162-173)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/MerchantsDataProvider.swift (3)
fetch(47-55)fetch(113-119)fetch(149-156)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Model/PointOfUseListModel.swift (2)
fetch(236-239)apply(216-219)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/MerchantListViewController.swift (1)
show(190-201)DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/Views/PointOfUseLocationServicePopup.swift (2)
show(123-133)show(135-139)DashWallet/Sources/Models/Explore Dash/Services/DWLocationManager.swift (1)
requestAuthorization(93-96)
🪛 SwiftLint (0.57.0)
DashWallet/Sources/Models/Explore Dash/Infrastructure/DAO Impl/MerchantDAO.swift
[Warning] 284-284: Force unwrapping should be avoided
(force_unwrapping)
[Warning] 285-285: Force unwrapping should be avoided
(force_unwrapping)
[Warning] 493-493: Function should have 5 parameters or less: it currently has 8
(function_parameter_count)
[Warning] 500-500: Function should have 5 parameters or less: it currently has 8
(function_parameter_count)
[Warning] 570-570: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 578-578: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
[Warning] 578-578: Operators should be surrounded by a single whitespace when they are being used
(operator_usage_whitespace)
🔇 Additional comments (28)
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/Details/Views/POIDetailsViewModel.swift (9)
18-24: LGTM!The @mainactor annotation ensures thread-safe UI updates, and the protocol conformances properly wire observability, sync monitoring, network reachability, and location tracking.
25-73: LGTM!The initialization sequence properly sets up providers, observers, distance calculation, and location count. The conditional compilation for PiggyCards and type-erased repository dictionary are well-structured.
113-121: LGTM!Proper cleanup of all observers (sync monitor, network, location) in deinit, and logout correctly delegates to the repository.
123-138: LGTM!Observer setup correctly wires network, sync, and location monitoring with proper main-thread isolation for UI updates.
140-153: LGTM!Distance calculation properly checks authorization, computes distance from merchant to current location, and formats using the shared formatter.
155-180: LGTM!Provider setup correctly extracts gift card provider metadata, determines picker visibility, selects the default provider, and initiates state observation.
182-185: LGTM!Radius update correctly stores the new value and refreshes the location count.
187-236: LGTM!Location count logic correctly differentiates between global "All" tab (no radius filtering) and radius-filtered views. The use of searchCenterCoordinate when available (map pan) or GPS location (default) aligns with the broader location-mapping patterns.
259-267: LGTM!Sync monitoring callbacks correctly use nonisolated methods with main-thread isolation for state updates. The empty progress handler is acceptable if progress tracking is not required.
DashWallet/Sources/UI/Explore Dash/Merchants & ATMs/List/ExplorePointOfUseListViewController.swift (8)
144-150: LGTM!The POI detail flow correctly derives the radius from filters (with a sensible default) and passes the necessary search context to
POIDetailsViewController.
314-330: LGTM!The service availability logic correctly handles authorization states and defers fetching when location is not yet available, allowing
locationManagerDidChangeCurrentLocationto trigger the fetch.
535-586: LGTM!The
showFiltersmethod correctly computes segment-specific effective filters, ensuring sort options are valid for the current segment and defaulting appropriately. This prevents invalid UI states when switching segments.
588-594: LGTM!Making
updateAppliedFiltersViewinternal and showing default filter text improves transparency. Always displaying the toolbar ensures users can access filters.
601-604: LGTM!The
showFiltersActionmethod properly connects the filter button to theshowFiltersimplementation.
640-683: LGTM!Segment switching logic correctly:
- Preserves filters when revisiting segments (only defaults on first visit).
- Proactively requests location permission when switching to Nearby tab.
- Applies segment-specific defaults (distance sort for Nearby, name sort otherwise) with sensible payment type and radius defaults.
790-792: LGTM!Passing
searchCenterCoordinateto the cell ensures distance calculations reflect the search center (e.g., after map drag) rather than always using GPS location, maintaining consistency with the search logic.
894-907: LGTM!The
apply(filters:)method correctly updates map radius and bounds before applying filters to the model, ensuring the map state is synchronized with the filter changes.DashWallet/Sources/Models/Explore Dash/Infrastructure/DAO Impl/MerchantDAO.swift (11)
42-106: LGTM!The payment method handling correctly maps
SpendingOptionsto concretePaymentMethodtypes, with proper conditional compilation for PiggyCards. The provider-specific filtering (lines 91-105) ensures that only merchants supporting the selected gift card providers are included.
108-116: LGTM!Filtering logic correctly excludes URL-based redemption (not supported) and PiggyCards-only merchants when the feature is disabled, while preserving merchants with multiple providers.
134-160: LGTM!Bounds expansion by 50% reduces false exclusions near the circular radius boundary. The logic correctly exempts online merchants from bounds filtering (they lack physical coordinates) while applying expanded bounds to physical locations.
249-266: LGTM!Circular distance filtering (lines 249-266) correctly applies true radius-based filtering after the rectangular bounds query, ensuring that only locations within the actual circular search area are included.
268-301: LGTM!The closest-location grouping logic correctly:
- Handles online merchants (no coordinates) separately.
- Computes distances for physical locations and tracks the closest per merchant.
Note: Force unwraps on lines 284-285 are safe due to the guard on lines 276-282 that ensures coordinates are non-nil before this code path is reached.
304-340: LGTM!Sorting and pagination logic correctly applies the selected sort order (name, distance, discount), defaults to distance sorting when no sort is specified, and properly paginates the results before returning on the main queue.
347-349: LGTM!The
GROUP BYfallback (line 348) correctly handles cases withoutuserLocation, preserving the original SQL-based grouping behavior.
396-470: Provider enrichment mirrors userLocation branch; DB guard correct.The non-userLocation branch (lines 396-470) correctly guards the database connection (lines 408-411) and applies the same provider enrichment logic as the userLocation branch, ensuring consistency.
482-491: LGTM!The
onlineMerchantsmethod correctly filters for pure online merchants whenonlineOnly=true, otherwise includes both online andonlineAndPhysicaltypes.
493-498: LGTM!The
nearbyMerchantsmethod signature correctly usesSpendingOptionsand filters for physical andonlineAndPhysicaltypes.Note: Static analysis warns about the high parameter count (8). While this is a code smell, it's acceptable for DAO methods that aggregate multiple filter criteria.
500-505: LGTM!The
allMerchantsmethod correctly usesSpendingOptionsand includes all merchant types (online,onlineAndPhysical, physical).Note: High parameter count (8) is acceptable for this DAO method, consistent with
nearbyMerchants.
- 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]>
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (2)
DashWallet.xcodeproj/project.pbxproj (1)
11977-11977: Previously flagged: DASH_TESTNET in main app Debug configuration.This line was already flagged in a previous review as a major issue. The DASH_TESTNET compilation flag should typically be confined to a dedicated Testnet target or configuration, not the main app's Debug build, to prevent potential network confusion during development.
CLAUDE.md (1)
523-530: Clarify nil handling for the circular distance filter guard.Line 529 still returns
boundsFilteredwhenuserPointis nil, contradicting the “always apply both filters” guidance. Please either require a non-optionaluserPoint(fail fast) or document a different fallback so the sample doesn’t endorse skipping the circular filter when location is missing.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
CLAUDE.md(1 hunks)DashWallet.xcodeproj/project.pbxproj(62 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-05T04:46:12.717Z
Learnt from: HashEngineering
PR: dashpay/dashwallet-ios#728
File: DashWallet.xcodeproj/project.pbxproj:1595-1599
Timestamp: 2025-09-05T04:46:12.717Z
Learning: In iOS projects, the `DashWallet.xcodeproj/project.pbxproj` file is automatically generated and managed by Xcode. Manual changes to this file should not be made, and the changes shown in diffs are typically the result of Xcode updating project configuration, dependencies, or build settings.
Applied to files:
DashWallet.xcodeproj/project.pbxproj
🪛 markdownlint-cli2 (0.18.1)
CLAUDE.md
332-332: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🔇 Additional comments (1)
DashWallet.xcodeproj/project.pbxproj (1)
10454-10454: Version bump to 8.4.2 looks correct.The marketing version has been consistently updated from 8.4.1 to 8.4.2 across all build configurations (Debug, Release, Testnet, Testflight) and targets (main app, watch app, extensions). This is standard for a feature release and aligns with the PR's introduction of UI improvements and DashSpend enhancements.
Based on learnings: These changes are automatically managed by Xcode when project configuration or versioning is updated.
Also applies to: 10594-10594, 10768-10768, 10790-10790, 10815-10815, 10842-10842, 11582-11582, 11751-11751, 11776-11776, 11893-11893, 12061-12061, 12086-12086
Issue being fixed or feature implemented
What was done?
How Has This Been Tested?
Breaking Changes
Checklist:
For repository code-owners and collaborators only
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Chores