mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-22 07:44:00 +01:00
porting the onboarding variant selection to the config
This commit is contained in:
parent
87a8c786f7
commit
e795e9da52
@ -40,7 +40,12 @@ object Config {
|
||||
/**
|
||||
* 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.
|
||||
@ -70,7 +75,7 @@ object Config {
|
||||
}
|
||||
|
||||
/**
|
||||
* The types of analytics Element currently supports
|
||||
* The types of analytics Element currently supports.
|
||||
*/
|
||||
sealed interface Analytics {
|
||||
|
||||
@ -99,3 +104,10 @@ sealed interface Analytics {
|
||||
val policyLink: String,
|
||||
) : Analytics
|
||||
}
|
||||
|
||||
|
||||
enum class OnboardingVariant {
|
||||
LEGACY,
|
||||
LOGIN_2,
|
||||
FTUE_AUTH
|
||||
}
|
||||
|
@ -156,8 +156,6 @@ android {
|
||||
buildConfigField "String", "GIT_BRANCH_NAME", "\"${gitBranchName()}\""
|
||||
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"
|
||||
|
||||
// If set, MSC3086 asserted identity messages sent on VoIP calls will cause the call to appear in the room corresponding to the asserted identity.
|
||||
|
@ -24,6 +24,7 @@ import androidx.datastore.preferences.core.booleanPreferencesKey
|
||||
import androidx.datastore.preferences.core.edit
|
||||
import androidx.datastore.preferences.core.stringPreferencesKey
|
||||
import androidx.datastore.preferences.preferencesDataStore
|
||||
import im.vector.app.config.OnboardingVariant
|
||||
import im.vector.app.features.DefaultVectorFeatures
|
||||
import im.vector.app.features.VectorFeatures
|
||||
import kotlinx.coroutines.flow.first
|
||||
@ -39,8 +40,8 @@ class DebugVectorFeatures(
|
||||
|
||||
private val dataStore = context.dataStore
|
||||
|
||||
override fun onboardingVariant(): VectorFeatures.OnboardingVariant {
|
||||
return readPreferences().getEnum<VectorFeatures.OnboardingVariant>() ?: vectorFeatures.onboardingVariant()
|
||||
override fun onboardingVariant(): OnboardingVariant {
|
||||
return readPreferences().getEnum<OnboardingVariant>() ?: vectorFeatures.onboardingVariant()
|
||||
}
|
||||
|
||||
override fun isOnboardingAlreadyHaveAccountSplashEnabled(): Boolean = read(DebugFeatureKeys.onboardingAlreadyHaveAnAccount)
|
||||
|
@ -231,7 +231,7 @@ object VectorStaticModule {
|
||||
|
||||
@Provides
|
||||
fun providesVoiceMessageConfig() = VoiceMessageConfig(
|
||||
lengthLimitMs = Config.VOICE_MESSAGE_LIMIT
|
||||
lengthLimitMs = Config.VOICE_MESSAGE_LIMIT_MS
|
||||
)
|
||||
|
||||
@Provides
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
package im.vector.app.features
|
||||
|
||||
import im.vector.app.BuildConfig
|
||||
import im.vector.app.config.Config
|
||||
import im.vector.app.config.OnboardingVariant
|
||||
|
||||
interface VectorFeatures {
|
||||
|
||||
@ -33,16 +33,10 @@ interface VectorFeatures {
|
||||
fun forceUsageOfOpusEncoder(): Boolean
|
||||
fun shouldStartDmOnFirstMessage(): Boolean
|
||||
fun isNewAppLayoutEnabled(): Boolean
|
||||
|
||||
enum class OnboardingVariant {
|
||||
LEGACY,
|
||||
LOGIN_2,
|
||||
FTUE_AUTH
|
||||
}
|
||||
}
|
||||
|
||||
class DefaultVectorFeatures : VectorFeatures {
|
||||
override fun onboardingVariant(): VectorFeatures.OnboardingVariant = BuildConfig.ONBOARDING_VARIANT
|
||||
override fun onboardingVariant() = Config.ONBOARDING_VARIANT
|
||||
override fun isOnboardingAlreadyHaveAccountSplashEnabled() = true
|
||||
override fun isOnboardingSplashCarouselEnabled() = true
|
||||
override fun isOnboardingUseCaseEnabled() = true
|
||||
|
@ -32,11 +32,11 @@ import androidx.core.util.Pair
|
||||
import androidx.core.view.ViewCompat
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import im.vector.app.R
|
||||
import im.vector.app.config.OnboardingVariant
|
||||
import im.vector.app.SpaceStateHandler
|
||||
import im.vector.app.core.di.ActiveSessionHolder
|
||||
import im.vector.app.core.error.fatalError
|
||||
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.extensions.toAnalyticsViewRoom
|
||||
import im.vector.app.features.analytics.plan.ViewRoom
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
package im.vector.app.features.onboarding
|
||||
|
||||
import im.vector.app.config.OnboardingVariant
|
||||
import im.vector.app.core.platform.ScreenOrientationLocker
|
||||
import im.vector.app.databinding.ActivityLoginBinding
|
||||
import im.vector.app.features.VectorFeatures
|
||||
@ -34,8 +35,8 @@ class OnboardingVariantFactory @Inject constructor(
|
||||
onboardingViewModel: Lazy<OnboardingViewModel>,
|
||||
loginViewModel2: Lazy<LoginViewModel2>
|
||||
) = when (vectorFeatures.onboardingVariant()) {
|
||||
VectorFeatures.OnboardingVariant.LEGACY -> error("Legacy is not supported by the FTUE")
|
||||
VectorFeatures.OnboardingVariant.FTUE_AUTH -> FtueAuthVariant(
|
||||
OnboardingVariant.LEGACY -> error("Legacy is not supported by the FTUE")
|
||||
OnboardingVariant.FTUE_AUTH -> FtueAuthVariant(
|
||||
views = views,
|
||||
onboardingViewModel = onboardingViewModel.value,
|
||||
activity = activity,
|
||||
@ -43,7 +44,7 @@ class OnboardingVariantFactory @Inject constructor(
|
||||
vectorFeatures = vectorFeatures,
|
||||
orientationLocker = orientationLocker
|
||||
)
|
||||
VectorFeatures.OnboardingVariant.LOGIN_2 -> Login2Variant(
|
||||
OnboardingVariant.LOGIN_2 -> Login2Variant(
|
||||
views = views,
|
||||
loginViewModel = loginViewModel2.value,
|
||||
activity = activity,
|
||||
|
Loading…
Reference in New Issue
Block a user