Skip to content

Commit 299cf29

Browse files
committed
Merge branch 'trunk' into try/general-app-settings
# Conflicts: # Storage/Storage.xcodeproj/project.pbxproj
2 parents bb5db3a + 4b1db96 commit 299cf29

File tree

101 files changed

+2206
-811
lines changed

Some content is hidden

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

101 files changed

+2206
-811
lines changed

Experiments/Experiments/DefaultFeatureFlagService.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
3535
return buildConfig == .localDeveloper || buildConfig == .alpha
3636
case .inPersonPaymentGatewaySelection:
3737
return buildConfig == .localDeveloper || buildConfig == .alpha
38+
case .unifiedOrderEditing:
39+
return buildConfig == .localDeveloper || buildConfig == .alpha
40+
case .backgroundProductImageUpload:
41+
return buildConfig == .localDeveloper || buildConfig == .alpha
3842
default:
3943
return true
4044
}

Experiments/Experiments/FeatureFlag.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,12 @@ public enum FeatureFlag: Int {
6969
/// Enable selection of payment gateway to use for In-Person Payments when there is more than one available
7070
///
7171
case inPersonPaymentGatewaySelection
72+
73+
/// Enable order editing from the order detailed screen.
74+
///
75+
case unifiedOrderEditing
76+
77+
/// Enable image upload after leaving the product form
78+
///
79+
case backgroundProductImageUpload
7280
}

Gemfile.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
GIT
22
remote: [email protected]:wordpress-mobile/release-toolkit
3-
revision: 48bf4f8ee18079154b2054b3014bed9f114416d6
3+
revision: a4d04a43125d84288e46ea38b893d001cd660a3b
44
branch: trunk
55
specs:
6-
fastlane-plugin-wpmreleasetoolkit (4.1.0)
6+
fastlane-plugin-wpmreleasetoolkit (4.2.0)
77
activesupport (~> 5)
88
bigdecimal (~> 1.4)
99
buildkit (~> 1.5)
@@ -23,7 +23,7 @@ GEM
2323
specs:
2424
CFPropertyList (3.0.5)
2525
rexml
26-
activesupport (5.2.7)
26+
activesupport (5.2.8)
2727
concurrent-ruby (~> 1.0, >= 1.0.2)
2828
i18n (>= 0.7, < 2)
2929
minitest (~> 5.1)
@@ -258,9 +258,9 @@ GEM
258258
racc (~> 1.4)
259259
nokogiri (1.13.6-x86_64-darwin)
260260
racc (~> 1.4)
261-
octokit (4.22.0)
262-
faraday (>= 0.9)
263-
sawyer (~> 0.8.0, >= 0.5.3)
261+
octokit (4.23.0)
262+
faraday (>= 1, < 3)
263+
sawyer (~> 0.9)
264264
oj (3.13.13)
265265
optimist (3.0.1)
266266
options (2.3.2)
@@ -306,9 +306,9 @@ GEM
306306
ruby-progressbar (1.11.0)
307307
ruby2_keywords (0.0.5)
308308
rubyzip (2.3.2)
309-
sawyer (0.8.2)
309+
sawyer (0.9.1)
310310
addressable (>= 2.3.5)
311-
faraday (> 0.8, < 2.0)
311+
faraday (>= 0.17.3, < 3)
312312
security (0.1.3)
313313
signet (0.16.1)
314314
addressable (~> 2.8)

Networking/Networking/Remote/ProductsRemote.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public protocol ProductsRemoteProtocol {
3535
sku: String,
3636
completion: @escaping (Result<String, Error>) -> Void)
3737
func updateProduct(product: Product, completion: @escaping (Result<Product, Error>) -> Void)
38+
func updateProductImages(siteID: Int64, productID: Int64, images: [ProductImage], completion: @escaping (Result<Product, Error>) -> Void)
3839
}
3940

4041
extension ProductsRemoteProtocol {
@@ -279,6 +280,19 @@ public final class ProductsRemote: Remote, ProductsRemoteProtocol {
279280
completion(.failure(error))
280281
}
281282
}
283+
284+
public func updateProductImages(siteID: Int64, productID: Int64, images: [ProductImage], completion: @escaping (Result<Product, Error>) -> Void) {
285+
do {
286+
let parameters = try ([ParameterKey.images: images]).toDictionary()
287+
let path = "\(Path.products)/\(productID)"
288+
let request = JetpackRequest(wooApiVersion: .mark3, method: .post, siteID: siteID, path: path, parameters: parameters)
289+
let mapper = ProductMapper(siteID: siteID)
290+
291+
enqueue(request, mapper: mapper, completion: completion)
292+
} catch {
293+
completion(.failure(error))
294+
}
295+
}
282296
}
283297

284298

@@ -320,6 +334,7 @@ public extension ProductsRemote {
320334
static let stockStatus: String = "stock_status"
321335
static let category: String = "category"
322336
static let fields: String = "_fields"
337+
static let images: String = "images"
323338
}
324339

325340
private enum ParameterValues {

Networking/NetworkingTests/Remote/ProductsRemoteTests.swift

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,44 @@ final class ProductsRemoteTests: XCTestCase {
503503
}
504504
}
505505
}
506+
507+
// MARK: - Update Product Images
508+
509+
/// Verifies that updateProductImages properly parses the `product-update` sample response.
510+
///
511+
func test_updateProductImages_properly_returns_parsed_product() throws {
512+
// Given
513+
let remote = ProductsRemote(network: network)
514+
network.simulateResponse(requestUrlSuffix: "products/\(sampleProductID)", filename: "product-update")
515+
516+
// When
517+
let result = waitFor { promise in
518+
remote.updateProductImages(siteID: self.sampleSiteID, productID: self.sampleProductID, images: []) { result in
519+
promise(result)
520+
}
521+
}
522+
523+
// Then
524+
let product = try XCTUnwrap(result.get())
525+
XCTAssertEqual(product.images.map { $0.imageID }, [1043, 1064])
526+
}
527+
528+
/// Verifies that updateProductImages properly relays Networking Layer errors.
529+
///
530+
func test_updateProductImages_properly_relays_networking_error() {
531+
// Given
532+
let remote = ProductsRemote(network: network)
533+
534+
// When
535+
let result = waitFor { promise in
536+
remote.updateProductImages(siteID: self.sampleSiteID, productID: self.sampleProductID, images: []) { result in
537+
promise(result)
538+
}
539+
}
540+
541+
// Then
542+
XCTAssertTrue(result.isFailure)
543+
}
506544
}
507545

508546
// MARK: - Private Helpers

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
-----
55
- [*] Orders: Order details now displays both the date and time for all orders. [https://github.com/woocommerce/woocommerce-ios/pull/6996]
66
- [*] Simple payments have the `Card` option available for stores with configuration issues to resolve, and show onboarding to help resolve them [https://github.com/woocommerce/woocommerce-ios/pull/7002]
7+
- [*] Order & Product list: Now, we can pull to refresh from an empty view. [https://github.com/woocommerce/woocommerce-ios/pull/7023, https://github.com/woocommerce/woocommerce-ios/pull/7030]
78

89
9.3
910
-----

Scripts/fix-translation

Lines changed: 0 additions & 29 deletions
This file was deleted.

Scripts/localize.py

Lines changed: 0 additions & 180 deletions
This file was deleted.

0 commit comments

Comments
 (0)