Remove SignInWithClassic FeatureFlag to enable the feature.
Closes #6669
This commit is contained in:
parent
c59d46a766
commit
801d96cdef
4 changed files with 0 additions and 46 deletions
|
|
@ -60,7 +60,6 @@ dependencies {
|
||||||
implementation(projects.libraries.core)
|
implementation(projects.libraries.core)
|
||||||
implementation(projects.libraries.androidutils)
|
implementation(projects.libraries.androidutils)
|
||||||
implementation(projects.libraries.architecture)
|
implementation(projects.libraries.architecture)
|
||||||
implementation(projects.libraries.featureflag.api)
|
|
||||||
implementation(projects.libraries.matrix.api)
|
implementation(projects.libraries.matrix.api)
|
||||||
implementation(projects.libraries.matrix.api)
|
implementation(projects.libraries.matrix.api)
|
||||||
implementation(projects.libraries.designsystem)
|
implementation(projects.libraries.designsystem)
|
||||||
|
|
@ -81,7 +80,6 @@ dependencies {
|
||||||
testImplementation(projects.features.login.test)
|
testImplementation(projects.features.login.test)
|
||||||
testImplementation(projects.features.enterprise.test)
|
testImplementation(projects.features.enterprise.test)
|
||||||
testImplementation(projects.features.preferences.test)
|
testImplementation(projects.features.preferences.test)
|
||||||
testImplementation(projects.libraries.featureflag.test)
|
|
||||||
testImplementation(projects.libraries.matrix.test)
|
testImplementation(projects.libraries.matrix.test)
|
||||||
testImplementation(projects.libraries.oauth.test)
|
testImplementation(projects.libraries.oauth.test)
|
||||||
testImplementation(projects.libraries.permissions.test)
|
testImplementation(projects.libraries.permissions.test)
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,6 @@ import io.element.android.libraries.androidutils.service.ServiceBinder
|
||||||
import io.element.android.libraries.core.log.logger.LoggerTag
|
import io.element.android.libraries.core.log.logger.LoggerTag
|
||||||
import io.element.android.libraries.core.uri.ensureProtocol
|
import io.element.android.libraries.core.uri.ensureProtocol
|
||||||
import io.element.android.libraries.di.annotations.AppCoroutineScope
|
import io.element.android.libraries.di.annotations.AppCoroutineScope
|
||||||
import io.element.android.libraries.featureflag.api.FeatureFlagService
|
|
||||||
import io.element.android.libraries.featureflag.api.FeatureFlags
|
|
||||||
import io.element.android.libraries.matrix.api.auth.ElementClassicSession
|
import io.element.android.libraries.matrix.api.auth.ElementClassicSession
|
||||||
import io.element.android.libraries.matrix.api.auth.HomeServerLoginCompatibilityChecker
|
import io.element.android.libraries.matrix.api.auth.HomeServerLoginCompatibilityChecker
|
||||||
import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService
|
import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService
|
||||||
|
|
@ -71,7 +69,6 @@ class DefaultElementClassicConnection(
|
||||||
private val coroutineScope: CoroutineScope,
|
private val coroutineScope: CoroutineScope,
|
||||||
private val matrixAuthenticationService: MatrixAuthenticationService,
|
private val matrixAuthenticationService: MatrixAuthenticationService,
|
||||||
private val homeServerLoginCompatibilityChecker: HomeServerLoginCompatibilityChecker,
|
private val homeServerLoginCompatibilityChecker: HomeServerLoginCompatibilityChecker,
|
||||||
private val featureFlagService: FeatureFlagService,
|
|
||||||
) : ElementClassicConnection {
|
) : ElementClassicConnection {
|
||||||
// Messenger for communicating with the service.
|
// Messenger for communicating with the service.
|
||||||
private var messenger: Messenger? = null
|
private var messenger: Messenger? = null
|
||||||
|
|
@ -119,10 +116,6 @@ class DefaultElementClassicConnection(
|
||||||
override fun start() {
|
override fun start() {
|
||||||
Timber.tag(loggerTag.value).d("start()")
|
Timber.tag(loggerTag.value).d("start()")
|
||||||
coroutineScope.launch {
|
coroutineScope.launch {
|
||||||
if (!featureFlagService.isFeatureEnabled(FeatureFlags.SignInWithClassic)) {
|
|
||||||
Timber.tag(loggerTag.value).d("Login with Element Classic is disabled, not starting connection")
|
|
||||||
return@launch
|
|
||||||
}
|
|
||||||
// Establish a connection with the service. We use an explicit
|
// Establish a connection with the service. We use an explicit
|
||||||
// class name because there is no reason to be able to let other
|
// class name because there is no reason to be able to let other
|
||||||
// applications replace our component.
|
// applications replace our component.
|
||||||
|
|
@ -158,11 +151,6 @@ class DefaultElementClassicConnection(
|
||||||
override fun requestSession() {
|
override fun requestSession() {
|
||||||
Timber.tag(loggerTag.value).d("requestSession()")
|
Timber.tag(loggerTag.value).d("requestSession()")
|
||||||
coroutineScope.launch {
|
coroutineScope.launch {
|
||||||
if (!featureFlagService.isFeatureEnabled(FeatureFlags.SignInWithClassic)) {
|
|
||||||
Timber.tag(loggerTag.value).d("Login with Element Classic is disabled")
|
|
||||||
emitState(ElementClassicConnectionState.Error("The feature is disabled"))
|
|
||||||
return@launch
|
|
||||||
}
|
|
||||||
val finalMessenger = messenger
|
val finalMessenger = messenger
|
||||||
if (finalMessenger == null) {
|
if (finalMessenger == null) {
|
||||||
Timber.tag(loggerTag.value).d("The messenger is null, can't request data")
|
Timber.tag(loggerTag.value).d("The messenger is null, can't request data")
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,6 @@ import androidx.core.graphics.createBitmap
|
||||||
import app.cash.turbine.test
|
import app.cash.turbine.test
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import io.element.android.libraries.androidutils.service.ServiceBinder
|
import io.element.android.libraries.androidutils.service.ServiceBinder
|
||||||
import io.element.android.libraries.featureflag.api.FeatureFlagService
|
|
||||||
import io.element.android.libraries.featureflag.api.FeatureFlags
|
|
||||||
import io.element.android.libraries.featureflag.test.FakeFeatureFlagService
|
|
||||||
import io.element.android.libraries.matrix.api.auth.ElementClassicSession
|
import io.element.android.libraries.matrix.api.auth.ElementClassicSession
|
||||||
import io.element.android.libraries.matrix.api.auth.HomeServerLoginCompatibilityChecker
|
import io.element.android.libraries.matrix.api.auth.HomeServerLoginCompatibilityChecker
|
||||||
import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService
|
import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService
|
||||||
|
|
@ -112,21 +109,6 @@ class DefaultElementClassicConnectionTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
fun `requestSession when the feature is disabled emits an error`() = runTest {
|
|
||||||
val connection = createDefaultElementClassicConnection(
|
|
||||||
matrixAuthenticationService = FakeMatrixAuthenticationService(
|
|
||||||
setElementClassicSessionResult = {},
|
|
||||||
),
|
|
||||||
isFeatureEnabled = false,
|
|
||||||
)
|
|
||||||
connection.stateFlow.test {
|
|
||||||
assertThat(awaitItem()).isEqualTo(ElementClassicConnectionState.Idle)
|
|
||||||
connection.requestSession()
|
|
||||||
assertThat(awaitItem()).isInstanceOf(ElementClassicConnectionState.Error::class.java)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `when an error is received, an error is emitted`() = runTest {
|
fun `when an error is received, an error is emitted`() = runTest {
|
||||||
val connection = createDefaultElementClassicConnection(
|
val connection = createDefaultElementClassicConnection(
|
||||||
|
|
@ -514,17 +496,10 @@ class DefaultElementClassicConnectionTest {
|
||||||
homeServerLoginCompatibilityChecker: HomeServerLoginCompatibilityChecker = FakeHomeServerLoginCompatibilityChecker(
|
homeServerLoginCompatibilityChecker: HomeServerLoginCompatibilityChecker = FakeHomeServerLoginCompatibilityChecker(
|
||||||
checkResult = { Result.success(true) }
|
checkResult = { Result.success(true) }
|
||||||
),
|
),
|
||||||
isFeatureEnabled: Boolean = true,
|
|
||||||
featureFlagService: FeatureFlagService = FakeFeatureFlagService(
|
|
||||||
initialState = mapOf(
|
|
||||||
FeatureFlags.SignInWithClassic.key to isFeatureEnabled,
|
|
||||||
)
|
|
||||||
),
|
|
||||||
) = DefaultElementClassicConnection(
|
) = DefaultElementClassicConnection(
|
||||||
serviceBinder = serviceBinder,
|
serviceBinder = serviceBinder,
|
||||||
coroutineScope = coroutineScope,
|
coroutineScope = coroutineScope,
|
||||||
matrixAuthenticationService = matrixAuthenticationService,
|
matrixAuthenticationService = matrixAuthenticationService,
|
||||||
homeServerLoginCompatibilityChecker = homeServerLoginCompatibilityChecker,
|
homeServerLoginCompatibilityChecker = homeServerLoginCompatibilityChecker,
|
||||||
featureFlagService = featureFlagService,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -100,13 +100,6 @@ enum class FeatureFlags(
|
||||||
defaultValue = { false },
|
defaultValue = { false },
|
||||||
isFinished = false,
|
isFinished = false,
|
||||||
),
|
),
|
||||||
SignInWithClassic(
|
|
||||||
key = "feature.signin_with_classic",
|
|
||||||
title = "Sign in with Element Classic",
|
|
||||||
description = "Allow the application to sign in to the current Element Classic account.",
|
|
||||||
defaultValue = { false },
|
|
||||||
isFinished = false,
|
|
||||||
),
|
|
||||||
AllowBlackTheme(
|
AllowBlackTheme(
|
||||||
key = "feature.allow_black_theme",
|
key = "feature.allow_black_theme",
|
||||||
title = "Allow black theme",
|
title = "Allow black theme",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue