renaming login version to variants to better describe the different flows

This commit is contained in:
Adam Brown 2021-12-08 11:54:21 +00:00
parent dae2e9988f
commit fd0e1e44c4
5 changed files with 16 additions and 16 deletions

View File

@ -140,7 +140,7 @@ android {
buildConfigField "String", "BUILD_NUMBER", "\"${buildNumber}\""
resValue "string", "build_number", "\"${buildNumber}\""
buildConfigField "im.vector.app.features.VectorFeatures.LoginVersion", "LOGIN_VERSION", "im.vector.app.features.VectorFeatures.LoginVersion.V1"
buildConfigField "im.vector.app.features.VectorFeatures.LoginVariant", "LOGIN_VARIANT", "im.vector.app.features.VectorFeatures.LoginVariant.LEGACY"
buildConfigField "im.vector.app.features.crypto.keysrequest.OutboundSessionKeySharingStrategy", "outboundSessionKeySharingStrategy", "im.vector.app.features.crypto.keysrequest.OutboundSessionKeySharingStrategy.WhenTyping"

View File

@ -28,8 +28,8 @@ class DebugFeaturesStateFactory @Inject constructor(
return FeaturesState(listOf(
createEnumFeature(
label = "Login version",
selection = debugFeatures.loginVersion(),
default = defaultFeatures.loginVersion()
selection = debugFeatures.loginVariant(),
default = defaultFeatures.loginVariant()
)
))
}

View File

@ -38,8 +38,8 @@ class DebugVectorFeatures(
private val dataStore = context.dataStore
override fun loginVersion(): VectorFeatures.LoginVersion {
return readPreferences().getEnum<VectorFeatures.LoginVersion>() ?: vectorFeatures.loginVersion()
override fun loginVariant(): VectorFeatures.LoginVariant {
return readPreferences().getEnum<VectorFeatures.LoginVariant>() ?: vectorFeatures.loginVariant()
}
fun <T : Enum<T>> hasEnumOverride(type: KClass<T>) = readPreferences().containsEnum(type)

View File

@ -20,11 +20,11 @@ import im.vector.app.BuildConfig
interface VectorFeatures {
fun loginVersion(): LoginVersion
fun loginVariant(): LoginVariant
enum class LoginVersion {
V1,
V2
enum class LoginVariant {
LEGACY,
FTUE_WIP
}
enum class NotificationSettingsVersion {
@ -34,5 +34,5 @@ interface VectorFeatures {
}
class DefaultVectorFeatures : VectorFeatures {
override fun loginVersion(): VectorFeatures.LoginVersion = BuildConfig.LOGIN_VERSION
override fun loginVariant(): VectorFeatures.LoginVariant = BuildConfig.LOGIN_VARIANT
}

View File

@ -110,18 +110,18 @@ class DefaultNavigator @Inject constructor(
) : Navigator {
override fun openLogin(context: Context, loginConfig: LoginConfig?, flags: Int) {
val intent = when (features.loginVersion()) {
VectorFeatures.LoginVersion.V1 -> LoginActivity.newIntent(context, loginConfig)
VectorFeatures.LoginVersion.V2 -> LoginActivity2.newIntent(context, loginConfig)
val intent = when (features.loginVariant()) {
VectorFeatures.LoginVariant.LEGACY -> LoginActivity.newIntent(context, loginConfig)
VectorFeatures.LoginVariant.FTUE_WIP -> LoginActivity2.newIntent(context, loginConfig)
}
intent.addFlags(flags)
context.startActivity(intent)
}
override fun loginSSORedirect(context: Context, data: Uri?) {
val intent = when (features.loginVersion()) {
VectorFeatures.LoginVersion.V1 -> LoginActivity.redirectIntent(context, data)
VectorFeatures.LoginVersion.V2 -> LoginActivity2.redirectIntent(context, data)
val intent = when (features.loginVariant()) {
VectorFeatures.LoginVariant.LEGACY -> LoginActivity.redirectIntent(context, data)
VectorFeatures.LoginVariant.FTUE_WIP -> LoginActivity2.redirectIntent(context, data)
}
context.startActivity(intent)
}