Promote "history sharing on invite" out of developer options (#6647)

* Enable history sharing by default, unconditionally

* Remove feature-flag dep from history viz icons in room header

* Remove feature-flag dep from warning on inviting new people

* Remove feature-flag dep from warning on starting chat with new people

* Remove `enableKeyShareOnInvite` feature flag

* Update screenshots

* Remove redundant `FakeFeatureFlagService()` invocation, per review comment

---------

Co-authored-by: ElementBot <android@element.io>
This commit is contained in:
Richard van der Hoff 2026-04-24 11:52:21 +01:00 committed by GitHub
parent 92ee479e91
commit 289dfff50a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
63 changed files with 106 additions and 206 deletions

View file

@ -15,8 +15,6 @@ import io.element.android.features.startchat.api.ConfirmingStartDmWithMatrixUser
import io.element.android.features.startchat.api.StartDMAction
import io.element.android.libraries.architecture.AsyncAction
import io.element.android.libraries.di.SessionScope
import io.element.android.libraries.featureflag.api.FeatureFlagService
import io.element.android.libraries.featureflag.api.FeatureFlags
import io.element.android.libraries.matrix.api.MatrixClient
import io.element.android.libraries.matrix.api.core.RoomId
import io.element.android.libraries.matrix.api.room.StartDMResult
@ -28,7 +26,6 @@ import io.element.android.services.analytics.api.AnalyticsService
class DefaultStartDMAction(
private val matrixClient: MatrixClient,
private val analyticsService: AnalyticsService,
private val featureFlagService: FeatureFlagService,
) : StartDMAction {
override suspend fun execute(
matrixUser: MatrixUser,
@ -50,7 +47,7 @@ class DefaultStartDMAction(
val identityState = matrixClient.encryptionService.getUserIdentity(matrixUser.userId, fallbackToServer = false).getOrNull()
actionState.value = ConfirmingStartDmWithMatrixUser(
matrixUser = matrixUser,
isUserIdentityUnknown = featureFlagService.isFeatureEnabled(FeatureFlags.EnableKeyShareOnInvite) && identityState == null
isUserIdentityUnknown = identityState == null
)
}
}

View file

@ -58,8 +58,6 @@ class StartChatPresenter(
featureFlagService.isFeatureEnabledFlow(FeatureFlags.RoomDirectorySearch)
}.collectAsState(initial = false)
val enableKeyShareOnInvite = featureFlagService.isFeatureEnabledFlow(FeatureFlags.EnableKeyShareOnInvite).collectAsState(false)
fun handleEvent(event: StartChatEvents) {
when (event) {
is StartChatEvents.StartDM -> localCoroutineScope.launch {
@ -78,7 +76,6 @@ class StartChatPresenter(
userListState = userListState,
startDmAction = startDmActionState.value,
isRoomDirectorySearchEnabled = isRoomDirectorySearchEnabled,
enableKeyShareOnInvite = enableKeyShareOnInvite.value,
eventSink = ::handleEvent,
)
}

View file

@ -17,6 +17,5 @@ data class StartChatState(
val userListState: UserListState,
val startDmAction: AsyncAction<RoomId>,
val isRoomDirectorySearchEnabled: Boolean,
val enableKeyShareOnInvite: Boolean,
val eventSink: (StartChatEvents) -> Unit,
)

View file

@ -82,6 +82,5 @@ fun aCreateRoomRootState(
userListState = userListState,
startDmAction = startDmAction,
isRoomDirectorySearchEnabled = isRoomDirectorySearchEnabled,
enableKeyShareOnInvite = false,
eventSink = eventSink,
)

View file

@ -130,7 +130,6 @@ fun StartChatView(
if (data is ConfirmingStartDmWithMatrixUser) {
CreateDmConfirmationBottomSheet(
matrixUser = data.matrixUser,
enableKeyShareOnInvite = state.enableKeyShareOnInvite,
isUserIdentityUnknown = data.isUserIdentityUnknown,
onSendInvite = {
state.eventSink(StartChatEvents.StartDM(data.matrixUser))

View file

@ -13,9 +13,6 @@ import com.google.common.truth.Truth.assertThat
import im.vector.app.features.analytics.plan.CreatedRoom
import io.element.android.features.startchat.api.ConfirmingStartDmWithMatrixUser
import io.element.android.libraries.architecture.AsyncAction
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.MatrixClient
import io.element.android.libraries.matrix.api.core.RoomId
import io.element.android.libraries.matrix.api.core.UserId
@ -88,7 +85,7 @@ class DefaultStartDMActionTest {
val state = mutableStateOf<AsyncAction<RoomId>>(AsyncAction.Uninitialized)
val matrixUser = aMatrixUser()
action.execute(matrixUser, false, state)
assertThat(state.value).isEqualTo(ConfirmingStartDmWithMatrixUser(matrixUser, isUserIdentityUnknown = false))
assertThat(state.value).isEqualTo(ConfirmingStartDmWithMatrixUser(matrixUser, isUserIdentityUnknown = true))
assertThat(analyticsService.capturedEvents).isEmpty()
}
@ -107,37 +104,31 @@ class DefaultStartDMActionTest {
}
@Test
fun `when history sharing enabled, user identity fetched and identity unknown`() = runTest {
fun `when user identity fetched and identity unknown`() = runTest {
val getUserIdentityResult = lambdaRecorder<UserId, Result<IdentityState?>> { _ -> Result.success(null) }
val encryptionService = FakeEncryptionService(getUserIdentityResult = getUserIdentityResult)
val matrixClient = FakeMatrixClient(encryptionService = encryptionService).apply {
givenFindDmResult(Result.success(null))
}
val featureFlagService = FakeFeatureFlagService().apply {
setFeatureEnabled(FeatureFlags.EnableKeyShareOnInvite, true)
}
val action = createStartDMAction(
matrixClient = matrixClient,
featureFlagService = featureFlagService
)
val state = mutableStateOf<AsyncAction<RoomId>>(AsyncAction.Uninitialized)
action.execute(aMatrixUser(), false, state)
assertThat(getUserIdentityResult.assertions().isCalledOnce())
getUserIdentityResult.assertions().isCalledOnce()
assertThat(state.value).isEqualTo(ConfirmingStartDmWithMatrixUser(aMatrixUser(), isUserIdentityUnknown = true))
}
private fun createStartDMAction(
matrixClient: MatrixClient = FakeMatrixClient(),
analyticsService: AnalyticsService = FakeAnalyticsService(),
featureFlagService: FeatureFlagService = FakeFeatureFlagService()
): DefaultStartDMAction {
return DefaultStartDMAction(
matrixClient = matrixClient,
analyticsService = analyticsService,
featureFlagService = featureFlagService,
)
}
}