Skip to content

Commit 73e0ff8

Browse files
committed
Merge branch 'trunk' into xcode-14
2 parents 5688454 + 456fdaf commit 73e0ff8

File tree

65 files changed

+1234
-402
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1234
-402
lines changed

.buildkite/commands/run-ui-tests.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,6 @@ echo "--- 🧪 Testing"
3636
xcrun simctl list >> /dev/null
3737
rake mocks &
3838
bundle exec fastlane test_without_building name:"$TEST_NAME" device:"$DEVICE" ios_version:"$IOS_VERSION"
39+
40+
echo "--- 📦 Zipping test results"
41+
cd fastlane/test_output/ && zip -rq WooCommerce.xcresult.zip WooCommerce.xcresult && cd -

.buildkite/commands/run-unit-tests.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ install_gems
1717

1818
echo "--- 🧪 Testing"
1919
bundle exec fastlane test_without_building name:UnitTests
20+
21+
echo "--- 📦 Zipping test results"
22+
cd fastlane/test_output/ && zip -rq WooCommerce.xcresult.zip WooCommerce.xcresult && cd -

.buildkite/pipeline.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ steps:
4444
depends_on: "build"
4545
env: *common_env
4646
plugins: *common_plugins
47+
artifact_paths:
48+
- "fastlane/test_output/*"
4749
notify:
4850
- github_commit_status:
4951
context: "Unit Tests"
@@ -71,7 +73,7 @@ steps:
7173
env: *common_env
7274
plugins: *common_plugins
7375
artifact_paths:
74-
- "build/results/"
76+
- "fastlane/test_output/*"
7577
notify:
7678
- github_commit_status:
7779
context: "UI Tests (iPhone)"
@@ -82,7 +84,7 @@ steps:
8284
env: *common_env
8385
plugins: *common_plugins
8486
artifact_paths:
85-
- "build/results/"
87+
- "fastlane/test_output/*"
8688
notify:
8789
- github_commit_status:
8890
context: "UI Tests (iPad)"

