Skip to content

Commit ac16053

Browse files
committed
Merge branch 'trunk' into task/stripe-sdk-update-4.2.0
2 parents d83cbbc + 1241471 commit ac16053

File tree

160 files changed

+5939
-850
lines changed

Some content is hidden

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

160 files changed

+5939
-850
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<!--
22
Contains editorialized release notes. Raw release notes should go into `RELEASE-NOTES.txt`.
33
-->
4+
## 22.0
5+
This update adds the option to set different notification preferences for each store. In Orders and Products, your filters stay around as you move through the app, and we've fixed a crash that could happen when you choose pictures for your products. Payments is improved too, with support for Puerto Rico in WooPayments, and better accessibility.
6+
47
## 21.9
58
We're dedicated to enhancing your WooCommerce app experience! We've ironed out the issues related to discarding images during uploads in the Product Form. Plus, we've ramped up our login flow accessibility to make your journey smoother and more intuitive. Enjoy the fresh update and newly polished features!
69

Experiments/Experiments/DefaultFeatureFlagService.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
7272
case .pointOfSale:
7373
return buildConfig == .localDeveloper || buildConfig == .alpha
7474
case .enableCouponsInPointOfSale:
75-
return buildConfig == .localDeveloper || buildConfig == .alpha
75+
return false
7676
case .googleAdsCampaignCreationOnWebView:
7777
return true
7878
case .backgroundTasks:
@@ -92,9 +92,13 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
9292
case .hideSitesInStorePicker:
9393
return true
9494
case .filterHistoryOnOrderAndProductLists:
95-
return buildConfig == .localDeveloper || buildConfig == .alpha
95+
return true
9696
case .backgroundProductImageUpload:
9797
return buildConfig == .localDeveloper || buildConfig == .alpha
98+
case .notificationSettings:
99+
return true
100+
case .allowMerchantAIAPIKey:
101+
return false
98102
default:
99103
return true
100104
}

Experiments/Experiments/FeatureFlag.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,12 @@ public enum FeatureFlag: Int {
204204
/// Supports uploading product images in background
205205
///
206206
case backgroundProductImageUpload
207+
208+
/// Supports managing notification settings from the app settings
209+
///
210+
case notificationSettings
211+
212+
/// Allows merchants to use their own API keys for AI-powered features
213+
///
214+
case allowMerchantAIAPIKey
207215
}

