Skip to content

Commit 0e51750

Browse files
authored
Merge branch 'trunk' into woomob-876-woo-posbarcodes-copy-updates-for-the-setup-flow
2 parents 898aa51 + 8f77c38 commit 0e51750

File tree

66 files changed

+2454
-516
lines changed

Some content is hidden

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

66 files changed

+2454
-516
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.9
5+
This update enhances Shipping Labels with improved accessibility, smarter address validation, and faster performance. We’ve also made the dedicated Point of Sale tab more widely available for quicker access, and POS orders are now filterable in your order list for better organization. Plus, we've optimized assets to reduce the app’s size.
6+
47
## 22.8
58
Our latest update brings smoother split shipment screens and improved accessibility for Shipping Labels, plus easier label size selection, and POS badges within the order list. In Point of Sale, enjoy a new barcode scan flow, and a safer cart clear button.
69

Modules/Sources/Yosemite/Model/Enums/CardPresentPaymentsPlugin.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ public enum CardPresentPaymentsPlugin: Equatable, CaseIterable {
1313
}
1414
}
1515

16-
public var fileNameWithoutExtension: String {
16+
public var plugin: Plugin {
1717
switch self {
1818
case .wcPay:
19-
return "woocommerce-payments"
19+
return .wooPayments
2020
case .stripe:
21-
return "woocommerce-gateway-stripe"
21+
return .stripe
2222
}
2323
}
2424

Modules/Sources/Yosemite/Tools/Plugin.swift

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,64 @@
11
import Foundation
22

33
public enum Plugin: Equatable, CaseIterable {
4+
case blaze
5+
case jetpack
6+
case googleListingsAndAds
47
case stripe
58
case wooCommerce
9+
case wooCompositeProducts
10+
case wooGiftCards
611
case wooPayments
12+
case wooPayPal
13+
case wooProductBundles
714
case wooSubscriptions
815
case wooShipmentTracking
916
case wooSquare
1017

18+
/// Creates a Plugin from a plugin file name in the plugin path.
19+
/// Returns nil if the file name doesn't match any known Plugin case.
20+
///
21+
/// - Parameter systemPlugin: The SystemPlugin to convert.
22+
public init?(fileNameWithoutExtension: String) {
23+
guard let plugin = Plugin.allCases.first(where: { $0.fileNameWithoutExtension == fileNameWithoutExtension }) else {
24+
return nil
25+
}
26+
self = plugin
27+
}
28+
29+
/// Creates a Plugin from a SystemPlugin by matching the plugin file name in the plugin path.
30+
/// Returns nil if the SystemPlugin doesn't match any known Plugin case.
31+
///
32+
/// - Parameter systemPlugin: The SystemPlugin to convert.
33+
public init?(systemPlugin: SystemPlugin) {
34+
let pluginFileNameWithoutExtension = systemPlugin.fileNameWithoutExtension
35+
self.init(fileNameWithoutExtension: pluginFileNameWithoutExtension)
36+
}
37+
1138
/// File name without extension in the plugin path.
1239
/// Full plugin path is like `woocommerce/woocommerce.php`.
1340
var fileNameWithoutExtension: String {
1441
switch self {
42+
case .blaze:
43+
return "blaze-ads"
44+
case .jetpack:
45+
return "jetpack"
46+
case .googleListingsAndAds:
47+
return "google-listings-and-ads"
1548
case .stripe:
1649
return "woocommerce-gateway-stripe"
1750
case .wooCommerce:
1851
return "woocommerce"
52+
case .wooCompositeProducts:
53+
return "woocommerce-composite-products"
54+
case .wooGiftCards:
55+
return "woocommerce-gift-cards"
1956
case .wooPayments:
2057
return "woocommerce-payments"
58+
case .wooPayPal:
59+
return "woocommerce-paypal-payments"
60+
case .wooProductBundles:
61+
return "woocommerce-product-bundles"
2162
case .wooSubscriptions:
2263
return "woocommerce-subscriptions"
2364
case .wooShipmentTracking:
@@ -27,3 +68,9 @@ public enum Plugin: Equatable, CaseIterable {
2768
}
2869
}
2970
}
71+
72+
private extension SystemPlugin {
73+
var fileNameWithoutExtension: String {
74+
((plugin as NSString).lastPathComponent as NSString).deletingPathExtension
75+
}
76+
}
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
import Foundation
2+
import Testing
3+
import Networking
4+
5+
@testable import Yosemite
6+
7+
struct PluginTests {
8+
@Test(arguments: [
9+
("blaze-ads/blaze-ads.php", Plugin.blaze),
10+
("jetpack/jetpack.php", Plugin.jetpack),
11+
("google-listings-and-ads/google-listings-and-ads.php", Plugin.googleListingsAndAds),
12+
("woocommerce-gateway-stripe/woocommerce-gateway-stripe.php", Plugin.stripe),
13+
("woocommerce/woocommerce.php", Plugin.wooCommerce),
14+
("woocommerce-composite-products/woocommerce-composite-products.php", Plugin.wooCompositeProducts),
15+
("woocommerce-gift-cards/woocommerce-gift-cards.php", Plugin.wooGiftCards),
16+
("woocommerce-payments/woocommerce-payments.php", Plugin.wooPayments),
17+
("woocommerce-paypal-payments/woocommerce-paypal-payments.php", Plugin.wooPayPal),
18+
("woocommerce-product-bundles/woocommerce-product-bundles.php", Plugin.wooProductBundles),
19+
("woocommerce-subscriptions/woocommerce-subscriptions.php", Plugin.wooSubscriptions),
20+
("woocommerce-shipment-tracking/woocommerce-shipment-tracking.php", Plugin.wooShipmentTracking),
21+
("woocommerce-square/woocommerce-square.php", Plugin.wooSquare),
22+
// Altered paths
23+
("_woocommerce-subscriptions/woocommerce-subscriptions.php", .wooSubscriptions),
24+
("woocommerce-subscriptions.php", .wooSubscriptions),
25+
("test/woocommerce-dev.php", nil)
26+
])
27+
func init_with_systemPlugin_returns_correct_plugin(pluginPath: String, expectedPlugin: Plugin?) {
28+
// Given
29+
let systemPlugin = SystemPlugin.fake().copy(
30+
siteID: 134,
31+
plugin: pluginPath,
32+
active: true
33+
)
34+
35+
// When
36+
let plugin = Plugin(systemPlugin: systemPlugin)
37+
38+
// Then
39+
#expect(plugin == expectedPlugin)
40+
}
41+
42+
@Test func init_with_systemPlugin_returns_nil_for_unknown_plugin() {
43+
// Given
44+
let systemPlugin = SystemPlugin.fake().copy(
45+
siteID: 134,
46+
plugin: "unknown-plugin/unknown-plugin.php"
47+
)
48+
49+
// When
50+
let plugin = Plugin(systemPlugin: systemPlugin)
51+
52+
// Then
53+
#expect(plugin == nil)
54+
}
55+
56+
@Test func init_with_systemPlugin_returns_nil_for_empty_plugin_path() {
57+
// Given
58+
let systemPlugin = SystemPlugin.fake().copy(
59+
plugin: ""
60+
)
61+
62+
// When
63+
let plugin = Plugin(systemPlugin: systemPlugin)
64+
65+
// Then
66+
#expect(plugin == nil)
67+
}
68+
69+
// MARK: - `init(fileNameWithoutExtension:)`
70+
71+
@Test(arguments: [
72+
("blaze-ads", Plugin.blaze),
73+
("jetpack", Plugin.jetpack),
74+
("google-listings-and-ads", Plugin.googleListingsAndAds),
75+
("woocommerce-gateway-stripe", Plugin.stripe),
76+
("woocommerce", Plugin.wooCommerce),
77+
("woocommerce-composite-products", Plugin.wooCompositeProducts),
78+
("woocommerce-gift-cards", Plugin.wooGiftCards),
79+
("woocommerce-payments", Plugin.wooPayments),
80+
("woocommerce-paypal-payments", Plugin.wooPayPal),
81+
("woocommerce-product-bundles", Plugin.wooProductBundles),
82+
("woocommerce-subscriptions", Plugin.wooSubscriptions),
83+
("woocommerce-shipment-tracking", Plugin.wooShipmentTracking),
84+
("woocommerce-square", Plugin.wooSquare)
85+
])
86+
func init_with_fileNameWithoutExtension_returns_correct_plugin(fileName: String, expectedPlugin: Plugin) {
87+
// When
88+
let plugin = Plugin(fileNameWithoutExtension: fileName)
89+
90+
// Then
91+
#expect(plugin == expectedPlugin)
92+
}
93+
94+
@Test func init_with_fileNameWithoutExtension_returns_nil_for_unknown_filename() {
95+
// When
96+
let plugin = Plugin(fileNameWithoutExtension: "wooooocommerce")
97+
98+
// Then
99+
#expect(plugin == nil)
100+
}
101+
102+
@Test func init_with_fileNameWithoutExtension_returns_nil_for_empty_filename() {
103+
// When
104+
let plugin = Plugin(fileNameWithoutExtension: "")
105+
106+
// Then
107+
#expect(plugin == nil)
108+
}
109+
}

RELEASE-NOTES.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
*** PLEASE FOLLOW THIS FORMAT: [<priority indicator, more stars = higher priority>] <description> [<PR URL>]
22
*** Use [*****] to indicate smoke tests of all critical flows should be run on the final IPA before release (e.g. major library or OS update).
33

4+
23.0
5+
-----
6+
7+
48
22.9
59
-----
610
- [*] Shipping Labels: Empty dimensions are no longer presented for product cards [https://github.com/woocommerce/woocommerce-ios/pull/15912]
@@ -15,6 +19,7 @@
1519
- [*] Shipping Labels: Show UPS TOS modal in full length for better accessibility. [https://github.com/woocommerce/woocommerce-ios/pull/15926]
1620
- [*] Shipping Labels: Optimize data loading on purchase form [https://github.com/woocommerce/woocommerce-ios/pull/15919]
1721
- [*] Shipping Labels: Cache settings and origin addresses to improve loading experience for purchase form [https://github.com/woocommerce/woocommerce-ios/pull/15935]
22+
- [*] Shipping Labels: Fixed UI glitch on the bottom sheet of the purchase form. [https://github.com/woocommerce/woocommerce-ios/pull/15940]
1823
- [internal] Optimized assets for app size reduction [https://github.com/woocommerce/woocommerce-ios/pull/15881]
1924
- [*] Shipping Labels: Allow dots in HS tariff number input field for customs settings [https://github.com/woocommerce/woocommerce-ios/pull/15933]
2025

@@ -29,6 +34,8 @@
2934
- [*] Watch app: Fixed connection issue upon fresh install [https://github.com/woocommerce/woocommerce-ios/pull/15867]
3035
- [Internal] Shipping Labels: Optimize requests for syncing countries [https://github.com/woocommerce/woocommerce-ios/pull/15875]
3136
- [*] Shipping Labels: Display label size from account settings as default [https://github.com/woocommerce/woocommerce-ios/pull/15873]
37+
- [*] Shipping Labels: Ensured customs form validation enforces non-zero product weight to fix shipping rate loading failure. [https://github.com/woocommerce/woocommerce-ios/pull/15927]
38+
- [*] Shipping Labels: ITN number is now required for shipments with total value more than 2500. [https://github.com/woocommerce/woocommerce-ios/pull/15937]
3239

3340
22.7
3441
-----

WooCommerce/Classes/Blaze/BlazeEligibilityChecker.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ private extension BlazeEligibilityChecker {
7171
stores.dispatch(SystemStatusAction.synchronizeSystemInformation(siteID: siteID) { result in
7272
switch result {
7373
case .success(let info):
74-
let plugin = info.systemPlugins.first(where: { $0.plugin == Constants.pluginSlug })
74+
let plugin = info.systemPlugins.first(where: { Plugin(systemPlugin: $0) == .blaze && $0.active })
7575
continuation.resume(returning: plugin)
7676
case .failure:
7777
continuation.resume(returning: nil)
@@ -80,9 +80,3 @@ private extension BlazeEligibilityChecker {
8080
}
8181
}
8282
}
83-
84-
private extension BlazeEligibilityChecker {
85-
enum Constants {
86-
static let pluginSlug = "blaze-ads/blaze-ads.php"
87-
}
88-
}

WooCommerce/Classes/Extensions/SitePlugin+Woo.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@ import Yosemite
33
/// Defines the names of the Site Plugins officially supported by the app.
44
///
55
extension SitePlugin {
6-
enum SupportedPlugin {
7-
public static let WCSubscriptions = ["WooCommerce Subscriptions", "Woo Subscriptions"]
8-
public static let WCProductBundles = ["WooCommerce Product Bundles", "Woo Product Bundles"]
9-
public static let WCCompositeProducts = "WooCommerce Composite Products"
10-
public static let WCGiftCards = ["WooCommerce Gift Cards", "Woo Gift Cards"]
11-
public static let GoogleForWooCommerce = ["Google Listings and Ads", "Google for WooCommerce"]
12-
}
13-
146
enum SupportedPluginPath {
157
public static let LegacyWCShip = "woocommerce-services/woocommerce-services.php"
168
public static let WooShipping = "woocommerce-shipping/woocommerce-shipping.php"

WooCommerce/Classes/GoogleAds/GoogleAdsEligibilityChecker.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ private extension DefaultGoogleAdsEligibilityChecker {
4949
stores.dispatch(SystemStatusAction.synchronizeSystemInformation(siteID: siteID) { result in
5050
switch result {
5151
case .success(let info):
52-
let plugin = info.systemPlugins.first(where: { $0.plugin == Constants.pluginSlug })
52+
let plugin = info.systemPlugins.first(where: { Plugin(systemPlugin: $0) == .googleListingsAndAds && $0.active })
5353
continuation.resume(returning: plugin)
5454
case .failure:
5555
continuation.resume(returning: nil)
@@ -76,8 +76,6 @@ private extension DefaultGoogleAdsEligibilityChecker {
7676
}
7777

7878
enum Constants {
79-
static let pluginSlug = "google-listings-and-ads/google-listings-and-ads.php"
80-
8179
/// Version 2.7.7 is required for an optimized experience of the plugin on the mobile web.
8280
/// Ref: https://github.com/woocommerce/google-listings-and-ads/releases/tag/2.7.7.
8381
/// We can remove this limit once we support native experience.

WooCommerce/Classes/Tools/CardPresentPluginsDataProvider.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,6 @@ struct CardPresentPluginsDataProvider: CardPresentPluginsDataProviderProtocol {
9595
}
9696
return storageManager.viewStorage
9797
.loadSystemPlugins(siteID: siteID).map { $0.toReadOnly() }
98-
.first(where: { $0.fileNameWithoutExtension == configuration.fileNameWithoutExtension })
99-
}
100-
}
101-
102-
extension Yosemite.SystemPlugin {
103-
var fileNameWithoutExtension: String {
104-
((plugin as NSString).lastPathComponent as NSString).deletingPathExtension
98+
.first(where: { Plugin(systemPlugin: $0) == configuration.plugin })
10599
}
106100
}

WooCommerce/Classes/ViewRelated/Customers/CustomersListViewModel.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,6 @@ private extension CustomersListViewModel {
329329
}
330330

331331
enum Constants {
332-
static let wcPluginName = "WooCommerce"
333332
static let wcPluginMinimumVersion = "8.0.0-beta.1"
334333
}
335334
}

0 commit comments

Comments
 (0)