diff --git a/Sources/TripKit/Model/Leg.swift b/Sources/TripKit/Model/Leg.swift index d1d007a0..a626cd96 100644 --- a/Sources/TripKit/Model/Leg.swift +++ b/Sources/TripKit/Model/Leg.swift @@ -231,7 +231,7 @@ public class IndividualLeg: NSObject, Leg, NSSecureCoding { } public enum `Type`: Int { - case WALK, BIKE, CAR, TRANSFER + case walk, bike, car, transfer } struct PropertyKey { diff --git a/Sources/TripKit/Provider/AbstractEfaMobileProvider.swift b/Sources/TripKit/Provider/AbstractEfaMobileProvider.swift index 8476bd4b..ecd195d9 100644 --- a/Sources/TripKit/Provider/AbstractEfaMobileProvider.swift +++ b/Sources/TripKit/Provider/AbstractEfaMobileProvider.swift @@ -396,9 +396,9 @@ public class AbstractEfaMobileProvider: AbstractEfaProvider { } let addTime: TimeInterval = !legs.isEmpty ? max(0, -departure.minTime.timeIntervalSince(legs.last!.maxTime)) : 0 if lineDestination.line === Line.FOOTWAY { - legs.append(IndividualLeg(type: .WALK, departureTime: departure.minTime.addingTimeInterval(addTime), departure: departure.location, arrival: arrival.location, arrivalTime: arrival.maxTime.addingTimeInterval(addTime), distance: 0, path: path)) + legs.append(IndividualLeg(type: .walk, departureTime: departure.minTime.addingTimeInterval(addTime), departure: departure.location, arrival: arrival.location, arrivalTime: arrival.maxTime.addingTimeInterval(addTime), distance: 0, path: path)) } else if lineDestination.line === Line.TRANSFER { - legs.append(IndividualLeg(type: .TRANSFER, departureTime: departure.minTime.addingTimeInterval(addTime), departure: departure.location, arrival: arrival.location, arrivalTime: arrival.maxTime.addingTimeInterval(addTime), distance: 0, path: path)) + legs.append(IndividualLeg(type: .transfer, departureTime: departure.minTime.addingTimeInterval(addTime), departure: departure.location, arrival: arrival.location, arrivalTime: arrival.maxTime.addingTimeInterval(addTime), distance: 0, path: path)) } else if lineDestination.line === Line.DO_NOT_CHANGE { if let last = legs.last as? PublicLeg { var lastMessage = "Nicht umsteigen, Weiterfahrt im selben Fahrzeug möglich." diff --git a/Sources/TripKit/Provider/AbstractEfaWebProvider.swift b/Sources/TripKit/Provider/AbstractEfaWebProvider.swift index 0669cc64..1ef272d0 100644 --- a/Sources/TripKit/Provider/AbstractEfaWebProvider.swift +++ b/Sources/TripKit/Provider/AbstractEfaWebProvider.swift @@ -459,11 +459,11 @@ public class AbstractEfaWebProvider: AbstractEfaProvider { } else if meansOfTransportType == 98 && meansOfTransportProductName == "gesicherter Anschluss" { // ignore } else if meansOfTransportType == 99 && meansOfTransportProductName == "Fussweg" { - processIndividualLeg(partialRoute, &legs, .WALK, departureTime, departureLocation, arrivalTime, arrivalLocation) + processIndividualLeg(partialRoute, &legs, .walk, departureTime, departureLocation, arrivalTime, arrivalLocation) } else if meansOfTransportType == 100 && (meansOfTransportProductName == nil || meansOfTransportProductName == "Fussweg") { - processIndividualLeg(partialRoute, &legs, .WALK, departureTime, departureLocation, arrivalTime, arrivalLocation) + processIndividualLeg(partialRoute, &legs, .walk, departureTime, departureLocation, arrivalTime, arrivalLocation) } else if meansOfTransportType == 105 && meansOfTransportProductName == "Taxi" { - processIndividualLeg(partialRoute, &legs, .CAR, departureTime, departureLocation, arrivalTime, arrivalLocation) + processIndividualLeg(partialRoute, &legs, .car, departureTime, departureLocation, arrivalTime, arrivalLocation) } else { throw ParseError(reason: "unknown means of transport: \(meansOfTransportType) \(meansOfTransportProductName ?? "")") } diff --git a/Sources/TripKit/Provider/AbstractHafasClientInterfaceProvider.swift b/Sources/TripKit/Provider/AbstractHafasClientInterfaceProvider.swift index 97edf61f..6c4466f2 100644 --- a/Sources/TripKit/Provider/AbstractHafasClientInterfaceProvider.swift +++ b/Sources/TripKit/Provider/AbstractHafasClientInterfaceProvider.swift @@ -502,7 +502,7 @@ public class AbstractHafasClientInterfaceProvider: AbstractHafasProvider { let gis = sec["gis"] let distance = gis["distance"].intValue let path = parsePath(encodedPolyList: encodedPolyList, jny: gis) - processIndividualLeg(legs: &legs, type: .WALK, departureStop: departureStop, arrivalStop: arrivalStop, distance: distance, path: path) + processIndividualLeg(legs: &legs, type: .walk, departureStop: departureStop, arrivalStop: arrivalStop, distance: distance, path: path) case "KISS": let gis = sec["gis"] let distance = gis["distance"].intValue @@ -514,7 +514,7 @@ public class AbstractHafasClientInterfaceProvider: AbstractHafasProvider { let line = Line(id: nil, network: nil, product: .onDemand, label: providerName, name: providerName, number: nil, vehicleNumber: nil, style: lineStyle(network: nil, product: .onDemand, label: providerName), attr: nil, message: nil, direction: nil) legs.append(PublicLeg(line: line, destination: arrivalStop.location, departure: departureStop, arrival: arrivalStop, intermediateStops: [], message: nil, path: path, journeyContext: nil, loadFactor: nil)) } else { - processIndividualLeg(legs: &legs, type: .WALK, departureStop: departureStop, arrivalStop: arrivalStop, distance: distance, path: path) + processIndividualLeg(legs: &legs, type: .walk, departureStop: departureStop, arrivalStop: arrivalStop, distance: distance, path: path) } default: throw ParseError(reason: "could not parse outcon sec type \(sec["type"].stringValue)") diff --git a/Sources/TripKit/Provider/AbstractHafasLegacyProvider.swift b/Sources/TripKit/Provider/AbstractHafasLegacyProvider.swift index 9e5e6b45..a3eb6313 100644 --- a/Sources/TripKit/Provider/AbstractHafasLegacyProvider.swift +++ b/Sources/TripKit/Provider/AbstractHafasLegacyProvider.swift @@ -1043,16 +1043,16 @@ public class AbstractHafasLegacyProvider: AbstractHafasProvider { let individualType: IndividualLeg.`Type` if let routingType = routingType { if routingType == "FOOT" { - individualType = .WALK + individualType = .walk } else if routingType == "BIKE" { - individualType = .BIKE + individualType = .bike } else if routingType == "CAR" || routingType == "P+R" { - individualType = .CAR + individualType = .car } else { throw ParseError(reason: "unknown routing type \(routingType)") } } else { - individualType = type == 1 ? .WALK : .TRANSFER + individualType = type == 1 ? .walk : .transfer } let departureTime = Date(timeIntervalSince1970: predictedDepartureTime != 0 ? predictedDepartureTime : plannedDepartureTime) diff --git a/Sources/TripKit/Provider/Implementations/HvvProvider.swift b/Sources/TripKit/Provider/Implementations/HvvProvider.swift index 25f2df57..9c531b39 100644 --- a/Sources/TripKit/Provider/Implementations/HvvProvider.swift +++ b/Sources/TripKit/Provider/Implementations/HvvProvider.swift @@ -601,14 +601,14 @@ public class HvvProvider: AbstractNetworkProvider { switch serviceType { case "FOOTPATH": // Individual leg - return IndividualLeg(type: .WALK, departureTime: departure.time, departure: departure.location, arrival: arrival.location, arrivalTime: arrival.time, distance: 0, path: path) + return IndividualLeg(type: .walk, departureTime: departure.time, departure: departure.location, arrival: arrival.location, arrivalTime: arrival.time, distance: 0, path: path) case "BICYCLE": - return IndividualLeg(type: .BIKE, departureTime: departure.time, departure: departure.location, arrival: arrival.location, arrivalTime: arrival.time, distance: 0, path: path) + return IndividualLeg(type: .bike, departureTime: departure.time, departure: departure.location, arrival: arrival.location, arrivalTime: arrival.time, distance: 0, path: path) case "CHANGE", "CHANGE_SAME_PLATFORM": if departure.time == arrival.time { return nil } - return IndividualLeg(type: .TRANSFER, departureTime: departure.time, departure: departure.location, arrival: arrival.location, arrivalTime: arrival.time, distance: 0, path: path) + return IndividualLeg(type: .transfer, departureTime: departure.time, departure: departure.location, arrival: arrival.location, arrivalTime: arrival.time, distance: 0, path: path) case "BUS", "TRAIN", "SHIP": // Public leg let servingLine = parseLineAndDestination(json: json["line"], directionType: nil) diff --git a/Sources/TripKit/Provider/Implementations/VrsProvider.swift b/Sources/TripKit/Provider/Implementations/VrsProvider.swift index bc6ffc0c..df970327 100644 --- a/Sources/TripKit/Provider/Implementations/VrsProvider.swift +++ b/Sources/TripKit/Provider/Implementations/VrsProvider.swift @@ -708,7 +708,7 @@ public class VrsProvider: AbstractNetworkProvider { if type == "walk" { let distance = segment["distance"] as? Int ?? 0 let addTime: TimeInterval = !legs.isEmpty ? max(0, -departurePlanned.timeIntervalSince(legs.last!.maxTime)) : 0 - legs.append(IndividualLeg(type: .WALK, departureTime: departurePlanned.addingTimeInterval(addTime), departure: segmentOrigin, arrival: segmentDestination, arrivalTime: arrivalPlanned.addingTimeInterval(addTime), distance: distance, path: points)) + legs.append(IndividualLeg(type: .walk, departureTime: departurePlanned.addingTimeInterval(addTime), departure: segmentOrigin, arrival: segmentDestination, arrivalTime: arrivalPlanned.addingTimeInterval(addTime), distance: distance, path: points)) } else if type == "publicTransport" { let directionLoc: Location? guard let lineObject = segment["line"] as? [String: Any] else {