Skip to content

Commit 5b03557

Browse files
committed
Add auto-draft support to OrderStatusEnum
1 parent 4f6279e commit 5b03557

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

Networking/Networking/Model/OrderStatusEnum.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import Codegen
77
/// and it is used to determine the user facing display order
88
///
99
public enum OrderStatusEnum: Codable, Hashable, Comparable, GeneratedFakeable {
10+
case autoDraft
1011
case pending
1112
case processing
1213
case onHold
@@ -25,6 +26,8 @@ extension OrderStatusEnum: RawRepresentable {
2526
///
2627
public init(rawValue: String) {
2728
switch rawValue {
29+
case Keys.autoDraft:
30+
self = .autoDraft
2831
case Keys.pending:
2932
self = .pending
3033
case Keys.processing:
@@ -48,6 +51,7 @@ extension OrderStatusEnum: RawRepresentable {
4851
///
4952
public var rawValue: String {
5053
switch self {
54+
case .autoDraft: return Keys.autoDraft
5155
case .pending: return Keys.pending
5256
case .processing: return Keys.processing
5357
case .onHold: return Keys.onHold
@@ -64,6 +68,7 @@ extension OrderStatusEnum: RawRepresentable {
6468
/// Enum containing the 'Known' OrderStatus Keys
6569
///
6670
private enum Keys {
71+
static let autoDraft = "auto-draft"
6772
static let pending = "pending"
6873
static let processing = "processing"
6974
static let onHold = "on-hold"

WooCommerce/Classes/Extensions/UILabel+OrderStatus.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extension UILabel {
2727
///
2828
private func applyBackground(for statusEnum: OrderStatusEnum) {
2929
switch statusEnum {
30-
case .pending, .completed, .cancelled, .refunded, .custom:
30+
case .autoDraft, .pending, .completed, .cancelled, .refunded, .custom:
3131
backgroundColor = .gray(.shade5)
3232
case .onHold:
3333
backgroundColor = .withColorStudio(.orange, shade: .shade5)

WooCommerce/Classes/ViewRelated/Orders/Order Creation/NewOrderViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ extension NewOrderViewModel {
280280
title = orderStatus.name ?? orderStatus.slug
281281
color = {
282282
switch orderStatus.status {
283-
case .pending, .completed, .cancelled, .refunded, .custom:
283+
case .autoDraft, .pending, .completed, .cancelled, .refunded, .custom:
284284
return .gray(.shade5)
285285
case .onHold:
286286
return .withColorStudio(.orange, shade: .shade5)

WooCommerce/Classes/ViewRelated/Orders/Order Filters/FilterOrderListViewModel.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ extension OrderStatusEnum: FilterType {
117117
///
118118
var description: String {
119119
switch self {
120+
case .autoDraft:
121+
return NSLocalizedString("Draft", comment: "Display label for auto-draft order status.")
120122
case .pending:
121123
return NSLocalizedString("Pending", comment: "Display label for pending order status.")
122124
case .processing:

0 commit comments

Comments
 (0)