Skip to content

Commit

Permalink
chore(PublicShareMatomo): Add matomo for multiselect actions
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianDevel committed Sep 26, 2024
1 parent 6f9d377 commit 82a91c5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
4 changes: 3 additions & 1 deletion app/src/main/java/com/infomaniak/drive/MatomoDrive.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ object MatomoDrive : MatomoCore {
const val ACTION_SAVE_TO_KDRIVE_NAME = "saveToKDrive"
const val ACTION_SEND_FILE_COPY_NAME = "sendFileCopy"

const val PUBLIC_SHARE_ACTION_CATEGORY = "publicShareAction"

fun Fragment.trackCategoriesEvent(name: String, action: TrackerAction = TrackerAction.CLICK, value: Float? = null) {
trackEvent("categories", name, action, value)
}
Expand All @@ -45,7 +47,7 @@ object MatomoDrive : MatomoCore {
}

fun Context.trackPublicShareActionEvent(name: String, action: TrackerAction = TrackerAction.CLICK, value: Float? = null) {
trackEvent("publicShareAction", name, action, value)
trackEvent(PUBLIC_SHARE_ACTION_CATEGORY, name, action, value)
}

fun Context.trackPdfActivityActionEvent(name: String, action: TrackerAction = TrackerAction.CLICK, value: Float? = null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,7 @@ abstract class MultiSelectActionsBottomSheetDialog(private val matomoCategory: S
}

binding.downloadFile.apply {
setOnClickListener {
if (drivePermissions.checkWriteStoragePermission()) {
trackEvent(matomoCategory, "bulkDownload")
download()
}
}

setOnClickListener { if (drivePermissions.checkWriteStoragePermission()) download() }
isVisible = navigationArgs.fileIds.isNotEmpty() || navigationArgs.isAllSelected
}
}
Expand All @@ -181,6 +175,7 @@ abstract class MultiSelectActionsBottomSheetDialog(private val matomoCategory: S
}

private fun download() {
trackEvent(matomoCategory, "bulkDownload")
if (navigationArgs.areAllFromTheSameFolder) downloadArchive() else downloadFiles()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import android.view.View
import androidx.core.view.isGone
import androidx.core.view.isVisible
import androidx.fragment.app.activityViewModels
import com.infomaniak.drive.MatomoDrive.PUBLIC_SHARE_ACTION_CATEGORY
import com.infomaniak.drive.data.api.ApiRoutes
import com.infomaniak.drive.ui.fileList.multiSelect.MultiSelectActionsBottomSheetDialog
import com.infomaniak.lib.core.utils.DownloadManagerUtils
Expand Down Expand Up @@ -67,6 +68,6 @@ class PublicShareMultiSelectActionsBottomSheetDialog : MultiSelectActionsBottomS
}

companion object {
const val MATOMO_CATEGORY = "publicShare"
const val MATOMO_CATEGORY = PUBLIC_SHARE_ACTION_CATEGORY
}
}

0 comments on commit 82a91c5

Please sign in to comment.