// FuelBoardLiveActivity.swift — Live Activity shared model. // // Compiled into BOTH the app target (to start/update/end the activity) and // the widget extension (to render it). ActivityKit is iOS-only, so this file // is deliberately NOT symlinked into FuelBoardTests/Sources — the SPM test // target runs on macOS where ActivityKit does not exist. // // The activity mirrors the app's TOP badge: the cheapest station selling the // app's selected fuel within the app's chosen distance radius. Tapping the // activity opens Apple Maps driving directions to that station (maps://). import ActivityKit import Foundation /// Attributes are fixed at request time. Here they pin the FUEL being /// tracked; everything that can change while driving (station, price, /// distance) lives in ContentState so updates don't need a new activity. struct FuelBoardLiveActivityAttributes: ActivityAttributes { var fuel: FuelType public struct ContentState: Codable, Hashable { var stationID: String var stationName: String var brand: String /// Price in pence per litre (same unit as `FuelStation.prices`). var pricePence: Double var distanceKM: Double var lat: Double var lng: Double var updatedAt: Date } }