Skip to content

Commit 8e0c5d7

Browse files
committed
Merge branch 'develop' into issue/5361-JCP-empty-store-visit-stats
2 parents da36b21 + 0c7caeb commit 8e0c5d7

File tree

29 files changed

+927
-393
lines changed

29 files changed

+927
-393
lines changed

Experiments/Experiments/DefaultFeatureFlagService.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
2727
return buildConfig == .localDeveloper || buildConfig == .alpha
2828
case .jetpackConnectionPackageSupport:
2929
return buildConfig == .localDeveloper || buildConfig == .alpha
30+
case .orderCreation:
31+
return buildConfig == .localDeveloper || buildConfig == .alpha
3032
default:
3133
return true
3234
}

Experiments/Experiments/FeatureFlag.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,8 @@ public enum FeatureFlag: Int {
5353
/// Allows sites with plugins that include Jetpack Connection Package and without Jetpack-the-plugin to connect to the app
5454
///
5555
case jetpackConnectionPackageSupport
56+
57+
/// Allows new orders to be manually created
58+
///
59+
case orderCreation
5660
}

Hardware/Hardware/CardReader/CardReaderConfigProvider.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public protocol ReaderLocationProvider {
1010
func fetchDefaultLocationID(completion: @escaping(String?, Error?) -> Void)
1111
}
1212

