diff --git a/vector/build.gradle b/vector/build.gradle
index ff81c4d721..6f36358aa3 100644
--- a/vector/build.gradle
+++ b/vector/build.gradle
@@ -140,10 +140,7 @@ android {
buildConfigField "String", "BUILD_NUMBER", "\"${buildNumber}\""
resValue "string", "build_number", "\"${buildNumber}\""
- // The two booleans must not have the same value. We need two values for the manifest
- // LoginFlowV2 is disabled to be merged on develop (changelog: Improve login/register flow (#1410, #2585, #3172))
- resValue "bool", "useLoginV1", "true"
- resValue "bool", "useLoginV2", "false"
+ buildConfigField "im.vector.app.features.VectorFeatures.LoginVersion", "LOGIN_VERSION", "im.vector.app.features.VectorFeatures.LoginVersion.V1"
// NotificationSettingsV2 is disabled. To be released in conjunction with iOS/Web
def useNotificationSettingsV2 = true
diff --git a/vector/src/main/AndroidManifest.xml b/vector/src/main/AndroidManifest.xml
index 8e9e534f7a..6d3c6cdc51 100644
--- a/vector/src/main/AndroidManifest.xml
+++ b/vector/src/main/AndroidManifest.xml
@@ -133,13 +133,11 @@
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 9912c25eb0..4fbeb549aa 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
@@ -137,7 +137,7 @@ object VectorStaticModule {
}
@Provides
- fun providesFeatures(context: Context): VectorFeatures {
- return DefaultVectorFeatures(context)
+ fun providesFeatures(): VectorFeatures {
+ return DefaultVectorFeatures()
}
}
diff --git a/vector/src/main/java/im/vector/app/features/VectorFeatures.kt b/vector/src/main/java/im/vector/app/features/VectorFeatures.kt
index a5f08bf7d1..ccc54b5d8e 100644
--- a/vector/src/main/java/im/vector/app/features/VectorFeatures.kt
+++ b/vector/src/main/java/im/vector/app/features/VectorFeatures.kt
@@ -16,27 +16,18 @@
package im.vector.app.features
-import android.content.Context
-import im.vector.app.R
-import im.vector.app.features.VectorFeatures.LoginType
+import im.vector.app.BuildConfig
interface VectorFeatures {
- fun loginType(): LoginType
+ fun loginVersion(): LoginVersion
- enum class LoginType {
+ enum class LoginVersion {
V1,
V2
}
}
-class DefaultVectorFeatures(private val context: Context) : VectorFeatures {
- override fun loginType(): LoginType {
- val v2LoginIsEnabled = context.resources.getBoolean(R.bool.useLoginV2)
- return if (v2LoginIsEnabled) {
- LoginType.V2
- } else {
- LoginType.V1
- }
- }
+class DefaultVectorFeatures : VectorFeatures {
+ override fun loginVersion(): VectorFeatures.LoginVersion = BuildConfig.LOGIN_VERSION
}
diff --git a/vector/src/main/java/im/vector/app/features/navigation/DefaultNavigator.kt b/vector/src/main/java/im/vector/app/features/navigation/DefaultNavigator.kt
index ff57528c16..eacd8523cf 100644
--- a/vector/src/main/java/im/vector/app/features/navigation/DefaultNavigator.kt
+++ b/vector/src/main/java/im/vector/app/features/navigation/DefaultNavigator.kt
@@ -111,26 +111,26 @@ class DefaultNavigator @Inject constructor(
) : Navigator {
override fun openLogin(context: Context, loginConfig: LoginConfig?, flags: Int) {
- val intent = when (features.loginType()) {
- VectorFeatures.LoginType.V1 -> LoginActivity.newIntent(context, loginConfig)
- VectorFeatures.LoginType.V2 -> LoginActivity2.newIntent(context, loginConfig)
+ val intent = when (features.loginVersion()) {
+ VectorFeatures.LoginVersion.V1 -> LoginActivity.newIntent(context, loginConfig)
+ VectorFeatures.LoginVersion.V2 -> LoginActivity2.newIntent(context, loginConfig)
}
intent.addFlags(flags)
context.startActivity(intent)
}
override fun loginSSORedirect(context: Context, data: Uri?) {
- val intent = when (features.loginType()) {
- VectorFeatures.LoginType.V1 -> LoginActivity.redirectIntent(context, data)
- VectorFeatures.LoginType.V2 -> LoginActivity2.redirectIntent(context, data)
+ val intent = when (features.loginVersion()) {
+ VectorFeatures.LoginVersion.V1 -> LoginActivity.redirectIntent(context, data)
+ VectorFeatures.LoginVersion.V2 -> LoginActivity2.redirectIntent(context, data)
}
context.startActivity(intent)
}
override fun softLogout(context: Context) {
- val intent = when (features.loginType()) {
- VectorFeatures.LoginType.V1 -> SoftLogoutActivity.newIntent(context)
- VectorFeatures.LoginType.V2 -> SoftLogoutActivity2.newIntent(context)
+ val intent = when (features.loginVersion()) {
+ VectorFeatures.LoginVersion.V1 -> SoftLogoutActivity.newIntent(context)
+ VectorFeatures.LoginVersion.V2 -> SoftLogoutActivity2.newIntent(context)
}
context.startActivity(intent)
}