Skip to content

Commit 3b04ae8

Browse files
committed
Display localized title for attendance status in the fitlers
1 parent 60f8666 commit 3b04ae8

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

Modules/Sources/Yosemite/Model/Model.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public typealias BlazeTargetLocation = Networking.BlazeTargetLocation
2727
public typealias BlazeTargetTopic = Networking.BlazeTargetTopic
2828
public typealias Booking = Networking.Booking
2929
public typealias BookingStatus = Networking.BookingStatus
30-
public typealias BookingAttendanceStatus = Networking.BookingAttendanceStatus
3130
public typealias BookingOrderInfo = Networking.BookingOrderInfo
3231
public typealias BookingCustomerInfo = Networking.BookingCustomerInfo
3332
public typealias BookingPaymentInfo = Networking.BookingPaymentInfo

WooCommerce/Classes/Bookings/BookingFilters/BookingFiltersViewModel.swift

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ final class BookingFiltersViewModel: FilterListViewModel {
141141
readable.append(product.name)
142142
}
143143
if let attendanceStatus {
144-
readable.append(attendanceStatus.rawValue) // TODO: update to localized title when available
144+
readable.append(attendanceStatus.localizedTitle)
145145
}
146146
if let paymentStatus {
147147
readable.append(paymentStatus.localizedTitle)
@@ -230,16 +230,14 @@ extension BookingFiltersViewModel.BookingListFilter {
230230

231231
// MARK: - FilterType conformance
232232
extension BookingResource: FilterType {
233-
public var description: String { name }
234-
public var isActive: Bool { true }
233+
var description: String { name }
234+
var isActive: Bool { true }
235235
}
236236

237237
extension BookingAttendanceStatus: FilterType {
238-
public var description: String {
239-
"" // TODO: use localized title later
240-
}
238+
var description: String { localizedTitle }
241239

242-
public var isActive: Bool {
240+
var isActive: Bool {
243241
switch self {
244242
case .booked, .checkedIn, .cancelled, .noShow:
245243
return true
@@ -250,9 +248,9 @@ extension BookingAttendanceStatus: FilterType {
250248
}
251249

252250
extension BookingStatus: FilterType {
253-
public var description: String { localizedTitle }
251+
var description: String { localizedTitle }
254252

255-
public var isActive: Bool {
253+
var isActive: Bool {
256254
switch self {
257255
case .complete, .paid, .unpaid, .cancelled, .pendingConfirmation, .confirmed:
258256
return true
@@ -264,14 +262,14 @@ extension BookingStatus: FilterType {
264262

265263
extension FilterBookingsByProduct: FilterType {
266264
/// The user-facing description of the filter value.
267-
public var description: String { name }
265+
var description: String { name }
268266

269267
/// Whether the filter is set to a non-empty value.
270-
public var isActive: Bool { true }
268+
var isActive: Bool { true }
271269
}
272270

273271
extension BookingDateRangeFilter: FilterType {
274-
public var description: String {
272+
var description: String {
275273
// TODO: Format dates nicely when implementing date range selector
276274
if let startDate = startDate, let endDate = endDate {
277275
let formatter = DateFormatter()
@@ -299,7 +297,7 @@ extension BookingDateRangeFilter: FilterType {
299297
}
300298
}
301299

302-
public var isActive: Bool {
300+
var isActive: Bool {
303301
startDate != nil || endDate != nil
304302
}
305303
}

WooCommerce/Classes/ViewRelated/Bookings/Booking Details/UpdateAttendanceStatusView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ struct UpdateAttendanceStatusView: View {
2828
Text(status.title)
2929
.font(.body.weight(.medium))
3030
.fixedSize(horizontal: false, vertical: true)
31-
Text(status.description)
31+
Text(status.information)
3232
.font(.subheadline)
3333
.foregroundColor(.secondary)
3434
.fixedSize(horizontal: false, vertical: true)
@@ -72,7 +72,7 @@ private extension BookingAttendanceStatus {
7272
}
7373
}
7474

75-
var description: String {
75+
var information: String {
7676
switch self {
7777
case .booked:
7878
return UpdateAttendanceStatusView.Localization.bookedDescription

0 commit comments

Comments
 (0)