diff --git a/vector-config/src/main/java/im/vector/app/config/Analytics.kt b/vector-config/src/main/java/im/vector/app/config/Analytics.kt new file mode 100644 index 0000000000..7fdc78dc8a --- /dev/null +++ b/vector-config/src/main/java/im/vector/app/config/Analytics.kt @@ -0,0 +1,48 @@ +/* + * 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.config + +/** + * The types of analytics Element currently supports. + */ +sealed interface Analytics { + + /** + * Disables the analytics integrations. + */ + object Disabled : Analytics + + /** + * Analytics integration via PostHog. + */ + data class PostHog( + /** + * The PostHog instance url. + */ + val postHogHost: String, + + /** + * The PostHog instance API key. + */ + val postHogApiKey: String, + + /** + * A URL to more information about the analytics collection. + */ + val policyLink: String, + ) : Analytics +} diff --git a/vector-config/src/main/java/im/vector/app/config/Config.kt b/vector-config/src/main/java/im/vector/app/config/Config.kt index a15ac198b9..ef9b6a7b8d 100644 --- a/vector-config/src/main/java/im/vector/app/config/Config.kt +++ b/vector-config/src/main/java/im/vector/app/config/Config.kt @@ -87,58 +87,3 @@ object Config { */ val NIGHTLY_ANALYTICS_CONFIG = RELEASE_ANALYTICS_CONFIG } - -/** - * The types of analytics Element currently supports. - */ -sealed interface Analytics { - - /** - * Disables the analytics integrations. - */ - object Disabled : Analytics - - /** - * Analytics integration via PostHog. - */ - data class PostHog( - /** - * The PostHog instance url. - */ - val postHogHost: String, - - /** - * The PostHog instance API key. - */ - val postHogApiKey: String, - - /** - * A URL to more information about the analytics collection. - */ - val policyLink: String, - ) : Analytics -} - -enum class OnboardingVariant { - LEGACY, - LOGIN_2, - FTUE_AUTH -} - -enum class KeySharingStrategy { - /** - * Keys will be sent for the first time when the first message is sent. - * This is handled by the Matrix SDK so there's no need to do it in Vector. - */ - WhenSendingEvent, - - /** - * Keys will be sent for the first time when the timeline displayed. - */ - WhenEnteringRoom, - - /** - * Keys will be sent for the first time when a typing started. - */ - WhenTyping -} diff --git a/vector-config/src/main/java/im/vector/app/config/KeySharingStrategy.kt b/vector-config/src/main/java/im/vector/app/config/KeySharingStrategy.kt new file mode 100644 index 0000000000..51f3d81151 --- /dev/null +++ b/vector-config/src/main/java/im/vector/app/config/KeySharingStrategy.kt @@ -0,0 +1,35 @@ +/* + * 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.config + +enum class KeySharingStrategy { + /** + * Keys will be sent for the first time when the first message is sent. + * This is handled by the Matrix SDK so there's no need to do it in Vector. + */ + WhenSendingEvent, + + /** + * Keys will be sent for the first time when the timeline displayed. + */ + WhenEnteringRoom, + + /** + * Keys will be sent for the first time when a typing started. + */ + WhenTyping +} diff --git a/vector-config/src/main/java/im/vector/app/config/OnboardingVariant.kt b/vector-config/src/main/java/im/vector/app/config/OnboardingVariant.kt new file mode 100644 index 0000000000..ae8cfd1172 --- /dev/null +++ b/vector-config/src/main/java/im/vector/app/config/OnboardingVariant.kt @@ -0,0 +1,23 @@ +/* + * 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.config + +enum class OnboardingVariant { + LEGACY, + LOGIN_2, + FTUE_AUTH +} diff --git a/vector/src/main/java/im/vector/app/core/di/ConfigurationModule.kt b/vector/src/main/java/im/vector/app/core/di/ConfigurationModule.kt index 10c91a5dd1..25d3d8311f 100644 --- a/vector/src/main/java/im/vector/app/core/di/ConfigurationModule.kt +++ b/vector/src/main/java/im/vector/app/core/di/ConfigurationModule.kt @@ -37,10 +37,12 @@ import im.vector.app.features.raw.wellknown.CryptoConfig object ConfigurationModule { @Provides - fun providesAnalyticsConfig(buildMeta: BuildMeta): AnalyticsConfig { - val config: Analytics = when (buildMeta.isDebug) { - true -> Config.DEBUG_ANALYTICS_CONFIG - false -> Config.RELEASE_ANALYTICS_CONFIG + fun providesAnalyticsConfig(): AnalyticsConfig { + val config: Analytics = when (BuildConfig.BUILD_TYPE) { + "debug" -> Config.DEBUG_ANALYTICS_CONFIG + "nightly" -> Config.NIGHTLY_ANALYTICS_CONFIG + "release" -> Config.RELEASE_ANALYTICS_CONFIG + else -> throw IllegalStateException("Unhandled build type: ${BuildConfig.BUILD_TYPE}") } return when (config) { Analytics.Disabled -> AnalyticsConfig(isEnabled = false, "", "", "") diff --git a/vector/src/main/java/im/vector/app/core/di/SingletonModule.kt b/vector/src/main/java/im/vector/app/core/di/SingletonModule.kt index 3ba9eb0f5b..0b7e3b347d 100644 --- a/vector/src/main/java/im/vector/app/core/di/SingletonModule.kt +++ b/vector/src/main/java/im/vector/app/core/di/SingletonModule.kt @@ -211,30 +211,6 @@ object VectorStaticModule { @Provides fun providesPhoneNumberUtil(): PhoneNumberUtil = PhoneNumberUtil.getInstance() - @Provides - fun providesAnalyticsConfig(): AnalyticsConfig { - val config: Analytics = when (BuildConfig.BUILD_TYPE) { - "debug" -> Config.DEBUG_ANALYTICS_CONFIG - "nightly" -> Config.NIGHTLY_ANALYTICS_CONFIG - "release" -> Config.RELEASE_ANALYTICS_CONFIG - else -> throw IllegalStateException("Unhandled build type: ${BuildConfig.BUILD_TYPE}") - } - return when (config) { - Analytics.Disabled -> AnalyticsConfig(isEnabled = false, "", "", "") - is Analytics.PostHog -> AnalyticsConfig( - isEnabled = true, - postHogHost = config.postHogHost, - postHogApiKey = config.postHogApiKey, - policyLink = config.policyLink - ) - } - } - - @Provides - fun providesVoiceMessageConfig() = VoiceMessageConfig( - lengthLimitMs = Config.VOICE_MESSAGE_LIMIT_MS - ) - @Provides @Singleton fun providesBuildMeta() = BuildMeta(