Skip to content

Commit 87808ae

Browse files
committed
Add a more descriptive function commitAndDismiss and call it instead of doneButtonTapped outside of done button tap.
1 parent a68db9c commit 87808ae

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ private extension ProductImagesViewController {
152152
}
153153

154154
@objc func doneButtonTapped() {
155+
commitAndDismiss()
156+
}
157+
158+
func commitAndDismiss() {
155159
onCompletion(productImages)
156160
}
157161

@@ -216,8 +220,7 @@ private extension ProductImagesViewController {
216220
return
217221
}
218222
uploadMediaAssetToSiteMediaLibrary(asset: asset)
219-
// Commits product image changes automatically.
220-
doneButtonTapped()
223+
commitAndDismiss()
221224
}
222225
}
223226

@@ -232,8 +235,7 @@ private extension ProductImagesViewController {
232235
return
233236
}
234237

235-
// Commits product image changes automatically.
236-
self?.doneButtonTapped()
238+
self?.commitAndDismiss()
237239
}
238240
}
239241
guard assets.isEmpty == false else {
@@ -255,8 +257,7 @@ private extension ProductImagesViewController {
255257
return
256258
}
257259

258-
// Commits product image changes automatically.
259-
self?.doneButtonTapped()
260+
self?.commitAndDismiss()
260261
}
261262
productImageActionHandler.addSiteMediaLibraryImagesToProduct(mediaItems: mediaItems)
262263
}

0 commit comments

Comments
 (0)