@@ -346,6 +346,8 @@ private extension ProductsViewController {
346346 }
347347
348348 @objc func selectAllProducts( ) {
349+ ServiceLocator . analytics. track ( event: . ProductsList. bulkUpdateSelectAll ( ) )
350+
349351 viewModel. selectProducts ( resultsController. fetchedObjects)
350352 updatedSelectedItems ( )
351353 tableView. reloadRows ( at: tableView. indexPathsForVisibleRows ?? [ ] , with: . none)
@@ -375,6 +377,8 @@ private extension ProductsViewController {
375377 }
376378
377379 func showStatusBulkEditingModal( ) {
380+ ServiceLocator . analytics. track ( event: . ProductsList. bulkUpdateRequested ( field: . status, selectedProductsCount: viewModel. selectedProductsCount) )
381+
378382 let initialStatus = viewModel. commonStatusForSelectedProducts
379383 let command = ProductStatusSettingListSelectorCommand ( selected: initialStatus)
380384 let listSelectorViewController = ListSelectorViewController ( command: command) { _ in
@@ -407,6 +411,8 @@ private extension ProductsViewController {
407411 func applyBulkEditingStatus( newStatus: ProductStatus ? , modalVC: UIViewController ) {
408412 guard let newStatus else { return }
409413
414+ ServiceLocator . analytics. track ( event: . ProductsList. bulkUpdateConfirmed ( field: . status, selectedProductsCount: viewModel. selectedProductsCount) )
415+
410416 displayProductsSavingInProgressView ( on: modalVC)
411417 viewModel. updateSelectedProducts ( with: newStatus) { [ weak self] result in
412418 guard let self else { return }
@@ -416,13 +422,17 @@ private extension ProductsViewController {
416422 case . success:
417423 self . finishBulkEditing ( )
418424 self . presentNotice ( title: Localization . statusUpdatedNotice)
425+ ServiceLocator . analytics. track ( event: . ProductsList. bulkUpdateSuccess ( field: . status) )
419426 case . failure:
420427 self . presentNotice ( title: Localization . updateErrorNotice)
428+ ServiceLocator . analytics. track ( event: . ProductsList. bulkUpdateFailure ( field: . status) )
421429 }
422430 }
423431 }
424432
425433 func showPriceBulkEditingModal( ) {
434+ ServiceLocator . analytics. track ( event: . ProductsList. bulkUpdateRequested ( field: . price, selectedProductsCount: viewModel. selectedProductsCount) )
435+
426436 let priceInputViewModel = PriceInputViewModel ( productListViewModel: viewModel)
427437 let priceInputViewController = PriceInputViewController ( viewModel: priceInputViewModel)
428438 priceInputViewModel. cancelClosure = { [ weak self] in
@@ -437,6 +447,8 @@ private extension ProductsViewController {
437447 func applyBulkEditingPrice( newPrice: String ? , modalVC: UIViewController ) {
438448 guard let newPrice else { return }
439449
450+ ServiceLocator . analytics. track ( event: . ProductsList. bulkUpdateConfirmed ( field: . price, selectedProductsCount: viewModel. selectedProductsCount) )
451+
440452 displayProductsSavingInProgressView ( on: modalVC)
441453 viewModel. updateSelectedProducts ( with: newPrice) { [ weak self] result in
442454 guard let self else { return }
@@ -446,8 +458,10 @@ private extension ProductsViewController {
446458 case . success:
447459 self . finishBulkEditing ( )
448460 self . presentNotice ( title: Localization . priceUpdatedNotice)
461+ ServiceLocator . analytics. track ( event: . ProductsList. bulkUpdateSuccess ( field: . price) )
449462 case . failure:
450463 self . presentNotice ( title: Localization . updateErrorNotice)
464+ ServiceLocator . analytics. track ( event: . ProductsList. bulkUpdateFailure ( field: . price) )
451465 }
452466 }
453467 }
0 commit comments