Remove RoomDirectorySearch feature flag — always enable the feature (#6736)
* Remove RoomDirectorySearch feature flag, always enable the feature Co-authored-by: stefanceriu <637564+stefanceriu@users.noreply.github.com> * Apply ktlint formatting Co-authored-by: jmartinesp <480955+jmartinesp@users.noreply.github.com> * Update screenshots --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: stefanceriu <637564+stefanceriu@users.noreply.github.com> Co-authored-by: jmartinesp <480955+jmartinesp@users.noreply.github.com> Co-authored-by: ElementBot <android@element.io>
This commit is contained in:
parent
9b91fabbd6
commit
6ef9315468
17 changed files with 18 additions and 100 deletions
|
|
@ -10,8 +10,6 @@ package io.element.android.features.startchat.impl.root
|
|||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
|
|
@ -24,8 +22,6 @@ import io.element.android.features.startchat.impl.userlist.UserListPresenterArgs
|
|||
import io.element.android.libraries.architecture.AsyncAction
|
||||
import io.element.android.libraries.architecture.Presenter
|
||||
import io.element.android.libraries.core.meta.BuildMeta
|
||||
import io.element.android.libraries.featureflag.api.FeatureFlagService
|
||||
import io.element.android.libraries.featureflag.api.FeatureFlags
|
||||
import io.element.android.libraries.matrix.api.core.RoomId
|
||||
import io.element.android.libraries.usersearch.api.UserRepository
|
||||
import kotlinx.coroutines.launch
|
||||
|
|
@ -37,7 +33,6 @@ class StartChatPresenter(
|
|||
userListDataStore: UserListDataStore,
|
||||
private val startDMAction: StartDMAction,
|
||||
private val buildMeta: BuildMeta,
|
||||
private val featureFlagService: FeatureFlagService,
|
||||
) : Presenter<StartChatState> {
|
||||
private val presenter = presenterFactory.create(
|
||||
UserListPresenterArgs(
|
||||
|
|
@ -54,10 +49,6 @@ class StartChatPresenter(
|
|||
val localCoroutineScope = rememberCoroutineScope()
|
||||
val startDmActionState: MutableState<AsyncAction<RoomId>> = remember { mutableStateOf(AsyncAction.Uninitialized) }
|
||||
|
||||
val isRoomDirectorySearchEnabled by remember {
|
||||
featureFlagService.isFeatureEnabledFlow(FeatureFlags.RoomDirectorySearch)
|
||||
}.collectAsState(initial = false)
|
||||
|
||||
fun handleEvent(event: StartChatEvents) {
|
||||
when (event) {
|
||||
is StartChatEvents.StartDM -> localCoroutineScope.launch {
|
||||
|
|
@ -75,7 +66,6 @@ class StartChatPresenter(
|
|||
applicationName = buildMeta.applicationName,
|
||||
userListState = userListState,
|
||||
startDmAction = startDmActionState.value,
|
||||
isRoomDirectorySearchEnabled = isRoomDirectorySearchEnabled,
|
||||
eventSink = ::handleEvent,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,5 @@ data class StartChatState(
|
|||
val applicationName: String,
|
||||
val userListState: UserListState,
|
||||
val startDmAction: AsyncAction<RoomId>,
|
||||
val isRoomDirectorySearchEnabled: Boolean,
|
||||
val eventSink: (StartChatEvents) -> Unit,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -55,9 +55,6 @@ open class StartChatStateProvider : PreviewParameterProvider<StartChatState> {
|
|||
aCreateRoomRootState(
|
||||
startDmAction = aConfirmingStartDmWithMatrixUser()
|
||||
),
|
||||
aCreateRoomRootState(
|
||||
isRoomDirectorySearchEnabled = true,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -75,12 +72,10 @@ fun aCreateRoomRootState(
|
|||
applicationName: String = "Element X Preview",
|
||||
userListState: UserListState = aUserListState(),
|
||||
startDmAction: AsyncAction<RoomId> = AsyncAction.Uninitialized,
|
||||
isRoomDirectorySearchEnabled: Boolean = false,
|
||||
eventSink: (StartChatEvents) -> Unit = {},
|
||||
) = StartChatState(
|
||||
applicationName = applicationName,
|
||||
userListState = userListState,
|
||||
startDmAction = startDmAction,
|
||||
isRoomDirectorySearchEnabled = isRoomDirectorySearchEnabled,
|
||||
eventSink = eventSink,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -176,14 +176,12 @@ private fun CreateRoomActionButtonsList(
|
|||
onClick = onNewRoomClick,
|
||||
)
|
||||
}
|
||||
if (state.isRoomDirectorySearchEnabled) {
|
||||
item {
|
||||
CreateRoomActionButton(
|
||||
iconRes = CompoundDrawables.ic_compound_list_bulleted,
|
||||
text = stringResource(id = R.string.screen_room_directory_search_title),
|
||||
onClick = onRoomDirectorySearchClick,
|
||||
)
|
||||
}
|
||||
item {
|
||||
CreateRoomActionButton(
|
||||
iconRes = CompoundDrawables.ic_compound_list_bulleted,
|
||||
text = stringResource(id = R.string.screen_room_directory_search_title),
|
||||
onClick = onRoomDirectorySearchClick,
|
||||
)
|
||||
}
|
||||
item {
|
||||
CreateRoomActionButton(
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@ import io.element.android.features.startchat.impl.userlist.FakeUserListPresenter
|
|||
import io.element.android.features.startchat.impl.userlist.FakeUserListPresenterFactory
|
||||
import io.element.android.features.startchat.impl.userlist.UserListDataStore
|
||||
import io.element.android.libraries.architecture.AsyncAction
|
||||
import io.element.android.libraries.featureflag.api.FeatureFlags
|
||||
import io.element.android.libraries.featureflag.test.FakeFeatureFlagService
|
||||
import io.element.android.libraries.matrix.api.core.RoomId
|
||||
import io.element.android.libraries.matrix.api.core.UserId
|
||||
import io.element.android.libraries.matrix.api.user.MatrixUser
|
||||
|
|
@ -155,34 +153,16 @@ class StartChatPresenterTest {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `present - room directory search`() = runTest {
|
||||
val presenter = createStartChatPresenter(isRoomDirectorySearchEnabled = true)
|
||||
presenter.test {
|
||||
skipItems(1)
|
||||
awaitItem().let { state ->
|
||||
assertThat(state.isRoomDirectorySearchEnabled).isTrue()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal fun createStartChatPresenter(
|
||||
startDMAction: StartDMAction = FakeStartDMAction(),
|
||||
isRoomDirectorySearchEnabled: Boolean = false,
|
||||
): StartChatPresenter {
|
||||
val featureFlagService = FakeFeatureFlagService(
|
||||
initialState = mapOf(
|
||||
FeatureFlags.RoomDirectorySearch.key to isRoomDirectorySearchEnabled,
|
||||
),
|
||||
)
|
||||
return StartChatPresenter(
|
||||
presenterFactory = FakeUserListPresenterFactory(FakeUserListPresenter()),
|
||||
userRepository = FakeUserRepository(),
|
||||
userListDataStore = UserListDataStore(),
|
||||
startDMAction = startDMAction,
|
||||
featureFlagService = featureFlagService,
|
||||
buildMeta = aBuildMeta(),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,7 +123,6 @@ class StartChatViewTest {
|
|||
setStartChatView(
|
||||
aCreateRoomRootState(
|
||||
eventSink = eventsRecorder,
|
||||
isRoomDirectorySearchEnabled = true
|
||||
),
|
||||
onRoomDirectorySearchClick = it
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue