Skip to content

Commit 3b900ae

Browse files
committed
Updates based on CR feedback.
1 parent 3e00311 commit 3b900ae

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

WooCommerce/Classes/ViewRelated/Products/Edit Product/ProductFormViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ private extension ProductFormViewController {
174174
// Waits for all product images to be uploaded before updating the product remotely.
175175
group.enter()
176176
let observationToken = productImageActionHandler.addUpdateObserver(self) { [weak self] (productImageStatuses, error) in
177-
guard productImageStatuses.hasImagesPendingUpload == false else {
177+
guard productImageStatuses.hasPendingUpload == false else {
178178
return
179179
}
180180

@@ -423,7 +423,7 @@ extension ProductFormViewController {
423423
}
424424

425425
private func hasUnsavedChanges(product: Product) -> Bool {
426-
return product != originalProduct || productImageActionHandler.productImageStatuses.hasImagesPendingUpload
426+
return product != originalProduct || productImageActionHandler.productImageStatuses.hasPendingUpload
427427
}
428428
}
429429

WooCommerce/Classes/ViewRelated/Products/Media/ProductImageStatus.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extension Collection where Element == ProductImageStatus {
2727

2828
/// Whether there are still any images being uploaded.
2929
///
30-
var hasImagesPendingUpload: Bool {
30+
var hasPendingUpload: Bool {
3131
return contains(where: {
3232
switch $0 {
3333
case .uploading:

WooCommerce/Classes/ViewRelated/Products/Media/ProductImagesViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ extension ProductImagesViewController {
190190

191191
private func hasOutstandingChanges() -> Bool {
192192
return originalProductImages != productImages
193-
|| productImageStatuses.hasImagesPendingUpload
193+
|| productImageStatuses.hasPendingUpload
194194
}
195195
}
196196

WooCommerce/WooCommerceTests/ViewRelated/Products/Media/ProductImageStatus+HelpersTests.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ import XCTest
77
final class ProductImageStatus_HelpersTests: XCTestCase {
88
// MARK: - `images`
99

10-
func testWithoutRemoteImages() {
10+
func testImagesReturnsEmptyIfThereAreNoRemoteImages() {
1111
let statuses: [ProductImageStatus] = [
1212
.uploading(asset: PHAsset())
1313
]
1414
XCTAssertEqual(statuses.images, [])
1515
}
1616

17-
func testWithRemoteImages() {
17+
func testImagesReturnsProductImagesIfThereAreRemoteImages() {
1818
let productImage = ProductImage(imageID: 17, dateCreated: Date(), dateModified: Date(), src: "", name: nil, alt: nil)
1919

2020
let statuses: [ProductImageStatus] = [
@@ -24,27 +24,27 @@ final class ProductImageStatus_HelpersTests: XCTestCase {
2424
XCTAssertEqual(statuses.images, [productImage])
2525
}
2626

27-
// MARK: - `hasImagesPendingUpload`
27+
// MARK: - `hasPendingUpload`
2828

29-
func testHasImagesPendingUploadWithNoImages() {
29+
func testHasPendingUploadWithNoImages() {
3030
let statuses: [ProductImageStatus] = []
31-
XCTAssertFalse(statuses.hasImagesPendingUpload)
31+
XCTAssertFalse(statuses.hasPendingUpload)
3232
}
3333

34-
func testHasImagesPendingUploadWithAllRemoteImages() {
34+
func testHasPendingUploadWithAllRemoteImages() {
3535
let productImage = ProductImage(imageID: 17, dateCreated: Date(), dateModified: Date(), src: "", name: nil, alt: nil)
3636

3737
let statuses: [ProductImageStatus] = [.remote(image: productImage), .remote(image: productImage)]
38-
XCTAssertFalse(statuses.hasImagesPendingUpload)
38+
XCTAssertFalse(statuses.hasPendingUpload)
3939
}
4040

41-
func testHasImagesPendingUploadWithBothStatusTypes() {
41+
func testHasPendingUploadWithBothStatusTypes() {
4242
let productImage = ProductImage(imageID: 17, dateCreated: Date(), dateModified: Date(), src: "", name: nil, alt: nil)
4343

4444
let statuses: [ProductImageStatus] = [
4545
.uploading(asset: PHAsset()),
4646
.remote(image: productImage)
4747
]
48-
XCTAssertTrue(statuses.hasImagesPendingUpload)
48+
XCTAssertTrue(statuses.hasPendingUpload)
4949
}
5050
}

0 commit comments

Comments
 (0)