Skip to content

Commit

Permalink
Added new filters to car market: batteryCapacity, drivingRange & maxT…
Browse files Browse the repository at this point in the history
…railerWeight (#290)
  • Loading branch information
osanoj authored Jun 6, 2019
1 parent 6666768 commit 131fb2a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Sources/Charcoal/Models/FilterUnit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public enum FilterUnit: Equatable {
case seats
case squareMeters
case year
case kiloWattHour
case custom(
value: String,
accessibilityValue: String,
Expand Down Expand Up @@ -46,6 +47,8 @@ public enum FilterUnit: Equatable {
return "unit.squareMeters.value".localized()
case .year:
return ""
case .kiloWattHour:
return "unit.kiloWattHour.value".localized()
case let .custom(value, _, _):
return value
}
Expand Down Expand Up @@ -75,6 +78,8 @@ public enum FilterUnit: Equatable {
return "unit.squareMeters.accessibilityValue".localized()
case .year:
return "unit.years.accessibilityValue".localized()
case .kiloWattHour:
return "unit.kiloWattHour.accessibilityValue".localized()
case let .custom(_, accessibilityValue, _):
return accessibilityValue
}
Expand Down
2 changes: 2 additions & 0 deletions Sources/Charcoal/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"unit.kilometers.value" = "km";
"unit.seats.value" = "seter";
"unit.squareMeters.value" = "m²";
"unit.kiloWattHour.value" = "kWh";

"unit.centimeters.accessibilityValue" = "centimeter";
"unit.cubicCentimeters.accessibilityValue" = "kubikkcentimeter";
Expand All @@ -58,6 +59,7 @@
"unit.seats.accessibilityValue" = "seter";
"unit.squareMeters.accessibilityValue" = "kvadratmeter";
"unit.years.accessibilityValue" = "år";
"unit.kiloWattHour.accessibilityValue" = "kilowattime";

"map.title" = "Område i kart";
"map.homeAddress" = "Min hjemmeadresse";
Expand Down
3 changes: 3 additions & 0 deletions Sources/FINNSetup/FilterKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,7 @@ public enum FilterKey: String, CodingKey {
case wheelSets = "wheel_sets"
case womenClothingBrand = "women_clothing_brand"
case year
case batteryCapacity = "battery_capacity"
case drivingRange = "driving_range"
case maxTrailerWeight = "max_trailer_weight"
}
15 changes: 15 additions & 0 deletions Sources/FINNSetup/FilterMarkets/FilterMarketCar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ extension FilterMarketCar: FilterConfiguration {
.mileage,
.leasepriceInit,
.leasepriceMonth,
.batteryCapacity,
.drivingRange,
.maxTrailerWeight,
.price,
.map,
.location,
Expand All @@ -56,6 +59,9 @@ extension FilterMarketCar: FilterConfiguration {
.map,
.location,
.year,
.batteryCapacity,
.drivingRange,
.maxTrailerWeight,
.price,
.mileage,
.engineEffect,
Expand Down Expand Up @@ -111,6 +117,9 @@ extension FilterMarketCar: FilterConfiguration {
return [
.leasepriceInit,
.leasepriceMonth,
.batteryCapacity,
.drivingRange,
.maxTrailerWeight,
]
}

Expand Down Expand Up @@ -191,6 +200,12 @@ extension FilterMarketCar: FilterConfiguration {
default:
return nil
}
case .batteryCapacity:
return .configuration(minimumValue: 0, maximumValue: 150, increment: 10, unit: .kiloWattHour)
case .drivingRange:
return .configuration(minimumValue: 0, maximumValue: 750, increment: 50, unit: .kilometers)
case .maxTrailerWeight:
return .configuration(minimumValue: 0, maximumValue: 4000, increment: 200, unit: .kilograms)
default:
return nil
}
Expand Down

0 comments on commit 131fb2a

Please sign in to comment.