Skip to content

Commit

Permalink
chore(Matomo): Matomo on addToMyDrive
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien-coye committed Jan 9, 2025
1 parent e9abcf7 commit ead2fca
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions kDrive/UI/Controller/Files/PublicShareAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ struct PublicShareAction {
selectedItemsIds: [Int],
exceptItemIds: [Int],
onPresentViewController: (UIViewController, Bool) -> Void,
onSave: (() -> Void)?,
onDismissViewController: (() -> Void)?
) {
let saveNavigationViewController = SaveFileViewController.instantiateInNavigationController(
driveFileManager: currentUserDriveFileManager,
publicShareProxy: publicShareProxy,
publicShareFileIds: selectedItemsIds,
publicShareExceptIds: exceptItemIds,
onSave: onSave,
onDismissViewController: onDismissViewController
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class SaveFileViewController: UIViewController {
}

@MainActor var onDismissViewController: (() -> Void)?
@MainActor var onSave: (() -> Void)?

@IBOutlet var tableView: UITableView!
@IBOutlet var closeBarButtonItem: UIBarButtonItem!
Expand Down Expand Up @@ -354,13 +355,16 @@ class SaveFileViewController: UIViewController {
publicShareProxy: PublicShareProxy,
publicShareFileIds: [Int],
publicShareExceptIds: [Int],
onSave: (() -> Void)?,
onDismissViewController: (() -> Void)?)
-> TitleSizeAdjustingNavigationController {
let saveViewController = instantiate(driveFileManager: driveFileManager)

saveViewController.publicShareFileIds = publicShareFileIds
saveViewController.publicShareExceptIds = publicShareExceptIds
saveViewController.publicShareProxy = publicShareProxy
saveViewController.onSave = onSave
saveViewController.onDismissViewController = onDismissViewController

return wrapInNavigationController(saveViewController)
}
Expand Down
3 changes: 3 additions & 0 deletions kDrive/UI/Controller/Menu/Share/PublicShareViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?()
Expand Down

0 comments on commit ead2fca

Please sign in to comment.