Remove debug prints and fix build warnings
- Remove all print statements from planning engine, data providers, and PDF generation - Fix deprecated CLGeocoder usage with MKLocalSearch for iOS 26 - Fix Swift 6 actor isolation by converting PDFGenerator/ExportService to @MainActor - Add @retroactive to CLLocationCoordinate2D protocol conformances - Fix unused variable warnings in GameDAGRouter and scenario planners - Remove unreachable catch blocks in SettingsViewModel 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,8 @@ import Foundation
|
||||
import PDFKit
|
||||
import UIKit
|
||||
|
||||
actor PDFGenerator {
|
||||
@MainActor
|
||||
final class PDFGenerator {
|
||||
|
||||
// MARK: - Constants
|
||||
|
||||
@@ -380,7 +381,7 @@ actor PDFGenerator {
|
||||
assets: PDFAssetPrefetcher.PrefetchedAssets?,
|
||||
y: CGFloat
|
||||
) -> CGFloat {
|
||||
var currentY = y
|
||||
let currentY = y
|
||||
|
||||
// Card background
|
||||
let cardRect = CGRect(x: margin + 10, y: currentY, width: contentWidth - 20, height: 65)
|
||||
@@ -486,7 +487,7 @@ actor PDFGenerator {
|
||||
}
|
||||
|
||||
private func drawTravelSegment(segment: TravelSegment, y: CGFloat) -> CGFloat {
|
||||
var currentY = y
|
||||
let currentY = y
|
||||
|
||||
let travelRect = CGRect(x: margin + 10, y: currentY, width: contentWidth - 20, height: 35)
|
||||
let travelPath = UIBezierPath(roundedRect: travelRect, cornerRadius: 6)
|
||||
@@ -601,7 +602,7 @@ actor PDFGenerator {
|
||||
}
|
||||
|
||||
private func drawPOIItem(poi: POISearchService.POI, index: Int, y: CGFloat) -> CGFloat {
|
||||
var currentY = y
|
||||
let currentY = y
|
||||
|
||||
// Number badge
|
||||
let badgeRect = CGRect(x: margin + 10, y: currentY, width: 22, height: 22)
|
||||
@@ -887,7 +888,8 @@ extension UIColor {
|
||||
|
||||
// MARK: - Export Service
|
||||
|
||||
actor ExportService {
|
||||
@MainActor
|
||||
final class ExportService {
|
||||
private let pdfGenerator = PDFGenerator()
|
||||
private let assetPrefetcher = PDFAssetPrefetcher()
|
||||
|
||||
|
||||
@@ -89,11 +89,15 @@ actor PDFAssetPrefetcher {
|
||||
}
|
||||
}
|
||||
|
||||
// Create immutable copies for concurrent access
|
||||
let teamsToFetch = teams
|
||||
let stadiumsToFetch = stadiums
|
||||
|
||||
// Run all fetches in parallel
|
||||
async let routeMapTask = fetchRouteMap(stops: trip.stops)
|
||||
async let cityMapsTask = fetchCityMaps(stops: trip.stops)
|
||||
async let logosTask = imageService.fetchTeamLogos(teams: teams)
|
||||
async let photosTask = imageService.fetchStadiumPhotos(stadiums: stadiums)
|
||||
async let logosTask = imageService.fetchTeamLogos(teams: teamsToFetch)
|
||||
async let photosTask = imageService.fetchStadiumPhotos(stadiums: stadiumsToFetch)
|
||||
async let poisTask = poiService.findPOIsForCities(stops: trip.stops, limit: 5)
|
||||
|
||||
// Await each result and update progress
|
||||
@@ -117,13 +121,6 @@ actor PDFAssetPrefetcher {
|
||||
progress.poisComplete = true
|
||||
await progressCallback?(progress)
|
||||
|
||||
print("[PDFAssetPrefetcher] Prefetch complete:")
|
||||
print(" - Route map: \(routeMap != nil ? "OK" : "Failed")")
|
||||
print(" - City maps: \(cityMaps.count) cities")
|
||||
print(" - Team logos: \(teamLogos.count) logos")
|
||||
print(" - Stadium photos: \(stadiumPhotos.count) photos")
|
||||
print(" - POIs: \(cityPOIs.values.reduce(0) { $0 + $1.count }) total POIs")
|
||||
|
||||
return PrefetchedAssets(
|
||||
routeMap: routeMap,
|
||||
cityMaps: cityMaps,
|
||||
@@ -141,7 +138,6 @@ actor PDFAssetPrefetcher {
|
||||
let mapSize = CGSize(width: 512, height: 350)
|
||||
return try await mapService.generateRouteMap(stops: stops, size: mapSize)
|
||||
} catch {
|
||||
print("[PDFAssetPrefetcher] Route map failed: \(error.localizedDescription)")
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -162,7 +158,6 @@ actor PDFAssetPrefetcher {
|
||||
let map = try await self.mapService.generateCityMap(stop: stop, size: mapSize)
|
||||
return (stop.city, map)
|
||||
} catch {
|
||||
print("[PDFAssetPrefetcher] City map for \(stop.city) failed: \(error.localizedDescription)")
|
||||
return (stop.city, nil)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,6 @@ actor POISearchService {
|
||||
limit: limitPerCategory
|
||||
)
|
||||
} catch {
|
||||
print("[POISearchService] Search failed for \(category): \(error.localizedDescription)")
|
||||
return []
|
||||
}
|
||||
}
|
||||
@@ -167,7 +166,6 @@ actor POISearchService {
|
||||
// Take top N overall
|
||||
return (stop.city, Array(pois.prefix(limit)))
|
||||
} catch {
|
||||
print("[POISearchService] Failed for \(stop.city): \(error.localizedDescription)")
|
||||
return (stop.city, [])
|
||||
}
|
||||
}
|
||||
@@ -208,11 +206,8 @@ actor POISearchService {
|
||||
let pois: [POI] = response.mapItems.prefix(limit).compactMap { item in
|
||||
guard let name = item.name else { return nil }
|
||||
|
||||
let itemLocation = CLLocation(
|
||||
latitude: item.placemark.coordinate.latitude,
|
||||
longitude: item.placemark.coordinate.longitude
|
||||
)
|
||||
let distance = referenceLocation.distance(from: itemLocation)
|
||||
let itemCoordinate = item.location.coordinate
|
||||
let distance = referenceLocation.distance(from: item.location)
|
||||
|
||||
// Only include POIs within radius
|
||||
guard distance <= radiusMeters else { return nil }
|
||||
@@ -221,22 +216,23 @@ actor POISearchService {
|
||||
id: UUID(),
|
||||
name: name,
|
||||
category: category,
|
||||
coordinate: item.placemark.coordinate,
|
||||
coordinate: itemCoordinate,
|
||||
distanceMeters: distance,
|
||||
address: formatAddress(item.placemark)
|
||||
address: formatAddress(item)
|
||||
)
|
||||
}
|
||||
|
||||
return pois
|
||||
}
|
||||
|
||||
private func formatAddress(_ placemark: MKPlacemark) -> String? {
|
||||
@available(iOS, deprecated: 26.0, message: "Uses placemark for address formatting")
|
||||
private func formatAddress(_ item: MKMapItem) -> String? {
|
||||
var components: [String] = []
|
||||
|
||||
if let subThoroughfare = placemark.subThoroughfare {
|
||||
if let subThoroughfare = item.placemark.subThoroughfare {
|
||||
components.append(subThoroughfare)
|
||||
}
|
||||
if let thoroughfare = placemark.thoroughfare {
|
||||
if let thoroughfare = item.placemark.thoroughfare {
|
||||
components.append(thoroughfare)
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,6 @@ actor RemoteImageService {
|
||||
let image = try await self.fetchImage(from: url)
|
||||
return (url, image)
|
||||
} catch {
|
||||
print("[RemoteImageService] Failed to fetch \(url): \(error.localizedDescription)")
|
||||
return (url, nil)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user