13-
public protocol CardReaderConfigProvider: ReaderLocationProvider {
13+
public protocol CardReaderConfigProvider: ReaderLocationProvider, ReaderTokenProvider {
1414
func fetchToken(completion: @escaping(String?, Error?) -> Void)
1515
func fetchDefaultLocationID(completion: @escaping(String?, Error?) -> Void)
1616
}

Hardware/Hardware/CardReader/StripeCardReader/DefaultConnectionTokenProvider.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import StripeTerminal
44
/// uses the networking adapter provided by clients of Hardware
55
/// to fetch a connection token
66
final class DefaultConnectionTokenProvider: ConnectionTokenProvider {
7-
private let provider: CardReaderConfigProvider
7+
private let provider: ReaderTokenProvider
88

9-
init(provider: CardReaderConfigProvider) {
9+
init(provider: ReaderTokenProvider) {
1010
self.provider = provider
1111
}
1212

Hardware/HardwareTests/AirPrintReceipt/ReceiptRendererTest.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ private extension ReceiptRendererTest {
4040
amount: 1,
4141
formattedAmount: "1",
4242
currency: "USD",
43-
date: .init(),
43+
date: .init(timeIntervalSince1970: 1636970486),
4444
storeName: "Test Store",
4545
cardDetails: .init(
4646
last4: "1234",

RELEASE-NOTES.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
*** PLEASE FOLLOW THIS FORMAT: [<priority indicator, more stars = higher priority>] <description> [<PR URL>]
22

3+
8.1
4+
-----
5+
- [internal] Migrated Settings screen to MVVM [https://github.com/woocommerce/woocommerce-ios/pull/5393]
6+
7+
38
8.0
49
-----
510
- [*] Product List: Add support for product filtering by category. [https://github.com/woocommerce/woocommerce-ios/pull/5388]

Storage/Storage/Model/Copiable/Models+Copiable.generated.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ extension GeneralAppSettings {
1010
feedbacks: CopiableProp<[FeedbackType: FeedbackSettings]> = .copy,
1111
isViewAddOnsSwitchEnabled: CopiableProp<Bool> = .copy,
1212
isSimplePaymentsSwitchEnabled: CopiableProp<Bool> = .copy,
13+
isOrderCreationSwitchEnabled: CopiableProp<Bool> = .copy,
1314
knownCardReaders: CopiableProp<[String]> = .copy,
1415
lastEligibilityErrorInfo: NullableCopiableProp<EligibilityErrorInfo> = .copy
1516
) -> GeneralAppSettings {
1617
let installationDate = installationDate ?? self.installationDate
1718
let feedbacks = feedbacks ?? self.feedbacks
1819
let isViewAddOnsSwitchEnabled = isViewAddOnsSwitchEnabled ?? self.isViewAddOnsSwitchEnabled
1920
let isSimplePaymentsSwitchEnabled = isSimplePaymentsSwitchEnabled ?? self.isSimplePaymentsSwitchEnabled
21+
let isOrderCreationSwitchEnabled = isOrderCreationSwitchEnabled ?? self.isOrderCreationSwitchEnabled
2022
let knownCardReaders = knownCardReaders ?? self.knownCardReaders
2123
let lastEligibilityErrorInfo = lastEligibilityErrorInfo ?? self.lastEligibilityErrorInfo
2224

@@ -25,6 +27,7 @@ extension GeneralAppSettings {
2527
feedbacks: feedbacks,
2628
isViewAddOnsSwitchEnabled: isViewAddOnsSwitchEnabled,
2729
isSimplePaymentsSwitchEnabled: isSimplePaymentsSwitchEnabled,
30+
isOrderCreationSwitchEnabled: isOrderCreationSwitchEnabled,
2831
knownCardReaders: knownCardReaders,
2932
lastEligibilityErrorInfo: lastEligibilityErrorInfo
3033
)

Storage/Storage/Model/GeneralAppSettings.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ public struct GeneralAppSettings: Codable, Equatable, GeneratedCopiable {
2828
///
2929
public let isSimplePaymentsSwitchEnabled: Bool
3030

31+
/// The state(`true` or `false`) for the Order Creation feature switch.
32+
///
33+
public let isOrderCreationSwitchEnabled: Bool
34+
3135
/// A list (possibly empty) of known card reader IDs - i.e. IDs of card readers that should be reconnected to automatically
3236
/// e.g. ["CHB204909005931"]
3337
///
@@ -41,12 +45,14 @@ public struct GeneralAppSettings: Codable, Equatable, GeneratedCopiable {
4145
feedbacks: [FeedbackType: FeedbackSettings],
4246
isViewAddOnsSwitchEnabled: Bool,
4347
isSimplePaymentsSwitchEnabled: Bool,
48+
isOrderCreationSwitchEnabled: Bool,
4449
knownCardReaders: [String],
4550
lastEligibilityErrorInfo: EligibilityErrorInfo? = nil) {
4651
self.installationDate = installationDate
4752
self.feedbacks = feedbacks
4853
self.isViewAddOnsSwitchEnabled = isViewAddOnsSwitchEnabled
4954
self.isSimplePaymentsSwitchEnabled = isSimplePaymentsSwitchEnabled
55+
self.isOrderCreationSwitchEnabled = isOrderCreationSwitchEnabled
5056
self.knownCardReaders = knownCardReaders
5157
self.lastEligibilityErrorInfo = lastEligibilityErrorInfo
5258
}
@@ -73,6 +79,7 @@ public struct GeneralAppSettings: Codable, Equatable, GeneratedCopiable {
7379
feedbacks: updatedFeedbacks,
7480
isViewAddOnsSwitchEnabled: isViewAddOnsSwitchEnabled,
7581
isSimplePaymentsSwitchEnabled: isSimplePaymentsSwitchEnabled,
82+
isOrderCreationSwitchEnabled: isOrderCreationSwitchEnabled,
7683
knownCardReaders: knownCardReaders,
7784
lastEligibilityErrorInfo: lastEligibilityErrorInfo
7885
)
@@ -90,6 +97,7 @@ extension GeneralAppSettings {
9097
self.feedbacks = try container.decodeIfPresent([FeedbackType: FeedbackSettings].self, forKey: .feedbacks) ?? [:]
9198
self.isViewAddOnsSwitchEnabled = try container.decodeIfPresent(Bool.self, forKey: .isViewAddOnsSwitchEnabled) ?? false
9299
self.isSimplePaymentsSwitchEnabled = try container.decodeIfPresent(Bool.self, forKey: .isSimplePaymentsSwitchEnabled) ?? false
100+
self.isOrderCreationSwitchEnabled = try container.decodeIfPresent(Bool.self, forKey: .isOrderCreationSwitchEnabled) ?? false
93101
self.knownCardReaders = try container.decodeIfPresent([String].self, forKey: .knownCardReaders) ?? []
94102
self.lastEligibilityErrorInfo = try container.decodeIfPresent(EligibilityErrorInfo.self, forKey: .lastEligibilityErrorInfo)
95103

Storage/Storage/Protocols/StorageManagerType.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public protocol StorageManagerType {
1616
///
1717
var viewStorage: StorageType { get }
1818

19-
/// Returns the `Storage` associated to the main thread.
19+
/// Returns a shared derived storage instance dedicated for write operations.
2020
///
2121
var writerDerivedStorage: StorageType { get }
2222

Storage/StorageTests/Model/AppSettings/GeneralAppSettingsTests.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class GeneralAppSettingsTests: XCTestCase {
1010
feedbacks: [.general: feedback],
1111
isViewAddOnsSwitchEnabled: false,
1212
isSimplePaymentsSwitchEnabled: false,
13+
isOrderCreationSwitchEnabled: false,
1314
knownCardReaders: [])
1415

1516
// When
@@ -25,6 +26,7 @@ class GeneralAppSettingsTests: XCTestCase {
2526
feedbacks: [:],
2627
isViewAddOnsSwitchEnabled: false,
2728
isSimplePaymentsSwitchEnabled: false,
29+
isOrderCreationSwitchEnabled: false,
2830
knownCardReaders: [])
2931

3032
// When
@@ -42,6 +44,7 @@ class GeneralAppSettingsTests: XCTestCase {
4244
feedbacks: [.general: existingFeedback],
4345
isViewAddOnsSwitchEnabled: false,
4446
isSimplePaymentsSwitchEnabled: false,
47+
isOrderCreationSwitchEnabled: false,
4548
knownCardReaders: []
4649
)
4750

@@ -59,6 +62,7 @@ class GeneralAppSettingsTests: XCTestCase {
5962
feedbacks: [:],
6063
isViewAddOnsSwitchEnabled: false,
6164
isSimplePaymentsSwitchEnabled: false,
65+
isOrderCreationSwitchEnabled: false,
6266
knownCardReaders: [])
6367

6468
// When
@@ -79,6 +83,7 @@ class GeneralAppSettingsTests: XCTestCase {
7983
feedbacks: feedbackSettings,
8084
isViewAddOnsSwitchEnabled: true,
8185
isSimplePaymentsSwitchEnabled: true,
86+
isOrderCreationSwitchEnabled: true,
8287
knownCardReaders: readers,
8388
lastEligibilityErrorInfo: eligibilityInfo)
8489

@@ -97,5 +102,6 @@ class GeneralAppSettingsTests: XCTestCase {
97102
assertEqual(newSettings.lastEligibilityErrorInfo, eligibilityInfo)
98103
assertEqual(newSettings.isViewAddOnsSwitchEnabled, false)
99104
assertEqual(newSettings.isSimplePaymentsSwitchEnabled, true)
105+
assertEqual(newSettings.isOrderCreationSwitchEnabled, true)
100106
}
101107
}

0 commit comments

Comments
 (0)