File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
WooCommerce/Classes/ViewRelated/Products/Edit Product Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -169,6 +169,16 @@ private extension ProductFormViewController {
169169
170170 navigationController? . present ( inProgressViewController, animated: true , completion: nil )
171171
172+ updateProductRemotely ( )
173+ }
174+
175+ func updateProductRemotely( ) {
176+ waitUntilAllImagesAreUploaded { [ weak self] in
177+ self ? . dispatchUpdateProductAction ( )
178+ }
179+ }
180+
181+ func waitUntilAllImagesAreUploaded( onCompletion: @escaping ( ) -> Void ) {
172182 let group = DispatchGroup ( )
173183
174184 // Waits for all product images to be uploaded before updating the product remotely.
@@ -186,13 +196,13 @@ private extension ProductFormViewController {
186196 group. leave ( )
187197 }
188198
189- group. notify ( queue: . main) { [ weak self ] in
199+ group. notify ( queue: . main) {
190200 observationToken. cancel ( )
191- self ? . updateProductRemotely ( )
201+ onCompletion ( )
192202 }
193203 }
194204
195- func updateProductRemotely ( ) {
205+ func dispatchUpdateProductAction ( ) {
196206 let action = ProductAction . updateProduct ( product: product) { [ weak self] ( product, error) in
197207 guard let product = product, error == nil else {
198208 let errorDescription = error? . localizedDescription ?? " No error specified "
You can’t perform that action at this time.
0 commit comments