From b91b9cb973a3c603c05bdf9fc59e8a22dc4d8326 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Fri, 21 Jan 2022 14:25:17 +0000 Subject: [PATCH] lifting analytics extension to the common package --- .../analytics/extensions/IdentityExt.kt | 29 +++++++++++++++++++ .../app/features/onboarding/FtueUseCase.kt | 11 ------- .../onboarding/OnboardingViewModel.kt | 1 + 3 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 vector/src/main/java/im/vector/app/features/analytics/extensions/IdentityExt.kt diff --git a/vector/src/main/java/im/vector/app/features/analytics/extensions/IdentityExt.kt b/vector/src/main/java/im/vector/app/features/analytics/extensions/IdentityExt.kt new file mode 100644 index 0000000000..d87769fd36 --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/analytics/extensions/IdentityExt.kt @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.app.features.analytics.extensions + +import im.vector.app.features.analytics.plan.Identity +import im.vector.app.features.onboarding.FtueUseCase + +fun FtueUseCase.toTrackingValue(): Identity.FtueUseCaseSelection { + return when (this) { + FtueUseCase.FRIENDS_FAMILY -> Identity.FtueUseCaseSelection.PersonalMessaging + FtueUseCase.TEAMS -> Identity.FtueUseCaseSelection.WorkMessaging + FtueUseCase.COMMUNITIES -> Identity.FtueUseCaseSelection.CommunityMessaging + FtueUseCase.SKIP -> Identity.FtueUseCaseSelection.Skip + } +} diff --git a/vector/src/main/java/im/vector/app/features/onboarding/FtueUseCase.kt b/vector/src/main/java/im/vector/app/features/onboarding/FtueUseCase.kt index 23bea3eb99..952612b43f 100644 --- a/vector/src/main/java/im/vector/app/features/onboarding/FtueUseCase.kt +++ b/vector/src/main/java/im/vector/app/features/onboarding/FtueUseCase.kt @@ -16,8 +16,6 @@ package im.vector.app.features.onboarding -import im.vector.app.features.analytics.plan.Identity - enum class FtueUseCase(val persistableValue: String) { FRIENDS_FAMILY("friends_family"), TEAMS("teams"), @@ -28,12 +26,3 @@ enum class FtueUseCase(val persistableValue: String) { fun from(persistedValue: String) = values().first { it.persistableValue == persistedValue } } } - -fun FtueUseCase.toTrackingValue(): Identity.FtueUseCaseSelection { - return when (this) { - FtueUseCase.FRIENDS_FAMILY -> Identity.FtueUseCaseSelection.PersonalMessaging - FtueUseCase.TEAMS -> Identity.FtueUseCaseSelection.WorkMessaging - FtueUseCase.COMMUNITIES -> Identity.FtueUseCaseSelection.CommunityMessaging - FtueUseCase.SKIP -> Identity.FtueUseCaseSelection.Skip - } -} diff --git a/vector/src/main/java/im/vector/app/features/onboarding/OnboardingViewModel.kt b/vector/src/main/java/im/vector/app/features/onboarding/OnboardingViewModel.kt index 530f2e62a5..9c3743f372 100644 --- a/vector/src/main/java/im/vector/app/features/onboarding/OnboardingViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/onboarding/OnboardingViewModel.kt @@ -37,6 +37,7 @@ import im.vector.app.core.resources.StringProvider import im.vector.app.core.utils.ensureTrailingSlash import im.vector.app.features.VectorFeatures import im.vector.app.features.analytics.AnalyticsTracker +import im.vector.app.features.analytics.extensions.toTrackingValue import im.vector.app.features.analytics.plan.Identity import im.vector.app.features.login.HomeServerConnectionConfigFactory import im.vector.app.features.login.LoginConfig