Fakes/Fakes/Networking.generated.swift

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2118,7 +2118,8 @@ extension Networking.ShippingLabelPurchase {
21182118
refundableAmount: .fake(),
21192119
status: .fake(),
21202120
productIDs: .fake(),
2121-
productNames: .fake()
2121+
productNames: .fake(),
2122+
shipmentID: .fake()
21222123
)
21232124
}
21242125
}
@@ -2804,6 +2805,26 @@ extension Networking.WooShippingCarrierPredefinedOptions {
28042805
)
28052806
}
28062807
}
2808+
extension Networking.WooShippingConfig {
2809+
/// Returns a "ready to use" type filled with fake values.
2810+
///
2811+
public static func fake() -> Networking.WooShippingConfig {
2812+
.init(
2813+
siteID: .fake(),
2814+
shipments: .fake(),
2815+
shippingLabelData: .fake()
2816+
)
2817+
}
2818+
}
2819+
extension Networking.WooShippingConfigResponse {
2820+
/// Returns a "ready to use" type filled with fake values.
2821+
///
2822+
public static func fake() -> Networking.WooShippingConfigResponse {
2823+
.init(
2824+
config: .fake()
2825+
)
2826+
}
2827+
}
28072828
extension Networking.WooShippingCreatePackageResponse {
28082829
/// Returns a "ready to use" type filled with fake values.
28092830
///
@@ -2957,6 +2978,16 @@ extension Networking.WooShippingSavedPredefinedPackage {
29572978
)
29582979
}
29592980
}
2981+
extension Networking.WooShippingShipment {
2982+
/// Returns a "ready to use" type filled with fake values.
2983+
///
2984+
public static func fake() -> Networking.WooShippingShipment {
2985+
.init(
2986+
id: .fake(),
2987+
subItems: .fake()
2988+
)
2989+
}
2990+
}
29602991
extension Networking.WordPressMedia {
29612992
/// Returns a "ready to use" type filled with fake values.
29622993
///

Networking/Networking.xcodeproj/project.pbxproj

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,7 +1257,13 @@
12571257
EE6FDCFC2966A70400E1CECF /* product-without-data.json in Resources */ = {isa = PBXBuildFile; fileRef = EE6FDCFB2966A70400E1CECF /* product-without-data.json */; };
12581258
EE71CC3D2951A8EA0074D908 /* ApplicationPasswordStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE71CC3C2951A8EA0074D908 /* ApplicationPasswordStorage.swift */; };
12591259
EE71CC412951CE700074D908 /* generate-application-password-using-wporg-creds-success.json in Resources */ = {isa = PBXBuildFile; fileRef = EE71CC402951CE700074D908 /* generate-application-password-using-wporg-creds-success.json */; };
1260+
EE74B1EA2D895F05000E4C56 /* WooShippingConfigMapperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE74B1E92D895F00000E4C56 /* WooShippingConfigMapperTests.swift */; };
1261+
EE74B1ED2D895FA4000E4C56 /* shipping-label-config-success.json in Resources */ = {isa = PBXBuildFile; fileRef = EE74B1EB2D895FA4000E4C56 /* shipping-label-config-success.json */; };
1262+
EE74B1EE2D895FA4000E4C56 /* shipping-label-config-success-without-data.json in Resources */ = {isa = PBXBuildFile; fileRef = EE74B1EC2D895FA4000E4C56 /* shipping-label-config-success-without-data.json */; };
12601263
EE76762F2962B85E000066FA /* RequestProcessorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE76762E2962B85E000066FA /* RequestProcessorTests.swift */; };
1264+
EE7E80B82D84F19100E6FF5B /* WooShippingConfigMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE7E80B72D84F18700E6FF5B /* WooShippingConfigMapper.swift */; };
1265+
EE7E80BA2D84F42E00E6FF5B /* WooShippingConfigResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE7E80B92D84F41500E6FF5B /* WooShippingConfigResponse.swift */; };
1266+
EE7E80BD2D84F55100E6FF5B /* WooShippingShipment.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE7E80BC2D84F54800E6FF5B /* WooShippingShipment.swift */; };
12611267
EE80A24729547F8B003591E4 /* coupons-all-without-data.json in Resources */ = {isa = PBXBuildFile; fileRef = EE80A24529547F8B003591E4 /* coupons-all-without-data.json */; };
12621268
EE80A24829547F8B003591E4 /* coupon-without-data.json in Resources */ = {isa = PBXBuildFile; fileRef = EE80A24629547F8B003591E4 /* coupon-without-data.json */; };
12631269
EE80A25029556FBD003591E4 /* coupon-reports-without-data.json in Resources */ = {isa = PBXBuildFile; fileRef = EE80A24F29556FBD003591E4 /* coupon-reports-without-data.json */; };
@@ -2488,7 +2494,13 @@
24882494
EE6FDCFB2966A70400E1CECF /* product-without-data.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "product-without-data.json"; sourceTree = "<group>"; };
24892495
EE71CC3C2951A8EA0074D908 /* ApplicationPasswordStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApplicationPasswordStorage.swift; sourceTree = "<group>"; };
24902496
EE71CC402951CE700074D908 /* generate-application-password-using-wporg-creds-success.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "generate-application-password-using-wporg-creds-success.json"; sourceTree = "<group>"; };
2497+
EE74B1E92D895F00000E4C56 /* WooShippingConfigMapperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WooShippingConfigMapperTests.swift; sourceTree = "<group>"; };
2498+
EE74B1EB2D895FA4000E4C56 /* shipping-label-config-success.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = "shipping-label-config-success.json"; sourceTree = "<group>"; };
2499+
EE74B1EC2D895FA4000E4C56 /* shipping-label-config-success-without-data.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = "shipping-label-config-success-without-data.json"; sourceTree = "<group>"; };
24912500
EE76762E2962B85E000066FA /* RequestProcessorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestProcessorTests.swift; sourceTree = "<group>"; };
2501+
EE7E80B72D84F18700E6FF5B /* WooShippingConfigMapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WooShippingConfigMapper.swift; sourceTree = "<group>"; };
2502+
EE7E80B92D84F41500E6FF5B /* WooShippingConfigResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WooShippingConfigResponse.swift; sourceTree = "<group>"; };
2503+
EE7E80BC2D84F54800E6FF5B /* WooShippingShipment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WooShippingShipment.swift; sourceTree = "<group>"; };
24922504
EE80A24529547F8B003591E4 /* coupons-all-without-data.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "coupons-all-without-data.json"; sourceTree = "<group>"; };
24932505
EE80A24629547F8B003591E4 /* coupon-without-data.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "coupon-without-data.json"; sourceTree = "<group>"; };
24942506
EE80A24F29556FBD003591E4 /* coupon-reports-without-data.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "coupon-reports-without-data.json"; sourceTree = "<group>"; };
@@ -2601,6 +2613,7 @@
26012613
02C2548225635BB500A04423 /* ShippingLabel */ = {
26022614
isa = PBXGroup;
26032615
children = (
2616+
EE7E80BB2D84F4E900E6FF5B /* Shipments */,
26042617
EE1042AB2D64E409005AB07F /* VerifyDestinationAddress */,
26052618
02C254B525637A8300A04423 /* Enums */,
26062619
029BA4F3255D72EC006171FD /* ShippingLabelPrintData.swift */,
@@ -3273,6 +3286,8 @@
32733286
DE66C5602977CB5F00DAA978 /* shipping-label-eligibility-success-without-data.json */,
32743287
DE66C55E2977C67D00DAA978 /* shipping-label-account-settings-without-data.json */,
32753288
DE66C55C2977C35A00DAA978 /* shipping-label-packages-success-without-data.json */,
3289+
EE74B1EB2D895FA4000E4C56 /* shipping-label-config-success.json */,
3290+
EE74B1EC2D895FA4000E4C56 /* shipping-label-config-success-without-data.json */,
32763291
DE66C55A2977C1A000DAA978 /* order-shipping-labels-without-data.json */,
32773292
DE66C558297799CF00DAA978 /* add-on-groups-without-data.json */,
32783293
DE66C5542976662700DAA978 /* just-in-time-message-list-without-data.json */,
@@ -3790,6 +3805,7 @@
37903805
CED9BCC42D3EBD0D00C063B8 /* WooShippingAddressValidationSuccessMapper.swift */,
37913806
EE1042AC2D65CE5E005AB07F /* WooShippingVerifyDestinationAddressMapper.swift */,
37923807
CE90E99D2CEFCB100068D852 /* WooShippingStatusMapper.swift */,
3808+
EE7E80B72D84F18700E6FF5B /* WooShippingConfigMapper.swift */,
37933809
CE606D8E2BE39426001CB424 /* ShippingMethodMapper.swift */,
37943810
FE28F6E326842848004465C7 /* UserMapper.swift */,
37953811
077F39D326A58DE700ABEADC /* SystemStatusMapper.swift */,
@@ -3965,6 +3981,7 @@
39653981
CCF48B7F2628BBC10034EA83 /* ShippingLabelAccountSettingsMapperTests.swift */,
39663982
CC9A254926442D26005DE56E /* ShippingLabelCreationEligibilityMapperTests.swift */,
39673983
CC07866426790B1100BA9AC1 /* ShippingLabelPurchaseMapperTests.swift */,
3984+
EE74B1E92D895F00000E4C56 /* WooShippingConfigMapperTests.swift */,
39683985
CC0786C8267BB32800BA9AC1 /* ShippingLabelStatusMapperTests.swift */,
39693986
CE606D922BE39889001CB424 /* ShippingMethodListMapperTests.swift */,
39703987
02C254D22563992900A04423 /* OrderShippingLabelListMapperTests.swift */,
@@ -4208,6 +4225,15 @@
42084225
path = ApplicationPassword;
42094226
sourceTree = "<group>";
42104227
};
4228+
EE7E80BB2D84F4E900E6FF5B /* Shipments */ = {
4229+
isa = PBXGroup;
4230+
children = (
4231+
EE7E80BC2D84F54800E6FF5B /* WooShippingShipment.swift */,
4232+
EE7E80B92D84F41500E6FF5B /* WooShippingConfigResponse.swift */,
4233+
);
4234+
path = Shipments;
4235+
sourceTree = "<group>";
4236+
};
42114237
EE80A24B29556F1D003591E4 /* Coupon */ = {
42124238
isa = PBXGroup;
42134239
children = (
@@ -4505,6 +4531,8 @@
45054531
02B41A92296BEB3000FE3311 /* load-site-current-plan-success.json in Resources */,
45064532
020EF5ED2A8C8F4F009D2169 /* products-total.json in Resources */,
45074533
02EF1672292F0D1900D90AD6 /* load-plan-success.json in Resources */,
4534+
EE74B1ED2D895FA4000E4C56 /* shipping-label-config-success.json in Resources */,
4535+
EE74B1EE2D895FA4000E4C56 /* shipping-label-config-success-without-data.json in Resources */,
45084536
DEA6B1C6296C13FB005AA5E9 /* payment-gateway-list-without-data.json in Resources */,
45094537
2685C0DE263B5A4200D9EE97 /* add-on-groups.json in Resources */,
45104538
AEA056E4296DBA6E00948D52 /* products-batch-update.json in Resources */,
@@ -5284,6 +5312,7 @@
52845312
CEB9BF392BB193020007978A /* ProductBundleStatsTotals.swift in Sources */,
52855313
CE71E22B2A4C363E00DB5376 /* ProductsReportsRemote.swift in Sources */,
52865314
45B204B82489095100FE6526 /* ProductCategoryMapper.swift in Sources */,
5315+
EE7E80BA2D84F42E00E6FF5B /* WooShippingConfigResponse.swift in Sources */,
52875316
B557DA0D20975DB1005962F4 /* WordPressAPIVersion.swift in Sources */,
52885317
7412A8EC21B6E286005D182A /* ReportOrderTotalsMapper.swift in Sources */,
52895318
451A97CD260A01A40059D135 /* ShippingLabelStoreOptions.swift in Sources */,
@@ -5376,6 +5405,7 @@
53765405
74A1D26D21189DFF00931DFA /* SiteVisitStatsMapper.swift in Sources */,
53775406
45152809257A7C6E0076B03C /* ProductAttributesRemote.swift in Sources */,
53785407
EECDBEDE296845F400293C4E /* RESTRequestConvertible.swift in Sources */,
5408+
EE7E80B82D84F19100E6FF5B /* WooShippingConfigMapper.swift in Sources */,
53795409
EE839C262ABEF9C900049545 /* AIProductMapper.swift in Sources */,
53805410
EEFAA57D295D77F0003583BE /* AuthenticatedRESTRequest.swift in Sources */,
53815411
D8FBFF2222D5266E006E3336 /* OrderStatsV4Interval.swift in Sources */,
@@ -5524,6 +5554,7 @@
55245554
451A97C92609FF050059D135 /* ShippingLabelPackagesResponse.swift in Sources */,
55255555
029BA4F0255D7282006171FD /* ShippingLabelRemote.swift in Sources */,
55265556
B557DA0F20975E07005962F4 /* DotcomRequest.swift in Sources */,
5557+
EE7E80BD2D84F55100E6FF5B /* WooShippingShipment.swift in Sources */,
55275558
AEF94585272974F2001DCCFB /* TelemetryRemote.swift in Sources */,
55285559
DE20046E2BFB522900660A72 /* ProductReportListMapper.swift in Sources */,
55295560
740211E321939C84002248DA /* CommentResultMapper.swift in Sources */,
@@ -5612,6 +5643,7 @@
56125643
74D5BECE217E0F98007B0348 /* SiteSettingsRemoteTests.swift in Sources */,
56135644
D8FBFF1C22D51C34006E3336 /* OrderStatsRemoteV4Tests.swift in Sources */,
56145645
EE62EE61295ACF8D009C965B /* RequestConverterTests.swift in Sources */,
5646+
EE74B1EA2D895F05000E4C56 /* WooShippingConfigMapperTests.swift in Sources */,
56155647
EE62EE65295AD46D009C965B /* String+URLTests.swift in Sources */,
56165648
EE8C202D2B47886500FE967B /* CreateBlazeCampaignMapperTests.swift in Sources */,
56175649
CE6D666F2379E82A007835A1 /* ArrayWooTests.swift in Sources */,
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import Foundation
2+
3+
struct WooShippingConfigMapper: Mapper {
4+
/// Site Identifier associated to the order that will be parsed.
5+
///
6+
/// We're injecting this field via `JSONDecoder.userInfo` because SiteID is not returned by the config endpoint.
7+
///
8+
let siteID: Int64
9+
10+
/// Order ID associated to the shipping labels that will be parsed.
11+
///
12+
/// We're injecting this field via `JSONDecoder.userInfo` because OrderID is not returned by the config endpoint.
13+
///
14+
let orderID: Int64
15+
16+
/// (Attempts) to convert a dictionary into `WooShippingConfig`.
17+
///
18+
func map(response: Data) throws -> WooShippingConfig {
19+
let decoder = JSONDecoder()
20+
decoder.userInfo = [
21+
.siteID: siteID,
22+
.orderID: orderID
23+
]
24+
if hasDataEnvelope(in: response) {
25+
return try decoder.decode(WooShippingConfigMapperEnvelope.self, from: response).data.config
26+
} else {
27+
return try decoder.decode(WooShippingConfigResponse.self, from: response).config
28+
}
29+
}
30+
}
31+
32+
/// WooShippingConfigMapperEnvelope Disposable Entity:
33+
/// `Woo Shipping Config` endpoint returns the shipping label config in the `data` key.
34+
/// This entity allows us to do parse all the things with JSONDecoder.
35+
///
36+
private struct WooShippingConfigMapperEnvelope: Decodable {
37+
let data: WooShippingConfigResponse
38+
39+
private enum CodingKeys: String, CodingKey {
40+
case data = "data"
41+
}
42+
}
43+
44+
extension WooShippingConfigMapper {
45+
/// Load only the relevant fields from remote
46+
///
47+
static let fieldsToLoad = "config.shipments, config.shippingLabelData.currentOrderLabels"
48+
}

0 commit comments

Comments
 (0)