Experiments/Experiments/ABTest.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ public enum ABTest: String, CaseIterable {
1414

1515
/// A/A test to make sure there is no bias in the logged out state.
1616
/// Experiment ref: pbxNRc-1S0-p2
17-
case aaTestLoggedOut202208 = "woocommerceios_explat_aa_test_logged_out_202208"
17+
case aaTestLoggedOut202209 = "woocommerceios_explat_aa_test_logged_out_202209"
1818

1919
/// A/B test for promoting linked products in Product Details.
2020
/// Experiment ref: pbxNRc-1Pp-p2
2121
case linkedProductsPromo = "woocommerceios_product_details_linked_products_banner"
2222

2323
/// A/B test for the login button order on the prologues screen.
2424
/// Experiment ref: pbxNRc-1VA-p2
25-
case loginPrologueButtonOrder = "woocommerceios_login_prologue_button_order"
25+
case loginPrologueButtonOrder = "woocommerceios_login_prologue_button_order_202209"
2626

2727
/// Returns a variation for the given experiment
2828
public var variation: Variation {

Experiments/Experiments/DefaultFeatureFlagService.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
1111
return true
1212
case .hubMenu:
1313
return true
14-
case .systemStatusReport:
15-
return true
1614
case .couponView:
1715
return true
1816
case .productSKUInputScanner:

Experiments/Experiments/FeatureFlag.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ public enum FeatureFlag: Int {
2222
///
2323
case hubMenu
2424

25-
/// Displays the System Status Report on Settings/Help screen
26-
///
27-
case systemStatusReport
28-
2925
/// Displays the option to view coupons
3026
///
3127
case couponView

Networking/Networking/Remote/LeaderboardsRemote.swift

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,23 @@ public class LeaderboardsRemote: Remote {
1212
/// - earliestDateToInclude: The earliest date to include in the results. This string is ISO8601 compliant
1313
/// - latestDateToInclude: The latest date to include in the results. This string is ISO8601 compliant
1414
/// - quantity: Number of results to fetch
15+
/// - forceRefresh: Whether to enforce the data being refreshed.
1516
/// - completion: Closure to be executed upon completion.
1617
///
1718
public func loadLeaderboards(for siteID: Int64,
1819
unit: StatsGranularityV4,
1920
earliestDateToInclude: String,
2021
latestDateToInclude: String,
2122
quantity: Int,
23+
forceRefresh: Bool,
2224
completion: @escaping (Result<[Leaderboard], Error>) -> Void) {
23-
let parameters = [ParameterKeys.interval: unit.rawValue,
24-
ParameterKeys.after: earliestDateToInclude,
25-
ParameterKeys.before: latestDateToInclude,
26-
ParameterKeys.quantity: String(quantity)]
25+
let parameters: [String: Any] = [
26+
ParameterKeys.interval: unit.rawValue,
27+
ParameterKeys.after: earliestDateToInclude,
28+
ParameterKeys.before: latestDateToInclude,
29+
ParameterKeys.quantity: String(quantity),
30+
ParameterKeys.forceRefresh: forceRefresh
31+
]
2732

2833
let request = JetpackRequest(wooApiVersion: .wcAnalytics, method: .get, siteID: siteID, path: Constants.path, parameters: parameters)
2934
let mapper = LeaderboardListMapper()
@@ -39,18 +44,23 @@ public class LeaderboardsRemote: Remote {
3944
/// - earliestDateToInclude: The earliest date to include in the results. This string is ISO8601 compliant
4045
/// - latestDateToInclude: The latest date to include in the results. This string is ISO8601 compliant
4146
/// - quantity: Number of results to fetch
47+
/// - forceRefresh: Whether to enforce the data being refreshed
4248
/// - completion: Closure to be executed upon completion
4349
///
4450
public func loadLeaderboardsDeprecated(for siteID: Int64,
4551
unit: StatsGranularityV4,
4652
earliestDateToInclude: String,
4753
latestDateToInclude: String,
4854
quantity: Int,
55+
forceRefresh: Bool,
4956
completion: @escaping (Result<[Leaderboard], Error>) -> Void) {
50-
let parameters = [ParameterKeys.interval: unit.rawValue,
51-
ParameterKeys.after: earliestDateToInclude,
52-
ParameterKeys.before: latestDateToInclude,
53-
ParameterKeys.quantity: String(quantity)]
57+
let parameters: [String: Any] = [
58+
ParameterKeys.interval: unit.rawValue,
59+
ParameterKeys.after: earliestDateToInclude,
60+
ParameterKeys.before: latestDateToInclude,
61+
ParameterKeys.quantity: String(quantity),
62+
ParameterKeys.forceRefresh: forceRefresh
63+
]
5464

5565
let request = JetpackRequest(wooApiVersion: .wcAnalytics, method: .get, siteID: siteID, path: Constants.pathDeprecated, parameters: parameters)
5666
let mapper = LeaderboardListMapper()
@@ -68,9 +78,10 @@ private extension LeaderboardsRemote {
6878
}
6979

7080
enum ParameterKeys {
71-
static let interval: String = "interval"
72-
static let after: String = "after"
73-
static let before: String = "before"
74-
static let quantity: String = "per_page"
81+
static let interval = "interval"
82+
static let after = "after"
83+
static let before = "before"
84+
static let quantity = "per_page"
85+
static let forceRefresh = "force_cache_refresh"
7586
}
7687
}

Networking/Networking/Remote/OrderStatsRemoteV4.swift

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ public final class OrderStatsRemoteV4: Remote {
66
/// Fetch the order stats for a given site, depending on the given granularity of the `unit` parameter.
77
///
88
/// - Parameters:
9-
/// - siteID: The site ID
10-
/// - unit: Defines the granularity of the stats we are fetching (one of 'hourly', 'daily', 'weekly', 'monthly', or 'yearly')
9+
/// - siteID: The site ID.
10+
/// - unit: Defines the granularity of the stats we are fetching (one of 'hourly', 'daily', 'weekly', 'monthly', or 'yearly').
11+
/// - earliestDateToInclude: The earliest date to include in the results.
1112
/// - latestDateToInclude: The latest date to include in the results.
13+
/// - quantity: The number of intervals to fetch the order stats.
14+
/// - forceRefresh: Whether to enforce the data being refreshed.
1215
/// - completion: Closure to be executed upon completion.
1316
///
1417
/// Note: by limiting the return values with the `_fields` param, we shrink the response size by over 90%! (~40kb to ~3kb)
@@ -18,13 +21,17 @@ public final class OrderStatsRemoteV4: Remote {
1821
earliestDateToInclude: Date,
1922
latestDateToInclude: Date,
2023
quantity: Int,
24+
forceRefresh: Bool,
2125
completion: @escaping (Result<OrderStatsV4, Error>) -> Void) {
2226
let dateFormatter = DateFormatter.Defaults.iso8601WithoutTimeZone
2327

24-
let parameters = [ParameterKeys.interval: unit.rawValue,
25-
ParameterKeys.after: dateFormatter.string(from: earliestDateToInclude),
26-
ParameterKeys.before: dateFormatter.string(from: latestDateToInclude),
27-
ParameterKeys.quantity: String(quantity)]
28+
let parameters: [String: Any] = [
29+
ParameterKeys.interval: unit.rawValue,
30+
ParameterKeys.after: dateFormatter.string(from: earliestDateToInclude),
31+
ParameterKeys.before: dateFormatter.string(from: latestDateToInclude),
32+
ParameterKeys.quantity: String(quantity),
33+
ParameterKeys.forceRefresh: forceRefresh
34+
]
2835

2936
let request = JetpackRequest(wooApiVersion: .wcAnalytics, method: .get, siteID: siteID, path: Constants.orderStatsPath, parameters: parameters)
3037
let mapper = OrderStatsV4Mapper(siteID: siteID, granularity: unit)
@@ -41,9 +48,10 @@ private extension OrderStatsRemoteV4 {
4148
}
4249

4350
enum ParameterKeys {
44-
static let interval: String = "interval"
45-
static let after: String = "after"
46-
static let before: String = "before"
47-
static let quantity: String = "per_page"
51+
static let interval = "interval"
52+
static let after = "after"
53+
static let before = "before"
54+
static let quantity = "per_page"
55+
static let forceRefresh = "force_cache_refresh"
4856
}
4957
}

Networking/NetworkingTests/Remote/LeaderboardsRemoteTests.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ final class LeaderboardsRemoteV4Tests: XCTestCase {
2424
unit: .yearly,
2525
earliestDateToInclude: "2020-01-01T00:00:00",
2626
latestDateToInclude: "2020-12-31T23:59:59",
27-
quantity: 3) { result in
27+
quantity: 3,
28+
forceRefresh: false) { result in
2829
promise(result)
2930
}
3031
}
@@ -62,7 +63,8 @@ final class LeaderboardsRemoteV4Tests: XCTestCase {
6263
unit: .yearly,
6364
earliestDateToInclude: "2020-01-01T00:00:00",
6465
latestDateToInclude: "2020-12-31T23:59:59",
65-
quantity: 3) { result in
66+
quantity: 3,
67+
forceRefresh: false) { result in
6668
promise(result)
6769
}
6870
}
@@ -100,7 +102,8 @@ final class LeaderboardsRemoteV4Tests: XCTestCase {
100102
unit: .yearly,
101103
earliestDateToInclude: "2020-01-01T00:00:00",
102104
latestDateToInclude: "2020-12-31T23:59:59",
103-
quantity: 3) { result in
105+
quantity: 3,
106+
forceRefresh: false) { result in
104107
remoteResult = result
105108
exp.fulfill()
106109
}

Networking/NetworkingTests/Remote/OrderStatsRemoteV4Tests.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ final class OrderStatsRemoteV4Tests: XCTestCase {
3333
unit: .hourly,
3434
earliestDateToInclude: Date(),
3535
latestDateToInclude: Date(),
36-
quantity: 24) { result in
36+
quantity: 24,
37+
forceRefresh: false) { result in
3738
promise(result)
3839
}
3940
}
@@ -58,7 +59,8 @@ final class OrderStatsRemoteV4Tests: XCTestCase {
5859
unit: .weekly,
5960
earliestDateToInclude: Date(),
6061
latestDateToInclude: Date(),
61-
quantity: 2) { result in
62+
quantity: 2,
63+
forceRefresh: false) { result in
6264
promise(result)
6365
}
6466
}
@@ -81,7 +83,8 @@ final class OrderStatsRemoteV4Tests: XCTestCase {
8183
unit: .daily,
8284
earliestDateToInclude: Date(),
8385
latestDateToInclude: Date(),
84-
quantity: 31) { result in
86+
quantity: 31,
87+
forceRefresh: false) { result in
8588
promise(result)
8689
}
8790
}

0 commit comments

Comments
 (0)