-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor how product categorization and filtering is done to make it …
…clearer.
- Loading branch information
1 parent
34442d1
commit f1b37ed
Showing
5 changed files
with
81 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...iewRelated/Products/Edit Product/BottomSheetListSelector/BottomSheetProductCategory.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import Foundation | ||
|
||
/// Product creation option's category. | ||
/// Used to group the options on the product creation sheet. | ||
/// | ||
enum BottomSheetProductCategory: CaseIterable { | ||
case standard | ||
case subscription | ||
case other | ||
|
||
/// Categorization for each available product types. | ||
/// Depending on store configurations, some types will need to be excluded before being used in the UI. | ||
var productTypes: [BottomSheetProductType] { | ||
switch self { | ||
case .standard: | ||
return [.simple(isVirtual: false), .simple(isVirtual: true), .variable, .blank] | ||
case .subscription: | ||
return [.subscription, .variableSubscription] | ||
case .other: | ||
return [.custom("custom"), .grouped, .affiliate] | ||
} | ||
} | ||
|
||
var label: String { | ||
switch self { | ||
case .standard: | ||
return NSLocalizedString( | ||
"productCreationCategory.standard", | ||
value: "Standard", | ||
comment: "Category label for standard product creation types" | ||
) | ||
case .subscription: | ||
return NSLocalizedString( | ||
"productCreationCategory.subscription", | ||
value: "Subscription", | ||
comment: "Category label for subscription product creation types" | ||
) | ||
case .other: | ||
return NSLocalizedString( | ||
"productCreationCategory.other", | ||
value: "Other", | ||
comment: "Category label for other product creation types" | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters