Skip to content

Commit

Permalink
feat(Matomo): Use same names as iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianDevel committed Mar 5, 2025
1 parent ba103ae commit 330eb50
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ object MatomoSwissTransfer : Matomo {
}
}

fun trackScreen(title: String) {
trackScreen(path = "/$title", title = title)
}

fun trackTransferTypeEvent(name: String) {
trackEvent("transferType", name)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ sealed class MainNavigation(override val matomoValue: String) : NavigationDestin

// If it has to be renamed, don't forget to rename `*DestinationName` in the companion object too.
@Serializable
data class SentDestination(val transferUuid: String? = null) : MainNavigation("SentScreen") {
data class SentDestination(val transferUuid: String? = null) : MainNavigation("SentView") {

companion object {
fun NavGraphBuilder.sentDestination(content: @Composable (AnimatedContentScope.(NavBackStackEntry) -> Unit)) {
Expand All @@ -62,7 +62,7 @@ sealed class MainNavigation(override val matomoValue: String) : NavigationDestin

// If it has to be renamed, don't forget to rename `*DestinationName` in the companion object too.
@Serializable
data class ReceivedDestination(val transferUuid: String? = null) : MainNavigation("ReceivedScreen") {
data class ReceivedDestination(val transferUuid: String? = null) : MainNavigation("ReceivedView") {

companion object {
fun NavGraphBuilder.receivedDestination(content: @Composable (AnimatedContentScope.(NavBackStackEntry) -> Unit)) {
Expand All @@ -72,7 +72,7 @@ sealed class MainNavigation(override val matomoValue: String) : NavigationDestin
}

@Serializable
data object SettingsDestination : MainNavigation("SettingsScreen")
data object SettingsDestination : MainNavigation("SettingsView")

companion object {
private val TAG = MainNavigation::class.java.simpleName
Expand Down Expand Up @@ -114,37 +114,37 @@ sealed class MainNavigation(override val matomoValue: String) : NavigationDestin
sealed class NewTransferNavigation(override val matomoValue: String) : NavigationDestination() {

@Serializable
data object ImportFilesDestination : NewTransferNavigation("ImportFileScreen")
data object ImportFilesDestination : NewTransferNavigation("ImportFileView")

@Serializable
data class ValidateUserEmailDestination(val authorEmail: String) : NewTransferNavigation("ValidateUserEmailScreen")
data class ValidateUserEmailDestination(val authorEmail: String) : NewTransferNavigation("ValidateUserEmailView")

@Serializable
data class UploadProgressDestination(
val transferType: TransferTypeUi,
val totalSize: Long,
val authorEmail: String?,
) : NewTransferNavigation("UploadProgressScreen")
) : NewTransferNavigation("UploadProgressView")

@Serializable
data class UploadSuccessDestination(
val transferType: TransferTypeUi,
val transferUuid: String,
val transferUrl: String,
) : NewTransferNavigation("UploadSuccessScreen")
) : NewTransferNavigation("UploadSuccessView")

@Serializable
data class UploadErrorDestination(
val transferType: TransferTypeUi,
val totalSize: Long,
val authorEmail: String?,
) : NewTransferNavigation("UploadErrorScreen")
) : NewTransferNavigation("UploadErrorView")

@Serializable
data object UploadIntegrityErrorDestination : NewTransferNavigation("UploadIntegrityErrorScreen")
data object UploadIntegrityErrorDestination : NewTransferNavigation("UploadIntegrityErrorView")

@Serializable
data object NewTransferFilesDetailsDestination : NewTransferNavigation("NewTransferFilesDetailsScreen")
data object NewTransferFilesDetailsDestination : NewTransferNavigation("NewTransferFilesDetailsView")

companion object {
val startDestination = ImportFilesDestination
Expand Down Expand Up @@ -198,6 +198,6 @@ sealed class NavigationDestination {
abstract val matomoValue: String

fun trackScreen() {
MatomoSwissTransfer.trackScreen(path = "/$matomoValue", title = matomoValue)
MatomoSwissTransfer.trackScreen(title = matomoValue)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ private fun ThreePaneScaffoldNavigator<DestinationContent>.navigateToDetails(
direction: TransferDirection,
transferUuid: String,
) {
val destinationName = "${direction.name.lowercase()}TransferDetail"
MatomoSwissTransfer.trackScreen(path = destinationName, title = destinationName)
MatomoSwissTransfer.trackScreen("${direction.name.lowercase()}TransferDetailView")
selectItem(context, windowAdaptiveInfo, DestinationContent.RootLevel(direction, transferUuid))
}

Expand Down

0 comments on commit 330eb50

Please sign in to comment.