Skip to content

Conversation

@chizberg
Copy link
Owner

@chizberg chizberg commented Jan 7, 2026

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the comparison view to display the actual year when Street View imagery was captured, rather than just a boolean availability status. The change replaces Bool with a new StreetViewAvailability enum that captures both availability status and the capture year.

Key changes:

  • Introduced StreetViewAvailability enum with .available(year: Int) and .unavailable cases
  • Updated Google Street View Metadata API response parsing to extract the year from the date field
  • Modified comparison view to display the Street View capture year when available, falling back to the current year in camera mode

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Rewind/Model/StreetViewFactory.swift Defines the new StreetViewAvailability enum to represent availability status and capture year
Rewind/Network/Request.swift Updates Street View API to return StreetViewAvailability, adds extractYear function to parse date strings in "YYYY-MM-DD" format
Rewind/Model/RewindRemotes.swift Updates streetViewAvailability remote type from Bool to StreetViewAvailability
Rewind/Model/ImageDetailsModel.swift Updates function signature to use new StreetViewAvailability type
Rewind/Model/ComparisonModel.swift Adds state field for availability, new action to handle loaded availability, extension to extract year, and passes year to view
Rewind/View/ComparisonView.swift Adds streetViewYear parameter and uses it instead of current year when displaying Street View comparisons
Rewind/View/ComparisonScreen.swift Updates preview mocks to use new enum syntax with specific years for testing
Rewind/View/ImageDetailsView.swift Updates preview mocks to use new enum syntax
Rewind/View/ImageList.swift Updates preview mocks to use new enum syntax

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

let year = Int(yearStr)
else {
throw HandlingError("Invalid date format")
}
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

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

The date parsing doesn't validate that the parsed year is reasonable for Google Street View imagery. According to the Google Street View Metadata API documentation, the date field contains imagery capture dates which typically range from 2007 onwards (when Street View was launched).

The current implementation would accept dates like "0001-01-01" or "9999-12-31" without any validation. Consider adding a sanity check to ensure the year falls within a reasonable range (e.g., between 2007 and current year + 1) to catch potentially malformed API responses or data corruption issues early.

Suggested change
}
}
let currentYear = Calendar.current.component(.year, from: Date())
let minYear = 2007
let maxYear = currentYear + 1
guard (minYear...maxYear).contains(year) else {
throw HandlingError("Unreasonable imagery year: \(year)")
}

Copilot uses AI. Check for mistakes.
@chizberg chizberg merged commit eb3f98a into main Jan 7, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants