porting the onboarding variant selection to the config

This commit is contained in:
Adam Brown 2022-06-30 12:41:33 +01:00
parent 87a8c786f7
commit e795e9da52
7 changed files with 25 additions and 19 deletions

View File

@ -40,7 +40,12 @@ object Config {
/** /**
* The maximum length of voice messages in milliseconds. * The maximum length of voice messages in milliseconds.
*/ */
const val VOICE_MESSAGE_LIMIT = 120_000L const val VOICE_MESSAGE_LIMIT_MS = 120_000L
/**
* The onboarding flow
*/
val ONBOARDING_VARIANT = OnboardingVariant.FTUE_AUTH
/** /**
* The analytics configuration to use for the Debug build type. * The analytics configuration to use for the Debug build type.
@ -70,7 +75,7 @@ object Config {
} }
/** /**
* The types of analytics Element currently supports * The types of analytics Element currently supports.
*/ */
sealed interface Analytics { sealed interface Analytics {
@ -99,3 +104,10 @@ sealed interface Analytics {
val policyLink: String, val policyLink: String,
) : Analytics ) : Analytics
} }
enum class OnboardingVariant {
LEGACY,
LOGIN_2,
FTUE_AUTH
}

View File

@ -156,8 +156,6 @@ android {
buildConfigField "String", "GIT_BRANCH_NAME", "\"${gitBranchName()}\"" buildConfigField "String", "GIT_BRANCH_NAME", "\"${gitBranchName()}\""
buildConfigField "String", "BUILD_NUMBER", "\"${buildNumber}\"" buildConfigField "String", "BUILD_NUMBER", "\"${buildNumber}\""
buildConfigField "im.vector.app.features.VectorFeatures.OnboardingVariant", "ONBOARDING_VARIANT", "im.vector.app.features.VectorFeatures.OnboardingVariant.FTUE_AUTH"
buildConfigField "im.vector.app.features.crypto.keysrequest.OutboundSessionKeySharingStrategy", "outboundSessionKeySharingStrategy", "im.vector.app.features.crypto.keysrequest.OutboundSessionKeySharingStrategy.WhenTyping" buildConfigField "im.vector.app.features.crypto.keysrequest.OutboundSessionKeySharingStrategy", "outboundSessionKeySharingStrategy", "im.vector.app.features.crypto.keysrequest.OutboundSessionKeySharingStrategy.WhenTyping"
// If set, MSC3086 asserted identity messages sent on VoIP calls will cause the call to appear in the room corresponding to the asserted identity. // If set, MSC3086 asserted identity messages sent on VoIP calls will cause the call to appear in the room corresponding to the asserted identity.

View File

@ -24,6 +24,7 @@ import androidx.datastore.preferences.core.booleanPreferencesKey
import androidx.datastore.preferences.core.edit import androidx.datastore.preferences.core.edit
import androidx.datastore.preferences.core.stringPreferencesKey import androidx.datastore.preferences.core.stringPreferencesKey
import androidx.datastore.preferences.preferencesDataStore import androidx.datastore.preferences.preferencesDataStore
import im.vector.app.config.OnboardingVariant
import im.vector.app.features.DefaultVectorFeatures import im.vector.app.features.DefaultVectorFeatures
import im.vector.app.features.VectorFeatures import im.vector.app.features.VectorFeatures
import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.first
@ -39,8 +40,8 @@ class DebugVectorFeatures(
private val dataStore = context.dataStore private val dataStore = context.dataStore
override fun onboardingVariant(): VectorFeatures.OnboardingVariant { override fun onboardingVariant(): OnboardingVariant {
return readPreferences().getEnum<VectorFeatures.OnboardingVariant>() ?: vectorFeatures.onboardingVariant() return readPreferences().getEnum<OnboardingVariant>() ?: vectorFeatures.onboardingVariant()
} }
override fun isOnboardingAlreadyHaveAccountSplashEnabled(): Boolean = read(DebugFeatureKeys.onboardingAlreadyHaveAnAccount) override fun isOnboardingAlreadyHaveAccountSplashEnabled(): Boolean = read(DebugFeatureKeys.onboardingAlreadyHaveAnAccount)

View File

@ -231,7 +231,7 @@ object VectorStaticModule {
@Provides @Provides
fun providesVoiceMessageConfig() = VoiceMessageConfig( fun providesVoiceMessageConfig() = VoiceMessageConfig(
lengthLimitMs = Config.VOICE_MESSAGE_LIMIT lengthLimitMs = Config.VOICE_MESSAGE_LIMIT_MS
) )
@Provides @Provides

View File

@ -16,8 +16,8 @@
package im.vector.app.features package im.vector.app.features
import im.vector.app.BuildConfig
import im.vector.app.config.Config import im.vector.app.config.Config
import im.vector.app.config.OnboardingVariant
interface VectorFeatures { interface VectorFeatures {
@ -33,16 +33,10 @@ interface VectorFeatures {
fun forceUsageOfOpusEncoder(): Boolean fun forceUsageOfOpusEncoder(): Boolean
fun shouldStartDmOnFirstMessage(): Boolean fun shouldStartDmOnFirstMessage(): Boolean
fun isNewAppLayoutEnabled(): Boolean fun isNewAppLayoutEnabled(): Boolean
enum class OnboardingVariant {
LEGACY,
LOGIN_2,
FTUE_AUTH
}
} }
class DefaultVectorFeatures : VectorFeatures { class DefaultVectorFeatures : VectorFeatures {
override fun onboardingVariant(): VectorFeatures.OnboardingVariant = BuildConfig.ONBOARDING_VARIANT override fun onboardingVariant() = Config.ONBOARDING_VARIANT
override fun isOnboardingAlreadyHaveAccountSplashEnabled() = true override fun isOnboardingAlreadyHaveAccountSplashEnabled() = true
override fun isOnboardingSplashCarouselEnabled() = true override fun isOnboardingSplashCarouselEnabled() = true
override fun isOnboardingUseCaseEnabled() = true override fun isOnboardingUseCaseEnabled() = true

View File

@ -32,11 +32,11 @@ import androidx.core.util.Pair
import androidx.core.view.ViewCompat import androidx.core.view.ViewCompat
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import im.vector.app.R import im.vector.app.R
import im.vector.app.config.OnboardingVariant
import im.vector.app.SpaceStateHandler import im.vector.app.SpaceStateHandler
import im.vector.app.core.di.ActiveSessionHolder import im.vector.app.core.di.ActiveSessionHolder
import im.vector.app.core.error.fatalError import im.vector.app.core.error.fatalError
import im.vector.app.features.VectorFeatures import im.vector.app.features.VectorFeatures
import im.vector.app.features.VectorFeatures.OnboardingVariant
import im.vector.app.features.analytics.AnalyticsTracker import im.vector.app.features.analytics.AnalyticsTracker
import im.vector.app.features.analytics.extensions.toAnalyticsViewRoom import im.vector.app.features.analytics.extensions.toAnalyticsViewRoom
import im.vector.app.features.analytics.plan.ViewRoom import im.vector.app.features.analytics.plan.ViewRoom

View File

@ -16,6 +16,7 @@
package im.vector.app.features.onboarding package im.vector.app.features.onboarding
import im.vector.app.config.OnboardingVariant
import im.vector.app.core.platform.ScreenOrientationLocker import im.vector.app.core.platform.ScreenOrientationLocker
import im.vector.app.databinding.ActivityLoginBinding import im.vector.app.databinding.ActivityLoginBinding
import im.vector.app.features.VectorFeatures import im.vector.app.features.VectorFeatures
@ -34,8 +35,8 @@ class OnboardingVariantFactory @Inject constructor(
onboardingViewModel: Lazy<OnboardingViewModel>, onboardingViewModel: Lazy<OnboardingViewModel>,
loginViewModel2: Lazy<LoginViewModel2> loginViewModel2: Lazy<LoginViewModel2>
) = when (vectorFeatures.onboardingVariant()) { ) = when (vectorFeatures.onboardingVariant()) {
VectorFeatures.OnboardingVariant.LEGACY -> error("Legacy is not supported by the FTUE") OnboardingVariant.LEGACY -> error("Legacy is not supported by the FTUE")
VectorFeatures.OnboardingVariant.FTUE_AUTH -> FtueAuthVariant( OnboardingVariant.FTUE_AUTH -> FtueAuthVariant(
views = views, views = views,
onboardingViewModel = onboardingViewModel.value, onboardingViewModel = onboardingViewModel.value,
activity = activity, activity = activity,
@ -43,7 +44,7 @@ class OnboardingVariantFactory @Inject constructor(
vectorFeatures = vectorFeatures, vectorFeatures = vectorFeatures,
orientationLocker = orientationLocker orientationLocker = orientationLocker
) )
VectorFeatures.OnboardingVariant.LOGIN_2 -> Login2Variant( OnboardingVariant.LOGIN_2 -> Login2Variant(
views = views, views = views,
loginViewModel = loginViewModel2.value, loginViewModel = loginViewModel2.value,
activity = activity, activity = activity,