lifting analytics extension to the common package

This commit is contained in:
Adam Brown 2022-01-21 14:25:17 +00:00
parent f44ccd739e
commit b91b9cb973
3 changed files with 30 additions and 11 deletions

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -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