@@ -346,6 +346,8 @@ private extension ProductsViewController {
346346 }
347347
348348 @objc func selectAllProducts( ) {
349+ ServiceLocator . analytics. track ( event: . ProductsList. bulkUpdateSelectAllTapped ( ) )
350+
349351 viewModel. selectProducts ( resultsController. fetchedObjects)
350352 updatedSelectedItems ( )
351353 tableView. reloadRows ( at: tableView. indexPathsForVisibleRows ?? [ ] , with: . none)
@@ -377,6 +379,8 @@ private extension ProductsViewController {
377379 }
378380
379381 func showStatusBulkEditingModal( ) {
382+ ServiceLocator . analytics. track ( event: . ProductsList. bulkUpdateRequested ( field: . status, selectedProductsCount: viewModel. selectedProductsCount) )
383+
380384 let initialStatus = viewModel. commonStatusForSelectedProducts
381385 let command = ProductStatusSettingListSelectorCommand ( selected: initialStatus)
382386 let listSelectorViewController = ListSelectorViewController ( command: command) { _ in
@@ -409,6 +413,8 @@ private extension ProductsViewController {
409413 func applyBulkEditingStatus( newStatus: ProductStatus ? , modalVC: UIViewController ) {
410414 guard let newStatus else { return }
411415
416+ ServiceLocator . analytics. track ( event: . ProductsList. bulkUpdateConfirmed ( field: . status, selectedProductsCount: viewModel. selectedProductsCount) )
417+
412418 displayProductsSavingInProgressView ( on: modalVC)
413419 viewModel. updateSelectedProducts ( with: newStatus) { [ weak self] result in
414420 guard let self else { return }
@@ -418,13 +424,17 @@ private extension ProductsViewController {
418424 case . success:
419425 self . finishBulkEditing ( )
420426 self . presentNotice ( title: Localization . statusUpdatedNotice)
427+ ServiceLocator . analytics. track ( event: . ProductsList. bulkUpdateSuccess ( field: . status) )
421428 case . failure:
422429 self . presentNotice ( title: Localization . updateErrorNotice)
430+ ServiceLocator . analytics. track ( event: . ProductsList. bulkUpdateFailure ( field: . status) )
423431 }
424432 }
425433 }
426434
427435 func showPriceBulkEditingModal( ) {
436+ ServiceLocator . analytics. track ( event: . ProductsList. bulkUpdateRequested ( field: . price, selectedProductsCount: viewModel. selectedProductsCount) )
437+
428438 let priceInputViewModel = PriceInputViewModel ( productListViewModel: viewModel)
429439 let priceInputViewController = PriceInputViewController ( viewModel: priceInputViewModel)
430440 priceInputViewModel. cancelClosure = { [ weak self] in
@@ -439,6 +449,8 @@ private extension ProductsViewController {
439449 func applyBulkEditingPrice( newPrice: String ? , modalVC: UIViewController ) {
440450 guard let newPrice else { return }
441451
452+ ServiceLocator . analytics. track ( event: . ProductsList. bulkUpdateConfirmed ( field: . price, selectedProductsCount: viewModel. selectedProductsCount) )
453+
442454 displayProductsSavingInProgressView ( on: modalVC)
443455 viewModel. updateSelectedProducts ( with: newPrice) { [ weak self] result in
444456 guard let self else { return }
@@ -448,8 +460,10 @@ private extension ProductsViewController {
448460 case . success:
449461 self . finishBulkEditing ( )
450462 self . presentNotice ( title: Localization . priceUpdatedNotice)
463+ ServiceLocator . analytics. track ( event: . ProductsList. bulkUpdateSuccess ( field: . price) )
451464 case . failure:
452465 self . presentNotice ( title: Localization . updateErrorNotice)
466+ ServiceLocator . analytics. track ( event: . ProductsList. bulkUpdateFailure ( field: . price) )
453467 }
454468 }
455469 }
0 commit comments