diff --git a/kDrive/UI/Controller/Files/FileActionsFloatingPanelViewController+Actions.swift b/kDrive/UI/Controller/Files/FileActionsFloatingPanelViewController+Actions.swift index 754f257b4..cf704bb50 100644 --- a/kDrive/UI/Controller/Files/FileActionsFloatingPanelViewController+Actions.swift +++ b/kDrive/UI/Controller/Files/FileActionsFloatingPanelViewController+Actions.swift @@ -542,6 +542,9 @@ extension FileActionsFloatingPanelViewController { onPresentViewController: { saveNavigationViewController, animated in self.present(saveNavigationViewController, animated: animated, completion: nil) }, + onSave: { + MatomoUtils.trackAddToMyDrive() + }, onDismissViewController: { [weak self] in guard let self else { return } self.dismiss(animated: true) diff --git a/kDrive/UI/Controller/Files/PublicShareAction.swift b/kDrive/UI/Controller/Files/PublicShareAction.swift index 765c6a3d6..2abc49ebf 100644 --- a/kDrive/UI/Controller/Files/PublicShareAction.swift +++ b/kDrive/UI/Controller/Files/PublicShareAction.swift @@ -26,6 +26,7 @@ struct PublicShareAction { selectedItemsIds: [Int], exceptItemIds: [Int], onPresentViewController: (UIViewController, Bool) -> Void, + onSave: (() -> Void)?, onDismissViewController: (() -> Void)? ) { let saveNavigationViewController = SaveFileViewController.instantiateInNavigationController( @@ -33,6 +34,7 @@ struct PublicShareAction { publicShareProxy: publicShareProxy, publicShareFileIds: selectedItemsIds, publicShareExceptIds: exceptItemIds, + onSave: onSave, onDismissViewController: onDismissViewController ) diff --git a/kDrive/UI/Controller/Files/Save File/SaveFileViewController+FooterButtonDelegate.swift b/kDrive/UI/Controller/Files/Save File/SaveFileViewController+FooterButtonDelegate.swift index 5f9246b87..47f458c6f 100644 --- a/kDrive/UI/Controller/Files/Save File/SaveFileViewController+FooterButtonDelegate.swift +++ b/kDrive/UI/Controller/Files/Save File/SaveFileViewController+FooterButtonDelegate.swift @@ -46,7 +46,11 @@ extension SaveFileViewController: FooterButtonDelegate { } Task { - defer { dismissViewController() } + defer { + onSave?() + dismissViewController() + } + try await savePublicShareToDrive(sourceDriveId: publicShareProxy.driveId, destinationDriveId: drive.id, destinationFolderId: directory.id, diff --git a/kDrive/UI/Controller/Files/Save File/SaveFileViewController.swift b/kDrive/UI/Controller/Files/Save File/SaveFileViewController.swift index 1c98438a1..fdea7d32f 100644 --- a/kDrive/UI/Controller/Files/Save File/SaveFileViewController.swift +++ b/kDrive/UI/Controller/Files/Save File/SaveFileViewController.swift @@ -118,6 +118,7 @@ class SaveFileViewController: UIViewController { } @MainActor var onDismissViewController: (() -> Void)? + @MainActor var onSave: (() -> Void)? @IBOutlet var tableView: UITableView! @IBOutlet var closeBarButtonItem: UIBarButtonItem! @@ -354,6 +355,7 @@ class SaveFileViewController: UIViewController { publicShareProxy: PublicShareProxy, publicShareFileIds: [Int], publicShareExceptIds: [Int], + onSave: (() -> Void)?, onDismissViewController: (() -> Void)?) -> TitleSizeAdjustingNavigationController { let saveViewController = instantiate(driveFileManager: driveFileManager) @@ -361,6 +363,8 @@ class SaveFileViewController: UIViewController { saveViewController.publicShareFileIds = publicShareFileIds saveViewController.publicShareExceptIds = publicShareExceptIds saveViewController.publicShareProxy = publicShareProxy + saveViewController.onSave = onSave + saveViewController.onDismissViewController = onDismissViewController return wrapInNavigationController(saveViewController) } diff --git a/kDrive/UI/Controller/Menu/Share/PublicShareViewModel.swift b/kDrive/UI/Controller/Menu/Share/PublicShareViewModel.swift index 136a358d4..bbe51f969 100644 --- a/kDrive/UI/Controller/Menu/Share/PublicShareViewModel.swift +++ b/kDrive/UI/Controller/Menu/Share/PublicShareViewModel.swift @@ -173,6 +173,9 @@ final class PublicShareViewModel: InMemoryFileListViewModel { onPresentViewController: { saveNavigationViewController, animated in onPresentViewController?(.modal, saveNavigationViewController, animated) }, + onSave: { + MatomoUtils.trackAddBulkToMykDrive() + }, onDismissViewController: { [weak self] in guard let self else { return } self.onDismissViewController?()