@@ -194,14 +194,8 @@ final class ProductFormViewController<ViewModel: ProductFormViewModelProtocol>:
194194 super. viewWillDisappear ( animated)
195195
196196 view. endEditing ( true )
197-
198- if isBeingDismissedInAnyWay {
199- let key = ProductImageUploaderKey ( siteID: viewModel. productModel. siteID,
200- productOrVariationID: productOrVariationID,
201- isLocalID: !viewModel. productModel. existsRemotely)
202- productImageUploader. startEmittingErrors ( key: key)
203- productImageUploader. sendBackgroundUploadNoticeIfNeeded ( key: key, using: ServiceLocator . noticePresenter)
204- }
197+ prepareForBackgroundUploadsUponDismissal ( )
198+
205199 }
206200
207201 override var shouldShowOfflineBanner : Bool {
@@ -1339,6 +1333,16 @@ private extension ProductFormViewController {
13391333// MARK: - Navigation actions handling
13401334//
13411335private extension ProductFormViewController {
1336+ func prepareForBackgroundUploadsUponDismissal( ) {
1337+ guard isBeingDismissedInAnyWay else { return }
1338+
1339+ let key = ProductImageUploaderKey ( siteID: viewModel. productModel. siteID,
1340+ productOrVariationID: productOrVariationID,
1341+ isLocalID: !viewModel. productModel. existsRemotely)
1342+ productImageUploader. startEmittingErrors ( key: key)
1343+ productImageUploader. sendBackgroundUploadNoticeIfNeeded ( key: key, using: ServiceLocator . noticePresenter)
1344+ }
1345+
13421346 func presentBackNavigationActionSheet( onDiscard: @escaping ( ) -> Void = { } , onCancel: @escaping ( ) -> Void = { } ) {
13431347 let exitForm : ( ) -> Void = {
13441348 presentationStyle. createExitForm ( viewController: navigationController ?? self , completion: onDiscard)
0 commit comments