From 21471e07fb5e3faeccc0b5683f58a7adb25e2a0d Mon Sep 17 00:00:00 2001 From: Jenna Vassar Date: Mon, 3 Aug 2026 09:07:48 -0700 Subject: [PATCH 001/145] Add persistent account provider history to app preferences --- .../api/store/AppPreferencesStore.kt | 14 ++++ .../impl/store/DefaultAppPreferencesStore.kt | 27 +++++++ .../store/DefaultAppPreferencesStoreTest.kt | 70 +++++++++++++++++++ .../test/InMemoryAppPreferencesStore.kt | 15 ++++ 4 files changed, 126 insertions(+) diff --git a/libraries/preferences/api/src/main/kotlin/io/element/android/libraries/preferences/api/store/AppPreferencesStore.kt b/libraries/preferences/api/src/main/kotlin/io/element/android/libraries/preferences/api/store/AppPreferencesStore.kt index b1877b3ae5..d4ff5b3592 100644 --- a/libraries/preferences/api/src/main/kotlin/io/element/android/libraries/preferences/api/store/AppPreferencesStore.kt +++ b/libraries/preferences/api/src/main/kotlin/io/element/android/libraries/preferences/api/store/AppPreferencesStore.kt @@ -38,6 +38,20 @@ interface AppPreferencesStore { suspend fun setTracingLogLevel(logLevel: LogLevel) fun getTracingLogLevelFlow(): Flow + /** + * The list of account providers (homeserver URLs) the user has previously authenticated + * against, most recent first. Used to default the account provider and to power autocomplete + * suggestions during sign-in. Stored locally only; never synced across devices. + */ + fun getHomeserverHistoryFlow(): Flow> + + /** + * Add [url] to the front of the account provider history (see [getHomeserverHistoryFlow]). + * The value is normalised (trimmed + lowercased); existing case-insensitive duplicates are + * moved to the front rather than duplicated, and the list is capped in size. No-op for blanks. + */ + suspend fun addHomeserverToHistory(url: String) + suspend fun setTracingLogPacks(targets: Set) fun getTracingLogPacksFlow(): Flow> diff --git a/libraries/preferences/impl/src/main/kotlin/io/element/android/libraries/preferences/impl/store/DefaultAppPreferencesStore.kt b/libraries/preferences/impl/src/main/kotlin/io/element/android/libraries/preferences/impl/store/DefaultAppPreferencesStore.kt index af35ac3c44..f8db0c11ee 100644 --- a/libraries/preferences/impl/src/main/kotlin/io/element/android/libraries/preferences/impl/store/DefaultAppPreferencesStore.kt +++ b/libraries/preferences/impl/src/main/kotlin/io/element/android/libraries/preferences/impl/store/DefaultAppPreferencesStore.kt @@ -8,6 +8,7 @@ package io.element.android.libraries.preferences.impl.store +import androidx.datastore.preferences.core.Preferences import androidx.datastore.preferences.core.booleanPreferencesKey import androidx.datastore.preferences.core.edit import androidx.datastore.preferences.core.intPreferencesKey @@ -36,6 +37,7 @@ private val timelineMediaPreviewValueKey = stringPreferencesKey("timelineMediaPr private val liveLocationMinimumDistanceUpdateKey = intPreferencesKey("liveLocationMinimumDistanceUpdate") private val logLevelKey = stringPreferencesKey("logLevel") private val traceLogPacksKey = stringPreferencesKey("traceLogPacks") +private val homeserverHistoryKey = stringPreferencesKey("homeserverHistory") private val messageSoundUriKey = stringPreferencesKey("notificationMessageSoundUri") private val messageSoundChannelVersionKey = intPreferencesKey("notificationMessageSoundChannelVersion") private val messageSoundDisplayNameKey = stringPreferencesKey("notificationMessageSoundDisplayName") @@ -43,6 +45,10 @@ private val callRingtoneUriKey = stringPreferencesKey("notificationCallRingtoneU private val callRingtoneChannelVersionKey = intPreferencesKey("notificationCallRingtoneChannelVersion") private val callRingtoneDisplayNameKey = stringPreferencesKey("notificationCallRingtoneDisplayName") +// URLs never contain a newline, so it is a safe delimiter to persist an ordered list in a single String. +private const val HOMESERVER_HISTORY_DELIMITER = "\n" +private const val MAX_HOMESERVER_HISTORY_SIZE = 10 + @ContributesBinding(AppScope::class) class DefaultAppPreferencesStore( private val buildMeta: BuildMeta, @@ -168,6 +174,20 @@ class DefaultAppPreferencesStore( } } + override fun getHomeserverHistoryFlow(): Flow> { + return store.data.map { prefs -> prefs.readHomeserverHistory() } + } + + override suspend fun addHomeserverToHistory(url: String) { + val normalized = url.trim().lowercase() + if (normalized.isEmpty()) return + store.edit { prefs -> + val updated = (listOf(normalized) + prefs.readHomeserverHistory().filter { it != normalized }) + .take(MAX_HOMESERVER_HISTORY_SIZE) + prefs[homeserverHistoryKey] = updated.joinToString(HOMESERVER_HISTORY_DELIMITER) + } + } + override fun getMessageSoundFlow(): Flow { return store.data.map { prefs -> NotificationSound.fromStored(prefs[messageSoundUriKey]) } } @@ -242,6 +262,13 @@ class DefaultAppPreferencesStore( } } +private fun Preferences.readHomeserverHistory(): List { + return this[homeserverHistoryKey] + ?.split(HOMESERVER_HISTORY_DELIMITER) + ?.filter { it.isNotEmpty() } + ?: emptyList() +} + private fun BuildMeta.defaultLogLevel(): LogLevel { return when (buildType) { BuildType.DEBUG -> LogLevel.TRACE diff --git a/libraries/preferences/impl/src/test/kotlin/io/element/android/libraries/preferences/impl/store/DefaultAppPreferencesStoreTest.kt b/libraries/preferences/impl/src/test/kotlin/io/element/android/libraries/preferences/impl/store/DefaultAppPreferencesStoreTest.kt index c52d1648ac..fbb9005ea5 100644 --- a/libraries/preferences/impl/src/test/kotlin/io/element/android/libraries/preferences/impl/store/DefaultAppPreferencesStoreTest.kt +++ b/libraries/preferences/impl/src/test/kotlin/io/element/android/libraries/preferences/impl/store/DefaultAppPreferencesStoreTest.kt @@ -54,4 +54,74 @@ class DefaultAppPreferencesStoreTest { assertThat(store.getLiveLocationMinimumDistanceInMetersUpdateFlow().first()).isEqualTo(25) } + + @Test + fun `homeserver history is empty by default`() = runTest { + val store = createStore() + assertThat(store.getHomeserverHistoryFlow().first()).isEmpty() + } + + @Test + fun `adding homeservers keeps the most recent first`() = runTest { + val store = createStore() + + store.addHomeserverToHistory("https://matrix.org") + store.addHomeserverToHistory("https://example.com") + + assertThat(store.getHomeserverHistoryFlow().first()) + .containsExactly("https://example.com", "https://matrix.org") + .inOrder() + } + + @Test + fun `adding an existing homeserver moves it to the front without duplicating`() = runTest { + val store = createStore() + + store.addHomeserverToHistory("https://matrix.org") + store.addHomeserverToHistory("https://example.com") + store.addHomeserverToHistory("https://matrix.org") + + assertThat(store.getHomeserverHistoryFlow().first()) + .containsExactly("https://matrix.org", "https://example.com") + .inOrder() + } + + @Test + fun `homeservers are normalised and deduplicated case-insensitively`() = runTest { + val store = createStore() + + store.addHomeserverToHistory(" HTTPS://Matrix.ORG ") + store.addHomeserverToHistory("https://matrix.org") + + assertThat(store.getHomeserverHistoryFlow().first()) + .containsExactly("https://matrix.org") + } + + @Test + fun `blank homeservers are ignored`() = runTest { + val store = createStore() + + store.addHomeserverToHistory(" ") + + assertThat(store.getHomeserverHistoryFlow().first()).isEmpty() + } + + @Test + fun `homeserver history is capped to the most recent entries`() = runTest { + val store = createStore() + + repeat(15) { index -> + store.addHomeserverToHistory("https://server$index.org") + } + + val history = store.getHomeserverHistoryFlow().first() + assertThat(history).hasSize(10) + assertThat(history.first()).isEqualTo("https://server14.org") + assertThat(history.last()).isEqualTo("https://server5.org") + } + + private fun createStore() = DefaultAppPreferencesStore( + buildMeta = buildMeta, + preferenceDataStoreFactory = FakePreferenceDataStoreFactory(), + ) } diff --git a/libraries/preferences/test/src/main/kotlin/io/element/android/libraries/preferences/test/InMemoryAppPreferencesStore.kt b/libraries/preferences/test/src/main/kotlin/io/element/android/libraries/preferences/test/InMemoryAppPreferencesStore.kt index 6499e70223..e8d0b0bb8e 100644 --- a/libraries/preferences/test/src/main/kotlin/io/element/android/libraries/preferences/test/InMemoryAppPreferencesStore.kt +++ b/libraries/preferences/test/src/main/kotlin/io/element/android/libraries/preferences/test/InMemoryAppPreferencesStore.kt @@ -16,6 +16,7 @@ import io.element.android.libraries.preferences.api.store.NotificationSound import io.element.android.libraries.preferences.api.store.NotificationSoundChannelConfig import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.update import kotlinx.coroutines.flow.updateAndGet class InMemoryAppPreferencesStore( @@ -27,6 +28,7 @@ class InMemoryAppPreferencesStore( liveLocationMinimumDistanceUpdate: Int = 10, logLevel: LogLevel = LogLevel.INFO, traceLogPacks: Set = emptySet(), + homeserverHistory: List = emptyList(), messageSound: NotificationSound = NotificationSound.SystemDefault, messageSoundChannelVersion: Int = 0, messageSoundDisplayName: String? = null, @@ -40,6 +42,7 @@ class InMemoryAppPreferencesStore( private val liveLocationMinimumDistanceUpdate = MutableStateFlow(liveLocationMinimumDistanceUpdate) private val logLevel = MutableStateFlow(logLevel) private val tracingLogPacks = MutableStateFlow(traceLogPacks) + private val homeserverHistory = MutableStateFlow(homeserverHistory) private val hideInviteAvatars = MutableStateFlow(hideInviteAvatars) private val timelineMediaPreviewValue = MutableStateFlow(timelineMediaPreviewValue) private val messageSound = MutableStateFlow(messageSound) @@ -117,6 +120,18 @@ class InMemoryAppPreferencesStore( return tracingLogPacks } + override fun getHomeserverHistoryFlow(): Flow> { + return homeserverHistory + } + + override suspend fun addHomeserverToHistory(url: String) { + val normalized = url.trim().lowercase() + if (normalized.isEmpty()) return + homeserverHistory.update { current -> + (listOf(normalized) + current.filter { it != normalized }).take(10) + } + } + override fun getMessageSoundFlow(): Flow { return messageSound } From 4714127cc053e06791c86775734f70ab847ff0ac Mon Sep 17 00:00:00 2001 From: Jenna Vassar Date: Mon, 3 Aug 2026 10:54:45 -0700 Subject: [PATCH 002/145] Default the account provider to the most recently used one --- features/login/impl/build.gradle.kts | 2 + .../AccountProviderDataSource.kt | 39 ++++++++++-- .../login/impl/DefaultLoginEntryPointTest.kt | 5 +- .../AccountProviderDataSourceFixture.kt | 25 ++++++++ .../AccountProviderDataSourceTest.kt | 62 ++++++++++++++++--- .../changeserver/ChangeServerPresenterTest.kt | 3 +- .../LoginWithClassicPresenterTest.kt | 4 +- .../ConfirmAccountProviderPresenterTest.kt | 4 +- .../createaccount/DefaultMessageParserTest.kt | 5 +- .../LoginPasswordPresenterTest.kt | 4 +- .../onboarding/OnBoardingPresenterTest.kt | 5 +- 11 files changed, 130 insertions(+), 28 deletions(-) create mode 100644 features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderDataSourceFixture.kt diff --git a/features/login/impl/build.gradle.kts b/features/login/impl/build.gradle.kts index 86a8e0e7bc..6cf8945e05 100644 --- a/features/login/impl/build.gradle.kts +++ b/features/login/impl/build.gradle.kts @@ -69,6 +69,7 @@ dependencies { implementation(projects.libraries.sessionStorage.api) implementation(projects.libraries.qrcode) implementation(projects.libraries.oauth.api) + implementation(projects.libraries.preferences.api) implementation(projects.libraries.uiUtils) implementation(projects.libraries.wellknown.api) implementation(libs.androidx.browser) @@ -80,6 +81,7 @@ dependencies { testImplementation(projects.features.login.test) testImplementation(projects.features.enterprise.test) testImplementation(projects.features.preferences.test) + testImplementation(projects.libraries.preferences.test) testImplementation(projects.libraries.matrix.test) testImplementation(projects.libraries.oauth.test) testImplementation(projects.libraries.permissions.test) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderDataSource.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderDataSource.kt index 931959d4ea..28e4294fa4 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderDataSource.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderDataSource.kt @@ -13,27 +13,58 @@ import dev.zacsweers.metro.Inject import dev.zacsweers.metro.SingleIn import io.element.android.appconfig.AuthenticationConfig import io.element.android.features.enterprise.api.EnterpriseService +import io.element.android.features.enterprise.api.canConnectToAnyHomeserver +import io.element.android.libraries.di.annotations.AppCoroutineScope +import io.element.android.libraries.preferences.api.store.AppPreferencesStore +import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.first +import kotlinx.coroutines.flow.update +import kotlinx.coroutines.launch @SingleIn(AppScope::class) @Inject class AccountProviderDataSource( - enterpriseService: EnterpriseService, + private val enterpriseService: EnterpriseService, + private val appPreferencesStore: AppPreferencesStore, + @AppCoroutineScope private val coroutineScope: CoroutineScope, ) { - private val defaultAccountProvider = createAccountProvider( + // The provider used when the user has not selected one: an enterprise/MDM-configured provider, + // else matrix.org. The most recently used provider (from history) can override it, see init. + private val configuredAccountProvider = createAccountProvider( url = enterpriseService.defaultHomeserverList() .firstOrNull { it != EnterpriseService.ANY_ACCOUNT_PROVIDER } ?: AuthenticationConfig.MATRIX_ORG_URL ) - private val accountProvider: MutableStateFlow = MutableStateFlow(defaultAccountProvider) + private val accountProvider: MutableStateFlow = MutableStateFlow(configuredAccountProvider) val flow: StateFlow = accountProvider.asStateFlow() + init { + // Seed the default from the last used provider, unless the user has already selected one. + coroutineScope.launch { + val default = defaultAccountProvider() + accountProvider.update { current -> if (current == configuredAccountProvider) default else current } + } + } + suspend fun reset() { - accountProvider.emit(defaultAccountProvider) + accountProvider.emit(defaultAccountProvider()) + } + + /** + * The provider to default to: the most recently used one from history when the user is free to + * connect to any provider, otherwise the enterprise/MDM-configured provider. + */ + private suspend fun defaultAccountProvider(): AccountProvider { + if (!enterpriseService.canConnectToAnyHomeserver()) { + return configuredAccountProvider + } + val lastUsedProvider = appPreferencesStore.getHomeserverHistoryFlow().first().firstOrNull() + return lastUsedProvider?.let { createAccountProvider(it) } ?: configuredAccountProvider } suspend fun setUrl(url: String) { diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/DefaultLoginEntryPointTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/DefaultLoginEntryPointTest.kt index a05194d008..4e040a7556 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/DefaultLoginEntryPointTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/DefaultLoginEntryPointTest.kt @@ -12,9 +12,8 @@ import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.bumble.appyx.core.modality.BuildContext import com.bumble.appyx.testing.junit4.util.MainDispatcherRule import com.google.common.truth.Truth.assertThat -import io.element.android.features.enterprise.test.FakeEnterpriseService import io.element.android.features.login.api.LoginEntryPoint -import io.element.android.features.login.impl.accountprovider.AccountProviderDataSource +import io.element.android.features.login.impl.accountprovider.anAccountProviderDataSource import io.element.android.features.login.impl.classic.FakeElementClassicConnection import io.element.android.features.preferences.test.FakePreferencesEntryPoint import io.element.android.libraries.oauth.test.customtab.FakeOAuthActionFlow @@ -38,7 +37,7 @@ class DefaultLoginEntryPointTest { LoginFlowNode( buildContext = buildContext, plugins = plugins, - accountProviderDataSource = AccountProviderDataSource(FakeEnterpriseService()), + accountProviderDataSource = anAccountProviderDataSource(), oAuthActionFlow = FakeOAuthActionFlow(), appCoroutineScope = backgroundScope, elementClassicConnection = FakeElementClassicConnection(), diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderDataSourceFixture.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderDataSourceFixture.kt new file mode 100644 index 0000000000..e8f9dbefb9 --- /dev/null +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderDataSourceFixture.kt @@ -0,0 +1,25 @@ +/* + * Copyright 2025 New Vector Ltd. + * + * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. + * Please see LICENSE files in the repository root for full details. + */ + +package io.element.android.features.login.impl.accountprovider + +import io.element.android.features.enterprise.api.EnterpriseService +import io.element.android.features.enterprise.test.FakeEnterpriseService +import io.element.android.libraries.preferences.api.store.AppPreferencesStore +import io.element.android.libraries.preferences.test.InMemoryAppPreferencesStore +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers + +fun anAccountProviderDataSource( + enterpriseService: EnterpriseService = FakeEnterpriseService(), + appPreferencesStore: AppPreferencesStore = InMemoryAppPreferencesStore(), + coroutineScope: CoroutineScope = CoroutineScope(Dispatchers.Unconfined), +) = AccountProviderDataSource( + enterpriseService = enterpriseService, + appPreferencesStore = appPreferencesStore, + coroutineScope = coroutineScope, +) diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderDataSourceTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderDataSourceTest.kt index f86df13335..30e25c8c3e 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderDataSourceTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderDataSourceTest.kt @@ -13,6 +13,7 @@ import com.google.common.truth.Truth.assertThat import io.element.android.appconfig.AuthenticationConfig import io.element.android.features.enterprise.api.EnterpriseService import io.element.android.features.enterprise.test.FakeEnterpriseService +import io.element.android.libraries.preferences.test.InMemoryAppPreferencesStore import io.element.android.tests.testutils.WarmUpRule import kotlinx.coroutines.test.runTest import org.junit.Rule @@ -24,7 +25,7 @@ class AccountProviderDataSourceTest { @Test fun `present - initial state`() = runTest { - val sut = AccountProviderDataSource(FakeEnterpriseService()) + val sut = anAccountProviderDataSource() sut.flow.test { val initialState = awaitItem() assertThat(initialState).isEqualTo( @@ -41,10 +42,10 @@ class AccountProviderDataSourceTest { @Test fun `present - initial state - matrix org`() = runTest { - val sut = AccountProviderDataSource( - FakeEnterpriseService( + val sut = anAccountProviderDataSource( + enterpriseService = FakeEnterpriseService( defaultHomeserverListResult = { listOf(AuthenticationConfig.MATRIX_ORG_URL) } - ) + ), ) sut.flow.test { val initialState = awaitItem() @@ -62,10 +63,10 @@ class AccountProviderDataSourceTest { @Test fun `present - ensure that default homeserver is not star char`() = runTest { - val sut = AccountProviderDataSource( - FakeEnterpriseService( + val sut = anAccountProviderDataSource( + enterpriseService = FakeEnterpriseService( defaultHomeserverListResult = { listOf(EnterpriseService.ANY_ACCOUNT_PROVIDER, AuthenticationConfig.MATRIX_ORG_URL) } - ) + ), ) sut.flow.test { val initialState = awaitItem() @@ -83,7 +84,7 @@ class AccountProviderDataSourceTest { @Test fun `present - user change and reset`() = runTest { - val sut = AccountProviderDataSource(FakeEnterpriseService()) + val sut = anAccountProviderDataSource() sut.flow.test { val initialState = awaitItem() assertThat(initialState.url).isEqualTo(AuthenticationConfig.MATRIX_ORG_URL) @@ -106,7 +107,7 @@ class AccountProviderDataSourceTest { @Test fun `present - set url and reset`() = runTest { - val sut = AccountProviderDataSource(FakeEnterpriseService()) + val sut = anAccountProviderDataSource() sut.flow.test { val initialState = awaitItem() assertThat(initialState.url).isEqualTo(AuthenticationConfig.MATRIX_ORG_URL) @@ -126,4 +127,47 @@ class AccountProviderDataSourceTest { assertThat(resetState.url).isEqualTo(AuthenticationConfig.MATRIX_ORG_URL) } } + + @Test + fun `present - defaults to the most recently used provider from history`() = runTest { + val sut = anAccountProviderDataSource( + appPreferencesStore = InMemoryAppPreferencesStore( + homeserverHistory = listOf("https://example.com", "https://matrix.org"), + ), + ) + sut.flow.test { + assertThat(awaitItem().url).isEqualTo("https://example.com") + } + } + + @Test + fun `present - history is ignored when the account provider is enforced`() = runTest { + val sut = anAccountProviderDataSource( + enterpriseService = FakeEnterpriseService( + defaultHomeserverListResult = { listOf("https://enforced.org") } + ), + appPreferencesStore = InMemoryAppPreferencesStore( + homeserverHistory = listOf("https://example.com"), + ), + ) + sut.flow.test { + assertThat(awaitItem().url).isEqualTo("https://enforced.org") + } + } + + @Test + fun `present - reset returns to the most recently used provider from history`() = runTest { + val sut = anAccountProviderDataSource( + appPreferencesStore = InMemoryAppPreferencesStore( + homeserverHistory = listOf("https://example.com"), + ), + ) + sut.flow.test { + assertThat(awaitItem().url).isEqualTo("https://example.com") + sut.setUrl("https://other.com") + assertThat(awaitItem().url).isEqualTo("https://other.com") + sut.reset() + assertThat(awaitItem().url).isEqualTo("https://example.com") + } + } } diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenterTest.kt index 5d9040adac..868f56f8a7 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenterTest.kt @@ -14,6 +14,7 @@ import io.element.android.features.enterprise.test.FakeEnterpriseService import io.element.android.features.login.impl.accesscontrol.DefaultAccountProviderAccessControl import io.element.android.features.login.impl.accountprovider.AccountProvider import io.element.android.features.login.impl.accountprovider.AccountProviderDataSource +import io.element.android.features.login.impl.accountprovider.anAccountProviderDataSource import io.element.android.features.login.impl.error.ChangeServerError import io.element.android.features.login.impl.localnetwork.LocalNetworkPermissionGate import io.element.android.features.wellknown.test.FakeWellknownRetriever @@ -259,7 +260,7 @@ class ChangeServerPresenterTest { private fun createPresenter( authenticationService: FakeMatrixAuthenticationService = FakeMatrixAuthenticationService(), - accountProviderDataSource: AccountProviderDataSource = AccountProviderDataSource(FakeEnterpriseService()), + accountProviderDataSource: AccountProviderDataSource = anAccountProviderDataSource(), enterpriseService: EnterpriseService = FakeEnterpriseService(), wellknownRetriever: WellknownRetriever = FakeWellknownRetriever(), localNetworkPermissionAdvisor: FakeLocalNetworkPermissionAdvisor = FakeLocalNetworkPermissionAdvisor(), diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/classic/loginwithclassic/LoginWithClassicPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/classic/loginwithclassic/LoginWithClassicPresenterTest.kt index 8d56386fa4..d4a1a74d99 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/classic/loginwithclassic/LoginWithClassicPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/classic/loginwithclassic/LoginWithClassicPresenterTest.kt @@ -8,8 +8,8 @@ package io.element.android.features.login.impl.screens.classic.loginwithclassic import com.google.common.truth.Truth.assertThat -import io.element.android.features.enterprise.test.FakeEnterpriseService import io.element.android.features.login.impl.accountprovider.AccountProviderDataSource +import io.element.android.features.login.impl.accountprovider.anAccountProviderDataSource import io.element.android.features.login.impl.classic.ElementClassicConnection import io.element.android.features.login.impl.classic.ElementClassicConnectionState import io.element.android.features.login.impl.classic.FakeElementClassicConnection @@ -249,7 +249,7 @@ private fun createPresenter( navigator: LoginWithClassicNavigator = FakeLoginWithClassicNavigator(), loginModePresenter: LoginModePresenter = createLoginModePresenter(), elementClassicConnection: ElementClassicConnection = FakeElementClassicConnection(), - accountProviderDataSource: AccountProviderDataSource = AccountProviderDataSource(FakeEnterpriseService()), + accountProviderDataSource: AccountProviderDataSource = anAccountProviderDataSource(), isEnterpriseBuild: Boolean = false, ) = LoginWithClassicPresenter( userId = userId, diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt index c20896870b..ce8e60c73f 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt @@ -10,8 +10,8 @@ package io.element.android.features.login.impl.screens.confirmaccountprovider import com.google.common.truth.Truth.assertThat import io.element.android.appconfig.AuthenticationConfig -import io.element.android.features.enterprise.test.FakeEnterpriseService import io.element.android.features.login.impl.accountprovider.AccountProviderDataSource +import io.element.android.features.login.impl.accountprovider.anAccountProviderDataSource import io.element.android.features.login.impl.login.LoginMode import io.element.android.features.login.impl.screens.createaccount.AccountCreationNotSupported import io.element.android.features.login.impl.screens.onboarding.createLoginModePresenter @@ -378,7 +378,7 @@ class ConfirmAccountProviderPresenterTest { private fun createConfirmAccountProviderPresenter( params: ConfirmAccountProviderPresenter.Params = ConfirmAccountProviderPresenter.Params(isAccountCreation = false), - accountProviderDataSource: AccountProviderDataSource = AccountProviderDataSource(FakeEnterpriseService()), + accountProviderDataSource: AccountProviderDataSource = anAccountProviderDataSource(), matrixAuthenticationService: MatrixAuthenticationService = FakeMatrixAuthenticationService(), defaultOAuthActionFlow: OAuthActionFlow = FakeOAuthActionFlow(), webClientUrlForAuthenticationRetriever: WebClientUrlForAuthenticationRetriever = FakeWebClientUrlForAuthenticationRetriever(), diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/createaccount/DefaultMessageParserTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/createaccount/DefaultMessageParserTest.kt index 680fda2838..e3fea27557 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/createaccount/DefaultMessageParserTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/createaccount/DefaultMessageParserTest.kt @@ -10,8 +10,7 @@ package io.element.android.features.login.impl.screens.createaccount import com.google.common.truth.Truth.assertThat import io.element.android.appconfig.AuthenticationConfig -import io.element.android.features.enterprise.test.FakeEnterpriseService -import io.element.android.features.login.impl.accountprovider.AccountProviderDataSource +import io.element.android.features.login.impl.accountprovider.anAccountProviderDataSource import io.element.android.libraries.androidutils.json.DefaultJsonProvider import io.element.android.libraries.matrix.api.auth.external.ExternalSession import kotlinx.serialization.SerializationException @@ -70,7 +69,7 @@ class DefaultMessageParserTest { private fun createDefaultMessageParser(): DefaultMessageParser { return DefaultMessageParser( - accountProviderDataSource = AccountProviderDataSource(FakeEnterpriseService()), + accountProviderDataSource = anAccountProviderDataSource(), json = DefaultJsonProvider(), ) } diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordPresenterTest.kt index 31a835cb8c..4133403c51 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordPresenterTest.kt @@ -10,8 +10,8 @@ package io.element.android.features.login.impl.screens.loginpassword import com.google.common.truth.Truth.assertThat import io.element.android.appconfig.AuthenticationConfig -import io.element.android.features.enterprise.test.FakeEnterpriseService import io.element.android.features.login.impl.accountprovider.AccountProviderDataSource +import io.element.android.features.login.impl.accountprovider.anAccountProviderDataSource import io.element.android.libraries.architecture.AsyncData import io.element.android.libraries.matrix.api.core.SessionId import io.element.android.libraries.matrix.test.AN_EXCEPTION @@ -157,7 +157,7 @@ class LoginPasswordPresenterTest { private fun createLoginPasswordPresenter( initialLogin: String = "", authenticationService: FakeMatrixAuthenticationService = FakeMatrixAuthenticationService(), - accountProviderDataSource: AccountProviderDataSource = AccountProviderDataSource(FakeEnterpriseService()), + accountProviderDataSource: AccountProviderDataSource = anAccountProviderDataSource(), ): LoginPasswordPresenter = LoginPasswordPresenter( initialLogin = initialLogin, authenticationService = authenticationService, diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingPresenterTest.kt index 79268aa1e4..b14e288d7e 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingPresenterTest.kt @@ -15,6 +15,7 @@ import io.element.android.features.enterprise.api.EnterpriseService import io.element.android.features.enterprise.test.FakeEnterpriseService import io.element.android.features.login.impl.accesscontrol.DefaultAccountProviderAccessControl import io.element.android.features.login.impl.accountprovider.AccountProviderDataSource +import io.element.android.features.login.impl.accountprovider.anAccountProviderDataSource import io.element.android.features.login.impl.localnetwork.LocalNetworkPermissionGate import io.element.android.features.login.impl.login.LoginModePresenter import io.element.android.features.login.impl.web.FakeWebClientUrlForAuthenticationRetriever @@ -247,7 +248,7 @@ class OnBoardingPresenterTest { Result.failure(AN_EXCEPTION) }, ) - val accountProviderDataSource = AccountProviderDataSource(FakeEnterpriseService()) + val accountProviderDataSource = anAccountProviderDataSource() val presenter = createPresenter( params = OnBoardingNode.Params( accountProvider = A_HOMESERVER_URL, @@ -297,7 +298,7 @@ private fun createPresenter( loginModePresenter: LoginModePresenter = createLoginModePresenter(), onBoardingLogoResIdProvider: OnBoardingLogoResIdProvider = OnBoardingLogoResIdProvider { null }, sessionStore: SessionStore = InMemorySessionStore(), - accountProviderDataSource: AccountProviderDataSource = AccountProviderDataSource(FakeEnterpriseService()), + accountProviderDataSource: AccountProviderDataSource = anAccountProviderDataSource(), ) = OnBoardingPresenter( params = params, buildMeta = buildMeta, From 3c09fb37b92a254a81286fab01a81dac21a9c7ab Mon Sep 17 00:00:00 2001 From: Jenna Vassar Date: Mon, 3 Aug 2026 11:18:05 -0700 Subject: [PATCH 003/145] Save the account provider to history on successful sign-in --- .../SaveAccountProviderToHistory.kt | 28 +++++++++++++++ .../login/impl/login/LoginModePresenter.kt | 3 ++ .../createaccount/CreateAccountPresenter.kt | 3 ++ .../loginpassword/LoginPasswordPresenter.kt | 3 ++ .../SaveAccountProviderToHistoryTest.kt | 34 +++++++++++++++++++ .../CreateAccountPresenterTest.kt | 30 ++++++++++++++++ .../LoginPasswordPresenterTest.kt | 32 +++++++++++++++++ .../onboarding/OnBoardingPresenterTest.kt | 5 +++ 8 files changed, 138 insertions(+) create mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/SaveAccountProviderToHistory.kt create mode 100644 features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accountprovider/SaveAccountProviderToHistoryTest.kt diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/SaveAccountProviderToHistory.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/SaveAccountProviderToHistory.kt new file mode 100644 index 0000000000..a88be1ae15 --- /dev/null +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/SaveAccountProviderToHistory.kt @@ -0,0 +1,28 @@ +/* + * Copyright 2025 New Vector Ltd. + * + * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. + * Please see LICENSE files in the repository root for full details. + */ + +package io.element.android.features.login.impl.accountprovider + +import dev.zacsweers.metro.Inject +import io.element.android.libraries.preferences.api.store.AppPreferencesStore + +/** + * Persist the account provider the user just authenticated against, so that it can be offered as + * the default (see [AccountProviderDataSource]) and as an autocomplete suggestion on the next + * sign-in. To be called from the manual sign-in / account creation flows only, on success. + * + * See [AppPreferencesStore.addHomeserverToHistory]. + */ +@Inject +class SaveAccountProviderToHistory( + private val accountProviderDataSource: AccountProviderDataSource, + private val appPreferencesStore: AppPreferencesStore, +) { + suspend operator fun invoke() { + appPreferencesStore.addHomeserverToHistory(accountProviderDataSource.flow.value.url) + } +} diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/login/LoginModePresenter.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/login/LoginModePresenter.kt index 34188095b0..1bb85fb6c9 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/login/LoginModePresenter.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/login/LoginModePresenter.kt @@ -13,6 +13,7 @@ import androidx.compose.runtime.MutableState import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import dev.zacsweers.metro.Inject +import io.element.android.features.login.impl.accountprovider.SaveAccountProviderToHistory import io.element.android.features.login.impl.error.ChangeServerError import io.element.android.features.login.impl.localnetwork.LocalNetworkPermissionGate import io.element.android.features.login.impl.screens.chooseaccountprovider.ChooseAccountProviderPresenter @@ -41,6 +42,7 @@ class LoginModePresenter( private val authenticationService: MatrixAuthenticationService, private val webClientUrlForAuthenticationRetriever: WebClientUrlForAuthenticationRetriever, private val localNetworkPermissionGate: LocalNetworkPermissionGate, + private val saveAccountProviderToHistory: SaveAccountProviderToHistory, ) : Presenter { @Composable override fun present(): LoginModeState { @@ -120,6 +122,7 @@ class LoginModePresenter( .onSuccess { loginMode.value = AsyncData.Uninitialized } .onFailure { loginMode.value = AsyncData.Failure(it) } is OAuthAction.Success -> authenticationService.loginWithOAuth(action.url) + .onSuccess { saveAccountProviderToHistory() } .onFailure { loginMode.value = AsyncData.Failure(it) } } oAuthActionFlow.reset() diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountPresenter.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountPresenter.kt index bf7af111f4..d750586e94 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountPresenter.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountPresenter.kt @@ -17,6 +17,7 @@ import androidx.compose.runtime.rememberCoroutineScope import dev.zacsweers.metro.Assisted import dev.zacsweers.metro.AssistedFactory import dev.zacsweers.metro.AssistedInject +import io.element.android.features.login.impl.accountprovider.SaveAccountProviderToHistory import io.element.android.libraries.architecture.AsyncAction import io.element.android.libraries.architecture.Presenter import io.element.android.libraries.core.extensions.flatMap @@ -33,6 +34,7 @@ class CreateAccountPresenter( private val authenticationService: MatrixAuthenticationService, private val messageParser: MessageParser, private val buildMeta: BuildMeta, + private val saveAccountProviderToHistory: SaveAccountProviderToHistory, ) : Presenter { @AssistedFactory interface Factory { @@ -74,6 +76,7 @@ class CreateAccountPresenter( }.flatMap { externalSession -> authenticationService.importCreatedSession(externalSession) }.onSuccess { sessionId -> + saveAccountProviderToHistory() loggedInState.value = AsyncAction.Success(sessionId) }.onFailure { failure -> loggedInState.value = AsyncAction.Failure(failure) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordPresenter.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordPresenter.kt index f26f342a42..6e28bd8781 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordPresenter.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordPresenter.kt @@ -20,6 +20,7 @@ import dev.zacsweers.metro.Assisted import dev.zacsweers.metro.AssistedFactory import dev.zacsweers.metro.AssistedInject import io.element.android.features.login.impl.accountprovider.AccountProviderDataSource +import io.element.android.features.login.impl.accountprovider.SaveAccountProviderToHistory import io.element.android.libraries.architecture.AsyncData import io.element.android.libraries.architecture.Presenter import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService @@ -33,6 +34,7 @@ class LoginPasswordPresenter( private val initialLogin: String, private val authenticationService: MatrixAuthenticationService, private val accountProviderDataSource: AccountProviderDataSource, + private val saveAccountProviderToHistory: SaveAccountProviderToHistory, ) : Presenter { @AssistedFactory interface Factory { @@ -83,6 +85,7 @@ class LoginPasswordPresenter( loggedInState.value = AsyncData.Loading() authenticationService.login(formState.login.trim(), formState.password) .onSuccess { sessionId -> + saveAccountProviderToHistory() loggedInState.value = AsyncData.Success(sessionId) } .onFailure { failure -> diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accountprovider/SaveAccountProviderToHistoryTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accountprovider/SaveAccountProviderToHistoryTest.kt new file mode 100644 index 0000000000..957235395f --- /dev/null +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accountprovider/SaveAccountProviderToHistoryTest.kt @@ -0,0 +1,34 @@ +/* + * Copyright 2025 New Vector Ltd. + * + * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. + * Please see LICENSE files in the repository root for full details. + */ + +package io.element.android.features.login.impl.accountprovider + +import com.google.common.truth.Truth.assertThat +import io.element.android.libraries.preferences.test.InMemoryAppPreferencesStore +import io.element.android.tests.testutils.WarmUpRule +import kotlinx.coroutines.flow.first +import kotlinx.coroutines.test.runTest +import org.junit.Rule +import org.junit.Test + +class SaveAccountProviderToHistoryTest { + @get:Rule + val warmUpRule = WarmUpRule() + + @Test + fun `invoke saves the current account provider url to history`() = runTest { + val appPreferencesStore = InMemoryAppPreferencesStore() + val accountProviderDataSource = anAccountProviderDataSource() + accountProviderDataSource.setUrl("https://example.com") + val sut = SaveAccountProviderToHistory(accountProviderDataSource, appPreferencesStore) + + sut() + + assertThat(appPreferencesStore.getHomeserverHistoryFlow().first()) + .containsExactly("https://example.com") + } +} diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountPresenterTest.kt index c70a5c9a9a..d2c9cf32b2 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountPresenterTest.kt @@ -9,6 +9,10 @@ package io.element.android.features.login.impl.screens.createaccount import com.google.common.truth.Truth.assertThat +import io.element.android.appconfig.AuthenticationConfig +import io.element.android.features.login.impl.accountprovider.AccountProviderDataSource +import io.element.android.features.login.impl.accountprovider.SaveAccountProviderToHistory +import io.element.android.features.login.impl.accountprovider.anAccountProviderDataSource import io.element.android.libraries.architecture.AsyncAction import io.element.android.libraries.core.meta.BuildMeta import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService @@ -19,10 +23,13 @@ import io.element.android.libraries.matrix.test.A_SESSION_ID import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService import io.element.android.libraries.matrix.test.core.aBuildMeta import io.element.android.libraries.matrix.test.verification.FakeSessionVerificationService +import io.element.android.libraries.preferences.api.store.AppPreferencesStore +import io.element.android.libraries.preferences.test.InMemoryAppPreferencesStore import io.element.android.tests.testutils.WarmUpRule import io.element.android.tests.testutils.lambda.lambdaRecorder import io.element.android.tests.testutils.lambda.value import io.element.android.tests.testutils.test +import kotlinx.coroutines.flow.first import kotlinx.coroutines.test.runTest import org.junit.Rule import org.junit.Test @@ -94,6 +101,26 @@ class CreateAccountPresenterTest { lambda.assertions().isCalledOnce().with(value("aMessage")) } + @Test + fun `present - successful account creation saves the account provider to history`() = runTest { + val appPreferencesStore = InMemoryAppPreferencesStore() + val presenter = createPresenter( + authenticationService = FakeMatrixAuthenticationService( + importCreatedSessionLambda = { Result.success(A_SESSION_ID) } + ), + messageParser = FakeMessageParser { anExternalSession() }, + appPreferencesStore = appPreferencesStore, + ) + presenter.test { + val initialState = awaitItem() + initialState.eventSink(CreateAccountEvents.OnMessageReceived("aMessage")) + assertThat(awaitItem().createAction.isLoading()).isTrue() + assertThat(awaitItem().createAction.dataOrNull()).isEqualTo(A_SESSION_ID) + assertThat(appPreferencesStore.getHomeserverHistoryFlow().first()) + .containsExactly(AuthenticationConfig.MATRIX_ORG_URL) + } + } + @Test fun `present - receiving a message able to be parsed but error in importing change the state to error`() = runTest { val presenter = createPresenter( @@ -115,10 +142,13 @@ class CreateAccountPresenterTest { authenticationService: MatrixAuthenticationService = FakeMatrixAuthenticationService(), messageParser: MessageParser = FakeMessageParser(), buildMeta: BuildMeta = aBuildMeta(), + appPreferencesStore: AppPreferencesStore = InMemoryAppPreferencesStore(), + accountProviderDataSource: AccountProviderDataSource = anAccountProviderDataSource(), ) = CreateAccountPresenter( url = url, authenticationService = authenticationService, messageParser = messageParser, buildMeta = buildMeta, + saveAccountProviderToHistory = SaveAccountProviderToHistory(accountProviderDataSource, appPreferencesStore), ) } diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordPresenterTest.kt index 4133403c51..4dd2859dee 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordPresenterTest.kt @@ -11,6 +11,7 @@ package io.element.android.features.login.impl.screens.loginpassword import com.google.common.truth.Truth.assertThat import io.element.android.appconfig.AuthenticationConfig import io.element.android.features.login.impl.accountprovider.AccountProviderDataSource +import io.element.android.features.login.impl.accountprovider.SaveAccountProviderToHistory import io.element.android.features.login.impl.accountprovider.anAccountProviderDataSource import io.element.android.libraries.architecture.AsyncData import io.element.android.libraries.matrix.api.core.SessionId @@ -21,8 +22,11 @@ import io.element.android.libraries.matrix.test.A_USER_NAME import io.element.android.libraries.matrix.test.A_USER_NAME_2 import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService import io.element.android.libraries.matrix.test.auth.aMatrixHomeServerDetails +import io.element.android.libraries.preferences.api.store.AppPreferencesStore +import io.element.android.libraries.preferences.test.InMemoryAppPreferencesStore import io.element.android.tests.testutils.WarmUpRule import io.element.android.tests.testutils.test +import kotlinx.coroutines.flow.first import kotlinx.coroutines.test.runTest import org.junit.Rule import org.junit.Test @@ -101,6 +105,32 @@ class LoginPasswordPresenterTest { } } + @Test + fun `present - successful login saves the account provider to history`() = runTest { + val authenticationService = FakeMatrixAuthenticationService( + setHomeserverResult = { + Result.success(aMatrixHomeServerDetails()) + }, + ) + val appPreferencesStore = InMemoryAppPreferencesStore() + createLoginPasswordPresenter( + authenticationService = authenticationService, + appPreferencesStore = appPreferencesStore, + ).test { + val initialState = awaitItem() + initialState.eventSink.invoke(LoginPasswordEvents.SetLogin(A_USER_NAME)) + initialState.eventSink.invoke(LoginPasswordEvents.SetPassword(A_PASSWORD)) + skipItems(1) + val loginAndPasswordState = awaitItem() + loginAndPasswordState.eventSink.invoke(LoginPasswordEvents.Submit) + skipItems(1) + val loggedInState = awaitItem() + assertThat(loggedInState.loginAction).isEqualTo(AsyncData.Success(A_SESSION_ID)) + assertThat(appPreferencesStore.getHomeserverHistoryFlow().first()) + .containsExactly(AuthenticationConfig.MATRIX_ORG_URL) + } + } + @Test fun `present - submit with error`() = runTest { val authenticationService = FakeMatrixAuthenticationService( @@ -158,9 +188,11 @@ class LoginPasswordPresenterTest { initialLogin: String = "", authenticationService: FakeMatrixAuthenticationService = FakeMatrixAuthenticationService(), accountProviderDataSource: AccountProviderDataSource = anAccountProviderDataSource(), + appPreferencesStore: AppPreferencesStore = InMemoryAppPreferencesStore(), ): LoginPasswordPresenter = LoginPasswordPresenter( initialLogin = initialLogin, authenticationService = authenticationService, accountProviderDataSource = accountProviderDataSource, + saveAccountProviderToHistory = SaveAccountProviderToHistory(accountProviderDataSource, appPreferencesStore), ) } diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingPresenterTest.kt index b14e288d7e..49ea0e3caa 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingPresenterTest.kt @@ -15,6 +15,7 @@ import io.element.android.features.enterprise.api.EnterpriseService import io.element.android.features.enterprise.test.FakeEnterpriseService import io.element.android.features.login.impl.accesscontrol.DefaultAccountProviderAccessControl import io.element.android.features.login.impl.accountprovider.AccountProviderDataSource +import io.element.android.features.login.impl.accountprovider.SaveAccountProviderToHistory import io.element.android.features.login.impl.accountprovider.anAccountProviderDataSource import io.element.android.features.login.impl.localnetwork.LocalNetworkPermissionGate import io.element.android.features.login.impl.login.LoginModePresenter @@ -36,6 +37,7 @@ import io.element.android.libraries.matrix.test.core.aBuildMeta import io.element.android.libraries.oauth.api.OAuthActionFlow import io.element.android.libraries.oauth.test.customtab.FakeOAuthActionFlow import io.element.android.libraries.permissions.api.localnetwork.LocalNetworkPermissionAdvisor +import io.element.android.libraries.preferences.test.InMemoryAppPreferencesStore import io.element.android.libraries.sessionstorage.api.SessionStore import io.element.android.libraries.sessionstorage.test.InMemorySessionStore import io.element.android.libraries.sessionstorage.test.aSessionData @@ -322,6 +324,8 @@ fun createLoginModePresenter( io.element.android.libraries.permissions.test.FakeLocalNetworkPermissionAdvisor(), permissionsPresenterFactory: io.element.android.libraries.permissions.api.PermissionsPresenter.Factory = io.element.android.libraries.permissions.test.FakePermissionsPresenterFactory(), + saveAccountProviderToHistory: SaveAccountProviderToHistory = + SaveAccountProviderToHistory(anAccountProviderDataSource(), InMemoryAppPreferencesStore()), ): LoginModePresenter = LoginModePresenter( oAuthActionFlow = oAuthActionFlow, authenticationService = authenticationService, @@ -330,4 +334,5 @@ fun createLoginModePresenter( advisor = localNetworkPermissionAdvisor, permissionsPresenterFactory = permissionsPresenterFactory, ), + saveAccountProviderToHistory = saveAccountProviderToHistory, ) From df6ccd9dc30312b766f41e22685e36756e60c5bd Mon Sep 17 00:00:00 2001 From: Jenna Vassar Date: Thu, 6 Aug 2026 11:31:25 -0700 Subject: [PATCH 004/145] Consolidate account provider selection into a single editable screen --- .../features/login/impl/LoginFlowNode.kt | 43 ----- .../ConfirmAccountProviderEvents.kt | 1 + .../ConfirmAccountProviderNode.kt | 2 - .../ConfirmAccountProviderPresenter.kt | 46 +++++- .../ConfirmAccountProviderState.kt | 14 +- .../ConfirmAccountProviderStateProvider.kt | 10 +- .../ConfirmAccountProviderView.kt | 128 ++++++++++----- .../ConfirmAccountProviderPresenterTest.kt | 148 +++++++++--------- .../src/main/res/values/temporary.xml | 5 + 9 files changed, 226 insertions(+), 171 deletions(-) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/LoginFlowNode.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/LoginFlowNode.kt index 978d28dfa3..7437051e01 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/LoginFlowNode.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/LoginFlowNode.kt @@ -23,7 +23,6 @@ import com.bumble.appyx.navmodel.backstack.BackStack import com.bumble.appyx.navmodel.backstack.operation.pop import com.bumble.appyx.navmodel.backstack.operation.push import com.bumble.appyx.navmodel.backstack.operation.replace -import com.bumble.appyx.navmodel.backstack.operation.singleTop import dev.zacsweers.metro.AppScope import dev.zacsweers.metro.Assisted import dev.zacsweers.metro.AssistedInject @@ -33,14 +32,12 @@ import io.element.android.features.login.api.LoginEntryPoint import io.element.android.features.login.impl.accountprovider.AccountProviderDataSource import io.element.android.features.login.impl.classic.ElementClassicConnection import io.element.android.features.login.impl.qrcode.QrCodeLoginFlowNode -import io.element.android.features.login.impl.screens.changeaccountprovider.ChangeAccountProviderNode import io.element.android.features.login.impl.screens.chooseaccountprovider.ChooseAccountProviderNode import io.element.android.features.login.impl.screens.classic.ClassicFlowNode import io.element.android.features.login.impl.screens.confirmaccountprovider.ConfirmAccountProviderNode import io.element.android.features.login.impl.screens.createaccount.CreateAccountNode import io.element.android.features.login.impl.screens.loginpassword.LoginPasswordNode import io.element.android.features.login.impl.screens.onboarding.OnBoardingNode -import io.element.android.features.login.impl.screens.searchaccountprovider.SearchAccountProviderNode import io.element.android.features.preferences.api.PreferencesEntryPoint import io.element.android.libraries.androidutils.browser.openUrlInChromeCustomTab import io.element.android.libraries.architecture.BackstackView @@ -130,12 +127,6 @@ class LoginFlowNode( @Parcelize data object ChooseAccountProvider : NavTarget - @Parcelize - data object ChangeAccountProvider : NavTarget - - @Parcelize - data object SearchAccountProvider : NavTarget - @Parcelize data class LoginPassword( val initialLogin: String = "", @@ -281,43 +272,9 @@ class LoginFlowNode( override fun navigateToLoginPassword() { backstack.push(NavTarget.LoginPassword()) } - - override fun navigateToChangeAccountProvider() { - backstack.push(NavTarget.ChangeAccountProvider) - } } createNode(buildContext, plugins = listOf(inputs, callback)) } - NavTarget.ChangeAccountProvider -> { - val callback = object : ChangeAccountProviderNode.Callback { - override fun onDone() { - // Go back to the Account Provider screen - val confirmAccountProvider = backstack.elements.value.firstOrNull { - it.key.navTarget is NavTarget.ConfirmAccountProvider - }?.key?.navTarget ?: NavTarget.ConfirmAccountProvider(isAccountCreation = false) - backstack.singleTop(confirmAccountProvider) - } - - override fun navigateToSearchAccountProvider() { - backstack.push(NavTarget.SearchAccountProvider) - } - } - - createNode(buildContext, plugins = listOf(callback)) - } - NavTarget.SearchAccountProvider -> { - val callback = object : SearchAccountProviderNode.Callback { - override fun onDone() { - // Go back to the Account Provider screen - val confirmAccountProvider = backstack.elements.value.firstOrNull { - it.key.navTarget is NavTarget.ConfirmAccountProvider - }?.key?.navTarget ?: NavTarget.ConfirmAccountProvider(isAccountCreation = false) - backstack.singleTop(confirmAccountProvider) - } - } - - createNode(buildContext, plugins = listOf(callback)) - } is NavTarget.LoginPassword -> { val inputs = LoginPasswordNode.Inputs( initialLogin = navTarget.initialLogin, diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderEvents.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderEvents.kt index d66606b22c..1fb024156b 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderEvents.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderEvents.kt @@ -9,6 +9,7 @@ package io.element.android.features.login.impl.screens.confirmaccountprovider sealed interface ConfirmAccountProviderEvents { + data class UserInputChanged(val accountProvider: String) : ConfirmAccountProviderEvents data object Continue : ConfirmAccountProviderEvents data object ClearError : ConfirmAccountProviderEvents } diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderNode.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderNode.kt index 928a493dc1..417b0d4850 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderNode.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderNode.kt @@ -46,7 +46,6 @@ class ConfirmAccountProviderNode( fun navigateToLoginPassword() fun navigateToOAuth(oAuthDetails: OAuthDetails) fun navigateToCreateAccount(url: String) - fun navigateToChangeAccountProvider() } private val callback: Callback = callback() @@ -61,7 +60,6 @@ class ConfirmAccountProviderNode( onOAuthDetails = callback::navigateToOAuth, onNeedLoginPassword = callback::navigateToLoginPassword, onCreateAccountContinue = callback::navigateToCreateAccount, - onChange = callback::navigateToChangeAccountProvider, onLearnMoreClick = { openLearnMorePage(context) }, ) } diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt index 0111b1e7d7..de6ec28774 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt @@ -9,14 +9,23 @@ package io.element.android.features.login.impl.screens.confirmaccountprovider import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.rememberUpdatedState +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue import dev.zacsweers.metro.Assisted import dev.zacsweers.metro.AssistedFactory import dev.zacsweers.metro.AssistedInject +import io.element.android.features.login.impl.accountprovider.AccountProvider import io.element.android.features.login.impl.accountprovider.AccountProviderDataSource +import io.element.android.features.login.impl.changeserver.ChangeServerEvents +import io.element.android.features.login.impl.changeserver.ChangeServerState import io.element.android.features.login.impl.login.LoginModeEvent import io.element.android.features.login.impl.login.LoginModeState +import io.element.android.libraries.architecture.AsyncData import io.element.android.libraries.architecture.Presenter @AssistedInject @@ -24,6 +33,7 @@ class ConfirmAccountProviderPresenter( @Assisted private val params: Params, private val accountProviderDataSource: AccountProviderDataSource, private val loginModePresenter: Presenter, + private val changeServerPresenter: Presenter, ) : Presenter { data class Params( val isAccountCreation: Boolean, @@ -38,25 +48,49 @@ class ConfirmAccountProviderPresenter( override fun present(): ConfirmAccountProviderState { val accountProvider by accountProviderDataSource.flow.collectAsState() val loginModeState = loginModePresenter.present() + val changeServerState = changeServerPresenter.present() - fun handleEvent(event: ConfirmAccountProviderEvents) { - when (event) { - ConfirmAccountProviderEvents.Continue -> loginModeState.eventSink( + // Editable input, seeded from the current (history-defaulted) account provider until the user edits it. + var userInput by rememberSaveable { mutableStateOf(null) } + val accountProviderInput = userInput ?: accountProvider.url + val latestAccountProviderInput by rememberUpdatedState(accountProviderInput) + + // Once the chosen account provider has been validated and persisted, proceed with the actual sign in / sign up. + LaunchedEffect(changeServerState.changeServerAction) { + if (changeServerState.changeServerAction is AsyncData.Success) { + loginModeState.eventSink( LoginModeEvent.Submit( isAccountCreation = params.isAccountCreation, - homeserverUrl = accountProvider.url, + homeserverUrl = latestAccountProviderInput.trim(), resolvedHomeserverUrl = null, loginHint = null, ) ) - ConfirmAccountProviderEvents.ClearError -> loginModeState.eventSink(LoginModeEvent.ClearError) + } + } + + fun handleEvent(event: ConfirmAccountProviderEvents) { + when (event) { + is ConfirmAccountProviderEvents.UserInputChanged -> { + userInput = event.accountProvider + } + // Validate (and persist) the chosen account provider before proceeding. This also enforces the + // enterprise account-provider access control, which the login submit does not do on its own. + ConfirmAccountProviderEvents.Continue -> changeServerState.eventSink( + ChangeServerEvents.ChangeServer(AccountProvider(url = accountProviderInput.trim())) + ) + ConfirmAccountProviderEvents.ClearError -> { + loginModeState.eventSink(LoginModeEvent.ClearError) + changeServerState.eventSink(ChangeServerEvents.ClearError) + } } } return ConfirmAccountProviderState( - accountProvider = accountProvider, + accountProviderInput = accountProviderInput, isAccountCreation = params.isAccountCreation, loginModeState = loginModeState, + changeServerState = changeServerState, eventSink = ::handleEvent, ) } diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderState.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderState.kt index 6e6deb8c2c..0c211341ef 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderState.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderState.kt @@ -8,17 +8,23 @@ package io.element.android.features.login.impl.screens.confirmaccountprovider -import io.element.android.features.login.impl.accountprovider.AccountProvider +import io.element.android.features.login.impl.changeserver.ChangeServerState import io.element.android.features.login.impl.login.LoginModeState import io.element.android.libraries.architecture.AsyncData data class ConfirmAccountProviderState( - val accountProvider: AccountProvider, + val accountProviderInput: String, val isAccountCreation: Boolean, val loginModeState: LoginModeState, + val changeServerState: ChangeServerState, val eventSink: (ConfirmAccountProviderEvents) -> Unit ) { val submitEnabled: Boolean - get() = accountProvider.url.isNotEmpty() && - (loginModeState.loginMode is AsyncData.Uninitialized || loginModeState.loginMode is AsyncData.Loading) + get() = accountProviderInput.isNotBlank() && + loginModeState.loginMode is AsyncData.Uninitialized && + changeServerState.changeServerAction is AsyncData.Uninitialized + + val isLoading: Boolean + get() = loginModeState.loginMode is AsyncData.Loading || + changeServerState.changeServerAction is AsyncData.Loading } diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderStateProvider.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderStateProvider.kt index f597ad6b54..73c5e5f550 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderStateProvider.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderStateProvider.kt @@ -9,8 +9,8 @@ package io.element.android.features.login.impl.screens.confirmaccountprovider import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import io.element.android.features.login.impl.accountprovider.AccountProvider -import io.element.android.features.login.impl.accountprovider.anAccountProvider +import io.element.android.features.login.impl.changeserver.ChangeServerState +import io.element.android.features.login.impl.changeserver.aChangeServerState import io.element.android.features.login.impl.login.LoginModeState import io.element.android.features.login.impl.login.aLoginModeState import io.element.android.features.login.impl.screens.createaccount.AccountCreationNotSupported @@ -31,13 +31,15 @@ open class ConfirmAccountProviderStateProvider : PreviewParameterProvider Unit = {}, ) = ConfirmAccountProviderState( - accountProvider = accountProvider, + accountProviderInput = accountProviderInput, isAccountCreation = isAccountCreation, loginModeState = loginModeState, + changeServerState = changeServerState, eventSink = eventSink ) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt index 95fbff25ab..3a7d2831c8 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt @@ -8,29 +8,38 @@ package io.element.android.features.login.impl.screens.confirmaccountprovider +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.text.KeyboardActions +import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.runtime.Composable -import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue -import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.res.stringResource +import androidx.compose.ui.semantics.Role +import androidx.compose.ui.text.input.ImeAction +import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import io.element.android.compound.tokens.generated.CompoundIcons -import io.element.android.features.login.impl.R +import io.element.android.features.login.impl.changeserver.ChangeServerView import io.element.android.features.login.impl.login.LoginModeEvent import io.element.android.features.login.impl.login.LoginModeView -import io.element.android.libraries.architecture.AsyncData import io.element.android.libraries.designsystem.atomic.molecules.ButtonColumnMolecule import io.element.android.libraries.designsystem.atomic.molecules.IconTitleSubtitleMolecule import io.element.android.libraries.designsystem.atomic.pages.HeaderFooterPage import io.element.android.libraries.designsystem.components.BigIcon +import io.element.android.libraries.designsystem.components.form.textFieldState +import io.element.android.libraries.designsystem.modifiers.onTabOrEnterKeyFocusNext import io.element.android.libraries.designsystem.preview.ElementPreview import io.element.android.libraries.designsystem.preview.PreviewsDayNight import io.element.android.libraries.designsystem.theme.components.Button -import io.element.android.libraries.designsystem.theme.components.TextButton +import io.element.android.libraries.designsystem.theme.components.Icon +import io.element.android.libraries.designsystem.theme.components.TextField import io.element.android.libraries.matrix.api.auth.OAuthDetails import io.element.android.libraries.permissions.api.localnetwork.LocalNetworkPermissionDialogView import io.element.android.libraries.testtags.TestTags @@ -44,14 +53,8 @@ fun ConfirmAccountProviderView( onNeedLoginPassword: () -> Unit, onLearnMoreClick: () -> Unit, onCreateAccountContinue: (url: String) -> Unit, - onChange: () -> Unit, modifier: Modifier = Modifier, ) { - val isLoading by remember(state.loginModeState.loginMode) { - derivedStateOf { - state.loginModeState.loginMode is AsyncData.Loading - } - } val eventSink = state.eventSink HeaderFooterPage( @@ -62,55 +65,97 @@ fun ConfirmAccountProviderView( iconStyle = BigIcon.Style.Default(CompoundIcons.UserProfileSolid()), title = stringResource( id = if (state.isAccountCreation) { - R.string.screen_account_provider_signup_title + CommonStrings.screen_select_server_title_register } else { - R.string.screen_account_provider_signin_title - }, - state.accountProvider.title + CommonStrings.screen_select_server_title_login + } ), - subTitle = stringResource( - id = if (state.isAccountCreation) { - R.string.screen_account_provider_signup_subtitle - } else { - R.string.screen_account_provider_signin_subtitle - }, - ) + subTitle = null, ) }, footer = { ButtonColumnMolecule { Button( text = stringResource(id = CommonStrings.action_continue), - showProgress = isLoading, - onClick = { eventSink.invoke(ConfirmAccountProviderEvents.Continue) }, - enabled = state.submitEnabled || isLoading, + showProgress = state.isLoading, + onClick = { eventSink(ConfirmAccountProviderEvents.Continue) }, + enabled = state.submitEnabled && !state.isLoading, modifier = Modifier .fillMaxWidth() .testTag(TestTags.loginContinue) ) - TextButton( - text = stringResource(id = R.string.screen_account_provider_change), - onClick = onChange, - enabled = !isLoading, - modifier = Modifier - .fillMaxWidth() - .testTag(TestTags.loginChangeServer) - ) } } ) { - LoginModeView( - loginMode = state.loginModeState.loginMode, - onClearError = { - eventSink(ConfirmAccountProviderEvents.ClearError) + var input by textFieldState(stateValue = state.accountProviderInput) + val focusManager = LocalFocusManager.current + TextField( + value = input, + onValueChange = { + input = it + eventSink(ConfirmAccountProviderEvents.UserInputChanged(it)) + }, + modifier = Modifier + .fillMaxWidth() + .padding(top = 40.dp) + .onTabOrEnterKeyFocusNext(focusManager) + .testTag(TestTags.changeServerServer), + label = stringResource(id = CommonStrings.screen_select_server_textfield_header), + supportingText = stringResource( + id = if (state.isAccountCreation) { + CommonStrings.screen_select_server_textfield_footer_register + } else { + CommonStrings.screen_select_server_textfield_footer_login + } + ), + keyboardOptions = KeyboardOptions( + keyboardType = KeyboardType.Uri, + imeAction = ImeAction.Done, + ), + keyboardActions = KeyboardActions(onDone = { + eventSink(ConfirmAccountProviderEvents.Continue) + }), + singleLine = true, + trailingIcon = if (input.isNotEmpty()) { + { + Box( + Modifier.clickable( + onClickLabel = stringResource(CommonStrings.action_clear), + role = Role.Button, + ) { + input = "" + eventSink(ConfirmAccountProviderEvents.UserInputChanged("")) + } + ) { + Icon( + imageVector = CompoundIcons.Close(), + contentDescription = stringResource(CommonStrings.action_clear) + ) + } + } + } else { + null }, - onLearnMoreClick = onLearnMoreClick, - onOAuthDetails = onOAuthDetails, - onNeedLoginPassword = onNeedLoginPassword, - onCreateAccountContinue = onCreateAccountContinue, ) } + // Renders the account-provider validation errors, progress and permission dialogs. + // The successful validation itself is observed by the presenter, which then proceeds with the login flow. + ChangeServerView( + state = state.changeServerState, + onLearnMoreClick = onLearnMoreClick, + onSuccess = {}, + ) + + LoginModeView( + loginMode = state.loginModeState.loginMode, + onClearError = { eventSink(ConfirmAccountProviderEvents.ClearError) }, + onLearnMoreClick = onLearnMoreClick, + onOAuthDetails = onOAuthDetails, + onNeedLoginPassword = onNeedLoginPassword, + onCreateAccountContinue = onCreateAccountContinue, + ) + LocalNetworkPermissionDialogView( dialog = state.loginModeState.localNetworkPermissionDialog, onSubmit = { @@ -133,6 +178,5 @@ internal fun ConfirmAccountProviderViewPreview( onNeedLoginPassword = {}, onCreateAccountContinue = {}, onLearnMoreClick = {}, - onChange = {}, ) } diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt index ce8e60c73f..0257d68ea9 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt @@ -8,15 +8,21 @@ package io.element.android.features.login.impl.screens.confirmaccountprovider +import app.cash.turbine.ReceiveTurbine import com.google.common.truth.Truth.assertThat import io.element.android.appconfig.AuthenticationConfig +import io.element.android.features.enterprise.test.FakeEnterpriseService +import io.element.android.features.login.impl.accesscontrol.DefaultAccountProviderAccessControl import io.element.android.features.login.impl.accountprovider.AccountProviderDataSource import io.element.android.features.login.impl.accountprovider.anAccountProviderDataSource +import io.element.android.features.login.impl.changeserver.ChangeServerPresenter +import io.element.android.features.login.impl.localnetwork.LocalNetworkPermissionGate import io.element.android.features.login.impl.login.LoginMode import io.element.android.features.login.impl.screens.createaccount.AccountCreationNotSupported import io.element.android.features.login.impl.screens.onboarding.createLoginModePresenter import io.element.android.features.login.impl.web.FakeWebClientUrlForAuthenticationRetriever import io.element.android.features.login.impl.web.WebClientUrlForAuthenticationRetriever +import io.element.android.features.wellknown.test.FakeWellknownRetriever import io.element.android.libraries.architecture.AsyncData import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService import io.element.android.libraries.matrix.test.AN_EXCEPTION @@ -25,6 +31,9 @@ import io.element.android.libraries.matrix.test.auth.aMatrixHomeServerDetails import io.element.android.libraries.oauth.api.OAuthAction import io.element.android.libraries.oauth.api.OAuthActionFlow import io.element.android.libraries.oauth.test.customtab.FakeOAuthActionFlow +import io.element.android.libraries.permissions.test.FakeLocalNetworkPermissionAdvisor +import io.element.android.libraries.permissions.test.FakePermissionsPresenter +import io.element.android.libraries.permissions.test.FakePermissionsPresenterFactory import io.element.android.tests.testutils.WarmUpRule import io.element.android.tests.testutils.test import kotlinx.coroutines.test.runTest @@ -42,7 +51,7 @@ class ConfirmAccountProviderPresenterTest { val initialState = awaitItem() assertThat(initialState.isAccountCreation).isFalse() assertThat(initialState.submitEnabled).isTrue() - assertThat(initialState.accountProvider.url).isEqualTo(AuthenticationConfig.MATRIX_ORG_URL) + assertThat(initialState.accountProviderInput).isEqualTo(AuthenticationConfig.MATRIX_ORG_URL) assertThat(initialState.loginModeState.loginMode).isEqualTo(AsyncData.Uninitialized) } } @@ -60,13 +69,9 @@ class ConfirmAccountProviderPresenterTest { presenter.test { val initialState = awaitItem() initialState.eventSink.invoke(ConfirmAccountProviderEvents.Continue) - val loadingState = awaitItem() - assertThat(loadingState.submitEnabled).isTrue() - assertThat(loadingState.loginModeState.loginMode).isInstanceOf(AsyncData.Loading::class.java) - val successState = awaitItem() - assertThat(successState.submitEnabled).isFalse() - assertThat(successState.loginModeState.loginMode).isInstanceOf(AsyncData.Success::class.java) + val successState = awaitLoginMode { it is AsyncData.Success } assertThat(successState.loginModeState.loginMode.dataOrNull()).isEqualTo(LoginMode.PasswordLogin) + cancelAndIgnoreRemainingEvents() } } @@ -83,13 +88,9 @@ class ConfirmAccountProviderPresenterTest { presenter.test { val initialState = awaitItem() initialState.eventSink.invoke(ConfirmAccountProviderEvents.Continue) - val loadingState = awaitItem() - assertThat(loadingState.submitEnabled).isTrue() - assertThat(loadingState.loginModeState.loginMode).isInstanceOf(AsyncData.Loading::class.java) - val successState = awaitItem() - assertThat(successState.submitEnabled).isFalse() - assertThat(successState.loginModeState.loginMode).isInstanceOf(AsyncData.Success::class.java) + val successState = awaitLoginMode { it is AsyncData.Success } assertThat(successState.loginModeState.loginMode.dataOrNull()).isInstanceOf(LoginMode.OAuth::class.java) + cancelAndIgnoreRemainingEvents() } } @@ -108,17 +109,13 @@ class ConfirmAccountProviderPresenterTest { presenter.test { val initialState = awaitItem() initialState.eventSink.invoke(ConfirmAccountProviderEvents.Continue) - val loadingState = awaitItem() - assertThat(loadingState.submitEnabled).isTrue() - assertThat(loadingState.loginModeState.loginMode).isInstanceOf(AsyncData.Loading::class.java) - val successState = awaitItem() - assertThat(successState.submitEnabled).isFalse() - assertThat(successState.loginModeState.loginMode).isInstanceOf(AsyncData.Success::class.java) + val successState = awaitLoginMode { it is AsyncData.Success } assertThat(successState.loginModeState.loginMode.dataOrNull()).isInstanceOf(LoginMode.OAuth::class.java) authenticationService.givenOAuthCancelError(AN_EXCEPTION) defaultOAuthActionFlow.post(OAuthAction.GoBack()) - val cancelFailureState = awaitItem() + val cancelFailureState = awaitLoginMode { it is AsyncData.Failure } assertThat(cancelFailureState.loginModeState.loginMode).isInstanceOf(AsyncData.Failure::class.java) + cancelAndIgnoreRemainingEvents() } } @@ -137,16 +134,12 @@ class ConfirmAccountProviderPresenterTest { presenter.test { val initialState = awaitItem() initialState.eventSink.invoke(ConfirmAccountProviderEvents.Continue) - val loadingState = awaitItem() - assertThat(loadingState.submitEnabled).isTrue() - assertThat(loadingState.loginModeState.loginMode).isInstanceOf(AsyncData.Loading::class.java) - val successState = awaitItem() - assertThat(successState.submitEnabled).isFalse() - assertThat(successState.loginModeState.loginMode).isInstanceOf(AsyncData.Success::class.java) + val successState = awaitLoginMode { it is AsyncData.Success } assertThat(successState.loginModeState.loginMode.dataOrNull()).isInstanceOf(LoginMode.OAuth::class.java) defaultOAuthActionFlow.post(OAuthAction.GoBack()) - val cancelFinalState = awaitItem() + val cancelFinalState = awaitLoginMode { it is AsyncData.Uninitialized } assertThat(cancelFinalState.loginModeState.loginMode).isInstanceOf(AsyncData.Uninitialized::class.java) + cancelAndIgnoreRemainingEvents() } } @@ -165,12 +158,11 @@ class ConfirmAccountProviderPresenterTest { presenter.test { val initialState = awaitItem() initialState.eventSink.invoke(ConfirmAccountProviderEvents.Continue) - val loadingState = awaitItem() - assertThat(loadingState.submitEnabled).isTrue() - assertThat(loadingState.loginModeState.loginMode).isInstanceOf(AsyncData.Loading::class.java) + awaitLoginMode { it is AsyncData.Loading } defaultOAuthActionFlow.post(OAuthAction.GoBack(toUnblock = true)) - val cancelFinalState = awaitItem() + val cancelFinalState = awaitLoginMode { it is AsyncData.Uninitialized } assertThat(cancelFinalState.loginModeState.loginMode).isInstanceOf(AsyncData.Uninitialized::class.java) + cancelAndIgnoreRemainingEvents() } } @@ -189,19 +181,13 @@ class ConfirmAccountProviderPresenterTest { presenter.test { val initialState = awaitItem() initialState.eventSink.invoke(ConfirmAccountProviderEvents.Continue) - val loadingState = awaitItem() - assertThat(loadingState.submitEnabled).isTrue() - assertThat(loadingState.loginModeState.loginMode).isInstanceOf(AsyncData.Loading::class.java) - val successState = awaitItem() - assertThat(successState.submitEnabled).isFalse() - assertThat(successState.loginModeState.loginMode).isInstanceOf(AsyncData.Success::class.java) + val successState = awaitLoginMode { it is AsyncData.Success } assertThat(successState.loginModeState.loginMode.dataOrNull()).isInstanceOf(LoginMode.OAuth::class.java) authenticationService.givenLoginError(AN_EXCEPTION) defaultOAuthActionFlow.post(OAuthAction.Success("aUrl")) - val cancelLoadingState = awaitItem() - assertThat(cancelLoadingState.loginModeState.loginMode).isInstanceOf(AsyncData.Loading::class.java) - val cancelFailureState = awaitItem() + val cancelFailureState = awaitLoginMode { it is AsyncData.Failure } assertThat(cancelFailureState.loginModeState.loginMode).isInstanceOf(AsyncData.Failure::class.java) + cancelAndIgnoreRemainingEvents() } } @@ -220,16 +206,12 @@ class ConfirmAccountProviderPresenterTest { presenter.test { val initialState = awaitItem() initialState.eventSink.invoke(ConfirmAccountProviderEvents.Continue) - val loadingState = awaitItem() - assertThat(loadingState.submitEnabled).isTrue() - assertThat(loadingState.loginModeState.loginMode).isInstanceOf(AsyncData.Loading::class.java) - val successState = awaitItem() - assertThat(successState.submitEnabled).isFalse() - assertThat(successState.loginModeState.loginMode).isInstanceOf(AsyncData.Success::class.java) + val successState = awaitLoginMode { it is AsyncData.Success } assertThat(successState.loginModeState.loginMode.dataOrNull()).isInstanceOf(LoginMode.OAuth::class.java) defaultOidcActionFlow.post(OAuthAction.Success("aUrl")) - val successSuccessState = awaitItem() + val successSuccessState = awaitLoginMode { it is AsyncData.Loading } assertThat(successSuccessState.loginModeState.loginMode).isInstanceOf(AsyncData.Loading::class.java) + cancelAndIgnoreRemainingEvents() } } @@ -246,10 +228,10 @@ class ConfirmAccountProviderPresenterTest { presenter.test { val initialState = awaitItem() initialState.eventSink.invoke(ConfirmAccountProviderEvents.Continue) - skipItems(1) // Loading - val failureState = awaitItem() - assertThat(failureState.submitEnabled).isFalse() - assertThat(failureState.loginModeState.loginMode).isInstanceOf(AsyncData.Failure::class.java) + // The account provider validation fails, so the login is never attempted. + val failureState = awaitState { it.changeServerState.changeServerAction is AsyncData.Failure } + assertThat(failureState.loginModeState.loginMode).isEqualTo(AsyncData.Uninitialized) + cancelAndIgnoreRemainingEvents() } } @@ -266,18 +248,15 @@ class ConfirmAccountProviderPresenterTest { presenter.test { val initialState = awaitItem() - // Submit will return an error + // Submit will return an error while validating the account provider initialState.eventSink(ConfirmAccountProviderEvents.Continue) - skipItems(1) // Loading - // Check an error was returned - val submittedState = awaitItem() - assertThat(submittedState.loginModeState.loginMode).isInstanceOf(AsyncData.Failure::class.java) + val submittedState = awaitState { it.changeServerState.changeServerAction is AsyncData.Failure } // Assert the error is then cleared submittedState.eventSink(ConfirmAccountProviderEvents.ClearError) - val clearedState = awaitItem() + val clearedState = awaitState { it.changeServerState.changeServerAction is AsyncData.Uninitialized } assertThat(clearedState.loginModeState.loginMode).isEqualTo(AsyncData.Uninitialized) } } @@ -286,7 +265,7 @@ class ConfirmAccountProviderPresenterTest { fun `present - confirm account creation without oidc and without url generates an error`() = runTest { val authenticationService = FakeMatrixAuthenticationService( setHomeserverResult = { - Result.success(aMatrixHomeServerDetails()) + Result.success(aMatrixHomeServerDetails(supportsPasswordLogin = true)) }, ) val presenter = createConfirmAccountProviderPresenter( @@ -299,14 +278,14 @@ class ConfirmAccountProviderPresenterTest { presenter.test { val initialState = awaitItem() initialState.eventSink(ConfirmAccountProviderEvents.Continue) - skipItems(1) // Loading // Check an error was returned - val submittedState = awaitItem() + val submittedState = awaitLoginMode { it is AsyncData.Failure } assertThat(submittedState.loginModeState.loginMode.errorOrNull()).isInstanceOf(AccountCreationNotSupported::class.java) // Assert the error is then cleared submittedState.eventSink(ConfirmAccountProviderEvents.ClearError) - val clearedState = awaitItem() + val clearedState = awaitLoginMode { it is AsyncData.Uninitialized } assertThat(clearedState.loginModeState.loginMode).isEqualTo(AsyncData.Uninitialized) + cancelAndIgnoreRemainingEvents() } } @@ -324,10 +303,9 @@ class ConfirmAccountProviderPresenterTest { presenter.test { val initialState = awaitItem() initialState.eventSink(ConfirmAccountProviderEvents.Continue) - skipItems(1) // Loading - val submittedState = awaitItem() - assertThat(submittedState.loginModeState.loginMode).isInstanceOf(AsyncData.Success::class.java) + val submittedState = awaitLoginMode { it is AsyncData.Success } assertThat(submittedState.loginModeState.loginMode.dataOrNull()).isInstanceOf(LoginMode.OAuth::class.java) + cancelAndIgnoreRemainingEvents() } } @@ -347,10 +325,9 @@ class ConfirmAccountProviderPresenterTest { presenter.test { val initialState = awaitItem() initialState.eventSink(ConfirmAccountProviderEvents.Continue) - skipItems(1) // Loading - val submittedState = awaitItem() - assertThat(submittedState.loginModeState.loginMode).isInstanceOf(AsyncData.Success::class.java) + val submittedState = awaitLoginMode { it is AsyncData.Success } assertThat(submittedState.loginModeState.loginMode.dataOrNull()).isInstanceOf(LoginMode.OAuth::class.java) + cancelAndIgnoreRemainingEvents() } } @@ -359,7 +336,7 @@ class ConfirmAccountProviderPresenterTest { val aUrl = "aUrl" val authenticationService = FakeMatrixAuthenticationService( setHomeserverResult = { - Result.success(aMatrixHomeServerDetails()) + Result.success(aMatrixHomeServerDetails(supportsPasswordLogin = true)) }, ) val presenter = createConfirmAccountProviderPresenter( @@ -370,9 +347,26 @@ class ConfirmAccountProviderPresenterTest { presenter.test { val initialState = awaitItem() initialState.eventSink(ConfirmAccountProviderEvents.Continue) - skipItems(1) // Loading - val submittedState = awaitItem() + val submittedState = awaitLoginMode { it is AsyncData.Success } assertThat(submittedState.loginModeState.loginMode.dataOrNull()).isEqualTo(LoginMode.AccountCreation(aUrl)) + cancelAndIgnoreRemainingEvents() + } + } + + /** + * Awaits until the emitted state's login mode matches [predicate], skipping the intermediate + * account-provider validation states, and returns that state. + */ + private suspend fun ReceiveTurbine.awaitLoginMode( + predicate: (AsyncData) -> Boolean, + ): ConfirmAccountProviderState = awaitState { predicate(it.loginModeState.loginMode) } + + private suspend fun ReceiveTurbine.awaitState( + predicate: (ConfirmAccountProviderState) -> Boolean, + ): ConfirmAccountProviderState { + while (true) { + val item = awaitItem() + if (predicate(item)) return item } } @@ -390,5 +384,19 @@ class ConfirmAccountProviderPresenterTest { oAuthActionFlow = defaultOAuthActionFlow, webClientUrlForAuthenticationRetriever = webClientUrlForAuthenticationRetriever, ), + changeServerPresenter = ChangeServerPresenter( + authenticationService = matrixAuthenticationService, + accountProviderDataSource = accountProviderDataSource, + defaultAccountProviderAccessControl = DefaultAccountProviderAccessControl( + enterpriseService = FakeEnterpriseService( + isAllowedToConnectToHomeserverResult = { true }, + ), + wellknownRetriever = FakeWellknownRetriever(), + ), + localNetworkPermissionGate = LocalNetworkPermissionGate( + advisor = FakeLocalNetworkPermissionAdvisor(), + permissionsPresenterFactory = FakePermissionsPresenterFactory(FakePermissionsPresenter()), + ), + ), ) } diff --git a/libraries/ui-strings/src/main/res/values/temporary.xml b/libraries/ui-strings/src/main/res/values/temporary.xml index c704e811ff..ca01aead32 100644 --- a/libraries/ui-strings/src/main/res/values/temporary.xml +++ b/libraries/ui-strings/src/main/res/values/temporary.xml @@ -10,4 +10,9 @@ "Collapsed" Active Inactive + "Enter your account provider" + "Choose an account provider" + "Account provider" + "If your account is provided by your company or a community, then change the account provider (example: companyname.com)." + "Create an account on matrix.org for free. If you want to create an account with a different provider, then change it accordingly (example: communityname.org)." From c2b3b0fe0f546a5c4192e9bb5b4cb490d9d1e66d Mon Sep 17 00:00:00 2001 From: Jenna Vassar Date: Thu, 6 Aug 2026 11:31:32 -0700 Subject: [PATCH 005/145] Remove the account provider search screen and homeserver resolver --- .../AccountProviderOtherView.kt | 77 ------- .../login/impl/resolver/HomeserverData.kt | 14 -- .../login/impl/resolver/HomeserverResolver.kt | 82 ------- .../ChangeAccountProviderNode.kt | 51 ----- .../ChangeAccountProviderPresenter.kt | 57 ----- .../ChangeAccountProviderState.kt | 19 -- .../ChangeAccountProviderStateProvider.kt | 37 --- .../ChangeAccountProviderView.kt | 129 ----------- .../SearchAccountProviderEvents.kt | 17 -- .../SearchAccountProviderNode.kt | 49 ---- .../SearchAccountProviderPresenter.kt | 77 ------- .../SearchAccountProviderState.kt | 20 -- .../SearchAccountProviderStateProvider.kt | 48 ---- .../SearchAccountProviderView.kt | 214 ------------------ .../ChangeAccountProviderPresenterTest.kt | 113 --------- .../SearchAccountProviderPresenterTest.kt | 179 --------------- 16 files changed, 1183 deletions(-) delete mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderOtherView.kt delete mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/resolver/HomeserverData.kt delete mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/resolver/HomeserverResolver.kt delete mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderNode.kt delete mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderPresenter.kt delete mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderState.kt delete mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderStateProvider.kt delete mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderView.kt delete mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderEvents.kt delete mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderNode.kt delete mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderPresenter.kt delete mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderState.kt delete mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderStateProvider.kt delete mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderView.kt delete mode 100644 features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderPresenterTest.kt delete mode 100644 features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderPresenterTest.kt diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderOtherView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderOtherView.kt deleted file mode 100644 index 8b9b22022e..0000000000 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderOtherView.kt +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.accountprovider - -import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.heightIn -import androidx.compose.foundation.layout.padding -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.res.stringResource -import androidx.compose.ui.semantics.Role -import androidx.compose.ui.unit.dp -import io.element.android.compound.theme.ElementTheme -import io.element.android.compound.tokens.generated.CompoundIcons -import io.element.android.features.login.impl.R -import io.element.android.libraries.designsystem.atomic.atoms.RoundedIconAtom -import io.element.android.libraries.designsystem.atomic.atoms.RoundedIconAtomSize -import io.element.android.libraries.designsystem.preview.ElementPreview -import io.element.android.libraries.designsystem.preview.PreviewsDayNight -import io.element.android.libraries.designsystem.theme.components.HorizontalDivider -import io.element.android.libraries.designsystem.theme.components.Text - -/** - * https://www.figma.com/file/o9p34zmiuEpZRyvZXJZAYL/FTUE?type=design&node-id=604-60817 - */ -@Composable -fun AccountProviderOtherView( - onClick: () -> Unit, - modifier: Modifier = Modifier, -) { - Column( - modifier = modifier - .fillMaxWidth() - .clickable(role = Role.Button) { onClick() } - ) { - HorizontalDivider() - Row( - modifier = Modifier - .fillMaxWidth() - .heightIn(min = 44.dp) - .padding(vertical = 4.dp, horizontal = 16.dp), - verticalAlignment = Alignment.CenterVertically - ) { - RoundedIconAtom( - size = RoundedIconAtomSize.Medium, - imageVector = CompoundIcons.Search(), - tint = ElementTheme.colors.iconPrimary, - ) - Text( - modifier = Modifier - .padding(start = 16.dp) - .weight(1f), - text = stringResource(R.string.screen_change_account_provider_other), - style = ElementTheme.typography.fontBodyLgMedium, - color = ElementTheme.colors.textPrimary, - ) - } - } -} - -@PreviewsDayNight -@Composable -internal fun AccountProviderOtherViewPreview() = ElementPreview { - AccountProviderOtherView( - onClick = { }, - ) -} diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/resolver/HomeserverData.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/resolver/HomeserverData.kt deleted file mode 100644 index d9994deb9a..0000000000 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/resolver/HomeserverData.kt +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2023-2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.resolver - -data class HomeserverData( - // The computed homeserver url, for which a wellknown file has been retrieved, or just a valid Url - val homeserverUrl: String, -) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/resolver/HomeserverResolver.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/resolver/HomeserverResolver.kt deleted file mode 100644 index 8c6cab79ce..0000000000 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/resolver/HomeserverResolver.kt +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2023-2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.resolver - -import dev.zacsweers.metro.Inject -import io.element.android.libraries.core.coroutine.CoroutineDispatchers -import io.element.android.libraries.core.coroutine.parallelMap -import io.element.android.libraries.core.uri.ensureProtocol -import io.element.android.libraries.core.uri.isValidUrl -import io.element.android.libraries.matrix.api.auth.HomeServerLoginCompatibilityChecker -import io.element.android.libraries.permissions.api.localnetwork.LocalNetworkPermissionAdvisor -import kotlinx.coroutines.currentCoroutineContext -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.flow -import kotlinx.coroutines.withContext -import timber.log.Timber -import java.util.Collections - -/** - * Resolve homeserver base on search terms. - */ -@Inject -class HomeserverResolver( - private val dispatchers: CoroutineDispatchers, - private val homeServerLoginCompatibilityChecker: HomeServerLoginCompatibilityChecker, - private val localNetworkPermissionAdvisor: LocalNetworkPermissionAdvisor, -) { - fun resolve(userInput: String): Flow> = flow { - val flowContext = currentCoroutineContext() - val trimmedUserInput = userInput.trim() - if (trimmedUserInput.length < 4) return@flow - val candidateBase = trimmedUserInput.ensureProtocol().removeSuffix("/") - val list = getUrlCandidates(candidateBase) - val currentList = Collections.synchronizedList(mutableListOf()) - // Run all the requests in parallel - withContext(dispatchers.io) { - list.parallelMap { url -> - // Skip the compatibility probe if we'd need ACCESS_LOCAL_NETWORK first — - // otherwise the probe hangs on the TCP timeout for ~30s. Emit the URL as a - // candidate directly; the actual sign-in flow triggers the permission prompt. - val shouldRequestPermissionOrIsValid = localNetworkPermissionAdvisor.shouldRequestPermissionFor(url) || - homeServerLoginCompatibilityChecker.check(url) - .onFailure { Timber.w(it, "Failed to check compatibility with homeserver $url") } - .getOrNull() - ?: return@parallelMap - - // Emit the list as soon as possible - if (shouldRequestPermissionOrIsValid) { - currentList.add(HomeserverData(homeserverUrl = url)) - withContext(flowContext) { - emit(currentList.toList()) - } - } - } - } - // If list is empty, and candidateBase is a valid an URL, do not block the user. - // A unsupported homeserver / homeserver not found error will be displayed if the user continues - if (currentList.isEmpty() && candidateBase.isValidUrl()) { - emit(listOf(HomeserverData(homeserverUrl = candidateBase))) - } - } - - private fun getUrlCandidates(data: String): List { - return buildList { - if (data.contains(".")) { - // TLD detected? - } else { - add("$data.org") - add("$data.com") - add("$data.io") - } - // Always try what the user has entered - add(data) - } - } -} diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderNode.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderNode.kt deleted file mode 100644 index 018a25dc89..0000000000 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderNode.kt +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2023-2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.screens.changeaccountprovider - -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.platform.LocalContext -import com.bumble.appyx.core.modality.BuildContext -import com.bumble.appyx.core.node.Node -import com.bumble.appyx.core.plugin.Plugin -import dev.zacsweers.metro.AppScope -import dev.zacsweers.metro.Assisted -import dev.zacsweers.metro.AssistedInject -import io.element.android.annotations.ContributesNode -import io.element.android.features.login.impl.util.openLearnMorePage -import io.element.android.libraries.architecture.callback - -@ContributesNode(AppScope::class) -@AssistedInject -class ChangeAccountProviderNode( - @Assisted buildContext: BuildContext, - @Assisted plugins: List, - private val presenter: ChangeAccountProviderPresenter, -) : Node(buildContext, plugins = plugins) { - interface Callback : Plugin { - fun onDone() - fun navigateToSearchAccountProvider() - } - - private val callback: Callback = callback() - - @Composable - override fun View(modifier: Modifier) { - val state = presenter.present() - val context = LocalContext.current - ChangeAccountProviderView( - state = state, - modifier = modifier, - onBackClick = ::navigateUp, - onLearnMoreClick = { openLearnMorePage(context) }, - onSuccess = callback::onDone, - onOtherProviderClick = callback::navigateToSearchAccountProvider, - ) - } -} diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderPresenter.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderPresenter.kt deleted file mode 100644 index 41605352ef..0000000000 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderPresenter.kt +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2023-2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.screens.changeaccountprovider - -import androidx.compose.runtime.Composable -import androidx.compose.runtime.remember -import dev.zacsweers.metro.Inject -import io.element.android.appconfig.AuthenticationConfig -import io.element.android.features.enterprise.api.EnterpriseService -import io.element.android.features.enterprise.api.canConnectToAnyHomeserver -import io.element.android.features.login.impl.accountprovider.AccountProvider -import io.element.android.features.login.impl.changeserver.ChangeServerState -import io.element.android.libraries.architecture.Presenter -import io.element.android.libraries.core.uri.ensureProtocol -import kotlinx.collections.immutable.toImmutableList - -@Inject -class ChangeAccountProviderPresenter( - private val changeServerPresenter: Presenter, - private val enterpriseService: EnterpriseService, -) : Presenter { - @Composable - override fun present(): ChangeAccountProviderState { - val staticAccountProviderList = remember { - enterpriseService.defaultHomeserverList() - .filter { it != EnterpriseService.ANY_ACCOUNT_PROVIDER } - .map { it.ensureProtocol() } - .ifEmpty { listOf(AuthenticationConfig.MATRIX_ORG_URL) } - .map { url -> - AccountProvider( - url = url, - subtitle = null, - isPublic = url == AuthenticationConfig.MATRIX_ORG_URL, - isMatrixOrg = url == AuthenticationConfig.MATRIX_ORG_URL, - ) - } - .toImmutableList() - } - - val canSearchForAccountProviders = remember { - enterpriseService.canConnectToAnyHomeserver() - } - - val changeServerState = changeServerPresenter.present() - return ChangeAccountProviderState( - accountProviders = staticAccountProviderList, - canSearchForAccountProviders = canSearchForAccountProviders, - changeServerState = changeServerState, - ) - } -} diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderState.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderState.kt deleted file mode 100644 index 3068a1cb57..0000000000 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderState.kt +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2023-2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.screens.changeaccountprovider - -import io.element.android.features.login.impl.accountprovider.AccountProvider -import io.element.android.features.login.impl.changeserver.ChangeServerState -import kotlinx.collections.immutable.ImmutableList - -data class ChangeAccountProviderState( - val accountProviders: ImmutableList, - val canSearchForAccountProviders: Boolean, - val changeServerState: ChangeServerState, -) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderStateProvider.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderStateProvider.kt deleted file mode 100644 index 5cec1961a4..0000000000 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderStateProvider.kt +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2023-2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.screens.changeaccountprovider - -import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import io.element.android.features.login.impl.accountprovider.AccountProvider -import io.element.android.features.login.impl.accountprovider.anAccountProvider -import io.element.android.features.login.impl.changeserver.ChangeServerState -import io.element.android.features.login.impl.changeserver.aChangeServerState -import kotlinx.collections.immutable.toImmutableList - -open class ChangeAccountProviderStateProvider : PreviewParameterProvider { - override val values: Sequence - get() = sequenceOf( - aChangeAccountProviderState(), - aChangeAccountProviderState(canSearchForAccountProviders = false), - // Add other state here - ) -} - -fun aChangeAccountProviderState( - accountProviders: List = listOf( - anAccountProvider() - ), - canSearchForAccountProviders: Boolean = true, - changeServerState: ChangeServerState = aChangeServerState(), -) = ChangeAccountProviderState( - accountProviders = accountProviders.toImmutableList(), - canSearchForAccountProviders = canSearchForAccountProviders, - changeServerState = changeServerState, -) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderView.kt deleted file mode 100644 index 212bab515d..0000000000 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderView.kt +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2023-2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -@file:OptIn(ExperimentalMaterial3Api::class) - -package io.element.android.features.login.impl.screens.changeaccountprovider - -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.consumeWindowInsets -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.imePadding -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.rememberScrollState -import androidx.compose.foundation.verticalScroll -import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.res.stringResource -import androidx.compose.ui.tooling.preview.PreviewParameter -import androidx.compose.ui.unit.dp -import io.element.android.compound.tokens.generated.CompoundIcons -import io.element.android.features.login.impl.R -import io.element.android.features.login.impl.accountprovider.AccountProviderOtherView -import io.element.android.features.login.impl.accountprovider.AccountProviderView -import io.element.android.features.login.impl.changeserver.ChangeServerEvents -import io.element.android.features.login.impl.changeserver.ChangeServerView -import io.element.android.libraries.designsystem.atomic.molecules.IconTitleSubtitleMolecule -import io.element.android.libraries.designsystem.components.BigIcon -import io.element.android.libraries.designsystem.components.button.BackButton -import io.element.android.libraries.designsystem.preview.ElementPreview -import io.element.android.libraries.designsystem.preview.PreviewsDayNight -import io.element.android.libraries.designsystem.theme.components.Scaffold -import io.element.android.libraries.designsystem.theme.components.TopAppBar -import io.element.android.libraries.designsystem.utils.lazyColumnContentPadding -import io.element.android.libraries.designsystem.utils.scaffoldScrollableContentInsets - -/** - * https://www.figma.com/file/o9p34zmiuEpZRyvZXJZAYL/FTUE?type=design&node-id=604-60817 - */ -@Composable -fun ChangeAccountProviderView( - state: ChangeAccountProviderState, - onBackClick: () -> Unit, - onLearnMoreClick: () -> Unit, - onSuccess: () -> Unit, - onOtherProviderClick: () -> Unit, - modifier: Modifier = Modifier, -) { - Scaffold( - modifier = modifier, - topBar = { - TopAppBar( - title = {}, - navigationIcon = { BackButton(onClick = onBackClick) } - ) - }, - contentWindowInsets = scaffoldScrollableContentInsets, - ) { padding -> - Box( - modifier = Modifier - .fillMaxSize() - .imePadding() - .padding(padding) - .consumeWindowInsets(padding) - ) { - Column( - modifier = Modifier - .verticalScroll(state = rememberScrollState()) - .padding(lazyColumnContentPadding) - ) { - IconTitleSubtitleMolecule( - modifier = Modifier.padding(top = 16.dp, bottom = 32.dp, start = 16.dp, end = 16.dp), - iconStyle = BigIcon.Style.Default(CompoundIcons.HomeSolid()), - title = stringResource(id = R.string.screen_change_account_provider_title), - subTitle = stringResource(id = R.string.screen_change_account_provider_subtitle), - ) - - state.accountProviders.forEach { item -> - val alteredItem = if (item.isMatrixOrg) { - // Set the subtitle from the resource - item.copy( - subtitle = stringResource(id = R.string.screen_change_account_provider_matrix_org_subtitle), - ) - } else { - item - } - AccountProviderView( - item = alteredItem, - onClick = { - state.changeServerState.eventSink.invoke(ChangeServerEvents.ChangeServer(alteredItem)) - } - ) - } - // Other - if (state.canSearchForAccountProviders) { - AccountProviderOtherView( - onClick = onOtherProviderClick - ) - } - Spacer(Modifier.height(32.dp)) - } - ChangeServerView( - state = state.changeServerState, - onLearnMoreClick = onLearnMoreClick, - onSuccess = onSuccess, - ) - } - } -} - -@PreviewsDayNight -@Composable -internal fun ChangeAccountProviderViewPreview(@PreviewParameter(ChangeAccountProviderStateProvider::class) state: ChangeAccountProviderState) = ElementPreview { - ChangeAccountProviderView( - state = state, - onBackClick = { }, - onLearnMoreClick = { }, - onSuccess = { }, - onOtherProviderClick = { }, - ) -} diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderEvents.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderEvents.kt deleted file mode 100644 index 8816de3946..0000000000 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderEvents.kt +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2023-2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.screens.searchaccountprovider - -sealed interface SearchAccountProviderEvents { - /** - * The user has typed something, expect to get a list of matching account provider results - * in the state. - */ - data class UserInput(val input: String) : SearchAccountProviderEvents -} diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderNode.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderNode.kt deleted file mode 100644 index ddbcc4c847..0000000000 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderNode.kt +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2023-2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.screens.searchaccountprovider - -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.platform.LocalContext -import com.bumble.appyx.core.modality.BuildContext -import com.bumble.appyx.core.node.Node -import com.bumble.appyx.core.plugin.Plugin -import dev.zacsweers.metro.AppScope -import dev.zacsweers.metro.Assisted -import dev.zacsweers.metro.AssistedInject -import io.element.android.annotations.ContributesNode -import io.element.android.features.login.impl.util.openLearnMorePage -import io.element.android.libraries.architecture.callback - -@ContributesNode(AppScope::class) -@AssistedInject -class SearchAccountProviderNode( - @Assisted buildContext: BuildContext, - @Assisted plugins: List, - private val presenter: SearchAccountProviderPresenter, -) : Node(buildContext, plugins = plugins) { - interface Callback : Plugin { - fun onDone() - } - - private val callback: Callback = callback() - - @Composable - override fun View(modifier: Modifier) { - val state = presenter.present() - val context = LocalContext.current - SearchAccountProviderView( - state = state, - modifier = modifier, - onBackClick = ::navigateUp, - onLearnMoreClick = { openLearnMorePage(context) }, - onSuccess = callback::onDone, - ) - } -} diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderPresenter.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderPresenter.kt deleted file mode 100644 index 2efe4501c6..0000000000 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderPresenter.kt +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2023-2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.screens.searchaccountprovider - -import androidx.compose.runtime.Composable -import androidx.compose.runtime.LaunchedEffect -import androidx.compose.runtime.MutableState -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.saveable.rememberSaveable -import androidx.compose.runtime.setValue -import dev.zacsweers.metro.Inject -import io.element.android.features.login.impl.changeserver.ChangeServerState -import io.element.android.features.login.impl.resolver.HomeserverData -import io.element.android.features.login.impl.resolver.HomeserverResolver -import io.element.android.libraries.architecture.AsyncData -import io.element.android.libraries.architecture.Presenter -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.delay -import kotlinx.coroutines.launch - -@Inject -class SearchAccountProviderPresenter( - private val homeserverResolver: HomeserverResolver, - private val changeServerPresenter: Presenter, -) : Presenter { - @Composable - override fun present(): SearchAccountProviderState { - var userInput by rememberSaveable { - mutableStateOf("") - } - val changeServerState = changeServerPresenter.present() - - val data: MutableState>> = remember { - mutableStateOf(AsyncData.Uninitialized) - } - - LaunchedEffect(userInput) { - onUserInput(userInput, data) - } - - fun handleEvent(event: SearchAccountProviderEvents) { - when (event) { - is SearchAccountProviderEvents.UserInput -> { - userInput = event.input - } - } - } - - return SearchAccountProviderState( - userInput = userInput, - userInputResult = data.value, - changeServerState = changeServerState, - eventSink = ::handleEvent, - ) - } - - private fun CoroutineScope.onUserInput(userInput: String, data: MutableState>>) = launch { - data.value = AsyncData.Uninitialized - // Debounce - delay(500) - data.value = AsyncData.Loading() - homeserverResolver.resolve(userInput).collect { - data.value = AsyncData.Success(it) - } - if (data.value !is AsyncData.Success) { - data.value = AsyncData.Uninitialized - } - } -} diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderState.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderState.kt deleted file mode 100644 index dc02a997a6..0000000000 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderState.kt +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2023-2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.screens.searchaccountprovider - -import io.element.android.features.login.impl.changeserver.ChangeServerState -import io.element.android.features.login.impl.resolver.HomeserverData -import io.element.android.libraries.architecture.AsyncData - -data class SearchAccountProviderState( - val userInput: String, - val userInputResult: AsyncData>, - val changeServerState: ChangeServerState, - val eventSink: (SearchAccountProviderEvents) -> Unit -) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderStateProvider.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderStateProvider.kt deleted file mode 100644 index 2a8512c38a..0000000000 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderStateProvider.kt +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2023-2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.screens.searchaccountprovider - -import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import io.element.android.appconfig.AuthenticationConfig -import io.element.android.features.login.impl.changeserver.aChangeServerState -import io.element.android.features.login.impl.resolver.HomeserverData -import io.element.android.libraries.architecture.AsyncData - -open class SearchAccountProviderStateProvider : PreviewParameterProvider { - override val values: Sequence - get() = sequenceOf( - aSearchAccountProviderState(), - aSearchAccountProviderState(userInputResult = AsyncData.Success(aHomeserverDataList())), - // Add other state here - ) -} - -fun aSearchAccountProviderState( - userInput: String = "", - userInputResult: AsyncData> = AsyncData.Uninitialized, -) = SearchAccountProviderState( - userInput = userInput, - userInputResult = userInputResult, - changeServerState = aChangeServerState(), - eventSink = {} -) - -fun aHomeserverDataList(): List { - return listOf( - aHomeserverData(homeserverUrl = AuthenticationConfig.MATRIX_ORG_URL), - aHomeserverData(homeserverUrl = "https://no.sliding.sync"), - aHomeserverData(homeserverUrl = "https://invalid"), - ) -} - -fun aHomeserverData( - homeserverUrl: String = AuthenticationConfig.MATRIX_ORG_URL, -): HomeserverData { - return HomeserverData(homeserverUrl = homeserverUrl) -} diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderView.kt deleted file mode 100644 index 8335dde112..0000000000 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderView.kt +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2023-2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -@file:OptIn(ExperimentalMaterial3Api::class) - -package io.element.android.features.login.impl.screens.searchaccountprovider - -import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.consumeWindowInsets -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.imePadding -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.foundation.lazy.items -import androidx.compose.foundation.lazy.rememberLazyListState -import androidx.compose.foundation.text.KeyboardActions -import androidx.compose.foundation.text.KeyboardOptions -import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.Scaffold -import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue -import androidx.compose.runtime.setValue -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.focus.FocusDirection -import androidx.compose.ui.platform.LocalFocusManager -import androidx.compose.ui.res.stringResource -import androidx.compose.ui.semantics.Role -import androidx.compose.ui.text.input.ImeAction -import androidx.compose.ui.text.input.KeyboardType -import androidx.compose.ui.tooling.preview.PreviewParameter -import androidx.compose.ui.unit.dp -import io.element.android.appconfig.AuthenticationConfig -import io.element.android.compound.tokens.generated.CompoundIcons -import io.element.android.features.login.impl.R -import io.element.android.features.login.impl.accountprovider.AccountProvider -import io.element.android.features.login.impl.accountprovider.AccountProviderView -import io.element.android.features.login.impl.changeserver.ChangeServerEvents -import io.element.android.features.login.impl.changeserver.ChangeServerView -import io.element.android.features.login.impl.resolver.HomeserverData -import io.element.android.libraries.architecture.AsyncData -import io.element.android.libraries.designsystem.atomic.molecules.IconTitleSubtitleMolecule -import io.element.android.libraries.designsystem.components.BigIcon -import io.element.android.libraries.designsystem.components.button.BackButton -import io.element.android.libraries.designsystem.components.form.textFieldState -import io.element.android.libraries.designsystem.modifiers.onTabOrEnterKeyFocusNext -import io.element.android.libraries.designsystem.preview.ElementPreview -import io.element.android.libraries.designsystem.preview.PreviewsDayNight -import io.element.android.libraries.designsystem.theme.components.CircularProgressIndicator -import io.element.android.libraries.designsystem.theme.components.Icon -import io.element.android.libraries.designsystem.theme.components.TextField -import io.element.android.libraries.designsystem.theme.components.TopAppBar -import io.element.android.libraries.testtags.TestTags -import io.element.android.libraries.testtags.testTag -import io.element.android.libraries.ui.strings.CommonStrings - -/** - * https://www.figma.com/file/o9p34zmiuEpZRyvZXJZAYL/FTUE?type=design&node-id=611-61435 - */ -@Composable -fun SearchAccountProviderView( - state: SearchAccountProviderState, - onBackClick: () -> Unit, - onLearnMoreClick: () -> Unit, - onSuccess: () -> Unit, - modifier: Modifier = Modifier, -) { - val eventSink = state.eventSink - Scaffold( - modifier = modifier, - topBar = { - TopAppBar( - title = {}, - navigationIcon = { BackButton(onClick = onBackClick) } - ) - } - ) { padding -> - Box( - modifier = Modifier - .fillMaxSize() - .imePadding() - .padding(padding) - .consumeWindowInsets(padding) - ) { - LazyColumn(modifier = Modifier.fillMaxWidth(), state = rememberLazyListState()) { - item { - IconTitleSubtitleMolecule( - modifier = Modifier.padding(top = 16.dp, bottom = 40.dp, start = 16.dp, end = 16.dp), - iconStyle = BigIcon.Style.Default(CompoundIcons.Search()), - title = stringResource(id = R.string.screen_account_provider_form_title), - subTitle = stringResource(id = R.string.screen_account_provider_form_subtitle), - ) - } - item { - // TextInput - var userInputState by textFieldState(stateValue = state.userInput) - val focusManager = LocalFocusManager.current - TextField( - value = userInputState, - // readOnly = isLoading, - modifier = Modifier - .fillMaxWidth() - .padding(start = 16.dp, end = 16.dp, bottom = 16.dp) - .onTabOrEnterKeyFocusNext(focusManager) - .testTag(TestTags.changeServerServer), - onValueChange = { - userInputState = it - eventSink(SearchAccountProviderEvents.UserInput(it)) - }, - keyboardOptions = KeyboardOptions( - keyboardType = KeyboardType.Uri, - imeAction = ImeAction.Done, - ), - keyboardActions = KeyboardActions(onDone = { - focusManager.moveFocus(FocusDirection.Down) - }), - singleLine = true, - trailingIcon = if (userInputState.isNotEmpty()) { - { - Box( - Modifier.clickable( - onClickLabel = stringResource(CommonStrings.action_clear), - role = Role.Button, - ) { - userInputState = "" - eventSink(SearchAccountProviderEvents.UserInput("")) - } - ) { - Icon( - imageVector = CompoundIcons.Close(), - contentDescription = stringResource(CommonStrings.action_clear) - ) - } - } - } else { - null - }, - supportingText = stringResource(id = R.string.screen_account_provider_form_notice), - ) - } - - when (state.userInputResult) { - is AsyncData.Failure -> { - // Ignore errors (let the user type more chars) - } - is AsyncData.Loading -> { - item { - Box( - modifier = Modifier - .fillMaxSize() - ) { - CircularProgressIndicator( - modifier = Modifier.align(Alignment.Center) - ) - } - } - } - is AsyncData.Success -> { - items(state.userInputResult.data) { homeserverData -> - val item = homeserverData.toAccountProvider() - AccountProviderView( - item = item, - onClick = { - state.changeServerState.eventSink.invoke(ChangeServerEvents.ChangeServer(item)) - } - ) - } - } - AsyncData.Uninitialized -> Unit - } - item { - Spacer(Modifier.height(32.dp)) - } - } - ChangeServerView( - state = state.changeServerState, - onLearnMoreClick = onLearnMoreClick, - onSuccess = onSuccess, - ) - } - } -} - -@Composable -private fun HomeserverData.toAccountProvider(): AccountProvider { - val isMatrixOrg = homeserverUrl == AuthenticationConfig.MATRIX_ORG_URL - return AccountProvider( - url = homeserverUrl, - subtitle = if (isMatrixOrg) stringResource(id = R.string.screen_change_account_provider_matrix_org_subtitle) else null, - // There is no need to know for other servers right now - isPublic = isMatrixOrg, - isMatrixOrg = isMatrixOrg, - ) -} - -@PreviewsDayNight -@Composable -internal fun SearchAccountProviderViewPreview(@PreviewParameter(SearchAccountProviderStateProvider::class) state: SearchAccountProviderState) = ElementPreview { - SearchAccountProviderView( - state = state, - onBackClick = {}, - onLearnMoreClick = {}, - onSuccess = {}, - ) -} diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderPresenterTest.kt deleted file mode 100644 index 7d81f05c0c..0000000000 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderPresenterTest.kt +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2023-2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.screens.changeaccountprovider - -import com.google.common.truth.Truth.assertThat -import io.element.android.features.enterprise.api.EnterpriseService -import io.element.android.features.enterprise.test.FakeEnterpriseService -import io.element.android.features.login.impl.accountprovider.AccountProvider -import io.element.android.features.login.impl.changeserver.aChangeServerState -import io.element.android.libraries.matrix.test.AN_ACCOUNT_PROVIDER -import io.element.android.libraries.matrix.test.AN_ACCOUNT_PROVIDER_2 -import io.element.android.tests.testutils.WarmUpRule -import io.element.android.tests.testutils.test -import kotlinx.coroutines.test.runTest -import org.junit.Rule -import org.junit.Test - -class ChangeAccountProviderPresenterTest { - @get:Rule - val warmUpRule = WarmUpRule() - - @Test - fun `present - initial state`() = runTest { - val presenter = ChangeAccountProviderPresenter( - changeServerPresenter = { aChangeServerState() }, - enterpriseService = FakeEnterpriseService( - defaultHomeserverListResult = { emptyList() } - ), - ) - presenter.test { - val initialState = awaitItem() - assertThat(initialState.accountProviders).isEqualTo( - listOf( - AccountProvider( - url = "https://matrix.org", - title = "matrix.org", - subtitle = null, - isPublic = true, - isMatrixOrg = true, - ) - ) - ) - assertThat(initialState.canSearchForAccountProviders).isTrue() - } - } - - @Test - fun `present - fixed list of account providers`() = runTest { - val presenter = ChangeAccountProviderPresenter( - changeServerPresenter = { aChangeServerState() }, - enterpriseService = FakeEnterpriseService( - defaultHomeserverListResult = { - listOf(AN_ACCOUNT_PROVIDER, AN_ACCOUNT_PROVIDER_2) - } - ), - ) - presenter.test { - val initialState = awaitItem() - assertThat(initialState.accountProviders).isEqualTo( - listOf( - AccountProvider( - url = "https://matrix.org", - title = "matrix.org", - subtitle = null, - isPublic = true, - isMatrixOrg = true, - ), - AccountProvider( - url = "https://element.io", - title = "element.io", - subtitle = null, - isPublic = false, - isMatrixOrg = false, - ) - ) - ) - assertThat(initialState.canSearchForAccountProviders).isFalse() - } - } - - @Test - fun `present - opened list of account providers`() = runTest { - val presenter = ChangeAccountProviderPresenter( - changeServerPresenter = { aChangeServerState() }, - enterpriseService = FakeEnterpriseService( - defaultHomeserverListResult = { - listOf(AN_ACCOUNT_PROVIDER, EnterpriseService.ANY_ACCOUNT_PROVIDER) - } - ), - ) - presenter.test { - val initialState = awaitItem() - assertThat(initialState.accountProviders).isEqualTo( - listOf( - AccountProvider( - url = "https://matrix.org", - title = "matrix.org", - subtitle = null, - isPublic = true, - isMatrixOrg = true, - ) - ) - ) - assertThat(initialState.canSearchForAccountProviders).isTrue() - } - } -} diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderPresenterTest.kt deleted file mode 100644 index 29c5d4a86c..0000000000 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderPresenterTest.kt +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2023-2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.screens.searchaccountprovider - -import com.google.common.truth.Truth.assertThat -import io.element.android.features.login.impl.changeserver.aChangeServerState -import io.element.android.features.login.impl.resolver.HomeserverResolver -import io.element.android.libraries.architecture.AsyncData -import io.element.android.libraries.matrix.test.auth.FakeHomeServerLoginCompatibilityChecker -import io.element.android.libraries.permissions.test.FakeLocalNetworkPermissionAdvisor -import io.element.android.tests.testutils.WarmUpRule -import io.element.android.tests.testutils.lambda.lambdaRecorder -import io.element.android.tests.testutils.lambda.value -import io.element.android.tests.testutils.test -import io.element.android.tests.testutils.testCoroutineDispatchers -import kotlinx.coroutines.test.runTest -import org.junit.Rule -import org.junit.Test - -class SearchAccountProviderPresenterTest { - @get:Rule - val warmUpRule = WarmUpRule() - - @Test - fun `present - initial state`() = runTest { - val fakeLoginCompatibilityChecker = FakeHomeServerLoginCompatibilityChecker(checkResult = { Result.success(true) }) - val presenter = SearchAccountProviderPresenter( - homeserverResolver = HomeserverResolver(testCoroutineDispatchers(), fakeLoginCompatibilityChecker, FakeLocalNetworkPermissionAdvisor()), - changeServerPresenter = { aChangeServerState() } - ) - presenter.test { - val initialState = awaitItem() - assertThat(initialState.userInput).isEmpty() - assertThat(initialState.userInputResult).isEqualTo(AsyncData.Uninitialized) - } - } - - @Test - fun `present - error while checking login compatibility`() = runTest { - val fakeLoginCompatibilityChecker = FakeHomeServerLoginCompatibilityChecker(checkResult = { Result.failure(IllegalStateException("Oops")) }) - val presenter = SearchAccountProviderPresenter( - homeserverResolver = HomeserverResolver(testCoroutineDispatchers(), fakeLoginCompatibilityChecker, FakeLocalNetworkPermissionAdvisor()), - changeServerPresenter = { aChangeServerState() } - ) - presenter.test { - val initialState = awaitItem() - initialState.eventSink.invoke(SearchAccountProviderEvents.UserInput("https://test.org")) - val withInputState = awaitItem() - assertThat(withInputState.userInput).isEqualTo("https://test.org") - assertThat(initialState.userInputResult).isEqualTo(AsyncData.Uninitialized) - assertThat(awaitItem().userInputResult).isInstanceOf(AsyncData.Loading::class.java) - assertThat(awaitItem().userInputResult).isEqualTo( - AsyncData.Success( - listOf( - aHomeserverData(homeserverUrl = "https://test.org") - ) - ) - ) - } - } - - @Test - fun `present - enter text no result`() = runTest { - val fakeWellknownRetriever = FakeHomeServerLoginCompatibilityChecker(checkResult = { Result.success(false) }) - val presenter = SearchAccountProviderPresenter( - homeserverResolver = HomeserverResolver(testCoroutineDispatchers(), fakeWellknownRetriever, FakeLocalNetworkPermissionAdvisor()), - changeServerPresenter = { aChangeServerState() } - ) - presenter.test { - val initialState = awaitItem() - initialState.eventSink.invoke(SearchAccountProviderEvents.UserInput("test")) - val withInputState = awaitItem() - assertThat(withInputState.userInput).isEqualTo("test") - assertThat(initialState.userInputResult).isEqualTo(AsyncData.Uninitialized) - assertThat(awaitItem().userInputResult).isInstanceOf(AsyncData.Loading::class.java) - assertThat(awaitItem().userInputResult).isEqualTo( - AsyncData.Success( - listOf( - aHomeserverData(homeserverUrl = "https://test"), - ) - ) - ) - } - } - - @Test - fun `present - enter text one result with wellknown`() = runTest { - val checkResult = lambdaRecorder> { - when (it) { - "https://test.org" -> Result.success(false) - "https://test.com" -> Result.success(false) - "https://test.io" -> Result.success(true) - "https://test" -> Result.success(false) - else -> error("should not happen") - } - } - val fakeLoginCompatibilityChecker = FakeHomeServerLoginCompatibilityChecker(checkResult = checkResult) - val presenter = SearchAccountProviderPresenter( - homeserverResolver = HomeserverResolver(testCoroutineDispatchers(), fakeLoginCompatibilityChecker, FakeLocalNetworkPermissionAdvisor()), - changeServerPresenter = { aChangeServerState() } - ) - presenter.test { - val initialState = awaitItem() - initialState.eventSink.invoke(SearchAccountProviderEvents.UserInput("test")) - val withInputState = awaitItem() - assertThat(withInputState.userInput).isEqualTo("test") - assertThat(initialState.userInputResult).isEqualTo(AsyncData.Uninitialized) - assertThat(awaitItem().userInputResult).isInstanceOf(AsyncData.Loading::class.java) - assertThat(awaitItem().userInputResult).isEqualTo( - AsyncData.Success( - listOf( - aHomeserverData(homeserverUrl = "https://test.io") - ) - ) - ) - checkResult.assertions().isCalledExactly(4) - .withSequence( - listOf(value("https://test.org")), - listOf(value("https://test.com")), - listOf(value("https://test.io")), - listOf(value("https://test")), - ) - } - } - - @Test - fun `present - enter text two results with wellknown`() = runTest { - val checkResult = lambdaRecorder> { - when (it) { - "https://test.org" -> Result.success(true) - "https://test.com" -> Result.success(false) - "https://test.io" -> Result.success(true) - "https://test" -> Result.success(false) - else -> error("should not happen") - } - } - val fakeLoginCompatibilityChecker = FakeHomeServerLoginCompatibilityChecker(checkResult = checkResult) - val presenter = SearchAccountProviderPresenter( - homeserverResolver = HomeserverResolver(testCoroutineDispatchers(), fakeLoginCompatibilityChecker, FakeLocalNetworkPermissionAdvisor()), - changeServerPresenter = { aChangeServerState() } - ) - presenter.test { - val initialState = awaitItem() - initialState.eventSink.invoke(SearchAccountProviderEvents.UserInput("test")) - val withInputState = awaitItem() - assertThat(withInputState.userInput).isEqualTo("test") - assertThat(initialState.userInputResult).isEqualTo(AsyncData.Uninitialized) - assertThat(awaitItem().userInputResult).isInstanceOf(AsyncData.Loading::class.java) - assertThat(awaitItem().userInputResult).isEqualTo( - AsyncData.Success( - listOf( - aHomeserverData(homeserverUrl = "https://test.org"), - ) - ) - ) - assertThat(awaitItem().userInputResult).isEqualTo( - AsyncData.Success( - listOf( - aHomeserverData(homeserverUrl = "https://test.org"), - aHomeserverData(homeserverUrl = "https://test.io"), - ) - ) - ) - checkResult.assertions().isCalledExactly(4) - .withSequence( - listOf(value("https://test.org")), - listOf(value("https://test.com")), - listOf(value("https://test.io")), - listOf(value("https://test")), - ) - } - } -} From d04a3853b4822bb3c12a10c3e6b86dbd23aefe01 Mon Sep 17 00:00:00 2001 From: Jenna Vassar Date: Thu, 6 Aug 2026 12:11:18 -0700 Subject: [PATCH 006/145] Add inline autocomplete for the account provider field --- .../ConfirmAccountProviderPresenter.kt | 23 ++++++++-- .../ConfirmAccountProviderState.kt | 2 + .../ConfirmAccountProviderStateProvider.kt | 6 +++ .../ConfirmAccountProviderView.kt | 44 ++++++++++++++++++ .../ConfirmAccountProviderPresenterTest.kt | 46 +++++++++++++++++++ .../src/main/res/values/temporary.xml | 1 + 6 files changed, 119 insertions(+), 3 deletions(-) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt index de6ec28774..c3f51a5177 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt @@ -13,6 +13,7 @@ import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember import androidx.compose.runtime.rememberUpdatedState import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue @@ -27,6 +28,7 @@ import io.element.android.features.login.impl.login.LoginModeEvent import io.element.android.features.login.impl.login.LoginModeState import io.element.android.libraries.architecture.AsyncData import io.element.android.libraries.architecture.Presenter +import io.element.android.libraries.preferences.api.store.AppPreferencesStore @AssistedInject class ConfirmAccountProviderPresenter( @@ -34,6 +36,7 @@ class ConfirmAccountProviderPresenter( private val accountProviderDataSource: AccountProviderDataSource, private val loginModePresenter: Presenter, private val changeServerPresenter: Presenter, + private val appPreferencesStore: AppPreferencesStore, ) : Presenter { data class Params( val isAccountCreation: Boolean, @@ -49,11 +52,24 @@ class ConfirmAccountProviderPresenter( val accountProvider by accountProviderDataSource.flow.collectAsState() val loginModeState = loginModePresenter.present() val changeServerState = changeServerPresenter.present() + val homeserverHistory by appPreferencesStore.getHomeserverHistoryFlow().collectAsState(emptyList()) // Editable input, seeded from the current (history-defaulted) account provider until the user edits it. var userInput by rememberSaveable { mutableStateOf(null) } val accountProviderInput = userInput ?: accountProvider.url - val latestAccountProviderInput by rememberUpdatedState(accountProviderInput) + + // Offer the most recent previously-used account provider that the current input is a prefix of. + val accountProviderSuggestion = remember(accountProviderInput, homeserverHistory) { + val input = accountProviderInput.trim() + input.takeIf { it.isNotEmpty() } + ?.let { prefix -> + homeserverHistory.firstOrNull { it.length > prefix.length && it.startsWith(prefix, ignoreCase = true) } + } + } + + // Continue accepts the suggestion when one is offered, otherwise the raw input. + val accountProviderToSubmit = accountProviderSuggestion ?: accountProviderInput + val latestAccountProviderToSubmit by rememberUpdatedState(accountProviderToSubmit) // Once the chosen account provider has been validated and persisted, proceed with the actual sign in / sign up. LaunchedEffect(changeServerState.changeServerAction) { @@ -61,7 +77,7 @@ class ConfirmAccountProviderPresenter( loginModeState.eventSink( LoginModeEvent.Submit( isAccountCreation = params.isAccountCreation, - homeserverUrl = latestAccountProviderInput.trim(), + homeserverUrl = latestAccountProviderToSubmit.trim(), resolvedHomeserverUrl = null, loginHint = null, ) @@ -77,7 +93,7 @@ class ConfirmAccountProviderPresenter( // Validate (and persist) the chosen account provider before proceeding. This also enforces the // enterprise account-provider access control, which the login submit does not do on its own. ConfirmAccountProviderEvents.Continue -> changeServerState.eventSink( - ChangeServerEvents.ChangeServer(AccountProvider(url = accountProviderInput.trim())) + ChangeServerEvents.ChangeServer(AccountProvider(url = accountProviderToSubmit.trim())) ) ConfirmAccountProviderEvents.ClearError -> { loginModeState.eventSink(LoginModeEvent.ClearError) @@ -88,6 +104,7 @@ class ConfirmAccountProviderPresenter( return ConfirmAccountProviderState( accountProviderInput = accountProviderInput, + accountProviderSuggestion = accountProviderSuggestion, isAccountCreation = params.isAccountCreation, loginModeState = loginModeState, changeServerState = changeServerState, diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderState.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderState.kt index 0c211341ef..a934378507 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderState.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderState.kt @@ -14,6 +14,8 @@ import io.element.android.libraries.architecture.AsyncData data class ConfirmAccountProviderState( val accountProviderInput: String, + // The full account provider from history that the current input is a prefix of, offered as inline autocomplete. + val accountProviderSuggestion: String?, val isAccountCreation: Boolean, val loginModeState: LoginModeState, val changeServerState: ChangeServerState, diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderStateProvider.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderStateProvider.kt index 73c5e5f550..53fa763c2f 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderStateProvider.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderStateProvider.kt @@ -20,6 +20,10 @@ open class ConfirmAccountProviderStateProvider : PreviewParameterProvider get() = sequenceOf( aConfirmAccountProviderState(), + aConfirmAccountProviderState( + accountProviderInput = "element", + accountProviderSuggestion = "element.io", + ), aConfirmAccountProviderState( isAccountCreation = true, ), @@ -32,12 +36,14 @@ open class ConfirmAccountProviderStateProvider : PreviewParameterProvider Unit = {}, ) = ConfirmAccountProviderState( accountProviderInput = accountProviderInput, + accountProviderSuggestion = accountProviderSuggestion, isAccountCreation = isAccountCreation, loginModeState = loginModeState, changeServerState = changeServerState, diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt index 3a7d2831c8..470b59926b 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt @@ -16,15 +16,25 @@ import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue +import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.res.stringResource import androidx.compose.ui.semantics.Role +import androidx.compose.ui.text.AnnotatedString +import androidx.compose.ui.text.SpanStyle +import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType +import androidx.compose.ui.text.input.OffsetMapping +import androidx.compose.ui.text.input.TransformedText +import androidx.compose.ui.text.input.VisualTransformation +import androidx.compose.ui.text.withStyle import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp +import io.element.android.compound.theme.ElementTheme import io.element.android.compound.tokens.generated.CompoundIcons import io.element.android.features.login.impl.changeserver.ChangeServerView import io.element.android.features.login.impl.login.LoginModeEvent @@ -89,6 +99,15 @@ fun ConfirmAccountProviderView( ) { var input by textFieldState(stateValue = state.accountProviderInput) val focusManager = LocalFocusManager.current + // Inline autocomplete: render the un-typed remainder of the suggested account provider in grey. + val suggestionSuffix = state.accountProviderSuggestion + ?.takeIf { it.length > input.length && it.startsWith(input, ignoreCase = true) } + ?.substring(input.length) + .orEmpty() + val ghostColor = ElementTheme.colors.textSecondary + val ghostTransformation = remember(suggestionSuffix, ghostColor) { + GhostSuffixVisualTransformation(suggestionSuffix, ghostColor) + } TextField( value = input, onValueChange = { @@ -101,6 +120,7 @@ fun ConfirmAccountProviderView( .onTabOrEnterKeyFocusNext(focusManager) .testTag(TestTags.changeServerServer), label = stringResource(id = CommonStrings.screen_select_server_textfield_header), + placeholder = stringResource(id = CommonStrings.screen_select_server_textfield_placeholder), supportingText = stringResource( id = if (state.isAccountCreation) { CommonStrings.screen_select_server_textfield_footer_register @@ -108,6 +128,7 @@ fun ConfirmAccountProviderView( CommonStrings.screen_select_server_textfield_footer_login } ), + visualTransformation = ghostTransformation, keyboardOptions = KeyboardOptions( keyboardType = KeyboardType.Uri, imeAction = ImeAction.Done, @@ -167,6 +188,29 @@ fun ConfirmAccountProviderView( ) } +/** + * Appends [suffix] (in [color]) after the user's text as a non-editable inline autocomplete hint. + * The underlying field value stays limited to what the user actually typed, so the cursor can never + * enter the suggested region. + */ +private class GhostSuffixVisualTransformation( + private val suffix: String, + private val color: Color, +) : VisualTransformation { + override fun filter(text: AnnotatedString): TransformedText { + if (suffix.isEmpty()) return TransformedText(text, OffsetMapping.Identity) + val transformed = buildAnnotatedString { + append(text) + withStyle(SpanStyle(color = color)) { append(suffix) } + } + val offsetMapping = object : OffsetMapping { + override fun originalToTransformed(offset: Int) = offset + override fun transformedToOriginal(offset: Int) = offset.coerceAtMost(text.length) + } + return TransformedText(transformed, offsetMapping) + } +} + @PreviewsDayNight @Composable internal fun ConfirmAccountProviderViewPreview( diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt index 0257d68ea9..eba6a4474f 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt @@ -34,6 +34,8 @@ import io.element.android.libraries.oauth.test.customtab.FakeOAuthActionFlow import io.element.android.libraries.permissions.test.FakeLocalNetworkPermissionAdvisor import io.element.android.libraries.permissions.test.FakePermissionsPresenter import io.element.android.libraries.permissions.test.FakePermissionsPresenterFactory +import io.element.android.libraries.preferences.api.store.AppPreferencesStore +import io.element.android.libraries.preferences.test.InMemoryAppPreferencesStore import io.element.android.tests.testutils.WarmUpRule import io.element.android.tests.testutils.test import kotlinx.coroutines.test.runTest @@ -353,6 +355,48 @@ class ConfirmAccountProviderPresenterTest { } } + @Test + fun `present - offers an autocomplete suggestion from the account provider history`() = runTest { + val presenter = createConfirmAccountProviderPresenter( + appPreferencesStore = InMemoryAppPreferencesStore( + homeserverHistory = listOf("https://randomcommunity.org"), + ), + ) + presenter.test { + val initialState = awaitItem() + assertThat(initialState.accountProviderSuggestion).isNull() + initialState.eventSink(ConfirmAccountProviderEvents.UserInputChanged("https://random")) + val suggestionState = awaitState { it.accountProviderInput == "https://random" } + assertThat(suggestionState.accountProviderSuggestion).isEqualTo("https://randomcommunity.org") + } + } + + @Test + fun `present - continue accepts the autocomplete suggestion rather than the typed prefix`() = runTest { + val submittedUrls = mutableListOf() + val authenticationService = FakeMatrixAuthenticationService( + setHomeserverResult = { url -> + submittedUrls.add(url) + Result.success(aMatrixHomeServerDetails(supportsPasswordLogin = true)) + }, + ) + val presenter = createConfirmAccountProviderPresenter( + matrixAuthenticationService = authenticationService, + appPreferencesStore = InMemoryAppPreferencesStore( + homeserverHistory = listOf("https://randomcommunity.org"), + ), + ) + presenter.test { + val initialState = awaitItem() + initialState.eventSink(ConfirmAccountProviderEvents.UserInputChanged("https://random")) + val suggestionState = awaitState { it.accountProviderSuggestion != null } + suggestionState.eventSink(ConfirmAccountProviderEvents.Continue) + awaitLoginMode { it is AsyncData.Success } + assertThat(submittedUrls.first()).isEqualTo("https://randomcommunity.org") + cancelAndIgnoreRemainingEvents() + } + } + /** * Awaits until the emitted state's login mode matches [predicate], skipping the intermediate * account-provider validation states, and returns that state. @@ -376,9 +420,11 @@ class ConfirmAccountProviderPresenterTest { matrixAuthenticationService: MatrixAuthenticationService = FakeMatrixAuthenticationService(), defaultOAuthActionFlow: OAuthActionFlow = FakeOAuthActionFlow(), webClientUrlForAuthenticationRetriever: WebClientUrlForAuthenticationRetriever = FakeWebClientUrlForAuthenticationRetriever(), + appPreferencesStore: AppPreferencesStore = InMemoryAppPreferencesStore(), ) = ConfirmAccountProviderPresenter( params = params, accountProviderDataSource = accountProviderDataSource, + appPreferencesStore = appPreferencesStore, loginModePresenter = createLoginModePresenter( authenticationService = matrixAuthenticationService, oAuthActionFlow = defaultOAuthActionFlow, diff --git a/libraries/ui-strings/src/main/res/values/temporary.xml b/libraries/ui-strings/src/main/res/values/temporary.xml index ca01aead32..2b5788042e 100644 --- a/libraries/ui-strings/src/main/res/values/temporary.xml +++ b/libraries/ui-strings/src/main/res/values/temporary.xml @@ -13,6 +13,7 @@ "Enter your account provider" "Choose an account provider" "Account provider" + "example.com" "If your account is provided by your company or a community, then change the account provider (example: companyname.com)." "Create an account on matrix.org for free. If you want to create an account with a different provider, then change it accordingly (example: communityname.org)." From 8c2cf9d95e6e849e2c366c98a73768bbae7d3514 Mon Sep 17 00:00:00 2001 From: Jenna Vassar Date: Fri, 7 Aug 2026 08:41:59 -0700 Subject: [PATCH 007/145] Reference the Figma design on the account provider screen --- .../ConfirmAccountProviderPresenter.kt | 2 +- .../confirmaccountprovider/ConfirmAccountProviderView.kt | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt index c3f51a5177..f83bce0510 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt @@ -91,7 +91,7 @@ class ConfirmAccountProviderPresenter( userInput = event.accountProvider } // Validate (and persist) the chosen account provider before proceeding. This also enforces the - // enterprise account-provider access control, which the login submit does not do on its own. + // account-provider access control, which the login submit does not run on its own. ConfirmAccountProviderEvents.Continue -> changeServerState.eventSink( ChangeServerEvents.ChangeServer(AccountProvider(url = accountProviderToSubmit.trim())) ) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt index 470b59926b..8be8bab7e8 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt @@ -56,6 +56,12 @@ import io.element.android.libraries.testtags.TestTags import io.element.android.libraries.testtags.testTag import io.element.android.libraries.ui.strings.CommonStrings +/** + * Account provider entry screen, shared by sign in and account creation. + * Figma (Compound Android Templates): + * - Sign in: https://www.figma.com/design/pDlJZGBsri47FNTXMnEdXB/Compound-Android-Templates?node-id=41-10251 + * - Create account: https://www.figma.com/design/pDlJZGBsri47FNTXMnEdXB/Compound-Android-Templates?node-id=41-10239 + */ @Composable fun ConfirmAccountProviderView( state: ConfirmAccountProviderState, From d7e6b64265ceae0549dfe206eeb70e17979b75e4 Mon Sep 17 00:00:00 2001 From: Jenna Vassar Date: Fri, 7 Aug 2026 12:46:11 -0700 Subject: [PATCH 008/145] Dismiss the keyboard on continue and restore it after an error --- .../ConfirmAccountProviderState.kt | 4 +++ .../ConfirmAccountProviderView.kt | 33 ++++++++++++++++--- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderState.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderState.kt index a934378507..bf6b0cb0e7 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderState.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderState.kt @@ -29,4 +29,8 @@ data class ConfirmAccountProviderState( val isLoading: Boolean get() = loginModeState.loginMode is AsyncData.Loading || changeServerState.changeServerAction is AsyncData.Loading + + val isShowingError: Boolean + get() = loginModeState.loginMode is AsyncData.Failure || + changeServerState.changeServerAction is AsyncData.Failure } diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt index 8be8bab7e8..e1be11da3a 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt @@ -15,12 +15,17 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier +import androidx.compose.ui.focus.FocusRequester +import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalFocusManager +import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.res.stringResource import androidx.compose.ui.semantics.Role import androidx.compose.ui.text.AnnotatedString @@ -72,6 +77,26 @@ fun ConfirmAccountProviderView( modifier: Modifier = Modifier, ) { val eventSink = state.eventSink + val focusManager = LocalFocusManager.current + val focusRequester = remember { FocusRequester() } + val keyboardController = LocalSoftwareKeyboardController.current + + fun submit() { + // Dismiss the keyboard and release focus while the account provider is being validated. + focusManager.clearFocus(force = true) + eventSink(ConfirmAccountProviderEvents.Continue) + } + + // Once a validation / login error has been dismissed, return focus and the keyboard to the field so + // the user can correct the account provider and retry. + var wasShowingError by remember { mutableStateOf(false) } + LaunchedEffect(state.isShowingError) { + if (wasShowingError && !state.isShowingError) { + focusRequester.requestFocus() + keyboardController?.show() + } + wasShowingError = state.isShowingError + } HeaderFooterPage( modifier = modifier, @@ -94,7 +119,7 @@ fun ConfirmAccountProviderView( Button( text = stringResource(id = CommonStrings.action_continue), showProgress = state.isLoading, - onClick = { eventSink(ConfirmAccountProviderEvents.Continue) }, + onClick = ::submit, enabled = state.submitEnabled && !state.isLoading, modifier = Modifier .fillMaxWidth() @@ -104,7 +129,6 @@ fun ConfirmAccountProviderView( } ) { var input by textFieldState(stateValue = state.accountProviderInput) - val focusManager = LocalFocusManager.current // Inline autocomplete: render the un-typed remainder of the suggested account provider in grey. val suggestionSuffix = state.accountProviderSuggestion ?.takeIf { it.length > input.length && it.startsWith(input, ignoreCase = true) } @@ -123,6 +147,7 @@ fun ConfirmAccountProviderView( modifier = Modifier .fillMaxWidth() .padding(top = 40.dp) + .focusRequester(focusRequester) .onTabOrEnterKeyFocusNext(focusManager) .testTag(TestTags.changeServerServer), label = stringResource(id = CommonStrings.screen_select_server_textfield_header), @@ -139,9 +164,7 @@ fun ConfirmAccountProviderView( keyboardType = KeyboardType.Uri, imeAction = ImeAction.Done, ), - keyboardActions = KeyboardActions(onDone = { - eventSink(ConfirmAccountProviderEvents.Continue) - }), + keyboardActions = KeyboardActions(onDone = { submit() }), singleLine = true, trailingIcon = if (input.isNotEmpty()) { { From de0e628512fc121021ff12e7f040f3c8dd977052 Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Sun, 9 Aug 2026 03:51:20 +0300 Subject: [PATCH 009/145] Show the account a UnifiedPush registration belongs to in the distributor A distributor such as ntfy or DAVx5 lists every registration it holds, but Element registered each one with no message for the distributor, so an account added from a second session was indistinguishable from the first. RegisterUnifiedPushUseCase.execute now takes the session id and passes it as messageForDistributor, which the connector has accepted since 3.x. The value is the raw Matrix ID, which is not personal data by the project's own logging rules, and no new string resource is needed. UnifiedPushProvider already has the MatrixClient in hand at the only call site, so the PushProvider interface is unchanged and nothing outside the module moves. Relates to https://github.com/element-hq/element-x-android/issues/6426 --- .../unifiedpush/RegisterUnifiedPushUseCase.kt | 10 +++++++--- .../pushproviders/unifiedpush/UnifiedPushProvider.kt | 2 +- .../DefaultRegisterUnifiedPushUseCaseTest.kt | 7 ++++--- .../unifiedpush/FakeRegisterUnifiedPushUseCase.kt | 7 ++++--- .../unifiedpush/UnifiedPushProviderTest.kt | 8 ++++---- 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/libraries/pushproviders/unifiedpush/src/main/kotlin/io/element/android/libraries/pushproviders/unifiedpush/RegisterUnifiedPushUseCase.kt b/libraries/pushproviders/unifiedpush/src/main/kotlin/io/element/android/libraries/pushproviders/unifiedpush/RegisterUnifiedPushUseCase.kt index 00e5649533..d76d69a653 100644 --- a/libraries/pushproviders/unifiedpush/src/main/kotlin/io/element/android/libraries/pushproviders/unifiedpush/RegisterUnifiedPushUseCase.kt +++ b/libraries/pushproviders/unifiedpush/src/main/kotlin/io/element/android/libraries/pushproviders/unifiedpush/RegisterUnifiedPushUseCase.kt @@ -12,6 +12,7 @@ import android.content.Context import dev.zacsweers.metro.AppScope import dev.zacsweers.metro.ContributesBinding import io.element.android.libraries.di.annotations.ApplicationContext +import io.element.android.libraries.matrix.api.core.SessionId import io.element.android.libraries.pushproviders.api.Distributor import io.element.android.libraries.pushproviders.unifiedpush.registration.EndpointRegistrationHandler import kotlinx.coroutines.flow.filter @@ -21,7 +22,7 @@ import org.unifiedpush.android.connector.UnifiedPush import kotlin.time.Duration.Companion.seconds interface RegisterUnifiedPushUseCase { - suspend fun execute(distributor: Distributor, clientSecret: String): Result + suspend fun execute(distributor: Distributor, clientSecret: String, sessionId: SessionId): Result } @ContributesBinding(AppScope::class) @@ -29,11 +30,14 @@ class DefaultRegisterUnifiedPushUseCase( @ApplicationContext private val context: Context, private val endpointRegistrationHandler: EndpointRegistrationHandler, ) : RegisterUnifiedPushUseCase { - override suspend fun execute(distributor: Distributor, clientSecret: String): Result { + override suspend fun execute(distributor: Distributor, clientSecret: String, sessionId: SessionId): Result { UnifiedPush.saveDistributor(context, distributor.value) // This will trigger the callback // VectorUnifiedPushMessagingReceiver.onNewEndpoint - UnifiedPush.register(context = context, instance = clientSecret) + // The session id is passed as the message for the distributor, so that its UI can tell one + // registration from another when several accounts are registered. + // See https://github.com/element-hq/element-x-android/issues/6426 + UnifiedPush.register(context = context, instance = clientSecret, messageForDistributor = sessionId.value) // Wait for VectorUnifiedPushMessagingReceiver.onNewEndpoint to proceed @Suppress("RunCatchingNotAllowed") return runCatching { diff --git a/libraries/pushproviders/unifiedpush/src/main/kotlin/io/element/android/libraries/pushproviders/unifiedpush/UnifiedPushProvider.kt b/libraries/pushproviders/unifiedpush/src/main/kotlin/io/element/android/libraries/pushproviders/unifiedpush/UnifiedPushProvider.kt index 7288fccab2..f72a591faa 100644 --- a/libraries/pushproviders/unifiedpush/src/main/kotlin/io/element/android/libraries/pushproviders/unifiedpush/UnifiedPushProvider.kt +++ b/libraries/pushproviders/unifiedpush/src/main/kotlin/io/element/android/libraries/pushproviders/unifiedpush/UnifiedPushProvider.kt @@ -36,7 +36,7 @@ class UnifiedPushProvider( override suspend fun registerWith(matrixClient: MatrixClient, distributor: Distributor): Result { val clientSecret = pushClientSecret.getSecretForUser(matrixClient.sessionId) - return registerUnifiedPushUseCase.execute(distributor, clientSecret) + return registerUnifiedPushUseCase.execute(distributor, clientSecret, matrixClient.sessionId) .onSuccess { unifiedPushStore.setDistributorValue(matrixClient.sessionId, distributor.value) } diff --git a/libraries/pushproviders/unifiedpush/src/test/kotlin/io/element/android/libraries/pushproviders/unifiedpush/DefaultRegisterUnifiedPushUseCaseTest.kt b/libraries/pushproviders/unifiedpush/src/test/kotlin/io/element/android/libraries/pushproviders/unifiedpush/DefaultRegisterUnifiedPushUseCaseTest.kt index fe7da75951..5460005cef 100644 --- a/libraries/pushproviders/unifiedpush/src/test/kotlin/io/element/android/libraries/pushproviders/unifiedpush/DefaultRegisterUnifiedPushUseCaseTest.kt +++ b/libraries/pushproviders/unifiedpush/src/test/kotlin/io/element/android/libraries/pushproviders/unifiedpush/DefaultRegisterUnifiedPushUseCaseTest.kt @@ -12,6 +12,7 @@ import androidx.test.platform.app.InstrumentationRegistry import com.google.common.truth.Truth.assertThat import io.element.android.libraries.matrix.test.AN_EXCEPTION import io.element.android.libraries.matrix.test.A_SECRET +import io.element.android.libraries.matrix.test.A_SESSION_ID import io.element.android.libraries.pushproviders.api.Distributor import io.element.android.libraries.pushproviders.unifiedpush.registration.EndpointRegistrationHandler import io.element.android.libraries.pushproviders.unifiedpush.registration.RegistrationResult @@ -41,7 +42,7 @@ class DefaultRegisterUnifiedPushUseCaseTest : RobolectricTest() { delay(100) endpointRegistrationHandler.registrationDone(RegistrationResult(A_SECRET, Result.success(Unit))) } - val result = useCase.execute(aDistributor, A_SECRET) + val result = useCase.execute(aDistributor, A_SECRET, A_SESSION_ID) assertThat(result.isSuccess).isTrue() } @@ -56,7 +57,7 @@ class DefaultRegisterUnifiedPushUseCaseTest : RobolectricTest() { delay(100) endpointRegistrationHandler.registrationDone(RegistrationResult(A_SECRET, Result.failure(AN_EXCEPTION))) } - val result = useCase.execute(aDistributor, A_SECRET) + val result = useCase.execute(aDistributor, A_SECRET, A_SESSION_ID) assertThat(result.isSuccess).isFalse() } @@ -67,7 +68,7 @@ class DefaultRegisterUnifiedPushUseCaseTest : RobolectricTest() { endpointRegistrationHandler = endpointRegistrationHandler ) val aDistributor = Distributor("aValue", "aName") - val result = useCase.execute(aDistributor, A_SECRET) + val result = useCase.execute(aDistributor, A_SECRET, A_SESSION_ID) assertThat(result.isSuccess).isFalse() } diff --git a/libraries/pushproviders/unifiedpush/src/test/kotlin/io/element/android/libraries/pushproviders/unifiedpush/FakeRegisterUnifiedPushUseCase.kt b/libraries/pushproviders/unifiedpush/src/test/kotlin/io/element/android/libraries/pushproviders/unifiedpush/FakeRegisterUnifiedPushUseCase.kt index 3055dad6b7..55729f29f8 100644 --- a/libraries/pushproviders/unifiedpush/src/test/kotlin/io/element/android/libraries/pushproviders/unifiedpush/FakeRegisterUnifiedPushUseCase.kt +++ b/libraries/pushproviders/unifiedpush/src/test/kotlin/io/element/android/libraries/pushproviders/unifiedpush/FakeRegisterUnifiedPushUseCase.kt @@ -8,13 +8,14 @@ package io.element.android.libraries.pushproviders.unifiedpush +import io.element.android.libraries.matrix.api.core.SessionId import io.element.android.libraries.pushproviders.api.Distributor import io.element.android.tests.testutils.lambda.lambdaError class FakeRegisterUnifiedPushUseCase( - private val result: (Distributor, String) -> Result = { _, _ -> lambdaError() } + private val result: (Distributor, String, SessionId) -> Result = { _, _, _ -> lambdaError() } ) : RegisterUnifiedPushUseCase { - override suspend fun execute(distributor: Distributor, clientSecret: String): Result { - return result(distributor, clientSecret) + override suspend fun execute(distributor: Distributor, clientSecret: String, sessionId: SessionId): Result { + return result(distributor, clientSecret, sessionId) } } diff --git a/libraries/pushproviders/unifiedpush/src/test/kotlin/io/element/android/libraries/pushproviders/unifiedpush/UnifiedPushProviderTest.kt b/libraries/pushproviders/unifiedpush/src/test/kotlin/io/element/android/libraries/pushproviders/unifiedpush/UnifiedPushProviderTest.kt index e22c1c3bf4..e766068783 100644 --- a/libraries/pushproviders/unifiedpush/src/test/kotlin/io/element/android/libraries/pushproviders/unifiedpush/UnifiedPushProviderTest.kt +++ b/libraries/pushproviders/unifiedpush/src/test/kotlin/io/element/android/libraries/pushproviders/unifiedpush/UnifiedPushProviderTest.kt @@ -62,7 +62,7 @@ class UnifiedPushProviderTest { @Test fun `register ok`() = runTest { val getSecretForUserResultLambda = lambdaRecorder { A_SECRET } - val executeLambda = lambdaRecorder> { _, _ -> Result.success(Unit) } + val executeLambda = lambdaRecorder> { _, _, _ -> Result.success(Unit) } val setDistributorValueResultLambda = lambdaRecorder { _, _ -> } val unifiedPushProvider = createUnifiedPushProvider( pushClientSecret = FakePushClientSecret( @@ -82,7 +82,7 @@ class UnifiedPushProviderTest { .with(value(A_SESSION_ID)) executeLambda.assertions() .isCalledOnce() - .with(value(Distributor("value", "Name")), value(A_SECRET)) + .with(value(Distributor("value", "Name")), value(A_SECRET), value(A_SESSION_ID)) setDistributorValueResultLambda.assertions() .isCalledOnce() .with(value(A_SESSION_ID), value("value")) @@ -91,7 +91,7 @@ class UnifiedPushProviderTest { @Test fun `register ko`() = runTest { val getSecretForUserResultLambda = lambdaRecorder { A_SECRET } - val executeLambda = lambdaRecorder> { _, _ -> Result.failure(AN_EXCEPTION) } + val executeLambda = lambdaRecorder> { _, _, _ -> Result.failure(AN_EXCEPTION) } val setDistributorValueResultLambda = lambdaRecorder(ensureNeverCalled = true) { _, _ -> } val unifiedPushProvider = createUnifiedPushProvider( pushClientSecret = FakePushClientSecret( @@ -111,7 +111,7 @@ class UnifiedPushProviderTest { .with(value(A_SESSION_ID)) executeLambda.assertions() .isCalledOnce() - .with(value(Distributor("value", "Name")), value(A_SECRET)) + .with(value(Distributor("value", "Name")), value(A_SECRET), value(A_SESSION_ID)) } @Test From b5e95e27d495a56d1572c2b6f73644904d28178c Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Sun, 9 Aug 2026 03:51:38 +0300 Subject: [PATCH 010/145] Do not group timeline messages sent more than five minutes apart Consecutive messages from the same sender were grouped into one bubble block no matter how far apart they were sent, so a reply hours later looked like part of the earlier burst and lost its own timestamp header. computeGroupPosition now folds a five minute limit into the two groupability flags it already computes. The delta is symmetric between a pair of neighbours, so both items always agree on where the block splits and every branch of the existing decision table keeps working unchanged. Breaking a group on reactions, which the iOS client also does, is a separate divergence and is not part of this. Relates to https://github.com/element-hq/element-x-android/issues/4757 --- .../event/TimelineItemEventFactory.kt | 17 ++- .../factories/TimelineItemsFactoryTest.kt | 124 ++++++++++++++++++ 2 files changed, 139 insertions(+), 2 deletions(-) create mode 100644 features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/timeline/factories/TimelineItemsFactoryTest.kt diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/factories/event/TimelineItemEventFactory.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/factories/event/TimelineItemEventFactory.kt index f29f23e903..d0aecbb8a0 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/factories/event/TimelineItemEventFactory.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/factories/event/TimelineItemEventFactory.kt @@ -38,6 +38,9 @@ import io.element.android.libraries.matrix.ui.messages.reply.map import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.toImmutableList +/** Events further apart than this are never grouped together, even when sent by the same person. */ +private const val GROUPING_TIMEOUT_MS = 5 * 60 * 1000L + @AssistedInject class TimelineItemEventFactory( @Assisted private val config: TimelineItemsFactoryConfig, @@ -221,8 +224,18 @@ class TimelineItemEventFactory( val previousSender = prevTimelineItem?.event?.sender val nextSender = nextTimelineItem?.event?.sender - val previousIsGroupable = prevTimelineItem?.canBeDisplayedInBubbleBlock().orTrue() - val nextIsGroupable = nextTimelineItem?.canBeDisplayedInBubbleBlock().orTrue() + // Two events from the same sender are only grouped together if they were sent within + // GROUPING_TIMEOUT_MS of each other. The delta is symmetric between a pair of neighbours, so + // both items always agree on where the group is split. + // See https://github.com/element-hq/element-x-android/issues/4757 + val previousIsGroupable = prevTimelineItem?.let { + it.canBeDisplayedInBubbleBlock() && + currentTimelineItem.event.timestamp - it.event.timestamp <= GROUPING_TIMEOUT_MS + }.orTrue() + val nextIsGroupable = nextTimelineItem?.let { + it.canBeDisplayedInBubbleBlock() && + it.event.timestamp - currentTimelineItem.event.timestamp <= GROUPING_TIMEOUT_MS + }.orTrue() return when { previousSender != currentSender && nextSender == currentSender -> { diff --git a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/timeline/factories/TimelineItemsFactoryTest.kt b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/timeline/factories/TimelineItemsFactoryTest.kt new file mode 100644 index 0000000000..0000ea1f07 --- /dev/null +++ b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/timeline/factories/TimelineItemsFactoryTest.kt @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2026 Element Creations Ltd. + * + * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. + * Please see LICENSE files in the repository root for full details. + */ + +package io.element.android.features.messages.impl.timeline.factories + +import app.cash.turbine.test +import com.google.common.truth.Truth.assertThat +import io.element.android.features.messages.impl.fixtures.aTimelineItemsFactory +import io.element.android.features.messages.impl.timeline.model.TimelineItem +import io.element.android.features.messages.impl.timeline.model.TimelineItemGroupPosition +import io.element.android.libraries.matrix.api.core.UniqueId +import io.element.android.libraries.matrix.api.timeline.MatrixTimelineItem +import io.element.android.libraries.matrix.test.A_USER_ID +import io.element.android.libraries.matrix.test.timeline.aMessageContent +import io.element.android.libraries.matrix.test.timeline.anEventTimelineItem +import kotlinx.coroutines.test.TestScope +import kotlinx.coroutines.test.runTest +import org.junit.Test + +class TimelineItemsFactoryTest { + @Test + fun `messages sent close together are grouped`() = runTest { + val positions = groupPositionsOf( + timestamps = listOf(0L, ONE_MINUTE, 2 * ONE_MINUTE), + ) + assertThat(positions).containsExactly( + TimelineItemGroupPosition.First, + TimelineItemGroupPosition.Middle, + TimelineItemGroupPosition.Last, + ).inOrder() + } + + @Test + fun `messages sent more than five minutes apart are not grouped`() = runTest { + val positions = groupPositionsOf( + timestamps = listOf(0L, 6 * ONE_MINUTE, 12 * ONE_MINUTE), + ) + assertThat(positions).containsExactly( + TimelineItemGroupPosition.None, + TimelineItemGroupPosition.None, + TimelineItemGroupPosition.None, + ).inOrder() + } + + @Test + fun `a gap of more than five minutes splits the group`() = runTest { + val positions = groupPositionsOf( + timestamps = listOf(0L, ONE_MINUTE, 8 * ONE_MINUTE, 9 * ONE_MINUTE), + ) + assertThat(positions).containsExactly( + TimelineItemGroupPosition.First, + TimelineItemGroupPosition.Last, + TimelineItemGroupPosition.First, + TimelineItemGroupPosition.Last, + ).inOrder() + } + + @Test + fun `a gap of exactly five minutes still groups`() = runTest { + val positions = groupPositionsOf( + timestamps = listOf(0L, FIVE_MINUTES), + ) + assertThat(positions).containsExactly( + TimelineItemGroupPosition.First, + TimelineItemGroupPosition.Last, + ).inOrder() + } + + @Test + fun `messages with the same timestamp are grouped`() = runTest { + val positions = groupPositionsOf( + timestamps = listOf(0L, 0L, 0L), + ) + assertThat(positions).containsExactly( + TimelineItemGroupPosition.First, + TimelineItemGroupPosition.Middle, + TimelineItemGroupPosition.Last, + ).inOrder() + } + + private suspend fun TestScope.groupPositionsOf(timestamps: List): List { + val factory = aTimelineItemsFactory( + config = TimelineItemsFactoryConfig( + computeReadReceipts = false, + computeReactions = false, + ) + ) + val items = timestamps.mapIndexed { index, timestamp -> + MatrixTimelineItem.Event( + uniqueId = UniqueId("event-$index"), + event = anEventTimelineItem( + sender = A_USER_ID, + timestamp = timestamp, + content = aMessageContent(body = "Message $index"), + ), + ) + } + var positions: List = emptyList() + factory.timelineItems.test { + factory.replaceWith( + timelineItems = items, + roomMembers = emptyList(), + renderReadReceipts = false, + ) + // The factory emits the timeline newest-first; reverse it so the assertions below read + // in the same chronological order as the timestamps that were fed in. + positions = awaitItem() + .filterIsInstance() + .map { it.groupPosition } + .reversed() + cancelAndIgnoreRemainingEvents() + } + return positions + } + + private companion object { + const val ONE_MINUTE = 60 * 1000L + const val FIVE_MINUTES = 5 * ONE_MINUTE + } +} From 0ccb9b23ccb1dd9901d5d3f41cb0731ba3a94be2 Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Sun, 9 Aug 2026 03:51:38 +0300 Subject: [PATCH 011/145] Linkify URLs whose host is a bracketed IPv6 address Patterns.WEB_URL, which LinkifyCompat uses to find links, has no production for a bracketed IPv6 authority, so a URL such as http://[2001:db8::1]:8008/path was never turned into a link. Worse, the phone number matcher claimed the digit runs inside the address, leaving a tel: link over part of it. LinkifyHelper now runs its own pass for those URLs. It requires both a scheme and the brackets, so array syntax like values[0]:1 is not matched, and it runs after LinkifyCompat.addLinks, which strips any span set before it, but before the pre-existing spans are restored, so real anchors and pill spans keep their precedence. Any span Linkify left inside the address is evicted, and the same trailing punctuation trimming as the other links is applied. Relates to https://github.com/element-hq/element-x-android/issues/2614 --- .../androidutils/text/LinkifyHelper.kt | 27 ++++++++++++++ .../androidutils/text/LinkifierHelperTest.kt | 37 +++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/libraries/androidutils/src/main/kotlin/io/element/android/libraries/androidutils/text/LinkifyHelper.kt b/libraries/androidutils/src/main/kotlin/io/element/android/libraries/androidutils/text/LinkifyHelper.kt index 441f819546..03dde18006 100644 --- a/libraries/androidutils/src/main/kotlin/io/element/android/libraries/androidutils/text/LinkifyHelper.kt +++ b/libraries/androidutils/src/main/kotlin/io/element/android/libraries/androidutils/text/LinkifyHelper.kt @@ -23,6 +23,12 @@ import timber.log.Timber * It also checks the linkified results to make sure URLs spans are not including trailing punctuation. */ object LinkifyHelper { + /** + * Matches a URL whose authority is a bracketed IPv6 address, i.e. `http://[2001:db8::1]:8008/path`. + * A scheme and the brackets are both required, so array syntax such as `values[0]:1` is not matched. + */ + private val IPV6_URL_REGEX = Regex("""(?i)\b(?:https?|ftp)://\[[0-9a-f:.]+(?:%25[0-9a-z._-]+)?](?::\d{1,5})?(?:/\S*)?""") + fun linkify( text: CharSequence, @LinkifyCompat.LinkifyMask linkifyMask: Int = Linkify.WEB_URLS or Linkify.PHONE_NUMBERS or Linkify.EMAIL_ADDRESSES, @@ -67,6 +73,27 @@ object LinkifyHelper { } } + // Patterns.WEB_URL, which LinkifyCompat uses, has no production for a bracketed IPv6 + // authority, so such a URL is never linkified — and worse, the phone-number matcher claims + // the digit runs inside the address. Add the links here, after addLinks (which strips any + // span set before it) and before the old spans are restored, so real and pill + // spans still win. See https://github.com/element-hq/element-x-android/issues/2614 + for (match in IPV6_URL_REGEX.findAll(spannable)) { + val start = match.range.first + val end = match.range.last + 1 + val newEnd = runCatchingExceptions { + adjustLinkifiedUrlSpanEndIndex(spannable, start, end) + }.onFailure { + Timber.e(it, "Failed to adjust end index for IPv6 link span") + }.getOrNull() ?: end + + // Evict whatever Linkify put inside the address, typically a tel: span. + for (span in spannable.getSpans(start, newEnd)) { + spannable.removeSpan(span) + } + spannable.setSpan(URLSpan(spannable.substring(start, newEnd)), start, newEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) + } + // Restore old spans, remove new ones if there is a conflict for ((urlSpan, location) in oldURLSpans) { val (start, end) = location diff --git a/libraries/androidutils/src/test/kotlin/io/element/android/libraries/androidutils/text/LinkifierHelperTest.kt b/libraries/androidutils/src/test/kotlin/io/element/android/libraries/androidutils/text/LinkifierHelperTest.kt index bb7a272908..47e6b1a933 100644 --- a/libraries/androidutils/src/test/kotlin/io/element/android/libraries/androidutils/text/LinkifierHelperTest.kt +++ b/libraries/androidutils/src/test/kotlin/io/element/android/libraries/androidutils/text/LinkifierHelperTest.kt @@ -36,6 +36,43 @@ class LinkifierHelperTest : RobolectricTest() { assertThat(urlSpans.first().url).isEqualTo("https://matrix.org") } + @Test + fun `linkification finds ipv6 URL`() { + val text = "A url http://[2001:db8::1]:8008/path" + val result = LinkifyHelper.linkify(text) + val urlSpans = result.toSpannable().getSpans() + assertThat(urlSpans.size).isEqualTo(1) + assertThat(urlSpans.first().url).isEqualTo("http://[2001:db8::1]:8008/path") + } + + @Test + @Config(sdk = [30]) + fun `linkification of an ipv6 URL does not leave a phone number span`() { + shadowOf(newInstanceOf(TelephonyManager::class.java)).setSimCountryIso("DE") + val text = "A url http://[2001:db8::1]:8008/path" + val result = LinkifyHelper.linkify(text) + val urlSpans = result.toSpannable().getSpans() + assertThat(urlSpans.size).isEqualTo(1) + assertThat(urlSpans.first().url).isEqualTo("http://[2001:db8::1]:8008/path") + } + + @Test + fun `linkification of an ipv6 URL trims trailing punctuation`() { + val text = "A url http://[::1]/x." + val result = LinkifyHelper.linkify(text) + val urlSpans = result.toSpannable().getSpans() + assertThat(urlSpans.size).isEqualTo(1) + assertThat(urlSpans.first().url).isEqualTo("http://[::1]/x") + } + + @Test + fun `linkification ignores bracketed text which is not a URL`() { + val text = "An array values[0]:1 and a bare [::1]" + val result = LinkifyHelper.linkify(text) + val urlSpans = result.toSpannable().getSpans() + assertThat(urlSpans).isEmpty() + } + @Test fun `linkification finds partial URL`() { val text = "A partial url matrix.org/test" From 1024323661be48ce63d2187f9d8fec0c21030bf0 Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Sun, 9 Aug 2026 04:09:10 +0300 Subject: [PATCH 012/145] Send a message with Enter on a physical keyboard, Shift+Enter for a new line With a hardware keyboard attached, Enter inserted a newline and the only way to send was to reach for the send button, which is the opposite of what every desktop chat client does. MarkdownEditText gains an optional Enter listener and consumes Enter when it comes from a physical keyboard without Shift. Shift+Enter keeps inserting a newline, and a key event from the on-screen keyboard is identified by its VIRTUAL_KEYBOARD device id and left alone, so nothing changes for touch users. The key release is consumed as well, so no newline leaks out on key repeat. TextComposer passes its existing send lambda through, guarded by the same canSendTextMessage check the send button already uses, so Enter cannot send an empty message. Relates to https://github.com/element-hq/element-x-android/issues/860 --- .../libraries/textcomposer/TextComposer.kt | 5 +- .../components/markdown/MarkdownEditText.kt | 27 ++++++++ .../components/markdown/MarkdownTextInput.kt | 8 +++ .../markdown/MarkdownTextInputTest.kt | 68 +++++++++++++++++++ 4 files changed, 106 insertions(+), 2 deletions(-) diff --git a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/TextComposer.kt b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/TextComposer.kt index 0f62eb5234..91b897c284 100644 --- a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/TextComposer.kt +++ b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/TextComposer.kt @@ -160,6 +160,8 @@ fun TextComposer( } else { stringResource(id = R.string.rich_text_editor_composer_placeholder) } + val canSendTextMessage = markdown.isNotBlank() || composerMode is MessageComposerMode.Attachment + val textInput: @Composable () -> Unit = when (state) { is TextEditorState.Rich -> { val coroutineScope = rememberCoroutineScope() @@ -218,14 +220,13 @@ fun TextComposer( onReceiveSuggestion = onReceiveSuggestion, richTextEditorStyle = style, onSelectRichContent = onSelectRichContent, + onSendMessage = { if (canSendTextMessage) onSendMessage() }, ) } } } } - val canSendTextMessage = markdown.isNotBlank() || composerMode is MessageComposerMode.Attachment - val textFormattingOptions: @Composable (() -> Unit)? = (state as? TextEditorState.Rich)?.let { @Composable { TextFormatting(state = it.richTextEditorState) } } diff --git a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/components/markdown/MarkdownEditText.kt b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/components/markdown/MarkdownEditText.kt index bd808c9acb..b8d173aaa8 100644 --- a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/components/markdown/MarkdownEditText.kt +++ b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/components/markdown/MarkdownEditText.kt @@ -9,6 +9,8 @@ package io.element.android.libraries.textcomposer.components.markdown import android.content.Context +import android.view.KeyCharacterMap +import android.view.KeyEvent import android.view.View import androidx.appcompat.widget.AppCompatEditText @@ -17,8 +19,33 @@ internal class MarkdownEditText( ) : AppCompatEditText(context) { var onSelectionChangeListener: ((Int, Int) -> Unit)? = null + /** + * Invoked when Enter is pressed on a physical keyboard without Shift. Return true to consume the + * key, i.e. to send instead of inserting a newline. + */ + var onEnterKeyListener: (() -> Boolean)? = null + private var isModifyingText = false + override fun dispatchKeyEvent(event: KeyEvent): Boolean { + if (event.keyCode == KeyEvent.KEYCODE_ENTER && + !event.isShiftPressed && + // A soft keyboard must keep inserting a newline, only a real one sends. + event.deviceId != KeyCharacterMap.VIRTUAL_KEYBOARD + ) { + val listener = onEnterKeyListener + if (listener != null) { + return when (event.action) { + // Consume the release too, so no newline leaks out on key repeat. + KeyEvent.ACTION_UP -> true + KeyEvent.ACTION_DOWN -> if (event.repeatCount == 0) listener() else true + else -> super.dispatchKeyEvent(event) + } + } + } + return super.dispatchKeyEvent(event) + } + fun updateEditableText(charSequence: CharSequence) { isModifyingText = true editableText.clear() diff --git a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/components/markdown/MarkdownTextInput.kt b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/components/markdown/MarkdownTextInput.kt index 064ef03106..adb026d812 100644 --- a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/components/markdown/MarkdownTextInput.kt +++ b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/components/markdown/MarkdownTextInput.kt @@ -54,6 +54,7 @@ fun MarkdownTextInput( onReceiveSuggestion: (Suggestion?) -> Unit, richTextEditorStyle: RichTextEditorStyle, onSelectRichContent: ((Uri) -> Unit)?, + onSendMessage: (() -> Unit)? = null, ) { // Copied from io.element.android.wysiwyg.internal.utils.UriContentListener class ReceiveUriContentListener( @@ -132,6 +133,13 @@ fun MarkdownTextInput( update = { editText -> editText.contentDescription = placeholder editText.applyStyleInCompose(richTextEditorStyle) + // Set here rather than in the factory, which runs once and would capture a stale lambda. + editText.onEnterKeyListener = onSendMessage?.let { send -> + { + send() + true + } + } val text = state.text.value() mentionSpanUpdater.updateMentionSpans(text) if (state.text.needsDisplaying()) { diff --git a/libraries/textcomposer/impl/src/test/kotlin/io/element/android/libraries/textcomposer/impl/components/markdown/MarkdownTextInputTest.kt b/libraries/textcomposer/impl/src/test/kotlin/io/element/android/libraries/textcomposer/impl/components/markdown/MarkdownTextInputTest.kt index ba49428cae..49206775ac 100644 --- a/libraries/textcomposer/impl/src/test/kotlin/io/element/android/libraries/textcomposer/impl/components/markdown/MarkdownTextInputTest.kt +++ b/libraries/textcomposer/impl/src/test/kotlin/io/element/android/libraries/textcomposer/impl/components/markdown/MarkdownTextInputTest.kt @@ -10,6 +10,8 @@ package io.element.android.libraries.textcomposer.impl.components.markdown +import android.view.KeyCharacterMap +import android.view.KeyEvent import android.widget.EditText import androidx.activity.ComponentActivity import androidx.compose.ui.test.AndroidComposeUiTest @@ -32,12 +34,51 @@ import io.element.android.libraries.textcomposer.model.MarkdownTextEditorState import io.element.android.libraries.textcomposer.model.Suggestion import io.element.android.libraries.textcomposer.model.SuggestionType import io.element.android.libraries.textcomposer.model.aMarkdownTextEditorState +import io.element.android.tests.testutils.EnsureCalledOnce import io.element.android.tests.testutils.EnsureCalledOnceWithParam import io.element.android.tests.testutils.EventsRecorder import io.element.android.tests.testutils.robolectric.RobolectricTest import org.junit.Test class MarkdownTextInputTest : RobolectricTest() { + @Test + fun `pressing enter on a physical keyboard sends the message`() = runAndroidComposeUiTest { + val state = aMarkdownTextEditorState(initialText = "Hello", initialFocus = true) + val onSendMessage = EnsureCalledOnce() + setMarkdownTextInput(state = state, onSendMessage = onSendMessage) + val editor = activity!!.findEditor() + editor.pressEnter() + awaitIdle() + onSendMessage.assertSuccess() + assertThat(editor.editableText.toString()).isEqualTo("Hello") + } + + @Test + fun `pressing shift enter on a physical keyboard inserts a new line`() = runAndroidComposeUiTest { + val state = aMarkdownTextEditorState(initialText = "Hello", initialFocus = true) + var sendCount = 0 + setMarkdownTextInput(state = state, onSendMessage = { sendCount++ }) + val editor = activity!!.findEditor() + editor.setSelection(editor.editableText.length) + editor.pressEnter(metaState = KeyEvent.META_SHIFT_ON) + awaitIdle() + assertThat(sendCount).isEqualTo(0) + assertThat(editor.editableText.toString()).isEqualTo("Hello\n") + } + + @Test + fun `pressing enter on the soft keyboard does not send the message`() = runAndroidComposeUiTest { + val state = aMarkdownTextEditorState(initialText = "Hello", initialFocus = true) + var sendCount = 0 + setMarkdownTextInput(state = state, onSendMessage = { sendCount++ }) + val editor = activity!!.findEditor() + editor.setSelection(editor.editableText.length) + editor.pressEnter(deviceId = KeyCharacterMap.VIRTUAL_KEYBOARD) + awaitIdle() + assertThat(sendCount).isEqualTo(0) + assertThat(editor.editableText.toString()).isEqualTo("Hello\n") + } + @Test fun `when user types onTyping is triggered with value 'true'`() = runAndroidComposeUiTest { val state = aMarkdownTextEditorState(initialFocus = true) @@ -150,6 +191,7 @@ class MarkdownTextInputTest : RobolectricTest() { state: MarkdownTextEditorState = aMarkdownTextEditorState(), onTyping: (Boolean) -> Unit = {}, onSuggestionReceived: (Suggestion?) -> Unit = {}, + onSendMessage: (() -> Unit)? = null, ) { setContent { val style = ElementRichTextEditorStyle.composerStyle(hasFocus = state.hasFocus) @@ -161,6 +203,27 @@ class MarkdownTextInputTest : RobolectricTest() { onReceiveSuggestion = onSuggestionReceived, richTextEditorStyle = style, onSelectRichContent = null, + onSendMessage = onSendMessage, + ) + } + } + + private fun EditText.pressEnter( + metaState: Int = 0, + deviceId: Int = PHYSICAL_KEYBOARD_DEVICE_ID, + ) { + listOf(KeyEvent.ACTION_DOWN, KeyEvent.ACTION_UP).forEach { action -> + dispatchKeyEvent( + KeyEvent( + 0L, + 0L, + action, + KeyEvent.KEYCODE_ENTER, + 0, + metaState, + deviceId, + 0, + ) ) } } @@ -168,4 +231,9 @@ class MarkdownTextInputTest : RobolectricTest() { private fun ComponentActivity.findEditor(): EditText { return window.decorView.findViewWithTag(TestTags.plainTextEditor.value) } + + private companion object { + // Any device id other than KeyCharacterMap.VIRTUAL_KEYBOARD is a real keyboard. + const val PHYSICAL_KEYBOARD_DEVICE_ID = 1 + } } From 4b85e2d31ef2579e3876724b00dd579219b9f5e2 Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Sun, 9 Aug 2026 04:09:10 +0300 Subject: [PATCH 013/145] Turn a matrix: URI in a message into a pill A permalink written as a matrix: URI stayed plain text, while the same link in matrix.to form became a pill. The pillifier only scanned Patterns.WEB_URL, which cannot match a URI with no web scheme, even though the permalink parser already understands matrix: URIs. Those URIs are now scanned for as well, before the web pass, since Patterns.WEB_URL otherwise claims the bare domain inside the URI and whichever pass runs first wins the range. Each match also gets a URLSpan: the timeline only reports URLSpans as clicks, so without one the pill would look right and do nothing. The composer path is untouched, since it pillifies without permalinks. Relates to https://github.com/element-hq/element-x-android/issues/5319 --- .../impl/utils/TextPillificationHelper.kt | 31 ++++++++ .../DefaultTextPillificationHelperTest.kt | 73 +++++++++++++++++++ 2 files changed, 104 insertions(+) diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/utils/TextPillificationHelper.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/utils/TextPillificationHelper.kt index f74d3b5f30..dbdba43340 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/utils/TextPillificationHelper.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/utils/TextPillificationHelper.kt @@ -28,6 +28,11 @@ import io.element.android.libraries.textcomposer.mentions.getMentionSpans import io.element.android.wysiwyg.view.spans.CodeBlockSpan import io.element.android.wysiwyg.view.spans.InlineCodeSpan +/** + * Matches a `matrix:` URI as defined by MSC2312, stopping before any trailing sentence punctuation. + */ +private val MATRIX_URI_REGEX = Regex("""matrix:(?:u|user|r|room|roomid|e|event)/\S*[^\s.,;:!?)]""", RegexOption.IGNORE_CASE) + interface TextPillificationHelper { fun pillify(text: CharSequence, pillifyPermalinks: Boolean = true): CharSequence } @@ -87,6 +92,9 @@ class DefaultTextPillificationHelper( } private fun pillifyPermalinks(text: SpannableStringBuilder) { + // Before the web pass: Patterns.WEB_URL matches the bare domain inside a matrix: URI, and + // whichever pass runs first wins the range. + pillifyMatrixUris(text) for (match in Patterns.WEB_URL.toRegex().findAll(text)) { val start = match.range.first val end = match.range.last + 1 @@ -99,6 +107,29 @@ class DefaultTextPillificationHelper( } } + /** + * `Patterns.WEB_URL` cannot match a `matrix:` URI, so those permalinks were left as plain text + * even though the parser understands them. See + * https://github.com/element-hq/element-x-android/issues/5319 + */ + private fun pillifyMatrixUris(text: SpannableStringBuilder) { + for (match in MATRIX_URI_REGEX.findAll(text)) { + val start = match.range.first + val end = match.range.last + 1 + if (!text.canPillify(start, end)) continue + val mentionSpan = mentionSpanProvider.getMentionSpanFor(match.value, match.value) + if (mentionSpan != null) { + text.setSpan(mentionSpan, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) + // A `matrix:` URI gets no URLSpan from linkification, and the timeline only reports + // URLSpans as clicks, so the pill would otherwise be inert. Adding it here also makes + // LinkifyHelper drop the bogus web link it would otherwise find inside the URI. + if (text.getSpans(start, end).isEmpty()) { + text.setSpan(URLSpan(match.value), start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) + } + } + } + } + private fun Spanned.canPillify(start: Int, end: Int): Boolean { if (getMentionSpans(start, end).isNotEmpty()) return false if (getSpans(start, end).isNotEmpty()) return false diff --git a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/utils/DefaultTextPillificationHelperTest.kt b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/utils/DefaultTextPillificationHelperTest.kt index 6390c2ba48..ae9f5f5715 100644 --- a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/utils/DefaultTextPillificationHelperTest.kt +++ b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/utils/DefaultTextPillificationHelperTest.kt @@ -9,6 +9,9 @@ package io.element.android.features.messages.impl.utils import android.net.Uri +import android.text.Spanned +import android.text.style.URLSpan +import androidx.core.text.getSpans import com.google.common.truth.Truth.assertThat import io.element.android.libraries.matrix.api.core.EventId import io.element.android.libraries.matrix.api.core.RoomAlias @@ -30,6 +33,76 @@ import io.element.android.tests.testutils.robolectric.RobolectricTest import org.junit.Test class DefaultTextPillificationHelperTest : RobolectricTest() { + @Test + fun `pillify - adds pills for matrix uri user links`() { + val text = "Hello matrix:u/someone:example.com" + val userId = UserId("@someone:example.com") + val helper = aTextPillificationHelper( + permalinkParser = FakePermalinkParser(result = { PermalinkData.UserLink(userId) }), + permalinkBuilder = FakePermalinkBuilder(permalinkForUserLambda = { + Result.success("https://matrix.to/#/@someone:example.com") + }), + ) + val pillified = helper.pillify(text) + val mentionSpans = pillified.getMentionSpans() + assertThat(mentionSpans).hasSize(1) + assertThat(mentionSpans.first().type).isInstanceOf(MentionType.User::class.java) + val spanned = pillified as Spanned + assertThat(spanned.getSpanStart(mentionSpans.first())).isEqualTo(text.indexOf("matrix:")) + assertThat(spanned.getSpanEnd(mentionSpans.first())).isEqualTo(text.length) + // Without a URLSpan the pill would not be clickable in the timeline. + val urlSpans = spanned.getSpans(0, spanned.length) + assertThat(urlSpans).hasLength(1) + assertThat(urlSpans.first().url).isEqualTo("matrix:u/someone:example.com") + } + + @Test + fun `pillify - adds pills for matrix uri room links`() { + val text = "Join matrix:r/room:example.com now" + val roomAlias = RoomAlias("#room:example.com") + val helper = aTextPillificationHelper( + permalinkParser = FakePermalinkParser(result = { + PermalinkData.RoomLink(roomIdOrAlias = roomAlias.toRoomIdOrAlias()) + }), + permalinkBuilder = FakePermalinkBuilder(permalinkForRoomAliasLambda = { + Result.success("https://matrix.to/#/#room:example.com") + }), + ) + val mentionSpans = helper.pillify(text).getMentionSpans() + assertThat(mentionSpans).hasSize(1) + assertThat(mentionSpans.first().type).isInstanceOf(MentionType.Room::class.java) + } + + @Test + fun `pillify - a matrix uri does not swallow trailing punctuation`() { + val text = "See matrix:u/someone:example.com." + val userId = UserId("@someone:example.com") + val helper = aTextPillificationHelper( + permalinkParser = FakePermalinkParser(result = { PermalinkData.UserLink(userId) }), + permalinkBuilder = FakePermalinkBuilder(permalinkForUserLambda = { + Result.success("https://matrix.to/#/@someone:example.com") + }), + ) + val pillified = helper.pillify(text) + val mentionSpans = pillified.getMentionSpans() + assertThat(mentionSpans).hasSize(1) + assertThat((pillified as Spanned).getSpanEnd(mentionSpans.first())).isEqualTo(text.length - 1) + } + + @Test + fun `pillify - does not pillify matrix uris when permalinks are disabled`() { + val text = "Hello matrix:u/someone:example.com" + val userId = UserId("@someone:example.com") + val helper = aTextPillificationHelper( + permalinkParser = FakePermalinkParser(result = { PermalinkData.UserLink(userId) }), + permalinkBuilder = FakePermalinkBuilder(permalinkForUserLambda = { + Result.success("https://matrix.to/#/@someone:example.com") + }), + ) + val pillified = helper.pillify(text, pillifyPermalinks = false) + assertThat(pillified.getMentionSpans()).isEmpty() + } + @Test fun `pillify - adds pills for user ids`() { val text = "A @user:server.com" From aa64f07ff0edd0b963df617533a626d1ac37504b Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Sun, 9 Aug 2026 13:11:16 +0300 Subject: [PATCH 014/145] Do not fail the screenshot recording job when there is nothing to commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit recordScreenshots.sh runs under `set -e`, and the `git commit -m "Update screenshots"` at the end of it is unconditional. When a recording run produces no diff — the common case once the snapshots are already up to date — `git commit` exits 1 with "nothing to commit, working tree clean" and takes the whole workflow down with it, reporting a red job for a successful run. Stage as before, then return early when the staged diff is empty. `set -e` is left in place: it was added deliberately so that a failed Gradle run cannot push a commit that deletes every snapshot. Using `git diff --cached --quiet` as an `if` condition is `set -e`-safe, because its non-zero "there are changes" status is consumed by the condition. The early return also skips the push, which had nothing to send. --- .github/workflows/scripts/recordScreenshots.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/scripts/recordScreenshots.sh b/.github/workflows/scripts/recordScreenshots.sh index d29353a2c2..d04ee46f72 100755 --- a/.github/workflows/scripts/recordScreenshots.sh +++ b/.github/workflows/scripts/recordScreenshots.sh @@ -78,6 +78,10 @@ else git config --local user.name "${INPUT_AUTHOR_EMAIL}" fi git add -A +if git diff --cached --quiet; then + echo "Screenshots are already up to date, nothing to commit." + exit 0 +fi git commit -m "Update screenshots" GITHUB_REPO="https://$GITHUB_ACTOR:$TOKEN@github.com/$REPO.git" From bf958e0008b6c13c426b91fc956c703bd159a883 Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Sun, 9 Aug 2026 14:42:04 +0300 Subject: [PATCH 015/145] Drop the comment above the UnifiedPush registration call Review feedback: the named `messageForDistributor` argument already says what the session id is doing there, so the comment only added noise. --- .../pushproviders/unifiedpush/RegisterUnifiedPushUseCase.kt | 3 --- 1 file changed, 3 deletions(-) diff --git a/libraries/pushproviders/unifiedpush/src/main/kotlin/io/element/android/libraries/pushproviders/unifiedpush/RegisterUnifiedPushUseCase.kt b/libraries/pushproviders/unifiedpush/src/main/kotlin/io/element/android/libraries/pushproviders/unifiedpush/RegisterUnifiedPushUseCase.kt index d76d69a653..0e1566ba59 100644 --- a/libraries/pushproviders/unifiedpush/src/main/kotlin/io/element/android/libraries/pushproviders/unifiedpush/RegisterUnifiedPushUseCase.kt +++ b/libraries/pushproviders/unifiedpush/src/main/kotlin/io/element/android/libraries/pushproviders/unifiedpush/RegisterUnifiedPushUseCase.kt @@ -34,9 +34,6 @@ class DefaultRegisterUnifiedPushUseCase( UnifiedPush.saveDistributor(context, distributor.value) // This will trigger the callback // VectorUnifiedPushMessagingReceiver.onNewEndpoint - // The session id is passed as the message for the distributor, so that its UI can tell one - // registration from another when several accounts are registered. - // See https://github.com/element-hq/element-x-android/issues/6426 UnifiedPush.register(context = context, instance = clientSecret, messageForDistributor = sessionId.value) // Wait for VectorUnifiedPushMessagingReceiver.onNewEndpoint to proceed @Suppress("RunCatchingNotAllowed") From 72cc8f848d9677d54268e1f36fa4bdfc3ca9a9b2 Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Sun, 9 Aug 2026 14:51:30 +0300 Subject: [PATCH 016/145] Drop the comments from the grouping timeout Review feedback: the constant name and the test names carry the rule. --- .../timeline/factories/event/TimelineItemEventFactory.kt | 5 ----- .../impl/timeline/factories/TimelineItemsFactoryTest.kt | 2 -- 2 files changed, 7 deletions(-) diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/factories/event/TimelineItemEventFactory.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/factories/event/TimelineItemEventFactory.kt index d0aecbb8a0..af3e18e3cc 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/factories/event/TimelineItemEventFactory.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/factories/event/TimelineItemEventFactory.kt @@ -38,7 +38,6 @@ import io.element.android.libraries.matrix.ui.messages.reply.map import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.toImmutableList -/** Events further apart than this are never grouped together, even when sent by the same person. */ private const val GROUPING_TIMEOUT_MS = 5 * 60 * 1000L @AssistedInject @@ -224,10 +223,6 @@ class TimelineItemEventFactory( val previousSender = prevTimelineItem?.event?.sender val nextSender = nextTimelineItem?.event?.sender - // Two events from the same sender are only grouped together if they were sent within - // GROUPING_TIMEOUT_MS of each other. The delta is symmetric between a pair of neighbours, so - // both items always agree on where the group is split. - // See https://github.com/element-hq/element-x-android/issues/4757 val previousIsGroupable = prevTimelineItem?.let { it.canBeDisplayedInBubbleBlock() && currentTimelineItem.event.timestamp - it.event.timestamp <= GROUPING_TIMEOUT_MS diff --git a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/timeline/factories/TimelineItemsFactoryTest.kt b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/timeline/factories/TimelineItemsFactoryTest.kt index 0000ea1f07..53c39ee530 100644 --- a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/timeline/factories/TimelineItemsFactoryTest.kt +++ b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/timeline/factories/TimelineItemsFactoryTest.kt @@ -106,8 +106,6 @@ class TimelineItemsFactoryTest { roomMembers = emptyList(), renderReadReceipts = false, ) - // The factory emits the timeline newest-first; reverse it so the assertions below read - // in the same chronological order as the timestamps that were fed in. positions = awaitItem() .filterIsInstance() .map { it.groupPosition } From cbe555009b1f6fbc216cd4193fb741e94425d94c Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Sun, 9 Aug 2026 15:09:59 +0300 Subject: [PATCH 017/145] Stop repeating messages that are already shown in a room notification A room notification is rebuilt from the one currently on screen: its messaging style is extracted and the incoming events are appended. Every event was appended unconditionally, so an event re-delivered while its notification was still showing was added again, and the notification re-alerted each time. Skip events whose id is already present in the existing messaging style, and set onlyAlertOnce when the batch adds nothing new. Smart reply failures are exempt, because that path deliberately reuses the same synthesised event id to append the "message not sent" line. Filtering is per event rather than per message so an image and its caption stay a unit. This fixes the visible duplication, not the re-delivery that triggers it, and does not help once the notification has been dismissed. --- .../factories/NotificationCreator.kt | 14 +++- .../DefaultNotificationCreatorTest.kt | 77 +++++++++++++++++++ 2 files changed, 89 insertions(+), 2 deletions(-) diff --git a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/factories/NotificationCreator.kt b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/factories/NotificationCreator.kt index 44a9b5ca30..afbbe4af4f 100755 --- a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/factories/NotificationCreator.kt +++ b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/factories/NotificationCreator.kt @@ -196,11 +196,12 @@ class DefaultNotificationCreator( isThread = threadId != null, roomIsGroup = !roomInfo.isDm, ) - messagingStyle.addMessagesFromEvents(events, imageLoader) + val newEvents = messagingStyle.filterOutAlreadyDisplayedEvents(events) + messagingStyle.addMessagesFromEvents(newEvents, imageLoader) return builder .setCategory(category) .setNumber(events.size) - .setOnlyAlertOnce(roomInfo.isUpdated) + .setOnlyAlertOnce(roomInfo.isUpdated || newEvents.isEmpty()) .setWhen(lastMessageTimestamp) // MESSAGING_STYLE sets title and content for API 16 and above devices. .setStyle(messagingStyle) @@ -416,6 +417,15 @@ class DefaultNotificationCreator( .build() } + private fun MessagingStyle.filterOutAlreadyDisplayedEvents( + events: List, + ): List { + val displayedEventIds = messages.mapNotNullTo(mutableSetOf()) { it.extras.getString(MESSAGE_EVENT_ID) } + return events.filter { event -> + event.isSmartReplyError() || displayedEventIds.add(event.eventId.value) + } + } + private suspend fun MessagingStyle.addMessagesFromEvents( events: List, imageLoader: ImageLoader, diff --git a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/factories/DefaultNotificationCreatorTest.kt b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/factories/DefaultNotificationCreatorTest.kt index 38b387a180..299c5ad213 100644 --- a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/factories/DefaultNotificationCreatorTest.kt +++ b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/factories/DefaultNotificationCreatorTest.kt @@ -19,6 +19,7 @@ import io.element.android.features.enterprise.api.EnterpriseService import io.element.android.features.enterprise.test.FakeEnterpriseService import io.element.android.libraries.core.meta.BuildMeta import io.element.android.libraries.matrix.test.AN_EVENT_ID +import io.element.android.libraries.matrix.test.AN_EVENT_ID_2 import io.element.android.libraries.matrix.test.A_COLOR_INT import io.element.android.libraries.matrix.test.A_ROOM_ID import io.element.android.libraries.matrix.test.A_SESSION_ID @@ -40,6 +41,7 @@ import io.element.android.libraries.push.impl.notifications.factories.action.Rej import io.element.android.libraries.push.impl.notifications.fixtures.aFallbackNotifiableEvent import io.element.android.libraries.push.impl.notifications.fixtures.aNotifiableMessageEvent import io.element.android.libraries.push.impl.notifications.model.InviteNotifiableEvent +import io.element.android.libraries.push.impl.notifications.model.NotifiableMessageEvent import io.element.android.libraries.push.impl.notifications.model.SimpleNotifiableEvent import io.element.android.services.toolbox.test.sdk.FakeBuildVersionSdkIntProvider import io.element.android.services.toolbox.test.strings.FakeStringProvider @@ -302,6 +304,81 @@ class DefaultNotificationCreatorTest : RobolectricTest() { result.commonAssertions() } + @Test + fun `test createMessagesListNotification does not add an event which is already displayed`() = runTest { + val sut = createNotificationCreator() + val event = aNotifiableMessageEvent(body = "A message") + val existingNotification = sut.createRoomNotification(events = listOf(event)) + assertThat(existingNotification.flags and Notification.FLAG_ONLY_ALERT_ONCE).isEqualTo(0) + val result = sut.createRoomNotification(events = listOf(event), existingNotification = existingNotification) + assertThat(result.messageTexts()).containsExactly("A message") + assertThat(result.flags and Notification.FLAG_ONLY_ALERT_ONCE).isNotEqualTo(0) + } + + @Test + fun `test createMessagesListNotification adds a new event to the already displayed ones`() = runTest { + val sut = createNotificationCreator() + val existingNotification = sut.createRoomNotification(events = listOf(aNotifiableMessageEvent(body = "A message"))) + val result = sut.createRoomNotification( + events = listOf(aNotifiableMessageEvent(eventId = AN_EVENT_ID_2, body = "Another message")), + existingNotification = existingNotification, + ) + assertThat(result.messageTexts()).containsExactly("A message", "Another message").inOrder() + } + + @Test + fun `test createMessagesListNotification adds the smart reply error of an already displayed event`() = runTest { + val sut = createNotificationCreator() + val event = aNotifiableMessageEvent(body = "A message").copy(outGoingMessage = true) + val existingNotification = sut.createRoomNotification(events = listOf(event)) + val result = sut.createRoomNotification( + events = listOf(event.copy(outGoingMessageFailed = true)), + existingNotification = existingNotification, + ) + assertThat(result.messageTexts()).containsExactly("A message", "test").inOrder() + } + + @Test + fun `test createMessagesListNotification does not add an image and its caption twice`() = runTest { + val sut = createNotificationCreator() + val event = aNotifiableMessageEvent(body = "A caption").copy( + imageUriString = "aUri", + imageMimeType = "image/jpeg", + ) + val existingNotification = sut.createRoomNotification(events = listOf(event)) + assertThat(existingNotification.messageTexts()).containsExactly("test", "A caption").inOrder() + val result = sut.createRoomNotification(events = listOf(event), existingNotification = existingNotification) + assertThat(result.messageTexts()).containsExactly("test", "A caption").inOrder() + } + + private suspend fun NotificationCreator.createRoomNotification( + events: List, + existingNotification: Notification? = null, + ) = createMessagesListNotification( + notificationAccountParams = aNotificationAccountParams(), + roomInfo = RoomEventGroupInfo( + sessionId = A_SESSION_ID, + roomId = A_ROOM_ID, + roomDisplayName = "roomDisplayName", + hasSmartReplyError = false, + shouldBing = false, + customSound = null, + isUpdated = false, + ), + threadId = null, + largeIcon = null, + lastMessageTimestamp = 123_456L, + tickerText = "tickerText", + existingNotification = existingNotification, + imageLoader = FakeImageLoader(), + events = events, + ) + + private fun Notification.messageTexts(): List { + val messagingStyle = checkNotNull(NotificationCompat.MessagingStyle.extractMessagingStyleFromNotification(this)) + return messagingStyle.messages.map { it.text?.toString() } + } + private fun Notification.commonAssertions( expectedGroup: String? = aMatrixUser().userId.value, expectedCategory: String? = NotificationCompat.CATEGORY_MESSAGE, From b725d37b0e5830dca48f2241aea916ebda52fbd2 Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Sun, 9 Aug 2026 15:20:13 +0300 Subject: [PATCH 018/145] Do not display pinned events that the client cannot render The pinned events timeline is built with an exclusion filter rather than an allowlist, so an event of a type the app has no renderer for reaches both pinned surfaces. The banner falls through to the formatter catch-all and reads "Unsupported event", and the list renders an unknown content tile. Drop unknown content and message-like or state events that failed to parse from both surfaces, along with any day divider left without an event to introduce, and show the empty state when nothing renderable remains. The spec makes this the client's call. Such an event can still be unpinned from the room timeline, where it is still rendered. Undecryptable and redacted events are untouched: they carry information the user needs. --- .../impl/pinned/DisplayablePinnedEvents.kt | 39 ++++++ .../banner/PinnedMessagesBannerItemFactory.kt | 2 + .../list/PinnedMessagesListPresenter.kt | 5 +- .../PinnedMessagesBannerItemFactoryTest.kt | 74 +++++++++++ .../PinnedMessagesBannerPresenterTest.kt | 42 +++++++ .../list/PinnedMessagesListPresenterTest.kt | 116 +++++++++++++++--- 6 files changed, 262 insertions(+), 16 deletions(-) create mode 100644 features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/DisplayablePinnedEvents.kt create mode 100644 features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/pinned/banner/PinnedMessagesBannerItemFactoryTest.kt diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/DisplayablePinnedEvents.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/DisplayablePinnedEvents.kt new file mode 100644 index 0000000000..55c4b61ed1 --- /dev/null +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/DisplayablePinnedEvents.kt @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2026 Element Creations Ltd. + * + * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. + * Please see LICENSE files in the repository root for full details. + */ + +package io.element.android.features.messages.impl.pinned + +import io.element.android.libraries.matrix.api.timeline.MatrixTimelineItem +import io.element.android.libraries.matrix.api.timeline.item.event.EventContent +import io.element.android.libraries.matrix.api.timeline.item.event.FailedToParseMessageLikeContent +import io.element.android.libraries.matrix.api.timeline.item.event.FailedToParseStateContent +import io.element.android.libraries.matrix.api.timeline.item.event.UnknownContent +import io.element.android.libraries.matrix.api.timeline.item.virtual.VirtualTimelineItem + +internal fun List.keepDisplayablePinnedEvents(): List { + val items = filter { it.isDisplayableAsPinnedEvent() } + return items.filterIndexed { index, item -> + !item.isDayDivider() || items.getOrNull(index + 1) is MatrixTimelineItem.Event + } +} + +internal fun EventContent.isDisplayableAsPinnedEvent(): Boolean { + return when (this) { + UnknownContent, + is FailedToParseMessageLikeContent, + is FailedToParseStateContent -> false + else -> true + } +} + +private fun MatrixTimelineItem.isDisplayableAsPinnedEvent(): Boolean { + return this !is MatrixTimelineItem.Event || event.content.isDisplayableAsPinnedEvent() +} + +private fun MatrixTimelineItem.isDayDivider(): Boolean { + return this is MatrixTimelineItem.Virtual && virtual is VirtualTimelineItem.DayDivider +} diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/banner/PinnedMessagesBannerItemFactory.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/banner/PinnedMessagesBannerItemFactory.kt index d1d53b36b4..0420416bff 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/banner/PinnedMessagesBannerItemFactory.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/banner/PinnedMessagesBannerItemFactory.kt @@ -10,6 +10,7 @@ package io.element.android.features.messages.impl.pinned.banner import androidx.compose.ui.text.AnnotatedString import dev.zacsweers.metro.Inject +import io.element.android.features.messages.impl.pinned.isDisplayableAsPinnedEvent import io.element.android.libraries.core.coroutine.CoroutineDispatchers import io.element.android.libraries.eventformatter.api.PinnedMessagesBannerFormatter import io.element.android.libraries.matrix.api.timeline.MatrixTimelineItem @@ -24,6 +25,7 @@ class PinnedMessagesBannerItemFactory( when (timelineItem) { is MatrixTimelineItem.Event -> { val eventId = timelineItem.eventId ?: return@withContext null + if (!timelineItem.event.content.isDisplayableAsPinnedEvent()) return@withContext null val formatted = formatter.format(timelineItem.event) PinnedMessagesBannerItem( eventId = eventId, diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/list/PinnedMessagesListPresenter.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/list/PinnedMessagesListPresenter.kt index 6e8974b871..e1ee18e920 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/list/PinnedMessagesListPresenter.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/pinned/list/PinnedMessagesListPresenter.kt @@ -28,6 +28,7 @@ import io.element.android.features.messages.impl.actionlist.ActionListState import io.element.android.features.messages.impl.actionlist.model.TimelineItemAction import io.element.android.features.messages.impl.link.LinkState import io.element.android.features.messages.impl.pinned.DefaultPinnedEventsTimelineProvider +import io.element.android.features.messages.impl.pinned.keepDisplayablePinnedEvents import io.element.android.features.messages.impl.timeline.TimelineRoomInfo import io.element.android.features.messages.impl.timeline.factories.TimelineItemsFactory import io.element.android.features.messages.impl.timeline.factories.TimelineItemsFactoryConfig @@ -207,7 +208,7 @@ class PinnedMessagesListPresenter( val timelineItemsFlow = asyncTimeline.data.timelineItems combine(timelineItemsFlow, room.membersStateFlow) { items, membersState -> timelineItemsFactory.replaceWith( - timelineItems = items, + timelineItems = items.keepDisplayablePinnedEvents(), roomMembers = membersState.roomMembers().orEmpty(), renderReadReceipts = false, ) @@ -239,7 +240,7 @@ class PinnedMessagesListPresenter( AsyncData.Uninitialized, is AsyncData.Loading -> PinnedMessagesListState.Loading is AsyncData.Failure -> PinnedMessagesListState.Failed is AsyncData.Success -> { - if (timelineItems.data.isEmpty()) { + if (timelineItems.data.all { it is TimelineItem.Virtual }) { PinnedMessagesListState.Empty } else { val actionListState = actionListPresenter.present() diff --git a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/pinned/banner/PinnedMessagesBannerItemFactoryTest.kt b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/pinned/banner/PinnedMessagesBannerItemFactoryTest.kt new file mode 100644 index 0000000000..114eed98d9 --- /dev/null +++ b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/pinned/banner/PinnedMessagesBannerItemFactoryTest.kt @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2026 Element Creations Ltd. + * + * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. + * Please see LICENSE files in the repository root for full details. + */ + +package io.element.android.features.messages.impl.pinned.banner + +import com.google.common.truth.Truth.assertThat +import io.element.android.libraries.eventformatter.test.FakePinnedMessagesBannerFormatter +import io.element.android.libraries.matrix.api.timeline.MatrixTimelineItem +import io.element.android.libraries.matrix.api.timeline.item.event.EventContent +import io.element.android.libraries.matrix.api.timeline.item.event.FailedToParseMessageLikeContent +import io.element.android.libraries.matrix.api.timeline.item.event.FailedToParseStateContent +import io.element.android.libraries.matrix.api.timeline.item.event.UnknownContent +import io.element.android.libraries.matrix.api.timeline.item.virtual.VirtualTimelineItem +import io.element.android.libraries.matrix.test.AN_EVENT_ID +import io.element.android.libraries.matrix.test.A_UNIQUE_ID +import io.element.android.libraries.matrix.test.timeline.aMessageContent +import io.element.android.libraries.matrix.test.timeline.anEventTimelineItem +import io.element.android.tests.testutils.testCoroutineDispatchers +import kotlinx.coroutines.test.TestScope +import kotlinx.coroutines.test.runTest +import org.junit.Test + +class PinnedMessagesBannerItemFactoryTest { + @Test + fun `create - returns an item for an event which can be displayed`() = runTest { + val factory = createPinnedMessagesBannerItemFactory() + val item = factory.create(anEventTimelineItemOf(aMessageContent("A message"))) + assertThat(item?.eventId).isEqualTo(AN_EVENT_ID) + } + + @Test + fun `create - returns null for events which cannot be displayed`() = runTest { + val factory = createPinnedMessagesBannerItemFactory() + val contents = listOf( + UnknownContent, + FailedToParseMessageLikeContent(eventType = "m.room.message", error = "an error"), + FailedToParseStateContent(eventType = "m.room.topic", stateKey = "", error = "an error"), + ) + for (content in contents) { + assertThat(factory.create(anEventTimelineItemOf(content))).isNull() + } + } + + @Test + fun `create - returns null for virtual items`() = runTest { + val factory = createPinnedMessagesBannerItemFactory() + val item = factory.create( + MatrixTimelineItem.Virtual( + uniqueId = A_UNIQUE_ID, + virtual = VirtualTimelineItem.DayDivider(timestamp = 0L), + ) + ) + assertThat(item).isNull() + } + + private fun anEventTimelineItemOf(content: EventContent) = MatrixTimelineItem.Event( + uniqueId = A_UNIQUE_ID, + event = anEventTimelineItem( + eventId = AN_EVENT_ID, + content = content, + ), + ) + + private fun TestScope.createPinnedMessagesBannerItemFactory() = PinnedMessagesBannerItemFactory( + coroutineDispatchers = testCoroutineDispatchers(), + formatter = FakePinnedMessagesBannerFormatter( + formatLambda = { event -> "${event.content}" } + ), + ) +} diff --git a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/pinned/banner/PinnedMessagesBannerPresenterTest.kt b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/pinned/banner/PinnedMessagesBannerPresenterTest.kt index 1f95baccc9..256837e5f7 100644 --- a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/pinned/banner/PinnedMessagesBannerPresenterTest.kt +++ b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/pinned/banner/PinnedMessagesBannerPresenterTest.kt @@ -14,6 +14,7 @@ import io.element.android.libraries.eventformatter.test.FakePinnedMessagesBanner import io.element.android.libraries.matrix.api.room.JoinedRoom import io.element.android.libraries.matrix.api.sync.SyncService import io.element.android.libraries.matrix.api.timeline.MatrixTimelineItem +import io.element.android.libraries.matrix.api.timeline.item.event.UnknownContent import io.element.android.libraries.matrix.test.AN_EVENT_ID import io.element.android.libraries.matrix.test.AN_EVENT_ID_2 import io.element.android.libraries.matrix.test.A_UNIQUE_ID @@ -24,6 +25,7 @@ import io.element.android.libraries.matrix.test.sync.FakeSyncService import io.element.android.libraries.matrix.test.timeline.FakeTimeline import io.element.android.libraries.matrix.test.timeline.aMessageContent import io.element.android.libraries.matrix.test.timeline.anEventTimelineItem +import io.element.android.tests.testutils.consumeItemsUntilPredicate import io.element.android.tests.testutils.test import io.element.android.tests.testutils.testCoroutineDispatchers import kotlinx.coroutines.flow.flowOf @@ -90,6 +92,46 @@ class PinnedMessagesBannerPresenterTest { } } + @Test + fun `present - loaded state - events which cannot be displayed are not rendered`() = runTest { + val messageContent = aMessageContent("A message") + val pinnedEventsTimeline = FakeTimeline( + timelineItems = flowOf( + listOf( + MatrixTimelineItem.Event( + uniqueId = A_UNIQUE_ID, + event = anEventTimelineItem( + eventId = AN_EVENT_ID, + content = messageContent, + ), + ), + MatrixTimelineItem.Event( + uniqueId = A_UNIQUE_ID_2, + event = anEventTimelineItem( + eventId = AN_EVENT_ID_2, + content = UnknownContent, + ), + ) + ) + ) + ) + val room = FakeJoinedRoom( + createTimelineResult = { Result.success(pinnedEventsTimeline) } + ).apply { + givenRoomInfo(aRoomInfo(pinnedEventIds = listOf(AN_EVENT_ID, AN_EVENT_ID_2))) + } + val presenter = createPinnedMessagesBannerPresenter(room = room) + presenter.test { + val loadedState = consumeItemsUntilPredicate { state -> + state is PinnedMessagesBannerState.Loaded + }.last() as PinnedMessagesBannerState.Loaded + assertThat(loadedState.loadedPinnedMessagesCount).isEqualTo(1) + assertThat(loadedState.currentPinnedMessageIndex).isEqualTo(0) + assertThat(loadedState.currentPinnedMessage.formatted.text).isEqualTo(messageContent.toString()) + cancelAndIgnoreRemainingEvents() + } + } + @Test fun `present - loaded state - multiple pinned messages`() = runTest { val messageContent1 = aMessageContent("A message") diff --git a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/pinned/list/PinnedMessagesListPresenterTest.kt b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/pinned/list/PinnedMessagesListPresenterTest.kt index 8b2da2cefd..3efa707c3d 100644 --- a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/pinned/list/PinnedMessagesListPresenterTest.kt +++ b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/pinned/list/PinnedMessagesListPresenterTest.kt @@ -21,13 +21,19 @@ import io.element.android.features.messages.test.timeline.FakeHtmlConverterProvi import io.element.android.libraries.designsystem.utils.snackbar.SnackbarDispatcher import io.element.android.libraries.featureflag.test.FakeFeatureFlagService import io.element.android.libraries.matrix.api.core.EventId +import io.element.android.libraries.matrix.api.core.UniqueId import io.element.android.libraries.matrix.api.room.JoinedRoom import io.element.android.libraries.matrix.api.sync.SyncService import io.element.android.libraries.matrix.api.timeline.MatrixTimelineItem import io.element.android.libraries.matrix.api.timeline.item.TimelineItemDebugInfo +import io.element.android.libraries.matrix.api.timeline.item.event.FailedToParseMessageLikeContent +import io.element.android.libraries.matrix.api.timeline.item.event.UnknownContent +import io.element.android.libraries.matrix.api.timeline.item.virtual.VirtualTimelineItem import io.element.android.libraries.matrix.test.AN_EVENT_ID +import io.element.android.libraries.matrix.test.AN_EVENT_ID_2 import io.element.android.libraries.matrix.test.AN_EXCEPTION import io.element.android.libraries.matrix.test.A_UNIQUE_ID +import io.element.android.libraries.matrix.test.A_UNIQUE_ID_2 import io.element.android.libraries.matrix.test.room.FakeBaseRoom import io.element.android.libraries.matrix.test.room.FakeJoinedRoom import io.element.android.libraries.matrix.test.room.aRoomInfo @@ -38,6 +44,7 @@ import io.element.android.libraries.matrix.test.timeline.aMessageContent import io.element.android.libraries.matrix.test.timeline.anEventTimelineItem import io.element.android.services.analytics.api.AnalyticsService import io.element.android.services.analytics.test.FakeAnalyticsService +import io.element.android.tests.testutils.consumeItemsUntilPredicate import io.element.android.tests.testutils.lambda.assert import io.element.android.tests.testutils.lambda.lambdaRecorder import io.element.android.tests.testutils.lambda.value @@ -131,6 +138,90 @@ class PinnedMessagesListPresenterTest { } } + @Test + fun `present - filled state - events which cannot be displayed are not rendered`() = runTest { + val pinnedEventsTimeline = createPinnedMessagesTimeline( + items = listOf( + MatrixTimelineItem.Virtual( + uniqueId = UniqueId("aDayDivider"), + virtual = VirtualTimelineItem.DayDivider(timestamp = 0L), + ), + MatrixTimelineItem.Event( + uniqueId = A_UNIQUE_ID, + event = anEventTimelineItem( + eventId = AN_EVENT_ID, + content = aMessageContent("A message"), + ), + ), + MatrixTimelineItem.Virtual( + uniqueId = UniqueId("anotherDayDivider"), + virtual = VirtualTimelineItem.DayDivider(timestamp = 1L), + ), + MatrixTimelineItem.Event( + uniqueId = A_UNIQUE_ID_2, + event = anEventTimelineItem( + eventId = AN_EVENT_ID_2, + content = UnknownContent, + ), + ), + ), + ) + val room = FakeJoinedRoom( + baseRoom = FakeBaseRoom( + roomPermissions = roomPermissions(), + ).apply { + givenRoomInfo(aRoomInfo(pinnedEventIds = listOf(AN_EVENT_ID, AN_EVENT_ID_2))) + }, + createTimelineResult = { Result.success(pinnedEventsTimeline) }, + ) + val presenter = createPinnedMessagesListPresenter(room = room) + presenter.test { + val filledState = consumeItemsUntilPredicate { state -> + state is PinnedMessagesListState.Filled + }.last() as PinnedMessagesListState.Filled + assertThat(filledState.loadedPinnedMessagesCount).isEqualTo(1) + assertThat(filledState.timelineItems).hasSize(2) + assertThat(filledState.timelineItems.filterIsInstance().map { it.eventId }).containsExactly(AN_EVENT_ID) + assertThat(filledState.timelineItems.filterIsInstance()).hasSize(1) + cancelAndIgnoreRemainingEvents() + } + } + + @Test + fun `present - empty state when no pinned event can be displayed`() = runTest { + val pinnedEventsTimeline = createPinnedMessagesTimeline( + items = listOf( + MatrixTimelineItem.Virtual( + uniqueId = A_UNIQUE_ID, + virtual = VirtualTimelineItem.DayDivider(timestamp = 0L), + ), + MatrixTimelineItem.Event( + uniqueId = A_UNIQUE_ID_2, + event = anEventTimelineItem( + eventId = AN_EVENT_ID, + content = FailedToParseMessageLikeContent(eventType = "m.room.message", error = "an error"), + ), + ), + ), + ) + val room = FakeJoinedRoom( + baseRoom = FakeBaseRoom( + roomPermissions = roomPermissions(), + ).apply { + givenRoomInfo(aRoomInfo(pinnedEventIds = listOf(AN_EVENT_ID))) + }, + createTimelineResult = { Result.success(pinnedEventsTimeline) }, + ) + val presenter = createPinnedMessagesListPresenter(room = room) + presenter.test { + val emptyState = consumeItemsUntilPredicate { state -> + state is PinnedMessagesListState.Empty + }.last() + assertThat(emptyState).isEqualTo(PinnedMessagesListState.Empty) + cancelAndIgnoreRemainingEvents() + } + } + @Test fun `present - unpin event`() = runTest { val successUnpinEventLambda = lambdaRecorder { _: EventId? -> Result.success(true) } @@ -263,21 +354,18 @@ class PinnedMessagesListPresenterTest { } } - private fun createPinnedMessagesTimeline(): FakeTimeline { - val messageContent = aMessageContent("A message") - return FakeTimeline( - timelineItems = flowOf( - listOf( - MatrixTimelineItem.Event( - uniqueId = A_UNIQUE_ID, - event = anEventTimelineItem( - eventId = AN_EVENT_ID, - content = messageContent, - ), - ) - ) + private fun createPinnedMessagesTimeline( + items: List = listOf( + MatrixTimelineItem.Event( + uniqueId = A_UNIQUE_ID, + event = anEventTimelineItem( + eventId = AN_EVENT_ID, + content = aMessageContent("A message"), + ), ) - ) + ), + ): FakeTimeline { + return FakeTimeline(timelineItems = flowOf(items)) } private fun roomPermissions( From 4b5429395d588c9b070967be07980811453a281b Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Sun, 9 Aug 2026 15:37:18 +0300 Subject: [PATCH 019/145] Drop the comments from the Enter key handling Review feedback: the callback name and the device-id check read on their own, and the test names carry the soft versus physical keyboard rule. --- .../textcomposer/components/markdown/MarkdownEditText.kt | 6 ------ .../textcomposer/components/markdown/MarkdownTextInput.kt | 1 - .../impl/components/markdown/MarkdownTextInputTest.kt | 1 - 3 files changed, 8 deletions(-) diff --git a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/components/markdown/MarkdownEditText.kt b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/components/markdown/MarkdownEditText.kt index b8d173aaa8..8cc06c77c3 100644 --- a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/components/markdown/MarkdownEditText.kt +++ b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/components/markdown/MarkdownEditText.kt @@ -19,10 +19,6 @@ internal class MarkdownEditText( ) : AppCompatEditText(context) { var onSelectionChangeListener: ((Int, Int) -> Unit)? = null - /** - * Invoked when Enter is pressed on a physical keyboard without Shift. Return true to consume the - * key, i.e. to send instead of inserting a newline. - */ var onEnterKeyListener: (() -> Boolean)? = null private var isModifyingText = false @@ -30,13 +26,11 @@ internal class MarkdownEditText( override fun dispatchKeyEvent(event: KeyEvent): Boolean { if (event.keyCode == KeyEvent.KEYCODE_ENTER && !event.isShiftPressed && - // A soft keyboard must keep inserting a newline, only a real one sends. event.deviceId != KeyCharacterMap.VIRTUAL_KEYBOARD ) { val listener = onEnterKeyListener if (listener != null) { return when (event.action) { - // Consume the release too, so no newline leaks out on key repeat. KeyEvent.ACTION_UP -> true KeyEvent.ACTION_DOWN -> if (event.repeatCount == 0) listener() else true else -> super.dispatchKeyEvent(event) diff --git a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/components/markdown/MarkdownTextInput.kt b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/components/markdown/MarkdownTextInput.kt index adb026d812..8c6f30eed1 100644 --- a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/components/markdown/MarkdownTextInput.kt +++ b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/components/markdown/MarkdownTextInput.kt @@ -133,7 +133,6 @@ fun MarkdownTextInput( update = { editText -> editText.contentDescription = placeholder editText.applyStyleInCompose(richTextEditorStyle) - // Set here rather than in the factory, which runs once and would capture a stale lambda. editText.onEnterKeyListener = onSendMessage?.let { send -> { send() diff --git a/libraries/textcomposer/impl/src/test/kotlin/io/element/android/libraries/textcomposer/impl/components/markdown/MarkdownTextInputTest.kt b/libraries/textcomposer/impl/src/test/kotlin/io/element/android/libraries/textcomposer/impl/components/markdown/MarkdownTextInputTest.kt index 49206775ac..15687cb4c9 100644 --- a/libraries/textcomposer/impl/src/test/kotlin/io/element/android/libraries/textcomposer/impl/components/markdown/MarkdownTextInputTest.kt +++ b/libraries/textcomposer/impl/src/test/kotlin/io/element/android/libraries/textcomposer/impl/components/markdown/MarkdownTextInputTest.kt @@ -233,7 +233,6 @@ class MarkdownTextInputTest : RobolectricTest() { } private companion object { - // Any device id other than KeyCharacterMap.VIRTUAL_KEYBOARD is a real keyboard. const val PHYSICAL_KEYBOARD_DEVICE_ID = 1 } } From f0e791001fa5b4120692bf8be36e27896bba4569 Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Sun, 9 Aug 2026 15:39:18 +0300 Subject: [PATCH 020/145] Drop the comments from the matrix URI pillification Review feedback: the regex name and the test names carry the meaning. --- .../messages/impl/utils/TextPillificationHelper.kt | 13 ------------- .../utils/DefaultTextPillificationHelperTest.kt | 1 - 2 files changed, 14 deletions(-) diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/utils/TextPillificationHelper.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/utils/TextPillificationHelper.kt index dbdba43340..9faf42d3fd 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/utils/TextPillificationHelper.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/utils/TextPillificationHelper.kt @@ -28,9 +28,6 @@ import io.element.android.libraries.textcomposer.mentions.getMentionSpans import io.element.android.wysiwyg.view.spans.CodeBlockSpan import io.element.android.wysiwyg.view.spans.InlineCodeSpan -/** - * Matches a `matrix:` URI as defined by MSC2312, stopping before any trailing sentence punctuation. - */ private val MATRIX_URI_REGEX = Regex("""matrix:(?:u|user|r|room|roomid|e|event)/\S*[^\s.,;:!?)]""", RegexOption.IGNORE_CASE) interface TextPillificationHelper { @@ -92,8 +89,6 @@ class DefaultTextPillificationHelper( } private fun pillifyPermalinks(text: SpannableStringBuilder) { - // Before the web pass: Patterns.WEB_URL matches the bare domain inside a matrix: URI, and - // whichever pass runs first wins the range. pillifyMatrixUris(text) for (match in Patterns.WEB_URL.toRegex().findAll(text)) { val start = match.range.first @@ -107,11 +102,6 @@ class DefaultTextPillificationHelper( } } - /** - * `Patterns.WEB_URL` cannot match a `matrix:` URI, so those permalinks were left as plain text - * even though the parser understands them. See - * https://github.com/element-hq/element-x-android/issues/5319 - */ private fun pillifyMatrixUris(text: SpannableStringBuilder) { for (match in MATRIX_URI_REGEX.findAll(text)) { val start = match.range.first @@ -120,9 +110,6 @@ class DefaultTextPillificationHelper( val mentionSpan = mentionSpanProvider.getMentionSpanFor(match.value, match.value) if (mentionSpan != null) { text.setSpan(mentionSpan, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) - // A `matrix:` URI gets no URLSpan from linkification, and the timeline only reports - // URLSpans as clicks, so the pill would otherwise be inert. Adding it here also makes - // LinkifyHelper drop the bogus web link it would otherwise find inside the URI. if (text.getSpans(start, end).isEmpty()) { text.setSpan(URLSpan(match.value), start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE) } diff --git a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/utils/DefaultTextPillificationHelperTest.kt b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/utils/DefaultTextPillificationHelperTest.kt index ae9f5f5715..2590c9fc5c 100644 --- a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/utils/DefaultTextPillificationHelperTest.kt +++ b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/utils/DefaultTextPillificationHelperTest.kt @@ -50,7 +50,6 @@ class DefaultTextPillificationHelperTest : RobolectricTest() { val spanned = pillified as Spanned assertThat(spanned.getSpanStart(mentionSpans.first())).isEqualTo(text.indexOf("matrix:")) assertThat(spanned.getSpanEnd(mentionSpans.first())).isEqualTo(text.length) - // Without a URLSpan the pill would not be clickable in the timeline. val urlSpans = spanned.getSpans(0, spanned.length) assertThat(urlSpans).hasLength(1) assertThat(urlSpans.first().url).isEqualTo("matrix:u/someone:example.com") From e5337b42e09695e636cc81ed543ad6e74bf51d16 Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Sun, 9 Aug 2026 15:44:14 +0300 Subject: [PATCH 021/145] Validate the bracketed authority with a URI parser instead of a regex Review feedback: the previous pattern hardcoded http, https and ftp and guessed at the address grammar. Candidates are now found by scheme and handed to java.net.URI, which accepts any scheme and rejects an authority that is not a real IPv6 literal, an unclosed bracket, or array syntax such as values[0]:1. Also drops the explanatory comments. --- .../androidutils/text/LinkifyHelper.kt | 27 +++++++++---------- .../androidutils/text/LinkifierHelperTest.kt | 17 ++++++++++++ 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/libraries/androidutils/src/main/kotlin/io/element/android/libraries/androidutils/text/LinkifyHelper.kt b/libraries/androidutils/src/main/kotlin/io/element/android/libraries/androidutils/text/LinkifyHelper.kt index 03dde18006..28d856ce1f 100644 --- a/libraries/androidutils/src/main/kotlin/io/element/android/libraries/androidutils/text/LinkifyHelper.kt +++ b/libraries/androidutils/src/main/kotlin/io/element/android/libraries/androidutils/text/LinkifyHelper.kt @@ -16,6 +16,7 @@ import androidx.core.text.toSpannable import androidx.core.text.util.LinkifyCompat import io.element.android.libraries.core.extensions.runCatchingExceptions import timber.log.Timber +import java.net.URI /** * Helper class to linkify text while preserving existing URL spans. @@ -23,11 +24,7 @@ import timber.log.Timber * It also checks the linkified results to make sure URLs spans are not including trailing punctuation. */ object LinkifyHelper { - /** - * Matches a URL whose authority is a bracketed IPv6 address, i.e. `http://[2001:db8::1]:8008/path`. - * A scheme and the brackets are both required, so array syntax such as `values[0]:1` is not matched. - */ - private val IPV6_URL_REGEX = Regex("""(?i)\b(?:https?|ftp)://\[[0-9a-f:.]+(?:%25[0-9a-z._-]+)?](?::\d{1,5})?(?:/\S*)?""") + private val BRACKETED_AUTHORITY_URL_REGEX = Regex("""(? and pill - // spans still win. See https://github.com/element-hq/element-x-android/issues/2614 - for (match in IPV6_URL_REGEX.findAll(spannable)) { + for (match in BRACKETED_AUTHORITY_URL_REGEX.findAll(spannable)) { val start = match.range.first val end = match.range.last + 1 val newEnd = runCatchingExceptions { adjustLinkifiedUrlSpanEndIndex(spannable, start, end) }.onFailure { - Timber.e(it, "Failed to adjust end index for IPv6 link span") + Timber.e(it, "Failed to adjust end index for link span") }.getOrNull() ?: end - // Evict whatever Linkify put inside the address, typically a tel: span. + val url = spannable.substring(start, newEnd) + if (!url.hasBracketedHost()) continue + for (span in spannable.getSpans(start, newEnd)) { spannable.removeSpan(span) } - spannable.setSpan(URLSpan(spannable.substring(start, newEnd)), start, newEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) + spannable.setSpan(URLSpan(url), start, newEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) } // Restore old spans, remove new ones if there is a conflict @@ -109,6 +103,11 @@ object LinkifyHelper { return spannable } + private fun String.hasBracketedHost(): Boolean { + val host = runCatchingExceptions { URI(this) }.getOrNull()?.host ?: return false + return host.startsWith('[') && host.endsWith(']') + } + private fun adjustLinkifiedUrlSpanEndIndex(spannable: Spannable, start: Int, end: Int): Int { var end = end diff --git a/libraries/androidutils/src/test/kotlin/io/element/android/libraries/androidutils/text/LinkifierHelperTest.kt b/libraries/androidutils/src/test/kotlin/io/element/android/libraries/androidutils/text/LinkifierHelperTest.kt index 47e6b1a933..9d7e622ca6 100644 --- a/libraries/androidutils/src/test/kotlin/io/element/android/libraries/androidutils/text/LinkifierHelperTest.kt +++ b/libraries/androidutils/src/test/kotlin/io/element/android/libraries/androidutils/text/LinkifierHelperTest.kt @@ -65,6 +65,23 @@ class LinkifierHelperTest : RobolectricTest() { assertThat(urlSpans.first().url).isEqualTo("http://[::1]/x") } + @Test + fun `linkification finds an ipv6 URL of any scheme`() { + val text = "A url ssh://[2001:db8::1]/path" + val result = LinkifyHelper.linkify(text) + val urlSpans = result.toSpannable().getSpans() + assertThat(urlSpans.size).isEqualTo(1) + assertThat(urlSpans.first().url).isEqualTo("ssh://[2001:db8::1]/path") + } + + @Test + fun `linkification ignores a bracketed authority which is not an address`() { + val text = "A url http://[not-an-address]/path" + val result = LinkifyHelper.linkify(text) + val urlSpans = result.toSpannable().getSpans() + assertThat(urlSpans).isEmpty() + } + @Test fun `linkification ignores bracketed text which is not a URL`() { val text = "An array values[0]:1 and a bare [::1]" From f8816b2449416ef998a396d5f59fc9f83c96e0c5 Mon Sep 17 00:00:00 2001 From: Jenna Vassar Date: Mon, 10 Aug 2026 09:28:31 -0700 Subject: [PATCH 022/145] Submit the exact account provider field text on continue --- .../ConfirmAccountProviderEvents.kt | 5 +++- .../ConfirmAccountProviderPresenter.kt | 18 +++++++----- .../ConfirmAccountProviderView.kt | 18 +++++++----- .../ConfirmAccountProviderPresenterTest.kt | 28 +++++++++---------- 4 files changed, 40 insertions(+), 29 deletions(-) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderEvents.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderEvents.kt index 1fb024156b..9093a8121f 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderEvents.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderEvents.kt @@ -10,6 +10,9 @@ package io.element.android.features.login.impl.screens.confirmaccountprovider sealed interface ConfirmAccountProviderEvents { data class UserInputChanged(val accountProvider: String) : ConfirmAccountProviderEvents - data object Continue : ConfirmAccountProviderEvents + + // Carries the account provider to submit (the current field text, or the accepted autocomplete suggestion), + // captured from the view at click time so it can't lag behind fast input (e.g. keyboard autofill). + data class Continue(val accountProvider: String) : ConfirmAccountProviderEvents data object ClearError : ConfirmAccountProviderEvents } diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt index f83bce0510..fbadcddc15 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt @@ -67,9 +67,10 @@ class ConfirmAccountProviderPresenter( } } - // Continue accepts the suggestion when one is offered, otherwise the raw input. - val accountProviderToSubmit = accountProviderSuggestion ?: accountProviderInput - val latestAccountProviderToSubmit by rememberUpdatedState(accountProviderToSubmit) + // The account provider submitted via Continue (carried by the event, so it reflects the exact field + // text at click time); used to actually sign in once validation succeeds. + var submittedAccountProvider by remember { mutableStateOf(null) } + val latestSubmittedAccountProvider by rememberUpdatedState(submittedAccountProvider) // Once the chosen account provider has been validated and persisted, proceed with the actual sign in / sign up. LaunchedEffect(changeServerState.changeServerAction) { @@ -77,7 +78,7 @@ class ConfirmAccountProviderPresenter( loginModeState.eventSink( LoginModeEvent.Submit( isAccountCreation = params.isAccountCreation, - homeserverUrl = latestAccountProviderToSubmit.trim(), + homeserverUrl = latestSubmittedAccountProvider.orEmpty().trim(), resolvedHomeserverUrl = null, loginHint = null, ) @@ -92,9 +93,12 @@ class ConfirmAccountProviderPresenter( } // Validate (and persist) the chosen account provider before proceeding. This also enforces the // account-provider access control, which the login submit does not run on its own. - ConfirmAccountProviderEvents.Continue -> changeServerState.eventSink( - ChangeServerEvents.ChangeServer(AccountProvider(url = accountProviderToSubmit.trim())) - ) + is ConfirmAccountProviderEvents.Continue -> { + submittedAccountProvider = event.accountProvider + changeServerState.eventSink( + ChangeServerEvents.ChangeServer(AccountProvider(url = event.accountProvider.trim())) + ) + } ConfirmAccountProviderEvents.ClearError -> { loginModeState.eventSink(LoginModeEvent.ClearError) changeServerState.eventSink(ChangeServerEvents.ClearError) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt index e1be11da3a..385a8477f6 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt @@ -81,10 +81,20 @@ fun ConfirmAccountProviderView( val focusRequester = remember { FocusRequester() } val keyboardController = LocalSoftwareKeyboardController.current + var input by textFieldState(stateValue = state.accountProviderInput) + // Inline autocomplete: the un-typed remainder of the suggested account provider (rendered in grey and + // accepted on Continue). Only valid while the suggestion still starts with the current input. + val suggestionSuffix = state.accountProviderSuggestion + ?.takeIf { it.length > input.length && it.startsWith(input, ignoreCase = true) } + ?.substring(input.length) + .orEmpty() + fun submit() { // Dismiss the keyboard and release focus while the account provider is being validated. focusManager.clearFocus(force = true) - eventSink(ConfirmAccountProviderEvents.Continue) + // Submit the exact field text (plus any accepted suggestion), read here so it can't lag behind + // fast input such as keyboard autofill. + eventSink(ConfirmAccountProviderEvents.Continue(input + suggestionSuffix)) } // Once a validation / login error has been dismissed, return focus and the keyboard to the field so @@ -128,12 +138,6 @@ fun ConfirmAccountProviderView( } } ) { - var input by textFieldState(stateValue = state.accountProviderInput) - // Inline autocomplete: render the un-typed remainder of the suggested account provider in grey. - val suggestionSuffix = state.accountProviderSuggestion - ?.takeIf { it.length > input.length && it.startsWith(input, ignoreCase = true) } - ?.substring(input.length) - .orEmpty() val ghostColor = ElementTheme.colors.textSecondary val ghostTransformation = remember(suggestionSuffix, ghostColor) { GhostSuffixVisualTransformation(suggestionSuffix, ghostColor) diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt index eba6a4474f..b3bf502965 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt @@ -70,7 +70,7 @@ class ConfirmAccountProviderPresenterTest { ) presenter.test { val initialState = awaitItem() - initialState.eventSink.invoke(ConfirmAccountProviderEvents.Continue) + initialState.eventSink.invoke(ConfirmAccountProviderEvents.Continue(AuthenticationConfig.MATRIX_ORG_URL)) val successState = awaitLoginMode { it is AsyncData.Success } assertThat(successState.loginModeState.loginMode.dataOrNull()).isEqualTo(LoginMode.PasswordLogin) cancelAndIgnoreRemainingEvents() @@ -89,7 +89,7 @@ class ConfirmAccountProviderPresenterTest { ) presenter.test { val initialState = awaitItem() - initialState.eventSink.invoke(ConfirmAccountProviderEvents.Continue) + initialState.eventSink.invoke(ConfirmAccountProviderEvents.Continue(AuthenticationConfig.MATRIX_ORG_URL)) val successState = awaitLoginMode { it is AsyncData.Success } assertThat(successState.loginModeState.loginMode.dataOrNull()).isInstanceOf(LoginMode.OAuth::class.java) cancelAndIgnoreRemainingEvents() @@ -110,7 +110,7 @@ class ConfirmAccountProviderPresenterTest { ) presenter.test { val initialState = awaitItem() - initialState.eventSink.invoke(ConfirmAccountProviderEvents.Continue) + initialState.eventSink.invoke(ConfirmAccountProviderEvents.Continue(AuthenticationConfig.MATRIX_ORG_URL)) val successState = awaitLoginMode { it is AsyncData.Success } assertThat(successState.loginModeState.loginMode.dataOrNull()).isInstanceOf(LoginMode.OAuth::class.java) authenticationService.givenOAuthCancelError(AN_EXCEPTION) @@ -135,7 +135,7 @@ class ConfirmAccountProviderPresenterTest { ) presenter.test { val initialState = awaitItem() - initialState.eventSink.invoke(ConfirmAccountProviderEvents.Continue) + initialState.eventSink.invoke(ConfirmAccountProviderEvents.Continue(AuthenticationConfig.MATRIX_ORG_URL)) val successState = awaitLoginMode { it is AsyncData.Success } assertThat(successState.loginModeState.loginMode.dataOrNull()).isInstanceOf(LoginMode.OAuth::class.java) defaultOAuthActionFlow.post(OAuthAction.GoBack()) @@ -159,7 +159,7 @@ class ConfirmAccountProviderPresenterTest { ) presenter.test { val initialState = awaitItem() - initialState.eventSink.invoke(ConfirmAccountProviderEvents.Continue) + initialState.eventSink.invoke(ConfirmAccountProviderEvents.Continue(AuthenticationConfig.MATRIX_ORG_URL)) awaitLoginMode { it is AsyncData.Loading } defaultOAuthActionFlow.post(OAuthAction.GoBack(toUnblock = true)) val cancelFinalState = awaitLoginMode { it is AsyncData.Uninitialized } @@ -182,7 +182,7 @@ class ConfirmAccountProviderPresenterTest { ) presenter.test { val initialState = awaitItem() - initialState.eventSink.invoke(ConfirmAccountProviderEvents.Continue) + initialState.eventSink.invoke(ConfirmAccountProviderEvents.Continue(AuthenticationConfig.MATRIX_ORG_URL)) val successState = awaitLoginMode { it is AsyncData.Success } assertThat(successState.loginModeState.loginMode.dataOrNull()).isInstanceOf(LoginMode.OAuth::class.java) authenticationService.givenLoginError(AN_EXCEPTION) @@ -207,7 +207,7 @@ class ConfirmAccountProviderPresenterTest { ) presenter.test { val initialState = awaitItem() - initialState.eventSink.invoke(ConfirmAccountProviderEvents.Continue) + initialState.eventSink.invoke(ConfirmAccountProviderEvents.Continue(AuthenticationConfig.MATRIX_ORG_URL)) val successState = awaitLoginMode { it is AsyncData.Success } assertThat(successState.loginModeState.loginMode.dataOrNull()).isInstanceOf(LoginMode.OAuth::class.java) defaultOidcActionFlow.post(OAuthAction.Success("aUrl")) @@ -229,7 +229,7 @@ class ConfirmAccountProviderPresenterTest { ) presenter.test { val initialState = awaitItem() - initialState.eventSink.invoke(ConfirmAccountProviderEvents.Continue) + initialState.eventSink.invoke(ConfirmAccountProviderEvents.Continue(AuthenticationConfig.MATRIX_ORG_URL)) // The account provider validation fails, so the login is never attempted. val failureState = awaitState { it.changeServerState.changeServerAction is AsyncData.Failure } assertThat(failureState.loginModeState.loginMode).isEqualTo(AsyncData.Uninitialized) @@ -251,7 +251,7 @@ class ConfirmAccountProviderPresenterTest { val initialState = awaitItem() // Submit will return an error while validating the account provider - initialState.eventSink(ConfirmAccountProviderEvents.Continue) + initialState.eventSink(ConfirmAccountProviderEvents.Continue(AuthenticationConfig.MATRIX_ORG_URL)) // Check an error was returned val submittedState = awaitState { it.changeServerState.changeServerAction is AsyncData.Failure } @@ -279,7 +279,7 @@ class ConfirmAccountProviderPresenterTest { ) presenter.test { val initialState = awaitItem() - initialState.eventSink(ConfirmAccountProviderEvents.Continue) + initialState.eventSink(ConfirmAccountProviderEvents.Continue(AuthenticationConfig.MATRIX_ORG_URL)) // Check an error was returned val submittedState = awaitLoginMode { it is AsyncData.Failure } assertThat(submittedState.loginModeState.loginMode.errorOrNull()).isInstanceOf(AccountCreationNotSupported::class.java) @@ -304,7 +304,7 @@ class ConfirmAccountProviderPresenterTest { ) presenter.test { val initialState = awaitItem() - initialState.eventSink(ConfirmAccountProviderEvents.Continue) + initialState.eventSink(ConfirmAccountProviderEvents.Continue(AuthenticationConfig.MATRIX_ORG_URL)) val submittedState = awaitLoginMode { it is AsyncData.Success } assertThat(submittedState.loginModeState.loginMode.dataOrNull()).isInstanceOf(LoginMode.OAuth::class.java) cancelAndIgnoreRemainingEvents() @@ -326,7 +326,7 @@ class ConfirmAccountProviderPresenterTest { ) presenter.test { val initialState = awaitItem() - initialState.eventSink(ConfirmAccountProviderEvents.Continue) + initialState.eventSink(ConfirmAccountProviderEvents.Continue(AuthenticationConfig.MATRIX_ORG_URL)) val submittedState = awaitLoginMode { it is AsyncData.Success } assertThat(submittedState.loginModeState.loginMode.dataOrNull()).isInstanceOf(LoginMode.OAuth::class.java) cancelAndIgnoreRemainingEvents() @@ -348,7 +348,7 @@ class ConfirmAccountProviderPresenterTest { ) presenter.test { val initialState = awaitItem() - initialState.eventSink(ConfirmAccountProviderEvents.Continue) + initialState.eventSink(ConfirmAccountProviderEvents.Continue(AuthenticationConfig.MATRIX_ORG_URL)) val submittedState = awaitLoginMode { it is AsyncData.Success } assertThat(submittedState.loginModeState.loginMode.dataOrNull()).isEqualTo(LoginMode.AccountCreation(aUrl)) cancelAndIgnoreRemainingEvents() @@ -390,7 +390,7 @@ class ConfirmAccountProviderPresenterTest { val initialState = awaitItem() initialState.eventSink(ConfirmAccountProviderEvents.UserInputChanged("https://random")) val suggestionState = awaitState { it.accountProviderSuggestion != null } - suggestionState.eventSink(ConfirmAccountProviderEvents.Continue) + suggestionState.eventSink(ConfirmAccountProviderEvents.Continue("https://randomcommunity.org")) awaitLoginMode { it is AsyncData.Success } assertThat(submittedUrls.first()).isEqualTo("https://randomcommunity.org") cancelAndIgnoreRemainingEvents() From bbb3a6808761ab450a605008f50ec86609927f8b Mon Sep 17 00:00:00 2001 From: Jenna Vassar Date: Mon, 10 Aug 2026 09:28:32 -0700 Subject: [PATCH 023/145] Save the selected account provider to history even if the flow default is reset --- .../accountprovider/AccountProviderDataSource.kt | 7 +++++++ .../SaveAccountProviderToHistory.kt | 6 +++++- .../SaveAccountProviderToHistoryTest.kt | 16 ++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderDataSource.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderDataSource.kt index 28e4294fa4..809c835d65 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderDataSource.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderDataSource.kt @@ -43,6 +43,12 @@ class AccountProviderDataSource( val flow: StateFlow = accountProvider.asStateFlow() + // The account provider the user last explicitly selected (via [setAccountProvider] / [setUrl]). + // Unlike [flow], this is not recomputed by [reset], so it survives to be persisted to history on a + // successful sign-in even when the login flow is torn down in between (e.g. across an OAuth round-trip). + var lastSelectedAccountProviderUrl: String? = null + private set + init { // Seed the default from the last used provider, unless the user has already selected one. coroutineScope.launch { @@ -72,6 +78,7 @@ class AccountProviderDataSource( } suspend fun setAccountProvider(data: AccountProvider) { + lastSelectedAccountProviderUrl = data.url accountProvider.emit(data) } diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/SaveAccountProviderToHistory.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/SaveAccountProviderToHistory.kt index a88be1ae15..46f3281826 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/SaveAccountProviderToHistory.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/SaveAccountProviderToHistory.kt @@ -23,6 +23,10 @@ class SaveAccountProviderToHistory( private val appPreferencesStore: AppPreferencesStore, ) { suspend operator fun invoke() { - appPreferencesStore.addHomeserverToHistory(accountProviderDataSource.flow.value.url) + // Persist the provider the user actually selected, not the currently-exposed default: the latter can be + // reset back to the history default while the login flow is torn down across an OAuth round-trip. + val url = accountProviderDataSource.lastSelectedAccountProviderUrl + ?: accountProviderDataSource.flow.value.url + appPreferencesStore.addHomeserverToHistory(url) } } diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accountprovider/SaveAccountProviderToHistoryTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accountprovider/SaveAccountProviderToHistoryTest.kt index 957235395f..21fd7efce8 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accountprovider/SaveAccountProviderToHistoryTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accountprovider/SaveAccountProviderToHistoryTest.kt @@ -31,4 +31,20 @@ class SaveAccountProviderToHistoryTest { assertThat(appPreferencesStore.getHomeserverHistoryFlow().first()) .containsExactly("https://example.com") } + + @Test + fun `invoke saves the selected provider even after the exposed default has been reset`() = runTest { + val appPreferencesStore = InMemoryAppPreferencesStore() + val accountProviderDataSource = anAccountProviderDataSource(appPreferencesStore = appPreferencesStore) + accountProviderDataSource.setUrl("https://example.com") + // Simulate the login flow being torn down (e.g. across an OAuth round-trip), which reverts the + // exposed default; the user's selection must still be the one saved to history. + accountProviderDataSource.reset() + val sut = SaveAccountProviderToHistory(accountProviderDataSource, appPreferencesStore) + + sut() + + assertThat(appPreferencesStore.getHomeserverHistoryFlow().first()) + .containsExactly("https://example.com") + } } From 749c96e409b9bac3da3ed9e2902b0eac5c3481ad Mon Sep 17 00:00:00 2001 From: Jenna Vassar Date: Mon, 10 Aug 2026 09:42:44 -0700 Subject: [PATCH 024/145] Raise the account provider history cap to 20 entries --- .../preferences/impl/store/DefaultAppPreferencesStore.kt | 2 +- .../impl/store/DefaultAppPreferencesStoreTest.kt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/preferences/impl/src/main/kotlin/io/element/android/libraries/preferences/impl/store/DefaultAppPreferencesStore.kt b/libraries/preferences/impl/src/main/kotlin/io/element/android/libraries/preferences/impl/store/DefaultAppPreferencesStore.kt index f8db0c11ee..1a14a0ea8f 100644 --- a/libraries/preferences/impl/src/main/kotlin/io/element/android/libraries/preferences/impl/store/DefaultAppPreferencesStore.kt +++ b/libraries/preferences/impl/src/main/kotlin/io/element/android/libraries/preferences/impl/store/DefaultAppPreferencesStore.kt @@ -47,7 +47,7 @@ private val callRingtoneDisplayNameKey = stringPreferencesKey("notificationCallR // URLs never contain a newline, so it is a safe delimiter to persist an ordered list in a single String. private const val HOMESERVER_HISTORY_DELIMITER = "\n" -private const val MAX_HOMESERVER_HISTORY_SIZE = 10 +private const val MAX_HOMESERVER_HISTORY_SIZE = 20 @ContributesBinding(AppScope::class) class DefaultAppPreferencesStore( diff --git a/libraries/preferences/impl/src/test/kotlin/io/element/android/libraries/preferences/impl/store/DefaultAppPreferencesStoreTest.kt b/libraries/preferences/impl/src/test/kotlin/io/element/android/libraries/preferences/impl/store/DefaultAppPreferencesStoreTest.kt index fbb9005ea5..4cf018371a 100644 --- a/libraries/preferences/impl/src/test/kotlin/io/element/android/libraries/preferences/impl/store/DefaultAppPreferencesStoreTest.kt +++ b/libraries/preferences/impl/src/test/kotlin/io/element/android/libraries/preferences/impl/store/DefaultAppPreferencesStoreTest.kt @@ -110,13 +110,13 @@ class DefaultAppPreferencesStoreTest { fun `homeserver history is capped to the most recent entries`() = runTest { val store = createStore() - repeat(15) { index -> + repeat(25) { index -> store.addHomeserverToHistory("https://server$index.org") } val history = store.getHomeserverHistoryFlow().first() - assertThat(history).hasSize(10) - assertThat(history.first()).isEqualTo("https://server14.org") + assertThat(history).hasSize(20) + assertThat(history.first()).isEqualTo("https://server24.org") assertThat(history.last()).isEqualTo("https://server5.org") } From 84b38e291a3b3a56ee71dfe278bf6d02d7cf0d50 Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Mon, 10 Aug 2026 22:53:50 +0300 Subject: [PATCH 025/145] Fix bug reports failing to send after the app has crashed The whole crash call stack was appended to the bug report description, and the bug report server copies that description verbatim into the GitHub issue it opens. GitHub refuses an issue body over 65536 characters, so the server's save step failed and answered "Could not save report". The stored crash data is only cleared after a successful send, so every retry failed the same way. Truncate the description before sending it. The user's own text and the GitHub issue link come first, so only the tail of the crash stack is dropped. The uncaught exception handler already writes the full stack through Timber, so it stays available in the attached log files. The 40 KB budget leaves room for the other reported fields, mainly the list of omitted log file names, which is not otherwise bounded. --- .../android/appconfig/RageshakeConfig.kt | 7 ++ .../impl/reporter/DefaultBugReporter.kt | 11 +++- .../impl/reporter/DefaultBugReporterTest.kt | 64 +++++++++++++++++++ 3 files changed, 81 insertions(+), 1 deletion(-) diff --git a/appconfig/src/main/kotlin/io/element/android/appconfig/RageshakeConfig.kt b/appconfig/src/main/kotlin/io/element/android/appconfig/RageshakeConfig.kt index 6dd2143d95..82d2145ecc 100644 --- a/appconfig/src/main/kotlin/io/element/android/appconfig/RageshakeConfig.kt +++ b/appconfig/src/main/kotlin/io/element/android/appconfig/RageshakeConfig.kt @@ -35,4 +35,11 @@ object RageshakeConfig { * The maximum number of log lines a rageshake can contain. */ const val MAX_LOG_LINES_SIZE = 1_000_000 + + /** + * The maximum size of the description. The bug report server copies it verbatim into a GitHub issue body, + * which GitHub rejects above 65536 characters. The remaining budget is left to the other reported fields, + * mainly the list of the omitted log file names. + */ + const val MAX_DESCRIPTION_SIZE = 40 * 1024 } diff --git a/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/reporter/DefaultBugReporter.kt b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/reporter/DefaultBugReporter.kt index 96bd7adfce..c1000784fc 100755 --- a/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/reporter/DefaultBugReporter.kt +++ b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/reporter/DefaultBugReporter.kt @@ -152,7 +152,7 @@ class DefaultBugReporter( append("\n\n\n\n--------------------------------- crash call stack ---------------------------------\n") append(crashCallStack) } - } + }.truncateDescription() val gzippedFiles = mutableListOf() var filesTooBig = emptyList() @@ -494,4 +494,13 @@ class DefaultBugReporter( private fun countLogLines(file: File): Int { return file.reader().useLines { it.count() } } + + private fun String.truncateDescription(): String { + return if (length <= RageshakeConfig.MAX_DESCRIPTION_SIZE) { + this + } else { + take(RageshakeConfig.MAX_DESCRIPTION_SIZE) + + "\n\n--------------------------------- truncated, see the attached logs ---------------------------------" + } + } } diff --git a/features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/reporter/DefaultBugReporterTest.kt b/features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/reporter/DefaultBugReporterTest.kt index ad29e5ed3f..fe32678c27 100755 --- a/features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/reporter/DefaultBugReporterTest.kt +++ b/features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/reporter/DefaultBugReporterTest.kt @@ -309,6 +309,68 @@ class DefaultBugReporterTest : RobolectricTest() { assertThat(foundValues["label"]).isEqualTo("crash") } + @Test + fun `test sendBugReport truncates a description which is too long`() = runTest { + val server = MockWebServer() + server.enqueue( + MockResponse() + .setResponseCode(200) + ) + server.start() + val hugeCrashCallStack = "a".repeat(RageshakeConfig.MAX_DESCRIPTION_SIZE * 2) + val sut = createDefaultBugReporter( + server = server, + crashDataStore = FakeCrashDataStore(hugeCrashCallStack, true), + ) + + sut.sendBugReport( + withDevicesLogs = true, + withCrashLogs = true, + withScreenshot = true, + problemDescription = "a bug occurred", + canContact = true, + listener = NoopBugReporterListener(), + ) + val request = server.takeRequest() + + val text = collectValuesFromFormData(request)["text"]!! + assertThat(text).startsWith("a bug occurred") + assertThat(text).contains("truncated") + assertThat(text.length).isAtMost(RageshakeConfig.MAX_DESCRIPTION_SIZE + TRUNCATION_MARKER_MAX_SIZE) + assertThat(text.length).isLessThan(GITHUB_MAX_ISSUE_BODY_SIZE) + server.shutdown() + } + + @Test + fun `test sendBugReport does not truncate a description which fits`() = runTest { + val server = MockWebServer() + server.enqueue( + MockResponse() + .setResponseCode(200) + ) + server.start() + val sut = createDefaultBugReporter( + server = server, + crashDataStore = FakeCrashDataStore("I did crash", true), + ) + + sut.sendBugReport( + withDevicesLogs = true, + withCrashLogs = true, + withScreenshot = true, + problemDescription = "a bug occurred", + canContact = true, + listener = NoopBugReporterListener(), + ) + val request = server.takeRequest() + + val text = collectValuesFromFormData(request)["text"]!! + assertThat(text).startsWith("a bug occurred") + assertThat(text).endsWith("I did crash") + assertThat(text).doesNotContain("truncated") + server.shutdown() + } + private fun collectValuesFromFormData(request: RecordedRequest): HashMap { val boundary = request.headers["Content-Type"]!!.split("=").last() val foundValues = HashMap() @@ -535,5 +597,7 @@ class DefaultBugReporterTest : RobolectricTest() { companion object { private const val EXPECTED_NUMBER_OF_PROGRESS_VALUE = 18 + private const val GITHUB_MAX_ISSUE_BODY_SIZE = 65536 + private const val TRUNCATION_MARKER_MAX_SIZE = 200 } } From b21c239a9d014ba32e682b41a2be9cef63d85431 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 11 Aug 2026 13:39:26 +0000 Subject: [PATCH 026/145] Update kotlin to v2.3.11 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9dbb2dbd5f..fc6d29f2d0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,7 +7,7 @@ android_gradle_plugin = "9.3.1" # When updating this, please also update the version in the file ./idea/kotlinc.xml kotlin = "2.4.10" kotlinpoet = "2.3.0" -ksp = "2.3.10" +ksp = "2.3.11" firebaseAppDistribution = "5.3.0" # AndroidX From 055fea8d2541521bfb158ebd0e24b833bd1a0e89 Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Tue, 11 Aug 2026 17:48:45 +0300 Subject: [PATCH 027/145] Hide the forward action on live location shares The timeline action sheet offered Forward on a live location share, but forwarding one always failed: Mode.Live maps to the SDK's MsgLikeKind.LiveLocation, which RoomContentForwarder rejects outright. So the action was shown for exactly the set of events on which it could never work. canBeForwarded() now returns true for a location event only when its mode is Static. Ended live shares keep Mode.Live and fail for the same reason, so they are excluded too. ActionListPresenter needs no change: its check is the function's only call site in the repo, so the single gate covers the timeline sheet, the threaded timeline and the pinned messages list. Hiding the action mirrors Element Web and the sticker exclusion already present in the same function. Converting a live share into a static m.location on forward would be a product decision and is out of scope. Relates to https://github.com/element-hq/element-x-android/issues/7190 --- .../model/event/TimelineItemEventContent.kt | 4 +- .../actionlist/ActionListPresenterTest.kt | 120 ++++++++++++++++++ 2 files changed, 123 insertions(+), 1 deletion(-) diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/model/event/TimelineItemEventContent.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/model/event/TimelineItemEventContent.kt index c60e3847da..01146a070b 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/model/event/TimelineItemEventContent.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/model/event/TimelineItemEventContent.kt @@ -58,10 +58,12 @@ fun TimelineItemEventContent.canBeForwarded(): Boolean = is TimelineItemFileContent, is TimelineItemAudioContent, is TimelineItemVideoContent, - is TimelineItemLocationContent, is TimelineItemVoiceContent, is TimelineItemGalleryContent, is TimelineItemAttachmentsContent -> true + // Live location shares can't be forwarded, the SDK rejects them, so we only show the option for static locations + // See https://github.com/element-hq/element-x-android/issues/7190 + is TimelineItemLocationContent -> mode is TimelineItemLocationContent.Mode.Static // Stickers can't be forwarded (yet) so we don't show the option // See https://github.com/element-hq/element-x-android/issues/2161 is TimelineItemStickerContent -> false diff --git a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/actionlist/ActionListPresenterTest.kt b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/actionlist/ActionListPresenterTest.kt index fb597df290..e987a32480 100644 --- a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/actionlist/ActionListPresenterTest.kt +++ b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/actionlist/ActionListPresenterTest.kt @@ -21,7 +21,10 @@ import io.element.android.features.messages.impl.timeline.model.event.RtcNotific import io.element.android.features.messages.impl.timeline.model.event.TimelineItemRedactedContent import io.element.android.features.messages.impl.timeline.model.event.TimelineItemRtcNotificationContent import io.element.android.features.messages.impl.timeline.model.event.TimelineItemTextContent +import io.element.android.features.messages.impl.timeline.model.event.aLiveLocationMode +import io.element.android.features.messages.impl.timeline.model.event.aStaticLocationMode import io.element.android.features.messages.impl.timeline.model.event.aTimelineItemImageContent +import io.element.android.features.messages.impl.timeline.model.event.aTimelineItemLocationContent import io.element.android.features.messages.impl.timeline.model.event.aTimelineItemPollContent import io.element.android.features.messages.impl.timeline.model.event.aTimelineItemStateEventContent import io.element.android.features.messages.impl.timeline.model.event.aTimelineItemVoiceContent @@ -601,6 +604,123 @@ class ActionListPresenterTest { } } + @Test + fun `present - compute for a static location item`() = runTest { + val presenter = createActionListPresenter(isDeveloperModeEnabled = true) + presenter.test { + val initialState = awaitItem() + val messageEvent = aMessageEvent( + isMine = true, + isEditable = false, + content = aTimelineItemLocationContent(mode = aStaticLocationMode()), + ) + initialState.eventSink.invoke( + ActionListEvent.ComputeForMessage( + event = messageEvent, + userEventPermissions = aUserEventPermissions( + canRedactOwn = true, + canRedactOther = false, + canSendMessage = true, + canSendReaction = true, + canPinUnpin = true, + ), + ) + ) + val successState = awaitItem() + assertThat(successState.target).isEqualTo( + ActionListState.Target.Success( + event = messageEvent, + sentTimeFull = "0 Full true", + displayEmojiReactions = true, + verifiedUserSendFailure = VerifiedUserSendFailure.None, + actions = persistentListOf( + TimelineItemAction.Reply, + TimelineItemAction.Forward, + TimelineItemAction.CopyLink, + TimelineItemAction.Pin, + TimelineItemAction.ViewSource, + TimelineItemAction.Redact, + ), + recentEmojis = suggestedEmojis, + ) + ) + initialState.eventSink.invoke(ActionListEvent.Clear) + assertThat(awaitItem().target).isEqualTo(ActionListState.Target.None) + } + } + + @Test + fun `present - compute for a live location item does not offer to forward it`() = runTest { + val presenter = createActionListPresenter(isDeveloperModeEnabled = true) + presenter.test { + val initialState = awaitItem() + val messageEvent = aMessageEvent( + isMine = true, + isEditable = false, + content = aTimelineItemLocationContent(mode = aLiveLocationMode(isActive = true)), + ) + initialState.eventSink.invoke( + ActionListEvent.ComputeForMessage( + event = messageEvent, + userEventPermissions = aUserEventPermissions( + canRedactOwn = true, + canRedactOther = false, + canSendMessage = true, + canSendReaction = true, + canPinUnpin = true, + ), + ) + ) + val successState = awaitItem() + assertThat(successState.target).isEqualTo( + ActionListState.Target.Success( + event = messageEvent, + sentTimeFull = "0 Full true", + displayEmojiReactions = true, + verifiedUserSendFailure = VerifiedUserSendFailure.None, + actions = persistentListOf( + TimelineItemAction.Reply, + TimelineItemAction.CopyLink, + TimelineItemAction.Pin, + TimelineItemAction.ViewSource, + TimelineItemAction.Redact, + ), + recentEmojis = suggestedEmojis, + ) + ) + initialState.eventSink.invoke(ActionListEvent.Clear) + assertThat(awaitItem().target).isEqualTo(ActionListState.Target.None) + } + } + + @Test + fun `present - compute for an ended live location item does not offer to forward it`() = runTest { + val presenter = createActionListPresenter(isDeveloperModeEnabled = true) + presenter.test { + val initialState = awaitItem() + val messageEvent = aMessageEvent( + isMine = true, + isEditable = false, + content = aTimelineItemLocationContent(mode = aLiveLocationMode(isActive = false)), + ) + initialState.eventSink.invoke( + ActionListEvent.ComputeForMessage( + event = messageEvent, + userEventPermissions = aUserEventPermissions( + canRedactOwn = true, + canRedactOther = false, + canSendMessage = true, + canSendReaction = true, + canPinUnpin = true, + ), + ) + ) + val successState = awaitItem() + assertThat((successState.target as ActionListState.Target.Success).actions) + .doesNotContain(TimelineItemAction.Forward) + } + } + @Test fun `present - compute for a media with caption item`() = runTest { val presenter = createActionListPresenter(isDeveloperModeEnabled = true) From c8bfabcaf5687e508ee61b82d5196a459d544e58 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 12 Aug 2026 13:41:43 +0200 Subject: [PATCH 028/145] Changelog for version 26.08.1 --- CHANGES.md | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 3f7360a338..2955fc8ad7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,95 @@ +Changes in Element X v26.08.1 +============================= + + + +## What's Changed +### 🙌 Improvements +* Render push notifications for live location share starts (MSC4505) by @ara4n in https://github.com/element-hq/element-x-android/pull/7203 +* [Task] Show active call participants in the people list #7199 by @Eklavya47 in https://github.com/element-hq/element-x-android/pull/7300 +### 🐛 Bugfixes +* Fix overlap issue. by @bmarty in https://github.com/element-hq/element-x-android/pull/7331 +* Announce checked/unchecked state for user rows in invite screen by @bmarty in https://github.com/element-hq/element-x-android/pull/7136 +* Display 'add reactions' menu in the threads screen by @jmartinesp in https://github.com/element-hq/element-x-android/pull/7388 +* Expand the emoji picker to full height when the keyboard is shown by @hayaksi1 in https://github.com/element-hq/element-x-android/pull/7382 +* UI fixes by @bmarty in https://github.com/element-hq/element-x-android/pull/7409 +### 🗣 Translations +* Sync Strings by @ElementBot in https://github.com/element-hq/element-x-android/pull/7389 +### 🧱 Build +* Don't check enterprise previews in `KonsistPreviewTest` by @jmartinesp in https://github.com/element-hq/element-x-android/pull/7297 +* CI: split unit tests, screenshots and coverage in `tests.yml` by @jmartinesp in https://github.com/element-hq/element-x-android/pull/7296 +* Update Gradle Wrapper from 9.6.1 to 9.7.0 by @ElementBot in https://github.com/element-hq/element-x-android/pull/7335 +### 🚧 In development 🚧 +* QR code login iteration by @bmarty in https://github.com/element-hq/element-x-android/pull/6719 +* User status last pieces by @ganfra in https://github.com/element-hq/element-x-android/pull/7328 +* [Link new device] Add timeout by @bmarty in https://github.com/element-hq/element-x-android/pull/7338 +### Dependency upgrades +* Update dependency org.maplibre.compose:maplibre-compose to v0.13.1 by @renovate[bot] in https://github.com/element-hq/element-x-android/pull/7291 +* Update android.gradle.plugin to v9.3.0 by @renovate[bot] in https://github.com/element-hq/element-x-android/pull/7248 +* Update dependency io.sentry:sentry-android to v8.50.0 by @renovate[bot] in https://github.com/element-hq/element-x-android/pull/7298 +* Update zizmorcore/zizmor-action action to v0.6.1 by @renovate[bot] in https://github.com/element-hq/element-x-android/pull/7306 +* Update android.gradle.plugin to v9.3.1 by @renovate[bot] in https://github.com/element-hq/element-x-android/pull/7304 +* Update dependency com.posthog:posthog-android to v3.56.4 by @renovate[bot] in https://github.com/element-hq/element-x-android/pull/7311 +* Update dependencyAnalysis to v3.18.0 by @renovate[bot] in https://github.com/element-hq/element-x-android/pull/7318 +* Update actions/stale action to v11 by @renovate[bot] in https://github.com/element-hq/element-x-android/pull/7317 +* Update dependency io.github.zxing-cpp:android to v3.1.1 by @renovate[bot] in https://github.com/element-hq/element-x-android/pull/7322 +* Update dependency org.matrix.rustcomponents:sdk-android to v26.08.05 by @renovate[bot] in https://github.com/element-hq/element-x-android/pull/7324 +* Update dependency androidx.constraintlayout:constraintlayout to v2.2.2 by @renovate[bot] in https://github.com/element-hq/element-x-android/pull/7329 +* Update reactivecircus/android-emulator-runner action to v2.38.0 by @renovate[bot] in https://github.com/element-hq/element-x-android/pull/7189 +* Update dependency io.sentry:sentry-android to v8.51.0 by @renovate[bot] in https://github.com/element-hq/element-x-android/pull/7301 +* Update dependency org.maplibre.gl:android-sdk to v13.4.1 by @renovate[bot] in https://github.com/element-hq/element-x-android/pull/7305 +* Update dependency io.element.android:element-call-embedded to v0.23.0 by @renovate[bot] in https://github.com/element-hq/element-x-android/pull/7323 +* Update metro to v1.4.0 by @renovate[bot] in https://github.com/element-hq/element-x-android/pull/7334 +* Update dependency com.google.firebase:firebase-bom to v34.17.0 by @renovate[bot] in https://github.com/element-hq/element-x-android/pull/7333 +* Update dependency androidx.compose.material3:material3 to v1.5.0-alpha23 by @renovate[bot] in https://github.com/element-hq/element-x-android/pull/7175 +* Update dependency org.jsoup:jsoup to v1.23.1 by @renovate[bot] in https://github.com/element-hq/element-x-android/pull/7332 +* Update dependency androidx.constraintlayout:constraintlayout-compose to v1.1.2 by @renovate[bot] in https://github.com/element-hq/element-x-android/pull/7330 +* Update zizmorcore/zizmor-action action to v0.6.2 by @renovate[bot] in https://github.com/element-hq/element-x-android/pull/7383 +* Update actions/setup-java action to v5.7.0 by @renovate[bot] in https://github.com/element-hq/element-x-android/pull/7339 +* Update gradle/actions action to v6.3.0 by @renovate[bot] in https://github.com/element-hq/element-x-android/pull/7384 +* Update plugin dependencycheck to v13 by @renovate[bot] in https://github.com/element-hq/element-x-android/pull/7386 +* Update dependency org.matrix.rustcomponents:sdk-android to v26.08.11 by @renovate[bot] in https://github.com/element-hq/element-x-android/pull/7402 +### 💼 Element Pro +* Add support for checking the ESS config in Element Pro by @jmartinesp in https://github.com/element-hq/element-x-android/pull/7302 +### Others +* Add extra vertical padding to `ReplyToInvalidContent` and `ReplyToNotFoundContent` by @jmartinesp in https://github.com/element-hq/element-x-android/pull/7288 +* Index messages locally in an encrypted on-device store so encrypted rooms can be searched at all by @hayaksi1 in https://github.com/element-hq/element-x-android/pull/7249 +* Bump enterprise module to the latest commit by @jmartinesp in https://github.com/element-hq/element-x-android/pull/7307 +* Bump enterprise module to the latest commit by @jennaharris7 in https://github.com/element-hq/element-x-android/pull/7309 +* Move deviceId and git details to developer settings by @bmarty in https://github.com/element-hq/element-x-android/pull/7241 +* Show a Message not found placeholder when a replied to message cannot be loaded by @hayaksi1 in https://github.com/element-hq/element-x-android/pull/7376 +* Update in reply to message when message is not found. by @bmarty in https://github.com/element-hq/element-x-android/pull/7387 +* Add default `OAUTH_CLIENT_URL_PATH` alternative by @jmartinesp in https://github.com/element-hq/element-x-android/pull/7385 +* Fix the feature module template writing the impl build script into the api module by @hayaksi1 in https://github.com/element-hq/element-x-android/pull/7374 +* Let users enter their full Matrix user ID when searching for a homeserver by @hayaksi1 in https://github.com/element-hq/element-x-android/pull/7375 +* Keep manually revealed media visible when re-entering a room by @hayaksi1 in https://github.com/element-hq/element-x-android/pull/7378 +* Copy a blocked user's Matrix ID by long pressing them by @hayaksi1 in https://github.com/element-hq/element-x-android/pull/7372 +* Do not draw the media loading progress bar under the status bar by @hayaksi1 in https://github.com/element-hq/element-x-android/pull/7366 +* Do not notify about an event sent by another account on the same device by @hayaksi1 in https://github.com/element-hq/element-x-android/pull/7360 +* Keep the opened image on screen when the media gallery fails to load by @hayaksi1 in https://github.com/element-hq/element-x-android/pull/7362 +* Do not linkify the server part of a fediverse handle as an email address by @hayaksi1 in https://github.com/element-hq/element-x-android/pull/7356 +* Expose global account data get and set on MatrixClient by @hayaksi1 in https://github.com/element-hq/element-x-android/pull/7373 +* Show the alias or the direct message user's Matrix ID in the room picker by @hayaksi1 in https://github.com/element-hq/element-x-android/pull/7371 +* Use a dedicated string for the Mute room notification mode by @hayaksi1 in https://github.com/element-hq/element-x-android/pull/7367 +* Keep playing a voice message when the screen turns off by @hayaksi1 in https://github.com/element-hq/element-x-android/pull/7365 +* Let a voice message without a waveform be seeked by @hayaksi1 in https://github.com/element-hq/element-x-android/pull/7363 +* Ignore a second voice recording start while one is already running by @hayaksi1 in https://github.com/element-hq/element-x-android/pull/7346 +* Do not offer to start a call in a DM with no other member by @hayaksi1 in https://github.com/element-hq/element-x-android/pull/7352 +* Do not notify about a redaction whose target event is unknown by @hayaksi1 in https://github.com/element-hq/element-x-android/pull/7350 +* Ignore a room list filter that is incompatible with an already selected one by @hayaksi1 in https://github.com/element-hq/element-x-android/pull/7342 +* Stop a right to left sender name from reordering a room list preview by @hayaksi1 in https://github.com/element-hq/element-x-android/pull/7348 +* Do not append the application MapTiler key to a custom map style url by @hayaksi1 in https://github.com/element-hq/element-x-android/pull/7340 +* Hide space children you have left that can only be joined by invitation by @hayaksi1 in https://github.com/element-hq/element-x-android/pull/7369 +* Never re-encode a video at a higher bitrate than the source by @hayaksi1 in https://github.com/element-hq/element-x-android/pull/7351 +* Display push notifications for knocks by @ara4n in https://github.com/element-hq/element-x-android/pull/7207 + +## New Contributors +* @hayaksi1 made their first contribution in https://github.com/element-hq/element-x-android/pull/7249 +* @ara4n made their first contribution in https://github.com/element-hq/element-x-android/pull/7203 +* @Eklavya47 made their first contribution in https://github.com/element-hq/element-x-android/pull/7300 + +**Full Changelog**: https://github.com/element-hq/element-x-android/compare/v26.08.0...v26.08.1 + Changes in Element X v26.08.0 ============================= From 6badc9634c2bcd40564e46a316b1f020113519b1 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 12 Aug 2026 09:24:59 +0100 Subject: [PATCH 029/145] build-rust-sdk: print the command we run It's helpful to know what exactly is being run. Also some tweaks to reduce the amount of directory changing that needs to happen. --- tools/sdk/build-rust-sdk | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tools/sdk/build-rust-sdk b/tools/sdk/build-rust-sdk index 91c6ed6e02..b89ae2cf42 100755 --- a/tools/sdk/build-rust-sdk +++ b/tools/sdk/build-rust-sdk @@ -215,25 +215,26 @@ if [ "$update_components" == "1" ]; then printf "\n## Resetting ${kotlinComponentsPath} to the latest main...\n\n" - cd "${kotlinComponentsPath}" - git reset --hard - git checkout main - git pull -else - cd "${kotlinComponentsPath}" + ( + cd "${kotlinComponentsPath}" + git reset --hard + git checkout main + git pull + ) fi ## Build the SDK printf "\n## Building the SDK for ${target_arch}...\n\n" -./scripts/build.sh \ +cmd=("${kotlinComponentsPath}/scripts/build.sh" \ -p "${rustSdkPath}" \ -m sdk \ -t "${target_arch}" \ - -o "${elementPwd}/libraries/rustsdk" + -o "${elementPwd}/libraries/rustsdk") -cd "${elementPwd}" +echo "$ ${cmd[@]}" +"${cmd[@]}" mv \ ./libraries/rustsdk/sdk-android-debug.aar \ From 76092fcba65962346f6bcf8db8279ad16aa87fa8 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 12 Aug 2026 09:40:41 +0100 Subject: [PATCH 030/145] fix lint --- tools/sdk/build-rust-sdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/sdk/build-rust-sdk b/tools/sdk/build-rust-sdk index b89ae2cf42..014aec6770 100755 --- a/tools/sdk/build-rust-sdk +++ b/tools/sdk/build-rust-sdk @@ -233,7 +233,7 @@ cmd=("${kotlinComponentsPath}/scripts/build.sh" \ -t "${target_arch}" \ -o "${elementPwd}/libraries/rustsdk") -echo "$ ${cmd[@]}" +echo "$" "${cmd[@]}" "${cmd[@]}" mv \ From d4863db03ecd3e3ee563201d50b17f59acdf7cda Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Wed, 12 Aug 2026 16:06:02 +0300 Subject: [PATCH 031/145] Group the GitHub issue body limit constant with an underscore The GITHUB_MAX_ISSUE_BODY_SIZE constant added with the description truncation is a five-digit literal, above detekt's acceptableLength of 4, so :features:rageshake:impl:detekt failed. Write it as 65_536, matching MAX_LOG_LINES_SIZE in RageshakeConfig. --- .../features/rageshake/impl/reporter/DefaultBugReporterTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/reporter/DefaultBugReporterTest.kt b/features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/reporter/DefaultBugReporterTest.kt index fe32678c27..7bb2add0e5 100755 --- a/features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/reporter/DefaultBugReporterTest.kt +++ b/features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/reporter/DefaultBugReporterTest.kt @@ -597,7 +597,7 @@ class DefaultBugReporterTest : RobolectricTest() { companion object { private const val EXPECTED_NUMBER_OF_PROGRESS_VALUE = 18 - private const val GITHUB_MAX_ISSUE_BODY_SIZE = 65536 + private const val GITHUB_MAX_ISSUE_BODY_SIZE = 65_536 private const val TRUNCATION_MARKER_MAX_SIZE = 200 } } From 7c648b34b703a6d6ca077fc1294bbeec1f66f37b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Mart=C3=ADn?= Date: Wed, 12 Aug 2026 16:04:24 +0200 Subject: [PATCH 032/145] Remove the legacy web-based account creation for matrix.org This was added as a temporary measure to allow matrix.org users to use Element X before it supported MAS, but it hasn't been needed for a very long time --- .../features/login/impl/LoginFlowNode.kt | 26 --- .../login/impl/login/LoginModePresenter.kt | 8 +- .../login/impl/login/LoginModeState.kt | 1 - .../login/impl/login/LoginModeView.kt | 3 - .../ChooseAccountProviderNode.kt | 2 - .../ChooseAccountProviderView.kt | 3 - .../impl/screens/classic/ClassicFlowNode.kt | 5 - .../loginwithclassic/LoginWithClassicNode.kt | 2 - .../loginwithclassic/LoginWithClassicView.kt | 3 - .../ConfirmAccountProviderNode.kt | 2 - .../ConfirmAccountProviderView.kt | 3 - .../createaccount/CreateAccountEvents.kt | 14 -- .../createaccount/CreateAccountNode.kt | 58 ------ .../createaccount/CreateAccountPresenter.kt | 82 -------- .../createaccount/CreateAccountState.kt | 20 -- .../CreateAccountStateProvider.kt | 34 ---- .../createaccount/CreateAccountView.kt | 176 ------------------ .../screens/createaccount/MessageParser.kt | 44 ----- .../MobileRegistrationResponse.kt | 28 --- .../WebViewMessageInterceptor.kt | 91 --------- .../impl/screens/onboarding/OnBoardingNode.kt | 2 - .../impl/screens/onboarding/OnBoardingView.kt | 3 - .../WebClientUrlForAuthenticationRetriever.kt | 55 ------ .../ChooseAccountProviderViewTest.kt | 2 - .../ConfirmAccountProviderPresenterTest.kt | 54 +----- .../CreateAccountPresenterTest.kt | 124 ------------ .../createaccount/DefaultMessageParserTest.kt | 87 --------- .../createaccount/FakeMessageParser.kt | 20 -- .../onboarding/OnBoardingPresenterTest.kt | 4 - .../screens/onboarding/OnboardingViewTest.kt | 18 -- ...eWebClientUrlForAuthenticationRetriever.kt | 19 -- 31 files changed, 3 insertions(+), 990 deletions(-) delete mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountEvents.kt delete mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountNode.kt delete mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountPresenter.kt delete mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountState.kt delete mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountStateProvider.kt delete mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountView.kt delete mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/MessageParser.kt delete mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/MobileRegistrationResponse.kt delete mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/WebViewMessageInterceptor.kt delete mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/web/WebClientUrlForAuthenticationRetriever.kt delete mode 100644 features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountPresenterTest.kt delete mode 100644 features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/createaccount/DefaultMessageParserTest.kt delete mode 100644 features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/createaccount/FakeMessageParser.kt delete mode 100644 features/login/impl/src/test/kotlin/io/element/android/features/login/impl/web/FakeWebClientUrlForAuthenticationRetriever.kt diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/LoginFlowNode.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/LoginFlowNode.kt index 978d28dfa3..a662f20351 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/LoginFlowNode.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/LoginFlowNode.kt @@ -37,7 +37,6 @@ import io.element.android.features.login.impl.screens.changeaccountprovider.Chan import io.element.android.features.login.impl.screens.chooseaccountprovider.ChooseAccountProviderNode import io.element.android.features.login.impl.screens.classic.ClassicFlowNode import io.element.android.features.login.impl.screens.confirmaccountprovider.ConfirmAccountProviderNode -import io.element.android.features.login.impl.screens.createaccount.CreateAccountNode import io.element.android.features.login.impl.screens.loginpassword.LoginPasswordNode import io.element.android.features.login.impl.screens.onboarding.OnBoardingNode import io.element.android.features.login.impl.screens.searchaccountprovider.SearchAccountProviderNode @@ -140,9 +139,6 @@ class LoginFlowNode( data class LoginPassword( val initialLogin: String = "", ) : NavTarget - - @Parcelize - data class CreateAccount(val url: String) : NavTarget } override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node { @@ -164,10 +160,6 @@ class LoginFlowNode( override fun navigateToOAuth(oAuthDetails: OAuthDetails) { navigateToMas(oAuthDetails) } - - override fun navigateToCreateAccount(url: String) { - backstack.push(NavTarget.CreateAccount(url)) - } } createNode(buildContext, listOf(callback)) } @@ -201,10 +193,6 @@ class LoginFlowNode( navigateToMas(oAuthDetails) } - override fun navigateToCreateAccount(url: String) { - backstack.push(NavTarget.CreateAccount(url)) - } - override fun navigateToDeveloperSettings() { backstack.push(NavTarget.AppDeveloperSettings) } @@ -247,10 +235,6 @@ class LoginFlowNode( navigateToMas(oAuthDetails) } - override fun navigateToCreateAccount(url: String) { - backstack.push(NavTarget.CreateAccount(url)) - } - override fun navigateToLoginPassword() { backstack.push(NavTarget.LoginPassword()) } @@ -274,10 +258,6 @@ class LoginFlowNode( navigateToMas(oAuthDetails) } - override fun navigateToCreateAccount(url: String) { - backstack.push(NavTarget.CreateAccount(url)) - } - override fun navigateToLoginPassword() { backstack.push(NavTarget.LoginPassword()) } @@ -324,12 +304,6 @@ class LoginFlowNode( ) createNode(buildContext, plugins = listOf(inputs)) } - is NavTarget.CreateAccount -> { - val inputs = CreateAccountNode.Inputs( - url = navTarget.url, - ) - createNode(buildContext, listOf(inputs)) - } } } diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/login/LoginModePresenter.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/login/LoginModePresenter.kt index 34188095b0..466cd210ab 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/login/LoginModePresenter.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/login/LoginModePresenter.kt @@ -20,7 +20,6 @@ import io.element.android.features.login.impl.screens.classic.loginwithclassic.L import io.element.android.features.login.impl.screens.confirmaccountprovider.ConfirmAccountProviderPresenter import io.element.android.features.login.impl.screens.createaccount.AccountCreationNotSupported import io.element.android.features.login.impl.screens.onboarding.OnBoardingPresenter -import io.element.android.features.login.impl.web.WebClientUrlForAuthenticationRetriever import io.element.android.libraries.architecture.AsyncData import io.element.android.libraries.architecture.Presenter import io.element.android.libraries.architecture.runCatchingUpdatingState @@ -39,7 +38,6 @@ import io.element.android.libraries.oauth.api.OAuthActionFlow class LoginModePresenter( private val oAuthActionFlow: OAuthActionFlow, private val authenticationService: MatrixAuthenticationService, - private val webClientUrlForAuthenticationRetriever: WebClientUrlForAuthenticationRetriever, private val localNetworkPermissionGate: LocalNetworkPermissionGate, ) : Presenter { @Composable @@ -90,11 +88,9 @@ class LoginModePresenter( authenticationService.getOAuthUrl(prompt = oAuthPrompt, loginHint = request.loginHint).getOrThrow() ) } - request.isAccountCreation -> LoginMode.AccountCreation( - webClientUrlForAuthenticationRetriever.retrieve(request.homeserverUrl) - ) + request.isAccountCreation -> throw AccountCreationNotSupported() matrixHomeServerDetails.supportsPasswordLogin -> LoginMode.PasswordLogin - else -> error("Unsupported login flow") + else -> error("Unsupported authentication flow") } }.getOrThrow() }.runCatchingUpdatingState( diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/login/LoginModeState.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/login/LoginModeState.kt index 849ff31f85..86dd550ea6 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/login/LoginModeState.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/login/LoginModeState.kt @@ -20,5 +20,4 @@ data class LoginModeState( sealed interface LoginMode { data object PasswordLogin : LoginMode data class OAuth(val oAuthDetails: OAuthDetails) : LoginMode - data class AccountCreation(val url: String) : LoginMode } diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/login/LoginModeView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/login/LoginModeView.kt index 3549e17457..8b59db1d61 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/login/LoginModeView.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/login/LoginModeView.kt @@ -34,7 +34,6 @@ fun LoginModeView( onLearnMoreClick: () -> Unit, onOAuthDetails: (OAuthDetails) -> Unit, onNeedLoginPassword: () -> Unit, - onCreateAccountContinue: (url: String) -> Unit ) { val context = LocalContext.current when (loginMode) { @@ -120,7 +119,6 @@ fun LoginModeView( when (val loginModeData = loginMode.data) { is LoginMode.OAuth -> onOAuthDetails(loginModeData.oAuthDetails) LoginMode.PasswordLogin -> onNeedLoginPassword() - is LoginMode.AccountCreation -> onCreateAccountContinue(loginModeData.url) } // Also clear the data, to let the next screen be able to go back onClearError() @@ -139,7 +137,6 @@ internal fun LoginModeViewPreview(@PreviewParameter(LoginModeViewErrorProvider:: onLearnMoreClick = {}, onOAuthDetails = {}, onNeedLoginPassword = {}, - onCreateAccountContinue = {} ) } } diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/chooseaccountprovider/ChooseAccountProviderNode.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/chooseaccountprovider/ChooseAccountProviderNode.kt index 5f79f197d9..6432042818 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/chooseaccountprovider/ChooseAccountProviderNode.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/chooseaccountprovider/ChooseAccountProviderNode.kt @@ -32,7 +32,6 @@ class ChooseAccountProviderNode( interface Callback : Plugin { fun navigateToLoginPassword() fun navigateToOAuth(oAuthDetails: OAuthDetails) - fun navigateToCreateAccount(url: String) } private val callback: Callback = callback() @@ -48,7 +47,6 @@ class ChooseAccountProviderNode( onOAuthDetails = callback::navigateToOAuth, onNeedLoginPassword = callback::navigateToLoginPassword, onLearnMoreClick = { openLearnMorePage(context) }, - onCreateAccountContinue = callback::navigateToCreateAccount, ) } } diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/chooseaccountprovider/ChooseAccountProviderView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/chooseaccountprovider/ChooseAccountProviderView.kt index e858789bb4..0d9d8cfba7 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/chooseaccountprovider/ChooseAccountProviderView.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/chooseaccountprovider/ChooseAccountProviderView.kt @@ -57,7 +57,6 @@ fun ChooseAccountProviderView( onOAuthDetails: (OAuthDetails) -> Unit, onNeedLoginPassword: () -> Unit, onLearnMoreClick: () -> Unit, - onCreateAccountContinue: (url: String) -> Unit, modifier: Modifier = Modifier, ) { val isLoading by remember(state.loginModeState.loginMode) { @@ -137,7 +136,6 @@ fun ChooseAccountProviderView( onLearnMoreClick = onLearnMoreClick, onOAuthDetails = onOAuthDetails, onNeedLoginPassword = onNeedLoginPassword, - onCreateAccountContinue = onCreateAccountContinue, ) } } @@ -161,6 +159,5 @@ internal fun ChooseAccountProviderViewPreview(@PreviewParameter(ChooseAccountPro onLearnMoreClick = { }, onOAuthDetails = { }, onNeedLoginPassword = { }, - onCreateAccountContinue = { }, ) } diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/classic/ClassicFlowNode.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/classic/ClassicFlowNode.kt index cfbd86f363..160b500cf6 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/classic/ClassicFlowNode.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/classic/ClassicFlowNode.kt @@ -55,7 +55,6 @@ class ClassicFlowNode( fun navigateToOnBoarding(allowBackNavigation: Boolean) fun navigateToLoginPassword() fun navigateToOAuth(oAuthDetails: OAuthDetails) - fun navigateToCreateAccount(url: String) } sealed interface NavTarget : Parcelable { @@ -115,10 +114,6 @@ class ClassicFlowNode( callback.navigateToOAuth(oAuthDetails) } - override fun navigateToCreateAccount(url: String) { - callback.navigateToCreateAccount(url) - } - override fun navigateToMissingKeyBackup() { backstack.push(NavTarget.MissingKeyBackup) } diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/classic/loginwithclassic/LoginWithClassicNode.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/classic/loginwithclassic/LoginWithClassicNode.kt index d5acca38ae..ff56b0e8e8 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/classic/loginwithclassic/LoginWithClassicNode.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/classic/loginwithclassic/LoginWithClassicNode.kt @@ -36,7 +36,6 @@ class LoginWithClassicNode( fun navigateToOtherOptions() fun navigateToLoginPassword() fun navigateToOAuth(oAuthDetails: OAuthDetails) - fun navigateToCreateAccount(url: String) fun navigateToMissingKeyBackup() } @@ -63,7 +62,6 @@ class LoginWithClassicNode( onOAuthDetails = callback::navigateToOAuth, onNeedLoginPassword = callback::navigateToLoginPassword, onLearnMoreClick = { openLearnMorePage(context) }, - onCreateAccountContinue = callback::navigateToCreateAccount, ) } } diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/classic/loginwithclassic/LoginWithClassicView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/classic/loginwithclassic/LoginWithClassicView.kt index 75181a068e..81638b4be0 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/classic/loginwithclassic/LoginWithClassicView.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/classic/loginwithclassic/LoginWithClassicView.kt @@ -64,7 +64,6 @@ fun LoginWithClassicView( onOAuthDetails: (OAuthDetails) -> Unit, onNeedLoginPassword: () -> Unit, onLearnMoreClick: () -> Unit, - onCreateAccountContinue: (url: String) -> Unit, modifier: Modifier = Modifier, ) { val isLoading by remember(state.loginModeState.loginMode) { @@ -204,7 +203,6 @@ fun LoginWithClassicView( onLearnMoreClick = onLearnMoreClick, onOAuthDetails = onOAuthDetails, onNeedLoginPassword = onNeedLoginPassword, - onCreateAccountContinue = onCreateAccountContinue, ) LocalNetworkPermissionDialogView( dialog = state.loginModeState.localNetworkPermissionDialog, @@ -226,6 +224,5 @@ internal fun LoginWithClassicViewPreview(@PreviewParameter(LoginWithClassicState onOAuthDetails = {}, onNeedLoginPassword = {}, onLearnMoreClick = {}, - onCreateAccountContinue = {}, ) } diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderNode.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderNode.kt index 928a493dc1..0accaea767 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderNode.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderNode.kt @@ -45,7 +45,6 @@ class ConfirmAccountProviderNode( interface Callback : Plugin { fun navigateToLoginPassword() fun navigateToOAuth(oAuthDetails: OAuthDetails) - fun navigateToCreateAccount(url: String) fun navigateToChangeAccountProvider() } @@ -60,7 +59,6 @@ class ConfirmAccountProviderNode( modifier = modifier, onOAuthDetails = callback::navigateToOAuth, onNeedLoginPassword = callback::navigateToLoginPassword, - onCreateAccountContinue = callback::navigateToCreateAccount, onChange = callback::navigateToChangeAccountProvider, onLearnMoreClick = { openLearnMorePage(context) }, ) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt index 95fbff25ab..3702b195a1 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt @@ -43,7 +43,6 @@ fun ConfirmAccountProviderView( onOAuthDetails: (OAuthDetails) -> Unit, onNeedLoginPassword: () -> Unit, onLearnMoreClick: () -> Unit, - onCreateAccountContinue: (url: String) -> Unit, onChange: () -> Unit, modifier: Modifier = Modifier, ) { @@ -107,7 +106,6 @@ fun ConfirmAccountProviderView( onLearnMoreClick = onLearnMoreClick, onOAuthDetails = onOAuthDetails, onNeedLoginPassword = onNeedLoginPassword, - onCreateAccountContinue = onCreateAccountContinue, ) } @@ -131,7 +129,6 @@ internal fun ConfirmAccountProviderViewPreview( state = state, onOAuthDetails = {}, onNeedLoginPassword = {}, - onCreateAccountContinue = {}, onLearnMoreClick = {}, onChange = {}, ) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountEvents.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountEvents.kt deleted file mode 100644 index a51557347e..0000000000 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountEvents.kt +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2024, 2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.screens.createaccount - -sealed interface CreateAccountEvents { - data class SetPageProgress(val progress: Int) : CreateAccountEvents - data class OnMessageReceived(val message: String) : CreateAccountEvents -} diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountNode.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountNode.kt deleted file mode 100644 index e1972e5a0f..0000000000 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountNode.kt +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2024, 2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.screens.createaccount - -import android.app.Activity -import androidx.activity.compose.LocalActivity -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import com.bumble.appyx.core.modality.BuildContext -import com.bumble.appyx.core.node.Node -import com.bumble.appyx.core.plugin.Plugin -import dev.zacsweers.metro.AppScope -import dev.zacsweers.metro.Assisted -import dev.zacsweers.metro.AssistedInject -import io.element.android.annotations.ContributesNode -import io.element.android.compound.theme.ElementTheme -import io.element.android.libraries.androidutils.browser.openUrlInChromeCustomTab -import io.element.android.libraries.architecture.NodeInputs -import io.element.android.libraries.architecture.inputs - -@ContributesNode(AppScope::class) -@AssistedInject -class CreateAccountNode( - @Assisted buildContext: BuildContext, - @Assisted plugins: List, - presenterFactory: CreateAccountPresenter.Factory, -) : Node(buildContext, plugins = plugins) { - data class Inputs( - val url: String, - ) : NodeInputs - - private val presenter = presenterFactory.create(inputs().url) - - private fun onOpenExternalUrl(activity: Activity, darkTheme: Boolean, url: String) { - activity.openUrlInChromeCustomTab(null, darkTheme, url) - } - - @Composable - override fun View(modifier: Modifier) { - val activity = requireNotNull(LocalActivity.current) - val isDark = ElementTheme.isLightTheme.not() - val state = presenter.present() - CreateAccountView( - state = state, - modifier = modifier, - onBackClick = ::navigateUp, - onOpenExternalUrl = { - onOpenExternalUrl(activity, isDark, it) - }, - ) - } -} diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountPresenter.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountPresenter.kt deleted file mode 100644 index bf7af111f4..0000000000 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountPresenter.kt +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2023-2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.screens.createaccount - -import androidx.compose.runtime.Composable -import androidx.compose.runtime.MutableState -import androidx.compose.runtime.mutableIntStateOf -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.rememberCoroutineScope -import dev.zacsweers.metro.Assisted -import dev.zacsweers.metro.AssistedFactory -import dev.zacsweers.metro.AssistedInject -import io.element.android.libraries.architecture.AsyncAction -import io.element.android.libraries.architecture.Presenter -import io.element.android.libraries.core.extensions.flatMap -import io.element.android.libraries.core.extensions.runCatchingExceptions -import io.element.android.libraries.core.meta.BuildMeta -import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService -import io.element.android.libraries.matrix.api.core.SessionId -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.launch - -@AssistedInject -class CreateAccountPresenter( - @Assisted private val url: String, - private val authenticationService: MatrixAuthenticationService, - private val messageParser: MessageParser, - private val buildMeta: BuildMeta, -) : Presenter { - @AssistedFactory - interface Factory { - fun create(url: String): CreateAccountPresenter - } - - @Composable - override fun present(): CreateAccountState { - val coroutineScope = rememberCoroutineScope() - val pageProgress: MutableState = remember { mutableIntStateOf(0) } - val createAction: MutableState> = remember { mutableStateOf(AsyncAction.Uninitialized) } - - fun handleEvent(event: CreateAccountEvents) { - when (event) { - is CreateAccountEvents.SetPageProgress -> { - pageProgress.value = event.progress - } - is CreateAccountEvents.OnMessageReceived -> { - // Ignore unexpected message - if (event.message.contains("isTrusted")) return - coroutineScope.importSession(event.message, createAction) - } - } - } - - return CreateAccountState( - url = url, - pageProgress = pageProgress.value, - isDebugBuild = buildMeta.isDebuggable, - createAction = createAction.value, - eventSink = ::handleEvent, - ) - } - - private fun CoroutineScope.importSession(message: String, loggedInState: MutableState>) = launch { - loggedInState.value = AsyncAction.Loading - runCatchingExceptions { - messageParser.parse(message) - }.flatMap { externalSession -> - authenticationService.importCreatedSession(externalSession) - }.onSuccess { sessionId -> - loggedInState.value = AsyncAction.Success(sessionId) - }.onFailure { failure -> - loggedInState.value = AsyncAction.Failure(failure) - } - } -} diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountState.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountState.kt deleted file mode 100644 index de7efe573e..0000000000 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountState.kt +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2024, 2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.screens.createaccount - -import io.element.android.libraries.architecture.AsyncAction -import io.element.android.libraries.matrix.api.core.SessionId - -data class CreateAccountState( - val url: String, - val pageProgress: Int, - val createAction: AsyncAction, - val isDebugBuild: Boolean, - val eventSink: (CreateAccountEvents) -> Unit -) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountStateProvider.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountStateProvider.kt deleted file mode 100644 index 976ceae70d..0000000000 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountStateProvider.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2023-2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.screens.createaccount - -import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import io.element.android.libraries.architecture.AsyncAction -import io.element.android.libraries.matrix.api.core.SessionId - -open class CreateAccountStateProvider : PreviewParameterProvider { - override val values: Sequence - get() = sequenceOf( - aCreateAccountState(), - aCreateAccountState(pageProgress = 33), - aCreateAccountState(createAction = AsyncAction.Loading), - aCreateAccountState(createAction = AsyncAction.Failure(RuntimeException("Failed to create account"))), - ) -} - -private fun aCreateAccountState( - pageProgress: Int = 100, - createAction: AsyncAction = AsyncAction.Uninitialized, -) = CreateAccountState( - url = "https://example.com", - isDebugBuild = true, - pageProgress = pageProgress, - createAction = createAction, - eventSink = {} -) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountView.kt deleted file mode 100644 index 051188627a..0000000000 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountView.kt +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2024, 2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.screens.createaccount - -import android.annotation.SuppressLint -import android.view.ViewGroup -import android.webkit.JsResult -import android.webkit.WebChromeClient -import android.webkit.WebView -import androidx.compose.animation.AnimatedVisibility -import androidx.compose.animation.fadeIn -import androidx.compose.animation.fadeOut -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.consumeWindowInsets -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding -import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.platform.LocalInspectionMode -import androidx.compose.ui.res.stringResource -import androidx.compose.ui.tooling.preview.PreviewParameter -import androidx.compose.ui.unit.dp -import androidx.compose.ui.viewinterop.AndroidView -import io.element.android.compound.theme.ElementTheme -import io.element.android.features.login.impl.R -import io.element.android.libraries.designsystem.components.async.AsyncActionView -import io.element.android.libraries.designsystem.components.button.BackButton -import io.element.android.libraries.designsystem.preview.ElementPreview -import io.element.android.libraries.designsystem.preview.PreviewsDayNight -import io.element.android.libraries.designsystem.theme.components.LinearProgressIndicator -import io.element.android.libraries.designsystem.theme.components.Scaffold -import io.element.android.libraries.designsystem.theme.components.Text -import io.element.android.libraries.designsystem.theme.components.TopAppBar -import io.element.android.libraries.designsystem.theme.progressIndicatorTrackColor -import timber.log.Timber - -@OptIn(ExperimentalMaterial3Api::class) -@Composable -fun CreateAccountView( - state: CreateAccountState, - onBackClick: () -> Unit, - onOpenExternalUrl: (String) -> Unit, - modifier: Modifier = Modifier, -) { - Scaffold( - modifier = modifier, - topBar = { - TopAppBar( - titleStr = stringResource(R.string.screen_create_account_title), - navigationIcon = { - BackButton(onClick = onBackClick) - }, - ) - } - ) { contentPadding -> - Box( - modifier = Modifier - .padding(contentPadding) - .consumeWindowInsets(contentPadding) - .fillMaxSize() - ) { - CreateAccountWebView( - modifier = Modifier - .fillMaxSize(), - state = state, - onWebViewCreate = { webView -> - WebViewMessageInterceptor( - webView, - state.isDebugBuild, - onOpenExternalUrl = onOpenExternalUrl, - onMessage = { - state.eventSink(CreateAccountEvents.OnMessageReceived(it)) - }, - ) - } - ) - AnimatedVisibility( - visible = state.pageProgress != 100, - // Disable enter animation - enter = fadeIn(initialAlpha = 1f), - exit = fadeOut(), - ) { - LinearProgressIndicator( - modifier = Modifier - .fillMaxWidth() - .height(2.dp), - progress = { state.pageProgress / 100f }, - trackColor = ElementTheme.colors.progressIndicatorTrackColor, - ) - } - } - } - - AsyncActionView( - async = state.createAction, - onSuccess = {}, - onErrorDismiss = onBackClick, - onRetry = null - ) -} - -@Composable -private fun CreateAccountWebView( - state: CreateAccountState, - onWebViewCreate: (WebView) -> Unit, - modifier: Modifier = Modifier, -) { - if (LocalInspectionMode.current) { - Box(modifier = modifier, contentAlignment = Alignment.Center) { - Text("WebView - can't be previewed") - } - } else { - AndroidView( - modifier = modifier, - factory = { context -> - WebView(context).apply { - onWebViewCreate(this) - setup(state) - } - }, - update = { webView -> - if (webView.url != state.url) { - webView.loadUrl(state.url) - } - }, - onRelease = { webView -> - webView.destroy() - } - ) - } -} - -@SuppressLint("SetJavaScriptEnabled") -private fun WebView.setup(state: CreateAccountState) { - layoutParams = ViewGroup.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - ViewGroup.LayoutParams.MATCH_PARENT - ) - with(settings) { - javaScriptEnabled = true - domStorageEnabled = true - } - - webChromeClient = object : WebChromeClient() { - override fun onProgressChanged(view: WebView?, newProgress: Int) { - super.onProgressChanged(view, newProgress) - state.eventSink(CreateAccountEvents.SetPageProgress(newProgress)) - } - - override fun onJsBeforeUnload(view: WebView?, url: String?, message: String?, result: JsResult?): Boolean { - Timber.w("onJsBeforeUnload, cancelling the dialog, we will open external links in a Custom Chrome Tab") - result?.confirm() - return true - } - } -} - -@PreviewsDayNight -@Composable -internal fun CreateAccountViewPreview(@PreviewParameter(CreateAccountStateProvider::class) state: CreateAccountState) = ElementPreview { - CreateAccountView( - state = state, - onBackClick = {}, - onOpenExternalUrl = {}, - ) -} diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/MessageParser.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/MessageParser.kt deleted file mode 100644 index d7954373bc..0000000000 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/MessageParser.kt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2024, 2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.screens.createaccount - -import dev.zacsweers.metro.AppScope -import dev.zacsweers.metro.ContributesBinding -import io.element.android.features.login.impl.accountprovider.AccountProviderDataSource -import io.element.android.libraries.androidutils.json.JsonProvider -import io.element.android.libraries.matrix.api.auth.external.ExternalSession - -interface MessageParser { - /** - * Parse the message and return the ExternalSession object, or - * throw an exception if the message is invalid. - */ - fun parse(message: String): ExternalSession -} - -@ContributesBinding(AppScope::class) -class DefaultMessageParser( - private val accountProviderDataSource: AccountProviderDataSource, - private val json: JsonProvider, -) : MessageParser { - override fun parse(message: String): ExternalSession { - val response = json().decodeFromString(MobileRegistrationResponse.serializer(), message) - val userId = response.userId ?: error("No user ID in response") - val homeServer = response.homeServer ?: accountProviderDataSource.flow.value.url - val accessToken = response.accessToken ?: error("No access token in response") - val deviceId = response.deviceId ?: error("No device ID in response") - return ExternalSession( - userId = userId, - homeserverUrl = homeServer, - accessToken = accessToken, - deviceId = deviceId, - refreshToken = null, - ) - } -} diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/MobileRegistrationResponse.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/MobileRegistrationResponse.kt deleted file mode 100644 index 5e78b1bd37..0000000000 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/MobileRegistrationResponse.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2024, 2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.screens.createaccount - -import kotlinx.serialization.SerialName -import kotlinx.serialization.Serializable - -/** - * For ref: - * https://github.com/element-hq/matrix-react-sdk/pull/42/files#diff-2bbba5a742004fd4e924a639ded444279f66f7ad890cb669fbc91ac6b8638c64R56 - */ -@Serializable -data class MobileRegistrationResponse( - @SerialName("user_id") - val userId: String? = null, - @SerialName("home_server") - val homeServer: String? = null, - @SerialName("access_token") - val accessToken: String? = null, - @SerialName("device_id") - val deviceId: String? = null, -) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/WebViewMessageInterceptor.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/WebViewMessageInterceptor.kt deleted file mode 100644 index 20d503522b..0000000000 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/createaccount/WebViewMessageInterceptor.kt +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2023-2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.screens.createaccount - -import android.graphics.Bitmap -import android.webkit.JavascriptInterface -import android.webkit.WebResourceRequest -import android.webkit.WebView -import android.webkit.WebViewClient -import androidx.webkit.WebViewCompat -import androidx.webkit.WebViewFeature - -class WebViewMessageInterceptor( - webView: WebView, - private val debugLog: Boolean, - private val onOpenExternalUrl: (String) -> Unit, - private val onMessage: (String) -> Unit, -) { - companion object { - // We call both the WebMessageListener and the JavascriptInterface objects in JS with this - // 'listenerName' so they can both receive the data from the WebView when - // `${LISTENER_NAME}.postMessage(...)` is called - const val LISTENER_NAME = "elementX" - } - - init { - webView.webViewClient = object : WebViewClient() { - override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) { - super.onPageStarted(view, url, favicon) - - // We inject this JS code when the page starts loading to attach a message listener to the window. - view?.evaluateJavascript( - """ - window.addEventListener( - "mobileregistrationresponse", - (event) => { - let json = JSON.stringify(event.detail) - ${"console.log('message sent: ' + json);".takeIf { debugLog }} - $LISTENER_NAME.postMessage(json); - }, - false, - ); - """.trimIndent(), - null - ) - } - - override fun shouldOverrideUrlLoading(view: WebView?, request: WebResourceRequest?): Boolean { - request ?: return false - // Load the URL in a Chrome Custom Tab, and return true to cancel the load - onOpenExternalUrl(request.url.toString()) - return true - } - } - - // Use WebMessageListener if supported, otherwise use JavascriptInterface - if (WebViewFeature.isFeatureSupported(WebViewFeature.WEB_MESSAGE_LISTENER)) { - // Create a WebMessageListener, which will receive messages from the WebView and reply to them - val webMessageListener = WebViewCompat.WebMessageListener { _, message, _, _, _ -> - onMessageReceived(message.data) - } - WebViewCompat.addWebMessageListener( - webView, - LISTENER_NAME, - setOf("*"), - webMessageListener - ) - } else { - webView.addJavascriptInterface( - object { - @JavascriptInterface - fun postMessage(json: String?) { - onMessageReceived(json) - } - }, - LISTENER_NAME, - ) - } - } - - private fun onMessageReceived(json: String?) { - // Here is where we would handle the messages from the WebView, passing them to the listener - json?.let { onMessage(it) } - } -} diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingNode.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingNode.kt index 99f7e86fd3..244e684c5b 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingNode.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingNode.kt @@ -41,7 +41,6 @@ class OnBoardingNode( fun navigateToBugReport() fun navigateToLoginPassword() fun navigateToOAuth(oAuthDetails: OAuthDetails) - fun navigateToCreateAccount(url: String) fun navigateToDeveloperSettings() fun onDone() } @@ -74,7 +73,6 @@ class OnBoardingNode( onOAuthDetails = callback::navigateToOAuth, onNeedLoginPassword = callback::navigateToLoginPassword, onLearnMoreClick = { openLearnMorePage(context) }, - onCreateAccountContinue = callback::navigateToCreateAccount, onBackClick = callback::onDone, onDeveloperSettingsClick = callback::navigateToDeveloperSettings, ) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingView.kt index bf96b2dbe0..10fe3a854c 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingView.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingView.kt @@ -71,7 +71,6 @@ fun OnBoardingView( onOAuthDetails: (OAuthDetails) -> Unit, onNeedLoginPassword: () -> Unit, onLearnMoreClick: () -> Unit, - onCreateAccountContinue: (url: String) -> Unit, onReportProblem: () -> Unit, modifier: Modifier = Modifier, ) { @@ -84,7 +83,6 @@ fun OnBoardingView( onLearnMoreClick = onLearnMoreClick, onOAuthDetails = onOAuthDetails, onNeedLoginPassword = onNeedLoginPassword, - onCreateAccountContinue = onCreateAccountContinue, ) LocalNetworkPermissionDialogView( dialog = state.loginModeState.localNetworkPermissionDialog, @@ -366,6 +364,5 @@ internal fun OnBoardingViewPreview( onOAuthDetails = {}, onNeedLoginPassword = {}, onLearnMoreClick = {}, - onCreateAccountContinue = {}, ) } diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/web/WebClientUrlForAuthenticationRetriever.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/web/WebClientUrlForAuthenticationRetriever.kt deleted file mode 100644 index 2902126417..0000000000 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/web/WebClientUrlForAuthenticationRetriever.kt +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2024, 2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.web - -import androidx.core.net.toUri -import dev.zacsweers.metro.AppScope -import dev.zacsweers.metro.ContributesBinding -import io.element.android.appconfig.AuthenticationConfig -import io.element.android.features.login.impl.screens.createaccount.AccountCreationNotSupported -import io.element.android.libraries.matrix.api.TemporaryMatrixClientFactory -import io.element.android.libraries.wellknown.api.EnterpriseRemoteConfigSource -import io.element.android.libraries.wellknown.api.WellknownRetriever -import timber.log.Timber - -interface WebClientUrlForAuthenticationRetriever { - suspend fun retrieve(homeServerUrl: String): String -} - -@ContributesBinding(AppScope::class) -class DefaultWebClientUrlForAuthenticationRetriever( - private val wellknownRetrieverFactory: WellknownRetriever.Factory, - private val temporaryMatrixClientFactory: TemporaryMatrixClientFactory, -) : WebClientUrlForAuthenticationRetriever { - override suspend fun retrieve(homeServerUrl: String): String { - if (homeServerUrl != AuthenticationConfig.MATRIX_ORG_URL) { - Timber.w("Temporary account creation flow is only supported on matrix.org") - throw AccountCreationNotSupported() - } - val temporaryMatrixClient = temporaryMatrixClientFactory.create(homeServerUrl).getOrThrow() - return temporaryMatrixClient.use { - val wellknownRetriever = wellknownRetrieverFactory.create(temporaryMatrixClient) - val wellknown = wellknownRetriever.getElementWellKnown( - host = homeServerUrl, - source = EnterpriseRemoteConfigSource.WELLKNOWN_ENDPOINT - ).dataOrNull() ?: throw AccountCreationNotSupported() - - val registrationHelperUrl = wellknown.registrationHelperUrl - if (registrationHelperUrl != null) { - registrationHelperUrl.toUri() - .buildUpon() - .appendQueryParameter("hs_url", homeServerUrl) - .build() - .toString() - } else { - throw AccountCreationNotSupported() - } - } - } -} diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/chooseaccountprovider/ChooseAccountProviderViewTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/chooseaccountprovider/ChooseAccountProviderViewTest.kt index f1ce703d1c..cd64638563 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/chooseaccountprovider/ChooseAccountProviderViewTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/chooseaccountprovider/ChooseAccountProviderViewTest.kt @@ -84,7 +84,6 @@ class ChooseAccountProviderViewTest : RobolectricTest() { onOAuthDetails: (OAuthDetails) -> Unit = EnsureNeverCalledWithParam(), onNeedLoginPassword: () -> Unit = EnsureNeverCalled(), onLearnMoreClick: () -> Unit = EnsureNeverCalled(), - onCreateAccountContinue: (url: String) -> Unit = EnsureNeverCalledWithParam(), ) { setContent { ChooseAccountProviderView( @@ -93,7 +92,6 @@ class ChooseAccountProviderViewTest : RobolectricTest() { onOAuthDetails = onOAuthDetails, onNeedLoginPassword = onNeedLoginPassword, onLearnMoreClick = onLearnMoreClick, - onCreateAccountContinue = onCreateAccountContinue, ) } } diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt index c20896870b..52858b77af 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt @@ -15,8 +15,6 @@ import io.element.android.features.login.impl.accountprovider.AccountProviderDat import io.element.android.features.login.impl.login.LoginMode import io.element.android.features.login.impl.screens.createaccount.AccountCreationNotSupported import io.element.android.features.login.impl.screens.onboarding.createLoginModePresenter -import io.element.android.features.login.impl.web.FakeWebClientUrlForAuthenticationRetriever -import io.element.android.features.login.impl.web.WebClientUrlForAuthenticationRetriever import io.element.android.libraries.architecture.AsyncData import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService import io.element.android.libraries.matrix.test.AN_EXCEPTION @@ -283,7 +281,7 @@ class ConfirmAccountProviderPresenterTest { } @Test - fun `present - confirm account creation without oidc and without url generates an error`() = runTest { + fun `present - confirm account creation without oidc generates an error`() = runTest { val authenticationService = FakeMatrixAuthenticationService( setHomeserverResult = { Result.success(aMatrixHomeServerDetails()) @@ -292,9 +290,6 @@ class ConfirmAccountProviderPresenterTest { val presenter = createConfirmAccountProviderPresenter( params = ConfirmAccountProviderPresenter.Params(isAccountCreation = true), matrixAuthenticationService = authenticationService, - webClientUrlForAuthenticationRetriever = FakeWebClientUrlForAuthenticationRetriever { - throw AccountCreationNotSupported() - }, ) presenter.test { val initialState = awaitItem() @@ -331,64 +326,17 @@ class ConfirmAccountProviderPresenterTest { } } - @Test - fun `present - confirm account creation with OAuth and url continues with OAuth`() = runTest { - val aUrl = "aUrl" - val authenticationService = FakeMatrixAuthenticationService( - setHomeserverResult = { - Result.success(aMatrixHomeServerDetails(supportsOAuthLogin = true)) - }, - ) - val presenter = createConfirmAccountProviderPresenter( - params = ConfirmAccountProviderPresenter.Params(isAccountCreation = true), - matrixAuthenticationService = authenticationService, - webClientUrlForAuthenticationRetriever = FakeWebClientUrlForAuthenticationRetriever { aUrl }, - ) - presenter.test { - val initialState = awaitItem() - initialState.eventSink(ConfirmAccountProviderEvents.Continue) - skipItems(1) // Loading - val submittedState = awaitItem() - assertThat(submittedState.loginModeState.loginMode).isInstanceOf(AsyncData.Success::class.java) - assertThat(submittedState.loginModeState.loginMode.dataOrNull()).isInstanceOf(LoginMode.OAuth::class.java) - } - } - - @Test - fun `present - confirm account creation without OAuth and with url continuing with url`() = runTest { - val aUrl = "aUrl" - val authenticationService = FakeMatrixAuthenticationService( - setHomeserverResult = { - Result.success(aMatrixHomeServerDetails()) - }, - ) - val presenter = createConfirmAccountProviderPresenter( - params = ConfirmAccountProviderPresenter.Params(isAccountCreation = true), - matrixAuthenticationService = authenticationService, - webClientUrlForAuthenticationRetriever = FakeWebClientUrlForAuthenticationRetriever { aUrl }, - ) - presenter.test { - val initialState = awaitItem() - initialState.eventSink(ConfirmAccountProviderEvents.Continue) - skipItems(1) // Loading - val submittedState = awaitItem() - assertThat(submittedState.loginModeState.loginMode.dataOrNull()).isEqualTo(LoginMode.AccountCreation(aUrl)) - } - } - private fun createConfirmAccountProviderPresenter( params: ConfirmAccountProviderPresenter.Params = ConfirmAccountProviderPresenter.Params(isAccountCreation = false), accountProviderDataSource: AccountProviderDataSource = AccountProviderDataSource(FakeEnterpriseService()), matrixAuthenticationService: MatrixAuthenticationService = FakeMatrixAuthenticationService(), defaultOAuthActionFlow: OAuthActionFlow = FakeOAuthActionFlow(), - webClientUrlForAuthenticationRetriever: WebClientUrlForAuthenticationRetriever = FakeWebClientUrlForAuthenticationRetriever(), ) = ConfirmAccountProviderPresenter( params = params, accountProviderDataSource = accountProviderDataSource, loginModePresenter = createLoginModePresenter( authenticationService = matrixAuthenticationService, oAuthActionFlow = defaultOAuthActionFlow, - webClientUrlForAuthenticationRetriever = webClientUrlForAuthenticationRetriever, ), ) } diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountPresenterTest.kt deleted file mode 100644 index c70a5c9a9a..0000000000 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/createaccount/CreateAccountPresenterTest.kt +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2024, 2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.screens.createaccount - -import com.google.common.truth.Truth.assertThat -import io.element.android.libraries.architecture.AsyncAction -import io.element.android.libraries.core.meta.BuildMeta -import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService -import io.element.android.libraries.matrix.api.auth.external.ExternalSession -import io.element.android.libraries.matrix.api.verification.SessionVerifiedStatus -import io.element.android.libraries.matrix.test.AN_EXCEPTION -import io.element.android.libraries.matrix.test.A_SESSION_ID -import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService -import io.element.android.libraries.matrix.test.core.aBuildMeta -import io.element.android.libraries.matrix.test.verification.FakeSessionVerificationService -import io.element.android.tests.testutils.WarmUpRule -import io.element.android.tests.testutils.lambda.lambdaRecorder -import io.element.android.tests.testutils.lambda.value -import io.element.android.tests.testutils.test -import kotlinx.coroutines.test.runTest -import org.junit.Rule -import org.junit.Test - -class CreateAccountPresenterTest { - @get:Rule - val warmUpRule = WarmUpRule() - - @Test - fun `present - initial state`() = runTest { - val presenter = createPresenter() - presenter.test { - val initialState = awaitItem() - assertThat(initialState.url).isEqualTo("aUrl") - assertThat(initialState.pageProgress).isEqualTo(0) - assertThat(initialState.createAction).isEqualTo(AsyncAction.Uninitialized) - assertThat(initialState.isDebugBuild).isTrue() - } - } - - @Test - fun `present - set up progress update the state`() = runTest { - val presenter = createPresenter() - presenter.test { - val initialState = awaitItem() - initialState.eventSink(CreateAccountEvents.SetPageProgress(33)) - assertThat(awaitItem().pageProgress).isEqualTo(33) - } - } - - @Test - fun `present - receiving a message not able to be parsed change the state to error`() = runTest { - val presenter = createPresenter( - messageParser = FakeMessageParser { error("An error") } - ) - presenter.test { - val initialState = awaitItem() - initialState.eventSink(CreateAccountEvents.OnMessageReceived("")) - assertThat(awaitItem().createAction).isInstanceOf(AsyncAction.Failure::class.java) - } - } - - @Test - fun `present - receiving a message containing isTrusted is ignored`() = runTest { - val presenter = createPresenter() - presenter.test { - val initialState = awaitItem() - initialState.eventSink(CreateAccountEvents.OnMessageReceived("isTrusted")) - } - } - - @Test - fun `present - receiving a message able to be parsed change the state to success`() = runTest { - val lambda = lambdaRecorder { _ -> anExternalSession() } - val sessionVerificationService = FakeSessionVerificationService() - val presenter = createPresenter( - authenticationService = FakeMatrixAuthenticationService( - importCreatedSessionLambda = { Result.success(A_SESSION_ID) } - ), - messageParser = FakeMessageParser(lambda), - ) - presenter.test { - val initialState = awaitItem() - initialState.eventSink(CreateAccountEvents.OnMessageReceived("aMessage")) - assertThat(awaitItem().createAction.isLoading()).isTrue() - sessionVerificationService.emitVerifiedStatus(SessionVerifiedStatus.Verified) - assertThat(awaitItem().createAction.dataOrNull()).isEqualTo(A_SESSION_ID) - } - lambda.assertions().isCalledOnce().with(value("aMessage")) - } - - @Test - fun `present - receiving a message able to be parsed but error in importing change the state to error`() = runTest { - val presenter = createPresenter( - authenticationService = FakeMatrixAuthenticationService( - importCreatedSessionLambda = { Result.failure(AN_EXCEPTION) } - ), - messageParser = FakeMessageParser { anExternalSession() } - ) - presenter.test { - val initialState = awaitItem() - initialState.eventSink(CreateAccountEvents.OnMessageReceived("")) - assertThat(awaitItem().createAction.isLoading()).isTrue() - assertThat(awaitItem().createAction.errorOrNull()).isNotNull() - } - } - - private fun createPresenter( - url: String = "aUrl", - authenticationService: MatrixAuthenticationService = FakeMatrixAuthenticationService(), - messageParser: MessageParser = FakeMessageParser(), - buildMeta: BuildMeta = aBuildMeta(), - ) = CreateAccountPresenter( - url = url, - authenticationService = authenticationService, - messageParser = messageParser, - buildMeta = buildMeta, - ) -} diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/createaccount/DefaultMessageParserTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/createaccount/DefaultMessageParserTest.kt deleted file mode 100644 index 680fda2838..0000000000 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/createaccount/DefaultMessageParserTest.kt +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2024, 2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.screens.createaccount - -import com.google.common.truth.Truth.assertThat -import io.element.android.appconfig.AuthenticationConfig -import io.element.android.features.enterprise.test.FakeEnterpriseService -import io.element.android.features.login.impl.accountprovider.AccountProviderDataSource -import io.element.android.libraries.androidutils.json.DefaultJsonProvider -import io.element.android.libraries.matrix.api.auth.external.ExternalSession -import kotlinx.serialization.SerializationException -import org.junit.Assert.assertThrows -import org.junit.Test - -class DefaultMessageParserTest { - private val validMessage = """ - { - "user_id": "user_id", - "home_server": "home_server", - "access_token": "access_token", - "device_id": "device_id" - } - """.trimIndent() - - @Test - fun `DefaultMessageParser is able to parse correct message`() { - val sut = createDefaultMessageParser() - assertThat(sut.parse(validMessage)).isEqualTo( - anExternalSession( - homeserverUrl = "home_server", - ) - ) - } - - @Test - fun `DefaultMessageParser should throw Exception in case of error`() { - val sut = createDefaultMessageParser() - // kotlinx.serialization.json.internal.JsonDecodingException - assertThrows(SerializationException::class.java) { sut.parse("invalid json") } - // missing userId - assertThrows(IllegalStateException::class.java) { sut.parse(validMessage.replace(""""user_id": "user_id",""", "")) } - // missing accessToken - assertThrows(IllegalStateException::class.java) { sut.parse(validMessage.replace(""""access_token": "access_token",""", "")) } - // missing deviceId - assertThrows(IllegalStateException::class.java) { - sut.parse( - validMessage - .replace(""""access_token": "access_token",""", """"access_token": "access_token"""") - .replace(""""device_id": "device_id"""", "") - ) - } - } - - @Test - fun `DefaultMessageParser should be successful even is homeserver url is missing`() { - val sut = createDefaultMessageParser() - // missing homeServer - assertThat(sut.parse(validMessage.replace(""""home_server": "home_server",""", ""))).isEqualTo( - anExternalSession( - homeserverUrl = AuthenticationConfig.MATRIX_ORG_URL, - ) - ) - } - - private fun createDefaultMessageParser(): DefaultMessageParser { - return DefaultMessageParser( - accountProviderDataSource = AccountProviderDataSource(FakeEnterpriseService()), - json = DefaultJsonProvider(), - ) - } -} - -internal fun anExternalSession( - homeserverUrl: String = "home_server", -) = ExternalSession( - userId = "user_id", - homeserverUrl = homeserverUrl, - accessToken = "access_token", - deviceId = "device_id", - refreshToken = null, -) diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/createaccount/FakeMessageParser.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/createaccount/FakeMessageParser.kt deleted file mode 100644 index 62d6dd7dd4..0000000000 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/createaccount/FakeMessageParser.kt +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2024, 2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.screens.createaccount - -import io.element.android.libraries.matrix.api.auth.external.ExternalSession -import io.element.android.tests.testutils.lambda.lambdaError - -class FakeMessageParser( - private val parseResult: (String) -> ExternalSession = { lambdaError() } -) : MessageParser { - override fun parse(message: String): ExternalSession { - return parseResult(message) - } -} diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingPresenterTest.kt index 782ff00ec0..fbee19f05e 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingPresenterTest.kt @@ -17,8 +17,6 @@ import io.element.android.features.login.impl.accesscontrol.DefaultAccountProvid import io.element.android.features.login.impl.accountprovider.AccountProviderDataSource import io.element.android.features.login.impl.localnetwork.LocalNetworkPermissionGate import io.element.android.features.login.impl.login.LoginModePresenter -import io.element.android.features.login.impl.web.FakeWebClientUrlForAuthenticationRetriever -import io.element.android.features.login.impl.web.WebClientUrlForAuthenticationRetriever import io.element.android.features.wellknown.test.FakeWellknownRetriever import io.element.android.features.wellknown.test.FakeWellknownRetrieverFactory import io.element.android.libraries.architecture.AsyncData @@ -322,7 +320,6 @@ private fun createPresenter( fun createLoginModePresenter( oAuthActionFlow: OAuthActionFlow = FakeOAuthActionFlow(), authenticationService: MatrixAuthenticationService = FakeMatrixAuthenticationService(), - webClientUrlForAuthenticationRetriever: WebClientUrlForAuthenticationRetriever = FakeWebClientUrlForAuthenticationRetriever(), localNetworkPermissionAdvisor: LocalNetworkPermissionAdvisor = FakeLocalNetworkPermissionAdvisor(), permissionsPresenterFactory: PermissionsPresenter.Factory = @@ -330,7 +327,6 @@ fun createLoginModePresenter( ): LoginModePresenter = LoginModePresenter( oAuthActionFlow = oAuthActionFlow, authenticationService = authenticationService, - webClientUrlForAuthenticationRetriever = webClientUrlForAuthenticationRetriever, localNetworkPermissionGate = LocalNetworkPermissionGate( advisor = localNetworkPermissionAdvisor, permissionsPresenterFactory = permissionsPresenterFactory, diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/onboarding/OnboardingViewTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/onboarding/OnboardingViewTest.kt index 1bdcb9bda1..dfa4119711 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/onboarding/OnboardingViewTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/onboarding/OnboardingViewTest.kt @@ -234,22 +234,6 @@ class OnboardingViewTest : RobolectricTestParameter() { eventSink.assertSingle(OnBoardingEvents.ClearError) } - @Test - fun `when success AccountCreation - the expected callback is invoked and the event is received`() = runAndroidComposeUiTest { - val eventSink = EventsRecorder() - val oAuthDetails = OAuthDetails("aUrl") - ensureCalledOnceWithParam(oAuthDetails.url) { callback -> - setOnboardingView( - state = anOnBoardingState( - loginModeState = aLoginModeState(loginMode = AsyncData.Success(LoginMode.AccountCreation("aUrl"))), - eventSink = eventSink, - ), - onCreateAccountContinue = callback, - ) - } - eventSink.assertSingle(OnBoardingEvents.ClearError) - } - private fun AndroidComposeUiTest.setOnboardingView( state: OnBoardingState, onBackClick: () -> Unit = EnsureNeverCalled(), @@ -261,7 +245,6 @@ class OnboardingViewTest : RobolectricTestParameter() { onOAuthDetails: (OAuthDetails) -> Unit = EnsureNeverCalledWithParam(), onNeedLoginPassword: () -> Unit = EnsureNeverCalled(), onLearnMoreClick: () -> Unit = EnsureNeverCalled(), - onCreateAccountContinue: (url: String) -> Unit = EnsureNeverCalledWithParam(), ) { setContent { OnBoardingView( @@ -275,7 +258,6 @@ class OnboardingViewTest : RobolectricTestParameter() { onOAuthDetails = onOAuthDetails, onNeedLoginPassword = onNeedLoginPassword, onLearnMoreClick = onLearnMoreClick, - onCreateAccountContinue = onCreateAccountContinue, ) } } diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/web/FakeWebClientUrlForAuthenticationRetriever.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/web/FakeWebClientUrlForAuthenticationRetriever.kt deleted file mode 100644 index f52af0adf3..0000000000 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/web/FakeWebClientUrlForAuthenticationRetriever.kt +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2024, 2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.login.impl.web - -import io.element.android.tests.testutils.lambda.lambdaError - -class FakeWebClientUrlForAuthenticationRetriever( - private val retrieveLambda: suspend (homeServerUrl: String) -> String = { lambdaError() } -) : WebClientUrlForAuthenticationRetriever { - override suspend fun retrieve(homeServerUrl: String): String { - return retrieveLambda(homeServerUrl) - } -} From 00e9a8ab71d3c09666c21923874f722e21e0a2fa Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 12 Aug 2026 16:40:49 +0200 Subject: [PATCH 033/145] Fix wrong TextComposer placeholder displayed when in a thread. We cannot only use MessageComposerMode since use can edit a message in a thread, so this is becoming handly. --- .../messagecomposer/MessageComposerPresenter.kt | 1 + .../impl/messagecomposer/MessageComposerState.kt | 1 + .../MessageComposerStateProvider.kt | 2 ++ .../impl/messagecomposer/MessageComposerView.kt | 1 + .../MessageComposerPresenterTest.kt | 14 ++++++++++++++ .../android/libraries/textcomposer/TextComposer.kt | 3 ++- 6 files changed, 21 insertions(+), 1 deletion(-) diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt index 18252ee17d..5f12bf4be1 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt @@ -425,6 +425,7 @@ class MessageComposerPresenter( textEditorState = textEditorState, isFullScreen = isFullScreen.value, mode = messageComposerContext.composerMode, + isInThreadTimeline = isInThread, showAttachmentSourcePicker = showAttachmentSourcePicker, showTextFormatting = showTextFormatting, canShareLocation = canShareLocation.value, diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerState.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerState.kt index f3fdb3d59a..b4da119d96 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerState.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerState.kt @@ -21,6 +21,7 @@ data class MessageComposerState( val textEditorState: TextEditorState, val isFullScreen: Boolean, val mode: MessageComposerMode, + val isInThreadTimeline: Boolean, val showAttachmentSourcePicker: Boolean, val showTextFormatting: Boolean, val canShareLocation: Boolean, diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerStateProvider.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerStateProvider.kt index ef9cd7933b..b08fea28ec 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerStateProvider.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerStateProvider.kt @@ -29,6 +29,7 @@ fun aMessageComposerState( textEditorState: TextEditorState = aTextEditorStateRich(), isFullScreen: Boolean = false, mode: MessageComposerMode = MessageComposerMode.Normal, + isInThreadTimeline: Boolean = false, showTextFormatting: Boolean = false, showAttachmentSourcePicker: Boolean = false, canShareLocation: Boolean = true, @@ -39,6 +40,7 @@ fun aMessageComposerState( textEditorState = textEditorState, isFullScreen = isFullScreen, mode = mode, + isInThreadTimeline = isInThreadTimeline, showTextFormatting = showTextFormatting, showAttachmentSourcePicker = showAttachmentSourcePicker, canShareLocation = canShareLocation, diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerView.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerView.kt index 245b23cf8e..cd20f3e58b 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerView.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerView.kt @@ -102,6 +102,7 @@ internal fun MessageComposerView( onRequestFocus = ::onRequestFocus, onSendMessage = ::sendMessage, composerMode = state.mode, + isInThreadTimeline = state.isInThreadTimeline, showTextFormatting = state.showTextFormatting, onResetComposerMode = ::onCloseSpecialMode, onAddAttachment = ::onAddAttachment, diff --git a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenterTest.kt b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenterTest.kt index fda8621087..07b9a4e330 100644 --- a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenterTest.kt +++ b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenterTest.kt @@ -61,6 +61,7 @@ import io.element.android.libraries.matrix.test.A_CAPTION import io.element.android.libraries.matrix.test.A_MESSAGE import io.element.android.libraries.matrix.test.A_REPLY import io.element.android.libraries.matrix.test.A_ROOM_ID +import io.element.android.libraries.matrix.test.A_THREAD_ID import io.element.android.libraries.matrix.test.A_TRANSACTION_ID import io.element.android.libraries.matrix.test.A_USER_ID import io.element.android.libraries.matrix.test.A_USER_ID_2 @@ -148,12 +149,25 @@ class MessageComposerPresenterTest : RobolectricTest() { assertThat(initialState.isFullScreen).isFalse() assertThat(initialState.textEditorState.messageHtml()).isEqualTo("") assertThat(initialState.mode).isEqualTo(MessageComposerMode.Normal) + assertThat(initialState.isInThreadTimeline).isFalse() assertThat(initialState.showAttachmentSourcePicker).isFalse() assertThat(initialState.canShareLocation).isTrue() assertThat(initialState.slashCommandAction).isEqualTo(AsyncAction.Uninitialized) } } + @Test + fun `present - when a threadRoot is provided, isInThreadTimeline is true`() = runTest { + val presenter = createPresenter( + threadRoot = A_THREAD_ID, + ) + presenter.test { + val initialState = awaitFirstItem() + assertThat(initialState.mode).isEqualTo(MessageComposerMode.Normal) + assertThat(initialState.isInThreadTimeline).isTrue() + } + } + @Test fun `present - toggle fullscreen`() = runTest { val presenter = createPresenter() diff --git a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/TextComposer.kt b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/TextComposer.kt index 0f62eb5234..a2ee9dd867 100644 --- a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/TextComposer.kt +++ b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/TextComposer.kt @@ -131,6 +131,7 @@ fun TextComposer( resolveAtRoomMentionDisplay: () -> TextDisplay, modifier: Modifier = Modifier, showTextFormatting: Boolean = false, + isInThreadTimeline: Boolean = false, ) { val markdown = when (state) { is TextEditorState.Markdown -> state.state.text.value() @@ -153,7 +154,7 @@ fun TextComposer( .fillMaxSize() .height(IntrinsicSize.Min) - val placeholder = if (composerMode.inThread) { + val placeholder = if (composerMode.inThread || (composerMode is MessageComposerMode.Normal && isInThreadTimeline)) { stringResource(id = CommonStrings.action_reply_in_thread) } else if (composerMode is MessageComposerMode.Attachment || composerMode is MessageComposerMode.EditCaption) { stringResource(id = R.string.rich_text_editor_composer_caption_placeholder) From ae5c4161c7bd4d6c9c08cbe9477c53bf42da2e19 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 12 Aug 2026 18:14:36 +0200 Subject: [PATCH 034/145] Remove redundant parenthesis --- .../io/element/android/libraries/textcomposer/TextComposer.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/TextComposer.kt b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/TextComposer.kt index a2ee9dd867..b8839cac67 100644 --- a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/TextComposer.kt +++ b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/TextComposer.kt @@ -154,7 +154,7 @@ fun TextComposer( .fillMaxSize() .height(IntrinsicSize.Min) - val placeholder = if (composerMode.inThread || (composerMode is MessageComposerMode.Normal && isInThreadTimeline)) { + val placeholder = if (composerMode.inThread || composerMode is MessageComposerMode.Normal && isInThreadTimeline) { stringResource(id = CommonStrings.action_reply_in_thread) } else if (composerMode is MessageComposerMode.Attachment || composerMode is MessageComposerMode.EditCaption) { stringResource(id = R.string.rich_text_editor_composer_caption_placeholder) From e2aa3071a903f947964ab6afff85d874a4177e3a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 12 Aug 2026 23:03:33 +0000 Subject: [PATCH 035/145] Update dependency io.sentry:sentry-android to v8.52.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3e2b0a902f..470fc76171 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -230,7 +230,7 @@ color_picker = "io.mhssn:colorpicker:1.0.0" # Analytics posthog = "com.posthog:posthog-android:3.56.4" -sentry = "io.sentry:sentry-android:8.51.0" +sentry = "io.sentry:sentry-android:8.52.0" # main branch can be tested replacing the version with main-SNAPSHOT matrix_analytics_events = "com.github.matrix-org:matrix-analytics-events:0.37.0" From 8c8d232eacbb69e63983bb818b57e84e6e941824 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 13 Aug 2026 09:21:31 +0200 Subject: [PATCH 036/145] Make onSendMessage parameter not nullable --- .../io/element/android/libraries/textcomposer/TextComposer.kt | 2 +- .../textcomposer/components/markdown/MarkdownTextInput.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/TextComposer.kt b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/TextComposer.kt index 45a9e95bc0..66c9dcba03 100644 --- a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/TextComposer.kt +++ b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/TextComposer.kt @@ -218,10 +218,10 @@ fun TextComposer( placeholder = placeholder, placeholderColor = ElementTheme.colors.textSecondary, onTyping = onTyping, + onSendMessage = { if (canSendTextMessage) onSendMessage() }, onReceiveSuggestion = onReceiveSuggestion, richTextEditorStyle = style, onSelectRichContent = onSelectRichContent, - onSendMessage = { if (canSendTextMessage) onSendMessage() }, ) } } diff --git a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/components/markdown/MarkdownTextInput.kt b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/components/markdown/MarkdownTextInput.kt index 8c6f30eed1..52ec2b762a 100644 --- a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/components/markdown/MarkdownTextInput.kt +++ b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/components/markdown/MarkdownTextInput.kt @@ -51,10 +51,10 @@ fun MarkdownTextInput( placeholder: String, placeholderColor: androidx.compose.ui.graphics.Color, onTyping: (Boolean) -> Unit, + onSendMessage: () -> Unit, onReceiveSuggestion: (Suggestion?) -> Unit, richTextEditorStyle: RichTextEditorStyle, onSelectRichContent: ((Uri) -> Unit)?, - onSendMessage: (() -> Unit)? = null, ) { // Copied from io.element.android.wysiwyg.internal.utils.UriContentListener class ReceiveUriContentListener( @@ -217,6 +217,7 @@ internal fun MarkdownTextInputPreview() { placeholder = "Placeholder", placeholderColor = ElementTheme.colors.textSecondary, onTyping = {}, + onSendMessage = {}, onReceiveSuggestion = {}, richTextEditorStyle = style, onSelectRichContent = {}, From 690ffa54ce806a84b5d71c0f54e5d7bb8c56fa93 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 13 Aug 2026 07:12:14 +0000 Subject: [PATCH 037/145] Update plugin sonarqube to v7.4.0.8496 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 61b053b3a5..1ab1574c9c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -276,7 +276,7 @@ paparazzi = "app.cash.paparazzi:2.0.0-alpha05" roborazzi = { id = "io.github.takahirom.roborazzi", version.ref = "roborazzi" } sqldelight = { id = "app.cash.sqldelight", version.ref = "sqldelight" } firebaseAppDistribution = { id = "com.google.firebase.appdistribution", version.ref = "firebaseAppDistribution" } -sonarqube = "org.sonarqube:7.3.1.8318" +sonarqube = "org.sonarqube:7.4.0.8496" licensee = "app.cash.licensee:1.14.1" compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } gms_google_services = { id = "com.google.gms.google-services", version = "4.5.0" } From 590e33de7167ed2e70d61b9ac1f91e28259adc52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Mart=C3=ADn?= Date: Thu, 13 Aug 2026 09:46:16 +0200 Subject: [PATCH 038/145] Add explicit dependency of `sonarResolver` task to `processResources` Otherwise `:codegen:sonarResolver` fails --- codegen/build.gradle.kts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/codegen/build.gradle.kts b/codegen/build.gradle.kts index 5c71c170bf..396ef665eb 100644 --- a/codegen/build.gradle.kts +++ b/codegen/build.gradle.kts @@ -1,3 +1,5 @@ +import org.sonarqube.gradle.SonarResolverTask + /* * Copyright (c) 2025 Element Creations Ltd. * Copyright 2022-2025 New Vector Ltd. @@ -18,3 +20,9 @@ dependencies { implementation(libs.ksp.plugin) implementation(libs.kotlinpoet.ksp) } + +// Ensure that the processResources task is executed before the SonarResolverTask to avoid issues with missing resources during SonarQube analysis. +// This *should not be necesssary* but is a workaround for a known issue with the SonarQube Gradle plugin. +tasks.withType().configureEach { + dependsOn("processResources") +} From d017a84b2b49122f497ca3c22593e7ac202b7c0f Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 13 Aug 2026 11:47:22 +0200 Subject: [PATCH 039/145] Remove useless let statement. --- .../textcomposer/components/markdown/MarkdownTextInput.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/components/markdown/MarkdownTextInput.kt b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/components/markdown/MarkdownTextInput.kt index 52ec2b762a..63f9e0a8ea 100644 --- a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/components/markdown/MarkdownTextInput.kt +++ b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/components/markdown/MarkdownTextInput.kt @@ -133,11 +133,9 @@ fun MarkdownTextInput( update = { editText -> editText.contentDescription = placeholder editText.applyStyleInCompose(richTextEditorStyle) - editText.onEnterKeyListener = onSendMessage?.let { send -> - { - send() - true - } + editText.onEnterKeyListener = { + onSendMessage() + true } val text = state.text.value() mentionSpanUpdater.updateMentionSpans(text) From 07e90ff704bb3e8be2621c84426917c8767c40bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Mart=C3=ADn?= Date: Thu, 13 Aug 2026 12:10:06 +0200 Subject: [PATCH 040/145] Fix `MarkdownTextInputTest` using the previous `onSendMessage` signature --- .../impl/components/markdown/MarkdownTextInputTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/textcomposer/impl/src/test/kotlin/io/element/android/libraries/textcomposer/impl/components/markdown/MarkdownTextInputTest.kt b/libraries/textcomposer/impl/src/test/kotlin/io/element/android/libraries/textcomposer/impl/components/markdown/MarkdownTextInputTest.kt index 15687cb4c9..d08048241e 100644 --- a/libraries/textcomposer/impl/src/test/kotlin/io/element/android/libraries/textcomposer/impl/components/markdown/MarkdownTextInputTest.kt +++ b/libraries/textcomposer/impl/src/test/kotlin/io/element/android/libraries/textcomposer/impl/components/markdown/MarkdownTextInputTest.kt @@ -191,7 +191,7 @@ class MarkdownTextInputTest : RobolectricTest() { state: MarkdownTextEditorState = aMarkdownTextEditorState(), onTyping: (Boolean) -> Unit = {}, onSuggestionReceived: (Suggestion?) -> Unit = {}, - onSendMessage: (() -> Unit)? = null, + onSendMessage: (() -> Unit) = {}, ) { setContent { val style = ElementRichTextEditorStyle.composerStyle(hasFocus = state.hasFocus) From 913b566270fd7f3ce8fce4533815ab20303b27cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Mart=C3=ADn?= Date: Thu, 13 Aug 2026 10:35:36 +0200 Subject: [PATCH 041/145] Add missing tests for `RustTemporaryMatrixClient` --- .../impl/RustTemporaryMatrixClientTest.kt | 92 +++++++++++++++++++ .../impl/fixtures/fakes/FakeFfiClient.kt | 5 + 2 files changed, 97 insertions(+) create mode 100644 libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/RustTemporaryMatrixClientTest.kt diff --git a/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/RustTemporaryMatrixClientTest.kt b/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/RustTemporaryMatrixClientTest.kt new file mode 100644 index 0000000000..322103042b --- /dev/null +++ b/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/RustTemporaryMatrixClientTest.kt @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2026 Element Creations Ltd. + * + * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. + * Please see LICENSE files in the repository root for full details. + */ + +package io.element.android.libraries.matrix.impl + +import com.google.common.truth.Truth.assertThat +import io.element.android.libraries.matrix.api.exception.ClientException +import io.element.android.libraries.matrix.api.paths.SessionPaths +import io.element.android.libraries.matrix.impl.fixtures.fakes.FakeFfiClient +import io.element.android.tests.testutils.lambda.lambdaRecorder +import io.element.android.tests.testutils.lambda.value +import kotlinx.coroutines.test.runTest +import org.junit.Test +import org.matrix.rustcomponents.sdk.Client +import org.matrix.rustcomponents.sdk.NoHandle +import java.io.File +import kotlin.io.path.createTempDirectory +import org.matrix.rustcomponents.sdk.ClientException as RustClientException + +class RustTemporaryMatrixClientTest { + @Test + fun `getUrl method uses client getUrl`() = runTest { + val paths = SessionPaths( + fileDirectory = File("files"), + cacheDirectory = File("cache"), + ) + + val getUrlRecorder = lambdaRecorder { ByteArray(0) } + val client = createRustTemporaryMatrixClient( + client = FakeFfiClient( + getUrlResult = getUrlRecorder, + ), + paths = paths, + ) + val url = "https://example.com" + + client.getUrl(url) + + getUrlRecorder.assertions().isCalledOnce().with(value(url)) + } + + @Test + fun `getUrl method can fail gracefully and map errors to public ones`() = runTest { + val paths = SessionPaths( + fileDirectory = File("files"), + cacheDirectory = File("cache"), + ) + + val getUrlRecorder = lambdaRecorder { throw RustClientException.Generic("Error", null) } + val client = createRustTemporaryMatrixClient( + client = FakeFfiClient( + getUrlResult = getUrlRecorder, + ), + paths = paths, + ) + val url = "https://example.com" + + val result = client.getUrl(url) + + assertThat(result.isFailure).isTrue() + assertThat(result.exceptionOrNull()).isInstanceOf(ClientException.Generic::class.java) + } + + @Test + fun `close deletes the directories if they exist`() = runTest { + val paths = SessionPaths( + fileDirectory = createTempDirectory().toFile(), + cacheDirectory = createTempDirectory().toFile(), + ) + + val client = createRustTemporaryMatrixClient(paths = paths) + + assertThat(paths.fileDirectory.exists()).isTrue() + assertThat(paths.cacheDirectory.exists()).isTrue() + + client.close() + + assertThat(paths.fileDirectory.exists()).isFalse() + assertThat(paths.cacheDirectory.exists()).isFalse() + } + + private fun createRustTemporaryMatrixClient( + client: Client = Client(NoHandle), + paths: SessionPaths, + ): RustTemporaryMatrixClient { + return RustTemporaryMatrixClient(client, paths) + } +} diff --git a/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/fakes/FakeFfiClient.kt b/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/fakes/FakeFfiClient.kt index a2c1f5b017..13be3cf2d5 100644 --- a/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/fakes/FakeFfiClient.kt +++ b/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/fakes/FakeFfiClient.kt @@ -60,6 +60,7 @@ class FakeFfiClient( private val setAccountDataResult: (String, String) -> Unit = { _, _ -> lambdaError() }, private val isUserStatusSupportedResult: () -> Boolean = { false }, private val subscribeToOwnProfileResult: (ProfileListener) -> Unit = {}, + private val getUrlResult: (String) -> ByteArray = { lambdaError() }, private val closeResult: () -> Unit = {}, ) : Client(NoHandle) { override fun userId(): String = userId @@ -134,5 +135,9 @@ class FakeFfiClient( setAccountDataResult(eventType, content) } + override suspend fun getUrl(url: String): ByteArray = simulateLongTask { + getUrlResult(url) + } + override fun close() = closeResult() } From 776182234e8e3059f9a2c6a7a3db7e5d7b5d8bbe Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 13 Aug 2026 16:40:56 +0200 Subject: [PATCH 042/145] Remove license check on Pro modules. --- .../tests/konsist/KonsistLicenseTest.kt | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistLicenseTest.kt b/tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistLicenseTest.kt index e7f82292a4..a2790d99df 100644 --- a/tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistLicenseTest.kt +++ b/tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistLicenseTest.kt @@ -23,24 +23,6 @@ class KonsistLicenseTest { \*/ """.trimIndent().toRegex() - private val enterpriseLicense = """ - /\* - \* © 20\d\d((, |-)20\d\d)? Element Creations Ltd\. - (?:.*\n)* \* - \* Element Creations Ltd, Element Software SARL, Element Software Inc\., - \* and Element Software GmbH \(the "Element Group"\) only make this file available - \* under a proprietary license model\. - \* - \* Without a proprietary license with us, you cannot use this file\. The terms of - \* the proprietary license agreement between you and any member of the Element Group - \* shall always apply to your use of this file\. Unauthorised use, copying, distribution, - \* or modification of this file, via any medium, is strictly prohibited\. - \* - \* For details about the licensing terms, you must either visit our website or contact - \* a member of our sales team\. - \*/ - """.trimIndent().toRegex() - @Test fun `assert that FOSS files have the correct license header`() { Konsist @@ -60,19 +42,6 @@ class KonsistLicenseTest { } } - @Test - fun `assert that Enterprise files have the correct license header`() { - Konsist - .scopeFromProject() - .files - .filter { - it.moduleName.startsWith("enterprise") - } - .assertTrue { - enterpriseLicense.containsMatchIn(it.text) - } - } - @Test fun `assert that files do not have double license header`() { Konsist From 5b728d911b159b1cda5386fc3e80d0c370bb5f56 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 12 Aug 2026 09:30:49 +0100 Subject: [PATCH 043/145] Add hooks to allow providing additional feature flags in EX pro We modify the existing `FeaturesProvider` interface so that there can be more than one of them, and the Features provided by *all* of the instances are shown. We can then make another instance in element-android-enterprise, which exposes enterprise-only features. --- .../featureflag/api/FeaturesProvider.kt | 21 +++++++++++++++++++ .../impl/DefaultFeatureFlagService.kt | 5 +++-- ...Provider.kt => DefaultFeaturesProvider.kt} | 9 +++----- 3 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 libraries/featureflag/api/src/main/kotlin/io/element/android/libraries/featureflag/api/FeaturesProvider.kt rename libraries/featureflag/impl/src/main/kotlin/io/element/android/libraries/featureflag/impl/{FeaturesProvider.kt => DefaultFeaturesProvider.kt} (78%) diff --git a/libraries/featureflag/api/src/main/kotlin/io/element/android/libraries/featureflag/api/FeaturesProvider.kt b/libraries/featureflag/api/src/main/kotlin/io/element/android/libraries/featureflag/api/FeaturesProvider.kt new file mode 100644 index 0000000000..a342ccdd9b --- /dev/null +++ b/libraries/featureflag/api/src/main/kotlin/io/element/android/libraries/featureflag/api/FeaturesProvider.kt @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2026 Element Creations Ltd. + * + * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. + * Please see LICENSE files in the repository root for full details. + */ + +package io.element.android.libraries.featureflag.api + +/** + * Provides a list of available [Feature]s that the application supports. + * Used by [FeatureFlagService.getAvailableFeatures] to obtain a list of features + * that can be presented to the user. + * + * Multiple instances can exist within the application, and all instances are polled + * to provide features for the list. This means that additional features can be provided + * by compile-time extensions. + */ +fun interface FeaturesProvider { + fun provide(): List +} diff --git a/libraries/featureflag/impl/src/main/kotlin/io/element/android/libraries/featureflag/impl/DefaultFeatureFlagService.kt b/libraries/featureflag/impl/src/main/kotlin/io/element/android/libraries/featureflag/impl/DefaultFeatureFlagService.kt index 74967a574d..675cf7855c 100644 --- a/libraries/featureflag/impl/src/main/kotlin/io/element/android/libraries/featureflag/impl/DefaultFeatureFlagService.kt +++ b/libraries/featureflag/impl/src/main/kotlin/io/element/android/libraries/featureflag/impl/DefaultFeatureFlagService.kt @@ -14,6 +14,7 @@ import dev.zacsweers.metro.SingleIn import io.element.android.libraries.core.meta.BuildMeta import io.element.android.libraries.featureflag.api.Feature import io.element.android.libraries.featureflag.api.FeatureFlagService +import io.element.android.libraries.featureflag.api.FeaturesProvider import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flowOf @@ -22,7 +23,7 @@ import kotlinx.coroutines.flow.flowOf class DefaultFeatureFlagService( private val providers: Set<@JvmSuppressWildcards FeatureFlagProvider>, private val buildMeta: BuildMeta, - private val featuresProvider: FeaturesProvider, + private val featuresProviders: Set, ) : FeatureFlagService { override fun isFeatureEnabledFlow(feature: Feature): Flow { return if (feature.isFinished) { @@ -47,7 +48,7 @@ class DefaultFeatureFlagService( includeFinishedFeatures: Boolean, isInLabs: Boolean, ): List { - return featuresProvider.provide().filter { flag -> + return featuresProviders.flatMap { provider -> provider.provide() }.filter { flag -> (includeFinishedFeatures || !flag.isFinished) && flag.isInLabs == isInLabs } diff --git a/libraries/featureflag/impl/src/main/kotlin/io/element/android/libraries/featureflag/impl/FeaturesProvider.kt b/libraries/featureflag/impl/src/main/kotlin/io/element/android/libraries/featureflag/impl/DefaultFeaturesProvider.kt similarity index 78% rename from libraries/featureflag/impl/src/main/kotlin/io/element/android/libraries/featureflag/impl/FeaturesProvider.kt rename to libraries/featureflag/impl/src/main/kotlin/io/element/android/libraries/featureflag/impl/DefaultFeaturesProvider.kt index e24ae66783..c96a781d82 100644 --- a/libraries/featureflag/impl/src/main/kotlin/io/element/android/libraries/featureflag/impl/FeaturesProvider.kt +++ b/libraries/featureflag/impl/src/main/kotlin/io/element/android/libraries/featureflag/impl/DefaultFeaturesProvider.kt @@ -9,15 +9,12 @@ package io.element.android.libraries.featureflag.impl import dev.zacsweers.metro.AppScope -import dev.zacsweers.metro.ContributesBinding +import dev.zacsweers.metro.ContributesIntoSet import io.element.android.libraries.featureflag.api.Feature import io.element.android.libraries.featureflag.api.FeatureFlags +import io.element.android.libraries.featureflag.api.FeaturesProvider -fun interface FeaturesProvider { - fun provide(): List -} - -@ContributesBinding(AppScope::class) +@ContributesIntoSet(AppScope::class) class DefaultFeaturesProvider : FeaturesProvider { override fun provide(): List = FeatureFlags.entries } From 42d389375543c2954d34976070dffacfc0e87a04 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 13 Aug 2026 18:34:30 +0200 Subject: [PATCH 044/145] Add KDoc to matrix API session and sync interfaces Document MatrixClientProvider, SdkMetadata, HomeserverCapabilitiesProvider, TemporaryMatrixClientFactory and SyncService, along with each of their members. Behaviour described here was checked against the implementations (MatrixSessionCache, RustSdkMetadata, RustHomeserverCapabilitiesProvider, RustTemporaryMatrixClientFactory and RustSyncService), so the docs mention the caching, idempotence and error-wrapping that callers cannot infer from the signatures alone. Co-Authored-By: Claude Opus 5 (1M context) --- .../api/HomeserverCapabilitiesProvider.kt | 2 ++ .../matrix/api/MatrixClientProvider.kt | 20 +++++++++++++------ .../libraries/matrix/api/SdkMetadata.kt | 8 ++++++++ .../api/TemporaryMatrixClientFactory.kt | 6 ++++++ .../libraries/matrix/api/sync/SyncService.kt | 14 +++++++++++-- 5 files changed, 42 insertions(+), 8 deletions(-) diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/HomeserverCapabilitiesProvider.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/HomeserverCapabilitiesProvider.kt index e914656f5f..fe05b88dc4 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/HomeserverCapabilitiesProvider.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/HomeserverCapabilitiesProvider.kt @@ -10,6 +10,8 @@ package io.element.android.libraries.matrix.api /** * Provides information about the capabilities of the homeserver. * + * The getters read a snapshot held by the SDK rather than querying the server on each call, so [refresh] must be used to pick up server-side changes. + * * Spec: https://spec.matrix.org/latest/client-server-api/#capabilities-negotiation */ interface HomeserverCapabilitiesProvider { diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClientProvider.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClientProvider.kt index 54f70845fa..08073d0cc0 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClientProvider.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClientProvider.kt @@ -10,18 +10,26 @@ package io.element.android.libraries.matrix.api import io.element.android.libraries.matrix.api.core.SessionId +/** + * In-memory cache of the [MatrixClient] of every logged in session. + * + * Prefer injecting the [MatrixClient] directly: this provider is meant for the entry points that only know a [SessionId], such as push handling and workers. + */ interface MatrixClientProvider { /** - * Can be used to get or restore a MatrixClient with the given [SessionId]. - * If a [MatrixClient] is already in memory, it'll return it. Otherwise it'll try to restore one. - * Most of the time you want to use injected constructor instead of retrieving a MatrixClient with this provider. + * Returns the cached [MatrixClient] for [sessionId], restoring the session from storage and starting its sync if it is not in memory yet. + * Concurrent calls are serialised, so only one restore happens per session. + * + * @param sessionId the [SessionId] of the session to get or restore. + * @return the client, or a failure if the session could not be restored. */ suspend fun getOrRestore(sessionId: SessionId): Result /** - * Can be used to retrieve an existing [MatrixClient] with the given [SessionId]. - * @param sessionId the [SessionId] of the [MatrixClient] to retrieve. - * @return the [MatrixClient] if it exists. + * Returns the [MatrixClient] for [sessionId] only if it is already in memory, without attempting to restore it. + * + * @param sessionId the [SessionId] of the session to retrieve. + * @return the cached client, or `null` if that session is not currently held in memory. */ fun getOrNull(sessionId: SessionId): MatrixClient? } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/SdkMetadata.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/SdkMetadata.kt index 16f34807fc..939734e314 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/SdkMetadata.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/SdkMetadata.kt @@ -8,6 +8,14 @@ package io.element.android.libraries.matrix.api +/** + * Exposes build information about the bundled `matrix-rust-sdk`. + * + * Mostly used to identify the exact SDK revision in bug reports and in the user agent. + */ interface SdkMetadata { + /** + * The full git SHA of the commit the bundled `matrix-rust-sdk` was built from. + */ val sdkGitSha: String } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/TemporaryMatrixClientFactory.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/TemporaryMatrixClientFactory.kt index 4be1b980a0..3bd22c64f3 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/TemporaryMatrixClientFactory.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/TemporaryMatrixClientFactory.kt @@ -11,5 +11,11 @@ package io.element.android.libraries.matrix.api * Factory to create a temporary [TemporaryMatrixClient] for a given home server URL. */ interface TemporaryMatrixClientFactory { + /** + * Builds an unauthenticated client pointing at [homeServerUrl], backed by a fresh set of temporary session directories. + * The caller owns the returned client and must close it to delete those directories. + * + * @param homeServerUrl the URL of the homeserver the client will talk to. + */ suspend fun create(homeServerUrl: String): Result } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/sync/SyncService.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/sync/SyncService.kt index ce0019d8dc..92f60352d7 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/sync/SyncService.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/sync/SyncService.kt @@ -10,21 +10,31 @@ package io.element.android.libraries.matrix.api.sync import kotlinx.coroutines.flow.StateFlow +/** + * Drives the sync loop of a single session and exposes its current state. + * + * Both [startSync] and [stopSync] are idempotent and never throw: any error is wrapped in the returned [Result]. + */ interface SyncService { /** - * Tries to start the sync. If already syncing it has no effect. + * Tries to start the sync. If already syncing, or if the service has been destroyed, it has no effect. */ suspend fun startSync(): Result /** - * Tries to stop the sync. If service is not syncing it has no effect. + * Tries to stop the sync. If the service is not syncing, or has been destroyed, it has no effect. */ suspend fun stopSync(): Result /** * Flow of [SyncState]. Will be updated as soon as the current [SyncState] changes. + * Starts at [SyncState.Idle] and only emits on an actual change, for as long as the session lives. */ val syncState: StateFlow + /** + * Whether the client currently considers itself online, derived from [syncState]. + * This is `false` only while the state is [SyncState.Offline]; an idle or errored sync still counts as online. + */ val isOnline: StateFlow } From f7d24050f8498add8c360e374044b7e94835528e Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 13 Aug 2026 17:38:59 +0100 Subject: [PATCH 045/145] fix unit test --- .../featureflag/impl/DefaultFeatureFlagServiceTest.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/featureflag/impl/src/test/kotlin/io/element/android/libraries/featureflag/impl/DefaultFeatureFlagServiceTest.kt b/libraries/featureflag/impl/src/test/kotlin/io/element/android/libraries/featureflag/impl/DefaultFeatureFlagServiceTest.kt index 00bc687bb9..0ed6d8eafd 100644 --- a/libraries/featureflag/impl/src/test/kotlin/io/element/android/libraries/featureflag/impl/DefaultFeatureFlagServiceTest.kt +++ b/libraries/featureflag/impl/src/test/kotlin/io/element/android/libraries/featureflag/impl/DefaultFeatureFlagServiceTest.kt @@ -12,6 +12,7 @@ import app.cash.turbine.test import com.google.common.truth.Truth.assertThat import io.element.android.libraries.core.meta.BuildMeta import io.element.android.libraries.featureflag.api.Feature +import io.element.android.libraries.featureflag.api.FeaturesProvider import io.element.android.libraries.featureflag.test.FakeFeature import io.element.android.libraries.matrix.test.core.aBuildMeta import kotlinx.coroutines.test.runTest @@ -166,5 +167,5 @@ private fun createDefaultFeatureFlagService( ) = DefaultFeatureFlagService( providers = providers, buildMeta = buildMeta, - featuresProvider = { features } + featuresProviders = setOf(FeaturesProvider { features }) ) From 5d6384e175abcf24f5ff17686f631a5a6545c62e Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 13 Aug 2026 18:49:45 +0200 Subject: [PATCH 046/145] Add KDoc to `MatrixClient` Document the interface itself and all of its 60+ properties and functions. Notable behaviours taken from RustMatrixClient that callers cannot guess from the signatures: getRoom and getJoinedRoom build a new closeable instance on every call, createRoom/joinRoom/knockRoom wait for the membership to come back through sync and report a null RoomInfo rather than a failure when that wait times out, getCacheSize excludes the crypto database, and clearCache destroys the client while keeping the session. Also fix the stale wording and the malformed KDoc block on resolveRoomAlias, and add the missing @param entries on the functions that already had a summary. Co-Authored-By: Claude Opus 5 (1M context) --- .../libraries/matrix/api/MatrixClient.kt | 247 +++++++++++++++++- 1 file changed, 239 insertions(+), 8 deletions(-) diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt index e3aa2004bf..519ccfe3a4 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt @@ -54,47 +54,188 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.StateFlow import java.util.Optional +/** + * Entry point for everything scoped to a single logged in session: the sub-services, room access, and account level operations. + * + * One instance exists per session, created on login or session restore and torn down by [logout], [clearCache] or account deactivation. + * Suspending members here report failures through a [Result] instead of throwing, and run their work off the main thread. + */ interface MatrixClient : UrlContentFetcher { + /** Identifier of the logged in user; a [SessionId] and a [UserId] are the same value. */ val sessionId: SessionId + + /** Identifier of this device, as assigned by the homeserver when the session was created. */ val deviceId: DeviceId /** Base URL of the homeserver this client is connected to. */ val homeserverUrl: String + + /** Directories holding this session's databases, caches and downloaded media. */ val sessionPaths: SessionPaths + + /** + * Display name and avatar of the logged in user. + * Seeded from the local session store so a value is available before the first network fetch, then kept up to date by the SDK. + */ val userProfile: StateFlow + + /** Gives access to the list of rooms the user is a member of, or has been invited to. */ val roomListService: RoomListService + + /** Gives access to the spaces the user belongs to and their hierarchy. */ val spaceService: SpaceService + + /** Controls the sync loop of this session and exposes its state. */ val syncService: SyncService + + /** Handles verifying this session against the user's other devices or their recovery key. */ val sessionVerificationService: SessionVerificationService + + /** Manages the push gateways (pushers) registered on the homeserver for this session. */ val pushersService: PushersService + + /** Resolves incoming push notifications into renderable events. */ val notificationService: NotificationService + + /** Reads and writes the push notification rules of the account. */ val notificationSettingsService: NotificationSettingsService + + /** Gives access to end-to-end encryption state, recovery and key backup. */ val encryptionService: EncryptionService + + /** Gives access to the public room directory of the homeserver. */ val roomDirectoryService: RoomDirectoryService /** Whether this live client was built with a message search index attached. */ val isMessageSearchAvailable: Boolean + + /** Searches messages in the local index; only usable when [isMessageSearchAvailable] is `true`. */ val messageSearchService: MessageSearchService + + /** Reads and writes the account settings controlling whether media previews and avatars are shown. */ val mediaPreviewService: MediaPreviewService + + /** Downloads media content, thumbnails and files from the homeserver, caching them on disk. */ val matrixMediaLoader: MatrixMediaLoader + + /** + * Coroutine scope tied to the lifetime of this session, to be used for work that must stop when the session goes away. + * It is cancelled when the session is logged out or otherwise destroyed, so never use it for work that must outlive the session. + */ val sessionCoroutineScope: CoroutineScope + + /** The users the logged in user has ignored; starts empty and is updated by the SDK, including with an initial value. */ val ignoredUsersFlow: StateFlow> + + /** Notifies of membership changes the current user makes, so that callers can react to leaving or joining a room. */ val roomMembershipObserver: RoomMembershipObserver + + /** Emits updates about the live location beacons published by the current user. */ val ownBeaconInfoUpdates: Flow + + /** Scans media content before it is displayed, or `null` when no content scanner is configured for this session. */ val contentScanner: ContentScanner? + /** + * Returns the room with the given id if the user has joined it, along with its live [Timeline]. + * A new instance is created on each call and the caller owns it, so it must be closed once no longer needed. + * + * @param roomId the id of the room to open. + * @return the room, or `null` if it is unknown to the client or the user is not joined. + */ suspend fun getJoinedRoom(roomId: RoomId): JoinedRoom? + + /** + * Returns the room with the given id whatever the current membership is, without building a timeline. + * As with [getJoinedRoom], a new instance is created on each call and must be closed by the caller. + * + * @param roomId the id of the room to open. + * @return the room, or `null` if it is unknown to the client. + */ suspend fun getRoom(roomId: RoomId): BaseRoom? + + /** + * Looks for an existing direct message room shared with [userId]. + * + * @param userId the other member of the direct message room. + * @return the room id, or `null` if no direct message room exists with this user. + */ suspend fun findDM(userId: UserId): Result + + /** + * Returns the ids of every room the user has joined, as currently known by the client. + * Invited, knocked and left rooms are excluded. + */ suspend fun getJoinedRoomIds(): Result> + + /** + * Adds [userId] to the ignore list of the account, which hides their events and makes [ignoredUsersFlow] emit. + * + * @param userId the user to ignore. + */ suspend fun ignoreUser(userId: UserId): Result + + /** + * Removes [userId] from the ignore list of the account, which makes [ignoredUsersFlow] emit. + * + * @param userId the user to stop ignoring. + */ suspend fun unignoreUser(userId: UserId): Result + + /** + * Creates a room, applying the app's default power levels on top of [createRoomParams]. + * Waits a short while for the new room to come back through sync, but a timeout there is only logged: the result is still a success. + * + * @param createRoomParams the name, topic, preset, invitees and other settings of the room to create. + */ suspend fun createRoom(createRoomParams: CreateRoomParameters): Result + + /** + * Creates a direct message room with [userId], as a private, invite-only room with the user already invited. + * This does not check whether such a room already exists; use [findDM] first if you want to reuse one. + * + * @param userId the user to start the direct message with. + * @param isEncrypted whether the room should have end-to-end encryption enabled. + */ suspend fun createDM(userId: UserId, isEncrypted: Boolean): Result + + /** + * Fetches the current profile of any user from the homeserver, bypassing the local cache. + * + * @param userId the user whose profile is requested. + */ suspend fun getProfile(userId: UserId): Result + + /** + * Searches the homeserver's user directory. + * + * @param searchTerm the text to look for in user ids and display names. + * @param limit the maximum number of results to return. + */ suspend fun searchUsers(searchTerm: String, limit: Long): Result + + /** + * Changes the display name of the logged in user on the homeserver. + * + * @param displayName the new display name. + */ suspend fun setDisplayName(displayName: String): Result + + /** + * Uploads [data] as the new avatar of the logged in user. + * + * @param mimeType the MIME type of the image, for instance `image/jpeg`. + * @param data the raw bytes of the image. + */ suspend fun uploadAvatar(mimeType: String, data: ByteArray): Result + + /** Removes the avatar of the logged in user. */ suspend fun removeAvatar(): Result + + /** + * Sets the `m.status` profile field of the logged in user (MSC4426), refreshing [userProfile] if the server does not push the change itself. + * + * @param status the status to publish. + */ suspend fun setUserStatus(status: UserStatus): Result /** Clears both m.status and m.call profile fields (maps to DELETE on the profile endpoint per MSC4426). */ @@ -103,16 +244,52 @@ interface MatrixClient : UrlContentFetcher { /** Whether the homeserver advertises support for user status (MSC4426). */ suspend fun isUserStatusSupported(): Result - /** Enable or disable automatically setting the user's status to "in a call" (m.call) while in a call. */ + /** + * Enable or disable automatically setting the user's status to "in a call" (m.call) while in a call. + * + * @param enabled whether the status should be maintained automatically. + */ fun enableAutomaticCallStatus(enabled: Boolean) + + /** + * Joins a room the client already knows about, then waits briefly for the new membership to arrive through sync. + * The returned [RoomInfo] is `null` when that wait times out, which is not treated as a failure: the join itself succeeded. + * + * @param roomId the id of the room to join. + */ suspend fun joinRoom(roomId: RoomId): Result + + /** + * Joins a room by id or by alias, resolving it through [serverNames] when the client does not know it yet. + * As with [joinRoom], the returned [RoomInfo] is `null` if the membership did not arrive through sync in time. + * + * @param roomIdOrAlias the id or the alias of the room to join. + * @param serverNames servers to ask about the room, used when it cannot be resolved locally. + */ suspend fun joinRoomByIdOrAlias(roomIdOrAlias: RoomIdOrAlias, serverNames: List): Result + + /** + * Sends a request to join a room whose join rule is knock, then waits briefly for the knocked membership to arrive through sync. + * As with [joinRoom], the returned [RoomInfo] is `null` if that wait times out. + * + * @param roomIdOrAlias the id or the alias of the room to knock on. + * @param message the reason shown to the room moderators; may be empty. + * @param serverNames servers to ask about the room, used when it cannot be resolved locally. + */ suspend fun knockRoom(roomIdOrAlias: RoomIdOrAlias, message: String, serverNames: List): Result + + /** + * Returns the number of bytes this session occupies on disk that [clearCache] would be able to reclaim. + * This covers the cache directory, the state database and the message search index, but not the crypto database. + */ suspend fun getCacheSize(): Long + + /** Returns the size of each individual store the SDK maintains for this session, as reported by the SDK. */ suspend fun getDatabaseSizes(): Result /** - * Will close the client and delete the cache data. + * Deletes the cached data of this session and destroys the client. + * The instance is unusable afterwards, so callers are expected to restart the session, unlike with [logout] the session itself is kept. */ suspend fun clearCache() @@ -125,29 +302,56 @@ interface MatrixClient : UrlContentFetcher { suspend fun logout(userInitiated: Boolean, ignoreSdkError: Boolean) /** - * Retrieve the user profile, will also eventually emit a new value to [userProfile]. + * Retrieve the profile of the logged in user, emitting it to [userProfile] and persisting it in the local session store on success. */ suspend fun getUserProfile(): Result + + /** + * Returns the web URL where the user can manage their account on the authentication provider, or `null` if the homeserver exposes none. + * + * @param action an optional section of the account management page to open directly, such as changing the password. + */ suspend fun getAccountManagementUrl(action: AccountManagementAction?): Result + + /** + * Uploads arbitrary content to the homeserver's media repository. + * + * @param mimeType the MIME type of the content being uploaded. + * @param data the raw bytes to upload. + * @return the `mxc://` URI the content is now available at. + */ suspend fun uploadMedia(mimeType: String, data: ByteArray): Result /** * Get a room info flow for a given room ID. - * The flow will emit a new value whenever the room info is updated. - * The flow will emit Optional.empty item if the room is not found. + * The flow will emit a new value whenever the room info is updated, skipping duplicates, and an empty [Optional] if the room is not found. + * + * @param roomId the id of the room to observe. */ fun getRoomInfoFlow(roomId: RoomId): Flow> + /** + * Whether [userId] is the logged in user, `false` for a `null` value. + * + * @param userId the user id to compare against this session's user. + */ fun isMe(userId: UserId?) = userId == sessionId + /** + * Adds a room to the account's list of recently visited rooms, which backs the room suggestions when sharing or forwarding. + * + * @param roomId the id of the room that was just visited. + */ suspend fun trackRecentlyVisitedRoom(roomId: RoomId): Result + + /** Returns the recently visited rooms of the account, most recent first. */ suspend fun getRecentlyVisitedRooms(): Result> /** * Resolves the given room alias to a roomID (and a list of servers), if possible. - * @param roomAlias the room alias to resolve - * @return the resolved room alias if any, an empty result if not found,or an error if the resolution failed. * + * @param roomAlias the room alias to resolve. + * @return the resolved room alias if any, an empty result if not found, or an error if the resolution failed. */ suspend fun resolveRoomAlias(roomAlias: RoomAlias): Result> @@ -158,6 +362,8 @@ interface MatrixClient : UrlContentFetcher { * event with it failed (e.g. sending an event via the Timeline), * so it's required to manually re-enable it as soon as * connectivity is back on the device. + * + * @param enabled whether the send queues of every room should be enabled. */ suspend fun setAllSendQueuesEnabled(enabled: Boolean) @@ -175,6 +381,9 @@ interface MatrixClient : UrlContentFetcher { /** * Get a room preview for a given room ID or alias. This is especially useful for rooms that the user is not a member of, or hasn't joined yet. + * + * @param roomIdOrAlias the id or the alias of the room to preview. + * @param serverNames servers to ask about the room, used when it cannot be resolved locally. */ suspend fun getRoomPreview(roomIdOrAlias: RoomIdOrAlias, serverNames: List): Result @@ -183,11 +392,21 @@ interface MatrixClient : UrlContentFetcher { */ suspend fun currentSlidingSyncVersion(): Result + /** Whether this account can be deactivated from the app, which depends on the authentication method used by the homeserver. */ fun canDeactivateAccount(): Boolean + + /** + * Deactivates the account on the homeserver, then destroys this client and deletes every local trace of the session. + * The password is only sent if the homeserver asks for re-authentication, and on failure the session is left untouched. + * + * @param password the account password, required to confirm the deactivation. + * @param eraseData whether the homeserver should also erase the messages the user sent. + */ suspend fun deactivateAccount(password: String, eraseData: Boolean): Result /** - * Check if the user can report a room. + * Whether the homeserver supports reporting a whole room, rather than individual events. + * Returns `false` if the capability cannot be determined. */ suspend fun canReportRoom(): Boolean @@ -208,16 +427,23 @@ interface MatrixClient : UrlContentFetcher { /** * Adds an emoji to the list of recent emoji reactions for this account. + * + * @param emoji the emoji that was just used. */ suspend fun addRecentEmoji(emoji: String): Result /** * Returns the raw JSON content of the global account data event of type [eventType], or null if it is not set. + * + * @param eventType the Matrix event type of the account data to read, for instance `m.direct`. */ suspend fun getAccountData(eventType: String): Result /** * Sets the global account data event of type [eventType] to the raw JSON [content]. + * + * @param eventType the Matrix event type of the account data to write. + * @param content the new content, as a raw JSON object. */ suspend fun setAccountData(eventType: String, content: String): Result @@ -226,6 +452,9 @@ interface MatrixClient : UrlContentFetcher { * * This method should be used with caution as providing the [eventId] ourselves can result in incorrect read receipts. * Use [Timeline.markAsRead] instead when possible. + * + * @param roomId the id of the room to mark as read. + * @param eventId the event up to which the room is considered read. */ suspend fun markRoomAsFullyRead(roomId: RoomId, eventId: EventId): Result @@ -252,6 +481,7 @@ interface MatrixClient : UrlContentFetcher { /** * Performs a database optimization that should flush cached data and improve performance. + * A periodic background job already calls this for every session, so callers rarely need to trigger it by hand. */ suspend fun performDatabaseVacuum(): Result @@ -265,6 +495,7 @@ interface MatrixClient : UrlContentFetcher { */ suspend fun resetWellKnownConfig(): Result + /** Returns a provider for the capabilities the homeserver advertises, such as whether the display name can be changed. */ fun homeserverCapabilities(): HomeserverCapabilitiesProvider } From 0bd4dc39cd9dafcf0b864dc2d7a0566a07547c00 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 13 Aug 2026 19:02:12 +0200 Subject: [PATCH 047/145] Add KDoc to matrix API room interfaces Document BaseRoom, JoinedRoom, NotJoinedRoom, RoomAliasHelper and JoinRoom, along with their members, and add the missing @param entries. Fix the documentation of BaseRoom.getUpdatedIsEncrypted, which described the room directory visibility instead of the encryption state it actually returns. Behaviours taken from the implementations: BaseRoom.predecessorRoom swallows errors into null, updateMembers only reads the cache on its first call, JoinedRoom.syncUpdateFlow is an opaque change counter, notification settings start in an Unknown state until updateRoomNotificationSettings is called, and JoinRoom maps a Forbidden answer to Failures.UnauthorizedJoin. Co-Authored-By: Claude Opus 5 (1M context) --- .../libraries/matrix/api/room/BaseRoom.kt | 44 ++++++- .../libraries/matrix/api/room/JoinedRoom.kt | 108 +++++++++++++++++- .../matrix/api/room/NotJoinedRoom.kt | 6 + .../matrix/api/room/alias/RoomAliasHelper.kt | 14 +++ .../matrix/api/room/join/JoinRoom.kt | 11 ++ 5 files changed, 180 insertions(+), 3 deletions(-) diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/BaseRoom.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/BaseRoom.kt index d49343f998..ab65b00f08 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/BaseRoom.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/BaseRoom.kt @@ -66,21 +66,30 @@ interface BaseRoom : Closeable { */ fun isDm() = roomInfoFlow.value.isDm + /** + * The room this one replaced when it was upgraded, or `null` if this room has no predecessor. + * Errors are swallowed and reported as `null`. + */ fun predecessorRoom(): PredecessorRoom? /** * Try to load the room members and update the membersFlow. + * The first call may serve members from the local cache before the server response arrives; later calls always go to the server. */ suspend fun updateMembers() /** * Get the members of the room. Note: generally this should not be used, please use * [membersStateFlow] and [updateMembers] instead. + * + * @param limit the maximum number of members to return. */ suspend fun getMembers(limit: Int = 5): Result> /** * Will return an updated member or an error. + * + * @param userId the member to fetch. */ suspend fun getUpdatedMember(userId: UserId): Result @@ -103,6 +112,8 @@ interface BaseRoom : Closeable { /** * Gets the role of the user with the provided [userId] in the room. + * + * @param userId the member whose role is requested. */ suspend fun userRole(userId: UserId): Result @@ -113,11 +124,15 @@ interface BaseRoom : Closeable { /** * Gets the display name of the user with the provided [userId] in the room. + * + * @param userId the member whose room specific display name is requested. */ suspend fun userDisplayName(userId: UserId): Result /** * Gets the avatar of the user with the provided [userId] in the room. + * + * @param userId the member whose room specific avatar is requested. */ suspend fun userAvatarUrl(userId: UserId): Result @@ -138,6 +153,8 @@ interface BaseRoom : Closeable { /** * Sets the room as favorite or not, based on the [isFavorite] parameter. + * + * @param isFavorite true to mark the room as favorite, false to remove the flag. */ suspend fun setIsFavorite(isFavorite: Boolean): Result @@ -176,22 +193,29 @@ interface BaseRoom : Closeable { suspend fun getRoomVisibility(): Result /** - * Returns the visibility for this room in the room directory, fetching it from the homeserver if needed. + * Returns whether this room is encrypted, based on the latest encryption state known to the SDK rather than on the cached [RoomInfo]. */ suspend fun getUpdatedIsEncrypted(): Result /** * Store the given `ComposerDraft` in the state store of this room. + * + * @param composerDraft the unsent message content to remember. + * @param threadRoot the thread the draft belongs to, or `null` for the main timeline. */ suspend fun saveComposerDraft(composerDraft: ComposerDraft, threadRoot: ThreadId?): Result /** * Retrieve the `ComposerDraft` stored in the state store for this room. + * + * @param threadRoot the thread whose draft is requested, or `null` for the main timeline. */ suspend fun loadComposerDraft(threadRoot: ThreadId?): Result /** * Clear the `ComposerDraft` stored in the state store for this room. + * + * @param threadRoot the thread whose draft should be cleared, or `null` for the main timeline. */ suspend fun clearComposerDraft(threadRoot: ThreadId?): Result @@ -202,10 +226,27 @@ interface BaseRoom : Closeable { */ suspend fun reportRoom(reason: String?): Result + /** + * Declines the incoming call advertised by the given notification, letting the other devices of the room know. + * + * @param notificationEventId the id of the call notification event being declined. + */ suspend fun declineCall(notificationEventId: EventId): Result + /** + * Emits the id of each user who declines the call advertised by the given notification. + * Used to stop ringing once the callee has declined from another device. + * + * @param notificationEventId the id of the call notification event to watch. + */ suspend fun subscribeToCallDecline(notificationEventId: EventId): Flow + /** + * Returns the id of the thread the given event belongs to, fetching the event from the server if it is not cached locally. + * + * @param eventId the event whose thread is requested. + * @return the thread root id, or `null` if the event is not part of a thread. + */ suspend fun threadRootIdForEvent(eventId: EventId): Result /** @@ -213,5 +254,6 @@ interface BaseRoom : Closeable { */ fun destroy() + /** Same as [destroy], so that a room can be used with `use { }`. */ override fun close() = destroy() } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/JoinedRoom.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/JoinedRoom.kt index 6d8325427b..98498131f9 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/JoinedRoom.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/JoinedRoom.kt @@ -28,11 +28,28 @@ import io.element.android.libraries.matrix.api.widget.MatrixWidgetSettings import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.StateFlow +/** + * A room the current user has joined, adding to [BaseRoom] everything that requires membership: sending events, moderation and room settings. + * + * An instance owns SDK resources, in particular [liveTimeline], so it must be closed once no longer needed. + */ interface JoinedRoom : BaseRoom { + /** + * A counter incremented every time a synced event is received on [liveTimeline], so callers can refresh data derived from the room. + * It carries no meaning beyond "something changed", and is only updated while it has subscribers. + */ val syncUpdateFlow: StateFlow + /** The members currently typing in the room, never including the current user; starts as an empty list. */ val roomTypingMembersFlow: Flow> + + /** Emits when the verification state of other members' identities changes, for instance after a member resets their identity. */ val identityStateChangesFlow: Flow> + + /** + * The notification settings that apply to this room. + * Starts as [RoomNotificationSettingsState.Unknown]: [updateRoomNotificationSettings] must be called to populate it. + */ val roomNotificationSettingsStateFlow: StateFlow /** @@ -45,6 +62,7 @@ interface JoinedRoom : BaseRoom { */ val liveTimeline: Timeline + /** Gives access to the paginated list of threads started in this room. */ val threadsListService: ThreadsListService /** @@ -55,6 +73,14 @@ interface JoinedRoom : BaseRoom { createTimelineParams: CreateTimelineParams, ): Result + /** + * Replaces the content of an event previously sent by the current user, by sending an edit of it. + * + * @param eventId the event to edit. + * @param body the new content, as plain text. + * @param htmlBody the new content as HTML, or `null` when the message has no formatted version. + * @param intentionalMentions the users and rooms this new content deliberately mentions. + */ suspend fun editMessage(eventId: EventId, body: String, htmlBody: String?, intentionalMentions: List): Result /** @@ -63,12 +89,28 @@ interface JoinedRoom : BaseRoom { */ suspend fun typingNotice(isTyping: Boolean): Result + /** + * Invites a user to this room. + * + * @param id the user to invite. + */ suspend fun inviteUserById(id: UserId): Result + /** + * Uploads [data] as the new avatar of the room, not of the current user. + * + * @param mimeType the MIME type of the image, for instance `image/jpeg`. + * @param data the raw bytes of the image. + */ suspend fun updateAvatar(mimeType: String, data: ByteArray): Result + /** Removes the avatar of the room. */ suspend fun removeAvatar(): Result + /** + * Refreshes [roomNotificationSettingsStateFlow], which moves to a pending state and then to a ready or error state. + * The failure is reported through that flow as well as through the returned [Result]. + */ suspend fun updateRoomNotificationSettings(): Result /** @@ -83,11 +125,15 @@ interface JoinedRoom : BaseRoom { /** * Update the room's visibility in the room directory. + * + * @param roomVisibility whether the room should be listed publicly in the directory. */ suspend fun updateRoomVisibility(roomVisibility: RoomVisibility): Result /** - * Update room history visibility for this room. + * Update room history visibility for this room, i.e. how much of the past a new member is allowed to read. + * + * @param historyVisibility the new history visibility to apply. */ suspend fun updateHistoryVisibility(historyVisibility: RoomHistoryVisibility): Result @@ -98,6 +144,8 @@ interface JoinedRoom : BaseRoom { * - `true` if the room alias didn't exist and it's now published. * - `false` if the room alias was already present so it couldn't be * published. + * + * @param roomAlias the alias to publish. */ suspend fun publishRoomAliasInRoomDirectory(roomAlias: RoomAlias): Result @@ -108,6 +156,8 @@ interface JoinedRoom : BaseRoom { * - `true` if the room alias was present and it's now removed from the * room directory. * - `false` if the room alias didn't exist so it couldn't be removed. + * + * @param roomAlias the alias to remove. */ suspend fun removeRoomAliasFromRoomDirectory(roomAlias: RoomAlias): Result @@ -117,26 +167,74 @@ interface JoinedRoom : BaseRoom { suspend fun enableEncryption(): Result /** - * Update the join rule for this room. + * Update the join rule for this room, i.e. who is allowed to join it. + * + * @param joinRule the new join rule to apply. */ suspend fun updateJoinRule(joinRule: JoinRule): Result + /** + * Changes the power level of individual members, which is how roles such as moderator or administrator are granted. + * + * @param changes the new power level to apply to each user. + */ suspend fun updateUsersRoles(changes: List): Result + /** + * Changes the power level required for each action in the room, such as inviting, kicking or changing the room name. + * + * @param roomPowerLevelsValues the new threshold for every action. + */ suspend fun updatePowerLevels(roomPowerLevelsValues: RoomPowerLevelsValues): Result + /** Restores the power levels required for each action to the defaults the room was created with. */ suspend fun resetPowerLevels(): Result + /** + * Changes the name of the room. + * + * @param name the new room name. + */ suspend fun setName(name: String): Result + /** + * Changes the topic of the room. + * + * @param topic the new room topic. + */ suspend fun setTopic(topic: String): Result + /** + * Reports an event to the homeserver moderators, optionally ignoring its sender at the same time. + * + * @param eventId the event being reported. + * @param reason the explanation sent to the moderators. + * @param blockUserId the sender to also add to the ignore list, or `null` to only report the event. + */ suspend fun reportContent(eventId: EventId, reason: String, blockUserId: UserId?): Result + /** + * Removes a member from the room; they are able to join again unless they are also banned. + * + * @param userId the member to remove. + * @param reason the reason recorded in the membership event, or `null` for none. + */ suspend fun kickUser(userId: UserId, reason: String? = null): Result + /** + * Bans a user from the room, removing them if they are a member and preventing them from joining again. + * + * @param userId the user to ban. + * @param reason the reason recorded in the membership event, or `null` for none. + */ suspend fun banUser(userId: UserId, reason: String? = null): Result + /** + * Lifts the ban on a user, allowing them to join the room again; it does not invite them back. + * + * @param userId the user to unban. + * @param reason the reason recorded in the membership event, or `null` for none. + */ suspend fun unbanUser(userId: UserId, reason: String? = null): Result /** @@ -161,6 +259,12 @@ interface JoinedRoom : BaseRoom { */ fun getWidgetDriver(widgetSettings: MatrixWidgetSettings): Result + /** + * Enables or disables the send queue of this room only; see [io.element.android.libraries.matrix.api.MatrixClient.setAllSendQueuesEnabled] + * for the session-wide equivalent and for why a queue disables itself. + * + * @param enabled whether the send queue of this room should be enabled. + */ suspend fun setSendQueueEnabled(enabled: Boolean) /** diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/NotJoinedRoom.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/NotJoinedRoom.kt index fd5e71ff9d..a47179cae7 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/NotJoinedRoom.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/NotJoinedRoom.kt @@ -12,7 +12,13 @@ import io.element.android.libraries.matrix.api.room.preview.RoomPreviewInfo /** A reference to a room either invited, knocked or banned. */ interface NotJoinedRoom : AutoCloseable { + /** What is publicly known about the room: name, topic, avatar, join rule and member count. */ val previewInfo: RoomPreviewInfo + + /** + * The local room, available when the user has a membership in it, for instance after being invited. + * It is `null` for a room only discovered through a preview, and closing this instance also closes it. + */ val localRoom: BaseRoom? /** diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/alias/RoomAliasHelper.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/alias/RoomAliasHelper.kt index c23252961f..aecd2ab7f4 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/alias/RoomAliasHelper.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/alias/RoomAliasHelper.kt @@ -10,7 +10,21 @@ package io.element.android.libraries.matrix.api.room.alias import io.element.android.libraries.matrix.api.core.RoomAlias +/** + * Helpers to build and validate room aliases, delegating to the SDK so that the app and the server agree on what is acceptable. + */ interface RoomAliasHelper { + /** + * Turns a room display name into a usable alias local part, dropping the characters that are not allowed in an alias. + * + * @param name the room display name to derive the alias from. + */ fun roomAliasNameFromRoomDisplayName(name: String): String + + /** + * Whether the given alias is well-formed; this is a format check only and says nothing about the alias being taken. + * + * @param roomAlias the alias to validate. + */ fun isRoomAliasValid(roomAlias: RoomAlias): Boolean } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/join/JoinRoom.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/join/JoinRoom.kt index 4220b68f0d..a6b1f3d36b 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/join/JoinRoom.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/join/JoinRoom.kt @@ -11,7 +11,18 @@ package io.element.android.libraries.matrix.api.room.join import im.vector.app.features.analytics.plan.JoinedRoom import io.element.android.libraries.matrix.api.core.RoomIdOrAlias +/** + * Joins a room and reports the join to analytics, so that callers do not have to do both. + */ interface JoinRoom { + /** + * Joins the room, picking the right SDK call depending on whether an id or an alias was given, and captures an analytics event on success. + * A `Forbidden` answer from the server is translated into [Failures.UnauthorizedJoin] so callers can tell it apart from other errors. + * + * @param roomIdOrAlias the id or the alias of the room to join. + * @param serverNames servers to ask about the room, ignored when joining by alias. + * @param trigger what made the user join, recorded in the analytics event. + */ suspend operator fun invoke( roomIdOrAlias: RoomIdOrAlias, serverNames: List, From 8a88638667e2600432d0b1b0abf432d29f2a464e Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 13 Aug 2026 19:03:48 +0200 Subject: [PATCH 048/145] Add KDoc to matrix API knock, threads and permissions interfaces Document KnockRequest and ThreadsListService along with all their members, and add the missing @param entries to the already documented RoomPermissions. For ThreadsListService the docs record what the implementation does with the subscriptions: subscribeToItemUpdates starts a shared subscription on the first call and re-emits the whole list, subscribeToPaginationUpdates replays the current state immediately, and destroy leaves the service unusable. Co-Authored-By: Claude Opus 5 (1M context) --- .../matrix/api/room/knock/KnockRequest.kt | 30 +++++++++++++++++++ .../api/room/powerlevels/RoomPermissions.kt | 24 +++++++++++++++ .../api/room/threads/ThreadsListService.kt | 17 +++++++++++ 3 files changed, 71 insertions(+) diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/knock/KnockRequest.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/knock/KnockRequest.kt index 317157793e..386be0d5c9 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/knock/KnockRequest.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/knock/KnockRequest.kt @@ -11,20 +11,50 @@ package io.element.android.libraries.matrix.api.room.knock import io.element.android.libraries.matrix.api.core.EventId import io.element.android.libraries.matrix.api.core.UserId +/** + * A pending request from a user to join a room whose join rule is knock, along with the actions a moderator can take on it. + * + * Instances are snapshots handed out by [io.element.android.libraries.matrix.api.room.JoinedRoom.knockRequestsFlow]. + */ interface KnockRequest { + /** The id of the membership event carrying the request. */ val eventId: EventId + + /** The user asking to join. */ val userId: UserId + + /** The display name of the user asking to join, or `null` if they have none. */ val displayName: String? + + /** The avatar of the user asking to join, or `null` if they have none. */ val avatarUrl: String? + + /** The message the user attached to their request, or `null` if they sent none. */ val reason: String? + + /** When the request was made, in milliseconds since the epoch, or `null` if the server did not provide it. */ val timestamp: Long? + + /** Whether a moderator has already marked this request as seen, so that it is no longer highlighted as new. */ val isSeen: Boolean + /** Accepts the request, which makes the user a member of the room. */ suspend fun accept(): Result + /** + * Declines the request; the user is free to knock again. + * + * @param reason the explanation recorded in the membership event, or `null` for none. + */ suspend fun decline(reason: String?): Result + /** + * Declines the request and bans the user, so that they cannot knock again. + * + * @param reason the explanation recorded in the membership event, or `null` for none. + */ suspend fun declineAndBan(reason: String?): Result + /** Marks the request as seen, without accepting or declining it. */ suspend fun markAsSeen(): Result } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/powerlevels/RoomPermissions.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/powerlevels/RoomPermissions.kt index a12f7d9606..19c01b9975 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/powerlevels/RoomPermissions.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/powerlevels/RoomPermissions.kt @@ -59,12 +59,16 @@ interface RoomPermissions : AutoCloseable { /** * Returns true if the current user is able to send a specific message type * in the room. + * + * @param message the kind of message the caller wants to send. */ fun canOwnUserSendMessage(message: MessageEventType): Boolean /** * Returns true if the current user is able to send a specific state event * type in the room. + * + * @param stateEvent the kind of state event the caller wants to send. */ fun canOwnUserSendState(stateEvent: StateEventType): Boolean @@ -77,48 +81,66 @@ interface RoomPermissions : AutoCloseable { /** * Returns true if the user with the given userId is able to ban in the * room. + * + * @param userId the member whose ability is checked. */ fun canUserBan(userId: UserId): Boolean /** * Returns true if the user with the given userId is able to invite in the * room. + * + * @param userId the member whose ability is checked. */ fun canUserInvite(userId: UserId): Boolean /** * Returns true if the user with the given userId is able to kick in the * room. + * + * @param userId the member whose ability is checked. */ fun canUserKick(userId: UserId): Boolean /** * Returns true if the user with the given userId is able to pin or unpin * events in the room. + * + * @param userId the member whose ability is checked. */ fun canUserPinUnpin(userId: UserId): Boolean /** * Returns true if the user with the given userId is able to redact * messages of other users in the room. + * + * @param userId the member whose ability is checked. */ fun canUserRedactOther(userId: UserId): Boolean /** * Returns true if the user with the given userId is able to redact * their own messages in the room. + * + * @param userId the member whose ability is checked. */ fun canUserRedactOwn(userId: UserId): Boolean /** * Returns true if the user with the given userId is able to send a * specific message type in the room. + * + * @param userId the member whose ability is checked. + * @param message the kind of message to check. */ fun canUserSendMessage(userId: UserId, message: MessageEventType): Boolean /** * Returns true if the user with the given userId is able to send a * specific state event type in the room. + * + * @param userId the member whose ability is checked. + * @param stateEvent the kind of state event to check. */ fun canUserSendState(userId: UserId, stateEvent: StateEventType): Boolean @@ -127,6 +149,8 @@ interface RoomPermissions : AutoCloseable { * notification in the room. * * The call may fail if there is an error in getting the power levels. + * + * @param userId the member whose ability is checked. */ fun canUserTriggerRoomNotification(userId: UserId): Boolean } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/threads/ThreadsListService.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/threads/ThreadsListService.kt index 7f819c540c..f544211741 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/threads/ThreadsListService.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/threads/ThreadsListService.kt @@ -9,10 +9,27 @@ package io.element.android.libraries.matrix.api.room.threads import kotlinx.coroutines.flow.Flow +/** + * Exposes the paginated list of threads of a single room, kept up to date by the SDK. + * + * The list grows through explicit [paginate] calls; [destroy] must be called to release the underlying SDK resources. + */ interface ThreadsListService { + /** + * The threads loaded so far, starting empty and re-emitted in full whenever the SDK sends an update. + * The underlying subscription is started on the first call and shared by later ones. + */ fun subscribeToItemUpdates(): Flow> + + /** The pagination state of the list, emitting the current value immediately so callers know whether more threads can be loaded. */ fun subscribeToPaginationUpdates(): Flow + + /** Loads the next page of threads, which will be reflected in [subscribeToItemUpdates]. */ suspend fun paginate(): Result + + /** Discards the loaded threads and starts the list again from the most recent one. */ suspend fun reset(): Result + + /** Releases the SDK resources and stops the item subscription; the service is unusable afterwards. */ fun destroy() } From 54780f0f70f42bce6d65ee82740f4c450ff54ce0 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 13 Aug 2026 19:07:55 +0200 Subject: [PATCH 049/145] Add KDoc to matrix API timeline interfaces Document Timeline and all of its members, TimelineProvider, and the three lazy providers carried by EventTimelineItem. Behaviours taken from RustTimeline: collecting membershipChangeEventReceived or onSyncedEventReceived is what keeps the timeline subscribed to the SDK, paginate fails with CannotPaginate when the matching status forbids it, the initial hasMoreToLoad of each pagination status depends on the timeline mode, timelineItems also carries virtual items such as date separators, and the media send functions return a handler the caller must await. Co-Authored-By: Claude Opus 5 (1M context) --- .../libraries/matrix/api/timeline/Timeline.kt | 171 +++++++++++++++++- .../matrix/api/timeline/TimelineProvider.kt | 1 + .../timeline/item/event/EventTimelineItem.kt | 16 ++ 3 files changed, 187 insertions(+), 1 deletion(-) diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/timeline/Timeline.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/timeline/Timeline.kt index 8cb933205b..72483e68f1 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/timeline/Timeline.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/timeline/Timeline.kt @@ -31,6 +31,12 @@ import kotlinx.coroutines.flow.StateFlow import kotlinx.parcelize.Parcelize import java.io.File +/** + * A window over the events of a room, restricted by its [Mode], and the entry point for sending events to that room. + * + * A timeline owns SDK resources and must be closed once no longer needed, except the live timeline, which is owned by its room. + * Sending returns successfully as soon as the event has been handed to the room's send queue, not when the server has accepted it. + */ interface Timeline : AutoCloseable { data class PaginationStatus( val isPaginating: Boolean, @@ -54,18 +60,66 @@ interface Timeline : AutoCloseable { data class Thread(val threadRootId: ThreadId) : Mode } + /** What this timeline is a view over: the live room, a single event and its context, the pinned events, the media, or a thread. */ val mode: Mode + + /** + * Emits every time a membership change event is received in this timeline, without saying which one. + * Collecting it keeps the timeline subscribed to the SDK, so it should not be collected for longer than needed. + */ val membershipChangeEventReceived: Flow + + /** + * Emits every time an event coming from sync is received in this timeline, without saying which one. + * As with [membershipChangeEventReceived], collecting it keeps the timeline subscribed to the SDK. + */ val onSyncedEventReceived: Flow + + /** + * Sends a read receipt for a single event, which is how the unread state of the room is cleared. + * + * @param eventId the event the receipt points at. + * @param receiptType whether the receipt is public, private or only marks the fully read position. + */ suspend fun sendReadReceipt(eventId: EventId, receiptType: ReceiptType): Result + + /** + * Marks the whole timeline as read by sending a receipt on its latest event. + * + * @param receiptType whether the receipt is public, private or only marks the fully read position. + */ suspend fun markAsRead(receiptType: ReceiptType): Result + + /** + * Loads one more page of events and updates the matching pagination status flow. + * Fails with a `CannotPaginate` error when the corresponding status does not allow it, for instance because a pagination is already running. + * + * @param direction whether to load older or newer events. + * @return whether the end of the timeline has been reached in that direction. + */ suspend fun paginate(direction: PaginationDirection): Result + /** Whether older events are being loaded and whether more remain; pinned event timelines start with nothing more to load. */ val backwardPaginationStatus: StateFlow + + /** Whether newer events are being loaded and whether more remain; only a timeline focused on an event starts with more to load. */ val forwardPaginationStatus: StateFlow + /** + * The items to display, in timeline order, re-emitted on every change. + * Beyond the room events this also carries the virtual items the UI needs, such as date separators, loading indicators and the room beginning. + */ val timelineItems: Flow> + /** + * Sends a text message to the room this timeline belongs to. + * + * @param body the message content, as plain text. + * @param htmlBody the message content as HTML, or `null` to send it unformatted. + * @param intentionalMentions the users and rooms the message deliberately mentions, so that they are notified. + * @param msgType the Matrix message type to use, which distinguishes a normal message from an emote or a notice. + * @param asPlainText whether to send the message without any formatting, ignoring markdown in [body]. + */ suspend fun sendMessage( body: String, htmlBody: String?, @@ -74,6 +128,14 @@ interface Timeline : AutoCloseable { asPlainText: Boolean = false, ): Result + /** + * Replaces the content of a message, whether it has already been sent or is still local in the send queue. + * + * @param eventOrTransactionId the event to edit, identified by its event id once sent or by its transaction id while still local. + * @param body the new content, as plain text. + * @param htmlBody the new content as HTML, or `null` to send it unformatted. + * @param intentionalMentions the users and rooms the new content deliberately mentions. + */ suspend fun editMessage( eventOrTransactionId: EventOrTransactionId, body: String, @@ -81,12 +143,29 @@ interface Timeline : AutoCloseable { intentionalMentions: List, ): Result + /** + * Replaces the caption of an already sent media message, leaving the media itself untouched. + * + * @param eventOrTransactionId the media event to edit, identified by its event id or by its transaction id while still local. + * @param caption the new caption, or `null` to remove it. + * @param formattedCaption the new caption as HTML, or `null` to send it unformatted. + */ suspend fun editCaption( eventOrTransactionId: EventOrTransactionId, caption: String?, formattedCaption: String?, ): Result + /** + * Sends a message as a reply to another event. + * + * @param repliedToEventId the event being replied to. + * @param body the reply content, as plain text. + * @param htmlBody the reply content as HTML, or `null` to send it unformatted. + * @param intentionalMentions the users and rooms the reply deliberately mentions. + * @param fromNotification whether the reply was written from a notification rather than from the timeline. + * @param msgType the Matrix message type to use. + */ suspend fun replyMessage( repliedToEventId: EventId, body: String, @@ -96,6 +175,16 @@ interface Timeline : AutoCloseable { msgType: MsgType = MsgType.MSG_TYPE_TEXT, ): Result + /** + * Starts sending an image. The returned [MediaUploadHandler] tracks the upload and must be awaited by the caller to know the outcome. + * + * @param file the image to upload. + * @param thumbnailFile a pre-generated thumbnail, or `null` to send none. + * @param imageInfo the dimensions, size and MIME type of the image. + * @param caption the text shown along with the image, or `null` for none. + * @param formattedCaption the caption as HTML, or `null` to send it unformatted. + * @param inReplyToEventId the event this message replies to, or `null` if it is not a reply. + */ suspend fun sendImage( file: File, thumbnailFile: File?, @@ -105,6 +194,16 @@ interface Timeline : AutoCloseable { inReplyToEventId: EventId?, ): Result + /** + * Starts sending a video, with the same upload contract as [sendImage]. + * + * @param file the video to upload. + * @param thumbnailFile a pre-generated thumbnail, or `null` to send none. + * @param videoInfo the duration, dimensions, size and MIME type of the video. + * @param caption the text shown along with the video, or `null` for none. + * @param formattedCaption the caption as HTML, or `null` to send it unformatted. + * @param inReplyToEventId the event this message replies to, or `null` if it is not a reply. + */ suspend fun sendVideo( file: File, thumbnailFile: File?, @@ -114,6 +213,15 @@ interface Timeline : AutoCloseable { inReplyToEventId: EventId?, ): Result + /** + * Starts sending an audio file, with the same upload contract as [sendImage]; use [sendVoiceMessage] for a recorded voice message. + * + * @param file the audio file to upload. + * @param audioInfo the duration, size and MIME type of the audio. + * @param caption the text shown along with the audio, or `null` for none. + * @param formattedCaption the caption as HTML, or `null` to send it unformatted. + * @param inReplyToEventId the event this message replies to, or `null` if it is not a reply. + */ suspend fun sendAudio( file: File, audioInfo: AudioInfo, @@ -122,6 +230,15 @@ interface Timeline : AutoCloseable { inReplyToEventId: EventId?, ): Result + /** + * Starts sending an arbitrary file, with the same upload contract as [sendImage]. + * + * @param file the file to upload. + * @param fileInfo the size and MIME type of the file. + * @param caption the text shown along with the file, or `null` for none. + * @param formattedCaption the caption as HTML, or `null` to send it unformatted. + * @param inReplyToEventId the event this message replies to, or `null` if it is not a reply. + */ suspend fun sendFile( file: File, fileInfo: FileInfo, @@ -151,6 +268,14 @@ interface Timeline : AutoCloseable { inReplyToEventId: EventId?, ): Result + /** + * Starts sending a recorded voice message, with the same upload contract as [sendImage]. + * + * @param file the recorded audio to upload. + * @param audioInfo the duration, size and MIME type of the recording. + * @param waveform the amplitudes used to draw the waveform, normalised between 0 and 1. + * @param inReplyToEventId the event this message replies to, or `null` if it is not a reply. + */ suspend fun sendVoiceMessage( file: File, audioInfo: AudioInfo, @@ -158,6 +283,14 @@ interface Timeline : AutoCloseable { inReplyToEventId: EventId?, ): Result + /** + * Starts sending several media items as a single gallery message, with the same upload contract as [sendImage]. + * + * @param items the media making up the gallery, in the order they should appear. + * @param caption the text shown along with the gallery, or `null` for none. + * @param formattedCaption the caption as HTML, or `null` to send it unformatted. + * @param inReplyToEventId the event this message replies to, or `null` if it is not a reply. + */ suspend fun sendGallery( items: List, caption: String?, @@ -165,12 +298,36 @@ interface Timeline : AutoCloseable { inReplyToEventId: EventId?, ): Result + /** + * Redacts an event, i.e. asks the server to remove its content; it also removes a local echo that has not been sent yet. + * + * @param eventOrTransactionId the event to redact, identified by its event id once sent or by its transaction id while still local. + * @param reason the explanation recorded in the redaction event, or `null` for none. + */ suspend fun redactEvent(eventOrTransactionId: EventOrTransactionId, reason: String?): Result + /** + * Adds the given reaction to an event, or removes it if the current user had already reacted with it. + * + * @param emoji the reaction key, usually an emoji. + * @param eventOrTransactionId the event to react to, identified by its event id or by its transaction id while still local. + * @return whether the reaction is now present. + */ suspend fun toggleReaction(emoji: String, eventOrTransactionId: EventOrTransactionId): Result + /** + * Forwards the content of an event to other rooms, as new messages sent by the current user. + * + * @param eventId the event whose content is forwarded. + * @param roomIds the rooms to forward it to. + */ suspend fun forwardEvent(eventId: EventId, roomIds: List): Result + /** + * Cancels an event that is still waiting in the send queue, by redacting its local echo. + * + * @param transactionId the transaction id of the local echo to drop. + */ suspend fun cancelSend(transactionId: TransactionId): Result = redactEvent(transactionId.toEventOrTransactionId(), reason = null) @@ -222,12 +379,20 @@ interface Timeline : AutoCloseable { */ suspend fun endPoll(pollStartId: EventId, text: String): Result + /** + * Resolves the content of a replied-to event so it can be rendered above the reply. + * Served from the loaded timeline items when possible, otherwise fetched through the SDK. + * + * @param eventId the event being replied to. + */ suspend fun loadReplyDetails(eventId: EventId): InReplyTo /** * Returns true if [eventId] is currently loaded in this timeline's window, even if the display * layer does not render it (e.g. filtered or state events). This distinguishes "in the window * but not displayed" from "genuinely outside the loaded window". + * + * @param eventId the event to look for. */ suspend fun isEventLoaded(eventId: EventId): Boolean @@ -237,6 +402,8 @@ interface Timeline : AutoCloseable { * * Returns `true` if we sent the request, `false` if the event was already * pinned. + * + * @param eventId the event to pin. */ suspend fun pinEvent(eventId: EventId): Result @@ -246,11 +413,13 @@ interface Timeline : AutoCloseable { * * Returns `true` if we sent the request, `false` if the event wasn't * pinned + * + * @param eventId the event to unpin. */ suspend fun unpinEvent(eventId: EventId): Result /** - * Get the latest event id of the timeline. + * Get the latest event id of the timeline, or `null` when it holds no event yet. */ suspend fun getLatestEventId(): Result } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/timeline/TimelineProvider.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/timeline/TimelineProvider.kt index 28e487f527..ef9d5d794e 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/timeline/TimelineProvider.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/timeline/TimelineProvider.kt @@ -18,6 +18,7 @@ import kotlinx.coroutines.flow.first * By default, the active timeline is the live timeline. */ fun interface TimelineProvider { + /** The timeline currently in use, or `null` while none is available yet; see [getActiveTimeline] to await a non-null value. */ fun activeTimelineFlow(): StateFlow } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/timeline/item/event/EventTimelineItem.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/timeline/item/event/EventTimelineItem.kt index f3982e83d2..91703f7fa4 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/timeline/item/event/EventTimelineItem.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/timeline/item/event/EventTimelineItem.kt @@ -60,14 +60,30 @@ data class EventTimelineItem( } } +/** + * Provides the debug information of a timeline item on demand, so the original event JSON is only fetched from the SDK when actually displayed. + */ fun interface TimelineItemDebugInfoProvider { + /** Returns the debug information of the item, including its original and latest edit JSON. */ operator fun invoke(): TimelineItemDebugInfo } +/** + * Provides the encryption warning to show next to a timeline item on demand, so the check is only run for items that are displayed. + */ fun interface MessageShieldProvider { + /** + * Returns the warning to display for this event, or `null` when there is nothing to warn about. + * + * @param strict whether to also report the weaker problems that are hidden by default. + */ operator fun invoke(strict: Boolean): MessageShield? } +/** + * Provides the send queue handle of a timeline item on demand, which is needed to retry or cancel a failed send. + */ fun interface SendHandleProvider { + /** Returns the send handle of the item, or `null` when it is not a local echo waiting in the send queue. */ operator fun invoke(): SendHandle? } From fa01166197175241d6882b925ace4919d9255bf9 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 13 Aug 2026 19:10:58 +0200 Subject: [PATCH 050/145] Add KDoc to matrix API encryption and verification interfaces Document EncryptionService, SessionVerificationService and SessionVerificationServiceListener along with their members, and add the missing @param entries. From RustEncryptionService: the backup and recovery state flows report a waiting-for-sync value for as long as the session is not syncing, and isLastDevice and hasDevicesToVerifyAgainst are polled rather than observed. PasswordStrengthEstimator was already accurate and is left untouched. Co-Authored-By: Claude Opus 5 (1M context) --- .../api/encryption/EncryptionService.kt | 29 ++++++++++++++++++- .../SessionVerificationService.kt | 22 ++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/encryption/EncryptionService.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/encryption/EncryptionService.kt index f82cdc1969..e036a198df 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/encryption/EncryptionService.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/encryption/EncryptionService.kt @@ -14,13 +14,32 @@ import io.element.android.libraries.matrix.api.encryption.identity.IdentityState import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.StateFlow +/** + * Gives access to the end-to-end encryption state of the session: key backup, recovery, and the trust of other users' identities. + */ interface EncryptionService { + /** + * The state of the room key backup on the server. + * Reports [BackupState.WAITING_FOR_SYNC] for as long as the session is not actively syncing, since the real state is unknown until then. + */ val backupStateStateFlow: StateFlow + + /** + * The state of recovery, i.e. whether the secrets needed to restore the keys on a new device are available. + * As with [backupStateStateFlow], it reports a waiting-for-sync state until the session is syncing. + */ val recoveryStateStateFlow: StateFlow + + /** Progress of the [enableRecovery] call currently in flight, to be observed while that call is running. */ val enableRecoveryProgressStateFlow: StateFlow + + /** Whether this is the only device of the account, which matters because logging out of it can make the room keys unrecoverable. */ val isLastDevice: StateFlow + + /** Whether the account has another device this one could be verified against; it stays loading until the first answer arrives. */ val hasDevicesToVerifyAgainst: StateFlow> + /** Enables the room key backup on the server, so that the keys survive losing every device. */ suspend fun enableBackups(): Result /** @@ -39,12 +58,16 @@ interface EncryptionService { */ suspend fun resetRecoveryKey(): Result + /** Disables recovery, which deletes the secrets from server-side storage; the key backup itself is left in place. */ suspend fun disableRecovery(): Result + /** Whether a room key backup currently exists on the server, whether or not this device is the one using it. */ suspend fun doesBackupExistOnServer(): Result /** - * Note: accept both recoveryKey and passphrase. + * Restores the secrets from server-side storage, which unlocks the room key backup for this device. + * + * @param recoveryKey the recovery key, or the passphrase it was derived from; both are accepted. */ suspend fun recover(recoveryKey: String): Result @@ -72,6 +95,8 @@ interface EncryptionService { /** * Remember this identity, ensuring it does not result in a pin violation. + * + * @param userId the user whose current identity should be pinned. */ suspend fun pinUserIdentity(userId: UserId): Result @@ -81,6 +106,8 @@ interface EncryptionService { * Useful when a user that was verified is not anymore, but it is not * possible to re-verify immediately. This allows to restore communication by reverting the * user trust from verified to TOFU verified. + * + * @param userId the user whose verification should be withdrawn. */ suspend fun withdrawVerification(userId: UserId): Result diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/verification/SessionVerificationService.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/verification/SessionVerificationService.kt index 38a00d833d..de9b11e882 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/verification/SessionVerificationService.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/verification/SessionVerificationService.kt @@ -13,6 +13,12 @@ import io.element.android.libraries.matrix.api.core.UserId import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.StateFlow +/** + * Drives session verification: proving to the account that this device is trusted, and verifying other users. + * + * A verification is a stateful exchange between two devices, so at most one flow is active at a time and its progress is reported + * through [verificationFlowState] rather than through the return value of each call. + */ interface SessionVerificationService { /** * State of the current verification flow ([VerificationFlowState.Initial] if not started). @@ -37,6 +43,8 @@ interface SessionVerificationService { /** * Request verification of the user with the given [userId]. + * + * @param userId the other user to verify. */ suspend fun requestUserVerification(userId: UserId) @@ -62,17 +70,23 @@ interface SessionVerificationService { /** * Returns the verification service state to the initial step. + * + * @param cancelAnyPendingVerificationAttempt whether to also cancel a verification that is still in progress. */ suspend fun reset(cancelAnyPendingVerificationAttempt: Boolean) /** * Register a listener to be notified of incoming session verification requests. + * + * @param listener the listener to notify, or `null` to stop being notified. */ fun setListener(listener: SessionVerificationServiceListener?) /** * Set this particular request as the currently active one and register for * events pertaining it. + * + * @param verificationRequest the incoming request to make active. */ suspend fun acknowledgeVerificationRequest(verificationRequest: VerificationRequest.Incoming) @@ -82,7 +96,15 @@ interface SessionVerificationService { suspend fun acceptVerificationRequest() } +/** + * Notified when another device asks to verify this session; register one through [SessionVerificationService.setListener]. + */ interface SessionVerificationServiceListener { + /** + * Called when a verification request is received, so the app can prompt the user about it. + * + * @param verificationRequest the incoming request, to be passed to [SessionVerificationService.acknowledgeVerificationRequest] to act on it. + */ fun onIncomingSessionRequest(verificationRequest: VerificationRequest.Incoming) } From 0b2d6eafc345aa8a60cf20d2d196b0ae59d2ed45 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 13 Aug 2026 19:14:00 +0200 Subject: [PATCH 051/145] Add KDoc to matrix API authentication and device linking interfaces Document MatrixAuthenticationService, OAuthRedirectUrlProvider, the two QR code login data interfaces, and the four device linking interfaces, along with their members and parameters. The docs record the ordering constraints a caller has to respect: setHomeserver must precede any login attempt, the link handlers report their outcome through their step flow rather than through a return value, and ContinuationMessageSender expects exactly one of cancel or confirm. The oauth package holds only a sealed interface, so it is out of scope here. Co-Authored-By: Claude Opus 5 (1M context) --- .../api/auth/MatrixAuthenticationService.kt | 41 ++++++++++++++++++- .../api/auth/OAuthRedirectUrlProvider.kt | 4 ++ .../api/auth/qrlogin/MatrixQrCodeLoginData.kt | 6 +++ .../qrlogin/MatrixQrCodeLoginDataFactory.kt | 8 ++++ .../api/linknewdevice/CheckCodeSender.kt | 3 ++ .../ContinuationMessageSender.kt | 8 ++++ .../api/linknewdevice/LinkDesktopHandler.kt | 14 +++++++ .../api/linknewdevice/LinkMobileHandler.kt | 9 ++++ 8 files changed, 92 insertions(+), 1 deletion(-) diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/auth/MatrixAuthenticationService.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/auth/MatrixAuthenticationService.kt index 04d1d13593..3ff1eaa337 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/auth/MatrixAuthenticationService.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/auth/MatrixAuthenticationService.kt @@ -16,23 +16,41 @@ import io.element.android.libraries.matrix.api.auth.qrlogin.QrCodeLoginStep import io.element.android.libraries.matrix.api.core.SessionId import io.element.android.libraries.matrix.api.core.UserId +/** + * Creates and restores sessions: password login, OAuth login, QR code login, and importing a session from another client. + * + * [setHomeserver] must be called before any login attempt, since it is what tells the SDK which server to authenticate against. + * Every successful login stores the session and notifies the listeners registered through [listenToNewMatrixClients]. + */ interface MatrixAuthenticationService { /** * Restore a session from a [sessionId]. * Do not restore anything it the access token is not valid anymore. * Generally this method should not be used directly, prefer using [MatrixClientProvider.getOrRestore] instead. + * + * @param sessionId the session to restore. */ suspend fun restoreSession(sessionId: SessionId): Result /** * Set the homeserver to use for authentication, and return its details. + * + * @param homeserver the homeserver URL or server name to authenticate against. */ suspend fun setHomeserver(homeserver: String): Result + /** + * Logs in with a password on the homeserver previously set through [setHomeserver]. + * + * @param username the user id or its local part. + * @param password the account password. + */ suspend fun login(username: String, password: String): Result /** * Import a session that was created using another client, for instance Element Web. + * + * @param externalSession the tokens and identifiers of the session to import. */ suspend fun importCreatedSession(externalSession: ExternalSession): Result @@ -42,6 +60,9 @@ interface MatrixAuthenticationService { /** * Get the OAuth url to display to the user. + * + * @param prompt whether the authentication server should show the sign-in or the account-creation page. + * @param loginHint the user identifier to pre-fill on that page, or `null` to leave it empty. */ suspend fun getOAuthUrl( prompt: OAuthPrompt, @@ -55,11 +76,17 @@ interface MatrixAuthenticationService { /** * Set the existing data about Element Classic session, if any. + * + * @param session the session found in a local Element Classic install, or `null` when there is none to migrate. */ fun setElementClassicSession(session: ElementClassicSession?) /** * Check if the provided secrets from Element Classic session contain a key backup. + * + * @param userId the user the secrets belong to. + * @param secrets the raw secrets exported from Element Classic. + * @param backupInfo the raw backup description exported alongside them. */ fun doSecretsContainBackupKey( userId: UserId, @@ -69,11 +96,23 @@ interface MatrixAuthenticationService { /** * Attempt to log in using the [callbackUrl] provided by the OAuth page. + * + * @param callbackUrl the redirect URL the authentication server sent the user back to, carrying the authorization code. */ suspend fun loginWithOAuth(callbackUrl: String): Result + /** + * Logs in by acting on a QR code shown by an already signed in device, reporting each step of the exchange as it happens. + * + * @param qrCodeData the decoded QR code, obtained from [io.element.android.libraries.matrix.api.auth.qrlogin.MatrixQrCodeLoginDataFactory]. + * @param progress called on every step of the flow, so the UI can follow along. + */ suspend fun loginWithQrCode(qrCodeData: MatrixQrCodeLoginData, progress: (QrCodeLoginStep) -> Unit): Result - /** Listen to new Matrix clients being created on authentication. */ + /** + * Listen to new Matrix clients being created on authentication. + * + * @param lambda called with each client created by a successful login or session restore. + */ fun listenToNewMatrixClients(lambda: (MatrixClient) -> Unit) } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/auth/OAuthRedirectUrlProvider.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/auth/OAuthRedirectUrlProvider.kt index 669d47501d..648884e930 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/auth/OAuthRedirectUrlProvider.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/auth/OAuthRedirectUrlProvider.kt @@ -8,6 +8,10 @@ package io.element.android.libraries.matrix.api.auth +/** + * Provides the redirect URL registered for OAuth login, which the authentication server sends the user back to once they have signed in. + */ interface OAuthRedirectUrlProvider { + /** Returns the redirect URL, built from the app's custom URL scheme so that the system hands the callback back to the app. */ fun provide(): String } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/auth/qrlogin/MatrixQrCodeLoginData.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/auth/qrlogin/MatrixQrCodeLoginData.kt index 413f17af63..f800ad2ba1 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/auth/qrlogin/MatrixQrCodeLoginData.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/auth/qrlogin/MatrixQrCodeLoginData.kt @@ -8,6 +8,12 @@ package io.element.android.libraries.matrix.api.auth.qrlogin +/** + * The decoded content of a login QR code, as produced by [MatrixQrCodeLoginDataFactory]. + * + * The underlying data is opaque to the app: it is passed back to the SDK to perform the login. + */ interface MatrixQrCodeLoginData { + /** The homeserver advertised by the QR code, or `null` when it does not carry one. */ fun serverName(): String? } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/auth/qrlogin/MatrixQrCodeLoginDataFactory.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/auth/qrlogin/MatrixQrCodeLoginDataFactory.kt index b0e3089501..21d77b74f2 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/auth/qrlogin/MatrixQrCodeLoginDataFactory.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/auth/qrlogin/MatrixQrCodeLoginDataFactory.kt @@ -8,6 +8,14 @@ package io.element.android.libraries.matrix.api.auth.qrlogin +/** + * Decodes the raw bytes of a scanned QR code into login data the SDK can use. + */ interface MatrixQrCodeLoginDataFactory { + /** + * Parses the scanned bytes, failing with a [QrCodeDecodeException] when they are not a valid Matrix login QR code. + * + * @param data the raw content read from the QR code. + */ fun parseQrCodeData(data: ByteArray): Result } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/linknewdevice/CheckCodeSender.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/linknewdevice/CheckCodeSender.kt index ecb440de83..a3a518f9ce 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/linknewdevice/CheckCodeSender.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/linknewdevice/CheckCodeSender.kt @@ -7,6 +7,9 @@ package io.element.android.libraries.matrix.api.linknewdevice +/** + * Lets the user confirm the two-digit check code displayed by the device being linked, which proves the channel is not being intercepted. + */ interface CheckCodeSender { /** * Validates the given [code]. Returns true if the code is valid, false otherwise. diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/linknewdevice/ContinuationMessageSender.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/linknewdevice/ContinuationMessageSender.kt index 0bbbaf3187..0a2ce273d5 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/linknewdevice/ContinuationMessageSender.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/linknewdevice/ContinuationMessageSender.kt @@ -7,7 +7,15 @@ package io.element.android.libraries.matrix.api.linknewdevice +/** + * Lets the user confirm or refuse a device linking request once they have approved it in the browser. + * + * Handed out with the step that is waiting for authorisation; exactly one of the two methods is meant to be called. + */ interface ContinuationMessageSender { + /** Tells the other device that the user refused the linking, which ends the flow. */ suspend fun cancel(): Result + + /** Tells the other device that the user approved the linking, so the flow can carry on. */ suspend fun confirm(): Result } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/linknewdevice/LinkDesktopHandler.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/linknewdevice/LinkDesktopHandler.kt index 343624aa34..26c2ed04c4 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/linknewdevice/LinkDesktopHandler.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/linknewdevice/LinkDesktopHandler.kt @@ -10,8 +10,22 @@ package io.element.android.libraries.matrix.api.linknewdevice import io.element.android.libraries.matrix.api.auth.qrlogin.QrCodeDecodeException import kotlinx.coroutines.flow.StateFlow +/** + * Drives the linking of a new device that cannot scan a QR code, such as a desktop: this device scans the code the other one displays. + * + * Progress is reported entirely through [linkDesktopStep]; there is one handler per attempt, obtained from + * [io.element.android.libraries.matrix.api.MatrixClient.createLinkDesktopHandler]. + */ interface LinkDesktopHandler { + /** Each step of the flow, from establishing the secure channel to syncing the secrets to the new device. */ val linkDesktopStep: StateFlow + + /** + * Runs the whole flow from the QR code just scanned, suspending until it finishes or fails. + * A code that cannot be decoded is reported as an invalid-QR-code step rather than as a thrown error. + * + * @param data the raw content read from the QR code shown by the other device. + */ suspend fun handleScannedQrCode(data: ByteArray) } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/linknewdevice/LinkMobileHandler.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/linknewdevice/LinkMobileHandler.kt index f187b8275a..ae51eb1f0a 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/linknewdevice/LinkMobileHandler.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/linknewdevice/LinkMobileHandler.kt @@ -9,8 +9,17 @@ package io.element.android.libraries.matrix.api.linknewdevice import kotlinx.coroutines.flow.Flow +/** + * Drives the linking of a new device that is able to scan a QR code, by showing one on this already signed in device. + * + * Progress is reported entirely through [linkMobileStep]; there is one handler per attempt, obtained from + * [io.element.android.libraries.matrix.api.MatrixClient.createLinkMobileHandler]. + */ interface LinkMobileHandler { + /** Each step of the flow, from generating the QR code to syncing the secrets to the new device. */ val linkMobileStep: Flow + + /** Runs the whole flow, suspending until it finishes or fails; the outcome is reported through [linkMobileStep]. */ suspend fun start() } From 1e19f5b607b2b3d4226950562f116645c687f216 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 13 Aug 2026 19:28:15 +0200 Subject: [PATCH 052/145] Add KDoc to matrix API room list, directory and spaces interfaces Document RoomDirectoryService, RoomDirectoryList, SpaceService, SpaceRoomList and LeaveSpaceHandle along with their members, add the missing DynamicRoomList page size doc and the missing @param entries, and give MessageSearchService the interface level doc it was lacking. The docs make the ownership rules explicit, since they differ across these types: a SpaceRoomList and a LeaveSpaceHandle are owned by the caller and must be destroyed or closed, while a RoomDirectoryList and a MessageSearch are released when the scope they were created with completes. RoomList, RoomListService and the search interfaces were already accurate and are left untouched. Co-Authored-By: Claude Opus 5 (1M context) --- .../api/roomdirectory/RoomDirectoryList.kt | 9 +++++++ .../api/roomdirectory/RoomDirectoryService.kt | 8 ++++++ .../matrix/api/roomlist/DynamicRoomList.kt | 1 + .../matrix/api/search/MessageSearchService.kt | 5 ++++ .../matrix/api/spaces/LeaveSpaceHandle.kt | 5 ++++ .../matrix/api/spaces/SpaceRoomList.kt | 14 ++++++++++ .../matrix/api/spaces/SpaceService.kt | 27 +++++++++++++++++++ 7 files changed, 69 insertions(+) diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/roomdirectory/RoomDirectoryList.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/roomdirectory/RoomDirectoryList.kt index c48bf54e9c..49de1bee89 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/roomdirectory/RoomDirectoryList.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/roomdirectory/RoomDirectoryList.kt @@ -10,12 +10,21 @@ package io.element.android.libraries.matrix.api.roomdirectory import kotlinx.coroutines.flow.Flow +/** + * A single, stateful search in the public room directory: one query at a time, with paginated results. + * + * Obtain an instance from [RoomDirectoryService.createRoomDirectoryList]. + */ interface RoomDirectoryList { /** * Starts a filtered search for the server. * If the filter is not provided it will search for all the rooms. You can specify a batch_size to control the number of rooms to fetch per request. * If the via_server is not provided it will search in the current homeserver by default. * This method will clear the current search results and start a new one + * + * @param filter the text to look for, or `null` to list every room. + * @param batchSize the number of rooms to fetch per request. + * @param viaServerName the server whose directory to search, or `null` to use the user's own homeserver. */ suspend fun filter(filter: String?, batchSize: Int, viaServerName: String?): Result diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/roomdirectory/RoomDirectoryService.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/roomdirectory/RoomDirectoryService.kt index 8f71cfb18c..65f83299cb 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/roomdirectory/RoomDirectoryService.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/roomdirectory/RoomDirectoryService.kt @@ -10,6 +10,14 @@ package io.element.android.libraries.matrix.api.roomdirectory import kotlinx.coroutines.CoroutineScope +/** + * Gives access to the public room directory, i.e. the rooms a server advertises to users who have not joined them. + */ interface RoomDirectoryService { + /** + * Creates an independent directory search, which is stateful and holds one query at a time. + * + * @param scope the lifetime of the search; the underlying SDK resources are released when it completes, so there is nothing to close by hand. + */ fun createRoomDirectoryList(scope: CoroutineScope): RoomDirectoryList } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/roomlist/DynamicRoomList.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/roomlist/DynamicRoomList.kt index 952cee6f22..eee98b82e9 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/roomlist/DynamicRoomList.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/roomlist/DynamicRoomList.kt @@ -14,6 +14,7 @@ package io.element.android.libraries.matrix.api.roomlist * It lets load rooms on demand and filter them. */ interface DynamicRoomList : RoomList { + /** The number of rooms added to the list by each [loadMore] call, as chosen when the list was created. */ val pageSize: Int /** diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/search/MessageSearchService.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/search/MessageSearchService.kt index 3e20b163f2..d7d8c017e3 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/search/MessageSearchService.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/search/MessageSearchService.kt @@ -10,6 +10,11 @@ package io.element.android.libraries.matrix.api.search import io.element.android.libraries.matrix.api.core.RoomId import kotlinx.coroutines.CoroutineScope +/** + * Creates the message search cursors backed by the local search index. + * + * Only usable when the session was built with the index attached, see [io.element.android.libraries.matrix.api.MatrixClient.isMessageSearchAvailable]. + */ interface MessageSearchService { /** * Create a new, independent search cursor. diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/spaces/LeaveSpaceHandle.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/spaces/LeaveSpaceHandle.kt index 174ec20dc9..59b9657b58 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/spaces/LeaveSpaceHandle.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/spaces/LeaveSpaceHandle.kt @@ -10,6 +10,11 @@ package io.element.android.libraries.matrix.api.spaces import io.element.android.libraries.matrix.api.core.RoomId +/** + * Handles leaving a space, letting the user also choose which of its rooms to leave in the same operation. + * + * Obtain an instance from [SpaceService.getLeaveSpaceHandle]; the caller owns it and must [close] it. + */ interface LeaveSpaceHandle { /** * The id of the space to leave. diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/spaces/SpaceRoomList.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/spaces/SpaceRoomList.kt index 2ccee8d1ee..b29d721d07 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/spaces/SpaceRoomList.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/spaces/SpaceRoomList.kt @@ -16,22 +16,36 @@ import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import java.util.Optional +/** + * The paginated list of the children of a single space, kept up to date by the SDK. + * + * Obtain an instance from [SpaceService.spaceRoomList]; the caller owns it and must call [destroy] when done. + */ interface SpaceRoomList { sealed interface PaginationStatus { data object Loading : PaginationStatus data class Idle(val hasMoreToLoad: Boolean) : PaginationStatus } + /** The space whose children this list holds. */ val spaceId: RoomId + /** What is known about the space itself, starting empty until the SDK provides it. */ val currentSpaceFlow: StateFlow> + /** The children loaded so far, re-emitted in full on every update; the latest value is replayed to new collectors. */ val spaceRoomsFlow: Flow> + + /** Whether a page is being loaded and whether more children remain; see [loadAllIncrementally] to drain the list. */ val paginationStatusFlow: StateFlow + /** Loads the next page of children, which will be reflected in [spaceRoomsFlow]. */ suspend fun paginate(): Result + + /** Discards the loaded children and starts the list again from the beginning. */ suspend fun reset(): Result + /** Releases the SDK resources and cancels the internal scope; the list is unusable afterwards. */ fun destroy() } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/spaces/SpaceService.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/spaces/SpaceService.kt index 299209e188..a7126a4766 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/spaces/SpaceService.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/spaces/SpaceService.kt @@ -11,13 +11,35 @@ package io.element.android.libraries.matrix.api.spaces import io.element.android.libraries.matrix.api.core.RoomId import kotlinx.coroutines.flow.SharedFlow +/** + * Gives access to the spaces the user belongs to, their hierarchy, and the operations that change it. + */ interface SpaceService { + /** The spaces that have no joined parent, i.e. the roots of the hierarchy shown to the user; the latest value is replayed to new collectors. */ val topLevelSpacesFlow: SharedFlow> + + /** The filters the space list can be narrowed down with; as with [topLevelSpacesFlow], the latest value is replayed. */ val spaceFiltersFlow: SharedFlow> + + /** + * Returns the spaces the given room or space is a child of, restricted to the ones the user has joined. + * + * @param spaceId the room or space whose parents are requested. + */ suspend fun joinedParents(spaceId: RoomId): Result> + /** + * Returns what is known about a single space, or `null` if it is unknown or the lookup failed. + * + * @param spaceId the space to look up. + */ suspend fun getSpaceRoom(spaceId: RoomId): SpaceRoom? + /** + * Creates a paginated list of the children of a space; the caller owns it and must call `destroy` on it. + * + * @param id the space whose children are listed. + */ fun spaceRoomList(id: RoomId): SpaceRoomList /** @@ -25,6 +47,11 @@ interface SpaceService { */ suspend fun editableSpaces(): Result> + /** + * Creates a handle to leave a space, which lets the user also pick which of its rooms to leave; the caller must close it. + * + * @param spaceId the space the user wants to leave. + */ fun getLeaveSpaceHandle(spaceId: RoomId): LeaveSpaceHandle /** From 68e5ea5a7427dde337cee1c46a4fb47f04f8f14c Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 13 Aug 2026 19:30:24 +0200 Subject: [PATCH 053/145] Add KDoc to matrix API media, mxc and scanner interfaces Add the interface level docs that MediaPreviewService, MatrixMediaLoader and MxcTools were missing, document MediaFile.path and the nested ContentScannerUrlProvider.Factory, and add the missing @param entries. Most members in these packages already had accurate documentation and are left untouched. Co-Authored-By: Claude Opus 5 (1M context) --- .../libraries/matrix/api/media/MatrixMediaLoader.kt | 3 +++ .../android/libraries/matrix/api/media/MediaFile.kt | 1 + .../libraries/matrix/api/media/MediaPreviewService.kt | 9 +++++++++ .../element/android/libraries/matrix/api/mxc/MxcTools.kt | 3 +++ .../matrix/api/scanner/ContentScannerUrlProvider.kt | 6 ++++++ 5 files changed, 22 insertions(+) diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/media/MatrixMediaLoader.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/media/MatrixMediaLoader.kt index a36849b812..28ae0762ff 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/media/MatrixMediaLoader.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/media/MatrixMediaLoader.kt @@ -8,6 +8,9 @@ package io.element.android.libraries.matrix.api.media +/** + * Fetches media content from the homeserver, decrypting it on the way when the room is encrypted. + */ interface MatrixMediaLoader { /** * @param source to fetch the content for. diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/media/MediaFile.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/media/MediaFile.kt index b5cefe897b..ae6035da88 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/media/MediaFile.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/media/MediaFile.kt @@ -16,6 +16,7 @@ import java.io.File * When closed the file will be removed from the disk unless [persist] has been used. */ interface MediaFile : Closeable { + /** The absolute path of the file on disk; see [toFile] to get a [File] instead. */ fun path(): String /** diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/media/MediaPreviewService.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/media/MediaPreviewService.kt index 39718ddfd2..660bb0b80e 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/media/MediaPreviewService.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/media/MediaPreviewService.kt @@ -10,6 +10,11 @@ package io.element.android.libraries.matrix.api.media import kotlinx.coroutines.flow.StateFlow +/** + * Reads and writes the account settings that decide whether media previews and invite avatars are shown. + * + * These are account data settings shared across clients, so the local value is only updated once the server has accepted the change. + */ interface MediaPreviewService { /** * Will fetch the media preview config from the server. @@ -24,11 +29,15 @@ interface MediaPreviewService { /** * Set the media preview display policy. This will update the value on the server and update the local value when successful. + * + * @param mediaPreviewValue whether media previews are shown always, never, or only in private rooms. */ suspend fun setMediaPreviewValue(mediaPreviewValue: MediaPreviewValue): Result /** * Set the invite avatars display policy. This will update the value on the server and update the local value when successful. + * + * @param hide true to hide the avatars of users and rooms the user has been invited by. */ suspend fun setHideInviteAvatars(hide: Boolean): Result } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/mxc/MxcTools.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/mxc/MxcTools.kt index 09ceaa4712..c28bfa9933 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/mxc/MxcTools.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/mxc/MxcTools.kt @@ -8,6 +8,9 @@ package io.element.android.libraries.matrix.api.mxc +/** + * Helpers to work with Matrix Content (`mxc://`) URIs. + */ interface MxcTools { /** * Sanitizes an mxcUri to be used as a relative file path. diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/scanner/ContentScannerUrlProvider.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/scanner/ContentScannerUrlProvider.kt index 76878080ae..2c11c750e4 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/scanner/ContentScannerUrlProvider.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/scanner/ContentScannerUrlProvider.kt @@ -19,7 +19,13 @@ fun interface ContentScannerUrlProvider { */ suspend fun getContentScannerUrl(sessionId: SessionId): Result + /** + * Creates a provider, which needs a fetcher because the scanner URL is itself discovered over HTTP. + */ fun interface Factory { + /** + * @param urlContentFetcher used to read the configuration advertised by the homeserver; a client that is not authenticated yet also works. + */ fun create(urlContentFetcher: UrlContentFetcher): ContentScannerUrlProvider } } From ddbc6a2a338e369d2590f7a380f1985d3f15e408 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 13 Aug 2026 18:59:32 +0000 Subject: [PATCH 054/145] Update metro to v1.4.1 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1ab1574c9c..865906e84b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -54,7 +54,7 @@ haze = "1.7.2" dependencyAnalysis = "3.18.0" # DI -metro = "1.4.0" +metro = "1.4.1" # Auto service autoservice = "1.1.1" From 58f09422e3302e167274698499d0b72df46c0b1b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 14 Aug 2026 06:17:33 +0000 Subject: [PATCH 055/145] Update roborazzi to v1.71.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 865906e84b..f7bad7e053 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -32,7 +32,7 @@ accompanist = "0.37.3" # Test test_core = "1.7.0" -roborazzi = "1.70.0" +roborazzi = "1.71.0" # Jetbrain datetime = "0.8.0" From 22195a47f2e8bbca50b117bc12bf698fa49ef5a8 Mon Sep 17 00:00:00 2001 From: Jorge Martin Espinosa Date: Fri, 14 Aug 2026 08:20:37 +0200 Subject: [PATCH 056/145] Move the custom tile server URL config to the Element wellknown content (#7416) * Move the custom tile server URL config to the Element wellknown content * Iteration: use whole `MapTilerConfig` in the remote config --- appnav/build.gradle.kts | 1 + .../android/appnav/LoggedInFlowNode.kt | 33 ++++++++---- features/location/api/build.gradle.kts | 1 + .../location/api/LocalMapTilerConfig.kt | 23 ++++++++ .../features/location/api/StaticMapView.kt | 9 +++- .../internal/MapTilerStaticMapUrlBuilder.kt | 8 +++ .../MapTilerTileServerStyleUriBuilder.kt | 14 +++-- .../api/internal/StaticMapUrlBuilder.kt | 15 +++++- .../api/internal/TileServerStyleUriBuilder.kt | 9 ++-- .../MapTilerTileServerStyleUriBuilderTest.kt | 52 +++++++++---------- features/location/impl/build.gradle.kts | 4 ++ .../impl/common/ui/MapBottomSheetScaffold.kt | 9 ++-- .../impl/share/ShareLocationPresenter.kt | 8 +-- .../location/impl/share/ShareLocationState.kt | 3 +- .../impl/share/ShareLocationStateProvider.kt | 9 ++-- .../location/impl/share/ShareLocationView.kt | 2 +- .../impl/show/ShowLocationPresenter.kt | 12 +++-- .../location/impl/show/ShowLocationState.kt | 3 +- .../impl/show/ShowLocationStateProvider.kt | 7 +-- .../location/impl/show/ShowLocationView.kt | 2 +- .../DefaultShareLocationEntryPointTest.kt | 2 + .../impl/share/ShareLocationPresenterTest.kt | 29 ++++++----- .../show/DefaultShowLocationEntryPointTest.kt | 10 ++-- .../impl/show/ShowLocationPresenterTest.kt | 47 +++++++++++++---- features/messages/impl/build.gradle.kts | 1 + .../event/TimelineItemLocationView.kt | 2 + .../libraries/matrix/api/MatrixClient.kt | 5 -- .../libraries/matrix/impl/RustMatrixClient.kt | 6 --- .../libraries/matrix/test/FakeMatrixClient.kt | 5 -- .../wellknown/api/ElementWellKnown.kt | 15 ++++++ .../impl/InternalElementWellKnown.kt | 14 +++++ .../libraries/wellknown/impl/Mapper.kt | 9 ++++ .../impl/DefaultWellknownRetrieverTest.kt | 11 +++- .../features/wellknown/test/Fixtures.kt | 15 ++++++ tools/detekt/detekt.yml | 1 + 35 files changed, 279 insertions(+), 117 deletions(-) create mode 100644 features/location/api/src/main/kotlin/io/element/android/features/location/api/LocalMapTilerConfig.kt diff --git a/appnav/build.gradle.kts b/appnav/build.gradle.kts index 7b86b434b9..054e9525c7 100644 --- a/appnav/build.gradle.kts +++ b/appnav/build.gradle.kts @@ -44,6 +44,7 @@ dependencies { implementation(projects.libraries.sessionStorage.api) implementation(projects.libraries.uiCommon) implementation(projects.libraries.uiStrings) + implementation(projects.libraries.wellknown.api) implementation(projects.features.login.api) implementation(libs.coil) diff --git a/appnav/src/main/kotlin/io/element/android/appnav/LoggedInFlowNode.kt b/appnav/src/main/kotlin/io/element/android/appnav/LoggedInFlowNode.kt index 14230d7c5a..d7b768132b 100644 --- a/appnav/src/main/kotlin/io/element/android/appnav/LoggedInFlowNode.kt +++ b/appnav/src/main/kotlin/io/element/android/appnav/LoggedInFlowNode.kt @@ -11,8 +11,10 @@ package io.element.android.appnav import android.os.Parcelable import androidx.compose.foundation.layout.Box import androidx.compose.runtime.Composable +import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue +import androidx.compose.runtime.produceState import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.lifecycle.lifecycleScope @@ -49,11 +51,13 @@ import io.element.android.compound.colors.SemanticColorsLightDark import io.element.android.features.createroom.api.CreateRoomEntryPoint import io.element.android.features.enterprise.api.EnterpriseService import io.element.android.features.enterprise.api.SessionEnterpriseService +import io.element.android.features.enterprise.api.remoteconfig.RemoteEnterpriseConfigProvider import io.element.android.features.ftue.api.FtueEntryPoint import io.element.android.features.ftue.api.state.FtueService import io.element.android.features.ftue.api.state.FtueState import io.element.android.features.home.api.HomeEntryPoint import io.element.android.features.linknewdevice.api.LinkNewDeviceEntryPoint +import io.element.android.features.location.api.LocalMapTilerConfig import io.element.android.features.location.api.live.ActiveLiveLocationShareManager import io.element.android.features.networkmonitor.api.NetworkMonitor import io.element.android.features.networkmonitor.api.NetworkStatus @@ -153,6 +157,7 @@ class LoggedInFlowNode( private val analyticsRoomListStateWatcher: AnalyticsRoomListStateWatcher, private val createRoomEntryPoint: CreateRoomEntryPoint, private val activeLiveLocationShareManager: ActiveLiveLocationShareManager, + private val remoteEnterpriseConfigProvider: RemoteEnterpriseConfigProvider, ) : BaseFlowNode( backstack = BackStack( initialElement = NavTarget.Placeholder, @@ -677,6 +682,12 @@ class LoggedInFlowNode( val colors by remember { enterpriseService.semanticColorsFlow(sessionId = matrixClient.sessionId) }.collectAsState(SemanticColorsLightDark.default) + + val currentMapTilerConfig = LocalMapTilerConfig.current + val updatedMapTilerConfig by produceState(currentMapTilerConfig) { + value = remoteEnterpriseConfigProvider.get(matrixClient.sessionId).dataOrNull()?.mapTilerConfig ?: currentMapTilerConfig + } + ElementThemeApp( appPreferencesStore = appPreferencesStore, featureFlagService = featureFlagService, @@ -684,16 +695,18 @@ class LoggedInFlowNode( compoundDark = colors.dark, buildMeta = buildMeta, ) { - val isOnline by syncService.isOnline.collectAsState() - ConnectivityIndicatorContainer( - isOnline = isOnline, - modifier = modifier, - ) { contentModifier -> - Box(modifier = contentModifier) { - val ftueState by ftueService.state.collectAsState() - BackstackView(transitionHandler = rememberLoggedInFlowTransitionHandler(backstack)) - if (ftueState is FtueState.Complete) { - PermanentChild(permanentNavModel = permanentNavModel, navTarget = NavTarget.LoggedInPermanent) + CompositionLocalProvider(LocalMapTilerConfig provides updatedMapTilerConfig) { + val isOnline by syncService.isOnline.collectAsState() + ConnectivityIndicatorContainer( + isOnline = isOnline, + modifier = modifier, + ) { contentModifier -> + Box(modifier = contentModifier) { + val ftueState by ftueService.state.collectAsState() + BackstackView(transitionHandler = rememberLoggedInFlowTransitionHandler(backstack)) + if (ftueState is FtueState.Complete) { + PermanentChild(permanentNavModel = permanentNavModel, navTarget = NavTarget.LoggedInPermanent) + } } } } diff --git a/features/location/api/build.gradle.kts b/features/location/api/build.gradle.kts index f8377389f1..b3eeacf87f 100644 --- a/features/location/api/build.gradle.kts +++ b/features/location/api/build.gradle.kts @@ -70,6 +70,7 @@ dependencies { implementation(projects.libraries.matrix.api) implementation(projects.libraries.matrixui) implementation(projects.libraries.uiStrings) + implementation(projects.libraries.wellknown.api) implementation(libs.coil.compose) implementation(libs.datetime) diff --git a/features/location/api/src/main/kotlin/io/element/android/features/location/api/LocalMapTilerConfig.kt b/features/location/api/src/main/kotlin/io/element/android/features/location/api/LocalMapTilerConfig.kt new file mode 100644 index 0000000000..a2212119f5 --- /dev/null +++ b/features/location/api/src/main/kotlin/io/element/android/features/location/api/LocalMapTilerConfig.kt @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2026 Element Creations Ltd. + * + * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. + * Please see LICENSE files in the repository root for full details. + */ + +package io.element.android.features.location.api + +import androidx.compose.runtime.staticCompositionLocalOf +import io.element.android.libraries.wellknown.api.MapTilerConfig + +/** + * Provides a [MapTilerConfig] for the MapLibre maps. + */ +val LocalMapTilerConfig = staticCompositionLocalOf { + MapTilerConfig( + apiKey = BuildConfig.MAPTILER_API_KEY, + lightStyleId = BuildConfig.MAPTILER_LIGHT_MAP_ID, + darkStyleId = BuildConfig.MAPTILER_DARK_MAP_ID, + baseUrl = BuildConfig.MAPTILER_BASE_URL + ) +} diff --git a/features/location/api/src/main/kotlin/io/element/android/features/location/api/StaticMapView.kt b/features/location/api/src/main/kotlin/io/element/android/features/location/api/StaticMapView.kt index c16b1ae560..33e454722f 100644 --- a/features/location/api/src/main/kotlin/io/element/android/features/location/api/StaticMapView.kt +++ b/features/location/api/src/main/kotlin/io/element/android/features/location/api/StaticMapView.kt @@ -38,13 +38,14 @@ import coil3.request.ImageRequest import coil3.request.SuccessResult import io.element.android.compound.theme.ElementTheme import io.element.android.features.location.api.internal.StaticMapPlaceholder -import io.element.android.features.location.api.internal.StaticMapUrlBuilder import io.element.android.features.location.api.internal.centerBottomEdge +import io.element.android.features.location.api.internal.rememberStaticMapBuilder import io.element.android.libraries.designsystem.components.LocationPin import io.element.android.libraries.designsystem.components.PinVariant import io.element.android.libraries.designsystem.preview.ElementPreview import io.element.android.libraries.designsystem.preview.PreviewsDayNight import io.element.android.libraries.designsystem.utils.CommonDrawables +import io.element.android.libraries.wellknown.api.MapTilerConfig /** * Shows a static map image downloaded via a third party service's static maps API. @@ -57,6 +58,7 @@ import io.element.android.libraries.designsystem.utils.CommonDrawables */ @Composable fun StaticMapView( + mapTilerConfig: MapTilerConfig?, location: Location?, zoom: Double, pinVariant: PinVariant, @@ -94,6 +96,7 @@ fun StaticMapView( } // Cases 3 & 4: Non-null location - fetch map else -> LoadableMapContent( + mapTilerConfig = mapTilerConfig, location = location, zoom = zoom, pinVariant = pinVariant, @@ -124,6 +127,7 @@ private fun BoxWithConstraintsScope.StaleMapContent( @Composable private fun BoxWithConstraintsScope.LoadableMapContent( + mapTilerConfig: MapTilerConfig?, location: Location, zoom: Double, pinVariant: PinVariant, @@ -132,7 +136,7 @@ private fun BoxWithConstraintsScope.LoadableMapContent( ) { val context = LocalContext.current var retryHash by remember { mutableIntStateOf(0) } - val builder = remember { StaticMapUrlBuilder() } + val builder = rememberStaticMapBuilder(mapTilerConfig) val (painter, state, contentScale) = if (LocalInspectionMode.current) { val painter = painterResource(CommonDrawables.sample_map) @@ -203,6 +207,7 @@ private fun BoxWithConstraintsScope.LoadableMapContent( @Composable internal fun StaticMapViewPreview() = ElementPreview { StaticMapView( + mapTilerConfig = null, location = Location(0.0, 0.0), zoom = 0.0, contentDescription = null, diff --git a/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/MapTilerStaticMapUrlBuilder.kt b/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/MapTilerStaticMapUrlBuilder.kt index 666ca07a08..78eae2f633 100644 --- a/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/MapTilerStaticMapUrlBuilder.kt +++ b/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/MapTilerStaticMapUrlBuilder.kt @@ -9,6 +9,7 @@ package io.element.android.features.location.api.internal import io.element.android.features.location.api.BuildConfig +import io.element.android.libraries.wellknown.api.MapTilerConfig import kotlin.math.roundToInt /** @@ -29,6 +30,13 @@ internal class MapTilerStaticMapUrlBuilder( darkMapId = BuildConfig.MAPTILER_DARK_MAP_ID, ) + constructor(mapTilerConfig: MapTilerConfig) : this( + baseUrl = (mapTilerConfig.baseUrl ?: BuildConfig.MAPTILER_BASE_URL).removeSuffix("/"), + apiKey = mapTilerConfig.apiKey.takeIf { it.isNotBlank() } ?: BuildConfig.MAPTILER_API_KEY, + lightMapId = mapTilerConfig.lightStyleId ?: BuildConfig.MAPTILER_LIGHT_MAP_ID, + darkMapId = mapTilerConfig.darkStyleId ?: BuildConfig.MAPTILER_DARK_MAP_ID, + ) + override fun build( lat: Double, lon: Double, diff --git a/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/MapTilerTileServerStyleUriBuilder.kt b/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/MapTilerTileServerStyleUriBuilder.kt index 0ff18a3767..10aef90116 100644 --- a/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/MapTilerTileServerStyleUriBuilder.kt +++ b/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/MapTilerTileServerStyleUriBuilder.kt @@ -11,6 +11,7 @@ package io.element.android.features.location.api.internal import io.element.android.features.location.api.BuildConfig +import io.element.android.libraries.wellknown.api.MapTilerConfig internal class MapTilerTileServerStyleUriBuilder( private val baseUrl: String, @@ -26,14 +27,17 @@ internal class MapTilerTileServerStyleUriBuilder( ) override fun build( - customMapStyleUrl: String?, + customMapTilerConfig: MapTilerConfig?, darkMode: Boolean, ): String { - return if (customMapStyleUrl.isNullOrBlank()) { - val mapId = if (darkMode) darkMapId else lightMapId - "$baseUrl/$mapId/style.json?key=$apiKey" + val baseUrl = customMapTilerConfig?.baseUrl.takeIf { !it.isNullOrBlank() } ?: baseUrl + val apiKey = customMapTilerConfig?.apiKey ?: apiKey + val mapId = if (darkMode) { + customMapTilerConfig?.darkStyleId ?: darkMapId } else { - customMapStyleUrl + customMapTilerConfig?.lightStyleId ?: lightMapId } + + return "$baseUrl/$mapId/style.json?key=$apiKey" } } diff --git a/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/StaticMapUrlBuilder.kt b/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/StaticMapUrlBuilder.kt index 6636976828..9bff0ee754 100644 --- a/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/StaticMapUrlBuilder.kt +++ b/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/StaticMapUrlBuilder.kt @@ -8,6 +8,10 @@ package io.element.android.features.location.api.internal +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import io.element.android.libraries.wellknown.api.MapTilerConfig + /** * Builds an URL for a 3rd party service provider static maps API. */ @@ -25,4 +29,13 @@ interface StaticMapUrlBuilder { fun isServiceAvailable(): Boolean } -fun StaticMapUrlBuilder(): StaticMapUrlBuilder = MapTilerStaticMapUrlBuilder() +@Composable +fun rememberStaticMapBuilder(mapTilerConfig: MapTilerConfig?): StaticMapUrlBuilder { + return remember(mapTilerConfig) { + if (mapTilerConfig != null) { + MapTilerStaticMapUrlBuilder(mapTilerConfig) + } else { + MapTilerStaticMapUrlBuilder() + } + } +} diff --git a/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/TileServerStyleUriBuilder.kt b/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/TileServerStyleUriBuilder.kt index 762d580f8e..f0c946f3d0 100644 --- a/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/TileServerStyleUriBuilder.kt +++ b/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/TileServerStyleUriBuilder.kt @@ -11,6 +11,7 @@ package io.element.android.features.location.api.internal import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import io.element.android.compound.theme.ElementTheme +import io.element.android.libraries.wellknown.api.MapTilerConfig /** * Builds a style URI for a MapLibre compatible tile server. @@ -19,7 +20,7 @@ import io.element.android.compound.theme.ElementTheme */ interface TileServerStyleUriBuilder { fun build( - customMapStyleUrl: String?, + customMapTilerConfig: MapTilerConfig?, darkMode: Boolean, ): String } @@ -31,12 +32,12 @@ interface TileServerStyleUriBuilder { */ @Composable fun rememberTileStyleUrl( - customMapStyleUrl: String?, + customMapTileConfig: MapTilerConfig?, ): String { val darkMode = !ElementTheme.isLightTheme - return remember(darkMode, customMapStyleUrl) { + return remember(darkMode, customMapTileConfig) { MapTilerTileServerStyleUriBuilder().build( - customMapStyleUrl = customMapStyleUrl, + customMapTilerConfig = customMapTileConfig, darkMode = darkMode, ) } diff --git a/features/location/api/src/test/kotlin/io/element/android/features/location/api/internal/MapTilerTileServerStyleUriBuilderTest.kt b/features/location/api/src/test/kotlin/io/element/android/features/location/api/internal/MapTilerTileServerStyleUriBuilderTest.kt index addc71c3b9..09aae4f310 100644 --- a/features/location/api/src/test/kotlin/io/element/android/features/location/api/internal/MapTilerTileServerStyleUriBuilderTest.kt +++ b/features/location/api/src/test/kotlin/io/element/android/features/location/api/internal/MapTilerTileServerStyleUriBuilderTest.kt @@ -9,6 +9,7 @@ package io.element.android.features.location.api.internal import com.google.common.truth.Truth.assertThat +import io.element.android.libraries.wellknown.api.MapTilerConfig import org.junit.Test class MapTilerTileServerStyleUriBuilderTest { @@ -23,7 +24,7 @@ class MapTilerTileServerStyleUriBuilderTest { fun `light map uri`() { assertThat( builder.build( - customMapStyleUrl = null, + customMapTilerConfig = null, darkMode = false, ) ).isEqualTo("https://base.url/aLightMapId/style.json?key=anApiKey") @@ -33,7 +34,7 @@ class MapTilerTileServerStyleUriBuilderTest { fun `dark map uri`() { assertThat( builder.build( - customMapStyleUrl = null, + customMapTilerConfig = null, darkMode = true, ) ).isEqualTo("https://base.url/aDarkMapId/style.json?key=anApiKey") @@ -43,49 +44,44 @@ class MapTilerTileServerStyleUriBuilderTest { fun `custom map uri light`() { assertThat( builder.build( - customMapStyleUrl = "https://custom.url/style.json", + customMapTilerConfig = MapTilerConfig( + apiKey = "API_KEY", + lightStyleId = "light", + darkStyleId = "dark", + baseUrl = "https://custom.url/style.json" + ), darkMode = false, ) - ).isEqualTo("https://custom.url/style.json") + ).isEqualTo("https://custom.url/style.json/light/style.json?key=API_KEY") } @Test fun `custom map uri dark`() { assertThat( builder.build( - customMapStyleUrl = "https://custom.url/style.json", + customMapTilerConfig = MapTilerConfig( + apiKey = "API_KEY", + lightStyleId = "light", + darkStyleId = "dark", + baseUrl = "https://custom.url/style.json" + ), darkMode = true, ) - ).isEqualTo("https://custom.url/style.json") - } - - @Test - fun `custom map uri with its own api key is not altered`() { - assertThat( - builder.build( - customMapStyleUrl = "https://api.maptiler.com/maps/streets-v2/style.json?key=anOperatorKey", - darkMode = false, - ) - ).isEqualTo("https://api.maptiler.com/maps/streets-v2/style.json?key=anOperatorKey") - } - - @Test - fun `custom map uri with an existing query is not altered`() { - assertThat( - builder.build( - customMapStyleUrl = "https://self.hosted/style.json?foo=bar", - darkMode = true, - ) - ).isEqualTo("https://self.hosted/style.json?foo=bar") + ).isEqualTo("https://custom.url/style.json/dark/style.json?key=API_KEY") } @Test fun `blank custom map uri falls back to the built-in style`() { assertThat( builder.build( - customMapStyleUrl = " ", + customMapTilerConfig = MapTilerConfig( + apiKey = "API_KEY", + lightStyleId = "light", + darkStyleId = "dark", + baseUrl = " " + ), darkMode = false, ) - ).isEqualTo("https://base.url/aLightMapId/style.json?key=anApiKey") + ).isEqualTo("https://base.url/light/style.json?key=API_KEY") } } diff --git a/features/location/impl/build.gradle.kts b/features/location/impl/build.gradle.kts index 165c32b7c5..43e4f58cab 100644 --- a/features/location/impl/build.gradle.kts +++ b/features/location/impl/build.gradle.kts @@ -26,6 +26,7 @@ setupDependencyInjection() dependencies { api(projects.features.location.api) + implementation(projects.features.enterprise.api) implementation(projects.features.messages.api) implementation(libs.maplibre.compose) implementation(libs.coil) @@ -45,6 +46,7 @@ dependencies { implementation(projects.libraries.preferences.api) implementation(projects.libraries.push.api) implementation(projects.libraries.sessionStorage.api) + implementation(projects.libraries.wellknown.api) implementation(libs.androidx.datastore.preferences) implementation(libs.datetime) @@ -58,5 +60,7 @@ dependencies { testImplementation(projects.libraries.featureflag.test) testImplementation(projects.libraries.preferences.test) testImplementation(projects.libraries.sessionStorage.test) + testImplementation(projects.libraries.wellknown.test) testImplementation(projects.features.location.test) + testImplementation(projects.features.enterprise.test) } diff --git a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/common/ui/MapBottomSheetScaffold.kt b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/common/ui/MapBottomSheetScaffold.kt index 0eff1b6028..eaa238bed0 100644 --- a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/common/ui/MapBottomSheetScaffold.kt +++ b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/common/ui/MapBottomSheetScaffold.kt @@ -50,6 +50,7 @@ import io.element.android.libraries.core.data.tryOrNull import io.element.android.libraries.designsystem.text.toDp import io.element.android.libraries.designsystem.theme.components.BottomSheetScaffold import io.element.android.libraries.designsystem.theme.components.CircularProgressIndicator +import io.element.android.libraries.wellknown.api.MapTilerConfig import org.maplibre.compose.camera.CameraState import org.maplibre.compose.camera.rememberCameraState import org.maplibre.compose.map.MapOptions @@ -66,7 +67,7 @@ import kotlin.math.roundToInt * - Updating camera position padding based on sheet height * - Rendering the MaplibreMap with proper ornament positioning * - * @param customMapStyleUrl Optional custom style URL for the map + * @param customMapTilerConfig Optional custom style URL for the map * @param modifier Modifier for the root layout * @param scaffoldState State for the bottom sheet scaffold * @param cameraState The camera state for the map @@ -83,7 +84,7 @@ import kotlin.math.roundToInt @OptIn(ExperimentalMaterial3Api::class) @Composable fun MapBottomSheetScaffold( - customMapStyleUrl: AsyncData, + customMapTilerConfig: AsyncData, modifier: Modifier = Modifier, scaffoldState: BottomSheetScaffoldState = rememberBottomSheetScaffoldState( bottomSheetState = rememberBottomSheetState( @@ -137,11 +138,11 @@ fun MapBottomSheetScaffold( val ornamentOptions = mapOptions.ornamentOptions.copy(padding = sheetPadding) val mapOptions = mapOptions.copy(ornamentOptions = ornamentOptions) Box { - when (customMapStyleUrl) { + when (customMapTilerConfig) { is AsyncData.Success -> { MaplibreMap( options = mapOptions, - baseStyle = BaseStyle.Uri(rememberTileStyleUrl(customMapStyleUrl.data)), + baseStyle = BaseStyle.Uri(rememberTileStyleUrl(customMapTilerConfig.data)), modifier = Modifier.fillMaxSize(), cameraState = cameraState, content = mapContent, diff --git a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationPresenter.kt b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationPresenter.kt index a3f3cac432..d388e0c5d2 100644 --- a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationPresenter.kt +++ b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationPresenter.kt @@ -22,6 +22,7 @@ import dev.zacsweers.metro.Assisted import dev.zacsweers.metro.AssistedFactory import dev.zacsweers.metro.AssistedInject import im.vector.app.features.analytics.plan.Composer +import io.element.android.features.enterprise.api.remoteconfig.RemoteEnterpriseConfigProvider import io.element.android.features.location.api.live.ActiveLiveLocationShareManager import io.element.android.features.location.impl.common.LocationConstraintsCheck import io.element.android.features.location.impl.common.MapDefaults @@ -72,6 +73,7 @@ class ShareLocationPresenter( private val liveLocationShareManager: ActiveLiveLocationShareManager, private val liveLocationStore: LiveLocationStore, private val userLocationStateFactory: UserLocationState.Factory, + private val remoteEnterpriseConfigProvider: RemoteEnterpriseConfigProvider, ) : Presenter { @AssistedFactory fun interface Factory { @@ -92,9 +94,9 @@ class ShareLocationPresenter( var pendingLiveLocationShare by remember { mutableStateOf(false) } val startLiveLocationAction = remember { mutableStateOf>(AsyncAction.Uninitialized) } val currentUser by client.userProfile.collectAsState() - val customMapStyleUrl by produceState(AsyncData.Loading()) { + val customMapConfig by produceState(AsyncData.Loading()) { // Ignore errors - value = AsyncData.Success(client.getMapStyleUrl().getOrNull()) + value = AsyncData.Success(remoteEnterpriseConfigProvider.get(client.sessionId).dataOrNull()?.mapTilerConfig) } val sendLiveLocationPermissions by room.permissionsAsState(SendLiveLocationPermissions.DEFAULT) { perms -> perms.sendLiveLocationPermissions() @@ -199,7 +201,7 @@ class ShareLocationPresenter( } return ShareLocationState( - customMapStyleUrl = customMapStyleUrl, + customMapTilerConfig = customMapConfig, currentUser = currentUser, dialogState = dialogState, trackUserLocation = trackUserPosition, diff --git a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationState.kt b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationState.kt index fb1b803435..d2cce94ef8 100644 --- a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationState.kt +++ b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationState.kt @@ -13,10 +13,11 @@ import io.element.android.features.location.impl.common.userlocation.UserLocatio import io.element.android.libraries.architecture.AsyncAction import io.element.android.libraries.architecture.AsyncData import io.element.android.libraries.matrix.api.user.MatrixUser +import io.element.android.libraries.wellknown.api.MapTilerConfig import kotlinx.collections.immutable.ImmutableList data class ShareLocationState( - val customMapStyleUrl: AsyncData, + val customMapTilerConfig: AsyncData, val currentUser: MatrixUser, val dialogState: Dialog, val trackUserLocation: Boolean, diff --git a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationStateProvider.kt b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationStateProvider.kt index ed8d46afd3..6d7ff5e612 100644 --- a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationStateProvider.kt +++ b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationStateProvider.kt @@ -15,6 +15,7 @@ import io.element.android.libraries.architecture.AsyncAction import io.element.android.libraries.architecture.AsyncData import io.element.android.libraries.matrix.api.core.UserId import io.element.android.libraries.matrix.api.user.MatrixUser +import io.element.android.libraries.wellknown.api.MapTilerConfig import kotlinx.collections.immutable.persistentListOf import kotlin.time.Duration.Companion.hours import kotlin.time.Duration.Companion.minutes @@ -70,13 +71,13 @@ class ShareLocationStateProvider : PreviewParameterProvider canShareLiveLocation = true, ), aShareLocationState( - customMapStyleUrl = AsyncData.Loading(), + customMapTilerConfig = AsyncData.Loading(), ), ) } fun aShareLocationState( - customMapStyleUrl: AsyncData = AsyncData.Success(null), + customMapTilerConfig: AsyncData = AsyncData.Success(null), currentUser: MatrixUser = MatrixUser(UserId("@user:matrix.org")), dialogState: ShareLocationState.Dialog = ShareLocationState.Dialog.None, trackUserPosition: Boolean = false, @@ -87,7 +88,7 @@ fun aShareLocationState( eventSink: (ShareLocationEvent) -> Unit = {}, ): ShareLocationState { return ShareLocationState( - customMapStyleUrl = customMapStyleUrl, + customMapTilerConfig = customMapTilerConfig, currentUser = currentUser, dialogState = dialogState, trackUserLocation = trackUserPosition, @@ -95,6 +96,6 @@ fun aShareLocationState( canShareLiveLocation = canShareLiveLocation, appName = appName, startLiveLocationAction = startLiveLocationAction, - eventSink = eventSink + eventSink = eventSink, ) } diff --git a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationView.kt b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationView.kt index 8b7106e939..53e7874936 100644 --- a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationView.kt +++ b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationView.kt @@ -118,7 +118,7 @@ fun ShareLocationView( } MapBottomSheetScaffold( - customMapStyleUrl = state.customMapStyleUrl, + customMapTilerConfig = state.customMapTilerConfig, cameraState = cameraState, modifier = modifier, scaffoldState = scaffoldState, diff --git a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationPresenter.kt b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationPresenter.kt index f187e91c53..2d9a4900dd 100644 --- a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationPresenter.kt +++ b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationPresenter.kt @@ -22,6 +22,7 @@ import androidx.compose.runtime.setValue import dev.zacsweers.metro.Assisted import dev.zacsweers.metro.AssistedFactory import dev.zacsweers.metro.AssistedInject +import io.element.android.features.enterprise.api.remoteconfig.RemoteEnterpriseConfigProvider import io.element.android.features.location.api.Location import io.element.android.features.location.api.ShowLocationMode import io.element.android.features.location.api.live.ActiveLiveLocationShareManager @@ -46,7 +47,7 @@ import io.element.android.libraries.dateformatter.api.DateFormatter import io.element.android.libraries.dateformatter.api.DateFormatterMode import io.element.android.libraries.designsystem.components.avatar.AvatarData import io.element.android.libraries.designsystem.components.avatar.AvatarSize -import io.element.android.libraries.matrix.api.MatrixClient +import io.element.android.libraries.matrix.api.core.SessionId import io.element.android.libraries.matrix.api.room.JoinedRoom import io.element.android.libraries.matrix.api.room.getBestName import io.element.android.libraries.matrix.api.room.joinedRoomMembers @@ -64,10 +65,11 @@ import kotlinx.coroutines.launch private val buildMeta: BuildMeta, private val dateFormatter: DateFormatter, private val stringProvider: StringProvider, - private val client: MatrixClient, + private val sessionId: SessionId, private val joinedRoom: JoinedRoom, private val liveLocationShareManager: ActiveLiveLocationShareManager, private val userLocationStateFactory: UserLocationState.Factory, + private val remoteEnterpriseConfigProvider: RemoteEnterpriseConfigProvider, ) : Presenter { @AssistedFactory fun interface Factory { fun create(mode: ShowLocationMode): ShowLocationPresenter @@ -85,9 +87,9 @@ import kotlinx.coroutines.launch mutableStateOf(LocationConstraintsDialogState.None) } - val customMapStyleUrl by produceState(AsyncData.Loading()) { + val customMapTilerConfig by produceState(AsyncData.Loading()) { // Ignore errors - value = AsyncData.Success(client.getMapStyleUrl().getOrNull()) + value = AsyncData.Success(remoteEnterpriseConfigProvider.get(sessionId).dataOrNull()?.mapTilerConfig) } fun checkLocationConstraints() { @@ -220,7 +222,7 @@ import kotlinx.coroutines.launch userLocationStateFactory.create(hasLocationPermission = permissionsState.isAnyGranted) } return ShowLocationState( - customMapStyleUrl = customMapStyleUrl, + customMapTilerConfig = customMapTilerConfig, dialogState = dialogState, locationShares = locationShares, focusedLocation = focusedLocation, diff --git a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationState.kt b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationState.kt index e5ddf589b0..2ae76ef9e9 100644 --- a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationState.kt +++ b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationState.kt @@ -17,10 +17,11 @@ import io.element.android.libraries.designsystem.components.PinVariant import io.element.android.libraries.designsystem.components.avatar.AvatarData import io.element.android.libraries.matrix.api.core.UserId import io.element.android.libraries.matrix.api.room.location.AssetType +import io.element.android.libraries.wellknown.api.MapTilerConfig import kotlinx.collections.immutable.ImmutableList data class ShowLocationState( - val customMapStyleUrl: AsyncData, + val customMapTilerConfig: AsyncData, val isLive: Boolean, val dialogState: LocationConstraintsDialogState, val locationShares: ImmutableList, diff --git a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationStateProvider.kt b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationStateProvider.kt index cd7ea108bb..a1f349d644 100644 --- a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationStateProvider.kt +++ b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationStateProvider.kt @@ -18,6 +18,7 @@ import io.element.android.libraries.designsystem.components.avatar.AvatarSize import io.element.android.libraries.designsystem.preview.USER_NAME_ALICE import io.element.android.libraries.matrix.api.core.UserId import io.element.android.libraries.matrix.api.room.location.AssetType +import io.element.android.libraries.wellknown.api.MapTilerConfig import kotlinx.collections.immutable.toImmutableList class ShowLocationStateProvider : PreviewParameterProvider { @@ -36,14 +37,14 @@ class ShowLocationStateProvider : PreviewParameterProvider { constraintsDialogState = LocationConstraintsDialogState.LocationServiceDisabled, ), aShowLocationState(isTrackMyLocation = true), - aShowLocationState(customMapStyleUrl = AsyncData.Loading()), + aShowLocationState(customMapTilerConfig = AsyncData.Loading()), ) } private const val APP_NAME = "ApplicationName" fun aShowLocationState( - customMapStyleUrl: AsyncData = AsyncData.Success(null), + customMapTilerConfig: AsyncData = AsyncData.Success(null), isLive: Boolean = false, constraintsDialogState: LocationConstraintsDialogState = LocationConstraintsDialogState.None, locationShares: List = listOf(aLocationShareItem(isLive = isLive)), @@ -55,7 +56,7 @@ fun aShowLocationState( eventSink: (ShowLocationEvent) -> Unit = {}, ): ShowLocationState { return ShowLocationState( - customMapStyleUrl = customMapStyleUrl, + customMapTilerConfig = customMapTilerConfig, dialogState = constraintsDialogState, locationShares = locationShares.toImmutableList(), focusedLocation = focusedLocation, diff --git a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationView.kt b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationView.kt index 9fdbe3aac8..45e4c7f4cc 100644 --- a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationView.kt +++ b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationView.kt @@ -102,7 +102,7 @@ fun ShowLocationView( } } MapBottomSheetScaffold( - customMapStyleUrl = state.customMapStyleUrl, + customMapTilerConfig = state.customMapTilerConfig, sheetDragHandle = if (state.isSheetDraggable) { { BottomSheetDefaults.DragHandle() } } else { diff --git a/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/share/DefaultShareLocationEntryPointTest.kt b/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/share/DefaultShareLocationEntryPointTest.kt index 49df684666..9be168e5a2 100644 --- a/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/share/DefaultShareLocationEntryPointTest.kt +++ b/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/share/DefaultShareLocationEntryPointTest.kt @@ -11,6 +11,7 @@ package io.element.android.features.location.impl.share import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.bumble.appyx.core.modality.BuildContext import com.google.common.truth.Truth.assertThat +import io.element.android.features.enterprise.test.remoteconfig.FakeRemoteEnterpriseConfigProvider import io.element.android.features.location.impl.common.FakeUserLocationStateFactory import io.element.android.features.location.impl.common.actions.FakeLocationActions import io.element.android.features.location.impl.common.permissions.FakePermissionsPresenter @@ -58,6 +59,7 @@ class DefaultShareLocationEntryPointTest { sessionId = room.sessionId, ), userLocationStateFactory = FakeUserLocationStateFactory(), + remoteEnterpriseConfigProvider = FakeRemoteEnterpriseConfigProvider(), ) }, analyticsService = FakeAnalyticsService(), diff --git a/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/share/ShareLocationPresenterTest.kt b/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/share/ShareLocationPresenterTest.kt index f4cc135e9e..6748c5a675 100644 --- a/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/share/ShareLocationPresenterTest.kt +++ b/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/share/ShareLocationPresenterTest.kt @@ -19,6 +19,8 @@ import app.cash.turbine.ReceiveTurbine import app.cash.turbine.test import com.google.common.truth.Truth.assertThat import im.vector.app.features.analytics.plan.Composer +import io.element.android.features.enterprise.api.remoteconfig.RemoteEnterpriseConfigProvider +import io.element.android.features.enterprise.test.remoteconfig.FakeRemoteEnterpriseConfigProvider import io.element.android.features.location.api.Location import io.element.android.features.location.impl.aPermissionsState import io.element.android.features.location.impl.common.FakeUserLocationStateFactory @@ -30,6 +32,8 @@ import io.element.android.features.location.impl.common.ui.LocationConstraintsDi import io.element.android.features.location.impl.live.LiveLocationStore import io.element.android.features.location.test.FakeActiveLiveLocationShareManager import io.element.android.features.messages.test.FakeMessageComposerContext +import io.element.android.features.wellknown.test.aMapTilerConfig +import io.element.android.features.wellknown.test.anElementWellKnown import io.element.android.libraries.dateformatter.test.FakeDurationFormatter import io.element.android.libraries.matrix.api.core.EventId import io.element.android.libraries.matrix.api.core.RoomId @@ -51,6 +55,7 @@ import io.element.android.libraries.matrix.test.room.powerlevels.FakeRoomPermiss import io.element.android.libraries.matrix.test.timeline.FakeTimeline import io.element.android.libraries.preferences.api.store.PreferenceDataStoreFactory import io.element.android.libraries.preferences.test.FakePreferenceDataStoreFactory +import io.element.android.libraries.wellknown.api.WellknownRetrieverResult import io.element.android.services.analytics.test.FakeAnalyticsService import io.element.android.tests.testutils.WarmUpRule import io.element.android.tests.testutils.lambda.assert @@ -60,7 +65,6 @@ import io.element.android.tests.testutils.test import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flowOf -import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.advanceUntilIdle import kotlinx.coroutines.test.runTest import org.junit.Rule @@ -77,20 +81,18 @@ class ShareLocationPresenterTest { private val fakeMessageComposerContext = FakeMessageComposerContext() private val fakeLocationActions = FakeLocationActions() private val fakeBuildMeta = aBuildMeta(applicationName = "app name") - private val fakeMatrixClient = FakeMatrixClient( - sessionId = A_USER_ID, - getMapStyleUrlResult = { Result.success(null) }, - ) + private val fakeMatrixClient = FakeMatrixClient(sessionId = A_USER_ID) private val durationFormatter = FakeDurationFormatter() - private fun TestScope.createShareLocationPresenter( + private fun createShareLocationPresenter( joinedRoom: JoinedRoom = FakeJoinedRoom(), timelineMode: Timeline.Mode = Timeline.Mode.Live, locationActions: FakeLocationActions = fakeLocationActions, liveLocationShareManager: FakeActiveLiveLocationShareManager = FakeActiveLiveLocationShareManager(), liveLocationStore: LiveLocationStore = createLiveLocationStore(sessionId = joinedRoom.sessionId), client: FakeMatrixClient = fakeMatrixClient, + remoteEnterpriseConfigProvider: RemoteEnterpriseConfigProvider = FakeRemoteEnterpriseConfigProvider(), ): ShareLocationPresenter = ShareLocationPresenter( permissionsPresenterFactory = { fakePermissionsPresenter }, room = joinedRoom, @@ -104,6 +106,7 @@ class ShareLocationPresenterTest { liveLocationShareManager = liveLocationShareManager, liveLocationStore = liveLocationStore, userLocationStateFactory = FakeUserLocationStateFactory(), + remoteEnterpriseConfigProvider = remoteEnterpriseConfigProvider, ) @Test @@ -118,7 +121,7 @@ class ShareLocationPresenterTest { val shareLocationPresenter = createShareLocationPresenter() shareLocationPresenter.test { val state = awaitFirstItem() - assertThat(state.customMapStyleUrl.isLoading()).isFalse() + assertThat(state.customMapTilerConfig.isLoading()).isFalse() assertThat(state.trackUserLocation).isTrue() assertThat(state.dialogState).isEqualTo(ShareLocationState.Dialog.Constraints(LocationConstraintsDialogState.None)) } @@ -126,18 +129,20 @@ class ShareLocationPresenterTest { @Test fun `present - non-null customMapStyleUrl`() = runTest { + val mapTilerConfig = aMapTilerConfig(apiKey = "A KEY") val shareLocationPresenter = createShareLocationPresenter( client = FakeMatrixClient( sessionId = A_USER_ID, - getMapStyleUrlResult = { Result.success("aUrl") }, + ), + remoteEnterpriseConfigProvider = FakeRemoteEnterpriseConfigProvider( + getResult = { WellknownRetrieverResult.Success(anElementWellKnown(mapTilerConfig = mapTilerConfig)) } ) ) shareLocationPresenter.test { - skipItems(1) val state = awaitItem() - assertThat(state.customMapStyleUrl.isLoading()).isTrue() + assertThat(state.customMapTilerConfig.isLoading()).isTrue() val finalState = awaitItem() - assertThat(finalState.customMapStyleUrl.dataOrNull()).isEqualTo("aUrl") + assertThat(finalState.customMapTilerConfig.dataOrNull()).isEqualTo(mapTilerConfig) } } @@ -709,7 +714,7 @@ class ShareLocationPresenterTest { } private suspend fun ReceiveTurbine.awaitFirstItem(): T { - skipItems(2) + skipItems(1) return awaitItem() } } diff --git a/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/DefaultShowLocationEntryPointTest.kt b/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/DefaultShowLocationEntryPointTest.kt index 23b7e9bf4d..69451eedb7 100644 --- a/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/DefaultShowLocationEntryPointTest.kt +++ b/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/DefaultShowLocationEntryPointTest.kt @@ -11,6 +11,7 @@ package io.element.android.features.location.impl.show import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.bumble.appyx.core.modality.BuildContext import com.google.common.truth.Truth.assertThat +import io.element.android.features.enterprise.test.remoteconfig.FakeRemoteEnterpriseConfigProvider import io.element.android.features.location.api.Location import io.element.android.features.location.api.ShowLocationEntryPoint import io.element.android.features.location.api.ShowLocationMode @@ -20,7 +21,7 @@ import io.element.android.features.location.impl.common.permissions.FakePermissi import io.element.android.features.location.test.FakeActiveLiveLocationShareManager import io.element.android.libraries.dateformatter.test.FakeDateFormatter import io.element.android.libraries.matrix.api.core.UserId -import io.element.android.libraries.matrix.test.FakeMatrixClient +import io.element.android.libraries.matrix.test.A_SESSION_ID import io.element.android.libraries.matrix.test.core.aBuildMeta import io.element.android.libraries.matrix.test.room.FakeJoinedRoom import io.element.android.services.analytics.test.FakeAnalyticsService @@ -41,8 +42,8 @@ class DefaultShowLocationEntryPointTest { ShowLocationNode( buildContext = buildContext, plugins = plugins, - presenterFactory = object : ShowLocationPresenter.Factory { - override fun create(mode: ShowLocationMode) = ShowLocationPresenter( + presenterFactory = { mode -> + ShowLocationPresenter( mode = mode, permissionsPresenterFactory = { FakePermissionsPresenter() }, locationActions = FakeLocationActions(), @@ -50,9 +51,10 @@ class DefaultShowLocationEntryPointTest { dateFormatter = FakeDateFormatter(), stringProvider = FakeStringProvider(), joinedRoom = joinedRoom, - client = FakeMatrixClient(), + sessionId = A_SESSION_ID, liveLocationShareManager = FakeActiveLiveLocationShareManager(), userLocationStateFactory = FakeUserLocationStateFactory(), + remoteEnterpriseConfigProvider = FakeRemoteEnterpriseConfigProvider(), ) }, analyticsService = FakeAnalyticsService(), diff --git a/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/ShowLocationPresenterTest.kt b/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/ShowLocationPresenterTest.kt index b579a79e4f..77b26eb66c 100644 --- a/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/ShowLocationPresenterTest.kt +++ b/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/ShowLocationPresenterTest.kt @@ -12,6 +12,7 @@ import app.cash.molecule.RecompositionMode import app.cash.molecule.moleculeFlow import app.cash.turbine.test import com.google.common.truth.Truth.assertThat +import io.element.android.features.enterprise.test.remoteconfig.FakeRemoteEnterpriseConfigProvider import io.element.android.features.location.api.Location import io.element.android.features.location.api.ShowLocationMode import io.element.android.features.location.impl.aPermissionsState @@ -22,17 +23,20 @@ import io.element.android.features.location.impl.common.permissions.PermissionsE import io.element.android.features.location.impl.common.permissions.PermissionsState import io.element.android.features.location.impl.common.ui.LocationConstraintsDialogState import io.element.android.features.location.test.FakeActiveLiveLocationShareManager +import io.element.android.features.wellknown.test.aMapTilerConfig +import io.element.android.features.wellknown.test.anElementWellKnown import io.element.android.libraries.dateformatter.test.FakeDateFormatter -import io.element.android.libraries.matrix.api.MatrixClient +import io.element.android.libraries.matrix.api.core.SessionId import io.element.android.libraries.matrix.api.core.UserId import io.element.android.libraries.matrix.api.room.JoinedRoom import io.element.android.libraries.matrix.api.room.location.AssetType import io.element.android.libraries.matrix.api.room.location.LiveLocationShare +import io.element.android.libraries.matrix.test.A_SESSION_ID import io.element.android.libraries.matrix.test.A_USER_ID -import io.element.android.libraries.matrix.test.FakeMatrixClient import io.element.android.libraries.matrix.test.core.aBuildMeta import io.element.android.libraries.matrix.test.room.FakeJoinedRoom import io.element.android.libraries.matrix.test.room.location.aLiveLocationShare +import io.element.android.libraries.wellknown.api.WellknownRetrieverResult import io.element.android.services.toolbox.test.strings.FakeStringProvider import io.element.android.tests.testutils.WarmUpRule import io.element.android.tests.testutils.test @@ -65,8 +69,9 @@ class ShowLocationPresenterTest { ), locationActions: FakeLocationActions = fakeLocationActions, joinedRoom: JoinedRoom = FakeJoinedRoom(), - client: MatrixClient = FakeMatrixClient(), + sessionId: SessionId = A_SESSION_ID, liveLocationShareManager: FakeActiveLiveLocationShareManager = FakeActiveLiveLocationShareManager(), + remoteEnterpriseConfigProvider: FakeRemoteEnterpriseConfigProvider = FakeRemoteEnterpriseConfigProvider(), ) = ShowLocationPresenter( mode = mode, permissionsPresenterFactory = { fakePermissionsPresenter }, @@ -75,24 +80,26 @@ class ShowLocationPresenterTest { dateFormatter = fakeDateFormatter, stringProvider = FakeStringProvider(), joinedRoom = joinedRoom, - client = client, + sessionId = sessionId, liveLocationShareManager = liveLocationShareManager, userLocationStateFactory = FakeUserLocationStateFactory(), + remoteEnterpriseConfigProvider = remoteEnterpriseConfigProvider, ) @Test fun `present - non-null customMapStyleUrl`() = runTest { + val mapTilerConfig = aMapTilerConfig(apiKey = "A KEY") val shareLocationPresenter = createShowLocationPresenter( - client = FakeMatrixClient( - sessionId = A_USER_ID, - getMapStyleUrlResult = { Result.success("aUrl") }, + sessionId = A_SESSION_ID, + remoteEnterpriseConfigProvider = FakeRemoteEnterpriseConfigProvider( + getResult = { WellknownRetrieverResult.Success(anElementWellKnown(mapTilerConfig = mapTilerConfig)) } ) ) shareLocationPresenter.test { val state = awaitItem() - assertThat(state.customMapStyleUrl.isLoading()).isTrue() + assertThat(state.customMapTilerConfig.isLoading()).isTrue() val finalState = awaitItem() - assertThat(finalState.customMapStyleUrl.dataOrNull()).isEqualTo("aUrl") + assertThat(finalState.customMapTilerConfig.dataOrNull()).isEqualTo(mapTilerConfig) } } @@ -115,6 +122,8 @@ class ShowLocationPresenterTest { initialState.eventSink(ShowLocationEvent.Share(location)) assertThat(fakeLocationActions.sharedLocation).isEqualTo(location) + + cancelAndIgnoreRemainingEvents() } } @@ -123,10 +132,12 @@ class ShowLocationPresenterTest { fakePermissionsPresenter.givenState(aPermissionsState(permissions = PermissionsState.Permissions.AllGranted)) val presenter = createShowLocationPresenter( - client = FakeMatrixClient( - getMapStyleUrlResult = { Result.success(null) } + sessionId = A_SESSION_ID, + remoteEnterpriseConfigProvider = FakeRemoteEnterpriseConfigProvider( + getResult = { WellknownRetrieverResult.Success(anElementWellKnown(mapTilerConfig = aMapTilerConfig())) } ) ) + presenter.test { val initialState = awaitItem() assertThat(initialState.isTrackMyLocation).isFalse() @@ -281,6 +292,8 @@ class ShowLocationPresenterTest { }.test { val initialState = awaitItem() assertThat(initialState.appName).isEqualTo("app name") + + cancelAndIgnoreRemainingEvents() } } @@ -334,6 +347,8 @@ class ShowLocationPresenterTest { val initialState = awaitItem() assertThat(initialState.locationShares).isEmpty() assertThat(initialState.isSheetDraggable).isFalse() + + cancelAndIgnoreRemainingEvents() } } @@ -408,6 +423,9 @@ class ShowLocationPresenterTest { val initialState = awaitItem() assertThat(initialState.locationShares).isEmpty() + // Wait until we receive the custom map style URL result + skipItems(1) + // Emit a new live share liveSharesFlow.value = listOf( aLiveLocationShare(userId = userId) @@ -447,6 +465,8 @@ class ShowLocationPresenterTest { assertThat(item.avatarData.id).isEqualTo(senderId.value) assertThat(item.avatarData.name).isEqualTo(senderName) assertThat(item.avatarData.url).isEqualTo(avatarUrl) + + cancelAndIgnoreRemainingEvents() } } @@ -456,6 +476,7 @@ class ShowLocationPresenterTest { presenter.test { val state = awaitItem() assertThat(state.isSheetDraggable).isFalse() + cancelAndIgnoreRemainingEvents() } } @@ -465,6 +486,8 @@ class ShowLocationPresenterTest { presenter.test { val state = awaitItem() assertThat(state.hideUserLocationPuck).isFalse() + + cancelAndIgnoreRemainingEvents() } } @@ -476,6 +499,8 @@ class ShowLocationPresenterTest { presenter.test { val state = awaitItem() assertThat(state.hideUserLocationPuck).isFalse() + + cancelAndIgnoreRemainingEvents() } } diff --git a/features/messages/impl/build.gradle.kts b/features/messages/impl/build.gradle.kts index b40aebab39..0b51a2b80d 100644 --- a/features/messages/impl/build.gradle.kts +++ b/features/messages/impl/build.gradle.kts @@ -61,6 +61,7 @@ dependencies { implementation(projects.libraries.push.api) implementation(projects.libraries.uiUtils) implementation(projects.libraries.testtags) + implementation(projects.libraries.wellknown.api) implementation(projects.features.networkmonitor.api) implementation(projects.features.contentscanner.api) implementation(projects.services.analytics.compose) diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemLocationView.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemLocationView.kt index 4ab4ee84a6..a7f7b33989 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemLocationView.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemLocationView.kt @@ -28,6 +28,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import io.element.android.compound.theme.ElementTheme import io.element.android.compound.tokens.generated.CompoundIcons +import io.element.android.features.location.api.LocalMapTilerConfig import io.element.android.features.location.api.StaticMapView import io.element.android.features.messages.impl.timeline.model.event.TimelineItemLocationContent import io.element.android.features.messages.impl.timeline.model.event.TimelineItemLocationContentProvider @@ -50,6 +51,7 @@ fun TimelineItemLocationView( modifier = Modifier .fillMaxWidth() .heightIn(max = 188.dp), + mapTilerConfig = LocalMapTilerConfig.current, pinVariant = content.pinVariant, location = content.location, zoom = 15.0, diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt index e3aa2004bf..26d7d02016 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt @@ -255,11 +255,6 @@ interface MatrixClient : UrlContentFetcher { */ suspend fun performDatabaseVacuum(): Result - /** - * Returns the URL of the map style configured on the server, if any. - */ - suspend fun getMapStyleUrl(): Result - /** * Resets the cached client `well-known` config by the SDK. */ diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt index 7aacb8edc6..0ff563a204 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt @@ -886,12 +886,6 @@ class RustMatrixClient( } } - override suspend fun getMapStyleUrl(): Result = withContext(sessionDispatcher) { - runCatchingExceptions { - innerClient.tileServer()?.mapStyleUrl - } - } - override suspend fun resetWellKnownConfig(): Result { return runCatchingExceptions { Timber.d("Resetting well-known config for session $sessionId") diff --git a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeMatrixClient.kt b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeMatrixClient.kt index 60f70c12c5..56d25ed175 100644 --- a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeMatrixClient.kt +++ b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeMatrixClient.kt @@ -129,7 +129,6 @@ class FakeMatrixClient( private val markRoomAsFullyReadResult: (RoomId, EventId) -> Result = { _, _ -> lambdaError() }, private val markAllRoomsAsReadResult: () -> Result = { Result.success(Unit) }, private val performDatabaseVacuumLambda: () -> Result = { lambdaError() }, - private val getMapStyleUrlResult: () -> Result = { lambdaError() }, private val getDatabaseSizesLambda: () -> Result = { lambdaError() }, private val resetWellKnownConfigLambda: () -> Result = { lambdaError() }, private val enableAutomaticCallStatusLambda: (Boolean) -> Unit = { }, @@ -435,10 +434,6 @@ class FakeMatrixClient( return performDatabaseVacuumLambda() } - override suspend fun getMapStyleUrl(): Result = simulateLongTask { - getMapStyleUrlResult() - } - override suspend fun canLinkNewDevice(): Result = simulateLongTask { return canLinkNewDeviceResult() } diff --git a/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellKnown.kt b/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellKnown.kt index a9c42b7121..88a89e7a49 100644 --- a/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellKnown.kt +++ b/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellKnown.kt @@ -18,4 +18,19 @@ data class ElementWellKnown( val customRecoveryPassphrase: CustomRecoveryPassphrase?, val contentScannerUrl: String?, val forceDisableE2EE: Boolean?, + val mapTilerConfig: MapTilerConfig?, +) + +/** + * A `MapTiler` configuration received from the server. This configuration is used to display maps in the app. + */ +data class MapTilerConfig( + /** The API key to use with MapTiler. This is always not null, but can be empty/blank. */ + val apiKey: String, + /** The style ID to use for light mode. This is optional and can be null. */ + val lightStyleId: String?, + /** The style ID to use for light mode. This is optional and can be null. */ + val darkStyleId: String?, + /** The base URL to use for MapTiler. This is optional and can be null. */ + val baseUrl: String?, ) diff --git a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/InternalElementWellKnown.kt b/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/InternalElementWellKnown.kt index c585264f55..317109a1c0 100644 --- a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/InternalElementWellKnown.kt +++ b/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/InternalElementWellKnown.kt @@ -48,6 +48,8 @@ data class InternalElementWellKnown( val contentScannerUrl: String? = null, @SerialName("force_disable_e2ee") val forceDisableE2EE: Boolean? = null, + @SerialName("map_tiler") + val mapTilerConfig: InternalMapTilerConfig? = null, ) @Serializable @@ -55,3 +57,15 @@ data class InternalCustomRecoveryPassphrase( @SerialName("min_character_count") val minCharacterCount: Int? = null, ) + +@Serializable +data class InternalMapTilerConfig( + @SerialName("api_key") + val apiKey: String, + @SerialName("light_style_id") + val lightStyleId: String? = null, + @SerialName("dark_style_id") + val darkStyleId: String? = null, + @SerialName("base_url") + val baseUrl: String? = null, +) diff --git a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/Mapper.kt b/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/Mapper.kt index c4d15e7325..254036c5c3 100644 --- a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/Mapper.kt +++ b/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/Mapper.kt @@ -11,6 +11,7 @@ package io.element.android.libraries.wellknown.impl import io.element.android.libraries.core.log.logger.LoggerTag import io.element.android.libraries.wellknown.api.CustomRecoveryPassphrase import io.element.android.libraries.wellknown.api.ElementWellKnown +import io.element.android.libraries.wellknown.api.MapTilerConfig import timber.log.Timber private val loggerTag = LoggerTag("Wellknown") @@ -32,6 +33,14 @@ fun InternalElementWellKnown.map() = ElementWellKnown( customRecoveryPassphrase = customRecoveryPassphrase?.toPublic(), contentScannerUrl = contentScannerUrl, forceDisableE2EE = forceDisableE2EE, + mapTilerConfig = mapTilerConfig?.let { + MapTilerConfig( + apiKey = it.apiKey, + lightStyleId = it.lightStyleId, + darkStyleId = it.darkStyleId, + baseUrl = it.baseUrl, + ) + } ) private fun InternalCustomRecoveryPassphrase.toPublic(): CustomRecoveryPassphrase { diff --git a/libraries/wellknown/impl/src/test/kotlin/io/element/android/libraries/wellknown/impl/DefaultWellknownRetrieverTest.kt b/libraries/wellknown/impl/src/test/kotlin/io/element/android/libraries/wellknown/impl/DefaultWellknownRetrieverTest.kt index 224c847387..a58aa0a347 100644 --- a/libraries/wellknown/impl/src/test/kotlin/io/element/android/libraries/wellknown/impl/DefaultWellknownRetrieverTest.kt +++ b/libraries/wellknown/impl/src/test/kotlin/io/element/android/libraries/wellknown/impl/DefaultWellknownRetrieverTest.kt @@ -13,6 +13,7 @@ package io.element.android.libraries.wellknown.impl import com.google.common.truth.Truth.assertThat import io.element.android.features.enterprise.test.FakeEnterpriseService import io.element.android.features.wellknown.test.FakeElementWellknownStore +import io.element.android.features.wellknown.test.aMapTilerConfig import io.element.android.features.wellknown.test.anElementWellKnown import io.element.android.libraries.core.uri.ensureProtocol import io.element.android.libraries.matrix.api.UrlContentFetcher @@ -204,7 +205,11 @@ class DefaultWellknownRetrieverTest { "notification_sound": "a_notification_sound.flac", "idp_app_scheme": "an_app_scheme", "content_scanner_url": "https://content-scanner.example.com", - "force_disable_e2ee": false + "force_disable_e2ee": false, + "map_tiler": { + "api_key": "test_api_key", + "base_url": "https://tile-server.example.com" + } }""" private val expectedElementWellKnown = ElementWellKnown( @@ -217,6 +222,10 @@ class DefaultWellknownRetrieverTest { contentScannerUrl = "https://content-scanner.example.com", customRecoveryPassphrase = null, forceDisableE2EE = false, + mapTilerConfig = aMapTilerConfig( + apiKey = "test_api_key", + baseUrl = "https://tile-server.example.com", + ) ) } } diff --git a/libraries/wellknown/test/src/main/kotlin/io/element/android/features/wellknown/test/Fixtures.kt b/libraries/wellknown/test/src/main/kotlin/io/element/android/features/wellknown/test/Fixtures.kt index 941e5f4cc7..36d9f7bc82 100644 --- a/libraries/wellknown/test/src/main/kotlin/io/element/android/features/wellknown/test/Fixtures.kt +++ b/libraries/wellknown/test/src/main/kotlin/io/element/android/features/wellknown/test/Fixtures.kt @@ -10,6 +10,7 @@ package io.element.android.features.wellknown.test import io.element.android.libraries.wellknown.api.CustomRecoveryPassphrase import io.element.android.libraries.wellknown.api.ElementWellKnown +import io.element.android.libraries.wellknown.api.MapTilerConfig fun anElementWellKnown( registrationHelperUrl: String? = null, @@ -21,6 +22,7 @@ fun anElementWellKnown( customRecoveryPassphrase: CustomRecoveryPassphrase? = null, contentScannerUrl: String? = null, forceDisableE2EE: Boolean? = null, + mapTilerConfig: MapTilerConfig? = null, ) = ElementWellKnown( registrationHelperUrl = registrationHelperUrl, enforceElementPro = enforceElementPro, @@ -31,6 +33,7 @@ fun anElementWellKnown( customRecoveryPassphrase = customRecoveryPassphrase, contentScannerUrl = contentScannerUrl, forceDisableE2EE = forceDisableE2EE, + mapTilerConfig = mapTilerConfig, ) fun aCustomRecoveryPassphrase( @@ -38,3 +41,15 @@ fun aCustomRecoveryPassphrase( ) = CustomRecoveryPassphrase( minCharacterCount = minCharacterCount, ) + +fun aMapTilerConfig( + apiKey: String = "test_api_key", + baseUrl: String? = null, + lightStyleId: String? = null, + darkStyleId: String? = null, +) = MapTilerConfig( + apiKey = apiKey, + baseUrl = baseUrl, + lightStyleId = lightStyleId, + darkStyleId = darkStyleId, +) diff --git a/tools/detekt/detekt.yml b/tools/detekt/detekt.yml index 79bfeb7250..147eca01d0 100644 --- a/tools/detekt/detekt.yml +++ b/tools/detekt/detekt.yml @@ -230,6 +230,7 @@ Compose: - LocalEventContentValidationState - LocalSnackbarDispatcher - LocalCameraPositionState + - LocalMapTilerConfig - LocalMediaItemPresenterFactories - LocalTimelineItemPresenterFactories - LocalRoomMemberProfilesCache From 99bbd0e29ec11388342353543d748955b42f9146 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 09:16:53 +0200 Subject: [PATCH 057/145] Add KDoc to matrix API notification and pusher interfaces Document NotificationSettingsService and PushersService along with all their members, and complete the NotificationService documentation. Fix the documentation of notificationSettingsChangeFlow, which described a state flow of room notification settings when the member is a SharedFlow that only signals that the push rules changed. That was the sole reference to RoomNotificationSettingsState in the file, so its now unused import is removed. The docs also explain why so many of these methods take isEncrypted and isOneToOne: Matrix keeps a separate default push rule per combination. Co-Authored-By: Claude Opus 5 (1M context) --- .../api/notification/NotificationService.kt | 3 + .../NotificationSettingsService.kt | 90 ++++++++++++++++++- .../matrix/api/pusher/PushersService.kt | 14 +++ 3 files changed, 105 insertions(+), 2 deletions(-) diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/notification/NotificationService.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/notification/NotificationService.kt index 369587cd10..3a3fbeaa19 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/notification/NotificationService.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/notification/NotificationService.kt @@ -24,6 +24,9 @@ typealias GetNotificationDataResult = Result>): GetNotificationDataResult } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/notificationsettings/NotificationSettingsService.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/notificationsettings/NotificationSettingsService.kt index 7ae1ca4886..7226de9a9d 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/notificationsettings/NotificationSettingsService.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/notificationsettings/NotificationSettingsService.kt @@ -11,28 +11,114 @@ package io.element.android.libraries.matrix.api.notificationsettings import io.element.android.libraries.matrix.api.core.RoomId import io.element.android.libraries.matrix.api.room.RoomNotificationMode import io.element.android.libraries.matrix.api.room.RoomNotificationSettings -import io.element.android.libraries.matrix.api.room.RoomNotificationSettingsState import kotlinx.coroutines.flow.SharedFlow +/** + * Reads and writes the push rules of the account, which decide what generates a notification. + * + * Rules are account data shared across clients, so a change made here is visible on the user's other devices. + * Several methods take the encryption and one-to-one nature of a room, because Matrix keeps a separate default rule for each combination. + */ interface NotificationSettingsService { /** - * State of the current room notification settings flow ([RoomNotificationSettingsState.Unknown] if not started). + * Emits every time the push rules change, whether from this client or another one, without saying what changed. + * Callers are expected to re-read the values they display; only the most recent signal is buffered. */ val notificationSettingsChangeFlow: SharedFlow + + /** + * Returns the notification settings that apply to one room, which may come from a room specific rule or from the matching default. + * + * @param roomId the room to read the settings of. + * @param isEncrypted whether that room is encrypted, which selects the relevant default rule. + * @param isOneToOne whether that room is a direct message, which selects the relevant default rule. + */ suspend fun getRoomNotificationSettings(roomId: RoomId, isEncrypted: Boolean, isOneToOne: Boolean): Result + + /** + * Returns the default notification mode used by rooms that have no rule of their own. + * + * @param isEncrypted whether to read the default for encrypted rooms. + * @param isOneToOne whether to read the default for direct messages. + */ suspend fun getDefaultRoomNotificationMode(isEncrypted: Boolean, isOneToOne: Boolean): Result + + /** + * Changes the default notification mode for a whole category of rooms. + * + * @param isEncrypted whether to change the default for encrypted rooms. + * @param mode the new default mode. + * @param isDM whether to change the default for direct messages. + */ suspend fun setDefaultRoomNotificationMode(isEncrypted: Boolean, mode: RoomNotificationMode, isDM: Boolean): Result + + /** + * Sets a room specific notification mode, which from then on overrides the default for that room. + * + * @param roomId the room to change. + * @param mode the new mode for that room. + */ suspend fun setRoomNotificationMode(roomId: RoomId, mode: RoomNotificationMode): Result + + /** + * Removes the room specific rule so the room follows the matching default again. + * + * @param roomId the room to reset. + */ suspend fun restoreDefaultRoomNotificationMode(roomId: RoomId): Result + + /** + * Mutes a room, which is a room specific rule like any other and is undone by [unmuteRoom]. + * + * @param roomId the room to mute. + */ suspend fun muteRoom(roomId: RoomId): Result + + /** + * Unmutes a room, restoring either its previous room specific mode or the matching default. + * + * @param roomId the room to unmute. + * @param isEncrypted whether that room is encrypted, which selects the relevant default rule. + * @param isOneToOne whether that room is a direct message, which selects the relevant default rule. + */ suspend fun unmuteRoom(roomId: RoomId, isEncrypted: Boolean, isOneToOne: Boolean): Result + + /** Whether being mentioned through `@room` generates a notification. */ suspend fun isRoomMentionEnabled(): Result + + /** + * Sets whether being mentioned through `@room` generates a notification. + * + * @param enabled true to be notified of `@room` mentions. + */ suspend fun setRoomMentionEnabled(enabled: Boolean): Result + + /** Whether incoming calls generate a notification. */ suspend fun isCallEnabled(): Result + + /** + * Sets whether incoming calls generate a notification. + * + * @param enabled true to be notified of incoming calls. + */ suspend fun setCallEnabled(enabled: Boolean): Result + + /** Whether room invitations generate a notification. */ suspend fun isInviteForMeEnabled(): Result + + /** + * Sets whether room invitations generate a notification. + * + * @param enabled true to be notified of invitations. + */ suspend fun setInviteForMeEnabled(enabled: Boolean): Result + + /** The rooms that have an enabled rule of their own rather than following the defaults. */ suspend fun getRoomsWithUserDefinedRules(): Result> + + /** Whether the homeserver is able to push encrypted events to the device, which decides how much a notification can show before decryption. */ suspend fun canHomeServerPushEncryptedEventsToDevice(): Result + + /** The push rules as raw JSON, for debugging and bug reports; `null` when the server returned none. */ suspend fun getRawPushRules(): Result } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/pusher/PushersService.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/pusher/PushersService.kt index 6764598235..1eafe8ab49 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/pusher/PushersService.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/pusher/PushersService.kt @@ -8,7 +8,21 @@ package io.element.android.libraries.matrix.api.pusher +/** + * Registers and removes the pusher of this session, i.e. the HTTP gateway the homeserver sends push notifications to. + */ interface PushersService { + /** + * Registers or updates the pusher; calling it again with the same push key replaces the existing registration. + * + * @param setHttpPusherData the gateway URL, the push key and the other details the homeserver needs to reach the device. + */ suspend fun setHttpPusher(setHttpPusherData: SetHttpPusherData): Result + + /** + * Removes the pusher, so the homeserver stops sending push notifications to this device. + * + * @param unsetHttpPusherData the push key and app id identifying the registration to remove. + */ suspend fun unsetHttpPusher(unsetHttpPusherData: UnsetHttpPusherData): Result } From 69e466a8e122081606224529e630314f05ed3401 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 09:27:01 +0200 Subject: [PATCH 058/145] Add KDoc to the remaining matrix API interfaces Document the permalink, widget, tracing, core, platform, server and analytics interfaces along with their members, which completes libraries/matrix/api: all 69 in-scope interfaces and their 398 members now carry documentation. Notable points recorded here: PermalinkParser reports an unrecognised uri as a fallback link rather than failing, MatrixWidgetDriver.run is a no-op while it is already running and send is silently ignored once closed, and every member of CallAnalyticCredentialsProvider is null when the service is unconfigured or the user has not consented to analytics. Co-Authored-By: Claude Opus 5 (1M context) --- .../api/analytics/GetDatabaseSizesUseCase.kt | 8 ++++++++ .../libraries/matrix/api/core/ProgressCallback.kt | 9 +++++++++ .../libraries/matrix/api/core/SendHandle.kt | 4 ++++ .../matrix/api/permalink/MatrixToConverter.kt | 3 +++ .../matrix/api/permalink/PermalinkBuilder.kt | 14 ++++++++++++++ .../matrix/api/permalink/PermalinkParser.kt | 3 +++ .../matrix/api/server/UserServerResolver.kt | 4 ++++ .../matrix/api/tracing/TracingService.kt | 13 +++++++++++++ .../api/widget/CallAnalyticCredentialsProvider.kt | 14 ++++++++++++++ .../api/widget/CallWidgetSettingsProvider.kt | 11 +++++++++++ .../matrix/api/widget/MatrixWidgetDriver.kt | 15 +++++++++++++++ 11 files changed, 98 insertions(+) diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/analytics/GetDatabaseSizesUseCase.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/analytics/GetDatabaseSizesUseCase.kt index fde02fb2c6..1ca9adfaca 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/analytics/GetDatabaseSizesUseCase.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/analytics/GetDatabaseSizesUseCase.kt @@ -9,6 +9,14 @@ package io.element.android.libraries.matrix.api.analytics import io.element.android.libraries.matrix.api.core.SessionId +/** + * Reads the on-disk size of a session's SDK stores, so they can be reported as analytics. + */ fun interface GetDatabaseSizesUseCase { + /** + * Returns the size of each store of the given session. + * + * @param sessionId the session whose stores are measured. + */ operator fun invoke(sessionId: SessionId): Result } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/core/ProgressCallback.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/core/ProgressCallback.kt index a7abc0f797..5c8a75e384 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/core/ProgressCallback.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/core/ProgressCallback.kt @@ -8,6 +8,15 @@ package io.element.android.libraries.matrix.api.core +/** + * Reports the progress of a long running transfer, such as a media upload or download. + */ interface ProgressCallback { + /** + * Called as the transfer advances, possibly many times and from a background thread. + * + * @param current the number of bytes transferred so far. + * @param total the total number of bytes to transfer. + */ fun onProgress(current: Long, total: Long) } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/core/SendHandle.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/core/SendHandle.kt index f3b8904fff..02c8a85d58 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/core/SendHandle.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/core/SendHandle.kt @@ -8,6 +8,10 @@ package io.element.android.libraries.matrix.api.core +/** + * A handle on an event sitting in a room's send queue, obtained from a timeline item that failed to send. + */ fun interface SendHandle { + /** Puts the event back in the send queue for another attempt. */ suspend fun retry(): Result } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/permalink/MatrixToConverter.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/permalink/MatrixToConverter.kt index cc3e2b5cf6..d6a2e71b8f 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/permalink/MatrixToConverter.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/permalink/MatrixToConverter.kt @@ -20,6 +20,9 @@ interface MatrixToConverter { * - https://riot.im/develop/#/room/#element-android:matrix.org -> https://matrix.to/#/#element-android:matrix.org * - https://app.element.io/#/room/#element-android:matrix.org -> https://matrix.to/#/#element-android:matrix.org * - https://www.example.org/#/room/#element-android:matrix.org -> https://matrix.to/#/#element-android:matrix.org + * + * @param uri the uri to convert. + * @return the equivalent matrix.to uri, or `null` when the input is not a permalink this converter recognises. */ fun convert(uri: Uri): Uri? } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/permalink/PermalinkBuilder.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/permalink/PermalinkBuilder.kt index 878b0e7a69..9140c312c7 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/permalink/PermalinkBuilder.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/permalink/PermalinkBuilder.kt @@ -11,8 +11,22 @@ package io.element.android.libraries.matrix.api.permalink import io.element.android.libraries.matrix.api.core.RoomAlias import io.element.android.libraries.matrix.api.core.UserId +/** + * Builds `matrix.to` permalinks, which are the shareable links to a user or a room; see [PermalinkParser] for the other direction. + */ interface PermalinkBuilder { + /** + * Builds a permalink to a user, failing with [PermalinkBuilderError.InvalidData] when the id is malformed. + * + * @param userId the user to link to. + */ fun permalinkForUser(userId: UserId): Result + + /** + * Builds a permalink to a room from its alias, failing with [PermalinkBuilderError.InvalidData] when the alias is malformed. + * + * @param roomAlias the room alias to link to. + */ fun permalinkForRoomAlias(roomAlias: RoomAlias): Result } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/permalink/PermalinkParser.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/permalink/PermalinkParser.kt index 5365b8776a..467b147d98 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/permalink/PermalinkParser.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/permalink/PermalinkParser.kt @@ -18,7 +18,10 @@ package io.element.android.libraries.matrix.api.permalink interface PermalinkParser { /** * Turns a uri string to a [PermalinkData]. + * A uri that is not a Matrix permalink is reported as a fallback link rather than as an error, so this never throws. * https://github.com/matrix-org/matrix-doc/blob/master/proposals/1704-matrix.to-permalinks.md + * + * @param uriString the uri to parse. */ fun parse(uriString: String): PermalinkData } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/server/UserServerResolver.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/server/UserServerResolver.kt index 3529b17d85..6c3c16b35e 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/server/UserServerResolver.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/server/UserServerResolver.kt @@ -8,6 +8,10 @@ package io.element.android.libraries.matrix.api.server +/** + * Resolves the server name of the logged in user, which is the part of their user id after the colon. + */ interface UserServerResolver { + /** Returns the server name, for instance `matrix.org` for `@alice:matrix.org`. */ fun resolve(): String } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/tracing/TracingService.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/tracing/TracingService.kt index d4ef27fd0d..f5de427ce0 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/tracing/TracingService.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/tracing/TracingService.kt @@ -10,8 +10,21 @@ package io.element.android.libraries.matrix.api.tracing import timber.log.Timber +/** + * Routes the app's own logs into the SDK's tracing subsystem, so that Kotlin and Rust logs end up interleaved in the same files. + */ interface TracingService { + /** + * Creates a Timber tree that forwards what the app logs to the SDK tracing subsystem. + * + * @param target the tracing target name the logs are attributed to, used to tell subsystems apart in the output. + */ fun createTimberTree(target: String): Timber.Tree + /** + * Turns writing logs to files on or off at runtime, which is how the user-facing logging toggle is applied. + * + * @param config where to write the log files, or the disabled configuration to stop writing them. + */ fun updateWriteToFilesConfiguration(config: WriteToFilesConfiguration) } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/widget/CallAnalyticCredentialsProvider.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/widget/CallAnalyticCredentialsProvider.kt index 5b2a691afc..1b45c4f1a0 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/widget/CallAnalyticCredentialsProvider.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/widget/CallAnalyticCredentialsProvider.kt @@ -8,10 +8,24 @@ package io.element.android.libraries.matrix.api.widget +/** + * Supplies the analytics and crash reporting credentials passed to the embedded Element Call widget. + * + * Every member is `null` when the corresponding service is not configured for this build, or when the user has not consented to analytics. + */ interface CallAnalyticCredentialsProvider { + /** The PostHog identifier of the current user, so call analytics can be tied to the same person as app analytics. */ val posthogUserId: String? + + /** The PostHog host the widget should send its events to. */ val posthogApiHost: String? + + /** The PostHog API key the widget should use. */ val posthogApiKey: String? + + /** The URL the widget should submit its rageshakes to. */ val rageshakeSubmitUrl: String? + + /** The Sentry DSN the widget should report its crashes to. */ val sentryDsn: String? } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/widget/CallWidgetSettingsProvider.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/widget/CallWidgetSettingsProvider.kt index d0686e8e5f..92510c4b8f 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/widget/CallWidgetSettingsProvider.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/widget/CallWidgetSettingsProvider.kt @@ -10,7 +10,18 @@ package io.element.android.libraries.matrix.api.widget import java.util.UUID +/** + * Builds the widget settings used to embed Element Call in a room, applying the app's own preferences on top of the SDK defaults. + */ interface CallWidgetSettingsProvider { + /** + * @param baseUrl the URL Element Call is served from. + * @param widgetId a unique identifier for this widget instance. + * @param encrypted whether the room the call takes place in is encrypted. + * @param direct whether the call happens in a direct message room. + * @param isAudioCall whether the call should start without video. + * @param hasActiveCall whether a call is already ongoing in the room, which affects whether the user joins straight away. + */ suspend fun provide( baseUrl: String, widgetId: String = UUID.randomUUID().toString(), diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/widget/MatrixWidgetDriver.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/widget/MatrixWidgetDriver.kt index d8cca95842..3b863279cf 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/widget/MatrixWidgetDriver.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/widget/MatrixWidgetDriver.kt @@ -10,10 +10,25 @@ package io.element.android.libraries.matrix.api.widget import kotlinx.coroutines.flow.Flow +/** + * Bridges a widget running in a WebView with the Matrix room it is embedded in, relaying the widget API messages in both directions. + * + * The driver owns SDK resources and must be closed once the widget goes away; Element Call is the main user of this. + */ interface MatrixWidgetDriver : AutoCloseable { + /** The id of the widget this driver serves, matching the one in its settings. */ val id: String + + /** The messages coming from the room that should be forwarded to the widget. */ val incomingMessages: Flow + /** Starts relaying messages and suspends for as long as the driver runs; calling it again while it is running does nothing. */ suspend fun run() + + /** + * Forwards a message from the widget to the room. Does nothing once the driver has been closed. + * + * @param message the raw widget API message emitted by the WebView. + */ suspend fun send(message: String) } From f01abdc00d4435a29889adf9e8b234e397faa3dd Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 09:33:16 +0200 Subject: [PATCH 059/145] Add KDoc to the `libraries/push` API interfaces Document PushService, GetCurrentPushProvider, NotificationCleaner and NotificationBitmapLoader along with their members, and add the missing @param entries across the notification interfaces. The NotificationCleaner docs record the behaviour shared by all its methods, which is not visible in the signatures: each one also removes the grouping summary notification once it has no children left. Co-Authored-By: Claude Opus 5 (1M context) --- .../push/api/GetCurrentPushProvider.kt | 10 +++++ .../android/libraries/push/api/PushService.kt | 31 +++++++++++++ .../notifications/NotificationBitmapLoader.kt | 3 ++ .../api/notifications/NotificationCleaner.kt | 44 +++++++++++++++++++ .../notifications/NotificationSoundUpdater.kt | 12 +++++ .../OnMissedCallNotificationHandler.kt | 4 ++ .../NotificationConversationService.kt | 12 +++++ .../sound/NotificationSoundCopier.kt | 6 +++ 8 files changed, 122 insertions(+) diff --git a/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/GetCurrentPushProvider.kt b/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/GetCurrentPushProvider.kt index a6fbb47173..eb2ce09545 100644 --- a/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/GetCurrentPushProvider.kt +++ b/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/GetCurrentPushProvider.kt @@ -10,6 +10,16 @@ package io.element.android.libraries.push.api import io.element.android.libraries.matrix.api.core.SessionId +/** + * Reads the name of the push provider a session is currently registered with. + * + * This is the low-level accessor used where depending on the whole push feature would be too much; prefer [PushService.getCurrentPushProvider] otherwise. + */ interface GetCurrentPushProvider { + /** + * Returns the stored provider name, or `null` when the session has no push provider selected yet. + * + * @param sessionId the session to read the provider of. + */ suspend fun getCurrentPushProvider(sessionId: SessionId): String? } diff --git a/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/PushService.kt b/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/PushService.kt index a43ee36403..4a5037d17f 100644 --- a/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/PushService.kt +++ b/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/PushService.kt @@ -16,9 +16,14 @@ import io.element.android.libraries.pushproviders.api.Distributor import io.element.android.libraries.pushproviders.api.PushProvider import kotlinx.coroutines.flow.Flow +/** + * Entry point for push notification setup: choosing a push provider, registering a pusher with the homeserver, and inspecting the push history. + */ interface PushService { /** * Return the current push provider, or null if none. + * + * @param sessionId the session to read the provider of. */ suspend fun getCurrentPushProvider(sessionId: SessionId): PushProvider? @@ -31,6 +36,10 @@ interface PushService { * Will unregister any previous pusher and register a new one with the provided [PushProvider]. * * The method has effect only if the [PushProvider] is different than the current one. + * + * @param matrixClient the session to register the pusher for. + * @param pushProvider the provider to switch to. + * @param distributor the distributor of that provider to use, which matters for providers such as UnifiedPush. */ suspend fun registerWith( matrixClient: MatrixClient, @@ -42,6 +51,8 @@ interface PushService { * Ensure that the pusher with the current push provider and distributor is registered. * If there is no current config, the default push provider with the default distributor will be used. * Error can be [PusherRegistrationFailure]. + * + * @param matrixClient the session to ensure the pusher of. */ suspend fun ensurePusherIsRegistered( matrixClient: MatrixClient, @@ -50,17 +61,35 @@ interface PushService { /** * Store the given push provider as the current one, but do not register. * To be used when there is no distributor available. + * + * @param sessionId the session to store the provider for. + * @param pushProvider the provider to remember. */ suspend fun selectPushProvider( sessionId: SessionId, pushProvider: PushProvider, ) + /** + * Whether the user has asked not to be warned about pusher registration failures for this session. + * + * @param sessionId the session to read the preference of. + */ fun ignoreRegistrationError(sessionId: SessionId): Flow + + /** + * Remembers whether pusher registration failures should be reported to the user for this session. + * + * @param sessionId the session to store the preference for. + * @param ignore true to stop warning the user about registration failures. + */ suspend fun setIgnoreRegistrationError(sessionId: SessionId, ignore: Boolean) /** + * Asks the homeserver to send a test push, so the user can check that the whole chain works. * Return false in case of early error. + * + * @param sessionId the session to test the push setup of. */ suspend fun testPush(sessionId: SessionId): Boolean @@ -86,6 +115,8 @@ interface PushService { /** * Notify the user that the service is un-registered. + * + * @param userId the user whose push service is no longer registered. */ suspend fun onServiceUnregistered(userId: UserId) } diff --git a/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/notifications/NotificationBitmapLoader.kt b/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/notifications/NotificationBitmapLoader.kt index bded69991b..9dd53ade09 100644 --- a/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/notifications/NotificationBitmapLoader.kt +++ b/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/notifications/NotificationBitmapLoader.kt @@ -14,6 +14,9 @@ import coil3.ImageLoader import io.element.android.libraries.designsystem.components.avatar.AvatarData import io.element.android.libraries.matrix.ui.media.AVATAR_THUMBNAIL_SIZE_IN_PIXEL +/** + * Loads the avatars used to decorate notifications, since the notification APIs need bitmaps rather than Compose images. + */ interface NotificationBitmapLoader { /** * Get icon of a room. diff --git a/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/notifications/NotificationCleaner.kt b/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/notifications/NotificationCleaner.kt index 0a4e35c697..95966f8eb1 100644 --- a/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/notifications/NotificationCleaner.kt +++ b/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/notifications/NotificationCleaner.kt @@ -13,12 +13,56 @@ import io.element.android.libraries.matrix.api.core.RoomId import io.element.android.libraries.matrix.api.core.SessionId import io.element.android.libraries.matrix.api.core.ThreadId +/** + * Dismisses notifications that are already displayed, typically because the user has now seen the events elsewhere. + * + * Every method also removes the grouping summary notification when it is left without children. + */ interface NotificationCleaner { + /** + * Dismisses every message notification of a session. + * + * @param sessionId the session whose notifications are dismissed. + */ fun clearAllMessagesEvents(sessionId: SessionId) + + /** + * Dismisses the message notifications of one room. + * + * @param sessionId the session the room belongs to. + * @param roomId the room whose notifications are dismissed. + */ fun clearMessagesForRoom(sessionId: SessionId, roomId: RoomId) + + /** + * Dismisses the message notifications of one thread, leaving the rest of the room's notifications in place. + * + * @param sessionId the session the room belongs to. + * @param roomId the room the thread belongs to. + * @param threadId the thread whose notifications are dismissed. + */ fun clearMessagesForThread(sessionId: SessionId, roomId: RoomId, threadId: ThreadId) + + /** + * Dismisses the notification of a single event. + * + * @param sessionId the session the event belongs to. + * @param eventId the event whose notification is dismissed. + */ fun clearEvent(sessionId: SessionId, eventId: EventId) + /** + * Dismisses every membership notification of a session, i.e. the invitations and the join requests. + * + * @param sessionId the session whose notifications are dismissed. + */ fun clearMembershipNotificationForSession(sessionId: SessionId) + + /** + * Dismisses the membership notifications of one room. + * + * @param sessionId the session the room belongs to. + * @param roomId the room whose notifications are dismissed. + */ fun clearMembershipNotificationForRoom(sessionId: SessionId, roomId: RoomId) } diff --git a/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/notifications/NotificationSoundUpdater.kt b/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/notifications/NotificationSoundUpdater.kt index b23c4122ad..91f50abc07 100644 --- a/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/notifications/NotificationSoundUpdater.kt +++ b/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/notifications/NotificationSoundUpdater.kt @@ -14,8 +14,20 @@ import io.element.android.libraries.preferences.api.store.NotificationSound * versioned channel because Android forbids mutating sound after creation. */ interface NotificationSoundUpdater { + /** + * Recreates the message notification channel so it uses [sound]. + * + * @param sound the sound the new channel should play. + * @param version bumped on every change, since a new channel id is the only way to change a channel's sound. + */ fun recreateNoisyChannel(sound: NotificationSound, version: Int) + /** + * Recreates the ringing call notification channel so it uses [sound]; see [recreateNoisyChannel] for why a version is needed. + * + * @param sound the sound the new channel should play. + * @param version bumped on every change to force a new channel id. + */ fun recreateRingingCallChannel(sound: NotificationSound, version: Int) /** Current channel sound classified into [NotificationSound]. Null when the channel doesn't exist. */ diff --git a/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/notifications/OnMissedCallNotificationHandler.kt b/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/notifications/OnMissedCallNotificationHandler.kt index 2ba61925c5..d4e051ebf2 100644 --- a/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/notifications/OnMissedCallNotificationHandler.kt +++ b/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/notifications/OnMissedCallNotificationHandler.kt @@ -18,6 +18,10 @@ import io.element.android.libraries.matrix.api.core.SessionId interface OnMissedCallNotificationHandler { /** * Adds a missed call notification. + * + * @param sessionId the session the call was received on. + * @param roomId the room the call took place in. + * @param eventId the call notification event that went unanswered. */ suspend fun addMissedCallNotification( sessionId: SessionId, diff --git a/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/notifications/conversations/NotificationConversationService.kt b/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/notifications/conversations/NotificationConversationService.kt index 4ea80e4ce8..b3bffc0147 100644 --- a/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/notifications/conversations/NotificationConversationService.kt +++ b/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/notifications/conversations/NotificationConversationService.kt @@ -18,6 +18,12 @@ interface NotificationConversationService { /** * Called when a new message is received in a room. * It should create a new conversation shortcut for this room. + * + * @param sessionId the session the message belongs to. + * @param roomId the room the message was received in. + * @param roomName the name to show on the shortcut, or `null` when the room has none. + * @param roomIsDirect whether the room is a direct message, which changes how the shortcut is presented. + * @param roomAvatarUrl the avatar to show on the shortcut, or `null` when the room has none. */ suspend fun onSendMessage( sessionId: SessionId, @@ -30,12 +36,18 @@ interface NotificationConversationService { /** * Called when a room is left. * It should remove the conversation shortcut for this room. + * + * @param sessionId the session the room belongs to. + * @param roomId the room that was left. */ suspend fun onLeftRoom(sessionId: SessionId, roomId: RoomId) /** * Called when the list of available rooms changes. * It should update the conversation shortcuts accordingly, removing shortcuts for no longer joined rooms. + * + * @param sessionId the session the rooms belong to. + * @param roomIds the rooms the user is currently joined to. */ suspend fun onAvailableRoomsChanged(sessionId: SessionId, roomIds: Set) } diff --git a/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/notifications/sound/NotificationSoundCopier.kt b/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/notifications/sound/NotificationSoundCopier.kt index 2268198353..ad3d73656f 100644 --- a/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/notifications/sound/NotificationSoundCopier.kt +++ b/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/notifications/sound/NotificationSoundCopier.kt @@ -12,6 +12,12 @@ package io.element.android.libraries.push.api.notifications.sound * FileProvider, so the persisted reference outlives the original source. */ interface NotificationSoundCopier { + /** + * Copies the picked sound into app-private storage, replacing any file previously stored for [slot]. + * + * @param sourceUriString the uri of the sound the user picked. + * @param slot which of the two sounds is being set, since each keeps its own copy. + */ suspend fun copyToAppFiles(sourceUriString: String, slot: SoundSlot): CopyResult /** From 82ff94672b071068ead8c0c7b7dfa8fb5b635612 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 09:35:57 +0200 Subject: [PATCH 060/145] Add KDoc to the `libraries/preferences` API interfaces Document AppPreferencesStore, SessionPreferencesStore, their two factories, and each of their 44 members. For a preference store the useful thing to document is the fallback value, so each getter states the default it uses when the preference has never been set, taken from DefaultAppPreferencesStore and DefaultSessionPreferencesStore: developer mode follows the build type, live location updates default to 10 metres, the log packs to an empty set, and the session toggles are all on by default except session verification skipping. Co-Authored-By: Claude Opus 5 (1M context) --- .../api/store/AppPreferencesStore.kt | 66 ++++++++++++++++++- .../api/store/PreferenceDataStoreFactory.kt | 5 ++ .../api/store/SessionPreferencesStore.kt | 47 +++++++++++++ .../store/SessionPreferencesStoreFactory.kt | 15 +++++ 4 files changed, 132 insertions(+), 1 deletion(-) diff --git a/libraries/preferences/api/src/main/kotlin/io/element/android/libraries/preferences/api/store/AppPreferencesStore.kt b/libraries/preferences/api/src/main/kotlin/io/element/android/libraries/preferences/api/store/AppPreferencesStore.kt index b1877b3ae5..f35fa88442 100644 --- a/libraries/preferences/api/src/main/kotlin/io/element/android/libraries/preferences/api/store/AppPreferencesStore.kt +++ b/libraries/preferences/api/src/main/kotlin/io/element/android/libraries/preferences/api/store/AppPreferencesStore.kt @@ -13,48 +13,111 @@ import io.element.android.libraries.matrix.api.tracing.LogLevel import io.element.android.libraries.matrix.api.tracing.TraceLogPack import kotlinx.coroutines.flow.Flow +/** + * Local, app-wide user preferences that are not tied to a session, stored on the device only. + * + * Each getter returns a flow that emits the current value straight away and then again on every change. + * The default each preference falls back to when it has never been set is given on the getter. + */ interface AppPreferencesStore { + /** + * @param enabled true to expose the developer options in the settings. + */ suspend fun setDeveloperModeEnabled(enabled: Boolean) + + /** Whether developer mode is on; defaults to `true` on debug builds and `false` otherwise. */ fun isDeveloperModeEnabledFlow(): Flow + /** + * @param string the Element Call deployment to use, or `null` to go back to the one from the homeserver. + */ suspend fun setCustomElementCallBaseUrl(string: String?) + + /** The Element Call URL the user has overridden, or `null` when the homeserver's own value should be used. */ fun getCustomElementCallBaseUrlFlow(): Flow + /** + * @param theme the name of the theme to apply: light, dark, or follow the system. + */ suspend fun setTheme(theme: String) + + /** The name of the chosen theme, or `null` when the user has not picked one and the system setting should be followed. */ fun getThemeFlow(): Flow + /** + * @param value the distance in metres the user must move before a new live location is published. + */ suspend fun setLiveLocationMinimumDistanceInMetersUpdate(value: Int) + + /** The minimum distance in metres between two live location updates; defaults to 10. */ fun getLiveLocationMinimumDistanceInMetersUpdateFlow(): Flow + /** + * Only used to clear the local value once it has been migrated to the server. + * + * @param hide the local setting, or `null` to erase it. + */ @Deprecated("Use MediaPreviewService instead. Kept only for migration.") suspend fun setHideInviteAvatars(hide: Boolean?) + + /** The local setting to migrate to the server, or `null` once there is nothing left to migrate. */ @Deprecated("Use MediaPreviewService instead. Kept only for migration.") fun getHideInviteAvatarsFlow(): Flow + + /** + * Only used to clear the local value once it has been migrated to the server. + * + * @param mediaPreviewValue the local setting, or `null` to erase it. + */ @Deprecated("Use MediaPreviewService instead. Kept only for migration.") suspend fun setTimelineMediaPreviewValue(mediaPreviewValue: MediaPreviewValue?) + + /** The local setting to migrate to the server, or `null` once there is nothing left to migrate. */ @Deprecated("Use MediaPreviewService instead. Kept only for migration.") fun getTimelineMediaPreviewValueFlow(): Flow + /** + * @param logLevel how verbose the SDK and app logs should be. + */ suspend fun setTracingLogLevel(logLevel: LogLevel) + + /** The configured log level; defaults to the one the build was compiled with. */ fun getTracingLogLevelFlow(): Flow + /** + * @param targets the extra log packs to enable on top of the default targets. + */ suspend fun setTracingLogPacks(targets: Set) + + /** The extra log packs enabled by the user; defaults to an empty set. */ fun getTracingLogPacksFlow(): Flow> + /** The sound played for message notifications. */ fun getMessageSoundFlow(): Flow /** * Atomically persists [sound] (with copy-time [title] for Custom; cleared otherwise) and * bumps the channel version. Single transaction so process death can't desync URI and version. + * + * @param sound the sound to persist. + * @param title the display name captured when the sound was copied, or `null` for the built-in choices. + * @return the new channel version, to be passed to the channel recreation. */ suspend fun setMessageSoundAndIncrementVersion(sound: NotificationSound, title: String?): Int /** Title captured at copy time. Null for SystemDefault / Silent or pre-title persisted data. */ fun getMessageSoundDisplayNameFlow(): Flow + /** The sound played for incoming call notifications. */ fun getCallRingtoneFlow(): Flow - /** See [setMessageSoundAndIncrementVersion]. */ + /** + * See [setMessageSoundAndIncrementVersion]. + * + * @param sound the ringtone to persist. + * @param title the display name captured when the sound was copied, or `null` for the built-in choices. + * @return the new channel version, to be passed to the channel recreation. + */ suspend fun setCallRingtoneAndIncrementVersion(sound: NotificationSound, title: String?): Int /** See [getMessageSoundDisplayNameFlow]. */ @@ -63,5 +126,6 @@ interface AppPreferencesStore { /** Single-snapshot read of all sound prefs; used at boot to seed channels without N reads. */ suspend fun getNotificationSoundChannelConfig(): NotificationSoundChannelConfig + /** Erases every app preference, so they all fall back to their defaults. */ suspend fun reset() } diff --git a/libraries/preferences/api/src/main/kotlin/io/element/android/libraries/preferences/api/store/PreferenceDataStoreFactory.kt b/libraries/preferences/api/src/main/kotlin/io/element/android/libraries/preferences/api/store/PreferenceDataStoreFactory.kt index 50f6eb2431..a3d609e205 100644 --- a/libraries/preferences/api/src/main/kotlin/io/element/android/libraries/preferences/api/store/PreferenceDataStoreFactory.kt +++ b/libraries/preferences/api/src/main/kotlin/io/element/android/libraries/preferences/api/store/PreferenceDataStoreFactory.kt @@ -17,5 +17,10 @@ import androidx.datastore.preferences.core.Preferences * It's a wrapper around AndroidX's `PreferenceDataStoreFactory` to make testing easier. */ interface PreferenceDataStoreFactory { + /** + * Creates or opens the preference store with the given name. + * + * @param name the store name, which also determines the file it is persisted to. + */ fun create(name: String): DataStore } diff --git a/libraries/preferences/api/src/main/kotlin/io/element/android/libraries/preferences/api/store/SessionPreferencesStore.kt b/libraries/preferences/api/src/main/kotlin/io/element/android/libraries/preferences/api/store/SessionPreferencesStore.kt index d3f3fb4e28..b554fff460 100644 --- a/libraries/preferences/api/src/main/kotlin/io/element/android/libraries/preferences/api/store/SessionPreferencesStore.kt +++ b/libraries/preferences/api/src/main/kotlin/io/element/android/libraries/preferences/api/store/SessionPreferencesStore.kt @@ -10,30 +10,77 @@ package io.element.android.libraries.preferences.api.store import kotlinx.coroutines.flow.Flow +/** + * Local, per-session user preferences, stored on the device only and never synced to the homeserver. + * + * Each getter returns a flow that emits the current value straight away and then again on every change. + * The default each preference falls back to when it has never been set is given on the getter. + */ interface SessionPreferencesStore { + /** + * @param enabled true to let the homeserver share this user's presence with others. + */ suspend fun setSharePresence(enabled: Boolean) + + /** Whether presence is shared; defaults to `true`. */ fun isSharePresenceEnabled(): Flow + /** + * @param enabled true to send read receipts that other members can see. + */ suspend fun setSendPublicReadReceipts(enabled: Boolean) + + /** Whether read receipts are sent publicly rather than privately; defaults to `true`. */ fun isSendPublicReadReceiptsEnabled(): Flow + /** + * @param enabled true to display the read receipts of other members in the timeline. + */ suspend fun setRenderReadReceipts(enabled: Boolean) + + /** Whether other members' read receipts are displayed; defaults to `true`. */ fun isRenderReadReceiptsEnabled(): Flow + /** + * @param enabled true to tell other members when this user is typing. + */ suspend fun setSendTypingNotifications(enabled: Boolean) + + /** Whether typing notifications are sent; defaults to `true`. */ fun isSendTypingNotificationsEnabled(): Flow + /** + * @param enabled true to display which other members are typing. + */ suspend fun setRenderTypingNotifications(enabled: Boolean) + + /** Whether other members' typing notifications are displayed; defaults to `true`. */ fun isRenderTypingNotificationsEnabled(): Flow + /** + * @param skip true to remember that the user dismissed the session verification prompt. + */ suspend fun setSkipSessionVerification(skip: Boolean) + + /** Whether the user chose to skip verifying this session, so they are not asked again; defaults to `false`. */ fun isSessionVerificationSkipped(): Flow + /** + * @param compress true to downscale images before uploading them. + */ suspend fun setOptimizeImages(compress: Boolean) + + /** Whether images are downscaled before upload; defaults to `true`. */ fun doesOptimizeImages(): Flow + /** + * @param preset the quality and size trade-off to apply when compressing videos. + */ suspend fun setVideoCompressionPreset(preset: VideoCompressionPreset) + + /** The video compression preset; defaults to [VideoCompressionPreset.STANDARD], including when the stored value is unreadable. */ fun getVideoCompressionPreset(): Flow + /** Erases every preference of this session, so they all fall back to their defaults. */ suspend fun clear() } diff --git a/libraries/preferences/api/src/main/kotlin/io/element/android/libraries/preferences/api/store/SessionPreferencesStoreFactory.kt b/libraries/preferences/api/src/main/kotlin/io/element/android/libraries/preferences/api/store/SessionPreferencesStoreFactory.kt index 2c0038d06e..05b4845026 100644 --- a/libraries/preferences/api/src/main/kotlin/io/element/android/libraries/preferences/api/store/SessionPreferencesStoreFactory.kt +++ b/libraries/preferences/api/src/main/kotlin/io/element/android/libraries/preferences/api/store/SessionPreferencesStoreFactory.kt @@ -11,7 +11,22 @@ package io.element.android.libraries.preferences.api.store import io.element.android.libraries.matrix.api.core.SessionId import kotlinx.coroutines.CoroutineScope +/** + * Caches one [SessionPreferencesStore] per session, so that every caller of a given session shares the same instance. + */ interface SessionPreferencesStoreFactory { + /** + * Returns the store of a session, creating it on first use. + * + * @param sessionId the session whose store is requested. + * @param sessionCoroutineScope the scope the store uses for its own work, only honoured when the store is actually created. + */ fun get(sessionId: SessionId, sessionCoroutineScope: CoroutineScope): SessionPreferencesStore + + /** + * Drops the cached store of a session, to be called when that session goes away. + * + * @param sessionId the session whose store is dropped. + */ fun remove(sessionId: SessionId) } From 7462c5f366155e54c46fdc475eb9ab4f76c71abb Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 09:38:36 +0200 Subject: [PATCH 061/145] Add KDoc to the `services/analytics` API interfaces Document AnalyticsService and ScreenTracker at the interface level, document the members of the cold start and room list watchers, and add the missing @param entries across the analytics interfaces. The AnalyticsService doc states the rule that applies to the whole interface: nothing reaches the providers until the user has given their consent. Co-Authored-By: Claude Opus 5 (1M context) --- .../analytics/api/AnalyticsSdkManager.kt | 7 +++++ .../analytics/api/AnalyticsService.kt | 29 ++++++++++++++++++- .../services/analytics/api/ScreenTracker.kt | 8 +++++ .../api/watchers/AnalyticsColdStartWatcher.kt | 5 ++++ .../watchers/AnalyticsRoomListStateWatcher.kt | 3 ++ 5 files changed, 51 insertions(+), 1 deletion(-) diff --git a/services/analytics/api/src/main/kotlin/io/element/android/services/analytics/api/AnalyticsSdkManager.kt b/services/analytics/api/src/main/kotlin/io/element/android/services/analytics/api/AnalyticsSdkManager.kt index bf5e04509c..d83690a644 100644 --- a/services/analytics/api/src/main/kotlin/io/element/android/services/analytics/api/AnalyticsSdkManager.kt +++ b/services/analytics/api/src/main/kotlin/io/element/android/services/analytics/api/AnalyticsSdkManager.kt @@ -13,16 +13,23 @@ package io.element.android.services.analytics.api interface AnalyticsSdkManager { /** * Enable or disable SDK analytics. + * + * @param enabled true to let the SDK report analytics, normally following the user consent. */ fun enableSdkAnalytics(enabled: Boolean) /** * Start a new span with the given [name], using [parentTraceId] to optionally attach it to a parent transaction. + * + * @param name the name of the span. + * @param parentTraceId the trace to attach the span to, or `null` to start a root span. */ fun startSpan(name: String, parentTraceId: String? = null): AnalyticsSdkSpan /** * Create a 'bridge' span optionally linking it to a parent trace via [parentTraceId]. + * + * @param parentTraceId the trace to link the bridge to, or `null` to leave it unattached. */ fun bridge(parentTraceId: String? = null): AnalyticsSdkSpan } diff --git a/services/analytics/api/src/main/kotlin/io/element/android/services/analytics/api/AnalyticsService.kt b/services/analytics/api/src/main/kotlin/io/element/android/services/analytics/api/AnalyticsService.kt index 846d5ce5b1..9f29f43b77 100644 --- a/services/analytics/api/src/main/kotlin/io/element/android/services/analytics/api/AnalyticsService.kt +++ b/services/analytics/api/src/main/kotlin/io/element/android/services/analytics/api/AnalyticsService.kt @@ -15,6 +15,11 @@ import io.element.android.services.analyticsproviders.api.trackers.AnalyticsTrac import io.element.android.services.analyticsproviders.api.trackers.ErrorTracker import kotlinx.coroutines.flow.Flow +/** + * Central analytics entry point: user consent, the analytics identity, and performance transactions. + * + * Nothing is sent to the providers until the user has given their consent through [setUserConsent]. + */ interface AnalyticsService : AnalyticsTracker, ErrorTracker { /** * Get the available analytics providers. @@ -28,6 +33,8 @@ interface AnalyticsService : AnalyticsTracker, ErrorTracker { /** * Update the user consent value. + * + * @param userConsent true when the user agrees to analytics being collected. */ suspend fun setUserConsent(userConsent: Boolean) @@ -48,16 +55,26 @@ interface AnalyticsService : AnalyticsTracker, ErrorTracker { /** * Update analyticsId from the AccountData. + * + * @param analyticsId the identifier shared across the user's clients, so their events are attributed to one person. */ suspend fun setAnalyticsId(analyticsId: String) /** * Starts a transaction to measure the performance of an operation. + * The caller is responsible for finishing it; see `recordTransaction` for a scoped alternative. + * + * @param name the name the transaction is reported under. + * @param operation the kind of operation being measured. + * @param description a human readable detail shown alongside the measurement. */ fun startTransaction(name: String, operation: String? = null, description: String? = null): AnalyticsTransaction /** * Starts an [AnalyticsLongRunningTransaction], that can be shared with other components. + * + * @param longRunningTransaction which of the known long running operations is starting. + * @param parentTransaction the transaction to attach this one to, or `null` to start a root transaction. */ fun startLongRunningTransaction( longRunningTransaction: AnalyticsLongRunningTransaction, @@ -66,15 +83,25 @@ interface AnalyticsService : AnalyticsTracker, ErrorTracker { /** * Gets an ongoing [AnalyticsLongRunningTransaction], if it exists. + * + * @param longRunningTransaction the long running operation to look up. */ fun getLongRunningTransaction(longRunningTransaction: AnalyticsLongRunningTransaction): AnalyticsTransaction? /** * Removes an ongoing [AnalyticsLongRunningTransaction] so it's no longer shared. + * + * @param longRunningTransaction the long running operation to stop sharing. + * @return the transaction that was removed, or `null` when none was ongoing. */ fun removeLongRunningTransaction(longRunningTransaction: AnalyticsLongRunningTransaction): AnalyticsTransaction? - /** Enter a span inside the Rust SDK tracing system. If a [parentTraceId] is provided, the SDK trace will be added as a child of that trace. */ + /** + * Enter a span inside the Rust SDK tracing system. If a [parentTraceId] is provided, the SDK trace will be added as a child of that trace. + * + * @param name the name of the span. + * @param parentTraceId the trace to attach the span to, or `null` to start a root span. + */ @Discouraged("This method can cause crashes of the app when using debug builds of the Rust SDK.") fun enterSdkSpan(name: String?, parentTraceId: String?): AnalyticsSdkSpan } diff --git a/services/analytics/api/src/main/kotlin/io/element/android/services/analytics/api/ScreenTracker.kt b/services/analytics/api/src/main/kotlin/io/element/android/services/analytics/api/ScreenTracker.kt index 29513f66ff..2a93b2f7aa 100644 --- a/services/analytics/api/src/main/kotlin/io/element/android/services/analytics/api/ScreenTracker.kt +++ b/services/analytics/api/src/main/kotlin/io/element/android/services/analytics/api/ScreenTracker.kt @@ -11,7 +11,15 @@ package io.element.android.services.analytics.api import androidx.compose.runtime.Composable import im.vector.app.features.analytics.plan.MobileScreen +/** + * Reports screen views to analytics from Composable code. + */ interface ScreenTracker { + /** + * Records a view of [screen] when this enters composition, so it is called once per appearance rather than on every recomposition. + * + * @param screen the screen being shown. + */ @Composable fun TrackScreen( screen: MobileScreen.ScreenName, diff --git a/services/analytics/api/src/main/kotlin/io/element/android/services/analytics/api/watchers/AnalyticsColdStartWatcher.kt b/services/analytics/api/src/main/kotlin/io/element/android/services/analytics/api/watchers/AnalyticsColdStartWatcher.kt index 67d3c5498b..905b0dc88f 100644 --- a/services/analytics/api/src/main/kotlin/io/element/android/services/analytics/api/watchers/AnalyticsColdStartWatcher.kt +++ b/services/analytics/api/src/main/kotlin/io/element/android/services/analytics/api/watchers/AnalyticsColdStartWatcher.kt @@ -12,7 +12,12 @@ package io.element.android.services.analytics.api.watchers * until the cached room list is displayed. This check only takes place in a cold app start after the user is authenticated. */ interface AnalyticsColdStartWatcher { + /** Begins the measurement, to be called as early as possible in the cold start. */ fun start() + + /** Restarts the measurement from the login flow, since a user who has to sign in first is not a normal cold start. */ fun whenLoggingIn() + + /** Ends the measurement, to be called once the cached room list is actually on screen. */ fun onRoomListVisible() } diff --git a/services/analytics/api/src/main/kotlin/io/element/android/services/analytics/api/watchers/AnalyticsRoomListStateWatcher.kt b/services/analytics/api/src/main/kotlin/io/element/android/services/analytics/api/watchers/AnalyticsRoomListStateWatcher.kt index 2f6d4723a3..85cb210d8c 100644 --- a/services/analytics/api/src/main/kotlin/io/element/android/services/analytics/api/watchers/AnalyticsRoomListStateWatcher.kt +++ b/services/analytics/api/src/main/kotlin/io/element/android/services/analytics/api/watchers/AnalyticsRoomListStateWatcher.kt @@ -12,6 +12,9 @@ package io.element.android.services.analytics.api.watchers * the app was previously running and we just returned to it. */ interface AnalyticsRoomListStateWatcher { + /** Begins watching the room list state, to be called when the app returns to the foreground. */ fun start() + + /** Stops watching, to be called when the app leaves the foreground. */ fun stop() } From 414d2b5dd08679d87333137bab9c207be023d3c5 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 09:39:36 +0200 Subject: [PATCH 062/145] Add KDoc to the `libraries/emoji` API interfaces Document AddRecentEmoji, GetRecentEmojis.invoke, the EmojiPickerRenderer interface and the EmojiPickerPresenter factory, pointing at the no-op renderer and the empty recent-emoji source so callers know how to opt out of each. EmojiPickerPresenter itself is a Presenter and therefore out of scope. Co-Authored-By: Claude Opus 5 (1M context) --- .../libraries/emoji/api/picker/EmojiPickerPresenter.kt | 7 +++++++ .../libraries/emoji/api/picker/EmojiPickerRenderer.kt | 7 +++++++ .../libraries/emoji/api/recentemojis/AddRecentEmoji.kt | 6 ++++++ .../libraries/emoji/api/recentemojis/GetRecentEmojis.kt | 1 + 4 files changed, 21 insertions(+) diff --git a/libraries/emoji/api/src/main/kotlin/io/element/android/libraries/emoji/api/picker/EmojiPickerPresenter.kt b/libraries/emoji/api/src/main/kotlin/io/element/android/libraries/emoji/api/picker/EmojiPickerPresenter.kt index a20b53a480..ac83b49533 100644 --- a/libraries/emoji/api/src/main/kotlin/io/element/android/libraries/emoji/api/picker/EmojiPickerPresenter.kt +++ b/libraries/emoji/api/src/main/kotlin/io/element/android/libraries/emoji/api/picker/EmojiPickerPresenter.kt @@ -11,7 +11,14 @@ import io.element.android.libraries.architecture.Presenter import io.element.android.libraries.emoji.api.recentemojis.GetRecentEmojis fun interface EmojiPickerPresenter : Presenter { + /** + * Creates a presenter for one picker instance. + */ fun interface Factory { + /** + * @param getRecentEmojis how the picker sources its recent tab; pass [io.element.android.libraries.emoji.api.recentemojis.EmptyGetRecentEmojis] + * for a picker that should have no recent tab at all. + */ fun create(getRecentEmojis: GetRecentEmojis): EmojiPickerPresenter } } diff --git a/libraries/emoji/api/src/main/kotlin/io/element/android/libraries/emoji/api/picker/EmojiPickerRenderer.kt b/libraries/emoji/api/src/main/kotlin/io/element/android/libraries/emoji/api/picker/EmojiPickerRenderer.kt index b3784b3c42..b273f41dae 100644 --- a/libraries/emoji/api/src/main/kotlin/io/element/android/libraries/emoji/api/picker/EmojiPickerRenderer.kt +++ b/libraries/emoji/api/src/main/kotlin/io/element/android/libraries/emoji/api/picker/EmojiPickerRenderer.kt @@ -13,9 +13,16 @@ import androidx.compose.ui.Modifier import io.element.android.emojibasebindings.Emoji import kotlinx.collections.immutable.ImmutableSet +/** + * Renders the emoji picker, so that callers can embed it without depending on its implementation. + * + * See [NoOpEmojiPickerRenderer] for a renderer that draws nothing, used where the picker is disabled. + */ @Immutable interface EmojiPickerRenderer { /** + * Draws the picker. + * * @param state opaque state produced by [EmojiPickerPresenter.present]. * @param onSelectEmoji invoked when the user taps an emoji (including a skin-tone variant). * @param selectedEmojis emojis to visually mark as already selected. diff --git a/libraries/emoji/api/src/main/kotlin/io/element/android/libraries/emoji/api/recentemojis/AddRecentEmoji.kt b/libraries/emoji/api/src/main/kotlin/io/element/android/libraries/emoji/api/recentemojis/AddRecentEmoji.kt index 5865568511..af2a1dfd7d 100644 --- a/libraries/emoji/api/src/main/kotlin/io/element/android/libraries/emoji/api/recentemojis/AddRecentEmoji.kt +++ b/libraries/emoji/api/src/main/kotlin/io/element/android/libraries/emoji/api/recentemojis/AddRecentEmoji.kt @@ -8,6 +8,12 @@ package io.element.android.libraries.emoji.api.recentemojis +/** + * Records that an emoji was just used, so it surfaces in the picker's recent list; see [GetRecentEmojis] for the read side. + */ fun interface AddRecentEmoji { + /** + * @param emoji the emoji that was just used, as its unicode representation. + */ suspend operator fun invoke(emoji: String): Result } diff --git a/libraries/emoji/api/src/main/kotlin/io/element/android/libraries/emoji/api/recentemojis/GetRecentEmojis.kt b/libraries/emoji/api/src/main/kotlin/io/element/android/libraries/emoji/api/recentemojis/GetRecentEmojis.kt index cf6015d799..276b0e7eba 100644 --- a/libraries/emoji/api/src/main/kotlin/io/element/android/libraries/emoji/api/recentemojis/GetRecentEmojis.kt +++ b/libraries/emoji/api/src/main/kotlin/io/element/android/libraries/emoji/api/recentemojis/GetRecentEmojis.kt @@ -15,6 +15,7 @@ import kotlinx.collections.immutable.persistentListOf * Returns the list of recently used emojis for reactions. */ fun interface GetRecentEmojis { + /** Returns the recently used emojis, most recent first; see [EmptyGetRecentEmojis] for a picker with no recent tab. */ suspend operator fun invoke(): Result> } From 23a346907cde6b3a7bd9d8da0ac1bc4c22ddc329 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 09:44:42 +0200 Subject: [PATCH 063/145] Add KDoc to the `libraries/mediaupload` API interfaces Document MediaSender and all its members, its two factories, MediaPreProcessor, MaxUploadSizeProvider and MediaOptimizationConfigProvider. The MediaSender doc explains the two-step shape of the API, which the individual signatures do not convey: pre-processing and sending are separate so a preview can be shown in between, and the temporary files that pre-processing creates are only released by cleanUp, whether or not anything was ultimately sent. Co-Authored-By: Claude Opus 5 (1M context) --- .../mediaupload/api/MaxUploadSizeProvider.kt | 1 + .../api/MediaOptimizationConfigProvider.kt | 4 ++ .../mediaupload/api/MediaPreProcessor.kt | 8 +++ .../libraries/mediaupload/api/MediaSender.kt | 58 +++++++++++++++++++ 4 files changed, 71 insertions(+) diff --git a/libraries/mediaupload/api/src/main/kotlin/io/element/android/libraries/mediaupload/api/MaxUploadSizeProvider.kt b/libraries/mediaupload/api/src/main/kotlin/io/element/android/libraries/mediaupload/api/MaxUploadSizeProvider.kt index a5462a6caf..e6b9c7f026 100644 --- a/libraries/mediaupload/api/src/main/kotlin/io/element/android/libraries/mediaupload/api/MaxUploadSizeProvider.kt +++ b/libraries/mediaupload/api/src/main/kotlin/io/element/android/libraries/mediaupload/api/MaxUploadSizeProvider.kt @@ -12,5 +12,6 @@ package io.element.android.libraries.mediaupload.api * Provides the maximum upload size allowed by the Matrix server. */ fun interface MaxUploadSizeProvider { + /** Returns the maximum size in bytes a single upload may have, as advertised by the homeserver. */ suspend fun getMaxUploadSize(): Result } diff --git a/libraries/mediaupload/api/src/main/kotlin/io/element/android/libraries/mediaupload/api/MediaOptimizationConfigProvider.kt b/libraries/mediaupload/api/src/main/kotlin/io/element/android/libraries/mediaupload/api/MediaOptimizationConfigProvider.kt index 976a7057f2..60dbf353eb 100644 --- a/libraries/mediaupload/api/src/main/kotlin/io/element/android/libraries/mediaupload/api/MediaOptimizationConfigProvider.kt +++ b/libraries/mediaupload/api/src/main/kotlin/io/element/android/libraries/mediaupload/api/MediaOptimizationConfigProvider.kt @@ -8,6 +8,10 @@ package io.element.android.libraries.mediaupload.api +/** + * Resolves how aggressively media should be compressed, combining the user's own preferences with the app defaults. + */ fun interface MediaOptimizationConfigProvider { + /** Returns the configuration to pass to the pre-processing and sending calls. */ suspend fun get(): MediaOptimizationConfig } diff --git a/libraries/mediaupload/api/src/main/kotlin/io/element/android/libraries/mediaupload/api/MediaPreProcessor.kt b/libraries/mediaupload/api/src/main/kotlin/io/element/android/libraries/mediaupload/api/MediaPreProcessor.kt index c2bf1e5f5d..a51ebc17b9 100644 --- a/libraries/mediaupload/api/src/main/kotlin/io/element/android/libraries/mediaupload/api/MediaPreProcessor.kt +++ b/libraries/mediaupload/api/src/main/kotlin/io/element/android/libraries/mediaupload/api/MediaPreProcessor.kt @@ -10,10 +10,18 @@ package io.element.android.libraries.mediaupload.api import android.net.Uri +/** + * Prepares a media file for upload: resizing, transcoding and stripping metadata that would leak information about the sender. + */ interface MediaPreProcessor { /** * Given a [uri] and [mimeType], pre-processes the media before it's uploaded, resizing, transcoding, and removing sensitive info from its metadata. * If [deleteOriginal] is `true`, the file reference by the [uri] will be automatically deleted too when this process finishes. + * + * @param uri the media to process. + * @param mimeType the MIME type of that media. + * @param deleteOriginal whether to delete the source file once processing is done. + * @param mediaOptimizationConfig how aggressively the media should be compressed. * @return a [Result] with the [MediaUploadInfo] containing all the info needed to begin the upload. */ suspend fun process( diff --git a/libraries/mediaupload/api/src/main/kotlin/io/element/android/libraries/mediaupload/api/MediaSender.kt b/libraries/mediaupload/api/src/main/kotlin/io/element/android/libraries/mediaupload/api/MediaSender.kt index 6cca73935e..808575f9e6 100644 --- a/libraries/mediaupload/api/src/main/kotlin/io/element/android/libraries/mediaupload/api/MediaSender.kt +++ b/libraries/mediaupload/api/src/main/kotlin/io/element/android/libraries/mediaupload/api/MediaSender.kt @@ -13,31 +13,62 @@ import io.element.android.libraries.matrix.api.core.EventId import io.element.android.libraries.matrix.api.room.JoinedRoom import io.element.android.libraries.matrix.api.timeline.Timeline +/** + * Creates a [MediaSender] for the room of the current room scope; see [MediaSenderRoomFactory] when the room is not in scope. + */ fun interface MediaSenderFactory { /** * Create a [MediaSender] for the given [Timeline.Mode], in the Room Scope. + * + * @param timelineMode the timeline the media should be sent to, which matters for threads in particular. */ fun create( timelineMode: Timeline.Mode, ): MediaSender } +/** + * Creates a [MediaSender] for an explicitly given room, used outside the room scope, for instance when sharing into a room. + */ fun interface MediaSenderRoomFactory { /** * Create a [MediaSender] for the given [JoinedRoom], with timeline mode Live. + * + * @param room the room the media should be sent to. */ fun create( room: JoinedRoom, ): MediaSender } +/** + * Sends media to a room, taking care of the pre-processing the timeline API does not do: resizing, transcoding and stripping metadata. + * + * Sending is a two-step process, and the steps can be used separately so the UI can show a preview between them. + * The temporary files produced by pre-processing are only released by [cleanUp]. + */ interface MediaSender { + /** + * Resizes, transcodes and strips the metadata of a media file without sending anything yet. + * + * @param uri the media picked by the user. + * @param mimeType the MIME type of that media. + * @param mediaOptimizationConfig how aggressively the media should be compressed. + */ suspend fun preProcessMedia( uri: Uri, mimeType: String, mediaOptimizationConfig: MediaOptimizationConfig, ): Result + /** + * Sends media that has already gone through [preProcessMedia]. + * + * @param mediaUploadInfo the result of the pre-processing step. + * @param caption the text shown along with the media, or `null` for none. + * @param formattedCaption the caption as HTML, or `null` to send it unformatted. + * @param inReplyToEventId the event this message replies to, or `null` if it is not a reply. + */ suspend fun sendPreProcessedMedia( mediaUploadInfo: MediaUploadInfo, caption: String?, @@ -45,6 +76,16 @@ interface MediaSender { inReplyToEventId: EventId?, ): Result + /** + * Pre-processes and sends a media file in one go, suspending until the upload finishes. + * + * @param uri the media picked by the user. + * @param mimeType the MIME type of that media. + * @param caption the text shown along with the media, or `null` for none. + * @param formattedCaption the caption as HTML, or `null` to send it unformatted. + * @param inReplyToEventId the event this message replies to, or `null` if it is not a reply. + * @param mediaOptimizationConfig how aggressively the media should be compressed. + */ suspend fun sendMedia( uri: Uri, mimeType: String, @@ -54,6 +95,14 @@ interface MediaSender { mediaOptimizationConfig: MediaOptimizationConfig, ): Result + /** + * Sends a recorded voice message, which is never compressed and carries a waveform instead of a caption. + * + * @param uri the recorded audio file. + * @param mimeType the MIME type of that recording. + * @param waveForm the amplitudes used to draw the waveform. + * @param inReplyToEventId the event this message replies to, or `null` if it is not a reply. + */ suspend fun sendVoiceMessage( uri: Uri, mimeType: String, @@ -61,6 +110,14 @@ interface MediaSender { inReplyToEventId: EventId? = null, ): Result + /** + * Sends several already pre-processed media items as a single gallery message. + * + * @param mediaUploadInfos the pre-processed items, in the order they should appear. + * @param caption the text shown along with the gallery, or `null` for none. + * @param formattedCaption the caption as HTML, or `null` to send it unformatted. + * @param inReplyToEventId the event this message replies to, or `null` if it is not a reply. + */ suspend fun sendGallery( mediaUploadInfos: List, caption: String?, @@ -68,5 +125,6 @@ interface MediaSender { inReplyToEventId: EventId?, ): Result + /** Deletes the temporary files produced by pre-processing; must be called even when nothing was ultimately sent. */ fun cleanUp() } From c6af196bf0ca6008e9c0a0f750b902791b265a40 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 09:50:08 +0200 Subject: [PATCH 064/145] Add KDoc to the `libraries/wellknown` API interfaces Document WellknownRetriever, ElementWellknownStore, ElementWellKnownParser and their factories, along with every member. The caching semantics are the part callers need and cannot see in the signatures, so they are recorded here: the store reports entries older than a day as outdated rather than missing, the retriever returns such a value immediately and refreshes in the background, an enterprise build with a hardcoded configuration short-circuits entirely, and the parser ignores unknown JSON fields. Co-Authored-By: Claude Opus 5 (1M context) --- .../wellknown/api/ElementWellKnownParser.kt | 8 +++++ .../wellknown/api/ElementWellknownStore.kt | 29 +++++++++++++++++++ .../wellknown/api/WellknownRetriever.kt | 17 +++++++++++ 3 files changed, 54 insertions(+) diff --git a/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellKnownParser.kt b/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellKnownParser.kt index db0a323a5f..1466a5b422 100644 --- a/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellKnownParser.kt +++ b/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellKnownParser.kt @@ -7,6 +7,14 @@ package io.element.android.libraries.wellknown.api +/** + * Parses the raw JSON of an Element `.well-known` document. + */ fun interface ElementWellKnownParser { + /** + * Parses the document, failing when it is not valid JSON; unknown fields are ignored so a newer server does not break an older client. + * + * @param json the raw document as served by the server. + */ fun parse(json: String): Result } diff --git a/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellknownStore.kt b/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellknownStore.kt index abb1cf53c7..93256fa6f1 100644 --- a/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellknownStore.kt +++ b/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellknownStore.kt @@ -7,12 +7,41 @@ package io.element.android.libraries.wellknown.api +/** + * On-disk cache of the Element `.well-known` documents already fetched, so the app has a configuration to work with while offline. + */ interface ElementWellknownStore { + /** + * Reads the cached document of a domain. + * Entries older than a day are reported as outdated rather than missing, so the caller can use them while refreshing; + * a document that no longer parses is reported as an error. + * + * @param domain the server whose cached document is requested. + */ suspend fun get(domain: String): WellknownRetrieverResult + + /** + * Stores the document of a domain and stamps it as fetched now, replacing any previous entry. + * + * @param domain the server the document belongs to. + * @param wellknown the raw document, stored as-is rather than parsed. + */ suspend fun update(domain: String, wellknown: String): Result + + /** + * Removes the cached document of a domain, used when the stored value turns out to be unusable. + * + * @param domain the server whose entry is removed. + */ suspend fun delete(domain: String): Result + /** + * Creates a store, one per configuration source so that their entries never collide. + */ fun interface Factory { + /** + * @param prefix namespaces the cache keys, or `null` for the default well-known endpoint. + */ fun create(prefix: String?): ElementWellknownStore } } diff --git a/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/WellknownRetriever.kt b/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/WellknownRetriever.kt index 56d251426a..9e265bc213 100644 --- a/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/WellknownRetriever.kt +++ b/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/WellknownRetriever.kt @@ -10,13 +10,30 @@ package io.element.android.libraries.wellknown.api import io.element.android.libraries.matrix.api.UrlContentFetcher +/** + * Retrieves the Element specific `.well-known` configuration of a server, which is how a deployment advertises its own settings. + */ interface WellknownRetriever { + /** + * Returns the configuration of a host, served from the local cache when possible. + * A cached value that has gone stale is returned as outdated while a refresh runs in the background, so this rarely waits on the network. + * An enterprise build with a hardcoded configuration always short-circuits and returns that instead. + * + * @param host the server to look up; a full URL is accepted and reduced to its host. + * @param source which endpoint to read the configuration from, which also selects the cache it is stored in. + */ suspend fun getElementWellKnown( host: String, source: EnterpriseRemoteConfigSource ): WellknownRetrieverResult + /** + * Creates a retriever, which needs a fetcher because the configuration is read over HTTP. + */ interface Factory { + /** + * @param urlContentFetcher used to perform the request; a client that is not authenticated yet also works. + */ fun create(urlContentFetcher: UrlContentFetcher): WellknownRetriever } } From a90801bcecde0c7b428bce6514ad33c3668ab84d Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 09:56:28 +0200 Subject: [PATCH 065/145] Add KDoc to the `libraries/pushstore` API interfaces Document UserPushStore, UserPushStoreFactory, PushClientSecret, PushClientSecretStore and PushClientSecretFactory along with all their members. The client secret interfaces now explain why they exist at all: a push gateway delivers notifications without saying which account they belong to, so the secret is what lets an incoming push be attributed back to a session. Co-Authored-By: Claude Opus 5 (1M context) --- .../libraries/pushstore/api/UserPushStore.kt | 22 +++++++++++++++ .../pushstore/api/UserPushStoreFactory.kt | 5 ++++ .../api/clientsecret/PushClientSecret.kt | 9 ++++++ .../clientsecret/PushClientSecretFactory.kt | 4 +++ .../api/clientsecret/PushClientSecretStore.kt | 28 +++++++++++++++++++ 5 files changed, 68 insertions(+) diff --git a/libraries/pushstore/api/src/main/kotlin/io/element/android/libraries/pushstore/api/UserPushStore.kt b/libraries/pushstore/api/src/main/kotlin/io/element/android/libraries/pushstore/api/UserPushStore.kt index 8a1b2f9f21..cec03e3c78 100644 --- a/libraries/pushstore/api/src/main/kotlin/io/element/android/libraries/pushstore/api/UserPushStore.kt +++ b/libraries/pushstore/api/src/main/kotlin/io/element/android/libraries/pushstore/api/UserPushStore.kt @@ -13,15 +13,36 @@ import kotlinx.coroutines.flow.Flow * Store data related to push about a user. */ interface UserPushStore { + /** The push provider selected for this user, or `null` when none has been selected yet. */ suspend fun getPushProviderName(): String? + + /** + * @param value the name of the push provider to remember for this user. + */ suspend fun setPushProviderName(value: String) + + /** The push key last registered with the homeserver, used to detect that a re-registration is needed; `null` when never registered. */ suspend fun getCurrentRegisteredPushKey(): String? + + /** + * @param value the push key that has just been registered, or `null` to forget it after unregistering. + */ suspend fun setCurrentRegisteredPushKey(value: String?) + /** Whether the user has enabled notifications on this device. */ fun getNotificationEnabledForDevice(): Flow + + /** + * @param enabled true to enable notifications on this device. + */ suspend fun setNotificationEnabledForDevice(enabled: Boolean) + /** Whether the user has asked not to be warned about pusher registration failures. */ fun ignoreRegistrationError(): Flow + + /** + * @param ignore true to stop warning the user about registration failures. + */ suspend fun setIgnoreRegistrationError(ignore: Boolean) /** @@ -29,5 +50,6 @@ interface UserPushStore { */ fun useCompleteNotificationFormat(): Boolean + /** Erases every push preference of this user, to be called when their session is removed. */ suspend fun reset() } diff --git a/libraries/pushstore/api/src/main/kotlin/io/element/android/libraries/pushstore/api/UserPushStoreFactory.kt b/libraries/pushstore/api/src/main/kotlin/io/element/android/libraries/pushstore/api/UserPushStoreFactory.kt index 78571d8b30..5210602e6c 100644 --- a/libraries/pushstore/api/src/main/kotlin/io/element/android/libraries/pushstore/api/UserPushStoreFactory.kt +++ b/libraries/pushstore/api/src/main/kotlin/io/element/android/libraries/pushstore/api/UserPushStoreFactory.kt @@ -14,5 +14,10 @@ import io.element.android.libraries.matrix.api.core.SessionId * Store data related to push about a user. */ interface UserPushStoreFactory { + /** + * Returns the push store of a user, creating it on first use. + * + * @param userId the user whose store is requested. + */ fun getOrCreate(userId: SessionId): UserPushStore } diff --git a/libraries/pushstore/api/src/main/kotlin/io/element/android/libraries/pushstore/api/clientsecret/PushClientSecret.kt b/libraries/pushstore/api/src/main/kotlin/io/element/android/libraries/pushstore/api/clientsecret/PushClientSecret.kt index da3ea946f0..a2f4c0ce3b 100644 --- a/libraries/pushstore/api/src/main/kotlin/io/element/android/libraries/pushstore/api/clientsecret/PushClientSecret.kt +++ b/libraries/pushstore/api/src/main/kotlin/io/element/android/libraries/pushstore/api/clientsecret/PushClientSecret.kt @@ -10,15 +10,24 @@ package io.element.android.libraries.pushstore.api.clientsecret import io.element.android.libraries.matrix.api.core.SessionId +/** + * Manages the per-session client secret sent along with a pusher registration. + * + * Push gateways deliver notifications without saying which account they belong to, so the secret is what lets an incoming push be attributed to a session. + */ interface PushClientSecret { /** * To call when registering a pusher. It will return the existing secret or create a new one. + * + * @param userId the user the pusher is being registered for. */ suspend fun getSecretForUser(userId: SessionId): String /** * To call when receiving a push containing a client secret. * Return null if not found. + * + * @param clientSecret the secret carried by the incoming push. */ suspend fun getUserIdFromSecret(clientSecret: String): SessionId? } diff --git a/libraries/pushstore/api/src/main/kotlin/io/element/android/libraries/pushstore/api/clientsecret/PushClientSecretFactory.kt b/libraries/pushstore/api/src/main/kotlin/io/element/android/libraries/pushstore/api/clientsecret/PushClientSecretFactory.kt index d7ea7d5239..0b425b0115 100644 --- a/libraries/pushstore/api/src/main/kotlin/io/element/android/libraries/pushstore/api/clientsecret/PushClientSecretFactory.kt +++ b/libraries/pushstore/api/src/main/kotlin/io/element/android/libraries/pushstore/api/clientsecret/PushClientSecretFactory.kt @@ -8,6 +8,10 @@ package io.element.android.libraries.pushstore.api.clientsecret +/** + * Generates the client secrets used to attribute an incoming push to a session; see [PushClientSecret] for how they are used. + */ interface PushClientSecretFactory { + /** Returns a new random secret. */ fun create(): String } diff --git a/libraries/pushstore/api/src/main/kotlin/io/element/android/libraries/pushstore/api/clientsecret/PushClientSecretStore.kt b/libraries/pushstore/api/src/main/kotlin/io/element/android/libraries/pushstore/api/clientsecret/PushClientSecretStore.kt index ecb87b2b14..c325042ff8 100644 --- a/libraries/pushstore/api/src/main/kotlin/io/element/android/libraries/pushstore/api/clientsecret/PushClientSecretStore.kt +++ b/libraries/pushstore/api/src/main/kotlin/io/element/android/libraries/pushstore/api/clientsecret/PushClientSecretStore.kt @@ -10,9 +10,37 @@ package io.element.android.libraries.pushstore.api.clientsecret import io.element.android.libraries.matrix.api.core.SessionId +/** + * Persists the mapping between sessions and their push client secrets, in both directions. + */ interface PushClientSecretStore { + /** + * Stores the secret of a user, replacing any previous one. + * + * @param userId the user the secret belongs to. + * @param clientSecret the secret to store. + */ suspend fun storeSecret(userId: SessionId, clientSecret: String) + + /** + * Returns the stored secret of a user, or `null` when they have none yet. + * + * @param userId the user whose secret is requested. + */ suspend fun getSecret(userId: SessionId): String? + + /** + * Forgets the secret of a user, to be called when their session is removed. + * + * @param userId the user whose secret is erased. + */ suspend fun resetSecret(userId: SessionId) + + /** + * Reverse lookup used when a push arrives carrying only a secret. + * + * @param clientSecret the secret to resolve. + * @return the user it belongs to, or `null` when no session matches. + */ suspend fun getUserIdFromSecret(clientSecret: String): SessionId? } From 0a47aefdf70597334ffbbb6d1aebdc4ca3175966 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 09:57:38 +0200 Subject: [PATCH 066/145] Add KDoc to the `libraries/permissions` API interfaces Document PermissionsStore, PermissionStateProvider, LocalNetworkPermissionAdvisor and the PermissionsPresenter factory, along with their members and parameters. The store doc explains why the module exists: Android does not let an app distinguish "never asked" from "asked and denied", so the app has to remember that itself in order to decide whether it may show a rationale. Co-Authored-By: Claude Opus 5 (1M context) --- .../api/PermissionStateProvider.kt | 29 ++++++++++++++++++ .../permissions/api/PermissionsPresenter.kt | 6 ++++ .../permissions/api/PermissionsStore.kt | 30 +++++++++++++++++++ .../LocalNetworkPermissionAdvisor.kt | 5 ++++ 4 files changed, 70 insertions(+) diff --git a/libraries/permissions/api/src/main/kotlin/io/element/android/libraries/permissions/api/PermissionStateProvider.kt b/libraries/permissions/api/src/main/kotlin/io/element/android/libraries/permissions/api/PermissionStateProvider.kt index beeef0b234..98fb3edbe0 100644 --- a/libraries/permissions/api/src/main/kotlin/io/element/android/libraries/permissions/api/PermissionStateProvider.kt +++ b/libraries/permissions/api/src/main/kotlin/io/element/android/libraries/permissions/api/PermissionStateProvider.kt @@ -10,11 +10,40 @@ package io.element.android.libraries.permissions.api import kotlinx.coroutines.flow.Flow +/** + * Answers permission questions by combining the live system state with what [PermissionsStore] remembers about past requests. + */ interface PermissionStateProvider { + /** + * Whether the permission is granted right now, read from the system rather than from the store. + * + * @param permission the Android permission name. + */ fun isPermissionGranted(permission: String): Boolean + + /** + * @param permission the Android permission name. + * @param value true once the user has refused this permission. + */ suspend fun setPermissionDenied(permission: String, value: Boolean) + + /** + * Whether the user has refused this permission before. + * + * @param permission the Android permission name. + */ fun isPermissionDenied(permission: String): Flow + /** + * @param permission the Android permission name. + * @param value true once the system dialog for this permission has been shown. + */ suspend fun setPermissionAsked(permission: String, value: Boolean) + + /** + * Whether the system dialog for this permission has already been shown. + * + * @param permission the Android permission name. + */ fun isPermissionAsked(permission: String): Flow } diff --git a/libraries/permissions/api/src/main/kotlin/io/element/android/libraries/permissions/api/PermissionsPresenter.kt b/libraries/permissions/api/src/main/kotlin/io/element/android/libraries/permissions/api/PermissionsPresenter.kt index f2ccb2bfc3..07918d0c86 100644 --- a/libraries/permissions/api/src/main/kotlin/io/element/android/libraries/permissions/api/PermissionsPresenter.kt +++ b/libraries/permissions/api/src/main/kotlin/io/element/android/libraries/permissions/api/PermissionsPresenter.kt @@ -11,7 +11,13 @@ package io.element.android.libraries.permissions.api import io.element.android.libraries.architecture.Presenter interface PermissionsPresenter : Presenter { + /** + * Creates a presenter dedicated to one permission. + */ interface Factory { + /** + * @param permission the Android permission name this presenter will request. + */ fun create(permission: String): PermissionsPresenter } } diff --git a/libraries/permissions/api/src/main/kotlin/io/element/android/libraries/permissions/api/PermissionsStore.kt b/libraries/permissions/api/src/main/kotlin/io/element/android/libraries/permissions/api/PermissionsStore.kt index 3bb7d2c679..0bf7f0aefd 100644 --- a/libraries/permissions/api/src/main/kotlin/io/element/android/libraries/permissions/api/PermissionsStore.kt +++ b/libraries/permissions/api/src/main/kotlin/io/element/android/libraries/permissions/api/PermissionsStore.kt @@ -10,15 +10,45 @@ package io.element.android.libraries.permissions.api import kotlinx.coroutines.flow.Flow +/** + * Remembers what the app has already asked the user about, since Android itself does not let an app tell + * "never asked" apart from "asked and denied". + */ interface PermissionsStore { + /** + * @param permission the Android permission name. + * @param value true once the user has refused this permission. + */ suspend fun setPermissionDenied(permission: String, value: Boolean) + + /** + * Whether the user has refused this permission before. + * + * @param permission the Android permission name. + */ fun isPermissionDenied(permission: String): Flow + /** + * @param permission the Android permission name. + * @param value true once the system dialog for this permission has been shown. + */ suspend fun setPermissionAsked(permission: String, value: Boolean) + + /** + * Whether the system dialog for this permission has already been shown, which decides whether the app may show a rationale instead. + * + * @param permission the Android permission name. + */ fun isPermissionAsked(permission: String): Flow + /** + * Forgets what was recorded about one permission, so the app behaves as if it had never been requested. + * + * @param permission the Android permission name. + */ suspend fun resetPermission(permission: String) + /** Forgets every recorded permission; exposed for debugging from the developer options. */ // To debug suspend fun resetStore() } diff --git a/libraries/permissions/api/src/main/kotlin/io/element/android/libraries/permissions/api/localnetwork/LocalNetworkPermissionAdvisor.kt b/libraries/permissions/api/src/main/kotlin/io/element/android/libraries/permissions/api/localnetwork/LocalNetworkPermissionAdvisor.kt index 9863dbb751..8d801cfe67 100644 --- a/libraries/permissions/api/src/main/kotlin/io/element/android/libraries/permissions/api/localnetwork/LocalNetworkPermissionAdvisor.kt +++ b/libraries/permissions/api/src/main/kotlin/io/element/android/libraries/permissions/api/localnetwork/LocalNetworkPermissionAdvisor.kt @@ -7,10 +7,15 @@ package io.element.android.libraries.permissions.api.localnetwork +/** + * Decides whether the local network permission is needed to reach a homeserver, which is the case for a server on the user's own network. + */ interface LocalNetworkPermissionAdvisor { /** * Returns true when the app should request the ACCESS_LOCAL_NETWORK permission before making * network requests to [homeserverUrl]. + * + * @param homeserverUrl the server the app is about to contact. */ suspend fun shouldRequestPermissionFor(homeserverUrl: String): Boolean } From 7f3d896a3e449ee207c83a286c86d4491fa49df5 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 10:01:14 +0200 Subject: [PATCH 067/145] Add KDoc to the `features/enterprise` API interfaces Document EnterpriseService, SessionEnterpriseService and RemoteEnterpriseConfigProvider along with all their members and parameters. Two points that callers get wrong are stated explicitly: these services return permissive defaults on a standard build, so there is no need to branch on the build type, and SessionEnterpriseService only answers meaningfully once init has run. The many nullable getters now say what null means in each case, which is generally "no override, use the app default". Co-Authored-By: Claude Opus 5 (1M context) --- .../enterprise/api/EnterpriseService.kt | 54 +++++++++++++++++++ .../api/SessionEnterpriseService.kt | 14 +++++ .../RemoteEnterpriseConfigProvider.kt | 12 +++++ 3 files changed, 80 insertions(+) diff --git a/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/EnterpriseService.kt b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/EnterpriseService.kt index a435b53e48..7d23ad0ea1 100644 --- a/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/EnterpriseService.kt +++ b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/EnterpriseService.kt @@ -15,11 +15,41 @@ import io.element.android.libraries.matrix.api.core.SessionId import io.element.android.libraries.wellknown.api.ElementWellKnown import kotlinx.coroutines.flow.Flow +/** + * Exposes the restrictions and customisations an enterprise deployment can impose: allowed homeservers, branding, push gateways and more. + * + * On a standard build this reports permissive defaults, so callers do not need to branch on the build type themselves. + */ interface EnterpriseService { + /** Whether this build is an enterprise one; `false` for the public app. */ val isEnterpriseBuild: Boolean + + /** + * Whether the given session belongs to an enterprise deployment, which can be true even on a standard build. + * + * @param sessionId the session to check. + */ suspend fun isEnterpriseUser(sessionId: SessionId): Boolean + + /** + * Rewrites the authentication server URL when the deployment requires a different one from the one advertised. + * + * @param url the URL to rewrite. + * @param homeserver the homeserver the URL belongs to. + * @param urlContentFetcher used to read the deployment configuration; a client that is not authenticated yet also works. + */ suspend fun tweakMasUrl(url: String, homeserver: String, urlContentFetcher: UrlContentFetcher): String + + /** + * The homeservers the user is allowed to sign in to; an empty list, or one containing [ANY_ACCOUNT_PROVIDER], means no restriction. + */ fun defaultHomeserverList(): List + + /** + * Whether the user is allowed to sign in to a given homeserver, according to [defaultHomeserverList]. + * + * @param homeserverUrl the server the user is trying to use. + */ suspend fun isAllowedToConnectToHomeserver(homeserverUrl: String): Boolean /** @@ -29,17 +59,38 @@ interface EnterpriseService { */ suspend fun overrideBrandColor(sessionId: SessionId?, brandColor: String?) + /** + * The brand color to apply, or `null` when the default theme color should be used. + * + * @param sessionId the session to read the color of, or `null` for the color used when no session is active. + */ fun brandColorsFlow(sessionId: SessionId?): Flow + /** + * The full light and dark color palettes derived from the brand color. + * + * @param sessionId the session to read the colors of, or `null` for the colors used when no session is active. + */ fun semanticColorsFlow(sessionId: SessionId?): Flow + /** The push gateway to register with when using Firebase, or `null` to use the app default. */ fun firebasePushGateway(): String? + + /** The push gateway to register with when using UnifiedPush, or `null` to use the app default. */ fun unifiedPushDefaultPushGateway(): String? + /** + * Where bug reports should be submitted, which an enterprise deployment can redirect or disable entirely. + * + * @param sessionId the session to read the setting of, or `null` for the setting used when no session is active. + */ fun bugReportUrlFlow(sessionId: SessionId?): Flow /** * Gets Notification Channel to use for the noisy notifications of the provided session. + * Returns `null` when the session has no dedicated channel and the app-wide one should be used. + * + * @param sessionId the session whose channel is requested. */ fun getNoisyNotificationChannelId(sessionId: SessionId): String? @@ -50,6 +101,9 @@ interface EnterpriseService { /** * Gets the Element Server Suite (ESS) config endpoint URL for the given domain. + * Returns `null` when this build does not read its configuration from an ESS deployment. + * + * @param domain the server whose configuration endpoint is requested. */ fun essConfigEndpointUrl(domain: String): String? diff --git a/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/SessionEnterpriseService.kt b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/SessionEnterpriseService.kt index ee005a0b6b..84067ce56f 100644 --- a/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/SessionEnterpriseService.kt +++ b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/SessionEnterpriseService.kt @@ -8,11 +8,25 @@ package io.element.android.features.enterprise.api +/** + * The session-scoped counterpart of [EnterpriseService], answering the same kind of questions for the session it belongs to. + * + * [init] must have run before the other members return meaningful answers. + */ interface SessionEnterpriseService { + /** Whether Element Call may be used on this session, which a deployment can turn off. */ suspend fun isElementCallAvailable(): Boolean + + /** + * Rewrites the authentication server URL for this session; see [EnterpriseService.tweakMasUrl]. + * + * @param url the URL to rewrite. + */ suspend fun tweakMasUrl(url: String): String + /** Whether the homeserver forbids creating encrypted rooms, in which case the app must not offer the option. */ suspend fun isEncryptionDisabledByHomeserver(): Boolean + /** Loads the deployment configuration of this session; to be called once when the session starts. */ suspend fun init() } diff --git a/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/RemoteEnterpriseConfigProvider.kt b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/RemoteEnterpriseConfigProvider.kt index adbcc5b31a..4507b1a72a 100644 --- a/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/RemoteEnterpriseConfigProvider.kt +++ b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/RemoteEnterpriseConfigProvider.kt @@ -15,9 +15,21 @@ import io.element.android.libraries.wellknown.api.WellknownRetrieverResult * Wrapper to fetch the remote enterprise configuration for a given [SessionId], either from a local cache or from a remote source. */ interface RemoteEnterpriseConfigProvider { + /** + * Returns the configuration of a session, served from the cache when possible. + * A stale entry is reported as outdated while a refresh runs in the background, so this rarely waits on the network. + * + * @param sessionId the session whose configuration is requested. + */ suspend fun get(sessionId: SessionId): WellknownRetrieverResult + /** + * Creates a provider, which needs a fetcher because the configuration is read over HTTP. + */ interface Factory { + /** + * @param urlContentFetcher used to perform the request; a client that is not authenticated yet also works. + */ fun create(urlContentFetcher: UrlContentFetcher): RemoteEnterpriseConfigProvider } } From 186d5b65b936b600d749b0565cc14fac25d461d8 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 10:02:48 +0200 Subject: [PATCH 068/145] Add KDoc to the `features/messages` API interfaces Document HtmlConverterProvider, MessageComposerContext, PinnedEventsTimelineProvider, the MessagesEntryPoint node proxy and the voice message composer factory. HtmlConverterProvider carries the ordering constraint that matters: the converter is rebuilt from the Compose theme, so Update has to be composed before provide is called. MessagesEntryPoint and its Callback are navigation plumbing and out of scope. Co-Authored-By: Claude Opus 5 (1M context) --- .../features/messages/api/MessageComposerContext.kt | 1 + .../android/features/messages/api/MessagesEntryPoint.kt | 9 +++++++++ .../messages/api/pinned/PinnedEventsTimelineProvider.kt | 5 +++++ .../messages/api/timeline/HtmlConverterProvider.kt | 7 +++++++ .../composer/VoiceMessageComposerPresenter.kt | 6 ++++++ 5 files changed, 28 insertions(+) diff --git a/features/messages/api/src/main/kotlin/io/element/android/features/messages/api/MessageComposerContext.kt b/features/messages/api/src/main/kotlin/io/element/android/features/messages/api/MessageComposerContext.kt index 534af8a5f9..12af1b32f2 100644 --- a/features/messages/api/src/main/kotlin/io/element/android/features/messages/api/MessageComposerContext.kt +++ b/features/messages/api/src/main/kotlin/io/element/android/features/messages/api/MessageComposerContext.kt @@ -17,5 +17,6 @@ import io.element.android.libraries.textcomposer.model.MessageComposerMode * the composer is in a thread, if it's editing a message, etc. */ interface MessageComposerContext { + /** What the composer is currently doing: writing a new message, editing one, replying, or composing in a thread. */ val composerMode: MessageComposerMode } diff --git a/features/messages/api/src/main/kotlin/io/element/android/features/messages/api/MessagesEntryPoint.kt b/features/messages/api/src/main/kotlin/io/element/android/features/messages/api/MessagesEntryPoint.kt index 3eecd54f3e..dd49dd0465 100644 --- a/features/messages/api/src/main/kotlin/io/element/android/features/messages/api/MessagesEntryPoint.kt +++ b/features/messages/api/src/main/kotlin/io/element/android/features/messages/api/MessagesEntryPoint.kt @@ -50,7 +50,16 @@ interface MessagesEntryPoint : FeatureEntryPoint { callback: Callback, ): Node + /** + * Lets callers outside this feature drive an already created messages node, for navigation that has to happen after it is attached. + */ interface NodeProxy { + /** + * Opens a thread on top of the messages screen, suspending until the thread node is attached. + * + * @param threadId the thread to open. + * @param focusedEventId the event to scroll to within the thread, or `null` to open at the latest message. + */ suspend fun attachThread(threadId: ThreadId, focusedEventId: EventId?) } } diff --git a/features/messages/api/src/main/kotlin/io/element/android/features/messages/api/pinned/PinnedEventsTimelineProvider.kt b/features/messages/api/src/main/kotlin/io/element/android/features/messages/api/pinned/PinnedEventsTimelineProvider.kt index 849b97479e..550373ed00 100644 --- a/features/messages/api/src/main/kotlin/io/element/android/features/messages/api/pinned/PinnedEventsTimelineProvider.kt +++ b/features/messages/api/src/main/kotlin/io/element/android/features/messages/api/pinned/PinnedEventsTimelineProvider.kt @@ -10,4 +10,9 @@ package io.element.android.features.messages.api.pinned import io.element.android.libraries.matrix.api.timeline.TimelineProvider +/** + * A [TimelineProvider] whose active timeline holds the pinned events of the room, rather than its live events. + * + * It exists as its own type so that it can be injected where only the pinned timeline is wanted. + */ interface PinnedEventsTimelineProvider : TimelineProvider diff --git a/features/messages/api/src/main/kotlin/io/element/android/features/messages/api/timeline/HtmlConverterProvider.kt b/features/messages/api/src/main/kotlin/io/element/android/features/messages/api/timeline/HtmlConverterProvider.kt index f44c996cac..baeb37e417 100644 --- a/features/messages/api/src/main/kotlin/io/element/android/features/messages/api/timeline/HtmlConverterProvider.kt +++ b/features/messages/api/src/main/kotlin/io/element/android/features/messages/api/timeline/HtmlConverterProvider.kt @@ -11,9 +11,16 @@ package io.element.android.features.messages.api.timeline import androidx.compose.runtime.Composable import io.element.android.wysiwyg.utils.HtmlConverter +/** + * Provides the converter that turns message HTML into styled text. + * + * The converter depends on the current theme and typography, so [Update] must be composed before [provide] is called. + */ interface HtmlConverterProvider { + /** Rebuilds the converter from the current Compose theme; call this once, high in the composition of a screen that renders messages. */ @Composable fun Update() + /** Returns the converter built by the last [Update] call. */ fun provide(): HtmlConverter } diff --git a/features/messages/api/src/main/kotlin/io/element/android/features/messages/api/timeline/voicemessages/composer/VoiceMessageComposerPresenter.kt b/features/messages/api/src/main/kotlin/io/element/android/features/messages/api/timeline/voicemessages/composer/VoiceMessageComposerPresenter.kt index 848f9fe82d..832d029e40 100644 --- a/features/messages/api/src/main/kotlin/io/element/android/features/messages/api/timeline/voicemessages/composer/VoiceMessageComposerPresenter.kt +++ b/features/messages/api/src/main/kotlin/io/element/android/features/messages/api/timeline/voicemessages/composer/VoiceMessageComposerPresenter.kt @@ -12,7 +12,13 @@ import io.element.android.libraries.architecture.Presenter import io.element.android.libraries.matrix.api.timeline.Timeline fun interface VoiceMessageComposerPresenter : Presenter { + /** + * Creates a presenter for one voice message composer. + */ interface Factory { + /** + * @param timelineMode the timeline the recording will be sent to, which matters for threads in particular. + */ fun create(timelineMode: Timeline.Mode): VoiceMessageComposerPresenter } } From bc6f237507b38fcf5e91769f3f60664fe04dc5b8 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 10:04:31 +0200 Subject: [PATCH 069/145] Add KDoc to the `features/invitepeople` API interfaces Document InvitePeopleState and each of its properties, InvitePeopleEvents, InvitePeopleRenderer and the presenter factory. The state properties now say what drives them, in particular that createRoomFromDmAction covers the case of inviting a third person into an existing direct message, and that the factory accepts a null room for that flow. Co-Authored-By: Claude Opus 5 (1M context) --- .../features/invitepeople/api/InvitePeopleEvents.kt | 3 +++ .../invitepeople/api/InvitePeoplePresenter.kt | 7 +++++++ .../invitepeople/api/InvitePeopleRenderer.kt | 9 +++++++++ .../features/invitepeople/api/InvitePeopleState.kt | 12 ++++++++++++ 4 files changed, 31 insertions(+) diff --git a/features/invitepeople/api/src/main/kotlin/io/element/android/features/invitepeople/api/InvitePeopleEvents.kt b/features/invitepeople/api/src/main/kotlin/io/element/android/features/invitepeople/api/InvitePeopleEvents.kt index 0422fac4f1..9570ab8152 100644 --- a/features/invitepeople/api/src/main/kotlin/io/element/android/features/invitepeople/api/InvitePeopleEvents.kt +++ b/features/invitepeople/api/src/main/kotlin/io/element/android/features/invitepeople/api/InvitePeopleEvents.kt @@ -8,6 +8,9 @@ package io.element.android.features.invitepeople.api +/** + * Events the invite people UI sends to its presenter through [InvitePeopleState.eventSink]. + */ interface InvitePeopleEvents { data object SendInvites : InvitePeopleEvents data object CloseSearch : InvitePeopleEvents diff --git a/features/invitepeople/api/src/main/kotlin/io/element/android/features/invitepeople/api/InvitePeoplePresenter.kt b/features/invitepeople/api/src/main/kotlin/io/element/android/features/invitepeople/api/InvitePeoplePresenter.kt index 0be0798680..1863397e48 100644 --- a/features/invitepeople/api/src/main/kotlin/io/element/android/features/invitepeople/api/InvitePeoplePresenter.kt +++ b/features/invitepeople/api/src/main/kotlin/io/element/android/features/invitepeople/api/InvitePeoplePresenter.kt @@ -13,7 +13,14 @@ import io.element.android.libraries.matrix.api.core.RoomId import io.element.android.libraries.matrix.api.room.JoinedRoom interface InvitePeoplePresenter : Presenter { + /** + * Creates a presenter for one invite flow. + */ interface Factory { + /** + * @param joinedRoom the room to invite into, or `null` when the room does not exist yet, as when inviting from a direct message. + * @param roomId the id of the room to invite into. + */ fun create( joinedRoom: JoinedRoom?, roomId: RoomId, diff --git a/features/invitepeople/api/src/main/kotlin/io/element/android/features/invitepeople/api/InvitePeopleRenderer.kt b/features/invitepeople/api/src/main/kotlin/io/element/android/features/invitepeople/api/InvitePeopleRenderer.kt index 7bad81ab65..0bbaa45a2f 100644 --- a/features/invitepeople/api/src/main/kotlin/io/element/android/features/invitepeople/api/InvitePeopleRenderer.kt +++ b/features/invitepeople/api/src/main/kotlin/io/element/android/features/invitepeople/api/InvitePeopleRenderer.kt @@ -11,7 +11,16 @@ package io.element.android.features.invitepeople.api import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +/** + * Renders the invite people UI, so that other screens can embed it without depending on its implementation. + */ interface InvitePeopleRenderer { + /** + * Draws the invite list and its search field. + * + * @param state the state produced by [InvitePeoplePresenter]. + * @param modifier layout modifier for the container. + */ @Composable fun Render( state: InvitePeopleState, diff --git a/features/invitepeople/api/src/main/kotlin/io/element/android/features/invitepeople/api/InvitePeopleState.kt b/features/invitepeople/api/src/main/kotlin/io/element/android/features/invitepeople/api/InvitePeopleState.kt index d14042cff7..0863ec7212 100644 --- a/features/invitepeople/api/src/main/kotlin/io/element/android/features/invitepeople/api/InvitePeopleState.kt +++ b/features/invitepeople/api/src/main/kotlin/io/element/android/features/invitepeople/api/InvitePeopleState.kt @@ -11,10 +11,22 @@ package io.element.android.features.invitepeople.api import io.element.android.libraries.architecture.AsyncAction import io.element.android.libraries.matrix.api.core.RoomId +/** + * State of the invite people UI, produced by an [InvitePeoplePresenter] and consumed by an [InvitePeopleRenderer]. + */ interface InvitePeopleState { + /** Whether the send button should be enabled, i.e. at least one user is selected and the user has the permission. */ val canInvite: Boolean + + /** Whether the search field currently has focus, which the host screen uses to adapt its own layout. */ val isSearchActive: Boolean + + /** Progress of the invite request, so the UI can show a loader and surface failures. */ val sendInvitesAction: AsyncAction + + /** Progress of turning a direct message into a room, which happens when inviting a third person into a DM. */ val createRoomFromDmAction: AsyncAction + + /** Where the UI sends its events. */ val eventSink: (InvitePeopleEvents) -> Unit } From 76411b07fb26551f7ebfaf211671265e547df2bb Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 10:05:31 +0200 Subject: [PATCH 070/145] Add KDoc to the `features/leaveroom` API interfaces Document LeaveRoomState, LeaveRoomEvent and LeaveRoomRenderer. The renderer doc records the two things a host screen needs to know, both taken from LeaveRoomPresenter and LeaveRoomView: it draws nothing until a leave event is sent, and onSelectNewOwners fires specifically when the user is the last owner of a room that still has other members. Co-Authored-By: Claude Opus 5 (1M context) --- .../android/features/leaveroom/api/LeaveRoomEvent.kt | 3 +++ .../features/leaveroom/api/LeaveRoomRenderer.kt | 10 ++++++++++ .../android/features/leaveroom/api/LeaveRoomState.kt | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/features/leaveroom/api/src/main/kotlin/io/element/android/features/leaveroom/api/LeaveRoomEvent.kt b/features/leaveroom/api/src/main/kotlin/io/element/android/features/leaveroom/api/LeaveRoomEvent.kt index 6d228ee887..f0c3eaf7bf 100644 --- a/features/leaveroom/api/src/main/kotlin/io/element/android/features/leaveroom/api/LeaveRoomEvent.kt +++ b/features/leaveroom/api/src/main/kotlin/io/element/android/features/leaveroom/api/LeaveRoomEvent.kt @@ -10,6 +10,9 @@ package io.element.android.features.leaveroom.api import io.element.android.libraries.matrix.api.core.RoomId +/** + * Events sent to the leave room presenter through [LeaveRoomState.eventSink]. + */ interface LeaveRoomEvent { data class LeaveRoom(val roomId: RoomId, val needsConfirmation: Boolean) : LeaveRoomEvent } diff --git a/features/leaveroom/api/src/main/kotlin/io/element/android/features/leaveroom/api/LeaveRoomRenderer.kt b/features/leaveroom/api/src/main/kotlin/io/element/android/features/leaveroom/api/LeaveRoomRenderer.kt index 852193d874..8472e098ec 100644 --- a/features/leaveroom/api/src/main/kotlin/io/element/android/features/leaveroom/api/LeaveRoomRenderer.kt +++ b/features/leaveroom/api/src/main/kotlin/io/element/android/features/leaveroom/api/LeaveRoomRenderer.kt @@ -12,7 +12,17 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import io.element.android.libraries.matrix.api.core.RoomId +/** + * Renders the confirmation dialogs of the leave room flow; it draws nothing until the host screen sends a leave event. + */ fun interface LeaveRoomRenderer { + /** + * Draws whichever dialog the current state calls for. + * + * @param state the state produced by the leave room presenter. + * @param onSelectNewOwners called when the user is the last owner of a room that still has other members, and must promote someone before leaving. + * @param modifier layout modifier for the container. + */ @Composable fun Render( state: LeaveRoomState, diff --git a/features/leaveroom/api/src/main/kotlin/io/element/android/features/leaveroom/api/LeaveRoomState.kt b/features/leaveroom/api/src/main/kotlin/io/element/android/features/leaveroom/api/LeaveRoomState.kt index 92a5916858..b9150b59f0 100644 --- a/features/leaveroom/api/src/main/kotlin/io/element/android/features/leaveroom/api/LeaveRoomState.kt +++ b/features/leaveroom/api/src/main/kotlin/io/element/android/features/leaveroom/api/LeaveRoomState.kt @@ -10,7 +10,11 @@ package io.element.android.features.leaveroom.api import androidx.compose.runtime.Immutable +/** + * State of the leave room flow, which is only the confirmation dialogs: the screen it is hosted in owns the rest of the UI. + */ @Immutable interface LeaveRoomState { + /** Where the host screen sends its events to start or confirm leaving a room. */ val eventSink: (LeaveRoomEvent) -> Unit } From 50214fe01a634e2e1b250fcc8cc963b476d585cb Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 10:06:47 +0200 Subject: [PATCH 071/145] Add KDoc to the `features/poll` API interfaces Document PollContentStateFactory, SendPollResponseAction and EndPollAction along with their members and parameters. The two action interfaces exist to wrap a plain timeline call, so their docs say what they add: both capture an analytics event on success, which is the reason callers should go through them rather than calling the timeline directly. Co-Authored-By: Claude Opus 5 (1M context) --- .../features/poll/api/actions/EndPollAction.kt | 7 +++++++ .../poll/api/actions/SendPollResponseAction.kt | 8 ++++++++ .../api/pollcontent/PollContentStateFactory.kt | 15 +++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/features/poll/api/src/main/kotlin/io/element/android/features/poll/api/actions/EndPollAction.kt b/features/poll/api/src/main/kotlin/io/element/android/features/poll/api/actions/EndPollAction.kt index a46a2db781..b33a00c165 100644 --- a/features/poll/api/src/main/kotlin/io/element/android/features/poll/api/actions/EndPollAction.kt +++ b/features/poll/api/src/main/kotlin/io/element/android/features/poll/api/actions/EndPollAction.kt @@ -11,6 +11,13 @@ package io.element.android.features.poll.api.actions import io.element.android.libraries.matrix.api.core.EventId import io.element.android.libraries.matrix.api.timeline.Timeline +/** + * Closes a poll so no further answers are accepted, wrapping the timeline call so the analytics are captured in one place. + */ interface EndPollAction { + /** + * @param timeline the timeline the poll lives in. + * @param pollStartId the poll start event to close. + */ suspend fun execute(timeline: Timeline, pollStartId: EventId): Result } diff --git a/features/poll/api/src/main/kotlin/io/element/android/features/poll/api/actions/SendPollResponseAction.kt b/features/poll/api/src/main/kotlin/io/element/android/features/poll/api/actions/SendPollResponseAction.kt index 00b60ed5ae..cbaace50fb 100644 --- a/features/poll/api/src/main/kotlin/io/element/android/features/poll/api/actions/SendPollResponseAction.kt +++ b/features/poll/api/src/main/kotlin/io/element/android/features/poll/api/actions/SendPollResponseAction.kt @@ -11,7 +11,15 @@ package io.element.android.features.poll.api.actions import io.element.android.libraries.matrix.api.core.EventId import io.element.android.libraries.matrix.api.timeline.Timeline +/** + * Sends the current user's answer to a poll, wrapping the timeline call so the analytics are captured in one place. + */ interface SendPollResponseAction { + /** + * @param timeline the timeline the poll lives in. + * @param pollStartId the poll start event being answered. + * @param answerId the id of the chosen answer. + */ suspend fun execute( timeline: Timeline, pollStartId: EventId, diff --git a/features/poll/api/src/main/kotlin/io/element/android/features/poll/api/pollcontent/PollContentStateFactory.kt b/features/poll/api/src/main/kotlin/io/element/android/features/poll/api/pollcontent/PollContentStateFactory.kt index c9bd31ea4f..87e3f5eece 100644 --- a/features/poll/api/src/main/kotlin/io/element/android/features/poll/api/pollcontent/PollContentStateFactory.kt +++ b/features/poll/api/src/main/kotlin/io/element/android/features/poll/api/pollcontent/PollContentStateFactory.kt @@ -12,7 +12,16 @@ import io.element.android.libraries.matrix.api.core.EventId import io.element.android.libraries.matrix.api.timeline.item.event.EventTimelineItem import io.element.android.libraries.matrix.api.timeline.item.event.PollContent +/** + * Turns the poll content of a timeline event into the state the poll UI renders. + */ interface PollContentStateFactory { + /** + * Convenience overload that reads the editability and ownership from the timeline item itself. + * + * @param eventTimelineItem the timeline item carrying the poll. + * @param content the poll content of that item. + */ suspend fun create(eventTimelineItem: EventTimelineItem, content: PollContent): PollContentState { return create( eventId = eventTimelineItem.eventId, @@ -21,5 +30,11 @@ interface PollContentStateFactory { content = content, ) } + /** + * @param eventId the poll start event, or `null` while the poll is still a local echo. + * @param isEditable whether the current user may still edit the poll. + * @param isOwn whether the poll was created by the current user. + * @param content the poll question, answers and votes. + */ suspend fun create(eventId: EventId?, isEditable: Boolean, isOwn: Boolean, content: PollContent): PollContentState } From 055fe408a64d045579838015b0045ccfc8c8d749 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 10:06:53 +0200 Subject: [PATCH 072/145] Add KDoc to the `features/roommembermoderation` API interfaces Document RoomMemberModerationState, RoomMemberModerationEvents and RoomMemberModerationRenderer along with their members and parameters. The renderer doc states that it draws nothing until the host screen asks for a member's actions, and that onSelectAction exists so the host can navigate for the actions that need a screen of their own. Co-Authored-By: Claude Opus 5 (1M context) --- .../api/RoomMemberModerationEvents.kt | 3 +++ .../api/RoomMemberModerationRenderer.kt | 11 +++++++++++ .../api/RoomMemberModerationState.kt | 6 ++++++ 3 files changed, 20 insertions(+) diff --git a/features/roommembermoderation/api/src/main/kotlin/io/element/android/features/roommembermoderation/api/RoomMemberModerationEvents.kt b/features/roommembermoderation/api/src/main/kotlin/io/element/android/features/roommembermoderation/api/RoomMemberModerationEvents.kt index 2238ff41df..d452ff4e66 100644 --- a/features/roommembermoderation/api/src/main/kotlin/io/element/android/features/roommembermoderation/api/RoomMemberModerationEvents.kt +++ b/features/roommembermoderation/api/src/main/kotlin/io/element/android/features/roommembermoderation/api/RoomMemberModerationEvents.kt @@ -10,6 +10,9 @@ package io.element.android.features.roommembermoderation.api import io.element.android.libraries.matrix.api.user.MatrixUser +/** + * Events sent to the moderation presenter through [RoomMemberModerationState.eventSink]. + */ interface RoomMemberModerationEvents { data class ShowActionsForUser(val user: MatrixUser) : RoomMemberModerationEvents data class ProcessAction(val action: ModerationAction, val targetUser: MatrixUser) : RoomMemberModerationEvents diff --git a/features/roommembermoderation/api/src/main/kotlin/io/element/android/features/roommembermoderation/api/RoomMemberModerationRenderer.kt b/features/roommembermoderation/api/src/main/kotlin/io/element/android/features/roommembermoderation/api/RoomMemberModerationRenderer.kt index efc87d8a40..7696f826a1 100644 --- a/features/roommembermoderation/api/src/main/kotlin/io/element/android/features/roommembermoderation/api/RoomMemberModerationRenderer.kt +++ b/features/roommembermoderation/api/src/main/kotlin/io/element/android/features/roommembermoderation/api/RoomMemberModerationRenderer.kt @@ -12,7 +12,18 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import io.element.android.libraries.matrix.api.user.MatrixUser +/** + * Renders the moderation action sheet and its confirmation dialogs; it draws nothing until the host screen asks for a member's actions. + */ interface RoomMemberModerationRenderer { + /** + * Draws whichever sheet or dialog the current state calls for. + * + * @param state the state produced by the moderation presenter. + * @param onSelectAction called when the user picks an action, so the host screen can navigate if that action needs its own screen. + * @param onAvatarClick called when the user taps the member's avatar, or `null` to make it non-interactive. + * @param modifier layout modifier for the container. + */ @Composable fun Render( state: RoomMemberModerationState, diff --git a/features/roommembermoderation/api/src/main/kotlin/io/element/android/features/roommembermoderation/api/RoomMemberModerationState.kt b/features/roommembermoderation/api/src/main/kotlin/io/element/android/features/roommembermoderation/api/RoomMemberModerationState.kt index c9ee958f6f..9227c77edf 100644 --- a/features/roommembermoderation/api/src/main/kotlin/io/element/android/features/roommembermoderation/api/RoomMemberModerationState.kt +++ b/features/roommembermoderation/api/src/main/kotlin/io/element/android/features/roommembermoderation/api/RoomMemberModerationState.kt @@ -10,9 +10,15 @@ package io.element.android.features.roommembermoderation.api import androidx.compose.runtime.Immutable +/** + * State of the member moderation flow, which is the action sheet and the confirmation dialogs shown for a room member. + */ @Immutable interface RoomMemberModerationState { + /** Which moderation actions the current user is allowed to perform, so the UI can hide or disable the rest. */ val permissions: RoomMemberModerationPermissions + + /** Where the host screen sends its events to open the actions of a member or run one of them. */ val eventSink: (RoomMemberModerationEvents) -> Unit } From c0848cee9d7b8a2ef9670dc3ddf0e5ccd2d8a2b7 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 10:28:47 +0200 Subject: [PATCH 073/145] Add KDoc to the `libraries/deeplink` API interfaces Document DeeplinkParser, DeepLinkCreator and InviteFriendsUseCase, including that DeepLinkCreator.create silently ignores the deeper arguments once an outer one is null. Co-Authored-By: Claude Opus 5 (1M context) --- .../android/libraries/deeplink/api/DeepLinkCreator.kt | 11 +++++++++++ .../android/libraries/deeplink/api/DeeplinkParser.kt | 7 +++++++ .../deeplink/api/usecase/InviteFriendsUseCase.kt | 6 ++++++ 3 files changed, 24 insertions(+) diff --git a/libraries/deeplink/api/src/main/kotlin/io/element/android/libraries/deeplink/api/DeepLinkCreator.kt b/libraries/deeplink/api/src/main/kotlin/io/element/android/libraries/deeplink/api/DeepLinkCreator.kt index 2b46b15e46..938939c6f0 100644 --- a/libraries/deeplink/api/src/main/kotlin/io/element/android/libraries/deeplink/api/DeepLinkCreator.kt +++ b/libraries/deeplink/api/src/main/kotlin/io/element/android/libraries/deeplink/api/DeepLinkCreator.kt @@ -13,6 +13,17 @@ import io.element.android.libraries.matrix.api.core.RoomId import io.element.android.libraries.matrix.api.core.SessionId import io.element.android.libraries.matrix.api.core.ThreadId +/** + * Builds the app's internal deep links, used to point a notification or a shortcut at a precise place in the app. + */ fun interface DeepLinkCreator { + /** + * Builds a link to the most precise target the arguments allow, ignoring the deeper ones once an outer one is `null`. + * + * @param sessionId the session to open. + * @param roomId the room to open, or `null` to stop at the room list. + * @param threadId the thread to open within that room, or `null` for the main timeline. + * @param eventId the event to focus on, or `null` to open at the latest message. + */ fun create(sessionId: SessionId, roomId: RoomId?, threadId: ThreadId?, eventId: EventId?): String } diff --git a/libraries/deeplink/api/src/main/kotlin/io/element/android/libraries/deeplink/api/DeeplinkParser.kt b/libraries/deeplink/api/src/main/kotlin/io/element/android/libraries/deeplink/api/DeeplinkParser.kt index f0f8640a2d..7a711d8a3a 100644 --- a/libraries/deeplink/api/src/main/kotlin/io/element/android/libraries/deeplink/api/DeeplinkParser.kt +++ b/libraries/deeplink/api/src/main/kotlin/io/element/android/libraries/deeplink/api/DeeplinkParser.kt @@ -10,6 +10,13 @@ package io.element.android.libraries.deeplink.api import android.content.Intent +/** + * Extracts the app's own deep link data from an incoming intent; see [DeepLinkCreator] for the other direction. + */ fun interface DeeplinkParser { + /** + * @param intent the intent the app was started or resumed with. + * @return the session, room and event to open, or `null` when the intent is not one of the app's deep links. + */ fun getFromIntent(intent: Intent): DeeplinkData? } diff --git a/libraries/deeplink/api/src/main/kotlin/io/element/android/libraries/deeplink/api/usecase/InviteFriendsUseCase.kt b/libraries/deeplink/api/src/main/kotlin/io/element/android/libraries/deeplink/api/usecase/InviteFriendsUseCase.kt index 64287f918c..2c4406a482 100644 --- a/libraries/deeplink/api/src/main/kotlin/io/element/android/libraries/deeplink/api/usecase/InviteFriendsUseCase.kt +++ b/libraries/deeplink/api/src/main/kotlin/io/element/android/libraries/deeplink/api/usecase/InviteFriendsUseCase.kt @@ -10,6 +10,12 @@ package io.element.android.libraries.deeplink.api.usecase import android.app.Activity +/** + * Opens the system share sheet with an invitation to install the app. + */ fun interface InviteFriendsUseCase { + /** + * @param activity the activity the share sheet is shown from. + */ fun execute(activity: Activity) } From 6446b30255c173a0a8a0b2bdeb2a2b58789ed687 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 10:28:48 +0200 Subject: [PATCH 074/145] Add KDoc to the `libraries/eventformatter` API interfaces Document RoomLatestEventFormatter, TimelineEventFormatter and PinnedMessagesBannerFormatter along with their members. The formatters return a nullable CharSequence, so each one now states what null means: the event is not rendered as text at all. Co-Authored-By: Claude Opus 5 (1M context) --- .../api/PinnedMessagesBannerFormatter.kt | 6 ++++++ .../api/RoomLatestEventFormatter.kt | 18 ++++++++++++++++++ .../api/TimelineEventFormatter.kt | 16 ++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/libraries/eventformatter/api/src/main/kotlin/io/element/android/libraries/eventformatter/api/PinnedMessagesBannerFormatter.kt b/libraries/eventformatter/api/src/main/kotlin/io/element/android/libraries/eventformatter/api/PinnedMessagesBannerFormatter.kt index 67994f18b9..986e5dfe32 100644 --- a/libraries/eventformatter/api/src/main/kotlin/io/element/android/libraries/eventformatter/api/PinnedMessagesBannerFormatter.kt +++ b/libraries/eventformatter/api/src/main/kotlin/io/element/android/libraries/eventformatter/api/PinnedMessagesBannerFormatter.kt @@ -10,6 +10,12 @@ package io.element.android.libraries.eventformatter.api import io.element.android.libraries.matrix.api.timeline.item.event.EventTimelineItem +/** + * Formats the short summary of a pinned event shown in the banner at the top of a room. + */ interface PinnedMessagesBannerFormatter { + /** + * @param event the pinned event to describe. + */ fun format(event: EventTimelineItem): CharSequence } diff --git a/libraries/eventformatter/api/src/main/kotlin/io/element/android/libraries/eventformatter/api/RoomLatestEventFormatter.kt b/libraries/eventformatter/api/src/main/kotlin/io/element/android/libraries/eventformatter/api/RoomLatestEventFormatter.kt index abb5cc929d..7ddc65f57b 100644 --- a/libraries/eventformatter/api/src/main/kotlin/io/element/android/libraries/eventformatter/api/RoomLatestEventFormatter.kt +++ b/libraries/eventformatter/api/src/main/kotlin/io/element/android/libraries/eventformatter/api/RoomLatestEventFormatter.kt @@ -10,7 +10,25 @@ package io.element.android.libraries.eventformatter.api import io.element.android.libraries.matrix.api.roomlist.LatestEventValue +/** + * Formats the one-line preview of a room's latest event, as shown in the room list. + */ interface RoomLatestEventFormatter { + /** + * Formats an event that is still local, i.e. queued or being sent. + * + * @param latestEvent the local event to describe. + * @param isDmRoom whether the room is a direct message, which lets the sender name be left out. + * @return the preview text, or `null` when this kind of event should not be previewed. + */ fun format(latestEvent: LatestEventValue.Local, isDmRoom: Boolean): CharSequence? + + /** + * Formats an event that has been received from the server. + * + * @param latestEvent the remote event to describe. + * @param isDmRoom whether the room is a direct message, which lets the sender name be left out. + * @return the preview text, or `null` when this kind of event should not be previewed. + */ fun format(latestEvent: LatestEventValue.Remote, isDmRoom: Boolean): CharSequence? } diff --git a/libraries/eventformatter/api/src/main/kotlin/io/element/android/libraries/eventformatter/api/TimelineEventFormatter.kt b/libraries/eventformatter/api/src/main/kotlin/io/element/android/libraries/eventformatter/api/TimelineEventFormatter.kt index be601fb82a..37081be242 100644 --- a/libraries/eventformatter/api/src/main/kotlin/io/element/android/libraries/eventformatter/api/TimelineEventFormatter.kt +++ b/libraries/eventformatter/api/src/main/kotlin/io/element/android/libraries/eventformatter/api/TimelineEventFormatter.kt @@ -13,7 +13,16 @@ import io.element.android.libraries.matrix.api.timeline.item.event.EventContent import io.element.android.libraries.matrix.api.timeline.item.event.EventTimelineItem import io.element.android.libraries.matrix.api.timeline.item.event.getDisambiguatedDisplayName +/** + * Turns a state or membership event into the human readable sentence shown in the timeline, such as "Alice joined the room". + */ interface TimelineEventFormatter { + /** + * Convenience overload that reads the sender and ownership from the timeline item itself. + * + * @param event the timeline item to describe. + * @return the sentence to display, or `null` when this kind of event is not rendered as text. + */ fun format(event: EventTimelineItem): CharSequence? { return format( content = event.content, @@ -22,5 +31,12 @@ interface TimelineEventFormatter { senderDisambiguatedDisplayName = event.senderProfile.getDisambiguatedDisplayName(event.sender), ) } + /** + * @param content the event content to describe. + * @param isOutgoing whether the event was sent by the current user, which selects the first-person wording. + * @param sender the user who sent the event. + * @param senderDisambiguatedDisplayName the sender's display name, already suffixed with their id when it is ambiguous in the room. + * @return the sentence to display, or `null` when this kind of event is not rendered as text. + */ fun format(content: EventContent, isOutgoing: Boolean, sender: UserId, senderDisambiguatedDisplayName: String): CharSequence? } From 1f3c73d3c6f0c4623df1af9836b6918202584618 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 10:28:56 +0200 Subject: [PATCH 075/145] Add KDoc to the `libraries/usersearch` API interfaces Document UserRepository and UserListDataSource along with their members. Two behaviours from MatrixUserRepository and MatrixUserListDataSource are recorded because callers rely on them: the data source swallows a failed directory request into an empty list, and a query that is a well-formed user id other than the current user's yields that user even when the directory does not know them. Co-Authored-By: Claude Opus 5 (1M context) --- .../usersearch/api/UserListDataSource.kt | 16 ++++++++++++++++ .../libraries/usersearch/api/UserRepository.kt | 9 +++++++++ 2 files changed, 25 insertions(+) diff --git a/libraries/usersearch/api/src/main/kotlin/io/element/android/libraries/usersearch/api/UserListDataSource.kt b/libraries/usersearch/api/src/main/kotlin/io/element/android/libraries/usersearch/api/UserListDataSource.kt index 0f7e02c7a8..9446668502 100644 --- a/libraries/usersearch/api/src/main/kotlin/io/element/android/libraries/usersearch/api/UserListDataSource.kt +++ b/libraries/usersearch/api/src/main/kotlin/io/element/android/libraries/usersearch/api/UserListDataSource.kt @@ -11,8 +11,24 @@ package io.element.android.libraries.usersearch.api import io.element.android.libraries.matrix.api.core.UserId import io.element.android.libraries.matrix.api.user.MatrixUser +/** + * Low-level access to the homeserver's user directory; see [UserRepository] for the search used by the UI. + */ interface UserListDataSource { + /** + * Searches the user directory, returning an empty list rather than failing when the request does not succeed. + * + * @param query the text to look for in user ids and display names. + * @param count the maximum number of results to return. + */ // TODO should probably have a flow suspend fun search(query: String, count: Long): List + + /** + * Fetches one user's profile. + * + * @param userId the user whose profile is requested. + * @return the profile, or `null` when it could not be retrieved. + */ suspend fun getProfile(userId: UserId): MatrixUser? } diff --git a/libraries/usersearch/api/src/main/kotlin/io/element/android/libraries/usersearch/api/UserRepository.kt b/libraries/usersearch/api/src/main/kotlin/io/element/android/libraries/usersearch/api/UserRepository.kt index f7e5367a9a..b3be565ca5 100644 --- a/libraries/usersearch/api/src/main/kotlin/io/element/android/libraries/usersearch/api/UserRepository.kt +++ b/libraries/usersearch/api/src/main/kotlin/io/element/android/libraries/usersearch/api/UserRepository.kt @@ -10,6 +10,15 @@ package io.element.android.libraries.usersearch.api import kotlinx.coroutines.flow.Flow +/** + * Searches for users to start a conversation with or invite, combining the homeserver directory with what the app already knows. + */ interface UserRepository { + /** + * Runs a search and emits its progress, so the UI can show local results before the directory answers. + * A query that is a well-formed user id other than the current user's also yields that user, even when the directory does not know them. + * + * @param query the text typed by the user. + */ fun search(query: String): Flow } From c561674221be81617255251c4c6d1ef397236b6a Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 10:28:56 +0200 Subject: [PATCH 076/145] Add KDoc to the `libraries/oauth` API interfaces Document OAuthIntentResolver and OAuthActionFlow along with their members. OAuthActionFlow now explains why it exists rather than the result simply being returned: the activity that receives the redirect and the login screen waiting for it are not in the same navigation subtree. Co-Authored-By: Claude Opus 5 (1M context) --- .../libraries/oauth/api/OAuthActionFlow.kt | 18 ++++++++++++++++++ .../libraries/oauth/api/OAuthIntentResolver.kt | 7 +++++++ 2 files changed, 25 insertions(+) diff --git a/libraries/oauth/api/src/main/kotlin/io/element/android/libraries/oauth/api/OAuthActionFlow.kt b/libraries/oauth/api/src/main/kotlin/io/element/android/libraries/oauth/api/OAuthActionFlow.kt index c6791e3197..7cb35de176 100644 --- a/libraries/oauth/api/src/main/kotlin/io/element/android/libraries/oauth/api/OAuthActionFlow.kt +++ b/libraries/oauth/api/src/main/kotlin/io/element/android/libraries/oauth/api/OAuthActionFlow.kt @@ -10,8 +10,26 @@ package io.element.android.libraries.oauth.api import kotlinx.coroutines.flow.FlowCollector +/** + * Carries the OAuth redirect from the activity that receives it to the login screen waiting for it. + * + * The two are not in the same navigation subtree, so the result cannot simply be returned. + */ interface OAuthActionFlow { + /** + * Publishes the action just received, to be picked up by whoever is collecting. + * + * @param oAuthAction the action resolved from the redirect intent. + */ fun post(oAuthAction: OAuthAction) + + /** + * Observes the published actions; `null` is emitted when there is nothing pending. + * + * @param collector the collector to feed. + */ suspend fun collect(collector: FlowCollector) + + /** Clears the pending action, so it is not handled twice. */ fun reset() } diff --git a/libraries/oauth/api/src/main/kotlin/io/element/android/libraries/oauth/api/OAuthIntentResolver.kt b/libraries/oauth/api/src/main/kotlin/io/element/android/libraries/oauth/api/OAuthIntentResolver.kt index 2091a86db4..5187649298 100644 --- a/libraries/oauth/api/src/main/kotlin/io/element/android/libraries/oauth/api/OAuthIntentResolver.kt +++ b/libraries/oauth/api/src/main/kotlin/io/element/android/libraries/oauth/api/OAuthIntentResolver.kt @@ -10,6 +10,13 @@ package io.element.android.libraries.oauth.api import android.content.Intent +/** + * Recognises the redirect the authentication server sends the user back with once they have signed in or cancelled. + */ interface OAuthIntentResolver { + /** + * @param intent the intent the app was resumed with. + * @return the action to carry out, or `null` when the intent is not an OAuth redirect. + */ fun resolve(intent: Intent): OAuthAction? } From aa7dc4fd0d85c49c3a39302119e049dd4f1bdc6b Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 10:31:33 +0200 Subject: [PATCH 077/145] Add KDoc to the `services/toolbox` API interfaces Add the interface level docs that StringProvider, SystemClock and BuildVersionSdkIntProvider were missing, document ExternalIntentLauncher.launch, and add the remaining @param entries. Each doc says why the abstraction exists rather than restating the signature: these wrap Context, Build.VERSION and the clock so that presenters can be tested without them. Co-Authored-By: Claude Opus 5 (1M context) --- .../toolbox/api/intent/ExternalIntentLauncher.kt | 5 +++++ .../toolbox/api/sdk/BuildVersionSdkIntProvider.kt | 11 +++++++++++ .../services/toolbox/api/strings/StringProvider.kt | 7 +++++++ .../services/toolbox/api/systemclock/SystemClock.kt | 4 ++++ 4 files changed, 27 insertions(+) diff --git a/services/toolbox/api/src/main/kotlin/io/element/android/services/toolbox/api/intent/ExternalIntentLauncher.kt b/services/toolbox/api/src/main/kotlin/io/element/android/services/toolbox/api/intent/ExternalIntentLauncher.kt index ba34a6a716..acd58c9f64 100644 --- a/services/toolbox/api/src/main/kotlin/io/element/android/services/toolbox/api/intent/ExternalIntentLauncher.kt +++ b/services/toolbox/api/src/main/kotlin/io/element/android/services/toolbox/api/intent/ExternalIntentLauncher.kt @@ -14,5 +14,10 @@ import android.content.Intent * Used to launch external intents from anywhere in the app. */ interface ExternalIntentLauncher { + /** + * Starts the given intent, doing nothing when no installed app can handle it. + * + * @param intent the intent to hand over to the system. + */ fun launch(intent: Intent) } diff --git a/services/toolbox/api/src/main/kotlin/io/element/android/services/toolbox/api/sdk/BuildVersionSdkIntProvider.kt b/services/toolbox/api/src/main/kotlin/io/element/android/services/toolbox/api/sdk/BuildVersionSdkIntProvider.kt index 26bbe23548..40b2b2aac8 100644 --- a/services/toolbox/api/src/main/kotlin/io/element/android/services/toolbox/api/sdk/BuildVersionSdkIntProvider.kt +++ b/services/toolbox/api/src/main/kotlin/io/element/android/services/toolbox/api/sdk/BuildVersionSdkIntProvider.kt @@ -10,6 +10,9 @@ package io.element.android.services.toolbox.api.sdk import androidx.annotation.ChecksSdkIntAtLeast +/** + * Exposes the running Android API level, injected rather than read from `Build.VERSION` so tests can pretend to be on any version. + */ interface BuildVersionSdkIntProvider { /** * Return the current version of the Android SDK. @@ -18,6 +21,9 @@ interface BuildVersionSdkIntProvider { /** * Checks the if the current OS version is equal or greater than [version]. + * + * @param version the minimum API level required. + * @param result computed and returned only when the requirement is met. * @return A `non-null` result if true, `null` otherwise. */ @ChecksSdkIntAtLeast(parameter = 0, lambda = 1) @@ -29,6 +35,11 @@ interface BuildVersionSdkIntProvider { } } + /** + * Whether the current OS version is equal or greater than [version]. + * + * @param version the minimum API level to test against. + */ @ChecksSdkIntAtLeast(parameter = 0) fun isAtLeast(version: Int) = get() >= version } diff --git a/services/toolbox/api/src/main/kotlin/io/element/android/services/toolbox/api/strings/StringProvider.kt b/services/toolbox/api/src/main/kotlin/io/element/android/services/toolbox/api/strings/StringProvider.kt index 4570e09921..f82d542f7e 100644 --- a/services/toolbox/api/src/main/kotlin/io/element/android/services/toolbox/api/strings/StringProvider.kt +++ b/services/toolbox/api/src/main/kotlin/io/element/android/services/toolbox/api/strings/StringProvider.kt @@ -11,6 +11,9 @@ package io.element.android.services.toolbox.api.strings import androidx.annotation.PluralsRes import androidx.annotation.StringRes +/** + * Resolves Android string resources outside of Composable and Context-aware code, so presenters stay testable. + */ interface StringProvider { /** * Returns a localized string from the application's package's @@ -39,6 +42,10 @@ interface StringProvider { * Returns a localized formatted string from the application's package's * default string table, substituting the format arguments as defined in * [java.util.Formatter] and [java.lang.String.format], based on the given quantity. + * + * @param resId Resource id for the plurals. + * @param quantity The quantity used to select the plural form. + * @param formatArgs The format arguments that will be used for substitution. */ fun getQuantityString(@PluralsRes resId: Int, quantity: Int, vararg formatArgs: Any?): String diff --git a/services/toolbox/api/src/main/kotlin/io/element/android/services/toolbox/api/systemclock/SystemClock.kt b/services/toolbox/api/src/main/kotlin/io/element/android/services/toolbox/api/systemclock/SystemClock.kt index 5436b44354..52a189f607 100644 --- a/services/toolbox/api/src/main/kotlin/io/element/android/services/toolbox/api/systemclock/SystemClock.kt +++ b/services/toolbox/api/src/main/kotlin/io/element/android/services/toolbox/api/systemclock/SystemClock.kt @@ -8,6 +8,10 @@ package io.element.android.services.toolbox.api.systemclock +/** + * Reads the current time, injected rather than called statically so that tests can control it. + */ fun interface SystemClock { + /** The current wall-clock time in milliseconds since the epoch. */ fun epochMillis(): Long } From 4a5d0d2540f2c3ec6fce8303a184b80c768f0b79 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 10:31:34 +0200 Subject: [PATCH 078/145] Add KDoc to the `services/analyticsproviders` API interfaces Document AnalyticsProvider, AnalyticsTransaction, AnalyticsTracker and ErrorTracker at the interface level, and add the missing @param entries. The provider doc records that providers are driven by the analytics service and only receive data once the user has consented, and that startTransaction returns null on a provider with no performance support. Co-Authored-By: Claude Opus 5 (1M context) --- .../analyticsproviders/api/AnalyticsProvider.kt | 14 ++++++++++++++ .../api/AnalyticsTransaction.kt | 16 ++++++++++++++++ .../api/trackers/AnalyticsTracker.kt | 9 +++++++++ .../api/trackers/ErrorTracker.kt | 8 ++++++++ 4 files changed, 47 insertions(+) diff --git a/services/analyticsproviders/api/src/main/kotlin/io/element/android/services/analyticsproviders/api/AnalyticsProvider.kt b/services/analyticsproviders/api/src/main/kotlin/io/element/android/services/analyticsproviders/api/AnalyticsProvider.kt index 593d62f40f..7b6278740c 100644 --- a/services/analyticsproviders/api/src/main/kotlin/io/element/android/services/analyticsproviders/api/AnalyticsProvider.kt +++ b/services/analyticsproviders/api/src/main/kotlin/io/element/android/services/analyticsproviders/api/AnalyticsProvider.kt @@ -11,15 +11,29 @@ package io.element.android.services.analyticsproviders.api import io.element.android.services.analyticsproviders.api.trackers.AnalyticsTracker import io.element.android.services.analyticsproviders.api.trackers.ErrorTracker +/** + * One analytics backend, such as PostHog or Sentry. + * + * Providers are driven by the analytics service rather than used directly, and only receive data once the user has consented. + */ interface AnalyticsProvider : AnalyticsTracker, ErrorTracker { /** * User friendly name. */ val name: String + /** Starts the backend, to be called when the user consents to analytics. */ fun init() + /** Stops the backend and drops any pending data, to be called when the user withdraws their consent. */ fun stop() + /** + * Starts a performance transaction, returning `null` when this provider does not support them. + * + * @param name the name the transaction is reported under. + * @param operation the kind of operation being measured. + * @param description a human readable detail shown alongside the measurement. + */ fun startTransaction(name: String, operation: String? = null, description: String? = null): AnalyticsTransaction? } diff --git a/services/analyticsproviders/api/src/main/kotlin/io/element/android/services/analyticsproviders/api/AnalyticsTransaction.kt b/services/analyticsproviders/api/src/main/kotlin/io/element/android/services/analyticsproviders/api/AnalyticsTransaction.kt index 82d337914a..f54cadbda8 100644 --- a/services/analyticsproviders/api/src/main/kotlin/io/element/android/services/analyticsproviders/api/AnalyticsTransaction.kt +++ b/services/analyticsproviders/api/src/main/kotlin/io/element/android/services/analyticsproviders/api/AnalyticsTransaction.kt @@ -9,6 +9,11 @@ package io.element.android.services.analyticsproviders.api import kotlin.time.Duration +/** + * A performance measurement in progress, which reports its timing once [finish] is called. + * + * Transactions can nest through [startChild]; see `recordChildTransaction` for a scoped alternative that always finishes the child. + */ interface AnalyticsTransaction { /** * The time elapsed since the transaction started until now if the transaction is ongoing or the time it finished. @@ -17,11 +22,17 @@ interface AnalyticsTransaction { /** * Start a child span from this transaction. + * + * @param operation the kind of operation the child measures. + * @param description a human readable detail shown alongside the measurement. */ fun startChild(operation: String, description: String? = null): AnalyticsTransaction /** * Adds extra data to the transaction. This data is not indexed, it's just listed. + * + * @param key the name of the field. + * @param value the value to attach. */ fun putExtraData(key: String, value: String) @@ -29,6 +40,9 @@ interface AnalyticsTransaction { * Similar to [putExtraData], adds extra data that *will be indexed* and can be used for filtering in the analytics portal. * * **Do not add numerical values using this function, use [putExtraData] instead.** + * + * @param key the name of the indexed field. + * @param value the value to attach. */ fun putIndexableData(key: String, value: String) @@ -44,6 +58,8 @@ interface AnalyticsTransaction { /** * Attach a throwable to the transaction, so we can know it failed. + * + * @param throwable the failure that occurred during the measured operation. */ fun attachError(throwable: Throwable) diff --git a/services/analyticsproviders/api/src/main/kotlin/io/element/android/services/analyticsproviders/api/trackers/AnalyticsTracker.kt b/services/analyticsproviders/api/src/main/kotlin/io/element/android/services/analyticsproviders/api/trackers/AnalyticsTracker.kt index 5bb63338a8..db4a8a5517 100644 --- a/services/analyticsproviders/api/src/main/kotlin/io/element/android/services/analyticsproviders/api/trackers/AnalyticsTracker.kt +++ b/services/analyticsproviders/api/src/main/kotlin/io/element/android/services/analyticsproviders/api/trackers/AnalyticsTracker.kt @@ -14,19 +14,28 @@ import im.vector.app.features.analytics.plan.Interaction import im.vector.app.features.analytics.plan.SuperProperties import im.vector.app.features.analytics.plan.UserProperties +/** + * Records analytics events; implemented by every provider and by the analytics service that fans out to them. + */ interface AnalyticsTracker { /** * Capture an Event. + * + * @param event the event to record, taken from the shared analytics plan. */ fun capture(event: VectorAnalyticsEvent) /** * Track a displayed screen. + * + * @param screen the screen that was shown. */ fun screen(screen: VectorAnalyticsScreen) /** * Update user specific properties. + * + * @param userProperties the properties to merge into the current user's profile. */ fun updateUserProperties(userProperties: UserProperties) diff --git a/services/analyticsproviders/api/src/main/kotlin/io/element/android/services/analyticsproviders/api/trackers/ErrorTracker.kt b/services/analyticsproviders/api/src/main/kotlin/io/element/android/services/analyticsproviders/api/trackers/ErrorTracker.kt index 5277493b64..94a04b842b 100644 --- a/services/analyticsproviders/api/src/main/kotlin/io/element/android/services/analyticsproviders/api/trackers/ErrorTracker.kt +++ b/services/analyticsproviders/api/src/main/kotlin/io/element/android/services/analyticsproviders/api/trackers/ErrorTracker.kt @@ -8,6 +8,14 @@ package io.element.android.services.analyticsproviders.api.trackers +/** + * Reports non-fatal errors to the crash reporting backend. + */ interface ErrorTracker { + /** + * Records an error that was handled but is still worth knowing about. + * + * @param throwable the failure to report; never pass one whose message can contain user content. + */ fun trackError(throwable: Throwable) } From c32f81f6965183ed9eaa00683411ddea8885f648 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 10:49:24 +0200 Subject: [PATCH 079/145] Revert "Keep manually revealed media visible when re-entering a room" --- .../protection/TimelineProtectionPresenter.kt | 9 ++++-- .../protection/TimelineProtectionStore.kt | 32 ------------------- .../TimelineProtectionPresenterTest.kt | 20 ------------ 3 files changed, 6 insertions(+), 55 deletions(-) delete mode 100644 features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/protection/TimelineProtectionStore.kt diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/protection/TimelineProtectionPresenter.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/protection/TimelineProtectionPresenter.kt index 6110a2c4db..22be4acb2d 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/protection/TimelineProtectionPresenter.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/protection/TimelineProtectionPresenter.kt @@ -12,6 +12,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateSetOf import androidx.compose.runtime.remember import dev.zacsweers.metro.Inject import dev.zacsweers.metro.SingleIn @@ -19,6 +20,7 @@ import io.element.android.features.contentscanner.api.ContentScannerService import io.element.android.libraries.architecture.Presenter import io.element.android.libraries.core.coroutine.mapState import io.element.android.libraries.di.RoomScope +import io.element.android.libraries.matrix.api.core.EventId import io.element.android.libraries.matrix.api.media.MediaPreviewService import io.element.android.libraries.matrix.api.media.isPreviewEnabled import io.element.android.libraries.matrix.api.room.BaseRoom @@ -30,8 +32,9 @@ class TimelineProtectionPresenter( private val mediaPreviewService: MediaPreviewService, private val room: BaseRoom, private val contentScannerService: ContentScannerService, - private val timelineProtectionStore: TimelineProtectionStore, ) : Presenter { + private val allowedEvents = mutableStateSetOf() + @Composable override fun present(): TimelineProtectionState { val mediaPreviewValue = remember { @@ -45,7 +48,7 @@ class TimelineProtectionPresenter( if (isPreviewEnabled) { ProtectionState.RenderAll } else { - ProtectionState.RenderOnly(eventIds = timelineProtectionStore.allowedEventIds.toImmutableSet()) + ProtectionState.RenderOnly(eventIds = allowedEvents.toImmutableSet()) } } } @@ -53,7 +56,7 @@ class TimelineProtectionPresenter( fun handleEvent(event: TimelineProtectionEvent) { when (event) { is TimelineProtectionEvent.ShowContent -> { - event.eventId?.let(timelineProtectionStore::allowEvent) + allowedEvents += setOfNotNull(event.eventId) } is TimelineProtectionEvent.ValidateContent -> { contentScannerService.scan(event.mediaSources, event.validationState) diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/protection/TimelineProtectionStore.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/protection/TimelineProtectionStore.kt deleted file mode 100644 index aa6655cb86..0000000000 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/protection/TimelineProtectionStore.kt +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2026 Element Creations Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.messages.impl.timeline.protection - -import androidx.compose.runtime.mutableStateSetOf -import androidx.compose.runtime.snapshots.SnapshotStateSet -import dev.zacsweers.metro.ContributesBinding -import dev.zacsweers.metro.SingleIn -import io.element.android.libraries.di.SessionScope -import io.element.android.libraries.matrix.api.core.EventId - -interface TimelineProtectionStore { - val allowedEventIds: SnapshotStateSet - fun allowEvent(eventId: EventId) -} - -@ContributesBinding(SessionScope::class) -@SingleIn(SessionScope::class) -class DefaultTimelineProtectionStore : TimelineProtectionStore { - private val allowedEvents = mutableStateSetOf() - - override val allowedEventIds: SnapshotStateSet = allowedEvents - - override fun allowEvent(eventId: EventId) { - allowedEvents += eventId - } -} diff --git a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/timeline/protection/TimelineProtectionPresenterTest.kt b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/timeline/protection/TimelineProtectionPresenterTest.kt index 161b350c96..11142cc9a2 100644 --- a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/timeline/protection/TimelineProtectionPresenterTest.kt +++ b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/timeline/protection/TimelineProtectionPresenterTest.kt @@ -95,24 +95,6 @@ class TimelineProtectionPresenterTest { } } - @Test - fun `present - shown content is restored when the presenter is recreated`() = runTest { - val mediaPreviewConfig = MediaPreviewConfig(mediaPreviewValue = MediaPreviewValue.Off, hideInviteAvatar = false) - val mediaPreviewService = FakeMediaPreviewService(mediaPreviewConfigFlow = MutableStateFlow(mediaPreviewConfig)) - val timelineProtectionStore = DefaultTimelineProtectionStore() - createPresenter(mediaPreviewService = mediaPreviewService, timelineProtectionStore = timelineProtectionStore).test { - val initialState = awaitItem() - assertThat(initialState.protectionState).isEqualTo(ProtectionState.RenderOnly(persistentSetOf())) - initialState.eventSink(TimelineProtectionEvent.ShowContent(eventId = AN_EVENT_ID)) - val finalState = awaitItem() - assertThat(finalState.protectionState).isEqualTo(ProtectionState.RenderOnly(persistentSetOf(AN_EVENT_ID))) - } - createPresenter(mediaPreviewService = mediaPreviewService, timelineProtectionStore = timelineProtectionStore).test { - val initialState = awaitItem() - assertThat(initialState.protectionState).isEqualTo(ProtectionState.RenderOnly(persistentSetOf(AN_EVENT_ID))) - } - } - @OptIn(ExperimentalCoroutinesApi::class) @Test fun `present - validate media scans the media source`() = runTest { @@ -152,11 +134,9 @@ class TimelineProtectionPresenterTest { room: BaseRoom = FakeBaseRoom(), mediaPreviewService: MediaPreviewService = FakeMediaPreviewService(), contentScannerService: ContentScannerService = ContentScannerService { _: List, _: ContentValidationState -> }, - timelineProtectionStore: TimelineProtectionStore = DefaultTimelineProtectionStore(), ) = TimelineProtectionPresenter( mediaPreviewService = mediaPreviewService, room = room, contentScannerService = contentScannerService, - timelineProtectionStore = timelineProtectionStore, ) } From 012d43665fc980fb6c96fde4084ae7bb1cab16f6 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 11:24:04 +0200 Subject: [PATCH 080/145] Add KDoc to the `libraries/session-storage` API interfaces Document SessionStore, SessionObserver and SessionListener at the interface level and add the missing @param entries. The store doc records that sessions are ordered by last usage, which is what makes "the latest session" meaningful across the rest of the interface, and the listener doc explains that wasLastSession is the signal to clean up app-wide data too. Co-Authored-By: Claude Opus 5 (1M context) --- .../sessionstorage/api/SessionStore.kt | 20 +++++++++++++++++++ .../api/observer/SessionListener.kt | 15 ++++++++++++++ .../api/observer/SessionObserver.kt | 10 ++++++++++ 3 files changed, 45 insertions(+) diff --git a/libraries/session-storage/api/src/main/kotlin/io/element/android/libraries/sessionstorage/api/SessionStore.kt b/libraries/session-storage/api/src/main/kotlin/io/element/android/libraries/sessionstorage/api/SessionStore.kt index fb60311418..53aa0c9516 100644 --- a/libraries/session-storage/api/src/main/kotlin/io/element/android/libraries/sessionstorage/api/SessionStore.kt +++ b/libraries/session-storage/api/src/main/kotlin/io/element/android/libraries/sessionstorage/api/SessionStore.kt @@ -11,6 +11,11 @@ package io.element.android.libraries.sessionstorage.api import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map +/** + * Persists the logged in sessions and their access tokens, so the app can restore them after a restart. + * + * Sessions are ordered by last usage, which is what makes "the latest session" meaningful across the interface. + */ interface SessionStore { /** * A flow emitting the current logged in state. @@ -28,21 +33,32 @@ interface SessionStore { * Add a new session. If other sessions exist, the new one will be set as the latest used one, and * the added session position will be set to a value higher than the other session positions. */ + /** + * @param sessionData the session to store, including its tokens. + */ suspend fun addSession(sessionData: SessionData) /** * Will update the session data matching the userId, except the value of loginTimestamp. * No op if userId is not found in DB. + * + * @param sessionData the new content of the session. */ suspend fun updateData(sessionData: SessionData) /** * Update the user profile info of the session matching the userId. + * + * @param sessionId the session to update. + * @param displayName the new display name, or `null` when the user has none. + * @param avatarUrl the new avatar, or `null` when the user has none. */ suspend fun updateUserProfile(sessionId: String, displayName: String?, avatarUrl: String?) /** * Get the session data matching the userId, or null if not found. + * + * @param sessionId the session to read. */ suspend fun getSession(sessionId: String): SessionData? @@ -63,11 +79,15 @@ interface SessionStore { /** * Set the session with [sessionId] as the latest used one. + * + * @param sessionId the session to bring to the front of the ordering. */ suspend fun setLatestSession(sessionId: String) /** * Remove the session matching the sessionId. + * + * @param sessionId the session to forget, which also discards its tokens. */ suspend fun removeSession(sessionId: String) } diff --git a/libraries/session-storage/api/src/main/kotlin/io/element/android/libraries/sessionstorage/api/observer/SessionListener.kt b/libraries/session-storage/api/src/main/kotlin/io/element/android/libraries/sessionstorage/api/observer/SessionListener.kt index 8dadcafc7d..8d94af5b13 100644 --- a/libraries/session-storage/api/src/main/kotlin/io/element/android/libraries/sessionstorage/api/observer/SessionListener.kt +++ b/libraries/session-storage/api/src/main/kotlin/io/element/android/libraries/sessionstorage/api/observer/SessionListener.kt @@ -8,7 +8,22 @@ package io.element.android.libraries.sessionstorage.api.observer +/** + * Reacts to sessions being created or deleted; both methods have an empty default so a listener only overrides what it cares about. + */ interface SessionListener { + /** + * Called after a session has been stored, for instance following a login. + * + * @param userId the session that was created. + */ suspend fun onSessionCreated(userId: String) {} + + /** + * Called after a session has been removed, which is where per-session data should be cleaned up. + * + * @param userId the session that was deleted. + * @param wasLastSession true when no session remains, so app-wide data can be cleaned up too. + */ suspend fun onSessionDeleted(userId: String, wasLastSession: Boolean) {} } diff --git a/libraries/session-storage/api/src/main/kotlin/io/element/android/libraries/sessionstorage/api/observer/SessionObserver.kt b/libraries/session-storage/api/src/main/kotlin/io/element/android/libraries/sessionstorage/api/observer/SessionObserver.kt index fb120acd56..08925ee688 100644 --- a/libraries/session-storage/api/src/main/kotlin/io/element/android/libraries/sessionstorage/api/observer/SessionObserver.kt +++ b/libraries/session-storage/api/src/main/kotlin/io/element/android/libraries/sessionstorage/api/observer/SessionObserver.kt @@ -8,7 +8,17 @@ package io.element.android.libraries.sessionstorage.api.observer +/** + * Notifies interested components when a session is created or deleted, so they can set up or clean up their own per-session data. + */ interface SessionObserver { + /** + * @param listener the listener to notify from now on. + */ fun addListener(listener: SessionListener) + + /** + * @param listener the listener to stop notifying. + */ fun removeListener(listener: SessionListener) } From 13aad55af84d8104fef69b30008d04b2f81f8f17 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 11:24:04 +0200 Subject: [PATCH 081/145] Add KDoc to the `libraries/pushproviders` API interfaces Document PusherSubscriber and PushHandler at the interface level, document the PushProvider members that had none, and add the missing @param entries. Notable points: getCurrentDistributor also returns null when the stored distributor is no longer installed, rotateToken throws unless canRotateToken is true, and handleInvalid records the payload in the push history for diagnosis. Co-Authored-By: Claude Opus 5 (1M context) --- .../pushproviders/api/PushHandler.kt | 8 +++++- .../pushproviders/api/PushProvider.kt | 25 +++++++++++++++++-- .../pushproviders/api/PusherSubscriber.kt | 11 ++++++++ 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/libraries/pushproviders/api/src/main/kotlin/io/element/android/libraries/pushproviders/api/PushHandler.kt b/libraries/pushproviders/api/src/main/kotlin/io/element/android/libraries/pushproviders/api/PushHandler.kt index 49b578070b..1e53575717 100644 --- a/libraries/pushproviders/api/src/main/kotlin/io/element/android/libraries/pushproviders/api/PushHandler.kt +++ b/libraries/pushproviders/api/src/main/kotlin/io/element/android/libraries/pushproviders/api/PushHandler.kt @@ -8,6 +8,9 @@ package io.element.android.libraries.pushproviders.api +/** + * Entry point for the pushes coming from any provider, which resolves them into notifications. + */ interface PushHandler { /** * Handle a push received from the provider. @@ -22,7 +25,10 @@ interface PushHandler { ): Boolean /** - * Handle an invalid push received from the provider. + * Handle an invalid push received from the provider, which is recorded in the push history so it can be diagnosed. + * + * @param providerInfo an identifier of the provider that sent the push, for logging and debugging purposes. + * @param data the raw payload that could not be understood. */ suspend fun handleInvalid( providerInfo: String, diff --git a/libraries/pushproviders/api/src/main/kotlin/io/element/android/libraries/pushproviders/api/PushProvider.kt b/libraries/pushproviders/api/src/main/kotlin/io/element/android/libraries/pushproviders/api/PushProvider.kt index 405a83b9b8..ed13d0ab37 100644 --- a/libraries/pushproviders/api/src/main/kotlin/io/element/android/libraries/pushproviders/api/PushProvider.kt +++ b/libraries/pushproviders/api/src/main/kotlin/io/element/android/libraries/pushproviders/api/PushProvider.kt @@ -37,33 +37,54 @@ interface PushProvider { /** * Register the pusher to the homeserver. + * + * @param matrixClient the session to register the pusher for. + * @param distributor the distributor to route the notifications through. */ suspend fun registerWith(matrixClient: MatrixClient, distributor: Distributor): Result /** - * Return the current distributor, or null if none. + * Return the current distributor as its raw stored value, or null if none. + * + * @param sessionId the session to read the distributor of. */ suspend fun getCurrentDistributorValue(sessionId: SessionId): String? /** - * Return the current distributor, or null if none. + * Return the current distributor, or null if none, which also happens when the stored one is no longer installed. + * + * @param sessionId the session to read the distributor of. */ suspend fun getCurrentDistributor(sessionId: SessionId): Distributor? /** * Unregister the pusher. + * + * @param matrixClient the session to unregister the pusher of. */ suspend fun unregister(matrixClient: MatrixClient): Result /** * To invoke when the session is deleted. + * + * @param sessionId the session that has been removed, whose provider-side data should be cleaned up. */ suspend fun onSessionDeleted(sessionId: SessionId) + /** + * The gateway and push key currently in use, for display in the troubleshooting screens; `null` when not registered. + * + * @param sessionId the session to read the configuration of. + */ suspend fun getPushConfig(sessionId: SessionId): Config? + /** Whether this provider can renew its push token on demand, which not every provider supports. */ fun canRotateToken(): Boolean + /** + * Renews the push token, which is one of the recovery steps offered when notifications stop arriving. + * Throws when [canRotateToken] is `false`. + */ suspend fun rotateToken(): Result { error("rotateToken() not implemented, you need to override this method in your implementation") } diff --git a/libraries/pushproviders/api/src/main/kotlin/io/element/android/libraries/pushproviders/api/PusherSubscriber.kt b/libraries/pushproviders/api/src/main/kotlin/io/element/android/libraries/pushproviders/api/PusherSubscriber.kt index 989170c975..e1d885fca2 100644 --- a/libraries/pushproviders/api/src/main/kotlin/io/element/android/libraries/pushproviders/api/PusherSubscriber.kt +++ b/libraries/pushproviders/api/src/main/kotlin/io/element/android/libraries/pushproviders/api/PusherSubscriber.kt @@ -11,14 +11,25 @@ package io.element.android.libraries.pushproviders.api import io.element.android.libraries.matrix.api.MatrixClient import io.element.android.libraries.matrix.api.exception.ClientException +/** + * Registers and removes a pusher on the homeserver on behalf of a push provider, so every provider agrees on the parameters sent. + */ interface PusherSubscriber { /** * Register a pusher. Note that failure will be a [RegistrationFailure]. + * + * @param matrixClient the session to register the pusher for. + * @param pushKey the token identifying this device with the gateway. + * @param gateway the URL the homeserver should send the notifications to. */ suspend fun registerPusher(matrixClient: MatrixClient, pushKey: String, gateway: String): Result /** * Unregister a pusher. + * + * @param matrixClient the session to unregister the pusher of. + * @param pushKey the token of the registration to remove. + * @param gateway the gateway of the registration to remove. */ suspend fun unregisterPusher(matrixClient: MatrixClient, pushKey: String, gateway: String): Result } From d80aaf6be4959c453d1f5f77e6f800f090d68ad1 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 11:24:05 +0200 Subject: [PATCH 082/145] Add KDoc to the `libraries/mediapickers` API interfaces Document PickerProvider and each of its register methods. The interface doc carries the two rules that apply to all of them: they must be called during composition rather than from a click handler, and a cancelled pick arrives as a null uri or an empty list rather than as an error. Co-Authored-By: Claude Opus 5 (1M context) --- .../mediapickers/api/PickerProvider.kt | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/libraries/mediapickers/api/src/main/kotlin/io/element/android/libraries/mediapickers/api/PickerProvider.kt b/libraries/mediapickers/api/src/main/kotlin/io/element/android/libraries/mediapickers/api/PickerProvider.kt index 1bab693609..185b2f58a0 100644 --- a/libraries/mediapickers/api/src/main/kotlin/io/element/android/libraries/mediapickers/api/PickerProvider.kt +++ b/libraries/mediapickers/api/src/main/kotlin/io/element/android/libraries/mediapickers/api/PickerProvider.kt @@ -12,37 +12,79 @@ import android.net.Uri import androidx.activity.result.PickVisualMediaRequest import androidx.compose.runtime.Composable +/** + * Registers the system media and file pickers from Composable code, returning launchers the UI can trigger later. + * + * Every method must be called during composition, not from a click handler; a cancelled pick reports a `null` uri or an empty list. + */ interface PickerProvider { + /** + * Registers a picker for a single photo or video from the gallery. + * + * @param onResult called with the picked media and its MIME type, both `null` when the user cancelled. + */ @Composable fun registerGalleryPicker( onResult: (uri: Uri?, mimeType: String?) -> Unit ): PickerLauncher + /** + * Registers a picker restricted to a single image, used where a video would not be valid, such as for an avatar. + * + * @param onResult called with the picked image, `null` when the user cancelled. + */ @Composable fun registerGalleryImagePicker( onResult: (Uri?) -> Unit ): PickerLauncher + /** + * Registers a picker for several photos or videos at once. + * + * @param onResult called with the picked media, empty when the user cancelled. + */ @Composable fun registerGalleryMultiPicker( onResult: (uris: List) -> Unit ): PickerLauncher> + /** + * Registers a picker for a single file of any kind. + * + * @param mimeType the MIME type to filter on, `*` / `*` to accept anything. + * @param onResult called with the picked file and its MIME type, both `null` when the user cancelled. + */ @Composable fun registerFilePicker( mimeType: String, onResult: (uri: Uri?, mimeType: String?) -> Unit, ): PickerLauncher + /** + * Registers a picker for several files at once. + * + * @param mimeType the MIME type to filter on. + * @param onResult called with the picked files, empty when the user cancelled. + */ @Composable fun registerFileMultiPicker( mimeType: String, onResult: (uris: List) -> Unit, ): PickerLauncher, List> + /** + * Registers a launcher that opens the camera to take a photo. + * + * @param onResult called with the captured photo, `null` when the user cancelled or the capture failed. + */ @Composable fun registerCameraPhotoPicker(onResult: (Uri?) -> Unit): PickerLauncher + /** + * Registers a launcher that opens the camera to record a video. + * + * @param onResult called with the recorded video, `null` when the user cancelled or the capture failed. + */ @Composable fun registerCameraVideoPicker(onResult: (Uri?) -> Unit): PickerLauncher } From 2284cff25ae39fb35a3f7f676d4dcfc179d468a5 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 11:43:40 +0200 Subject: [PATCH 083/145] Add KDoc to six small library API modules Cover the remaining interfaces of libraries/troubleshoot, libraries/matrixmedia, libraries/dateformatter, libraries/featureflag, libraries/workmanager and libraries/mediaviewer, along with their members and parameters. Behaviours worth recording: NotificationTroubleshootTest reports its outcome through its state flow rather than by returning, and its quickFix throws unless the test offers one; DateFormatter.format turns a null timestamp into an empty string so callers need no null check; ImageLoaderHolder keeps one loader per session because decrypting room media needs that session's client. Co-Authored-By: Claude Opus 5 (1M context) --- .../dateformatter/api/DateFormatter.kt | 10 ++++++++ .../dateformatter/api/DurationFormatter.kt | 5 ++++ .../libraries/featureflag/api/Feature.kt | 3 +++ .../featureflag/api/FeatureFlagService.kt | 3 +++ .../matrix/ui/media/ImageLoaderHolder.kt | 16 ++++++++++++ .../ui/media/InitialsAvatarBitmapGenerator.kt | 9 +++++++ .../api/local/LocalMediaFactory.kt | 11 ++++++++ .../api/local/LocalMediaRenderer.kt | 8 ++++++ .../api/util/FileExtensionExtractor.kt | 7 ++++++ .../test/NotificationTroubleshootNavigator.kt | 4 +++ .../api/test/NotificationTroubleshootTest.kt | 25 +++++++++++++++++++ .../workmanager/api/WorkManagerScheduler.kt | 11 ++++++++ .../workmanager/api/di/MetroWorkerFactory.kt | 6 +++++ 13 files changed, 118 insertions(+) diff --git a/libraries/dateformatter/api/src/main/kotlin/io/element/android/libraries/dateformatter/api/DateFormatter.kt b/libraries/dateformatter/api/src/main/kotlin/io/element/android/libraries/dateformatter/api/DateFormatter.kt index 1f5c88f008..84cbf5efdd 100644 --- a/libraries/dateformatter/api/src/main/kotlin/io/element/android/libraries/dateformatter/api/DateFormatter.kt +++ b/libraries/dateformatter/api/src/main/kotlin/io/element/android/libraries/dateformatter/api/DateFormatter.kt @@ -8,7 +8,17 @@ package io.element.android.libraries.dateformatter.api +/** + * Formats timestamps for display, in the user's locale and time zone. + */ interface DateFormatter { + /** + * Formats a timestamp according to [mode]. + * + * @param timestamp milliseconds since the epoch; a `null` value yields an empty string, so callers need no null check of their own. + * @param mode how much of the date and time to include; see [DateFormatterMode] for examples of each. + * @param useRelative true to prefer wording relative to today, such as "Today" or "This month", where the mode allows it. + */ fun format( timestamp: Long?, mode: DateFormatterMode = DateFormatterMode.Full, diff --git a/libraries/dateformatter/api/src/main/kotlin/io/element/android/libraries/dateformatter/api/DurationFormatter.kt b/libraries/dateformatter/api/src/main/kotlin/io/element/android/libraries/dateformatter/api/DurationFormatter.kt index ac297d10e9..712355c423 100644 --- a/libraries/dateformatter/api/src/main/kotlin/io/element/android/libraries/dateformatter/api/DurationFormatter.kt +++ b/libraries/dateformatter/api/src/main/kotlin/io/element/android/libraries/dateformatter/api/DurationFormatter.kt @@ -21,6 +21,11 @@ import kotlin.time.Duration * - 30 seconds → "30 seconds" */ interface DurationFormatter { + /** + * Formats the duration using its largest appropriate unit, rounding rather than listing several units. + * + * @param duration the duration to describe. + */ fun format(duration: Duration): String } diff --git a/libraries/featureflag/api/src/main/kotlin/io/element/android/libraries/featureflag/api/Feature.kt b/libraries/featureflag/api/src/main/kotlin/io/element/android/libraries/featureflag/api/Feature.kt index 395fd04c6c..4fd8706d89 100644 --- a/libraries/featureflag/api/src/main/kotlin/io/element/android/libraries/featureflag/api/Feature.kt +++ b/libraries/featureflag/api/src/main/kotlin/io/element/android/libraries/featureflag/api/Feature.kt @@ -10,6 +10,9 @@ package io.element.android.libraries.featureflag.api import io.element.android.libraries.core.meta.BuildMeta +/** + * Describes one feature flag: how it is identified, how it is presented in the developer options, and what it defaults to. + */ interface Feature { /** * Unique key to identify the feature. diff --git a/libraries/featureflag/api/src/main/kotlin/io/element/android/libraries/featureflag/api/FeatureFlagService.kt b/libraries/featureflag/api/src/main/kotlin/io/element/android/libraries/featureflag/api/FeatureFlagService.kt index 6a8cb2fd9d..3dc791317f 100644 --- a/libraries/featureflag/api/src/main/kotlin/io/element/android/libraries/featureflag/api/FeatureFlagService.kt +++ b/libraries/featureflag/api/src/main/kotlin/io/element/android/libraries/featureflag/api/FeatureFlagService.kt @@ -11,6 +11,9 @@ package io.element.android.libraries.featureflag.api import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.first +/** + * Reads and, where a mutable provider is registered, changes the state of the feature flags. + */ interface FeatureFlagService { /** * @param feature the feature to check for diff --git a/libraries/matrixmedia/api/src/main/kotlin/io/element/android/libraries/matrix/ui/media/ImageLoaderHolder.kt b/libraries/matrixmedia/api/src/main/kotlin/io/element/android/libraries/matrix/ui/media/ImageLoaderHolder.kt index 62b169744b..228fbd2cff 100644 --- a/libraries/matrixmedia/api/src/main/kotlin/io/element/android/libraries/matrix/ui/media/ImageLoaderHolder.kt +++ b/libraries/matrixmedia/api/src/main/kotlin/io/element/android/libraries/matrix/ui/media/ImageLoaderHolder.kt @@ -11,8 +11,24 @@ import coil3.ImageLoader import io.element.android.libraries.matrix.api.MatrixClient import io.element.android.libraries.matrix.api.core.SessionId +/** + * Caches one Coil image loader per session, since loading Matrix media requires the session's own client to fetch and decrypt it. + */ interface ImageLoaderHolder { + /** Returns a loader that can only fetch ordinary URLs, for images that do not come from a Matrix room. */ fun get(): ImageLoader + + /** + * Returns the loader of a session, creating it on first use. + * + * @param client the session whose media the loader will fetch. + */ fun get(client: MatrixClient): ImageLoader + + /** + * Drops the cached loader of a session, to be called when that session goes away. + * + * @param sessionId the session whose loader is dropped. + */ fun remove(sessionId: SessionId) } diff --git a/libraries/matrixmedia/api/src/main/kotlin/io/element/android/libraries/matrix/ui/media/InitialsAvatarBitmapGenerator.kt b/libraries/matrixmedia/api/src/main/kotlin/io/element/android/libraries/matrix/ui/media/InitialsAvatarBitmapGenerator.kt index e6ff5d762d..f145383e87 100644 --- a/libraries/matrixmedia/api/src/main/kotlin/io/element/android/libraries/matrix/ui/media/InitialsAvatarBitmapGenerator.kt +++ b/libraries/matrixmedia/api/src/main/kotlin/io/element/android/libraries/matrix/ui/media/InitialsAvatarBitmapGenerator.kt @@ -14,6 +14,15 @@ import io.element.android.libraries.designsystem.components.avatar.AvatarData * Generates a bitmap for an initials avatar based on the provided [io.element.android.libraries.designsystem.components.avatar.AvatarData]. */ interface InitialsAvatarBitmapGenerator { + /** + * Draws the initials avatar, used where a bitmap is required rather than a Composable, such as in notifications and shortcuts. + * + * @param size the width and height of the bitmap in pixels. + * @param avatarData the name and id the initials and the background colour are derived from. + * @param useDarkTheme whether to draw the dark theme variant. + * @param fontSizePercentage the text height as a fraction of [size]. + * @return the bitmap, or `null` when it could not be drawn. + */ fun generateBitmap( size: Int, avatarData: AvatarData, diff --git a/libraries/mediaviewer/api/src/main/kotlin/io/element/android/libraries/mediaviewer/api/local/LocalMediaFactory.kt b/libraries/mediaviewer/api/src/main/kotlin/io/element/android/libraries/mediaviewer/api/local/LocalMediaFactory.kt index 383f985c4f..5a218f9e1e 100644 --- a/libraries/mediaviewer/api/src/main/kotlin/io/element/android/libraries/mediaviewer/api/local/LocalMediaFactory.kt +++ b/libraries/mediaviewer/api/src/main/kotlin/io/element/android/libraries/mediaviewer/api/local/LocalMediaFactory.kt @@ -12,9 +12,15 @@ import android.net.Uri import io.element.android.libraries.matrix.api.media.MediaFile import io.element.android.libraries.mediaviewer.api.MediaInfo +/** + * Builds the [LocalMedia] the media viewer renders, from either a downloaded Matrix media file or an arbitrary content uri. + */ interface LocalMediaFactory { /** * This method will create a [LocalMedia] with the given [MediaFile] and [MediaInfo]. + * + * @param mediaFile the file already downloaded from the homeserver. + * @param mediaInfo what is known about the media from the event that carried it. */ fun createFromMediaFile( mediaFile: MediaFile, @@ -24,6 +30,11 @@ interface LocalMediaFactory { /** * This method will create a [LocalMedia] with the given mimeType, name and formattedFileSize * If any of those params are null, it'll try to read them from the content. + * + * @param uri the content to display, for instance one just picked by the user. + * @param mimeType the MIME type, or `null` to read it from the content. + * @param name the file name, or `null` to read it from the content. + * @param formattedFileSize the size to display, or `null` to read it from the content. */ fun createFromUri( uri: Uri, diff --git a/libraries/mediaviewer/api/src/main/kotlin/io/element/android/libraries/mediaviewer/api/local/LocalMediaRenderer.kt b/libraries/mediaviewer/api/src/main/kotlin/io/element/android/libraries/mediaviewer/api/local/LocalMediaRenderer.kt index fb7f26101e..5bc84919be 100644 --- a/libraries/mediaviewer/api/src/main/kotlin/io/element/android/libraries/mediaviewer/api/local/LocalMediaRenderer.kt +++ b/libraries/mediaviewer/api/src/main/kotlin/io/element/android/libraries/mediaviewer/api/local/LocalMediaRenderer.kt @@ -10,7 +10,15 @@ package io.element.android.libraries.mediaviewer.api.local import androidx.compose.runtime.Composable +/** + * Renders a media file held on the device, picking the right player or viewer for its type. + */ interface LocalMediaRenderer { + /** + * Draws the media, filling the space it is given. + * + * @param localMedia the file to display, along with what is known about its type. + */ @Composable fun Render(localMedia: LocalMedia) } diff --git a/libraries/mediaviewer/api/src/main/kotlin/io/element/android/libraries/mediaviewer/api/util/FileExtensionExtractor.kt b/libraries/mediaviewer/api/src/main/kotlin/io/element/android/libraries/mediaviewer/api/util/FileExtensionExtractor.kt index 094b4513d8..e29188e984 100644 --- a/libraries/mediaviewer/api/src/main/kotlin/io/element/android/libraries/mediaviewer/api/util/FileExtensionExtractor.kt +++ b/libraries/mediaviewer/api/src/main/kotlin/io/element/android/libraries/mediaviewer/api/util/FileExtensionExtractor.kt @@ -8,6 +8,13 @@ package io.element.android.libraries.mediaviewer.api.util +/** + * Extracts the extension of a file name, so it can be shown to the user and used to pick an icon. + */ interface FileExtensionExtractor { + /** + * @param name the file name to inspect. + * @return the extension without its dot, or an empty string when the name has none. + */ fun extractFromName(name: String): String } diff --git a/libraries/troubleshoot/api/src/main/kotlin/io/element/android/libraries/troubleshoot/api/test/NotificationTroubleshootNavigator.kt b/libraries/troubleshoot/api/src/main/kotlin/io/element/android/libraries/troubleshoot/api/test/NotificationTroubleshootNavigator.kt index a4be22e70b..69a0561d25 100644 --- a/libraries/troubleshoot/api/src/main/kotlin/io/element/android/libraries/troubleshoot/api/test/NotificationTroubleshootNavigator.kt +++ b/libraries/troubleshoot/api/src/main/kotlin/io/element/android/libraries/troubleshoot/api/test/NotificationTroubleshootNavigator.kt @@ -8,6 +8,10 @@ package io.element.android.libraries.troubleshoot.api.test +/** + * Lets a troubleshooting test's quick fix send the user to another screen, without the test itself knowing about navigation. + */ interface NotificationTroubleshootNavigator { + /** Opens the blocked users screen, so the user can unblock someone whose messages were being filtered out. */ fun navigateToBlockedUsers() } diff --git a/libraries/troubleshoot/api/src/main/kotlin/io/element/android/libraries/troubleshoot/api/test/NotificationTroubleshootTest.kt b/libraries/troubleshoot/api/src/main/kotlin/io/element/android/libraries/troubleshoot/api/test/NotificationTroubleshootTest.kt index 27f3bcf8ed..98898ad483 100644 --- a/libraries/troubleshoot/api/src/main/kotlin/io/element/android/libraries/troubleshoot/api/test/NotificationTroubleshootTest.kt +++ b/libraries/troubleshoot/api/src/main/kotlin/io/element/android/libraries/troubleshoot/api/test/NotificationTroubleshootTest.kt @@ -20,11 +20,36 @@ import kotlinx.coroutines.flow.StateFlow * the component they're injected into is bound to [SessionScope] and so should these (https://github.com/ZacSweers/metro/issues/1932). */ interface NotificationTroubleshootTest { + /** Position of this test in the list shown to the user; tests run in ascending order. */ val order: Int + + /** The current state of this test, which the UI observes to show it as idle, running, successful or failed. */ val state: StateFlow + + /** + * Whether this test applies to the current setup, so that irrelevant tests are hidden rather than shown as failing. + * + * @param data the current push provider and distributor, used to decide relevance. + */ fun isRelevant(data: TestFilterData): Boolean = true + + /** + * Runs the test, reporting its outcome through [state] rather than by returning or throwing. + * + * @param coroutineScope the scope to launch any work that must outlive the call itself. + */ suspend fun run(coroutineScope: CoroutineScope) + + /** Returns the test to its idle state so it can be run again. */ suspend fun reset() + + /** + * Attempts to fix what this test detected, for the tests that can offer it. Throws by default, so check the state's quick fix + * flag before calling. + * + * @param coroutineScope the scope to launch any work that must outlive the call itself. + * @param navigator used by the fixes that have to send the user to another screen. + */ suspend fun quickFix( coroutineScope: CoroutineScope, navigator: NotificationTroubleshootNavigator, diff --git a/libraries/workmanager/api/src/main/kotlin/io/element/android/libraries/workmanager/api/WorkManagerScheduler.kt b/libraries/workmanager/api/src/main/kotlin/io/element/android/libraries/workmanager/api/WorkManagerScheduler.kt index a616e01573..b4c2950cd4 100644 --- a/libraries/workmanager/api/src/main/kotlin/io/element/android/libraries/workmanager/api/WorkManagerScheduler.kt +++ b/libraries/workmanager/api/src/main/kotlin/io/element/android/libraries/workmanager/api/WorkManagerScheduler.kt @@ -10,20 +10,31 @@ package io.element.android.libraries.workmanager.api import io.element.android.libraries.matrix.api.core.SessionId +/** + * Schedules background work, wrapping `WorkManager` so the rest of the app does not depend on it directly. + */ interface WorkManagerScheduler { /** * Submits a new work request built from [workManagerRequestBuilder] to run in `WorkManager`. + * + * @param workManagerRequestBuilder describes the work to schedule. */ suspend fun submit(workManagerRequestBuilder: WorkManagerRequestBuilder) /** * Checks if there are any pending requests scheduled for the provided [sessionId] and [requestType]. + * + * @param sessionId the session the work belongs to. + * @param requestType the kind of work to look for. */ fun hasPendingWork(sessionId: SessionId, requestType: WorkManagerRequestType): Boolean /** * Cancel pending work requests for the session [SessionId]. * If [requestType] is provided, it will only cancel requests for that type, otherwise it will cancel all requests. + * + * @param sessionId the session whose work is cancelled. + * @param requestType the kind of work to cancel, or `null` to cancel every kind. */ fun cancel(sessionId: SessionId, requestType: WorkManagerRequestType? = null) } diff --git a/libraries/workmanager/api/src/main/kotlin/io/element/android/libraries/workmanager/api/di/MetroWorkerFactory.kt b/libraries/workmanager/api/src/main/kotlin/io/element/android/libraries/workmanager/api/di/MetroWorkerFactory.kt index 086d3baafa..d97f66f966 100644 --- a/libraries/workmanager/api/src/main/kotlin/io/element/android/libraries/workmanager/api/di/MetroWorkerFactory.kt +++ b/libraries/workmanager/api/src/main/kotlin/io/element/android/libraries/workmanager/api/di/MetroWorkerFactory.kt @@ -28,7 +28,13 @@ class MetroWorkerFactory( return workerProviders[Class.forName(workerClassName).kotlin]?.create(workerParameters) } + /** + * Creates one worker type with its dependencies injected, since `WorkManager` instantiates workers itself and cannot use the graph. + */ interface WorkerInstanceFactory { + /** + * @param params the parameters `WorkManager` built the worker with. + */ fun create(params: WorkerParameters): T } } From 57658640e1a5116ff9b676f812518ab13f3167b6 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 11:48:58 +0200 Subject: [PATCH 084/145] Add KDoc to the `features/location` API interfaces Document LocationService, StaticMapUrlBuilder, TileServerStyleUriBuilder and the members of ActiveLiveLocationShareManager that had none. The two URL builders now say what happens when no map provider is configured for the build, which is the case LocationService.isServiceAvailable exists to guard. Co-Authored-By: Claude Opus 5 (1M context) --- .../android/features/location/api/LocationService.kt | 4 ++++ .../location/api/internal/StaticMapUrlBuilder.kt | 12 ++++++++++++ .../api/internal/TileServerStyleUriBuilder.kt | 6 ++++++ .../api/live/ActiveLiveLocationShareManager.kt | 10 ++++++++++ 4 files changed, 32 insertions(+) diff --git a/features/location/api/src/main/kotlin/io/element/android/features/location/api/LocationService.kt b/features/location/api/src/main/kotlin/io/element/android/features/location/api/LocationService.kt index 22049c9548..41c58c396f 100644 --- a/features/location/api/src/main/kotlin/io/element/android/features/location/api/LocationService.kt +++ b/features/location/api/src/main/kotlin/io/element/android/features/location/api/LocationService.kt @@ -8,6 +8,10 @@ package io.element.android.features.location.api +/** + * Tells whether the location features can be used at all, which depends on the build having a map provider configured. + */ interface LocationService { + /** Whether location sharing and map rendering are available; `false` disables the whole feature in the UI. */ fun isServiceAvailable(): Boolean } diff --git a/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/StaticMapUrlBuilder.kt b/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/StaticMapUrlBuilder.kt index 6636976828..c03fb8a838 100644 --- a/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/StaticMapUrlBuilder.kt +++ b/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/StaticMapUrlBuilder.kt @@ -12,6 +12,17 @@ package io.element.android.features.location.api.internal * Builds an URL for a 3rd party service provider static maps API. */ interface StaticMapUrlBuilder { + /** + * Builds the URL of a map image centred on the given coordinates. + * + * @param lat latitude of the centre of the map. + * @param lon longitude of the centre of the map. + * @param zoom zoom level to render at. + * @param darkMode whether to request the dark map style. + * @param width width of the image in density independent pixels. + * @param height height of the image in density independent pixels. + * @param density screen density, used to request a matching pixel size. + */ fun build( lat: Double, lon: Double, @@ -22,6 +33,7 @@ interface StaticMapUrlBuilder { density: Float, ): String + /** Whether a map provider is configured for this build; the URLs are unusable when it is not. */ fun isServiceAvailable(): Boolean } diff --git a/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/TileServerStyleUriBuilder.kt b/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/TileServerStyleUriBuilder.kt index 762d580f8e..08a40d2a7b 100644 --- a/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/TileServerStyleUriBuilder.kt +++ b/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/TileServerStyleUriBuilder.kt @@ -18,6 +18,12 @@ import io.element.android.compound.theme.ElementTheme * Used for rendering dynamic maps. */ interface TileServerStyleUriBuilder { + /** + * Builds the style URI the map view loads its tiles from. + * + * @param customMapStyleUrl the style advertised by the homeserver, or `null` to use the one built into the app. + * @param darkMode whether to request the dark map style. + */ fun build( customMapStyleUrl: String?, darkMode: Boolean, diff --git a/features/location/api/src/main/kotlin/io/element/android/features/location/api/live/ActiveLiveLocationShareManager.kt b/features/location/api/src/main/kotlin/io/element/android/features/location/api/live/ActiveLiveLocationShareManager.kt index cd6b8731c1..74c9089c30 100644 --- a/features/location/api/src/main/kotlin/io/element/android/features/location/api/live/ActiveLiveLocationShareManager.kt +++ b/features/location/api/src/main/kotlin/io/element/android/features/location/api/live/ActiveLiveLocationShareManager.kt @@ -12,6 +12,9 @@ import io.element.android.libraries.matrix.api.core.RoomId import kotlinx.coroutines.flow.StateFlow import kotlin.time.Duration +/** + * Owns the live location shares running on this device, across every room, and the foreground service that feeds them GPS updates. + */ interface ActiveLiveLocationShareManager { /** All rooms currently sharing live location on this device. */ val sharingRoomIds: StateFlow> @@ -28,6 +31,10 @@ interface ActiveLiveLocationShareManager { * Calls room.startLiveLocationShare() on the SDK, registers the share, * and starts the foreground GPS service if not already running. */ + /** + * @param roomId the room to start sharing the location in. + * @param duration how long the share should last before it expires on its own. + */ suspend fun startShare(roomId: RoomId, duration: Duration): Result /** @@ -35,6 +42,9 @@ interface ActiveLiveLocationShareManager { * Calls room.stopLiveLocationShare() on the SDK, removes the share, * and stops the foreground service if no shares remain. */ + /** + * @param roomId the room to stop sharing the location in. + */ suspend fun stopShare(roomId: RoomId): Result } From c4c7dac9cf8d9c66535c67dc1ae1cbf6e551f5f7 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 11:48:59 +0200 Subject: [PATCH 085/145] Add KDoc to the `features/rageshake` API interfaces Document RageshakeFeatureAvailability, LogFilesRemover and the BugReporter interface, and complete the docs of its remaining members. The BugReporter doc records that progress and the outcome arrive through the listener passed to sendBugReport rather than through a return value or an exception. Co-Authored-By: Claude Opus 5 (1M context) --- .../rageshake/api/RageshakeFeatureAvailability.kt | 4 ++++ .../features/rageshake/api/logs/LogFilesRemover.kt | 3 +++ .../features/rageshake/api/reporter/BugReporter.kt | 13 +++++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/RageshakeFeatureAvailability.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/RageshakeFeatureAvailability.kt index bc72e7021b..c4205c1575 100644 --- a/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/RageshakeFeatureAvailability.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/RageshakeFeatureAvailability.kt @@ -10,6 +10,10 @@ package io.element.android.features.rageshake.api import kotlinx.coroutines.flow.Flow +/** + * Tells whether bug reporting is available, which an enterprise deployment can turn off. + */ fun interface RageshakeFeatureAvailability { + /** Whether the rageshake and bug report entry points should be offered to the user. */ fun isAvailable(): Flow } diff --git a/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/logs/LogFilesRemover.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/logs/LogFilesRemover.kt index f8eee31675..a7b2961ab6 100644 --- a/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/logs/LogFilesRemover.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/logs/LogFilesRemover.kt @@ -10,6 +10,9 @@ package io.element.android.features.rageshake.api.logs import java.io.File +/** + * Deletes the log files the app writes, used to keep them from growing without bound and to clear them on request. + */ interface LogFilesRemover { /** * Perform the log files removal. diff --git a/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/reporter/BugReporter.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/reporter/BugReporter.kt index 631a51a686..c1611f30b5 100644 --- a/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/reporter/BugReporter.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/reporter/BugReporter.kt @@ -10,6 +10,11 @@ package io.element.android.features.rageshake.api.reporter import java.io.File +/** + * Uploads bug reports, including the log files the app has been writing. + * + * Progress and the outcome are reported through the listener passed to [sendBugReport] rather than by returning or throwing. + */ interface BugReporter { /** * Send a bug report. @@ -35,17 +40,21 @@ interface BugReporter { ) /** - * Provide the log directory. + * Provide the log directory, i.e. where the rotating log files are written. */ fun logDirectory(): File /** - * Set the current tracing log level. + * Set the current tracing log level, so it can be reported alongside the bug. + * + * @param logLevel the log level currently in effect. */ fun setCurrentTracingLogLevel(logLevel: String) /** * Save the logcat. + * + * @return the file the logcat was written to, or `null` when it could not be captured. */ fun saveLogCat(): File? } From b683c62d8f62e4b3c58f680b0461bde8556f0d9e Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 11:50:13 +0200 Subject: [PATCH 086/145] Add KDoc to the `services/appnavstate` API interfaces Document the members of AppNavigationStateService and AppForegroundStateService that had none, and add the missing @param entries. The recurring `owner` parameter is now explained, from DefaultAppNavigationStateService: the navigation state is a stack, pushing a level without its parent logs an error and does nothing, and a leave call whose owner does not match the current level is silently ignored so that a node which has already been replaced cannot pop someone else's state. Co-Authored-By: Claude Opus 5 (1M context) --- .../api/AppForegroundStateService.kt | 16 +++++++- .../api/AppNavigationStateService.kt | 41 +++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/services/appnavstate/api/src/main/kotlin/io/element/android/services/appnavstate/api/AppForegroundStateService.kt b/services/appnavstate/api/src/main/kotlin/io/element/android/services/appnavstate/api/AppForegroundStateService.kt index 33c2ee133b..8bfa747583 100644 --- a/services/appnavstate/api/src/main/kotlin/io/element/android/services/appnavstate/api/AppForegroundStateService.kt +++ b/services/appnavstate/api/src/main/kotlin/io/element/android/services/appnavstate/api/AppForegroundStateService.kt @@ -34,27 +34,41 @@ interface AppForegroundStateService { */ val isSyncingNotificationEvent: StateFlow + /** + * Updates to whether the app is publishing a live location will be emitted here. + */ val isSharingLiveLocation: StateFlow /** - * Start observing the foreground state. + * Start observing the foreground state; to be called once when the app process starts. */ fun startObservingForeground() /** * Update the in-call state. + * + * @param isInCall true while the user is in a call, which keeps the session syncing even in the background. */ fun updateIsInCallState(isInCall: Boolean) /** * Update the 'has ringing call' state. + * + * @param hasRingingCall true while an incoming call is ringing and has not yet been answered or declined. */ fun updateHasRingingCall(hasRingingCall: Boolean) /** * Update the active state for the syncing notification event flow. + * + * @param isSyncingNotificationEvent true while a push is being resolved, so the sync is not stopped mid-way. */ fun updateIsSyncingNotificationEvent(isSyncingNotificationEvent: Boolean) + /** + * Update the live location sharing state. + * + * @param isSharingLiveLocation true while at least one live location share is active on this device. + */ fun updateIsSharingLiveLocation(isSharingLiveLocation: Boolean) } diff --git a/services/appnavstate/api/src/main/kotlin/io/element/android/services/appnavstate/api/AppNavigationStateService.kt b/services/appnavstate/api/src/main/kotlin/io/element/android/services/appnavstate/api/AppNavigationStateService.kt index cf32bb0bf4..d6373f44c3 100644 --- a/services/appnavstate/api/src/main/kotlin/io/element/android/services/appnavstate/api/AppNavigationStateService.kt +++ b/services/appnavstate/api/src/main/kotlin/io/element/android/services/appnavstate/api/AppNavigationStateService.kt @@ -17,14 +17,55 @@ import kotlinx.coroutines.flow.StateFlow * A service that tracks the navigation and foreground states of the app. */ interface AppNavigationStateService { + /** + * Where the user currently is, as a stack that deepens from root to session, room and thread. + * Used by the components that need to know what is on screen, notably to suppress the notifications of the room being read. + */ val appNavigationState: StateFlow + /** + * Pushes a session onto the navigation state. + * + * @param owner identifies the navigation node reporting this, so that a later leave call can be matched to it. + * @param sessionId the session that was opened. + */ fun onNavigateToSession(owner: String, sessionId: SessionId) + + /** + * Pops back to the root. Does nothing when [owner] is not the owner of the current state, which is how out-of-order + * calls from a node that has already been replaced are ignored. + * + * @param owner the same value passed to [onNavigateToSession]. + */ fun onLeavingSession(owner: String) + /** + * Pushes a room onto the navigation state. Logs an error and does nothing unless a session was pushed first. + * + * @param owner identifies the navigation node reporting this. + * @param roomId the room that was opened. + */ fun onNavigateToRoom(owner: String, roomId: RoomId) + + /** + * Pops back to the parent session; as with [onLeavingSession], a mismatched [owner] makes this a no-op. + * + * @param owner the same value passed to [onNavigateToRoom]. + */ fun onLeavingRoom(owner: String) + /** + * Pushes a thread onto the navigation state. Logs an error and does nothing unless a room was pushed first. + * + * @param owner identifies the navigation node reporting this. + * @param threadId the thread that was opened. + */ fun onNavigateToThread(owner: String, threadId: ThreadId) + + /** + * Pops back to the parent room; as with [onLeavingSession], a mismatched [owner] makes this a no-op. + * + * @param owner the same value passed to [onNavigateToThread]. + */ fun onLeavingThread(owner: String) } From d713017afe40b649809459d29e2c6a38be92931c Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 11:51:32 +0200 Subject: [PATCH 087/145] Add KDoc to the `libraries/cryptography` API interfaces Document the members of SecretKeyRepository and EncryptionDecryptionService. The caveat worth having in the API doc comes from KeyStoreSecretKeyRepository: requiresUserAuthentication only takes effect when the key is created, so an existing key keeps whatever protection it was created with. Co-Authored-By: Claude Opus 5 (1M context) --- .../api/EncryptionDecryptionService.kt | 27 +++++++++++++++++++ .../cryptography/api/SecretKeyRepository.kt | 7 +++++ 2 files changed, 34 insertions(+) diff --git a/libraries/cryptography/api/src/main/kotlin/io/element/android/libraries/cryptography/api/EncryptionDecryptionService.kt b/libraries/cryptography/api/src/main/kotlin/io/element/android/libraries/cryptography/api/EncryptionDecryptionService.kt index fc882bc54b..1e2866a20f 100644 --- a/libraries/cryptography/api/src/main/kotlin/io/element/android/libraries/cryptography/api/EncryptionDecryptionService.kt +++ b/libraries/cryptography/api/src/main/kotlin/io/element/android/libraries/cryptography/api/EncryptionDecryptionService.kt @@ -15,8 +15,35 @@ import javax.crypto.SecretKey * Simple service to provide encryption and decryption operations. */ interface EncryptionDecryptionService { + /** + * Creates a cipher ready to encrypt, for the callers that need the cipher itself, such as to bind it to a biometric prompt. + * + * @param key the key to encrypt with. + */ fun createEncryptionCipher(key: SecretKey): Cipher + + /** + * Creates a cipher ready to decrypt, for the callers that need the cipher itself. + * + * @param key the key to decrypt with. + * @param initializationVector the vector produced when the data was encrypted. + */ fun createDecryptionCipher(key: SecretKey, initializationVector: ByteArray): Cipher + + /** + * Encrypts data in one call. + * + * @param key the key to encrypt with. + * @param input the plaintext bytes. + * @return the ciphertext along with the initialization vector needed to decrypt it. + */ fun encrypt(key: SecretKey, input: ByteArray): EncryptionResult + + /** + * Decrypts data in one call. + * + * @param key the key the data was encrypted with. + * @param encryptionResult the ciphertext and its initialization vector, as returned by [encrypt]. + */ fun decrypt(key: SecretKey, encryptionResult: EncryptionResult): ByteArray } diff --git a/libraries/cryptography/api/src/main/kotlin/io/element/android/libraries/cryptography/api/SecretKeyRepository.kt b/libraries/cryptography/api/src/main/kotlin/io/element/android/libraries/cryptography/api/SecretKeyRepository.kt index b210664d9f..c68f3170b9 100644 --- a/libraries/cryptography/api/src/main/kotlin/io/element/android/libraries/cryptography/api/SecretKeyRepository.kt +++ b/libraries/cryptography/api/src/main/kotlin/io/element/android/libraries/cryptography/api/SecretKeyRepository.kt @@ -16,10 +16,17 @@ import javax.crypto.SecretKey * Implementation should be able to store the generated key securely. */ interface SecretKeyRepository { + /** + * Whether a key exists for the given alias, re-emitted when it is created or deleted. + * + * @param alias the alias to watch. + */ fun hasKey(alias: String): Flow /** * Get or create a secret key for a given alias. + * Note that [requiresUserAuthentication] only applies when the key is created: an existing key keeps the protection it was created with. + * * @param alias the alias to use * @param requiresUserAuthentication true if the key should be protected by user authentication */ From fa123d941b8542fb8458840495547d9b9c3af157 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 11:51:32 +0200 Subject: [PATCH 088/145] Add KDoc to the `features/invite` API interfaces Document AcceptDeclineInviteEvents, AcceptDeclineInviteView and the SeenInvitesStore interface. The view doc explains why it is a shared component rather than part of one screen: it is embedded everywhere an invitation can be acted on, so the confirmation dialogs behave identically in the invite list and in a room preview. Co-Authored-By: Claude Opus 5 (1M context) --- .../android/features/invite/api/SeenInvitesStore.kt | 5 ++++- .../api/acceptdecline/AcceptDeclineInviteEvents.kt | 3 +++ .../api/acceptdecline/AcceptDeclineInviteView.kt | 13 +++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/features/invite/api/src/main/kotlin/io/element/android/features/invite/api/SeenInvitesStore.kt b/features/invite/api/src/main/kotlin/io/element/android/features/invite/api/SeenInvitesStore.kt index 046303ca4f..d8ab7c71c8 100644 --- a/features/invite/api/src/main/kotlin/io/element/android/features/invite/api/SeenInvitesStore.kt +++ b/features/invite/api/src/main/kotlin/io/element/android/features/invite/api/SeenInvitesStore.kt @@ -11,6 +11,9 @@ package io.element.android.features.invite.api import io.element.android.libraries.matrix.api.core.RoomId import kotlinx.coroutines.flow.Flow +/** + * Remembers which invitations the user has already looked at, so that only genuinely new ones are highlighted in the room list. + */ interface SeenInvitesStore { /** * Returns a flow of seen room IDs of invitation. @@ -32,7 +35,7 @@ interface SeenInvitesStore { suspend fun markAsUnSeen(roomId: RoomId) /** - * Delete the store. + * Delete the store, so every invitation counts as unseen again. */ suspend fun clear() } diff --git a/features/invite/api/src/main/kotlin/io/element/android/features/invite/api/acceptdecline/AcceptDeclineInviteEvents.kt b/features/invite/api/src/main/kotlin/io/element/android/features/invite/api/acceptdecline/AcceptDeclineInviteEvents.kt index 2caaacab2b..5691b19ef7 100644 --- a/features/invite/api/src/main/kotlin/io/element/android/features/invite/api/acceptdecline/AcceptDeclineInviteEvents.kt +++ b/features/invite/api/src/main/kotlin/io/element/android/features/invite/api/acceptdecline/AcceptDeclineInviteEvents.kt @@ -10,6 +10,9 @@ package io.element.android.features.invite.api.acceptdecline import io.element.android.features.invite.api.InviteData +/** + * Events sent to the accept/decline invite presenter, from whichever screen is showing the invitation. + */ interface AcceptDeclineInviteEvents { data class AcceptInvite(val invite: InviteData) : AcceptDeclineInviteEvents data class DeclineInvite(val invite: InviteData, val blockUser: Boolean, val shouldConfirm: Boolean) : AcceptDeclineInviteEvents diff --git a/features/invite/api/src/main/kotlin/io/element/android/features/invite/api/acceptdecline/AcceptDeclineInviteView.kt b/features/invite/api/src/main/kotlin/io/element/android/features/invite/api/acceptdecline/AcceptDeclineInviteView.kt index b6eec03a6f..6e9d78082b 100644 --- a/features/invite/api/src/main/kotlin/io/element/android/features/invite/api/acceptdecline/AcceptDeclineInviteView.kt +++ b/features/invite/api/src/main/kotlin/io/element/android/features/invite/api/acceptdecline/AcceptDeclineInviteView.kt @@ -12,7 +12,20 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import io.element.android.libraries.matrix.api.core.RoomId +/** + * Renders the confirmation dialogs and error states of accepting or declining an invitation; it draws nothing until such an event is sent. + * + * Embedded by every screen that can act on an invitation, so the behaviour stays identical between the invite list and a room preview. + */ fun interface AcceptDeclineInviteView { + /** + * Draws whichever dialog the current state calls for. + * + * @param state the state produced by the accept/decline presenter. + * @param onAcceptInviteSuccess called once the room has been joined, so the host screen can navigate into it. + * @param onDeclineInviteSuccess called once the invitation has been declined. + * @param modifier layout modifier for the container. + */ @Composable fun Render( state: AcceptDeclineInviteState, From 1b4d6c07fafbfc7edfffb6cf865e070e0031da8d Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 11:53:37 +0200 Subject: [PATCH 089/145] Add KDoc to the authentication, logout, preferences and share API interfaces Cover the remaining interfaces of features/login, features/logout, features/preferences and features/share, along with their members and parameters. Points recorded here: AccountProviderAccessControl returns true on a build with no enterprise restriction, ExtraDeveloperOptionsRenderer is bound to a no-op in the standard build, DirectLogoutView draws nothing until a logout event is sent, and CacheService exists because clearing a cache destroys the client and the app has to react. Co-Authored-By: Claude Opus 5 (1M context) --- .../android/features/login/api/LoginIntentResolver.kt | 7 +++++++ .../api/accesscontrol/AccountProviderAccessControl.kt | 8 ++++++++ .../features/logout/api/direct/DirectLogoutView.kt | 10 ++++++++++ .../android/features/preferences/api/CacheService.kt | 3 +++ .../preferences/api/ExtraDeveloperOptionsRenderer.kt | 5 +++++ .../element/android/features/share/api/OnSharedData.kt | 3 +++ .../android/features/share/api/ShareIntentHandler.kt | 4 ++++ 7 files changed, 40 insertions(+) diff --git a/features/login/api/src/main/kotlin/io/element/android/features/login/api/LoginIntentResolver.kt b/features/login/api/src/main/kotlin/io/element/android/features/login/api/LoginIntentResolver.kt index 79cfc35fbd..b2b7378be4 100644 --- a/features/login/api/src/main/kotlin/io/element/android/features/login/api/LoginIntentResolver.kt +++ b/features/login/api/src/main/kotlin/io/element/android/features/login/api/LoginIntentResolver.kt @@ -8,6 +8,13 @@ package io.element.android.features.login.api +/** + * Extracts the login parameters from a link, so that a deployment can hand out a URL that pre-fills the sign-in screen. + */ interface LoginIntentResolver { + /** + * @param uriString the link the app was opened with. + * @return the account provider and login hint to pre-fill, or `null` when the link is not a login link. + */ fun parse(uriString: String): LoginParams? } diff --git a/features/login/api/src/main/kotlin/io/element/android/features/login/api/accesscontrol/AccountProviderAccessControl.kt b/features/login/api/src/main/kotlin/io/element/android/features/login/api/accesscontrol/AccountProviderAccessControl.kt index fc804c14ff..0c35c1655f 100644 --- a/features/login/api/src/main/kotlin/io/element/android/features/login/api/accesscontrol/AccountProviderAccessControl.kt +++ b/features/login/api/src/main/kotlin/io/element/android/features/login/api/accesscontrol/AccountProviderAccessControl.kt @@ -8,6 +8,14 @@ package io.element.android.features.login.api.accesscontrol +/** + * Enforces the restriction an enterprise deployment can put on which account providers the user may sign in to. + */ interface AccountProviderAccessControl { + /** + * Whether sign-in to this provider is permitted; `true` on a build with no such restriction. + * + * @param accountProviderUrl the server the user is trying to use. + */ suspend fun isAllowedToConnectToAccountProvider(accountProviderUrl: String): Boolean } diff --git a/features/logout/api/src/main/kotlin/io/element/android/features/logout/api/direct/DirectLogoutView.kt b/features/logout/api/src/main/kotlin/io/element/android/features/logout/api/direct/DirectLogoutView.kt index 7841b85a5a..affd2be94d 100644 --- a/features/logout/api/src/main/kotlin/io/element/android/features/logout/api/direct/DirectLogoutView.kt +++ b/features/logout/api/src/main/kotlin/io/element/android/features/logout/api/direct/DirectLogoutView.kt @@ -10,7 +10,17 @@ package io.element.android.features.logout.api.direct import androidx.compose.runtime.Composable +/** + * Renders the confirmation dialogs of logging out directly, in particular the warning shown when the user would lose their room keys. + * + * It draws nothing until the host screen sends a logout event. + */ fun interface DirectLogoutView { + /** + * Draws whichever dialog the current state calls for. + * + * @param state the state produced by the direct logout presenter. + */ @Composable fun Render(state: DirectLogoutState) } diff --git a/features/preferences/api/src/main/kotlin/io/element/android/features/preferences/api/CacheService.kt b/features/preferences/api/src/main/kotlin/io/element/android/features/preferences/api/CacheService.kt index 82fcd1053f..9dc3eb1877 100644 --- a/features/preferences/api/src/main/kotlin/io/element/android/features/preferences/api/CacheService.kt +++ b/features/preferences/api/src/main/kotlin/io/element/android/features/preferences/api/CacheService.kt @@ -11,6 +11,9 @@ package io.element.android.features.preferences.api import io.element.android.libraries.matrix.api.core.SessionId import kotlinx.coroutines.flow.Flow +/** + * Announces that a session's cache has been cleared, since clearing it destroys the client and the app has to react. + */ interface CacheService { /** * A flow of [SessionId], can let the app to know when the diff --git a/features/preferences/api/src/main/kotlin/io/element/android/features/preferences/api/ExtraDeveloperOptionsRenderer.kt b/features/preferences/api/src/main/kotlin/io/element/android/features/preferences/api/ExtraDeveloperOptionsRenderer.kt index 7d7eec9d8b..3acb2c9057 100644 --- a/features/preferences/api/src/main/kotlin/io/element/android/features/preferences/api/ExtraDeveloperOptionsRenderer.kt +++ b/features/preferences/api/src/main/kotlin/io/element/android/features/preferences/api/ExtraDeveloperOptionsRenderer.kt @@ -14,6 +14,11 @@ import androidx.compose.ui.Modifier * Component for rendering extra developer options in the preferences screen. */ interface ExtraDeveloperOptionsRenderer { + /** + * Draws the extra options. The standard build binds a no-op implementation, so only the builds that actually add options provide a real one. + * + * @param modifier layout modifier for the container. + */ @Composable fun Render(modifier: Modifier) } diff --git a/features/share/api/src/main/kotlin/io/element/android/features/share/api/OnSharedData.kt b/features/share/api/src/main/kotlin/io/element/android/features/share/api/OnSharedData.kt index d7985e8b06..f635cc0cce 100644 --- a/features/share/api/src/main/kotlin/io/element/android/features/share/api/OnSharedData.kt +++ b/features/share/api/src/main/kotlin/io/element/android/features/share/api/OnSharedData.kt @@ -11,5 +11,8 @@ package io.element.android.features.share.api * Post-processing to be done once a [ShareIntentData] has been consumed. */ fun interface OnSharedData { + /** + * @param data the shared content that has just been handled, so any temporary copy of it can be released. + */ operator fun invoke(data: ShareIntentData) } diff --git a/features/share/api/src/main/kotlin/io/element/android/features/share/api/ShareIntentHandler.kt b/features/share/api/src/main/kotlin/io/element/android/features/share/api/ShareIntentHandler.kt index d689c57398..d85ae9792a 100644 --- a/features/share/api/src/main/kotlin/io/element/android/features/share/api/ShareIntentHandler.kt +++ b/features/share/api/src/main/kotlin/io/element/android/features/share/api/ShareIntentHandler.kt @@ -9,10 +9,14 @@ package io.element.android.features.share.api import android.content.Intent +/** + * Recognises the intents another app uses to share content into this one, and resolves what was shared. + */ interface ShareIntentHandler { /** * This methods aims to handle incoming share intents and parse its data. * + * @param intent the intent the app was started with. * @return the [ShareIntentData] if it could be resolved, or null. */ fun handleIncomingShareIntent( From 9822b3d4f75c4bbba56424b134b8da21698362da Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 12:00:42 +0200 Subject: [PATCH 090/145] Add KDoc to the single-interface feature API modules Cover the last remaining interfaces across features/announcement, cachecleaner, call, contentscanner, createroom, knockrequests, lockscreen, rolesandpermissions, startchat, userprofile and viewfolder, with their members and parameters. Grouped into one commit rather than eleven near-empty ones, per the AGENTS.md rule about tiny commits. This completes every features/* api module. Co-Authored-By: Claude Opus 5 (1M context) --- .../announcement/api/AnnouncementService.kt | 19 +++++++++++++++++++ .../features/cachecleaner/api/CacheCleaner.kt | 3 +++ .../features/call/api/CurrentCallService.kt | 3 +++ .../api/ContentScannerService.kt | 6 ++++++ .../createroom/api/CreateRoomEntryPoint.kt | 12 ++++++++++++ .../api/banner/KnockRequestsBannerRenderer.kt | 9 +++++++++ .../lockscreen/api/LockScreenService.kt | 3 +++ .../api/ChangeRoomMemberRolesEntryPoint.kt | 10 ++++++++++ .../features/startchat/api/StartDMAction.kt | 5 +++++ .../api/UserProfilePresenterFactory.kt | 6 ++++++ .../features/viewfolder/api/TextFileViewer.kt | 9 +++++++++ 11 files changed, 85 insertions(+) diff --git a/features/announcement/api/src/main/kotlin/io/element/android/features/announcement/api/AnnouncementService.kt b/features/announcement/api/src/main/kotlin/io/element/android/features/announcement/api/AnnouncementService.kt index 42c66aa29d..23c748d6da 100644 --- a/features/announcement/api/src/main/kotlin/io/element/android/features/announcement/api/AnnouncementService.kt +++ b/features/announcement/api/src/main/kotlin/io/element/android/features/announcement/api/AnnouncementService.kt @@ -12,15 +12,34 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import kotlinx.coroutines.flow.Flow +/** + * Queues the full-screen announcements shown to the user once, such as the notice about a new feature. + * + * A dismissed announcement is remembered so it is not shown again. + */ interface AnnouncementService { + /** + * Queues an announcement, unless the user has already dismissed it. + * + * @param announcement the announcement to show. + */ suspend fun showAnnouncement(announcement: Announcement) + /** + * Records that the user dismissed an announcement, so it is not queued again. + * + * @param announcement the announcement that was dismissed. + */ suspend fun onAnnouncementDismissed(announcement: Announcement) + /** The announcements still waiting to be shown, in the order they should appear. */ fun announcementsToShowFlow(): Flow> /** * Use this composable to render the announcement UI in Fullscreen. + * Draws nothing while there is no announcement to show. + * + * @param modifier layout modifier for the container. */ @Composable fun Render( diff --git a/features/cachecleaner/api/src/main/kotlin/io/element/android/features/cachecleaner/api/CacheCleaner.kt b/features/cachecleaner/api/src/main/kotlin/io/element/android/features/cachecleaner/api/CacheCleaner.kt index b5a5396b16..48b464cb21 100644 --- a/features/cachecleaner/api/src/main/kotlin/io/element/android/features/cachecleaner/api/CacheCleaner.kt +++ b/features/cachecleaner/api/src/main/kotlin/io/element/android/features/cachecleaner/api/CacheCleaner.kt @@ -8,6 +8,9 @@ package io.element.android.features.cachecleaner.api +/** + * Removes the temporary files holding decrypted content, so plaintext media does not linger on disk. + */ interface CacheCleaner { /** * Clear the cache subdirs holding temporarily decrypted content (such as media and voice messages). diff --git a/features/call/api/src/main/kotlin/io/element/android/features/call/api/CurrentCallService.kt b/features/call/api/src/main/kotlin/io/element/android/features/call/api/CurrentCallService.kt index 25720596ba..20ff7ef4d8 100644 --- a/features/call/api/src/main/kotlin/io/element/android/features/call/api/CurrentCallService.kt +++ b/features/call/api/src/main/kotlin/io/element/android/features/call/api/CurrentCallService.kt @@ -10,6 +10,9 @@ package io.element.android.features.call.api import kotlinx.coroutines.flow.StateFlow +/** + * Tracks the call the user is currently in on this device, so unrelated parts of the app can react to it. + */ interface CurrentCallService { /** * The current call state flow, which will be updated when the active call changes. diff --git a/features/contentscanner/api/src/main/kotlin/io/element/android/features/contentscanner/api/ContentScannerService.kt b/features/contentscanner/api/src/main/kotlin/io/element/android/features/contentscanner/api/ContentScannerService.kt index 68f7af28f1..3649768eb7 100644 --- a/features/contentscanner/api/src/main/kotlin/io/element/android/features/contentscanner/api/ContentScannerService.kt +++ b/features/contentscanner/api/src/main/kotlin/io/element/android/features/contentscanner/api/ContentScannerService.kt @@ -18,5 +18,11 @@ import io.element.android.libraries.matrix.ui.media.contentvalidation.ContentVal * This will only process media when a [ContentScanner] is provided when building the client in Pro. */ fun interface ContentScannerService { + /** + * Starts scanning the given media, reporting the verdict of each one through [contentValidationState] rather than by returning. + * + * @param mediaSources the media to scan. + * @param contentValidationState where the outcome of each scan is published for the UI to observe. + */ fun scan(mediaSources: List, contentValidationState: ContentValidationState) } diff --git a/features/createroom/api/src/main/kotlin/io/element/android/features/createroom/api/CreateRoomEntryPoint.kt b/features/createroom/api/src/main/kotlin/io/element/android/features/createroom/api/CreateRoomEntryPoint.kt index 271fdb2332..3128b8073a 100644 --- a/features/createroom/api/src/main/kotlin/io/element/android/features/createroom/api/CreateRoomEntryPoint.kt +++ b/features/createroom/api/src/main/kotlin/io/element/android/features/createroom/api/CreateRoomEntryPoint.kt @@ -15,9 +15,21 @@ import io.element.android.libraries.architecture.FeatureEntryPoint import io.element.android.libraries.matrix.api.core.RoomId interface CreateRoomEntryPoint : FeatureEntryPoint { + /** + * Configures the create-room flow before it is started, since it serves rooms and spaces from the same screens. + */ interface Builder { + /** + * @param isSpace true to create a space rather than a room. + */ fun setIsSpace(isSpace: Boolean): Builder + + /** + * @param parentSpaceId the space the new room should be added to once created. + */ fun setParentSpace(parentSpaceId: RoomId): Builder + + /** Builds the node with the options configured so far. */ fun build(): Node } diff --git a/features/knockrequests/api/src/main/kotlin/io/element/android/features/knockrequests/api/banner/KnockRequestsBannerRenderer.kt b/features/knockrequests/api/src/main/kotlin/io/element/android/features/knockrequests/api/banner/KnockRequestsBannerRenderer.kt index 34061db335..e6be68b95a 100644 --- a/features/knockrequests/api/src/main/kotlin/io/element/android/features/knockrequests/api/banner/KnockRequestsBannerRenderer.kt +++ b/features/knockrequests/api/src/main/kotlin/io/element/android/features/knockrequests/api/banner/KnockRequestsBannerRenderer.kt @@ -11,7 +11,16 @@ package io.element.android.features.knockrequests.api.banner import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +/** + * Renders the banner shown at the top of a room when people are waiting to join it. + */ interface KnockRequestsBannerRenderer { + /** + * Draws the banner, or nothing when there is no pending request or the user cannot moderate the room. + * + * @param modifier layout modifier for the container. + * @param onViewRequestsClick called when the user asks to see the full list of requests. + */ @Composable fun View(modifier: Modifier, onViewRequestsClick: () -> Unit) } diff --git a/features/lockscreen/api/src/main/kotlin/io/element/android/features/lockscreen/api/LockScreenService.kt b/features/lockscreen/api/src/main/kotlin/io/element/android/features/lockscreen/api/LockScreenService.kt index bd644e69e9..59c148660e 100644 --- a/features/lockscreen/api/src/main/kotlin/io/element/android/features/lockscreen/api/LockScreenService.kt +++ b/features/lockscreen/api/src/main/kotlin/io/element/android/features/lockscreen/api/LockScreenService.kt @@ -17,6 +17,9 @@ import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach +/** + * Exposes the app lock state: whether a PIN or biometric lock is set up, whether it is mandatory, and whether the app is locked right now. + */ interface LockScreenService { /** * The current lock state of the app. diff --git a/features/rolesandpermissions/api/src/main/kotlin/io/element/android/features/rolesandpermissions/api/ChangeRoomMemberRolesEntryPoint.kt b/features/rolesandpermissions/api/src/main/kotlin/io/element/android/features/rolesandpermissions/api/ChangeRoomMemberRolesEntryPoint.kt index 7cfdfefae0..4f823387f3 100644 --- a/features/rolesandpermissions/api/src/main/kotlin/io/element/android/features/rolesandpermissions/api/ChangeRoomMemberRolesEntryPoint.kt +++ b/features/rolesandpermissions/api/src/main/kotlin/io/element/android/features/rolesandpermissions/api/ChangeRoomMemberRolesEntryPoint.kt @@ -22,8 +22,18 @@ fun interface ChangeRoomMemberRolesEntryPoint : FeatureEntryPoint { listType: ChangeRoomMemberRolesListType, ): Node + /** + * Lets a caller outside this feature wait for the role change to finish, which is needed when leaving a room depends on it. + */ interface NodeProxy { + /** The room whose member roles are being changed. */ val roomId: RoomId + + /** + * Suspends until the user finishes or abandons the flow. + * + * @return true when roles were actually changed, false when the user backed out. + */ suspend fun waitForCompletion(): Boolean } } diff --git a/features/startchat/api/src/main/kotlin/io/element/android/features/startchat/api/StartDMAction.kt b/features/startchat/api/src/main/kotlin/io/element/android/features/startchat/api/StartDMAction.kt index 6aa2ad5d98..2e5a92f18e 100644 --- a/features/startchat/api/src/main/kotlin/io/element/android/features/startchat/api/StartDMAction.kt +++ b/features/startchat/api/src/main/kotlin/io/element/android/features/startchat/api/StartDMAction.kt @@ -13,6 +13,11 @@ import io.element.android.libraries.architecture.AsyncAction import io.element.android.libraries.matrix.api.core.RoomId import io.element.android.libraries.matrix.api.user.MatrixUser +/** + * Opens a direct message with a user, reusing the existing room when there is one. + * + * Progress is reported into the state passed in, so the caller only has to render it. + */ interface StartDMAction { /** * Try to find an existing DM with the given user, or create one if none exists. diff --git a/features/userprofile/api/src/main/kotlin/io/element/android/features/userprofile/api/UserProfilePresenterFactory.kt b/features/userprofile/api/src/main/kotlin/io/element/android/features/userprofile/api/UserProfilePresenterFactory.kt index 4bf68ae324..80a21505f5 100644 --- a/features/userprofile/api/src/main/kotlin/io/element/android/features/userprofile/api/UserProfilePresenterFactory.kt +++ b/features/userprofile/api/src/main/kotlin/io/element/android/features/userprofile/api/UserProfilePresenterFactory.kt @@ -11,6 +11,12 @@ package io.element.android.features.userprofile.api import io.element.android.libraries.architecture.Presenter import io.element.android.libraries.matrix.api.core.UserId +/** + * Creates the user profile presenter, so that other features can show a profile without depending on this one's implementation. + */ fun interface UserProfilePresenterFactory { + /** + * @param userId the user whose profile is shown. + */ fun create(userId: UserId): Presenter } diff --git a/features/viewfolder/api/src/main/kotlin/io/element/android/features/viewfolder/api/TextFileViewer.kt b/features/viewfolder/api/src/main/kotlin/io/element/android/features/viewfolder/api/TextFileViewer.kt index 29a7c9f9e8..5abc27546d 100644 --- a/features/viewfolder/api/src/main/kotlin/io/element/android/features/viewfolder/api/TextFileViewer.kt +++ b/features/viewfolder/api/src/main/kotlin/io/element/android/features/viewfolder/api/TextFileViewer.kt @@ -12,7 +12,16 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import kotlinx.collections.immutable.ImmutableList +/** + * Renders the contents of a text file, used by the log viewer in the developer options. + */ fun interface TextFileViewer { + /** + * Draws the file, one row per line. + * + * @param lines the already-read contents of the file. + * @param modifier layout modifier for the container. + */ @Composable fun Render( lines: ImmutableList, From b74b146917b4daeb07f7a8275c33982297e04fcc Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 12:04:40 +0200 Subject: [PATCH 091/145] Add KDoc to the single-interface library and service API modules Cover the last remaining interfaces across libraries/audio, libraries/cachestore, libraries/indicator, libraries/slashcommands, libraries/voiceplayer and services/apperror, with their members and parameters. This completes the effort: all 222 in-scope interfaces and their 820 members in the 60 api modules that hold any now carry documentation. Notable points: CacheStore applies no expiry of its own and only records when each entry was written, leaving staleness to the caller; SlashCommandService.parse never throws, returning NotACommand for ordinary text and an error case for a malformed command. Co-Authored-By: Claude Opus 5 (1M context) --- .../android/libraries/audio/api/AudioFocus.kt | 3 +++ .../libraries/cachestore/api/CacheStore.kt | 24 +++++++++++++++++++ .../indicator/api/IndicatorService.kt | 2 ++ .../slashcommands/api/SlashCommandService.kt | 24 ++++++++++++++++++- .../api/VoiceMessagePresenterFactory.kt | 10 ++++++++ .../apperror/api/AppErrorStateService.kt | 16 +++++++++++++ 6 files changed, 78 insertions(+), 1 deletion(-) diff --git a/libraries/audio/api/src/main/kotlin/io/element/android/libraries/audio/api/AudioFocus.kt b/libraries/audio/api/src/main/kotlin/io/element/android/libraries/audio/api/AudioFocus.kt index aeccaa9b8a..de2e5844d5 100644 --- a/libraries/audio/api/src/main/kotlin/io/element/android/libraries/audio/api/AudioFocus.kt +++ b/libraries/audio/api/src/main/kotlin/io/element/android/libraries/audio/api/AudioFocus.kt @@ -15,6 +15,9 @@ enum class AudioFocusRequester { MediaViewer, } +/** + * Claims and releases system audio focus, so that the app's own players do not talk over each other or over other apps. + */ interface AudioFocus { /** * Request audio focus for the given requester. diff --git a/libraries/cachestore/api/src/main/kotlin/io/element/android/libraries/cachestore/api/CacheStore.kt b/libraries/cachestore/api/src/main/kotlin/io/element/android/libraries/cachestore/api/CacheStore.kt index 5df446f688..bbfb7d3405 100644 --- a/libraries/cachestore/api/src/main/kotlin/io/element/android/libraries/cachestore/api/CacheStore.kt +++ b/libraries/cachestore/api/src/main/kotlin/io/element/android/libraries/cachestore/api/CacheStore.kt @@ -7,9 +7,33 @@ package io.element.android.libraries.cachestore.api +/** + * A generic on-disk key/value cache, where each entry records when it was written so callers can decide for themselves when it is stale. + */ interface CacheStore { + /** + * Stores an entry, replacing any previous one under the same key. + * + * @param key the entry to write. + * @param data the value along with the time it was obtained. + */ suspend fun storeData(key: String, data: CacheData) + + /** + * Reads an entry without applying any expiry of its own; judging staleness is up to the caller. + * + * @param key the entry to read. + * @return the value and its timestamp, or `null` when nothing is stored under that key. + */ suspend fun getData(key: String): CacheData? + + /** + * Removes one entry. + * + * @param key the entry to delete. + */ suspend fun deleteData(key: String) + + /** Empties the whole cache. */ suspend fun deleteAll() } diff --git a/libraries/indicator/api/src/main/kotlin/io/element/android/libraries/indicator/api/IndicatorService.kt b/libraries/indicator/api/src/main/kotlin/io/element/android/libraries/indicator/api/IndicatorService.kt index 0409a0f846..d2fde82d8a 100644 --- a/libraries/indicator/api/src/main/kotlin/io/element/android/libraries/indicator/api/IndicatorService.kt +++ b/libraries/indicator/api/src/main/kotlin/io/element/android/libraries/indicator/api/IndicatorService.kt @@ -15,9 +15,11 @@ import androidx.compose.runtime.State * A set of State to observe to display or not the indicators in the UI. */ interface IndicatorService { + /** Whether to show the red dot on the room list top bar, which aggregates the reasons the user should open the settings. */ @Composable fun showRoomListTopBarIndicator(): State + /** Whether to show the red dot on the chat backup setting, i.e. when recovery needs the user's attention. */ @Composable fun showSettingChatBackupIndicator(): State } diff --git a/libraries/slashcommands/api/src/main/kotlin/io/element/android/libraries/slashcommands/api/SlashCommandService.kt b/libraries/slashcommands/api/src/main/kotlin/io/element/android/libraries/slashcommands/api/SlashCommandService.kt index 9dfca26078..7ae056e38b 100644 --- a/libraries/slashcommands/api/src/main/kotlin/io/element/android/libraries/slashcommands/api/SlashCommandService.kt +++ b/libraries/slashcommands/api/src/main/kotlin/io/element/android/libraries/slashcommands/api/SlashCommandService.kt @@ -9,7 +9,19 @@ package io.element.android.libraries.slashcommands.api import io.element.android.libraries.matrix.api.timeline.Timeline +/** + * Recognises and runs the slash commands the user can type in the composer, such as `/me` or `/join`. + * + * The composer first [parse]s what was typed, then hands the result to whichever proceed method matches its kind; navigation + * commands and the error cases are handled by the composer itself. + */ interface SlashCommandService { + /** + * Returns the commands whose name starts with what has been typed, so the composer can offer an autocomplete list. + * + * @param text the current composer content. + * @param isInThread whether the composer is in a thread, since not every command is available there. + */ suspend fun getSuggestions( text: String, isInThread: Boolean, @@ -17,6 +29,11 @@ interface SlashCommandService { /** * Parse the message and return a SlashCommand. + * Ordinary text comes back as `NotACommand`, and a malformed or unsupported command as one of the error cases, so this never throws. + * + * @param textMessage the composer content as plain text. + * @param formattedMessage the composer content as HTML, or `null` when unformatted. + * @param isInThreadTimeline whether the composer is in a thread. */ suspend fun parse( textMessage: CharSequence, @@ -26,6 +43,9 @@ interface SlashCommandService { /** * Proceed a SlashCommandSendMessage. + * + * @param slashCommand the parsed command, carrying the content to send. + * @param timeline the timeline to send it to. */ suspend fun proceedSendMessage( slashCommand: SlashCommand.SlashCommandSendMessage, @@ -33,7 +53,9 @@ interface SlashCommandService { ): Result /** - * Proceed a SlashCommandAdmin. + * Proceed a SlashCommandAdmin, i.e. one that acts on the room or its members rather than sending a message. + * + * @param slashCommand the parsed command to run. */ suspend fun proceedAdmin( slashCommand: SlashCommand.SlashCommandAdmin, diff --git a/libraries/voiceplayer/api/src/main/kotlin/io/element/android/libraries/voiceplayer/api/VoiceMessagePresenterFactory.kt b/libraries/voiceplayer/api/src/main/kotlin/io/element/android/libraries/voiceplayer/api/VoiceMessagePresenterFactory.kt index 0229ed991f..1b576a6d72 100644 --- a/libraries/voiceplayer/api/src/main/kotlin/io/element/android/libraries/voiceplayer/api/VoiceMessagePresenterFactory.kt +++ b/libraries/voiceplayer/api/src/main/kotlin/io/element/android/libraries/voiceplayer/api/VoiceMessagePresenterFactory.kt @@ -13,7 +13,17 @@ import io.element.android.libraries.matrix.api.core.EventId import io.element.android.libraries.matrix.api.media.MediaSource import kotlin.time.Duration +/** + * Creates the presenter of a single voice message player, one per voice message shown in a timeline. + */ interface VoiceMessagePresenterFactory { + /** + * @param eventId the event carrying the voice message, or `null` while it is still a local echo. + * @param mediaSource where the audio is fetched from. + * @param mimeType the MIME type of the audio, or `null` when the event did not state it. + * @param filename the file name to display, or `null` when the event did not state it. + * @param duration the length of the recording, used to render the waveform before the audio is downloaded. + */ fun createVoiceMessagePresenter( eventId: EventId?, mediaSource: MediaSource, diff --git a/services/apperror/api/src/main/kotlin/io/element/android/services/apperror/api/AppErrorStateService.kt b/services/apperror/api/src/main/kotlin/io/element/android/services/apperror/api/AppErrorStateService.kt index 7c592e2102..d9ae37c097 100644 --- a/services/apperror/api/src/main/kotlin/io/element/android/services/apperror/api/AppErrorStateService.kt +++ b/services/apperror/api/src/main/kotlin/io/element/android/services/apperror/api/AppErrorStateService.kt @@ -11,10 +11,26 @@ package io.element.android.services.apperror.api import androidx.annotation.StringRes import kotlinx.coroutines.flow.StateFlow +/** + * Surfaces app-wide error dialogs from anywhere, for the failures that are not tied to the screen the user is on. + */ interface AppErrorStateService { + /** The error to display, if any; observed once at the top of the app rather than per screen. */ val appErrorStateFlow: StateFlow + /** + * Shows an error dialog with already resolved text. + * + * @param title the dialog title. + * @param body the dialog message; never put user content or secrets in it. + */ fun showError(title: String, body: String) + /** + * Shows an error dialog from string resources, which is the preferred form since it stays localised. + * + * @param titleRes resource id of the dialog title. + * @param bodyRes resource id of the dialog message. + */ fun showError(@StringRes titleRes: Int, @StringRes bodyRes: Int) } From 2c94cee5754ceff21550f6c682a715d23d9a6fc0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 14 Aug 2026 12:18:43 +0200 Subject: [PATCH 092/145] Update dependency org.matrix.rustcomponents:sdk-android to v26.08.13 (#7420) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c0a6746e0a..17eb8ff751 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -185,7 +185,7 @@ test_detekt_test = { module = "io.gitlab.arturbosch.detekt:detekt-test", version # https://github.com/matrix-org/matrix-rust-components-kotlin/commits/main/sdk/sdk-android/src/main/kotlin/org/matrix/rustcomponents/sdk/matrix_sdk_ffi.kt # All new features should not be implemented in the pull request that upgrades the version, developers should # only fix API breaks and may add some TODOs. -matrix_sdk = "org.matrix.rustcomponents:sdk-android:26.08.11" +matrix_sdk = "org.matrix.rustcomponents:sdk-android:26.08.13" # Others coil = { module = "io.coil-kt.coil3:coil", version.ref = "coil" } From 1ab401482ac177a865bb9a882ed3c051fc437d4a Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 12:20:49 +0200 Subject: [PATCH 093/145] Fix formatting issues --- .../location/api/live/ActiveLiveLocationShareManager.kt | 6 ++---- .../poll/api/pollcontent/PollContentStateFactory.kt | 1 + .../libraries/eventformatter/api/TimelineEventFormatter.kt | 1 + .../io/element/android/libraries/matrix/api/MatrixClient.kt | 1 + .../android/libraries/permissions/api/PermissionsStore.kt | 1 - .../android/libraries/sessionstorage/api/SessionStore.kt | 3 +-- .../android/libraries/usersearch/api/UserListDataSource.kt | 2 +- 7 files changed, 7 insertions(+), 8 deletions(-) diff --git a/features/location/api/src/main/kotlin/io/element/android/features/location/api/live/ActiveLiveLocationShareManager.kt b/features/location/api/src/main/kotlin/io/element/android/features/location/api/live/ActiveLiveLocationShareManager.kt index 74c9089c30..64c28209ca 100644 --- a/features/location/api/src/main/kotlin/io/element/android/features/location/api/live/ActiveLiveLocationShareManager.kt +++ b/features/location/api/src/main/kotlin/io/element/android/features/location/api/live/ActiveLiveLocationShareManager.kt @@ -30,8 +30,7 @@ interface ActiveLiveLocationShareManager { * Starts live location sharing in the given room. * Calls room.startLiveLocationShare() on the SDK, registers the share, * and starts the foreground GPS service if not already running. - */ - /** + * * @param roomId the room to start sharing the location in. * @param duration how long the share should last before it expires on its own. */ @@ -41,8 +40,7 @@ interface ActiveLiveLocationShareManager { * Stops live location sharing in the given room. * Calls room.stopLiveLocationShare() on the SDK, removes the share, * and stops the foreground service if no shares remain. - */ - /** + * * @param roomId the room to stop sharing the location in. */ suspend fun stopShare(roomId: RoomId): Result diff --git a/features/poll/api/src/main/kotlin/io/element/android/features/poll/api/pollcontent/PollContentStateFactory.kt b/features/poll/api/src/main/kotlin/io/element/android/features/poll/api/pollcontent/PollContentStateFactory.kt index 87e3f5eece..f9b4a56efc 100644 --- a/features/poll/api/src/main/kotlin/io/element/android/features/poll/api/pollcontent/PollContentStateFactory.kt +++ b/features/poll/api/src/main/kotlin/io/element/android/features/poll/api/pollcontent/PollContentStateFactory.kt @@ -30,6 +30,7 @@ interface PollContentStateFactory { content = content, ) } + /** * @param eventId the poll start event, or `null` while the poll is still a local echo. * @param isEditable whether the current user may still edit the poll. diff --git a/libraries/eventformatter/api/src/main/kotlin/io/element/android/libraries/eventformatter/api/TimelineEventFormatter.kt b/libraries/eventformatter/api/src/main/kotlin/io/element/android/libraries/eventformatter/api/TimelineEventFormatter.kt index 37081be242..67d263f168 100644 --- a/libraries/eventformatter/api/src/main/kotlin/io/element/android/libraries/eventformatter/api/TimelineEventFormatter.kt +++ b/libraries/eventformatter/api/src/main/kotlin/io/element/android/libraries/eventformatter/api/TimelineEventFormatter.kt @@ -31,6 +31,7 @@ interface TimelineEventFormatter { senderDisambiguatedDisplayName = event.senderProfile.getDisambiguatedDisplayName(event.sender), ) } + /** * @param content the event content to describe. * @param isOutgoing whether the event was sent by the current user, which selects the first-person wording. diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt index 519ccfe3a4..0f5ed8ebf8 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt @@ -135,6 +135,7 @@ interface MatrixClient : UrlContentFetcher { /** Scans media content before it is displayed, or `null` when no content scanner is configured for this session. */ val contentScanner: ContentScanner? + /** * Returns the room with the given id if the user has joined it, along with its live [Timeline]. * A new instance is created on each call and the caller owns it, so it must be closed once no longer needed. diff --git a/libraries/permissions/api/src/main/kotlin/io/element/android/libraries/permissions/api/PermissionsStore.kt b/libraries/permissions/api/src/main/kotlin/io/element/android/libraries/permissions/api/PermissionsStore.kt index 0bf7f0aefd..2d37f016f9 100644 --- a/libraries/permissions/api/src/main/kotlin/io/element/android/libraries/permissions/api/PermissionsStore.kt +++ b/libraries/permissions/api/src/main/kotlin/io/element/android/libraries/permissions/api/PermissionsStore.kt @@ -49,6 +49,5 @@ interface PermissionsStore { suspend fun resetPermission(permission: String) /** Forgets every recorded permission; exposed for debugging from the developer options. */ - // To debug suspend fun resetStore() } diff --git a/libraries/session-storage/api/src/main/kotlin/io/element/android/libraries/sessionstorage/api/SessionStore.kt b/libraries/session-storage/api/src/main/kotlin/io/element/android/libraries/sessionstorage/api/SessionStore.kt index 53aa0c9516..641a2afdf2 100644 --- a/libraries/session-storage/api/src/main/kotlin/io/element/android/libraries/sessionstorage/api/SessionStore.kt +++ b/libraries/session-storage/api/src/main/kotlin/io/element/android/libraries/sessionstorage/api/SessionStore.kt @@ -32,8 +32,7 @@ interface SessionStore { /** * Add a new session. If other sessions exist, the new one will be set as the latest used one, and * the added session position will be set to a value higher than the other session positions. - */ - /** + * * @param sessionData the session to store, including its tokens. */ suspend fun addSession(sessionData: SessionData) diff --git a/libraries/usersearch/api/src/main/kotlin/io/element/android/libraries/usersearch/api/UserListDataSource.kt b/libraries/usersearch/api/src/main/kotlin/io/element/android/libraries/usersearch/api/UserListDataSource.kt index 9446668502..3697125922 100644 --- a/libraries/usersearch/api/src/main/kotlin/io/element/android/libraries/usersearch/api/UserListDataSource.kt +++ b/libraries/usersearch/api/src/main/kotlin/io/element/android/libraries/usersearch/api/UserListDataSource.kt @@ -17,11 +17,11 @@ import io.element.android.libraries.matrix.api.user.MatrixUser interface UserListDataSource { /** * Searches the user directory, returning an empty list rather than failing when the request does not succeed. + * TODO should probably have a flow * * @param query the text to look for in user ids and display names. * @param count the maximum number of results to return. */ - // TODO should probably have a flow suspend fun search(query: String, count: Long): List /** From 7d9f4b9af4b04a0757b5e551323d05d2445d65f2 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 12:22:37 +0200 Subject: [PATCH 094/145] Fix outdated documentation. --- .../services/toolbox/api/sdk/BuildVersionSdkIntProvider.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/toolbox/api/src/main/kotlin/io/element/android/services/toolbox/api/sdk/BuildVersionSdkIntProvider.kt b/services/toolbox/api/src/main/kotlin/io/element/android/services/toolbox/api/sdk/BuildVersionSdkIntProvider.kt index 40b2b2aac8..385109d6c8 100644 --- a/services/toolbox/api/src/main/kotlin/io/element/android/services/toolbox/api/sdk/BuildVersionSdkIntProvider.kt +++ b/services/toolbox/api/src/main/kotlin/io/element/android/services/toolbox/api/sdk/BuildVersionSdkIntProvider.kt @@ -20,8 +20,9 @@ interface BuildVersionSdkIntProvider { fun get(): Int /** - * Checks the if the current OS version is equal or greater than [version]. + * Checks if the current OS version is equal or greater than [version], and run [result] if so. * + * @param T the type of the result to compute. * @param version the minimum API level required. * @param result computed and returned only when the requirement is met. * @return A `non-null` result if true, `null` otherwise. From ea076ecc4bddd880ee8019709115454852653f9e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 14 Aug 2026 11:48:17 +0000 Subject: [PATCH 095/145] Update media3 to v1.11.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 17eb8ff751..d1a777d3b5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -17,7 +17,7 @@ constraintlayout = "2.2.2" constraintlayout_compose = "1.1.2" lifecycle = "2.11.0" activity = "1.13.0" -media3 = "1.10.1" +media3 = "1.11.0" camera = "1.6.1" work = "2.11.2" From 54ba43a8ec5646f73bfd903059745b014d3b5695 Mon Sep 17 00:00:00 2001 From: Jenna Vassar Date: Fri, 14 Aug 2026 08:12:51 -0700 Subject: [PATCH 096/145] Use the correct license header on the new account provider history files --- .../login/impl/accountprovider/SaveAccountProviderToHistory.kt | 2 +- .../impl/accountprovider/AccountProviderDataSourceFixture.kt | 2 +- .../impl/accountprovider/SaveAccountProviderToHistoryTest.kt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/SaveAccountProviderToHistory.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/SaveAccountProviderToHistory.kt index 46f3281826..b3b99115cc 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/SaveAccountProviderToHistory.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/SaveAccountProviderToHistory.kt @@ -1,5 +1,5 @@ /* - * Copyright 2025 New Vector Ltd. + * Copyright (c) 2026 Element Creations Ltd. * * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. * Please see LICENSE files in the repository root for full details. diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderDataSourceFixture.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderDataSourceFixture.kt index e8f9dbefb9..25bc67144b 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderDataSourceFixture.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderDataSourceFixture.kt @@ -1,5 +1,5 @@ /* - * Copyright 2025 New Vector Ltd. + * Copyright (c) 2026 Element Creations Ltd. * * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. * Please see LICENSE files in the repository root for full details. diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accountprovider/SaveAccountProviderToHistoryTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accountprovider/SaveAccountProviderToHistoryTest.kt index 21fd7efce8..0af8188f3f 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accountprovider/SaveAccountProviderToHistoryTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accountprovider/SaveAccountProviderToHistoryTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2025 New Vector Ltd. + * Copyright (c) 2026 Element Creations Ltd. * * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. * Please see LICENSE files in the repository root for full details. From f488da890b57c94f4ba6492f1f21d9b12289d300 Mon Sep 17 00:00:00 2001 From: Jenna Vassar Date: Fri, 14 Aug 2026 08:57:37 -0700 Subject: [PATCH 097/145] Update the maestro sign-in flow for the consolidated account provider screen --- .maestro/tests/account/changeServer.yaml | 21 ------------------- .maestro/tests/account/login.yaml | 3 +-- .../assertions/assertLoginDisplayed.yaml | 2 +- 3 files changed, 2 insertions(+), 24 deletions(-) delete mode 100644 .maestro/tests/account/changeServer.yaml diff --git a/.maestro/tests/account/changeServer.yaml b/.maestro/tests/account/changeServer.yaml deleted file mode 100644 index b07fa5cc09..0000000000 --- a/.maestro/tests/account/changeServer.yaml +++ /dev/null @@ -1,21 +0,0 @@ -appId: ${MAESTRO_APP_ID} ---- -- tapOn: - id: "login-change_server" -- takeScreenshot: build/maestro/200-ChangeServer -- tapOn: "matrix.org" -- tapOn: - id: "login-change_server" -- tapOn: "Other" -- tapOn: - id: "change_server-server" -- inputText: "element" -- hideKeyboard -- extendedWaitUntil: - visible: "element.io" - timeout: 10000 -- tapOn: "element.io" -# Revert to matrix.org -- tapOn: - id: "login-change_server" -- tapOn: "matrix.org" diff --git a/.maestro/tests/account/login.yaml b/.maestro/tests/account/login.yaml index 873843b22d..81922c7f38 100644 --- a/.maestro/tests/account/login.yaml +++ b/.maestro/tests/account/login.yaml @@ -3,8 +3,7 @@ appId: ${MAESTRO_APP_ID} - tapOn: "Sign in manually" - runFlow: ../assertions/assertLoginDisplayed.yaml - takeScreenshot: build/maestro/100-SignIn -- runFlow: changeServer.yaml -- runFlow: ../assertions/assertLoginDisplayed.yaml +# The account provider field defaults to matrix.org, so continue straight to the MAS login. - tapOn: id: "login-continue" ## MAS page diff --git a/.maestro/tests/assertions/assertLoginDisplayed.yaml b/.maestro/tests/assertions/assertLoginDisplayed.yaml index 6d8558c38e..c32f23c323 100644 --- a/.maestro/tests/assertions/assertLoginDisplayed.yaml +++ b/.maestro/tests/assertions/assertLoginDisplayed.yaml @@ -1,5 +1,5 @@ appId: ${MAESTRO_APP_ID} --- - extendedWaitUntil: - visible: "Change account provider" + visible: "Enter your account provider" timeout: 10000 From 23b75c342361ab400e3c2ff795507dea82ceac02 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Sat, 15 Aug 2026 11:05:43 +0200 Subject: [PATCH 098/145] Fix outdated documentation. (#7430) --- .../features/location/api/internal/TileServerStyleUriBuilder.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/TileServerStyleUriBuilder.kt b/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/TileServerStyleUriBuilder.kt index 4cfc8c4a2f..9676005f59 100644 --- a/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/TileServerStyleUriBuilder.kt +++ b/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/TileServerStyleUriBuilder.kt @@ -22,7 +22,7 @@ interface TileServerStyleUriBuilder { /** * Builds the style URI the map view loads its tiles from. * - * @param customMapStyleUrl the style advertised by the homeserver, or `null` to use the one built into the app. + * @param customMapTilerConfig the custom MapTiler configuration received from the server, or null if not available. * @param darkMode whether to request the dark map style. */ fun build( From 45057b35a58333810b0ada06ab8bd3d8bc6fe12e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 15 Aug 2026 09:07:16 +0000 Subject: [PATCH 099/145] Update dependency org.maplibre.compose:maplibre-compose to v0.14.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 17eb8ff751..f576c77125 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -217,7 +217,7 @@ telephoto_flick = { module = "me.saket.telephoto:flick-android", version.ref = " statemachine = "com.freeletics.flowredux:compose:1.2.2" maplibre = "org.maplibre.gl:android-sdk:13.4.1" maplibre_ktx = "org.maplibre.gl:android-sdk-ktx-v7:3.0.2" -maplibre_compose = "org.maplibre.compose:maplibre-compose:0.13.1" +maplibre_compose = "org.maplibre.compose:maplibre-compose:0.14.0" maplibre_annotation = "org.maplibre.gl:android-plugin-annotation-v9:3.0.2" opusencoder = "io.element.android:opusencoder:1.2.0" zxing_cpp = "io.github.zxing-cpp:android:3.1.1" From 04dcc14eaaad0b178dfc133431adeb89ca12eb6a Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Sun, 16 Aug 2026 22:44:29 +0300 Subject: [PATCH 100/145] Show an error when the room to leave cannot be found showLeaveRoomAlert ran its whole body inside client.getRoom(roomId)?.use { }. When getRoom returned null, which happens for a room the client can no longer resolve, the body was skipped without writing any state: leaveAction stayed Uninitialized, so no confirmation dialog and no error was displayed and Leave room appeared to do nothing at all. Handle the missing room explicitly and surface it as a failure, which AsyncActionView already renders with the generic error dialog. leaveRoom used a !! for the same lookup, so it reported the miss as a NullPointerException; it now throws the same named exception. --- .../leaveroom/impl/LeaveRoomPresenter.kt | 13 ++++++++-- .../impl/LeaveBaseRoomPresenterTest.kt | 26 +++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/features/leaveroom/impl/src/main/kotlin/io/element/android/features/leaveroom/impl/LeaveRoomPresenter.kt b/features/leaveroom/impl/src/main/kotlin/io/element/android/features/leaveroom/impl/LeaveRoomPresenter.kt index d11dc7e7e8..e2065bca1f 100644 --- a/features/leaveroom/impl/src/main/kotlin/io/element/android/features/leaveroom/impl/LeaveRoomPresenter.kt +++ b/features/leaveroom/impl/src/main/kotlin/io/element/android/features/leaveroom/impl/LeaveRoomPresenter.kt @@ -60,7 +60,13 @@ class LeaveRoomPresenter( roomId: RoomId, leaveAction: MutableState>, ) = launch(dispatchers.io) { - client.getRoom(roomId)?.use { room -> + val room = client.getRoom(roomId) + if (room == null) { + Timber.e("Unable to find room $roomId to leave it") + leaveAction.value = AsyncAction.Failure(RoomNotFoundException(roomId)) + return@launch + } + room.use { val roomInfo = room.roomInfoFlow.first() leaveAction.value = when { roomInfo.isDm -> Confirmation.Dm(roomId) @@ -78,7 +84,8 @@ class LeaveRoomPresenter( leaveAction: MutableState>, ) = launch(dispatchers.io) { leaveAction.runCatchingUpdatingState { - client.getRoom(roomId)!!.use { room -> + val room = client.getRoom(roomId) ?: throw RoomNotFoundException(roomId) + room.use { room .leave() .onSuccess { notificationConversationService.onLeftRoom(client.sessionId, roomId) } @@ -100,3 +107,5 @@ class LeaveRoomPresenter( } } } + +internal class RoomNotFoundException(roomId: RoomId) : IllegalStateException("Room $roomId not found") diff --git a/features/leaveroom/impl/src/test/kotlin/io/element/android/features/leaveroom/impl/LeaveBaseRoomPresenterTest.kt b/features/leaveroom/impl/src/test/kotlin/io/element/android/features/leaveroom/impl/LeaveBaseRoomPresenterTest.kt index 90b7f2369f..f8f7a771e1 100644 --- a/features/leaveroom/impl/src/test/kotlin/io/element/android/features/leaveroom/impl/LeaveBaseRoomPresenterTest.kt +++ b/features/leaveroom/impl/src/test/kotlin/io/element/android/features/leaveroom/impl/LeaveBaseRoomPresenterTest.kt @@ -175,6 +175,32 @@ class LeaveBaseRoomPresenterTest { } } + @Test + fun `present - show error if the room to confirm leaving is not found`() = runTest { + val presenter = createLeaveRoomPresenter(client = FakeMatrixClient()) + presenter.stateFlow().test { + val initialState = awaitItem() + initialState.eventSink(LeaveRoomEvent.LeaveRoom(A_ROOM_ID, needsConfirmation = true)) + val errorState = awaitItem() + assertThat(errorState.leaveAction).isInstanceOf(AsyncAction.Failure::class.java) + cancelAndIgnoreRemainingEvents() + } + } + + @Test + fun `present - show error if the room to leave is not found`() = runTest { + val presenter = createLeaveRoomPresenter(client = FakeMatrixClient()) + presenter.stateFlow().test { + val initialState = awaitItem() + initialState.eventSink(LeaveRoomEvent.LeaveRoom(A_ROOM_ID, needsConfirmation = false)) + val progressState = awaitItem() + assertThat(progressState.leaveAction).isEqualTo(AsyncAction.Loading) + val errorState = awaitItem() + assertThat(errorState.leaveAction).isInstanceOf(AsyncAction.Failure::class.java) + cancelAndIgnoreRemainingEvents() + } + } + @Test fun `present - reset state after error`() = runTest { val presenter = createLeaveRoomPresenter( From c901b902b14c0db38c593341be7b8543656e216b Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Sun, 16 Aug 2026 22:44:48 +0300 Subject: [PATCH 101/145] Exclude carriage returns from the login and password fields The sanitize() helper applied to the login, password and account deactivation password fields promises to remove "any new line characters" but only removes LF. A value pasted from a source with CRLF endings keeps its CR, which is invisible in the field and is sent to the homeserver as part of the password, so the login is rejected while typing the same characters by hand works. Drop every line separator instead of LF only, in both copies of the helper. Whitespace that can legitimately be part of a password, such as spaces and tabs, is left untouched. --- .../logout/impl/AccountDeactivationView.kt | 4 +-- .../loginpassword/LoginPasswordView.kt | 4 +-- .../loginpassword/LoginPasswordViewTest.kt | 30 +++++++++++++++++++ 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/features/deactivation/impl/src/main/kotlin/io/element/android/features/logout/impl/AccountDeactivationView.kt b/features/deactivation/impl/src/main/kotlin/io/element/android/features/logout/impl/AccountDeactivationView.kt index 738046b3a3..9b5f0cfd99 100644 --- a/features/deactivation/impl/src/main/kotlin/io/element/android/features/logout/impl/AccountDeactivationView.kt +++ b/features/deactivation/impl/src/main/kotlin/io/element/android/features/logout/impl/AccountDeactivationView.kt @@ -299,10 +299,10 @@ private fun Content( } /** - * Ensure that the string does not contain any new line characters, which can happen when pasting values. + * Ensure that the string does not contain any line separator, which can happen when pasting values. */ private fun String.sanitize(): String { - return replace("\n", "") + return filterNot { it == '\n' || it == '\r' } } @PreviewsDayNight diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordView.kt index 06a1641644..9757f5e9ee 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordView.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordView.kt @@ -274,10 +274,10 @@ private fun LoginForm( } /** - * Ensure that the string does not contain any new line characters, which can happen when pasting values. + * Ensure that the string does not contain any line separator, which can happen when pasting values. */ private fun String.sanitize(): String { - return replace("\n", "") + return filterNot { it == '\n' || it == '\r' } } @Composable diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordViewTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordViewTest.kt index 3a128f2e4f..d76c94d5ea 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordViewTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordViewTest.kt @@ -81,6 +81,21 @@ class LoginPasswordViewTest : RobolectricTest() { ) } + @Test + fun `changing login removes carriage returns the expected event`() = runAndroidComposeUiTest { + val eventsRecorder = EventsRecorder() + setLoginPasswordView( + aLoginPasswordState( + eventSink = eventsRecorder, + ), + ) + val userNameHint = activity!!.getString(CommonStrings.common_username) + onNodeWithText(userNameHint).performTextInput("a\r\nb") + eventsRecorder.assertSingle( + LoginPasswordEvents.SetLogin("ab") + ) + } + @Test fun `clearing login invokes the expected event`() = runAndroidComposeUiTest { val eventsRecorder = EventsRecorder() @@ -112,6 +127,21 @@ class LoginPasswordViewTest : RobolectricTest() { ) } + @Test + fun `changing password removes carriage returns the expected event`() = runAndroidComposeUiTest { + val eventsRecorder = EventsRecorder() + setLoginPasswordView( + aLoginPasswordState( + eventSink = eventsRecorder, + ), + ) + val passwordHint = activity!!.getString(CommonStrings.common_password) + onNodeWithText(passwordHint).performTextInput("a\r\nb") + eventsRecorder.assertSingle( + LoginPasswordEvents.SetPassword("ab") + ) + } + @Test fun `reveal password makes the password visible`() = runAndroidComposeUiTest { val eventsRecorder = EventsRecorder(expectEvents = false) From 537842bb4065471b8dbf10b5a7c221e03ece6f5e Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Mon, 17 Aug 2026 03:40:11 +0300 Subject: [PATCH 102/145] Convert markdown to HTML when a caption is edited Adding or editing a media caption from the plain composer sent the caption as text only: the composer has no HTML to pass, and the media caption edit was built by hand with a null formatted body, so the markdown was never rendered. Sending a caption with the same markdown does render it, because the SDK builds the formatted body there. Build the edit with the SDK's createCaptionEdit, which runs the caption through the same markdown conversion the send path uses. --- .../android/libraries/matrix/impl/timeline/RustTimeline.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt index bd756bc002..64c07304c5 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt @@ -75,6 +75,7 @@ import org.matrix.rustcomponents.sdk.PollData import org.matrix.rustcomponents.sdk.SendAttachmentJoinHandle import org.matrix.rustcomponents.sdk.UploadParameters import org.matrix.rustcomponents.sdk.UploadSource +import org.matrix.rustcomponents.sdk.createCaptionEdit import org.matrix.rustcomponents.sdk.use import timber.log.Timber import uniffi.matrix_sdk.PaginationStatus @@ -341,7 +342,7 @@ class RustTimeline( formattedCaption: String?, ): Result = withContext(dispatcher) { runCatchingExceptions { - val editedContent = EditedContent.MediaCaption( + val editedContent = createCaptionEdit( caption = caption, formattedCaption = formattedCaption?.let { FormattedBody(body = it, format = MessageFormat.Html) From 999bee2420dfeb215ebb4e7e34873e6ae6c38714 Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Mon, 17 Aug 2026 03:40:53 +0300 Subject: [PATCH 103/145] Remove the F-Droid dex patching step from the release script fix-pg-map-id.py rewrites the pg_map_id of a dex file, but the dex format changed and its regex no longer matches anything, so the step is a no-op and the F-Droid build is reproducible without it. inplace-fix.py only existed to drive it; none of its other commands are used here. The removed call also re-ran zipalign -P 16 on each APK. AGP aligns the release APKs at packaging time and apksigner is already invoked with --alignment-preserved, so the signed output stays 16 KB aligned. --- tools/release/fix-pg-map-id.py | 227 --------------------------------- tools/release/inplace-fix.py | 199 ----------------------------- tools/release/release.sh | 9 -- 3 files changed, 435 deletions(-) delete mode 100644 tools/release/fix-pg-map-id.py delete mode 100644 tools/release/inplace-fix.py diff --git a/tools/release/fix-pg-map-id.py b/tools/release/fix-pg-map-id.py deleted file mode 100644 index c37fec2528..0000000000 --- a/tools/release/fix-pg-map-id.py +++ /dev/null @@ -1,227 +0,0 @@ -#!/usr/bin/python3 -# encoding: utf-8 -# SPDX-FileCopyrightText: 2024 FC (Fay) Stegerman -# SPDX-License-Identifier: GPL-3.0-or-later. - -import hashlib -import os -import re -import struct -import zipfile -import zlib - -from binascii import hexlify -from typing import Any, Dict, Match, Tuple - -DEX_MAGIC = b"dex\n" -DEX_MAGIC_RE = re.compile(rb"dex\n(\d{3})\x00") - -PROF_MAGIC = b"pro\x00" -PROF_010_P = b"010\x00" - -CLASSES_DEX_RE = re.compile(r"classes\d*\.dex") -ASSET_PROF = "assets/dexopt/baseline.prof" - -PG_MAP_ID_RE = re.compile(rb'(~~R8{"backend":"dex".*?"pg-map-id":")([0-9a-f]{7})(")') - -ATTRS = ("compress_type", "create_system", "create_version", "date_time", - "external_attr", "extract_version", "flag_bits") -LEVELS = (9, 6, 4, 1) - - -class Error(RuntimeError): - pass - - -# FIXME: is there a better alternative? -class ReproducibleZipInfo(zipfile.ZipInfo): - """Reproducible ZipInfo hack.""" - - if "_compresslevel" not in zipfile.ZipInfo.__slots__: # type: ignore[attr-defined] - if "compress_level" not in zipfile.ZipInfo.__slots__: # type: ignore[attr-defined] - raise Error("zipfile.ZipInfo has no ._compresslevel") - - _compresslevel: int - _override: Dict[str, Any] = {} - - def __init__(self, zinfo: zipfile.ZipInfo, **override: Any) -> None: - # pylint: disable=W0231 - if override: - self._override = {**self._override, **override} - for k in self.__slots__: - if hasattr(zinfo, k): - setattr(self, k, getattr(zinfo, k)) - - def __getattribute__(self, name: str) -> Any: - if name != "_override": - try: - return self._override[name] - except KeyError: - pass - return object.__getattribute__(self, name) - - -def fix_pg_map_id(input_dir: str, output_dir: str, map_id: str) -> None: - file_data = {} - for filename in [ASSET_PROF] + sorted(os.listdir(input_dir)): - if re.fullmatch(CLASSES_DEX_RE, filename) or filename == ASSET_PROF: - print(f"reading {filename!r}...") - with open(os.path.join(input_dir, *filename.split("/")), "rb") as fh: - file_data[filename] = fh.read() - _fix_pg_map_id(file_data, map_id) - for filename, data in file_data.items(): - print(f"writing {filename!r}...") - if "/" in filename: - os.makedirs(os.path.join(output_dir, *filename.split("/")[:-1]), exist_ok=True) - with open(os.path.join(output_dir, *filename.split("/")), "wb") as fh: - fh.write(data) - - -def fix_pg_map_id_apk(input_apk: str, output_apk: str, map_id: str) -> None: - with open(input_apk, "rb") as fh_raw: - with zipfile.ZipFile(input_apk) as zf_in: - with zipfile.ZipFile(output_apk, "w") as zf_out: - file_data = {} - for info in zf_in.infolist(): - if re.fullmatch(CLASSES_DEX_RE, info.filename) or info.filename == ASSET_PROF: - print(f"reading {info.filename!r}...") - file_data[info.filename] = zf_in.read(info) - _fix_pg_map_id(file_data, map_id) - for info in zf_in.infolist(): - attrs = {attr: getattr(info, attr) for attr in ATTRS} - zinfo = ReproducibleZipInfo(info, **attrs) - if info.compress_type == 8: - fh_raw.seek(info.header_offset) - n, m = struct.unpack(" 0: - ccrc = zlib.crc32(fh_raw.read(min(size, 4096)), ccrc) - size -= 4096 - with zf_in.open(info) as fh_in: - comps = {lvl: zlib.compressobj(lvl, 8, -15) for lvl in LEVELS} - ccrcs = {lvl: 0 for lvl in LEVELS} - while True: - data = fh_in.read(4096) - if not data: - break - for lvl in LEVELS: - ccrcs[lvl] = zlib.crc32(comps[lvl].compress(data), ccrcs[lvl]) - for lvl in LEVELS: - if ccrc == zlib.crc32(comps[lvl].flush(), ccrcs[lvl]): - zinfo._compresslevel = lvl - break - else: - raise Error(f"Unable to determine compresslevel for {info.filename!r}") - elif info.compress_type != 0: - raise Error(f"Unsupported compress_type {info.compress_type}") - if re.fullmatch(CLASSES_DEX_RE, info.filename) or info.filename == ASSET_PROF: - print(f"writing {info.filename!r}...") - zf_out.writestr(zinfo, file_data[info.filename]) - else: - with zf_in.open(info) as fh_in: - with zf_out.open(zinfo, "w") as fh_out: - while True: - data = fh_in.read(4096) - if not data: - break - fh_out.write(data) - - -def _fix_pg_map_id(file_data: Dict[str, bytes], map_id: str) -> None: - crcs = {} - for filename in file_data: - if re.fullmatch(CLASSES_DEX_RE, filename): - print(f"fixing {filename!r}...") - data = _fix_dex_id_checksum(file_data[filename], map_id.encode()) - file_data[filename] = data - crcs[filename] = zlib.crc32(data) - if ASSET_PROF in file_data: - print(f"fixing {ASSET_PROF!r}...") - file_data[ASSET_PROF] = _fix_prof_checksum(file_data[ASSET_PROF], crcs) - - -def _fix_dex_id_checksum(data: bytes, map_id: bytes) -> bytes: - def repl(m: Match[bytes]) -> bytes: - print(f"fixing pg-map-id: {m.group(2)!r} -> {map_id!r}") - return m.group(1) + map_id + m.group(3) - - magic = data[:8] - if magic[:4] != DEX_MAGIC or not DEX_MAGIC_RE.fullmatch(magic): - raise Error(f"Unsupported magic {magic!r}") - print(f"dex version={int(magic[4:7]):03d}") - checksum, signature = struct.unpack(" {hexlify(fixed_sig).decode()}") - fixed_data = fixed_sig + fixed_data - fixed_checksum = zlib.adler32(fixed_data) - print(f"fixing checksum: 0x{checksum:x} -> 0x{fixed_checksum:x}") - return magic + int.to_bytes(fixed_checksum, 4, "little") + fixed_data - - -def _fix_prof_checksum(data: bytes, crcs: Dict[str, int]) -> bytes: - magic, data = _split(data, 4) - version, data = _split(data, 4) - if magic == PROF_MAGIC: - if version == PROF_010_P: - print("prof version=010 P") - return PROF_MAGIC + PROF_010_P + _fix_prof_010_p_checksum(data, crcs) - else: - raise Error(f"Unsupported prof version {version!r}") - else: - raise Error(f"Unsupported magic {magic!r}") - - -def _fix_prof_010_p_checksum(data: bytes, crcs: Dict[str, int]) -> bytes: - num_dex_files, uncompressed_data_size, compressed_data_size, data = _unpack(" 0x{fixed_checksum:x}") - dex_data_headers.append(struct.pack( - " Any: - assert all(c in " Tuple[bytes, bytes]: - return data[:size], data[size:] - - -if __name__ == "__main__": - import argparse - parser = argparse.ArgumentParser(prog="fix-pg-map-id.py") - parser.add_argument("input_dir_or_apk", metavar="INPUT_DIR_OR_APK") - parser.add_argument("output_dir_or_apk", metavar="OUTPUT_DIR_OR_APK") - parser.add_argument("pg_map_id", metavar="PG_MAP_ID") - args = parser.parse_args() - if os.path.isdir(args.input_dir_or_apk): - fix_pg_map_id(args.input_dir_or_apk, args.output_dir_or_apk, args.pg_map_id) - else: - fix_pg_map_id_apk(args.input_dir_or_apk, args.output_dir_or_apk, args.pg_map_id) - -# vim: set tw=80 sw=4 sts=4 et fdm=marker : diff --git a/tools/release/inplace-fix.py b/tools/release/inplace-fix.py deleted file mode 100644 index a791e69140..0000000000 --- a/tools/release/inplace-fix.py +++ /dev/null @@ -1,199 +0,0 @@ -#!/usr/bin/python3 -# encoding: utf-8 -# SPDX-FileCopyrightText: 2024 FC (Fay) Stegerman -# SPDX-License-Identifier: GPL-3.0-or-later. - -import argparse -import os -import shutil -import subprocess -import sys -import tempfile - -from typing import Optional, Tuple - -COMMANDS = ( - "fix-compresslevel", - "fix-files", - "fix-newlines", - "fix-pg-map-id", - "rm-files", - "sort-apk", - "sort-baseline", -) - -BUILD_TOOLS_WITH_BROKEN_ZIPALIGN = ("31.0.0", "32.0.0") -BUILD_TOOLS_WITH_PAGE_SIZE_FROM = "35.0.0-rc1" -SDK_ENV = ("ANDROID_HOME", "ANDROID_SDK", "ANDROID_SDK_ROOT") - - -def _zipalign_cmd(page_align: bool, page_size: Optional[int]) -> Tuple[str, ...]: - if page_align: - if page_size is not None: - return ("zipalign", "-P", str(page_size), "4") - return ("zipalign", "-p", "4") - return ("zipalign", "4") - - -ZIPALIGN = _zipalign_cmd(page_align=False, page_size=None) -ZIPALIGN_P = _zipalign_cmd(page_align=True, page_size=None) - - -class Error(RuntimeError): - pass - - -def inplace_fix(command: str, input_file: str, *args: str, - zipalign: bool = False, page_align: bool = False, - page_size: Optional[int] = None, internal: bool = False) -> None: - if command not in COMMANDS: - raise Error(f"Unknown command {command}") - exe, script = _script_cmd(command) - ext = os.path.splitext(input_file)[1] - with tempfile.TemporaryDirectory() as tdir: - fixed = os.path.join(tdir, "fixed" + ext) - run_command(exe, script, input_file, fixed, *args, trim=2) - if zipalign: - aligned = os.path.join(tdir, "aligned" + ext) - zac = zipalign_cmd(page_align=page_align, page_size=page_size, internal=internal) - run_command(*zac, fixed, aligned, trim=2) - print(f"[MOVE] {aligned} to {input_file}") - shutil.move(aligned, input_file) - else: - print(f"[MOVE] {fixed} to {input_file}") - shutil.move(fixed, input_file) - - -def zipalign_cmd(page_align: bool = False, page_size: Optional[int] = None, - internal: bool = False) -> Tuple[str, ...]: - """ - Find zipalign command using $PATH or $ANDROID_HOME etc. - - >>> zipalign_cmd() - ('zipalign', '4') - >>> zipalign_cmd(page_align=True) - ('zipalign', '-p', '4') - >>> zipalign_cmd(page_align=True, page_size=16) - ('zipalign', '-P', '16', '4') - >>> cmd = zipalign_cmd(page_align=True, page_size=16, internal=True) - >>> [x.split("/")[-1] for x in cmd] - ['python3', 'zipalign.py', '-P', '16', '4'] - >>> os.environ["PATH"] = "" - >>> for k in SDK_ENV: - ... os.environ[k] = "" - >>> cmd = zipalign_cmd() - >>> [x.split("/")[-1] for x in cmd] - ['python3', 'zipalign.py', '4'] - >>> os.environ["ANDROID_HOME"] = "test/fake-sdk" - >>> zipalign_cmd() - [SKIP BROKEN] 31.0.0 - [FOUND] test/fake-sdk/build-tools/30.0.3/zipalign - ('test/fake-sdk/build-tools/30.0.3/zipalign', '4') - >>> cmd = zipalign_cmd(page_align=True, page_size=16) - [SKIP TOO OLD] 31.0.0 - [SKIP TOO OLD] 30.0.3 - [SKIP TOO OLD] 26.0.2 - >>> [x.split("/")[-1] for x in cmd] - ['python3', 'zipalign.py', '-P', '16', '4'] - >>> os.environ["ANDROID_HOME"] = "test/fake-sdk-2" - >>> zipalign_cmd(page_align=True, page_size=16) - [FOUND] test/fake-sdk-2/build-tools/35.0.0-rc1/zipalign - ('test/fake-sdk-2/build-tools/35.0.0-rc1/zipalign', '-P', '16', '4') - - """ - cmd, *args = _zipalign_cmd(page_align, page_size) - if not internal: - if shutil.which(cmd): - return (cmd, *args) - for k in SDK_ENV: - if home := os.environ.get(k): - tools = os.path.join(home, "build-tools") - if os.path.exists(tools): - for vsn in sorted(os.listdir(tools), key=_vsn, reverse=True): - if page_size and _vsn(vsn) < _vsn(BUILD_TOOLS_WITH_PAGE_SIZE_FROM): - print(f"[SKIP TOO OLD] {vsn}") - continue - for s in BUILD_TOOLS_WITH_BROKEN_ZIPALIGN: - if vsn.startswith(s): - print(f"[SKIP BROKEN] {vsn}") - break - else: - c = os.path.join(tools, vsn, cmd) - if shutil.which(c): - print(f"[FOUND] {c}") - return (c, *args) - return (*_script_cmd(cmd), *args) - - -def _vsn(v: str) -> Tuple[int, ...]: - """ - >>> vs = "31.0.0 32.1.0-rc1 34.0.0-rc3 34.0.0 35.0.0-rc1".split() - >>> for v in sorted(vs, key=_vsn, reverse=True): - ... (_vsn(v), v) - ((35, 0, 0, 0, 1), '35.0.0-rc1') - ((34, 0, 0, 1, 0), '34.0.0') - ((34, 0, 0, 0, 3), '34.0.0-rc3') - ((32, 1, 0, 0, 1), '32.1.0-rc1') - ((31, 0, 0, 1, 0), '31.0.0') - """ - if "-rc" in v: - v = v.replace("-rc", ".0.", 1) - else: - v = v + ".1.0" - return tuple(int(x) if x.isdigit() else -1 for x in v.split(".")) - - -def _script_cmd(command: str) -> Tuple[str, str]: - script_dir = os.path.dirname(__file__) - for cmd in (command, command.replace("-", "_")): - script = os.path.join(script_dir, cmd + ".py") - if os.path.exists(script): - break - else: - raise Error(f"Script for {command} not found") - exe = sys.executable or "python3" - return exe, script - - -def run_command(*args: str, trim: int = 1) -> None: - targs = tuple(os.path.basename(a) for a in args[:trim]) + args[trim:] - print(f"[RUN] {' '.join(targs)}") - try: - subprocess.run(args, check=True) - except subprocess.CalledProcessError as e: - raise Error(f"{args[0]} command failed") from e - except FileNotFoundError as e: - raise Error(f"{args[0]} command not found") from e - - -def main() -> None: - prog = os.path.basename(sys.argv[0]) - usage = (f"{prog} [-h] [--zipalign] [--page-align] [--page-size N] [--internal]\n" - f"{len('usage: ' + prog) * ' '} COMMAND INPUT_FILE [...]") - epilog = f"Commands: {', '.join(COMMANDS)}." - parser = argparse.ArgumentParser(usage=usage, epilog=epilog) - parser.add_argument("--zipalign", action="store_true", - help="run zipalign after COMMAND") - parser.add_argument("--page-align", action="store_true", - help="run zipalign w/ -p option (implies --zipalign)") - parser.add_argument("--page-size", metavar="N", type=int, - help="run zipalign w/ -P N option (implies --page-align)") - parser.add_argument("--internal", action="store_true", - help="use zipalign.py instead of searching $PATH/$ANDROID_HOME/etc.") - parser.add_argument("command", metavar="COMMAND") - parser.add_argument("input_file", metavar="INPUT_FILE") - args, rest = parser.parse_known_args() - try: - inplace_fix(args.command, args.input_file, *rest, - zipalign=bool(args.zipalign or args.page_align or args.page_size), - page_align=bool(args.page_align or args.page_size), - page_size=args.page_size, internal=args.internal) - except Error as e: - print(f"Error: {e}.", file=sys.stderr) - sys.exit(1) - - -if __name__ == "__main__": - main() - -# vim: set tw=80 sw=4 sts=4 et fdm=marker : diff --git a/tools/release/release.sh b/tools/release/release.sh index 83ccc6d258..392074208a 100755 --- a/tools/release/release.sh +++ b/tools/release/release.sh @@ -225,15 +225,6 @@ printf "Unzipping the F-Droid artifact...\n" fdroidTargetPath="${targetPath}/fdroid" unzip "${targetPath}"/elementx-app-fdroid-apks-unsigned.zip -d "${fdroidTargetPath}" -printf "\n================================================================================\n" -printf "Patching the FDroid APKs using inplace-fix.py...\n" - -inplaceFixScript="./tools/release/inplace-fix.py" -python3 "${inplaceFixScript}" --page-size 16 fix-pg-map-id "${fdroidTargetPath}"/app-fdroid-arm64-v8a-release.apk '0000000' -python3 "${inplaceFixScript}" --page-size 16 fix-pg-map-id "${fdroidTargetPath}"/app-fdroid-armeabi-v7a-release.apk '0000000' -python3 "${inplaceFixScript}" --page-size 16 fix-pg-map-id "${fdroidTargetPath}"/app-fdroid-x86-release.apk '0000000' -python3 "${inplaceFixScript}" --page-size 16 fix-pg-map-id "${fdroidTargetPath}"/app-fdroid-x86_64-release.apk '0000000' - printf "\n================================================================================\n" printf "Signing the FDroid APKs...\n" From c5a878249bf6bb03dd1ae376597fb7e5095d78b4 Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Mon, 17 Aug 2026 03:48:44 +0300 Subject: [PATCH 104/145] Open the user profile of a user id that contains a slash A slash is valid in the local part of a user id, but in a permalink it also separates the identifier from an event id, so the SDK could not tell the two apart and the link fell back to opening matrix.to in a browser. Only a user id can start with an @, so recover it before handing the URI to the SDK, and only when the identifier really contains a slash so every other permalink keeps taking the same path. --- .../impl/permalink/DefaultPermalinkParser.kt | 20 +++++++++ .../permalink/DefaultPermalinkParserTest.kt | 44 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/permalink/DefaultPermalinkParserTest.kt diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/permalink/DefaultPermalinkParser.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/permalink/DefaultPermalinkParser.kt index e59530e874..a5f372d7d1 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/permalink/DefaultPermalinkParser.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/permalink/DefaultPermalinkParser.kt @@ -8,11 +8,13 @@ package io.element.android.libraries.matrix.impl.permalink +import android.net.Uri import androidx.core.net.toUri import dev.zacsweers.metro.AppScope import dev.zacsweers.metro.ContributesBinding import io.element.android.libraries.core.extensions.runCatchingExceptions import io.element.android.libraries.matrix.api.core.EventId +import io.element.android.libraries.matrix.api.core.MatrixPatterns import io.element.android.libraries.matrix.api.core.RoomAlias import io.element.android.libraries.matrix.api.core.RoomId import io.element.android.libraries.matrix.api.core.UserId @@ -51,6 +53,10 @@ class DefaultPermalinkParser( matrixToConverter.convert(uri) ?: return PermalinkData.FallbackLink(uri) } + matrixToUri.userIdWithSlash()?.let { userId -> + return PermalinkData.UserLink(userId = userId) + } + val result = runCatchingExceptions { parseMatrixEntityFrom(matrixToUri.toString()) }.getOrNull() @@ -84,3 +90,17 @@ class DefaultPermalinkParser( } } } + +/** + * A slash is allowed in the local part of a user id, but it also separates an identifier from an + * event id in a permalink, so [parseMatrixEntityFrom] cannot tell the two apart. Only a user id can + * start with an `@`, so recover it here rather than letting the ambiguity reach the SDK. + */ +private fun Uri.userIdWithSlash(): UserId? { + val identifier = fragment + ?.removePrefix("/") + ?.substringBefore('?') + ?: return null + if (!identifier.startsWith("@") || !identifier.contains('/')) return null + return identifier.takeIf { MatrixPatterns.isUserId(it) }?.let(::UserId) +} diff --git a/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/permalink/DefaultPermalinkParserTest.kt b/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/permalink/DefaultPermalinkParserTest.kt new file mode 100644 index 0000000000..416213a0b2 --- /dev/null +++ b/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/permalink/DefaultPermalinkParserTest.kt @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2026 Element Creations Ltd. + * + * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. + * Please see LICENSE files in the repository root for full details. + */ + +package io.element.android.libraries.matrix.impl.permalink + +import com.google.common.truth.Truth.assertThat +import io.element.android.libraries.matrix.api.core.UserId +import io.element.android.libraries.matrix.api.permalink.PermalinkData +import io.element.android.tests.testutils.robolectric.RobolectricTest +import org.junit.Test + +class DefaultPermalinkParserTest : RobolectricTest() { + @Test + fun `a matrix-to link to a user id with a slash is parsed as a user link`() { + val result = createParser().parse("https://matrix.to/#/@it/sme:matrix.org") + assertThat(result).isEqualTo(PermalinkData.UserLink(UserId("@it/sme:matrix.org"))) + } + + @Test + fun `an escaped slash in a user id is parsed as a user link`() { + val result = createParser().parse("https://matrix.to/#/@it%2Fsme:matrix.org") + assertThat(result).isEqualTo(PermalinkData.UserLink(UserId("@it/sme:matrix.org"))) + } + + @Test + fun `an element web link to a user id with a slash is parsed as a user link`() { + val result = createParser().parse("https://app.element.io/#/user/@it/sme:matrix.org") + assertThat(result).isEqualTo(PermalinkData.UserLink(UserId("@it/sme:matrix.org"))) + } + + @Test + fun `a user id with a slash that is not a valid user id is not a user link`() { + val result = createParser().parse("https://example.org/foo/@it/sme") + assertThat(result).isInstanceOf(PermalinkData.FallbackLink::class.java) + } + + private fun createParser() = DefaultPermalinkParser( + matrixToConverter = DefaultMatrixToConverter(), + ) +} From 1a3b89de12c5fef63a3ca3dfdd9876cd37c9818a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 17 Aug 2026 07:33:18 +0000 Subject: [PATCH 105/145] Update dependency io.github.sergio-sastre.ComposablePreviewScanner:android to v0.9.2 (#7431) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 17eb8ff751..6b5a75bc3d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -175,7 +175,7 @@ test_truth = "com.google.truth:truth:1.4.5" test_parameter_injector = "com.google.testparameterinjector:test-parameter-injector:1.22" test_robolectric = "org.robolectric:robolectric:4.16.1" test_appyx_junit = { module = "com.bumble.appyx:testing-junit4", version.ref = "appyx" } -test_composable_preview_scanner = "io.github.sergio-sastre.ComposablePreviewScanner:android:0.9.1" +test_composable_preview_scanner = "io.github.sergio-sastre.ComposablePreviewScanner:android:0.9.2" test_detekt_api = { module = "io.gitlab.arturbosch.detekt:detekt-api", version.ref = "detekt" } test_detekt_test = { module = "io.gitlab.arturbosch.detekt:detekt-test", version.ref = "detekt" } From aa6f70530a819e27f53198c50e15664cb16fb676 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 15:18:10 +0200 Subject: [PATCH 106/145] [LinkNewDevice] Move the timeout management when linking a new desktop device to the LinkNewDeviceFlowNode so that it can also be used for the DesktopNotice screen. --- .../linknewdevice/impl/LinkNewDesktopHandler.kt | 11 ++++++++--- .../linknewdevice/impl/LinkNewDeviceFlowNode.kt | 8 ++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/features/linknewdevice/impl/src/main/kotlin/io/element/android/features/linknewdevice/impl/LinkNewDesktopHandler.kt b/features/linknewdevice/impl/src/main/kotlin/io/element/android/features/linknewdevice/impl/LinkNewDesktopHandler.kt index 7afb9a7623..6f5beafbd9 100644 --- a/features/linknewdevice/impl/src/main/kotlin/io/element/android/features/linknewdevice/impl/LinkNewDesktopHandler.kt +++ b/features/linknewdevice/impl/src/main/kotlin/io/element/android/features/linknewdevice/impl/LinkNewDesktopHandler.kt @@ -53,15 +53,20 @@ class LinkNewDesktopHandler( timerJob = null } - fun createNewHandler() { - resetJobs() - handler = matrixClient.createLinkDesktopHandler().getOrNull() + fun startTimer() { + timerJob?.cancel() timerJob = sessionScope.launch { delay(2.minutes) linkDesktopStepFlow.emit(LinkDesktopStep.Error(ErrorType.Expired("Scanning QrCode took too long."))) } } + fun createNewHandler() { + currentJob?.cancel() + currentJob = null + handler = matrixClient.createLinkDesktopHandler().getOrNull() + } + fun reset() { resetJobs() sessionScope.launch { diff --git a/features/linknewdevice/impl/src/main/kotlin/io/element/android/features/linknewdevice/impl/LinkNewDeviceFlowNode.kt b/features/linknewdevice/impl/src/main/kotlin/io/element/android/features/linknewdevice/impl/LinkNewDeviceFlowNode.kt index afa570f0a9..a71e32bad5 100644 --- a/features/linknewdevice/impl/src/main/kotlin/io/element/android/features/linknewdevice/impl/LinkNewDeviceFlowNode.kt +++ b/features/linknewdevice/impl/src/main/kotlin/io/element/android/features/linknewdevice/impl/LinkNewDeviceFlowNode.kt @@ -263,6 +263,8 @@ class LinkNewDeviceFlowNode( } LinkDeviceType.Desktop -> { linkNewDesktopHandler.reset() + // Ensure unlock state does not last longer than the timeout for scanning the QR code, so start the timer after unlock + linkNewDesktopHandler.startTimer() backstack.push(NavTarget.DesktopNotice) } } @@ -278,10 +280,14 @@ class LinkNewDeviceFlowNode( NavTarget.DesktopNotice -> { val callback = object : DesktopNoticeNode.Callback { override fun navigateBack() { + // reset the timer when the user leaves the screen (user will have to authenticate again) + linkNewDesktopHandler.reset() backstack.pop() } override fun navigateToQrCodeScanner() { + // reset the timer when the user enters the next screen (they clicked on "Ready to scan") + linkNewDesktopHandler.startTimer() backstack.push(NavTarget.DesktopScanQrCode) } } @@ -290,6 +296,8 @@ class LinkNewDeviceFlowNode( NavTarget.DesktopScanQrCode -> { val callback = object : ScanQrCodeNode.Callback { override fun cancel() { + // reset the timer when the user goes back to the DesktopNoticeNode + linkNewDesktopHandler.startTimer() backstack.pop() } } From d0a1011638e08c7b1138bc99d7e9ecf7c21bf25b Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Aug 2026 15:48:35 +0200 Subject: [PATCH 107/145] Add documentation on LinkNewDesktopHandler and LinkNewMobileHandler --- .../impl/LinkNewDesktopHandler.kt | 21 ++++++++++++++++++ .../impl/LinkNewMobileHandler.kt | 22 +++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/features/linknewdevice/impl/src/main/kotlin/io/element/android/features/linknewdevice/impl/LinkNewDesktopHandler.kt b/features/linknewdevice/impl/src/main/kotlin/io/element/android/features/linknewdevice/impl/LinkNewDesktopHandler.kt index 6f5beafbd9..bff81a3e9e 100644 --- a/features/linknewdevice/impl/src/main/kotlin/io/element/android/features/linknewdevice/impl/LinkNewDesktopHandler.kt +++ b/features/linknewdevice/impl/src/main/kotlin/io/element/android/features/linknewdevice/impl/LinkNewDesktopHandler.kt @@ -39,6 +39,10 @@ class LinkNewDesktopHandler( LinkDesktopStep.Uninitialized ) + /** + * A [StateFlow] that emits the current step of the link desktop process. + * It starts with [LinkDesktopStep.Uninitialized] and will emit other steps as they occur. + */ val stepFlow: StateFlow get() = linkDesktopStepFlow.asStateFlow() @@ -53,6 +57,9 @@ class LinkNewDesktopHandler( timerJob = null } + /** + * Starts (or restarts) a timer that will emit an error in [stepFlow] after 2 minutes. + */ fun startTimer() { timerJob?.cancel() timerJob = sessionScope.launch { @@ -61,12 +68,20 @@ class LinkNewDesktopHandler( } } + /** + * Creates a new [LinkDesktopHandler] and cancels any existing job. + * This should be called when the user wants to retry scanning a QR code. + */ fun createNewHandler() { currentJob?.cancel() currentJob = null handler = matrixClient.createLinkDesktopHandler().getOrNull() } + /** + * Resets the state of the handler and cancels any existing job. + * This should be called when the user wants to start over. + */ fun reset() { resetJobs() sessionScope.launch { @@ -74,6 +89,12 @@ class LinkNewDesktopHandler( } } + /** + * Handles the scanned QR code data. + * This should be called when the user scans a QR code. + * + * @param data The scanned QR code data as a byte array. + */ fun onScannedCode(data: ByteArray) { resetJobs() val currentHandler = handler diff --git a/features/linknewdevice/impl/src/main/kotlin/io/element/android/features/linknewdevice/impl/LinkNewMobileHandler.kt b/features/linknewdevice/impl/src/main/kotlin/io/element/android/features/linknewdevice/impl/LinkNewMobileHandler.kt index 39c9c6fef3..9436c0e901 100644 --- a/features/linknewdevice/impl/src/main/kotlin/io/element/android/features/linknewdevice/impl/LinkNewMobileHandler.kt +++ b/features/linknewdevice/impl/src/main/kotlin/io/element/android/features/linknewdevice/impl/LinkNewMobileHandler.kt @@ -40,9 +40,19 @@ class LinkNewMobileHandler( LinkMobileStep.Uninitialized ) + /** + * A [StateFlow] that emits the current step of the link mobile process. + * It starts with [LinkMobileStep.Uninitialized] and will emit other steps as they occur. + */ val stepFlow: StateFlow get() = linkMobileStepFlow.asStateFlow() + /** + * Creates a new [LinkMobileHandler] and starts the linking process. + * If [forRotating] is true, it indicates that this is a rotation of the QR code. + * + * @param forRotating Whether this is a rotation of the QR code. Defaults to false. + */ fun createAndStartNewHandler(forRotating: Boolean = false) { Timber.tag(loggerTag.value).d("createAndStartNewHandler()") currentJob?.cancel() @@ -62,6 +72,10 @@ class LinkNewMobileHandler( } } + /** + * Resets the handler and cancels any ongoing job. + * This will also emit [LinkMobileStep.Uninitialized] to the [stepFlow]. + */ fun reset() { currentJob?.cancel() currentJob = null @@ -70,10 +84,18 @@ class LinkNewMobileHandler( } } + /** + * Rotates the QR code by creating a new handler and starting the linking process. + * This is typically called when a timeout occurs for the current QR code. + */ fun rotateQrCode() { createAndStartNewHandler(forRotating = true) } + /** + * Handles the case where there are too many QR code rotations. + * This will reset the handler and emit an error to the [stepFlow]. + */ fun onTooManyRotation() { reset() sessionScope.launch { From 2ac11ebe14681f9326eb1f0f96e48ad2bb2e63e7 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 17 Aug 2026 10:30:57 +0200 Subject: [PATCH 108/145] Clarify the comments --- .../features/linknewdevice/impl/LinkNewDeviceFlowNode.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/features/linknewdevice/impl/src/main/kotlin/io/element/android/features/linknewdevice/impl/LinkNewDeviceFlowNode.kt b/features/linknewdevice/impl/src/main/kotlin/io/element/android/features/linknewdevice/impl/LinkNewDeviceFlowNode.kt index a71e32bad5..b31aca8cb2 100644 --- a/features/linknewdevice/impl/src/main/kotlin/io/element/android/features/linknewdevice/impl/LinkNewDeviceFlowNode.kt +++ b/features/linknewdevice/impl/src/main/kotlin/io/element/android/features/linknewdevice/impl/LinkNewDeviceFlowNode.kt @@ -280,13 +280,13 @@ class LinkNewDeviceFlowNode( NavTarget.DesktopNotice -> { val callback = object : DesktopNoticeNode.Callback { override fun navigateBack() { - // reset the timer when the user leaves the screen (user will have to authenticate again) + // Stop the timer when the user leaves the screen (user will have to authenticate again) linkNewDesktopHandler.reset() backstack.pop() } override fun navigateToQrCodeScanner() { - // reset the timer when the user enters the next screen (they clicked on "Ready to scan") + // Start again the timer when the user enters the next screen (they clicked on "Ready to scan") linkNewDesktopHandler.startTimer() backstack.push(NavTarget.DesktopScanQrCode) } @@ -296,7 +296,7 @@ class LinkNewDeviceFlowNode( NavTarget.DesktopScanQrCode -> { val callback = object : ScanQrCodeNode.Callback { override fun cancel() { - // reset the timer when the user goes back to the DesktopNoticeNode + // start again the timer when the user goes back to the DesktopNoticeNode linkNewDesktopHandler.startTimer() backstack.pop() } From 9a4daa19b22cff0fc559a94e0963fc78ff3983ea Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Mon, 17 Aug 2026 11:33:10 +0300 Subject: [PATCH 109/145] Keep the focused login field visible above the keyboard On shorter screens the software keyboard can cover the field the user is typing into on the login and account provider screens, because nothing scrolls the content back into the reduced viewport once the keyboard is shown. Apply the existing bringIntoViewOnImeVisible modifier to those fields, the same way the recovery key screen already does. --- .../login/impl/screens/loginpassword/LoginPasswordView.kt | 3 +++ .../screens/searchaccountprovider/SearchAccountProviderView.kt | 2 ++ 2 files changed, 5 insertions(+) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordView.kt index 06a1641644..453c716e86 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordView.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordView.kt @@ -56,6 +56,7 @@ import io.element.android.libraries.designsystem.components.BigIcon import io.element.android.libraries.designsystem.components.button.BackButton import io.element.android.libraries.designsystem.components.dialogs.ErrorDialog import io.element.android.libraries.designsystem.components.form.textFieldState +import io.element.android.libraries.designsystem.modifiers.bringIntoViewOnImeVisible import io.element.android.libraries.designsystem.modifiers.onTabOrEnterKeyFocusNext import io.element.android.libraries.designsystem.preview.ElementPreview import io.element.android.libraries.designsystem.preview.PreviewsDayNight @@ -191,6 +192,7 @@ private fun LoginForm( enabled = !isLoading, modifier = Modifier .fillMaxWidth() + .bringIntoViewOnImeVisible() .onTabOrEnterKeyFocusNext(focusManager) .testTag(TestTags.loginEmailUsername) .semantics { @@ -243,6 +245,7 @@ private fun LoginForm( enabled = !isLoading, modifier = Modifier .fillMaxWidth() + .bringIntoViewOnImeVisible() .onTabOrEnterKeyFocusNext(focusManager) .testTag(TestTags.loginPassword) .semantics { diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderView.kt index 8335dde112..ffe7192991 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderView.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderView.kt @@ -52,6 +52,7 @@ import io.element.android.libraries.designsystem.atomic.molecules.IconTitleSubti import io.element.android.libraries.designsystem.components.BigIcon import io.element.android.libraries.designsystem.components.button.BackButton import io.element.android.libraries.designsystem.components.form.textFieldState +import io.element.android.libraries.designsystem.modifiers.bringIntoViewOnImeVisible import io.element.android.libraries.designsystem.modifiers.onTabOrEnterKeyFocusNext import io.element.android.libraries.designsystem.preview.ElementPreview import io.element.android.libraries.designsystem.preview.PreviewsDayNight @@ -110,6 +111,7 @@ fun SearchAccountProviderView( modifier = Modifier .fillMaxWidth() .padding(start = 16.dp, end = 16.dp, bottom = 16.dp) + .bringIntoViewOnImeVisible() .onTabOrEnterKeyFocusNext(focusManager) .testTag(TestTags.changeServerServer), onValueChange = { From 932a4d013c4582d71c1f0c5dfac1b4c59f349cfc Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Mon, 17 Aug 2026 11:33:41 +0300 Subject: [PATCH 110/145] Relax image compression so photos keep more detail Images are downscaled against a 640px reference, which makes inSampleSize halve the source one step further than the documented intent: the KDoc says images should be sent at up to 1280x1280, but a 12000x3916 photo is sent as 3006x979. Text in screenshots and detail in photos is lost at that size. Raise the reference to 1280. inSampleSize is a power of two, so this moves each image one step up rather than to an exact size. --- .../mediaupload/impl/AndroidMediaPreProcessor.kt | 4 ++-- .../mediaupload/impl/AndroidMediaPreProcessorTest.kt | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libraries/mediaupload/impl/src/main/kotlin/io/element/android/libraries/mediaupload/impl/AndroidMediaPreProcessor.kt b/libraries/mediaupload/impl/src/main/kotlin/io/element/android/libraries/mediaupload/impl/AndroidMediaPreProcessor.kt index b374e530f4..87c4a22d39 100644 --- a/libraries/mediaupload/impl/src/main/kotlin/io/element/android/libraries/mediaupload/impl/AndroidMediaPreProcessor.kt +++ b/libraries/mediaupload/impl/src/main/kotlin/io/element/android/libraries/mediaupload/impl/AndroidMediaPreProcessor.kt @@ -62,10 +62,10 @@ class AndroidMediaPreProcessor( /** * Used for calculating `inSampleSize` for bitmaps. * - * *Note*: Ideally, this should result in images of up to (but not included) 1280x1280 being sent. However, images with very different width and height + * *Note*: Ideally, this should result in images of up to (but not included) 2560x2560 being sent. However, images with very different width and height * values may surpass this limit. (i.e.: an image of `480x3000px` would have `inSampleSize=1` and be sent as is). */ - private const val IMAGE_SCALE_REF_SIZE = 640 + private const val IMAGE_SCALE_REF_SIZE = 1280 private val notCompressibleImageTypes = listOf(MimeTypes.Gif, MimeTypes.WebP) } diff --git a/libraries/mediaupload/impl/src/test/kotlin/io/element/android/libraries/mediaupload/impl/AndroidMediaPreProcessorTest.kt b/libraries/mediaupload/impl/src/test/kotlin/io/element/android/libraries/mediaupload/impl/AndroidMediaPreProcessorTest.kt index 3fb639aa9b..d08784c834 100644 --- a/libraries/mediaupload/impl/src/test/kotlin/io/element/android/libraries/mediaupload/impl/AndroidMediaPreProcessorTest.kt +++ b/libraries/mediaupload/impl/src/test/kotlin/io/element/android/libraries/mediaupload/impl/AndroidMediaPreProcessorTest.kt @@ -208,10 +208,10 @@ class AndroidMediaPreProcessorTest : RobolectricTest() { assertThat(info.thumbnailFile).isNotNull() assertThat(info.imageInfo).isEqualTo( ImageInfo( - height = 979, - width = 3006, + height = 1958, + width = 6012, mimetype = MimeTypes.Jpeg, - size = 84_845, + size = 682_492, ThumbnailInfo(height = 244, width = 751, mimetype = MimeTypes.Jpeg, size = 7_178), thumbnailSource = null, blurhash = "K07gBzX=j_D4xZjoaSe,s:" @@ -233,10 +233,10 @@ class AndroidMediaPreProcessorTest : RobolectricTest() { assertThat(info.thumbnailFile).isNull() assertThat(info.imageInfo).isEqualTo( ImageInfo( - height = 979, - width = 3_006, + height = 1_958, + width = 6_012, mimetype = MimeTypes.Jpeg, - size = 84_845, + size = 682_492, thumbnailInfo = null, thumbnailSource = null, blurhash = null, From a740423343b96d6c91e7bb9e7eb13ebd38676b02 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 17 Aug 2026 11:34:52 +0200 Subject: [PATCH 111/145] Sync strings. --- .../src/main/res/values-ar/translations.xml | 6 + .../src/main/res/values-fa/translations.xml | 1 + .../src/main/res/values-ar/translations.xml | 7 + .../src/main/res/values-pl/translations.xml | 2 +- .../src/main/res/values-ar/translations.xml | 10 + .../src/main/res/values-pl/translations.xml | 2 +- .../src/main/res/values-ar/translations.xml | 8 + .../src/main/res/values-fa/translations.xml | 1 + .../src/main/res/values-ar/translations.xml | 36 ++ .../src/main/res/values-es/translations.xml | 20 + .../src/main/res/values-fa/translations.xml | 28 +- .../src/main/res/values-ar/translations.xml | 14 + .../src/main/res/values-es/translations.xml | 5 +- .../src/main/res/values-fa/translations.xml | 7 +- .../src/main/res/values-ar/translations.xml | 15 + .../src/main/res/values-es/translations.xml | 4 +- .../src/main/res/values-ar/translations.xml | 56 ++ .../src/main/res/values-es/translations.xml | 11 +- .../src/main/res/values-fa/translations.xml | 10 +- .../src/main/res/values-ar/translations.xml | 18 + .../src/main/res/values-fa/translations.xml | 3 + .../src/main/res/values-ar/translations.xml | 9 + .../src/main/res/values-es/translations.xml | 6 +- .../src/main/res/values-fa/translations.xml | 4 + .../src/main/res/values-ar/translations.xml | 34 + .../src/main/res/values-es/translations.xml | 6 +- .../src/main/res/values-fa/translations.xml | 15 +- .../src/main/res/values-ar/translations.xml | 40 ++ .../src/main/res/values-fa/translations.xml | 13 + .../src/main/res/values-ar/translations.xml | 10 + .../src/main/res/values-es/translations.xml | 3 + .../src/main/res/values-fa/translations.xml | 1 + .../src/main/res/values-ar/translations.xml | 60 ++ .../src/main/res/values-es/translations.xml | 20 + .../src/main/res/values-fa/translations.xml | 20 + .../src/main/res/values-fi/translations.xml | 1 + .../src/main/res/values-fr/translations.xml | 1 + .../src/main/res/values-ar/translations.xml | 6 + .../src/main/res/values-es/translations.xml | 6 + .../src/main/res/values-fa/translations.xml | 6 + .../src/main/res/values-ar/translations.xml | 46 ++ .../src/main/res/values-es/translations.xml | 4 +- .../src/main/res/values-pl/translations.xml | 2 +- .../src/main/res/values-ar/translations.xml | 109 ++++ .../src/main/res/values-es/translations.xml | 16 +- .../src/main/res/values-fa/translations.xml | 19 + .../src/main/res/values-ar/translations.xml | 18 + .../src/main/res/values-es/translations.xml | 26 +- .../src/main/res/values-ar/translations.xml | 114 ++++ .../src/main/res/values-es/translations.xml | 35 +- .../src/main/res/values-fa/translations.xml | 35 + .../src/main/res/values-fi/translations.xml | 4 + .../src/main/res/values-fr/translations.xml | 4 + .../src/main/res/values-ar/translations.xml | 13 + .../src/main/res/values-es/translations.xml | 5 + .../src/main/res/values-fa/translations.xml | 4 + .../src/main/res/values-ar/translations.xml | 20 + .../src/main/res/values-fa/translations.xml | 1 + .../src/main/res/values-ar/translations.xml | 115 ++++ .../src/main/res/values-es/translations.xml | 49 +- .../src/main/res/values-fa/translations.xml | 43 ++ .../src/main/res/values-fi/translations.xml | 10 +- .../src/main/res/values-fr/translations.xml | 8 + .../src/main/res/values-ar/translations.xml | 7 + .../src/main/res/values-ar/translations.xml | 22 + .../src/main/res/values-es/translations.xml | 4 + .../src/main/res/values-fa/translations.xml | 5 + .../src/main/res/values-ar/translations.xml | 8 + .../src/main/res/values-fa/translations.xml | 2 + .../src/main/res/values-ar/translations.xml | 98 +++ .../src/main/res/values-es/translations.xml | 33 +- .../src/main/res/values-fa/translations.xml | 19 + .../src/main/res/values-ar/translations.xml | 5 + .../src/main/res/values-fa/translations.xml | 1 + .../src/main/res/values-ar/translations.xml | 188 ++++++ .../src/main/res/values-be/translations.xml | 1 - .../src/main/res/values-bg/translations.xml | 1 - .../src/main/res/values-ca/translations.xml | 2 - .../src/main/res/values-cy/translations.xml | 2 +- .../src/main/res/values-da/translations.xml | 2 - .../src/main/res/values-el/translations.xml | 1 - .../src/main/res/values-es/translations.xml | 50 +- .../src/main/res/values-et/translations.xml | 3 +- .../src/main/res/values-eu/translations.xml | 1 - .../src/main/res/values-fa/translations.xml | 59 +- .../src/main/res/values-fi/translations.xml | 1 + .../src/main/res/values-fr/translations.xml | 5 +- .../src/main/res/values-hr/translations.xml | 2 - .../src/main/res/values-it/translations.xml | 1 - .../src/main/res/values-ja/translations.xml | 2 - .../src/main/res/values-ka/translations.xml | 1 - .../src/main/res/values-ko/translations.xml | 1 - .../src/main/res/values-nb/translations.xml | 1 - .../src/main/res/values-nl/translations.xml | 1 - .../src/main/res/values-pl/translations.xml | 1 + .../main/res/values-pt-rBR/translations.xml | 1 - .../src/main/res/values-pt/translations.xml | 3 +- .../src/main/res/values-ro/translations.xml | 1 + .../src/main/res/values-sv/translations.xml | 1 - .../src/main/res/values-tr/translations.xml | 1 - .../src/main/res/values-uk/translations.xml | 3 +- .../src/main/res/values-ur/translations.xml | 2 - .../src/main/res/values-uz/translations.xml | 1 - .../src/main/res/values-vi/translations.xml | 2 - .../src/main/res/values-zh/translations.xml | 3 +- .../impl/src/main/res/values/localazy.xml | 3 +- .../src/main/res/values-ar/translations.xml | 7 + .../src/main/res/values-ar/translations.xml | 5 + .../src/main/res/values-ar/translations.xml | 22 + .../src/main/res/values-es/translations.xml | 2 + .../src/main/res/values-fa/translations.xml | 4 + .../src/main/res/values-ar/translations.xml | 95 +++ .../src/main/res/values-es/translations.xml | 48 +- .../src/main/res/values-fa/translations.xml | 32 +- .../src/main/res/values-ar/translations.xml | 50 ++ .../src/main/res/values-es/translations.xml | 19 +- .../src/main/res/values-fa/translations.xml | 47 +- .../src/main/res/values-ar/translations.xml | 8 + .../src/main/res/values-ar/translations.xml | 36 ++ .../src/main/res/values-es/translations.xml | 23 + .../src/main/res/values-fa/translations.xml | 15 + .../src/main/res/values-ar/translations.xml | 12 + .../src/main/res/values-es/translations.xml | 2 +- .../src/main/res/values-fa/translations.xml | 2 +- .../src/main/res/values-fr/translations.xml | 2 +- .../src/main/res/values-ar/translations.xml | 19 + .../src/main/res/values-ar/translations.xml | 54 ++ .../src/main/res/values-es/translations.xml | 10 +- .../src/main/res/values-fa/translations.xml | 17 + .../src/main/res/values-ar/translations.xml | 4 + .../src/main/res/values-ar/translations.xml | 5 + .../src/main/res/values-ar/translations.xml | 13 + .../src/main/res/values-es/translations.xml | 2 + .../src/main/res/values-pl/translations.xml | 2 +- .../src/main/res/values-ar/translations.xml | 73 +++ .../src/main/res/values-fa/translations.xml | 4 + .../src/main/res/values-ar/translations.xml | 9 + .../src/main/res/values-es/translations.xml | 2 + .../src/main/res/values-fa/translations.xml | 2 + .../src/main/res/values-ar/translations.xml | 22 + .../src/main/res/values-es/translations.xml | 7 +- .../src/main/res/values-fa/translations.xml | 4 + .../src/main/res/values-ar/translations.xml | 7 + .../src/main/res/values-ar/translations.xml | 5 + .../src/main/res/values-ar/translations.xml | 140 ++++ .../src/main/res/values-es/translations.xml | 24 + .../src/main/res/values-fa/translations.xml | 29 + .../src/main/res/values-fi/translations.xml | 5 + .../src/main/res/values-fr/translations.xml | 5 + .../impl/src/main/res/values/localazy.xml | 2 + .../src/main/res/values-ar/translations.xml | 11 + .../src/main/res/values-ar/translations.xml | 14 + .../src/main/res/values-fa/translations.xml | 4 + .../src/main/res/values-ar/translations.xml | 33 + .../src/main/res/values-es/translations.xml | 3 + .../src/main/res/values-fa/translations.xml | 1 + .../src/main/res/values-ar/translations.xml | 12 + .../src/main/res/values-ar/translations.xml | 611 ++++++++++++++++++ .../src/main/res/values-es/translations.xml | 246 ++++++- .../src/main/res/values-fa/translations.xml | 199 +++++- .../src/main/res/values-fi/translations.xml | 23 + .../src/main/res/values-fr/translations.xml | 61 +- 162 files changed, 3726 insertions(+), 165 deletions(-) create mode 100644 appnav/src/main/res/values-ar/translations.xml create mode 100644 features/analytics/api/src/main/res/values-ar/translations.xml create mode 100644 features/analytics/impl/src/main/res/values-ar/translations.xml create mode 100644 features/call/impl/src/main/res/values-ar/translations.xml create mode 100644 features/createroom/impl/src/main/res/values-ar/translations.xml create mode 100644 features/deactivation/impl/src/main/res/values-ar/translations.xml create mode 100644 features/ftue/impl/src/main/res/values-ar/translations.xml create mode 100644 features/home/impl/src/main/res/values-ar/translations.xml create mode 100644 features/invite/impl/src/main/res/values-ar/translations.xml create mode 100644 features/invitepeople/impl/src/main/res/values-ar/translations.xml create mode 100644 features/joinroom/impl/src/main/res/values-ar/translations.xml create mode 100644 features/knockrequests/impl/src/main/res/values-ar/translations.xml create mode 100644 features/leaveroom/api/src/main/res/values-ar/translations.xml create mode 100644 features/linknewdevice/impl/src/main/res/values-ar/translations.xml create mode 100644 features/location/impl/src/main/res/values-ar/translations.xml create mode 100644 features/location/impl/src/main/res/values-es/translations.xml create mode 100644 features/location/impl/src/main/res/values-fa/translations.xml create mode 100644 features/lockscreen/impl/src/main/res/values-ar/translations.xml create mode 100644 features/login/impl/src/main/res/values-ar/translations.xml create mode 100644 features/logout/impl/src/main/res/values-ar/translations.xml create mode 100644 features/messages/impl/src/main/res/values-ar/translations.xml create mode 100644 features/poll/api/src/main/res/values-ar/translations.xml create mode 100644 features/poll/impl/src/main/res/values-ar/translations.xml create mode 100644 features/preferences/impl/src/main/res/values-ar/translations.xml create mode 100644 features/rageshake/api/src/main/res/values-ar/translations.xml create mode 100644 features/rageshake/impl/src/main/res/values-ar/translations.xml create mode 100644 features/reportroom/impl/src/main/res/values-ar/translations.xml create mode 100644 features/rolesandpermissions/impl/src/main/res/values-ar/translations.xml create mode 100644 features/roomaliasresolver/impl/src/main/res/values-ar/translations.xml create mode 100644 features/roomdetails/impl/src/main/res/values-ar/translations.xml create mode 100644 features/roomdetailsedit/impl/src/main/res/values-ar/translations.xml create mode 100644 features/roomdirectory/impl/src/main/res/values-ar/translations.xml create mode 100644 features/roommembermoderation/impl/src/main/res/values-ar/translations.xml create mode 100644 features/securebackup/impl/src/main/res/values-ar/translations.xml create mode 100644 features/securityandprivacy/impl/src/main/res/values-ar/translations.xml create mode 100644 features/signedout/impl/src/main/res/values-ar/translations.xml create mode 100644 features/space/impl/src/main/res/values-ar/translations.xml create mode 100644 features/startchat/impl/src/main/res/values-ar/translations.xml create mode 100644 features/userprofile/shared/src/main/res/values-ar/translations.xml create mode 100644 features/verifysession/impl/src/main/res/values-ar/translations.xml create mode 100644 libraries/androidutils/src/main/res/values-ar/translations.xml create mode 100644 libraries/dateformatter/impl/src/main/res/values-ar/translations.xml create mode 100644 libraries/emoji/impl/src/main/res/values-ar/translations.xml create mode 100644 libraries/eventformatter/impl/src/main/res/values-ar/translations.xml create mode 100644 libraries/matrixui/src/main/res/values-ar/translations.xml create mode 100644 libraries/mediaviewer/impl/src/main/res/values-ar/translations.xml create mode 100644 libraries/permissions/api/src/main/res/values-ar/translations.xml create mode 100644 libraries/permissions/impl/src/main/res/values-ar/translations.xml create mode 100644 libraries/push/impl/src/main/res/values-ar/translations.xml create mode 100644 libraries/pushproviders/firebase/src/main/res/values-ar/translations.xml create mode 100644 libraries/pushproviders/unifiedpush/src/main/res/values-ar/translations.xml create mode 100644 libraries/textcomposer/impl/src/main/res/values-ar/translations.xml create mode 100644 libraries/troubleshoot/impl/src/main/res/values-ar/translations.xml create mode 100644 libraries/ui-strings/src/main/res/values-ar/translations.xml diff --git a/appnav/src/main/res/values-ar/translations.xml b/appnav/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..ca3a804097 --- /dev/null +++ b/appnav/src/main/res/values-ar/translations.xml @@ -0,0 +1,6 @@ + + + "تسجيل الخروج والترقية" + "لم يعد %1$s يدعم البروتوكول القديم. يرجى تسجيل الخروج ثم تسجيل الدخول مرة أخرى لمتابعة استخدام التطبيق." + "لم يعد خادمك المنزلي يدعم البروتوكول القديم. يرجى تسجيل الخروج ثم تسجيل الدخول مرة أخرى لمتابعة استخدام التطبيق." + diff --git a/appnav/src/main/res/values-fa/translations.xml b/appnav/src/main/res/values-fa/translations.xml index 16bb7fd3e2..dfff863365 100644 --- a/appnav/src/main/res/values-fa/translations.xml +++ b/appnav/src/main/res/values-fa/translations.xml @@ -2,4 +2,5 @@ "خروج و ارتقا" "‏%1$s دیگر از شیوه‌نامهٔ قدیمی پشتیبانی نمی‌کند. لطفاً برای ادامهٔ استفاده از کاره، خارج شده و دوباره وارد شوید." + "سرور خانگی شما دیگر از پروتکل قدیمی پشتیبانی نمی‌کند. لطفاً برای ادامه استفاده از برنامه، از سیستم خارج شده و دوباره وارد شوید." diff --git a/features/analytics/api/src/main/res/values-ar/translations.xml b/features/analytics/api/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..449a0a01cb --- /dev/null +++ b/features/analytics/api/src/main/res/values-ar/translations.xml @@ -0,0 +1,7 @@ + + + "مشاركة بيانات استخدام مجهولة لمساعدتنا على تتبع المشاكل." + "يمكنك قراءة كافة شروطنا %1$s." + "هنا" + "مشاركة البيانات الإحصائية" + diff --git a/features/analytics/api/src/main/res/values-pl/translations.xml b/features/analytics/api/src/main/res/values-pl/translations.xml index a3347582cc..37848b4c3f 100644 --- a/features/analytics/api/src/main/res/values-pl/translations.xml +++ b/features/analytics/api/src/main/res/values-pl/translations.xml @@ -1,6 +1,6 @@ - "Udostępniaj anonimowe dane użytkowania, aby pomóc nam identyfikować problemy." + "Udostępniaj anonimowe dane użytkowania, aby pomóc nam ulepszać aplikację." "Przeczytaj nasze warunki użytkowania %1$s." "tutaj" "Udostępniaj dane analityczne" diff --git a/features/analytics/impl/src/main/res/values-ar/translations.xml b/features/analytics/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..8d1bf460d6 --- /dev/null +++ b/features/analytics/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,10 @@ + + + "لن نسجّل أو ننشئ ملفات شخصية لأي معلومات شخصية" + "مشاركة بيانات استخدام مجهولة لمساعدتنا على تتبع المشاكل." + "يمكنك قراءة كافة شروطنا %1$s." + "هنا" + "يمكنك إطفاء هذا الخيار في أي وقت" + "لن نشارك بياناتك مع أطراف ثالثة" + "ساعدنا على التحسن %1$s" + diff --git a/features/analytics/impl/src/main/res/values-pl/translations.xml b/features/analytics/impl/src/main/res/values-pl/translations.xml index 61da8408ad..c58d630ce9 100644 --- a/features/analytics/impl/src/main/res/values-pl/translations.xml +++ b/features/analytics/impl/src/main/res/values-pl/translations.xml @@ -1,7 +1,7 @@ "Nie będziemy rejestrować ani profilować żadnych danych osobistych" - "Udostępniaj anonimowe dane użytkowania, aby pomóc nam identyfikować problemy." + "Udostępniaj anonimowe dane użytkowania, aby pomóc nam ulepszać aplikację." "Przeczytaj nasze warunki użytkowania %1$s." "tutaj" "Możesz to wyłączyć w dowolnym momencie" diff --git a/features/call/impl/src/main/res/values-ar/translations.xml b/features/call/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..612dd16a28 --- /dev/null +++ b/features/call/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,8 @@ + + + "مكالمة جارية" + "اضغط للعودة إلى المكالمة" + "☎️ الاتصال يتمّ" + "لا يدعم Element Call استخدام أجهزة الصوت عبر Bluetooth في إصدار Android هذا. يرجى اختيار جهاز صوت آخر." + "مكالمة Element Call واردة" + diff --git a/features/call/impl/src/main/res/values-fa/translations.xml b/features/call/impl/src/main/res/values-fa/translations.xml index c58ebfd5c6..622be3d428 100644 --- a/features/call/impl/src/main/res/values-fa/translations.xml +++ b/features/call/impl/src/main/res/values-fa/translations.xml @@ -3,5 +3,6 @@ "تماس خروجی" "زدن برای بازگشت به تماس" "تماس در جریان ☎️" + "برنامه Element Call در این نسخه اندروید از دستگاه‌های صوتی بلوتوث پشتیبانی نمی‌کند. لطفاً دستگاه صوتی دیگری را انتخاب کنید." "تماس المنتی ورودی" diff --git a/features/createroom/impl/src/main/res/values-ar/translations.xml b/features/createroom/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..7cb356739a --- /dev/null +++ b/features/createroom/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,36 @@ + + + "إنشاء غرفة جديدة" + "دعوة أشخاص" + "حصل خطأ أثناء إنشاء الغرفة" + "تعذّر إنشاء المساحة بسبب خطأ غير معروف. حاول مرة أخرى لاحقًا." + "إضافة اسم…" + "غرفة جديدة" + "مساحة جديدة" + "لا يدخل إلا المدعوّون." + "خاصة" + "بإمكان الجميع العثور على هذه الغرفة. +يمكنك تغيير هذا من إعدادات الغرفة متى شئت." + "يمكن لأي شخص الانضمام." + "عامة" + "يمكن لأي شخص طلب الانضمام، لكن يجب أن يقبل الطلب مسؤول أو مشرف." + "السماح بطلبات الانضمام" + "يمكن لأي شخص في %1$s الانضمام، لكن يجب على الآخرين طلب الوصول." + "طلب الانضمام" + "يمكن للمدعوين فقط الانضمام." + "خاصة" + "يمكن لأي شخص الانضمام." + "عامة" + "يمكن لأي شخص في %1$s الانضمام." + "قياسي" + "من يمكنه الوصول" + "تحتاج إلى عنوان حتى تظهر الغرفة في الدليل العام." + "العنوان" + "ظهور الغرفة" + "(لا توجد مساحة)" + "عدم الإضافة إلى مساحة" + "لم يتم اختيار أي مساحة" + "إضافة إلى مساحة" + "الموضوع (اختياري)" + "إضافة وصف…" + diff --git a/features/createroom/impl/src/main/res/values-es/translations.xml b/features/createroom/impl/src/main/res/values-es/translations.xml index 740e0b70cc..e3ceccbb83 100644 --- a/features/createroom/impl/src/main/res/values-es/translations.xml +++ b/features/createroom/impl/src/main/res/values-es/translations.xml @@ -3,14 +3,34 @@ "Nueva sala" "Invitar personas" "Se ha producido un error al crear la sala" + "No se pudo crear el espacio debido a un error desconocido. Inténtalo de nuevo más tarde." + "Añadir nombre…" + "Nueva sala" + "Nuevo espacio" "Solo las personas invitadas pueden acceder." + "Privado" "Cualquiera puede encontrar esta sala. Puedes cambiar esto en cualquier momento en los ajustes de la sala." + "Cualquiera puede unirse." + "Público" "Cualquiera puede solicitar unirse, pero un administrador o un moderador tendrá que aceptar la solicitud" "Permitir solicitar unirse" + "Cualquiera en %1$s puede unirse, pero el resto debe solicitar acceso." + "Solicitar unirse" + "Solo las personas invitadas pueden unirse." + "Privado" "Cualquiera puede unirse." + "Público" + "Cualquiera de %1$s puede unirse." + "Estándar" + "Quién tiene acceso" "Necesitarás una dirección de sala para que sea visible en el directorio de salas públicas." "Dirección" "Visibilidad de la sala" + "(ningún espacio)" + "No añadir a un espacio" + "No se ha seleccionado ningún espacio" + "Añadir a un espacio" "Tema (opcional)" + "Añadir descripción…" diff --git a/features/createroom/impl/src/main/res/values-fa/translations.xml b/features/createroom/impl/src/main/res/values-fa/translations.xml index 821d55af67..c3ec327d5b 100644 --- a/features/createroom/impl/src/main/res/values-fa/translations.xml +++ b/features/createroom/impl/src/main/res/values-fa/translations.xml @@ -3,12 +3,34 @@ "اتاق جدید" "دعوت افراد" "هنگام ایجاد اتاق خطایی رخ داد" + "به دلیل خطای ناشناخته‌ای، فضا ایجاد نشد. بعداً دوباره امتحان کنید." + "افزودن نام…" + "اتاق جدید" + "فضای جدید" "تنها افراد دعوت شده می‌توانند بپیوندند." + "خصوصی" "هرکسی می‌تواند اتاق را بیابد. می‌توانید بعداً در تظیمات اتاق عوضش کنید." - "درخواست دعوت" - "هرکسی می‌تواند به این اتاق بپیوندد" - "نشانی اتاق" + "هر کسی می‌تواند عضو شود." + "عمومی" + "هر کسی می‌تواند درخواست عضویت بدهد، اما یک مدیر یا ناظر باید درخواست را بپذیرد." + "اجازه درخواست عضویت" + "هر کسی در %1$s می‌تواند عضو شود، اما بقیه باید درخواست دسترسی بدهند." + "درخواست عضویت" + "تنها افراد دعوت شده می‌توانند بپیوندند." + "خصوصی" + "هر کسی می‌تواند عضو شود." + "عمومی" + "هر کسی که در %1$s باشد می‌تواند عضو شود." + "استاندارد" + "چه کسی دسترسی دارد" + "برای اینکه بتوانید آن را در فهرست عمومی مشاهده کنید، به یک آدرس نیاز دارید." + "آدرس" "نمایانی اتاق" + "(بدون فضا)" + "به یک فضا اضافه نکنید" + "فضایی انتخاب نشده است" + "به فضا اضافه کنید" "موضوع (اختیاری)" + "اضافه کردن توضیحات…" diff --git a/features/deactivation/impl/src/main/res/values-ar/translations.xml b/features/deactivation/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..d0fa5afe94 --- /dev/null +++ b/features/deactivation/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,14 @@ + + + "يرجى تأكيد رغبتك في حذف حسابك. لا يمكن التراجع عن هذا الإجراء." + "حذف جميع رسائلي" + "تحذير: قد يرى المستخدمون في المستقبل محادثات غير مكتملة." + "حذف حسابك %1$s، وسيؤدي إلى:" + "إجراء لا رجعة فيه" + "%1$s (لن تتمكن من تسجيل الدخول مرة أخرى، ولا يمكن إعادة استخدام معرّفك)." + "تعطيل حسابك نهائيًا" + "إزالتك من جميع غرف الدردشة." + "حذف معلومات حسابك من خادم الهوية لدينا." + "ستظل رسائلك مرئية للمستخدمين المسجلين، لكنها لن تكون متاحة للمستخدمين الجدد أو غير المسجلين إذا اخترت حذفها." + "حذف الحساب" + diff --git a/features/deactivation/impl/src/main/res/values-es/translations.xml b/features/deactivation/impl/src/main/res/values-es/translations.xml index 17ae73d6c8..dc3e090e06 100644 --- a/features/deactivation/impl/src/main/res/values-es/translations.xml +++ b/features/deactivation/impl/src/main/res/values-es/translations.xml @@ -1,13 +1,14 @@ - "Confirma que quieres desactivar tu cuenta. Esta acción no se puede deshacer." + "Confirma que quieres eliminar tu cuenta. Esta acción no se puede deshacer." "Borrar todos mis mensajes" "Advertencia: Futuros usuarios pueden ver conversaciones incompletas." - "Desactivar tu cuenta es %1$s:" + "Eliminar tu cuenta es %1$s:" "irreversible" "%1$s tu cuenta (no podrás volver a iniciar sesión y tu ID no se podrá volver a utilizar)." "Inhabilitará permanentemente" "Te eliminará de todas las salas de chat." "Eliminará la información de tu cuenta de nuestro servidor de identidad." "Tus mensajes seguirán siendo visibles para los usuarios registrados, pero no estarán disponibles para los usuarios nuevos o no registrados si decides eliminarlos." + "Eliminar cuenta" diff --git a/features/deactivation/impl/src/main/res/values-fa/translations.xml b/features/deactivation/impl/src/main/res/values-fa/translations.xml index 5c4eb00d62..38828d5e60 100644 --- a/features/deactivation/impl/src/main/res/values-fa/translations.xml +++ b/features/deactivation/impl/src/main/res/values-fa/translations.xml @@ -1,9 +1,14 @@ + "لطفاً تأیید کنید که می‌خواهید حساب کاربری خود را حذف کنید. این اقدام قابل بازگشت نیست." "حذف همهٔ پیام‌هایم" + "هشدار: کاربران آینده ممکن است مکالمات ناقص را ببینند." + "حذف حساب کاربری شما %1$s است، این کار باعث می‌شود:" "بازگشت‌ناپذیر" + "حساب کاربری خود را %1$s کنید (شما نمی‌توانید دوباره وارد سیستم شوید و شناسه شما قابل استفاده مجدد نیست)." "از کار انداختن دایمی" "برداشتنتان از همهٔ اتاق‌های گپ." "حذف اطّلاعات حسابتان از کارساز هویت." - "غیرفعّال‌سازی حساب" + "پیام‌های شما همچنان برای کاربران ثبت‌نام‌شده قابل مشاهده خواهند بود، اما اگر تصمیم به حذف آنها بگیرید، برای کاربران جدید یا ثبت‌نام‌نشده در دسترس نخواهند بود." + "حذف حساب کاربری" diff --git a/features/ftue/impl/src/main/res/values-ar/translations.xml b/features/ftue/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..afd974d4bb --- /dev/null +++ b/features/ftue/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,15 @@ + + + "لا يمكنك التأكيد؟" + "إنشاء مفتاح استرداد جديد" + "اختر طريقة التحقق لإعداد المراسلة الآمنة." + "تأكيد هويتك الرقمية" + "استخدام جهاز آخر" + "استخدام مفتاح الاسترداد" + "يمكنك الآن قراءة الرسائل أو إرسالها بأمان، ويمكن لأي شخص تدردش معه أن يثق بهذا الجهاز أيضًا." + "تم التحقق من الجهاز" + "استخدام جهاز آخر" + "في انتظار الجهاز الآخر…" + "يمكنك تغيير إعداداتك لاحقاً." + "السماح بالإشعارات وعدم تفويت أي رسالة" + diff --git a/features/ftue/impl/src/main/res/values-es/translations.xml b/features/ftue/impl/src/main/res/values-es/translations.xml index 8f49a77e0d..9b232f8dab 100644 --- a/features/ftue/impl/src/main/res/values-es/translations.xml +++ b/features/ftue/impl/src/main/res/values-es/translations.xml @@ -2,8 +2,8 @@ "¿No puedes confirmar?" "Crear una nueva clave de recuperación" - "Verifica este dispositivo para configurar la mensajería segura." - "Confirma que eres tú" + "Elige cómo verificar para configurar la mensajería segura." + "Confirma tu identidad digital" "Usar otro dispositivo" "Usar clave de recuperación" "Ahora puedes leer o enviar mensajes de forma segura y cualquier persona con la que chatees también puede confiar en este dispositivo." diff --git a/features/home/impl/src/main/res/values-ar/translations.xml b/features/home/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..59f4d6c821 --- /dev/null +++ b/features/home/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,56 @@ + + + "عطّل تحسين البطارية لهذا التطبيق للتأكد من استلام جميع الإشعارات." + "تعطيل التحسين" + "هل لا تصلك الإشعارات؟" + "تم تحديث صوت إشعاراتك، ليصبح أوضح وأسرع وأقل إزعاجًا." + "حدّثنا الأصوات لديك" + "يتم نسخ دردشاتك احتياطيًا تلقائيًا بتشفير من طرف إلى طرف. لاستعادة هذه النسخة الاحتياطية والاحتفاظ بهويتك الرقمية إذا فقدت الوصول إلى جميع أجهزتك، ستحتاج إلى مفتاح الاسترداد." + "الحصول على مفتاح الاسترداد" + "احتفِظ بنسخة احتياطية من دردشاتك" + "أكّد مفتاح الاسترداد الخاص بك للحفاظ على الوصول إلى تخزين المفاتيح وسجل الرسائل." + "أدخل مفتاح الاسترداد" + "هل نسيت مفتاح الاسترداد؟" + "تخزين المفاتيح لديك غير متزامن" + "للتأكد من عدم تفويت أي مكالمة مهمة، يُرجى تغيير إعداداتك للسماح بإشعارات ملء الشاشة عندما يكون هاتفك مقفلاً." + "حسّن تجربة مكالماتك" + "المحادثات" + "المساحات" + "أمتأكد من رغبتك برفض دعوة للانضمام إلى %1$s؟" + "رفض الدعوة" + "أمتأكد من رغبتك برفض المحادثة الخاصة مع %1$s؟" + "رفض المحادثة" + "لا دعوات" + "دعاك %1$s (%2$s)" + "هذه العملية تُجرى لمرة واحدة، شكراً على انتظارك." + "إعداد حسابك" + "إنشاء محادثة جديد أو غرفة" + "مسح عوامل التصفية" + "ابدأ الآن بمراسلة من تشاء." + "لا محادثات بعد." + "المفضلة" + "يمكنك إضافة محادثة إلى المفضلة من إعدادات المحادثة. +يمكنك الآن إلغاء تحديد عوامل التصفية لرؤية محادثاتك الأخرى" + "ليست لديك أي محادثات مفضلة بعد" + "الدعوات" + "ليس لديك أي دعوات قيد الانتظار." + "منخفضة الأولوية" + "ليست لديك أي دردشات منخفضة الأولوية بعد" + "يمكنك إلغاء تحديد عوامل التصفية لرؤية محادثاتك الأخرى" + "ليست لديك محادثات لهذا الاختيار" + "الأشخاص" + "ليست لديك أي رسائل مباشرة بعد" + "الغرف" + "لست في أي غرفة بعد" + "غير المقروءة" + "تهانينا! +ليست لديك أي رسائل غير مقروءة!" + "تم إرسال طلب الانضمام" + "المحادثات" + "وضع علامة كمقروء" + "وضع علامة كغير مقروء" + "تمت ترقية هذه الغرفة" + "مساحاتك" + "يبدو أنك تستخدم جهازاً جديداً. تحقق باستخدام جهاز آخر ليصبح لك وصول إلى رسائلك المشفرة." + "أثبت هويتك" + diff --git a/features/home/impl/src/main/res/values-es/translations.xml b/features/home/impl/src/main/res/values-es/translations.xml index ed6cfdc990..e841d6ebf8 100644 --- a/features/home/impl/src/main/res/values-es/translations.xml +++ b/features/home/impl/src/main/res/values-es/translations.xml @@ -3,9 +3,11 @@ "Deshabilita la optimización de la batería en esta aplicación para asegurarte de que recibes notificaciones." "Deshabilitar la optimización" "¿No llegan las notificaciones?" - "Recupera tu identidad criptográfica y tu historial de mensajes con una clave de recuperación si has perdido todos tus dispositivos actuales." - "Configurar la recuperación" - "Configura la recuperación para proteger tu cuenta" + "Se ha actualizado tu sonido de notificación: más claro, rápido y menos disruptivo." + "Hemos actualizado tus sonidos" + "Tus chats se respaldan automáticamente con cifrado de extremo a extremo. Para restaurar esta copia de seguridad y conservar tu identidad digital si pierdes el acceso a todos tus dispositivos, necesitarás tu clave de recuperación." + "Obtener clave de recuperación" + "Copia de seguridad de tus chats" "Confirma tu clave de recuperación para mantener el acceso a tu almacén de claves y al historial de mensajes." "Introduce tu clave de recuperación" "¿Olvidaste tu clave de recuperación?" @@ -13,6 +15,7 @@ "Para asegurarte de que nunca te pierdas una llamada importante, modifica tus ajustes para permitir notificaciones a pantalla completa cuando el teléfono esté bloqueado." "Mejora tu experiencia de llamada" "Chats" + "Espacios" "¿Estás seguro de que quieres rechazar la invitación a unirte a %1$s?" "Rechazar la invitación" "¿Estás seguro de que quieres rechazar este chat privado con %1$s?" @@ -32,6 +35,7 @@ Por ahora, puedes deseleccionar los filtros para ver tus otros chats" "Invitaciones" "No tienes ninguna invitación pendiente." "Prioridad baja" + "Aún no tienes ningún chat de prioridad baja" "Puedes deseleccionar filtros para ver tus otros chats." "No tienes chats para esta selección" "Personas" @@ -46,6 +50,7 @@ Por ahora, puedes deseleccionar los filtros para ver tus otros chats" "Marcar como leído" "Marcar como no leído" "Esta sala ha sido renovada" + "Tus espacios" "Parece que estás usando un nuevo dispositivo. Verifica que eres tú para acceder a tus mensajes cifrados." "Verifica que eres tú" diff --git a/features/home/impl/src/main/res/values-fa/translations.xml b/features/home/impl/src/main/res/values-fa/translations.xml index b0c6a30bc4..64ce86ddc7 100644 --- a/features/home/impl/src/main/res/values-fa/translations.xml +++ b/features/home/impl/src/main/res/values-fa/translations.xml @@ -3,12 +3,16 @@ "از کار انداختن بهینه‌سازی باتری برای این کاره برای اطمینان از گرفتن همهٔ آگاهی‌ها." "از کار انداختن بهینه سازی" "آگاهی‌ها نمی‌رسند؟" - "بازگردانی تاریخچهٔ پیام‌ها و هویت رمزنگاشته‌تان با کلید بازیابی در صورت از دست دادن همهٔ افزاره‌های موجودتان." + "پینگ اعلان شما به‌روزرسانی شده است—واضح‌تر، سریع‌تر و کم‌دردسرتر." + "ما صداهای شما را تازه کرده‌ایم" + "چت‌های شما به طور خودکار با رمزگذاری سراسری پشتیبان‌گیری می‌شوند. برای بازیابی این پشتیبان‌گیری و حفظ هویت دیجیتال خود در زمانی که دسترسی به تمام دستگاه‌هایتان را از دست می‌دهید، به کلید بازیابی خود نیاز خواهید داشت." "دریافت کلید بازیابی" - "برپایی بازیابی" + "از چت‌هایتان پشتیبان بگیرید" "کلید بازیابی خود را تأیید کنید تا دسترسی به حافظه کلیدها و تاریخچه پیام‌هایتان حفظ شود ." "ورود کلید بازیابیتان" + "کلید بازیابی خود را فراموش کرده‌اید؟" "ذخیره‌ساز کلیدتان از هم‌گام بودن در آمده" + "برای اطمینان از اینکه هرگز تماس مهمی را از دست نمی‌دهید، لطفاً تنظیمات خود را تغییر دهید تا وقتی تلفنتان قفل است، اعلان‌ها به صورت تمام صفحه نمایش داده شوند." "بهبود تجریهٔ تماستان" "گپ‌ها" "فضاها" @@ -30,6 +34,7 @@ "دعوت‌ها" "هیچ دعوت منتظری ندارید." "اولویت کم" + "شما هنوز هیچ چت با اولویت پایین ندارید" "می توانید پالایه‌ها را برای دیدن دیگر گپ‌هایتان بردارید" "هیچ گپی برای این گزینش ندارید" "افراد" @@ -44,6 +49,7 @@ "علامت‌گذاری به عنوان خوانده شده" "نشان به ناخوانده" "این اتاق ارتقا یافته" + "فضاهای شما" "گویا از افزاره‌ای جدید استفاده می‌کنید. تأیید با افزاره‌ای دیگر برای دسترسی به پیام‌های رمزنگاری شده‌تان." "تأیید کنید که خودتانید" diff --git a/features/invite/impl/src/main/res/values-ar/translations.xml b/features/invite/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..31ed141c3e --- /dev/null +++ b/features/invite/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,18 @@ + + + "لن ترى أي رسائل أو دعوات إلى غرف من هذا المستخدم" + "حظر المستخدم" + "أبلغ موفّر حسابك عن هذه الغرفة." + "صِف سبب الإبلاغ…" + "رفض وحظر" + "أمتأكد من رغبتك برفض دعوة للانضمام إلى %1$s؟" + "رفض الدعوة" + "أمتأكد من رغبتك برفض المحادثة الخاصة مع %1$s؟" + "رفض المحادثة" + "لا دعوات" + "دعاك %1$s (%2$s)" + "نعم، ارفض واحظر" + "هل أنت متأكد من رغبتك في رفض الدعوة للانضمام إلى هذه الغرفة؟ سيمنع هذا أيضًا %1$s من التواصل معك أو دعوتك إلى غرف." + "رفض الدعوة والحظر" + "رفض وحظر" + diff --git a/features/invite/impl/src/main/res/values-fa/translations.xml b/features/invite/impl/src/main/res/values-fa/translations.xml index 9cbad94f91..9e245d7e9f 100644 --- a/features/invite/impl/src/main/res/values-fa/translations.xml +++ b/features/invite/impl/src/main/res/values-fa/translations.xml @@ -1,6 +1,8 @@ + "شما هیچ پیام یا دعوتنامه‌ای از این کاربر نخواهید دید." "انسداد کاربر" + "این اتاق را به ارائه دهنده حساب خود گزارش دهید." "شرح دلیل گزارش…" "رد و انسداد" "مطمئنید که می‌خواهید دعوت پیوستن به %1$s را رد کنید؟" @@ -10,6 +12,7 @@ "بدون دعوت" "%1$s (%2$s) دعوتتان کرد" "بله. رد و انسداد" + "آیا مطمئنید که می‌خواهید دعوت به عضویت در این اتاق را رد کنید؟ این کار همچنین مانع از تماس %1$s با شما یا دعوت شما به اتاق‌ها می‌شود." "رد دعوت و انسداد" "رد و انسداد" diff --git a/features/invitepeople/impl/src/main/res/values-ar/translations.xml b/features/invitepeople/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..fa28cb13b9 --- /dev/null +++ b/features/invitepeople/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,9 @@ + + + "أنت عضو بالفعل" + "مَدعُوّ بالفعل" + "ليست لديك حاليًا أي دردشات مع جهات الاتصال هذه. أكّد دعوتهم إلى هذه الغرفة قبل المتابعة." + "ليست لديك حاليًا أي دردشات مع جهة الاتصال هذه. أكّد دعوتها إلى هذه الغرفة قبل المتابعة." + "هل تريد دعوة جهات اتصال جديدة إلى هذه الغرفة؟" + "هل تريد دعوة جهة اتصال جديدة إلى هذه الغرفة؟" + diff --git a/features/invitepeople/impl/src/main/res/values-es/translations.xml b/features/invitepeople/impl/src/main/res/values-es/translations.xml index e62bb211e5..b9058446b4 100644 --- a/features/invitepeople/impl/src/main/res/values-es/translations.xml +++ b/features/invitepeople/impl/src/main/res/values-es/translations.xml @@ -1,5 +1,9 @@ - "Ya eres miembro" + "Ya es miembro" "Ya estás invitado" + "De momento no tienes ningún chat con estos contactos. Confirma que quieres invitarlos a esta sala antes de continuar." + "De momento no tienes ningún chat con este contacto. Confirma que quieres invitarlo a esta sala antes de continuar." + "¿Invitar contactos nuevos a esta sala?" + "¿Invitar contacto nuevo a esta sala?" diff --git a/features/invitepeople/impl/src/main/res/values-fa/translations.xml b/features/invitepeople/impl/src/main/res/values-fa/translations.xml index 544f01b8c8..100abe539c 100644 --- a/features/invitepeople/impl/src/main/res/values-fa/translations.xml +++ b/features/invitepeople/impl/src/main/res/values-fa/translations.xml @@ -2,4 +2,8 @@ "از پیش عضو است" "از پیش دعوت شده" + "شما در حال حاضر هیچ گفت‌وگویی با این مخاطبین ندارید. قبل از ادامه، دعوت آنها را به این اتاق تأیید کنید." + "شما در حال حاضر هیچ گفت‌وگویی با این مخاطب ندارید. قبل از ادامه، دعوت او را به این اتاق تأیید کنید." + "مخاطبین جدید را به این اتاق دعوت کنید؟" + "مخاطب جدید را به این اتاق دعوت می‌کنید؟" diff --git a/features/joinroom/impl/src/main/res/values-ar/translations.xml b/features/joinroom/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..84a81ad6a5 --- /dev/null +++ b/features/joinroom/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,34 @@ + + + "لقد حظرك %1$s." + "تم حظرك" + "السبب: %1$s." + "إلغاء الطلب" + "نعم، ألغِ" + "هل أنت متأكد من رغبتك في إلغاء طلبك للانضمام إلى هذه الغرفة؟" + "إلغاء طلب الانضمام" + "نعم، ارفض واحظر" + "هل أنت متأكد من رغبتك في رفض الدعوة للانضمام إلى هذه الغرفة؟ سيمنع هذا أيضًا %1$s من التواصل معك أو دعوتك إلى غرف." + "رفض الدعوة والحظر" + "رفض وحظر" + "فشل الانضمام" + "إما أنك تحتاج إلى دعوة للانضمام، أو قد توجد قيود على الوصول." + "نسيان" + "تحتاج إلى دعوة للانضمام" + "بدعوة من" + "إنضمام" + "قد تحتاج إلى دعوة أو إلى أن تكون عضوًا في مساحة لتتمكن من الانضمام." + "إرسال طلب الانضمام" + "الأحرف المسموح بها: %1$d من %2$d" + "رسالة (اختيارية)" + "ستتلقى دعوة للانضمام إلى الغرفة إذا تم قبول طلبك." + "تم إرسال طلب الانضمام" + "تعذّر عرض معاينة الغرفة. قد يكون ذلك بسبب مشكلات في الشبكة أو الخادم." + "تعذّر عرض معاينة هذه الغرفة" + "لا يدعم %1$s المساحات بعد. يمكنك الوصول إلى المساحات عبر الويب." + "المساحات غير مدعومة بعد" + "انقر على الزر أدناه وسيتم إشعار مسؤول الغرفة. ستتمكن من الانضمام إلى المحادثة بعد الموافقة." + "يجب أن تكون عضوًا في هذه الغرفة لعرض سجل الرسائل." + "هل تريد الانضمام إلى هذه الغرفة؟" + "المعاينة غير متاحة" + diff --git a/features/joinroom/impl/src/main/res/values-es/translations.xml b/features/joinroom/impl/src/main/res/values-es/translations.xml index 698a6eb1c9..6773318776 100644 --- a/features/joinroom/impl/src/main/res/values-es/translations.xml +++ b/features/joinroom/impl/src/main/res/values-es/translations.xml @@ -1,7 +1,7 @@ - "Has sido baneado por %1$s." - "Has sido baneado." + "Has sido vetado por %1$s." + "Has sido vetado" "Motivo: %1$s." "Cancelar solicitud" "Sí, cancelar" @@ -15,9 +15,11 @@ "O es necesario estar invitado para unirse o puede haber restricciones de acceso." "Olvidar" "Necesitas una invitación para unirte" + "Te invitó" "Unirse" "Es posible que necesites ser invitado o ser miembro de un espacio para poder unirte." "Enviar solicitud de unión" + "%1$d de %2$d caracteres permitidos" "Mensaje (opcional)" "Recibirás una invitación para unirte a la sala si se acepta tu solicitud." "Solicitud de unión enviada" diff --git a/features/joinroom/impl/src/main/res/values-fa/translations.xml b/features/joinroom/impl/src/main/res/values-fa/translations.xml index 3f9fc99877..d5102b939f 100644 --- a/features/joinroom/impl/src/main/res/values-fa/translations.xml +++ b/features/joinroom/impl/src/main/res/values-fa/translations.xml @@ -1,23 +1,30 @@ - "به دست %1$s از این اتاق محروم شدید." - "از این اتاق محروم شدید" + "شما توسط %1$s مسدود شده‌اید." + "شما محروم شدید" "دلیل: %1$s." "لغو درخواست" "بله. لغو" + "آیا مطمئن هستید که می‌خواهید درخواست عضویت خود در این اتاق را لغو کنید؟" "لغو درخواست پیوستن" "بله. رد و انسداد" + "آیا مطمئنید که می‌خواهید دعوت به عضویت در این اتاق را رد کنید؟ این کار همچنین مانع از تماس %1$s با شما یا دعوت شما به اتاق‌ها می‌شود." "رد دعوت و انسداد" "رد و انسداد" "پیوستن شکست خورد" - "فراموشی این اتاق" - "برای پیوستن به این اتاق نیاز به دعوت دارید" + "یا باید دعوتنامه داشته باشید یا ممکن است محدودیت‌هایی برای دسترسی وجود داشته باشد." + "فراموش کردن" + "برای عضویت نیاز به دعوتنامه دارید" "دعوت شده از سوی" "پیوستن" "برای پیوستن به فضا باید دعوت شده باشید." "در زدن برای پیوستن" + "کاراکترهای مجاز %1$d از %2$d" "پیام (اختیاری)" + "در صورت پذیرش درخواست، دعوتنامه‌ای برای ورود به اتاق دریافت خواهید کرد." "درخواست پیوستن فرستاده شد" + "ما نتوانستیم پیش‌نمایش اتاق را نمایش دهیم. این ممکن است به دلیل مشکلات شبکه یا سرور باشد." + "ما نتوانستیم پیش‌نمایش این اتاق را نمایش دهیم" "%1$s هنوز از فضاها پشتیبانی نمی‌کند. می‌توانید روی وب به فضاها دسترسی داشته باشید." "فضاها هنوز پشتیبانی نمی‌شوند" "زدن روی این دکمه برای آگاه شدن مدیر اتاق. پس از تأیید می‌توانید به گفت‌وگو بپیوندید." diff --git a/features/knockrequests/impl/src/main/res/values-ar/translations.xml b/features/knockrequests/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..4ff4995748 --- /dev/null +++ b/features/knockrequests/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,40 @@ + + + "نعم، قبول الكل" + "هل أنت متأكد من رغبتك في قبول جميع طلبات الانضمام؟" + "قبول جميع الطلبات" + "قبول الكل" + "تعذّر قبول جميع الطلبات. هل ترغب في المحاولة مرة أخرى؟" + "فشل قبول جميع الطلبات" + "جارٍ قبول جميع طلبات الانضمام" + "تعذّر قبول هذا الطلب. هل ترغب في المحاولة مرة أخرى؟" + "فشل قبول الطلب" + "جارٍ قبول طلب الانضمام" + "نعم، ارفض واحظر" + "هل أنت متأكد من رغبتك في رفض %1$s وحظره؟ لن يتمكن هذا المستخدم من طلب الوصول للانضمام إلى هذه الغرفة مرة أخرى." + "رفض الوصول والحظر" + "جارٍ رفض الوصول وحظره" + "نعم، ارفض" + "هل أنت متأكد من رغبتك في رفض طلب %1$s للانضمام إلى هذه الغرفة؟" + "رفض الوصول" + "رفض وحظر" + "تعذّر رفض هذا الطلب. هل ترغب في المحاولة مرة أخرى؟" + "فشل رفض الطلب" + "جارٍ رفض طلب الانضمام" + "عندما يطلب أحدهم الانضمام إلى الغرفة، ستتمكن من رؤية طلبه هنا." + "لا توجد طلبات انضمام معلّقة" + "جارٍ تحميل طلبات الانضمام…" + "طلبات الانضمام" + + "%1$s يريد الانضمام إلى هذه الغرفة" + "%1$s +%2$d آخر يريدان الانضمام إلى هذه الغرفة" + "%1$s +%2$d آخران يريدون الانضمام إلى هذه الغرفة" + "%1$s +%2$d آخرون يريدون الانضمام إلى هذه الغرفة" + "%1$s +%2$d آخرين يريدون الانضمام إلى هذه الغرفة" + "%1$s +%2$d آخرين يريدون الانضمام إلى هذه الغرفة" + + "عرض الكل" + "قبول" + "%1$s يريد الانضمام إلى هذه الغرفة" + "عرض" + diff --git a/features/knockrequests/impl/src/main/res/values-fa/translations.xml b/features/knockrequests/impl/src/main/res/values-fa/translations.xml index 5b931e4f00..af786de6de 100644 --- a/features/knockrequests/impl/src/main/res/values-fa/translations.xml +++ b/features/knockrequests/impl/src/main/res/values-fa/translations.xml @@ -1,21 +1,34 @@ "بله. پذیرش همه" + "آیا مطمئن هستید که می‌خواهید همه درخواست‌های عضویت را بپذیرید؟" "پذیرش همهٔ درخواست‌ها" "پذیرش همه" + "ما نتوانستیم همه درخواست‌ها را بپذیریم. آیا مایلید دوباره امتحان کنید؟" "شکست در پذیرش همهٔ درخواست‌ها" "پذیرفتن همهٔ درخواست‌های پیوستن" + "ما نتوانستیم این درخواست را بپذیریم. آیا مایلید دوباره امتحان کنید؟" "شکست در پذیرش درخواست" "پذیرفتن درخواست پیوستن" "بله. رد و انسداد" + "آیا مطمئن هستید که می‌خواهید %1$s را رد و مسدود کنید؟ این کاربر دیگر نمی‌تواند درخواست دسترسی برای پیوستن به این اتاق را بدهد." "رد و تحریم دسترسی" "رد کردن و تحریم دسترسی" "بله. رد شود" + "آیا مطمئن هستید که می‌خواهید درخواست %1$s برای پیوستن به این اتاق را رد کنید؟" "رد کردن دسترسی" "رد و تحریم" + "ما نمی‌توانستیم این درخواست را رد کنیم. آیا مایلید دوباره امتحان کنید؟" "شکتس در رد درخواست" "در کردن درخواست پیوستن" + "وقتی کسی درخواست عضویت در اتاق را می‌دهد، می‌توانید درخواست او را اینجا ببینید." + "درخواست عضویت در حال بررسی نیست" + "در حال بارگیری درخواست‌های عضویت…" "درخواست‌های پیوستن" + + "%1$s +%2$d افراد دیگری هم می‌خواهند به این اتاق بپیوندند" + "%1$s +%2$d دیگران می‌خواهند به این اتاق بپیوندند" + "دیدن همه" "پذیرش" "%1$s می‌خواهد به این اتاق بپیوندد" diff --git a/features/leaveroom/api/src/main/res/values-ar/translations.xml b/features/leaveroom/api/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..9253cb5365 --- /dev/null +++ b/features/leaveroom/api/src/main/res/values-ar/translations.xml @@ -0,0 +1,10 @@ + + + "هل أنت متأكد من رغبتك في مغادرة هذه المحادثة؟ هذه المحادثة ليست عامة ولن تتمكن من الانضمام إليها مرة أخرى دون دعوة." + "أأنت متأكد من رغبتك بخروج الغرفة؟ أنت الشخص الوحيد هنا. وإذا ما غادرت فلن يعود أحد قادراً على الدخول في المستقبل، بما فيهم أنت." + "أأنت متأكد من رغبتك بخروج الغرفة؟ هذه الغرفة ليست عامة ولن تعود قادراً على الدخول مجدداً بلا دعوة" + "اختيار المالكين" + "أنت المالك الوحيد لهذه الغرفة. يجب أن تنقل الملكية إلى شخص آخر قبل مغادرة الغرفة." + "نقل الملكية" + "أأنت متأكد من رغبتك بخروج الغرفة؟" + diff --git a/features/leaveroom/api/src/main/res/values-es/translations.xml b/features/leaveroom/api/src/main/res/values-es/translations.xml index 81b169e5c9..59457c8dad 100644 --- a/features/leaveroom/api/src/main/res/values-es/translations.xml +++ b/features/leaveroom/api/src/main/res/values-es/translations.xml @@ -3,5 +3,8 @@ "¿Estás seguro de que quieres salir de esta conversación? Esta conversación no es pública y no podrás volver a unirte sin una invitación." "¿Estás seguro de que quieres salir de esta sala? Eres la única persona aquí. Si te vas, nadie podrá unirse en el futuro, ni siquiera tú." "¿Seguro que quieres salir de esta sala? Esta sala no es pública y no podrás volver a entrar sin una invitación." + "Elegir propietarios" + "Eres el único propietario de esta sala. Debes transferir la propiedad a otra persona antes de salir de la sala." + "Transferir la propiedad" "¿Seguro que quieres salir de la sala?" diff --git a/features/leaveroom/api/src/main/res/values-fa/translations.xml b/features/leaveroom/api/src/main/res/values-fa/translations.xml index ec2cd89314..6391a70210 100644 --- a/features/leaveroom/api/src/main/res/values-fa/translations.xml +++ b/features/leaveroom/api/src/main/res/values-fa/translations.xml @@ -4,6 +4,7 @@ "مطمئنید که می‌خواهید این اتاق را ترک کنید؟ تنها فرد این‌جا هستید. در صورت ترک، هیچ‌کسی از جمله خودتان در آینده نخواهد توانست به آن بپیوندد." "مطمئنید که می‌خواهید این اتاق را ترک کنید؟ این اتاق عمومی نبوده قادر نخواهید بود بدون دعوت دوباره بپیوندید." "گزینش مالکان" + "شما تنها مالک این اتاق هستید. قبل از ترک اتاق، باید مالکیت را به شخص دیگری منتقل کنید." "انتقال مالکیت" "مطمئنید که می‌خواهید این اتاق را ترک کنید؟" diff --git a/features/linknewdevice/impl/src/main/res/values-ar/translations.xml b/features/linknewdevice/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..895a0e7efe --- /dev/null +++ b/features/linknewdevice/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,60 @@ + + + "امسح رمز QR ضوئيًا" + "افتح %1$s على كمبيوتر محمول أو مكتبي" + "امسح رمز QR ضوئيًا باستخدام هذا الجهاز" + "جاهز للمسح الضوئي" + "افتح %1$s على كمبيوتر مكتبي للحصول على رمز QR" + "الأرقام غير متطابقة" + "أدخل الرمز المكوّن من رقمين" + "سيؤكد هذا أن الاتصال بجهازك الآخر آمن." + "أدخل الرقم المعروض على جهازك الآخر" + "لا يدعم موفّر حسابك %1$s." + "%1$s غير مدعوم" + "لا يدعم موفّر حسابك تسجيل الدخول إلى جهاز جديد باستخدام رمز QR." + "رمز QR غير مدعوم" + "تم إلغاء تسجيل الدخول على الجهاز الآخر." + "تم إلغاء طلب تسجيل الدخول" + "انتهت صلاحية تسجيل الدخول. يرجى المحاولة مرة أخرى." + "لم يكتمل تسجيل الدخول في الوقت المحدد" + "افتح %1$s على الجهاز الآخر" + "اختر %1$s" + "«تسجيل الدخول باستخدام رمز QR»" + "امسح رمز QR المعروض هنا باستخدام الجهاز الآخر" + "افتح %1$s على الجهاز الآخر" + "كمبيوتر مكتبي" + "جارٍ تحميل رمز QR…" + "جهاز محمول" + "ما نوع الجهاز الذي تريد ربطه؟" + "يرجى المحاولة مرة أخرى والتأكد من إدخال الرمز المكوّن من رقمين بشكل صحيح. إذا ظلت الأرقام غير متطابقة، فتواصل مع موفّر حسابك." + "الأرقام غير متطابقة" + "تعذّر إنشاء اتصال آمن بالجهاز الجديد. لا تزال أجهزتك الحالية آمنة ولا داعي للقلق بشأنها." + "ماذا الآن؟" + "حاول تسجيل الدخول مجددًا باستخدام رمز QR إذا كانت هذه مشكلة في الشبكة." + "إذا واجهت المشكلة نفسها، جرّب شبكة Wi-Fi مختلفة أو استخدم بيانات الهاتف المحمول بدلًا من Wi-Fi." + "إذا لم ينجح ذلك، سجّل الدخول يدويًا" + "الاتصال غير آمن" + "سيُطلب منك إدخال الرقمين الظاهرين على هذا الجهاز." + "أدخل الرقم أدناه على جهازك الآخر" + "تم إلغاء تسجيل الدخول على الجهاز الآخر." + "تم إلغاء طلب تسجيل الدخول" + "تم رفض تسجيل الدخول على الجهاز الآخر." + "تم رفض تسجيل الدخول" + "لست بحاجة إلى فعل أي شيء آخر." + "جهازك الآخر مسجّل الدخول بالفعل" + "انتهت صلاحية تسجيل الدخول. يرجى المحاولة مرة أخرى." + "لم يكتمل تسجيل الدخول في الوقت المحدد" + "جهازك الآخر لا يدعم تسجيل الدخول إلى %s باستخدام رمز QR. + +جرّب تسجيل الدخول يدويًا، أو امسح رمز QR ضوئيًا باستخدام جهاز آخر." + "رمز QR غير مدعوم" + "لا يدعم موفّر حسابك %1$s." + "%1$s غير مدعوم" + "استخدم رمز QR المعروض على الجهاز الآخر." + "حاول مرة أخرى" + "رمز QR غير صحيح" + "تحتاج إلى منح %1$s إذنًا لاستخدام كاميرا جهازك للمتابعة." + "اسمح بالوصول إلى الكاميرا لمسح رمز QR ضوئيًا" + "حدث خطأ غير متوقع. يرجى المحاولة مرة أخرى." + "في انتظار جهازك الآخر" + diff --git a/features/linknewdevice/impl/src/main/res/values-es/translations.xml b/features/linknewdevice/impl/src/main/res/values-es/translations.xml index c33dc3ad88..5593f4bfd6 100644 --- a/features/linknewdevice/impl/src/main/res/values-es/translations.xml +++ b/features/linknewdevice/impl/src/main/res/values-es/translations.xml @@ -1,16 +1,34 @@ "Escanea el código QR" + "Abre %1$s en un ordenador" "Escanea el código QR con este dispositivo" "Listo para escanear" + "Abre %1$s en un ordenador para obtener el código QR" + "Solo escanea un código QR después de haber seguido los pasos anteriores en tu propio dispositivo. Nunca escanees un código que te haya enviado otra persona." + "Los números no coinciden" + "Introduce el código de 2 dígitos" + "Esto verificará que la conexión con tu otro dispositivo sea segura." + "Introduce el número que aparece en tu otro dispositivo" "Tu proveedor de cuentas no es compatible con %1$s." "%1$s no admitido" + "El proveedor de tu cuenta no admite el inicio de sesión en un nuevo dispositivo con un código QR." "Código QR no admitido" "El inicio de sesión se canceló en el otro dispositivo." "Solicitud de inicio de sesión cancelada" "El inicio de sesión ha caducado. Inténtalo de nuevo." "El inicio de sesión no se completó a tiempo" + "Abre %1$s en el otro dispositivo" "Selecciona %1$s" + "«Iniciar sesión con un código QR»" + "Escanea el código QR que se muestra aquí con el otro dispositivo" + "Abre %1$s en el otro dispositivo" + "Ordenador" + "Cargando código QR…" + "Dispositivo móvil" + "¿Qué tipo de dispositivo quieres vincular?" + "Inténtalo de nuevo y asegúrate de haber introducido correctamente el código de 2 dígitos. Si los números siguen sin coincidir, ponte en contacto con el proveedor de tu cuenta." + "Los números no coinciden" "No se pudo establecer una conexión segura con el nuevo dispositivo. Tus dispositivos actuales siguen siendo seguros y no tienes que preocuparte por ellos." "¿Y ahora qué?" "Intenta iniciar sesión de nuevo con un código QR en caso de que se trate de un problema de red" @@ -23,6 +41,8 @@ "Solicitud de inicio de sesión cancelada" "El inicio de sesión se rechazó en el otro dispositivo." "Inicio de sesión rechazado" + "No tienes que hacer nada más." + "Tu otro dispositivo ya está conectado" "El inicio de sesión ha caducado. Inténtalo de nuevo." "El inicio de sesión no se completó a tiempo" "Tu otro dispositivo no admite el inicio de sesión en %s con un código QR. diff --git a/features/linknewdevice/impl/src/main/res/values-fa/translations.xml b/features/linknewdevice/impl/src/main/res/values-fa/translations.xml index f7b0d7f3db..20c064410c 100644 --- a/features/linknewdevice/impl/src/main/res/values-fa/translations.xml +++ b/features/linknewdevice/impl/src/main/res/values-fa/translations.xml @@ -1,16 +1,34 @@ "پویش کد پاس" + "%1$s را روی لپ‌تاپ یا رایانه رومیزی باز کنید." "پویش کد پاس با این افزاره" "آمادهٔ پویش" + "برای دریافت کد QR، %1$s را روی رایانه رومیزی باز کنید." + "فقط پس از انجام مراحل بالا در دستگاه خود، کد QR را اسکن کنید. هرگز کدی را که توسط شخص دیگری ارسال شده است، اسکن نکنید." + "اعداد مطابقت ندارند" + "کد دو رقمی را وارد کنید" + "این کار تأیید می‌کند که اتصال به دستگاه دیگر شما ایمن است." + "عدد نمایش داده شده در دستگاه دیگر خود را وارد کنید" "فراهم کنندهٔ حسابتان از %1$s پشتیبانی نمی‌کند." "%1$s پشتیبانی نمی‌شود" + "ارائه دهنده حساب شما از ورود به دستگاه جدید با کد QR پشتیبانی نمی‌کند." "کد پاس پشتیبانی نمی‌شود" "ورود روی افزارهٔ دیگر لغو شد." "درخواست ورد لغو شد" "ورود منقضی شد. لطفاً دوباره تلاش کنید." "ورود در زمان معیّن کامل نشد" + "%1$s را در دستگاه دیگر باز کنید" "گزینش %1$s" + "«ورود با کد QR»" + "کد QR نشان داده شده در اینجا را با دستگاه دیگر اسکن کنید" + "%1$s را در دستگاه دیگر باز کنید" + "کامپیوتر رومیزی" + "در حال بارگذاری کد QR…" + "دستگاه همراه" + "چه نوع دستگاهی را می‌خواهید لینک کنید؟" + "لطفاً دوباره امتحان کنید و مطمئن شوید که کد دو رقمی را به درستی وارد کرده‌اید. اگر اعداد هنوز مطابقت ندارند، با ارائه دهنده حساب خود تماس بگیرید." + "اعداد مطابقت ندارند" "نتوانست اتّصالی امن به افزارهٔ جدید بسازد. افزاره‌های موجودتان هنوز امنند و نیازی نیست نگرانشان باشید." "اکنون چه؟" "آزمودن ورود دوباره با کد پاس در صورت مشکل شبکه" @@ -23,6 +41,8 @@ "درخواست ورد لغو شد" "ورود به دست افزارهٔ دیگر رد شد." "ورود رد شد" + "لازم نیست کار دیگری انجام دهید." + "دستگاه دیگر شما قبلاً وارد سیستم شده است" "ورود منقضی شد. لطفاً دوباره تلاش کنید." "ورود در زمان معیّن کامل نشد" "افزارهٔ دیگرتان از ورود به %s با کد پاس پشتیبانی نمی‌کند. diff --git a/features/linknewdevice/impl/src/main/res/values-fi/translations.xml b/features/linknewdevice/impl/src/main/res/values-fi/translations.xml index 0ba5a30e58..c18b9bbfd0 100644 --- a/features/linknewdevice/impl/src/main/res/values-fi/translations.xml +++ b/features/linknewdevice/impl/src/main/res/values-fi/translations.xml @@ -5,6 +5,7 @@ "Skannaa QR-koodi tällä laitteella" "Valmis skannaamaan" "Avaa %1$s pöytätietokoneella saadaksesi QR-koodin" + "Skannaa QR-koodi vasta, kun olet noudattanut yllä olevia ohjeita omalla laitteellasi. Älä koskaan skannaa toisen henkilön lähettämää koodia." "Numerot eivät täsmää" "Kirjoita 2-numeroinen koodi" "Tämä varmistaa, että yhteys toiseen laitteeseesi on turvallinen." diff --git a/features/linknewdevice/impl/src/main/res/values-fr/translations.xml b/features/linknewdevice/impl/src/main/res/values-fr/translations.xml index 12a770af17..7e642578af 100644 --- a/features/linknewdevice/impl/src/main/res/values-fr/translations.xml +++ b/features/linknewdevice/impl/src/main/res/values-fr/translations.xml @@ -5,6 +5,7 @@ "Scanner le code QR avec cet appareil" "Prêt à scanner" "Ouvrir %1$s sur un ordinateur pour obtenir le code QR" + "Ne scannez un code QR qu’après avoir suivi les étapes ci-dessus sur votre propre appareil. Ne scannez jamais un code envoyé par quelqu’un d’autre." "Les nombres ne correspondent pas" "Saisissez le code à 2 chiffres" "Cela permettra de vérifier que la connexion à votre autre appareil est sécurisée." diff --git a/features/location/impl/src/main/res/values-ar/translations.xml b/features/location/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..fb70505fbe --- /dev/null +++ b/features/location/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,6 @@ + + + "سيُخزَّن سجل موقعك المباشر في الغرفة وسيكون مرئيًا للأعضاء بعد انتهاء الجلسة." + "اختر مدة مشاركة موقعك المباشر." + "ليست لديك صلاحيات لمشاركة موقعك المباشر في هذه الغرفة" + diff --git a/features/location/impl/src/main/res/values-es/translations.xml b/features/location/impl/src/main/res/values-es/translations.xml new file mode 100644 index 0000000000..9fc15d3468 --- /dev/null +++ b/features/location/impl/src/main/res/values-es/translations.xml @@ -0,0 +1,6 @@ + + + "Tu historial de ubicación en tiempo real se guardará en la sala y será visible para los miembros después de que termine la sesión." + "Elige por cuánto tiempo quieres compartir tu ubicación en tiempo real" + "No tienes permiso para compartir tu ubicación en tiempo real en esta sala." + diff --git a/features/location/impl/src/main/res/values-fa/translations.xml b/features/location/impl/src/main/res/values-fa/translations.xml new file mode 100644 index 0000000000..5183ed2f43 --- /dev/null +++ b/features/location/impl/src/main/res/values-fa/translations.xml @@ -0,0 +1,6 @@ + + + "سابقه موقعیت مکانی زنده شما در اتاق ذخیره می‌شود و پس از پایان جلسه برای اعضا قابل مشاهده خواهد بود." + "مدت زمان اشتراک‌گذاری موقعیت مکانی زنده خود را انتخاب کنید." + "شما مجوز اشتراک‌گذاری موقعیت مکانی زنده خود را در این اتاق ندارید" + diff --git a/features/lockscreen/impl/src/main/res/values-ar/translations.xml b/features/lockscreen/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..b277c420ea --- /dev/null +++ b/features/lockscreen/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,46 @@ + + + "المصادقة بالمقاييس الحيوية" + "إلغاء القفل باستخدام المقاييس الحيوية" + "إلغاء القفل باستخدام المقاييس الحيوية" + "تأكيد المصادقة الحيوية" + "هل نسيت رمز PIN؟" + "تغيير رمز PIN" + "السماح بإلغاء القفل باستخدام المقاييس الحيوية" + "إزالة رمز PIN" + "هل أنت متأكد من رغبتك في إزالة رمز PIN؟" + "إزالة رمز PIN؟" + "السماح بـ %1$s" + "أفضّل استخدام رمز PIN" + "وفّر بعض الوقت واستخدم %1$s لإلغاء قفل التطبيق في كل مرة" + "اختر رمز PIN" + "تأكيد رمز PIN" + "اقفل %1$s لإضافة مزيد من الأمان إلى محادثاتك. + +اختر شيئًا يسهل تذكره. إذا نسيت رمز PIN هذا، فسيتم تسجيل خروجك من التطبيق." + "لا يمكنك اختيار هذا كرمز PIN لأسباب أمنية" + "اختر رمز PIN مختلفًا" + "يُرجى إدخال رمز PIN نفسه مرتين" + "رمزا PIN غير متطابقين" + "ستحتاج إلى تسجيل الدخول مرة أخرى وإنشاء رمز PIN جديد للمتابعة" + "تتم إزالة هذا الجهاز" + + "لديك %1$d محاولات لإلغاء القفل" + "لديك %1$d محاولة لإلغاء القفل" + "لديك %1$d محاولتان لإلغاء القفل" + "لديك %1$d محاولات لإلغاء القفل" + "لديك %1$d محاولة لإلغاء القفل" + "لديك %1$d محاولة لإلغاء القفل" + + + "رمز PIN غير صحيح. لديك %1$d فرص أخرى" + "رمز PIN غير صحيح. لديك %1$d فرصة أخرى" + "رمز PIN غير صحيح. لديك %1$d فرصتان أخريان" + "رمز PIN غير صحيح. لديك %1$d فرص أخرى" + "رمز PIN غير صحيح. لديك %1$d فرصة أخرى" + "رمز PIN غير صحيح. لديك %1$d فرصة أخرى" + + "استخدام المقاييس الحيوية" + "استخدام رمز PIN" + "تجري إزالة الجهاز…" + diff --git a/features/lockscreen/impl/src/main/res/values-es/translations.xml b/features/lockscreen/impl/src/main/res/values-es/translations.xml index c0e34a3763..085c1d1cbf 100644 --- a/features/lockscreen/impl/src/main/res/values-es/translations.xml +++ b/features/lockscreen/impl/src/main/res/values-es/translations.xml @@ -23,7 +23,7 @@ Elige algo que puedas recordar. Si olvidas este PIN, se cerrará la sesión de l "Por favor ingresa el mismo PIN dos veces" "Los PINs no coinciden" "Tendrás que volver a iniciar sesión y crear un nuevo PIN para continuar" - "Se está cerrando tu sesión" + "Se está eliminando este dispositivo" "Tienes %1$d intento de desbloqueo" "Tienes %1$d intentos de desbloqueo" @@ -34,5 +34,5 @@ Elige algo que puedas recordar. Si olvidas este PIN, se cerrará la sesión de l "Usar desbloqueo biométrico" "Usar PIN" - "Cerrando sesión…" + "Eliminando dispositivo…" diff --git a/features/lockscreen/impl/src/main/res/values-pl/translations.xml b/features/lockscreen/impl/src/main/res/values-pl/translations.xml index 29691987f6..e6faf72945 100644 --- a/features/lockscreen/impl/src/main/res/values-pl/translations.xml +++ b/features/lockscreen/impl/src/main/res/values-pl/translations.xml @@ -17,7 +17,7 @@ "Potwierdź PIN" "Zablokuj %1$s, aby zwiększyć bezpieczeństwo swoich czatów. -Wybierz coś łatwego do zapamiętania. Jeśli zapomnisz ten PIN, zostaniesz wylogowany z aplikacji." +Wybierz coś łatwego do zapamiętania. Jeśli zapomnisz tego PINu, zostaniesz wylogowany z aplikacji." "Nie możesz wybrać tego PIN\'u ze względów bezpieczeństwa" "Wybierz inny kod PIN" "Wprowadź ten sam kod PIN dwa razy" diff --git a/features/login/impl/src/main/res/values-ar/translations.xml b/features/login/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..181b38ec24 --- /dev/null +++ b/features/login/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,109 @@ + + + "تغيير مزوّد الحسابات" + "عنوان السيرفر" + "أدخِل عبارة بحث أو عنوان نطاق." + "ابحث عن شركة، أو مجتمع، أو سيرفر خاص." + "ابحث عن مزوّد حسابات" + "هذا المكان الذي تقطن فيه رسائلك — تماماً كاستخدامك مزوّد بريد إلكتروني للاحتفاظ برسائل البريد خاصّتك فيه." + "أنت على وشك تسجيل الدخول إلى %s" + "هذا المكان الذي تقطن فيه رسائلك — تماماً كاستخدامك مزوّد بريد إلكتروني للاحتفاظ برسائل البريد خاصّتك فيه." + "أنت على وشك إنشاء حساب في %s" + "إن Matrix.org سيرفر ضخم ومجاني في شبكة Matrix العامّة وُجِد من أجل مراسلات آمنة ولا مركزية، يُدار من قِبل مؤسسة Matrix.org." + "غير ذلك" + "استخدم مزوّد حسابات آخر كسيرفرك الخاص أو حساب عمل." + "تغيير مزوّد الحسابات" + "Google Play" + "تطبيق Element Pro مطلوب على %1$s. يرجى تنزيله من المتجر." + "Element Pro مطلوب" + "لم نستطع الوصول لهذا السيرفر. رجاءً تحقق إذا ما كنت أدخلت عنوان الـURL بشكل صحيح. إذا كان الـURL صحيحاً فراسل إدارة السيرفر خاصتك لمزيد من المساعدة." + "الخادم غير متاح بسبب مشكلة في ملف .well-known: +%1$s" + "لا يدعم موفّر الحساب المحدد ميزة Sliding Sync. يلزم ترقية الخادم لاستخدام %1$s." + "غير مسموح لـ %1$s بالاتصال بـ %2$s." + "تم إعداد هذا التطبيق للسماح بـ: %1$s." + "موفّر الحساب %1$s غير مسموح به." + "عنوان الـ URL للسيرفر" + "أدخل عنوان نطاق." + "ما عنوان السيرفر خاصتك؟" + "اختر خادمك" + "إنشاء حساب" + "هذا الحساب محذوف." + "اسم المستخدم و/أو كلمة المرور غير صحيحة" + "معرّف المستخدم هذا غير صالح. التنسيق المتوقّع: \'@user:homeserver.org\'" + "تم إعداد هذا الخادم لاستخدام رموز التحديث. وهي غير مدعومة عند استخدام تسجيل الدخول بكلمة المرور." + "لا يتيح المخدِّم المختار تسجيلَ الدخول بكلمة سرّ أو OAuth. راجع المسؤول أو اختر مخدِّماً آخر." + "أدخِل تفاصيلك" + "Matrix عبارة عن شبكة مفتوحة للاتصالات الآمنة واللا مركزية." + "أهلاً بعودتك!" + "تسجيل الدخول إلى %1$s" + "فتح Element Classic" + "افتح Element Classic على جهازك" + "انتقل إلى الإعدادات > الأمان والخصوصية" + "في إدارة مفاتيح التشفير، اختر استرداد الرسائل المشفّرة" + "اتبع التعليمات لتفعيل تخزين مفاتيحك" + "عُد إلى %1$s" + "فعّل تخزين مفاتيحك قبل المتابعة إلى %1$s" + "الإصدار %1$s" + "جارٍ التحقق من الحساب" + "تسجيل الدخول يدوياً" + "تسجيل الدخول إلى %1$s" + "تسجيل الدخول باستخدام رمز QR" + "إنشاء حساب" + "مرحبًا بعودتك" + "مرحباً بك في أسرع %1$s على الإطلاق. مزوَّد من أجل سرعةٍ وبساطة." + "مرحباً بك في %1$s. المعزَّز، من أجل سرعةٍ وبساطة." + "Be in your element" + "جارٍ إنشاء اتصال آمن" + "تعذّر إنشاء اتصال آمن بالجهاز الجديد. لا تزال أجهزتك الحالية آمنة ولا داعي للقلق بشأنها." + "ماذا الآن؟" + "حاول تسجيل الدخول مجددًا باستخدام رمز QR إذا كانت هذه مشكلة في الشبكة." + "إذا واجهت المشكلة نفسها، جرّب شبكة Wi-Fi مختلفة أو استخدم بيانات الهاتف المحمول بدلًا من Wi-Fi." + "إذا لم ينجح ذلك، سجّل الدخول يدويًا" + "الاتصال غير آمن" + "سيُطلب منك إدخال الرقمين الظاهرين على هذا الجهاز." + "أدخل الرقم أدناه على جهازك الآخر" + "سجّل الدخول إلى جهازك الآخر ثم حاول مرة أخرى، أو استخدم جهازًا آخر تم تسجيل الدخول عليه بالفعل." + "لم يتم تسجيل الدخول على الجهاز الآخر" + "تم إلغاء تسجيل الدخول على الجهاز الآخر." + "تم إلغاء طلب تسجيل الدخول" + "تم رفض تسجيل الدخول على الجهاز الآخر." + "تم رفض تسجيل الدخول" + "لست بحاجة إلى فعل أي شيء آخر." + "جهازك الآخر مسجّل الدخول بالفعل" + "انتهت صلاحية تسجيل الدخول. يرجى المحاولة مرة أخرى." + "لم يكتمل تسجيل الدخول في الوقت المحدد" + "جهازك الآخر لا يدعم تسجيل الدخول إلى %s باستخدام رمز QR. + +جرّب تسجيل الدخول يدويًا، أو امسح رمز QR ضوئيًا باستخدام جهاز آخر." + "رمز QR غير مدعوم" + "لا يدعم موفّر حسابك %1$s." + "%1$s غير مدعوم" + "جاهز للمسح الضوئي" + "افتح %1$s على جهاز سطح مكتب" + "انقر على صورتك الرمزية" + "اختر %1$s" + "“ربط جهاز جديد”" + "امسح رمز QR ضوئيًا باستخدام هذا الجهاز" + "متاح فقط إذا كان موفّر حسابك يدعم ذلك." + "افتح %1$s على جهاز آخر للحصول على رمز QR" + "استخدم رمز QR المعروض على الجهاز الآخر." + "حاول مرة أخرى" + "رمز QR غير صحيح" + "الانتقال إلى إعدادات الكاميرا" + "تحتاج إلى منح %1$s إذنًا لاستخدام كاميرا جهازك للمتابعة." + "اسمح بالوصول إلى الكاميرا لمسح رمز QR ضوئيًا" + "امسح رمز QR ضوئيًا" + "البدء من جديد" + "حدث خطأ غير متوقع. يرجى المحاولة مرة أخرى." + "في انتظار جهازك الآخر" + "قد يطلب موفّر حسابك الرمز التالي للتحقق من تسجيل الدخول." + "رمز التحقق الخاص بك" + "تغيير مزوّد الحسابات" + "سيرفر خاص بموظّفي Element." + "Matrix عبارة عن شبكة مفتوحة للاتصالات الآمنة واللا مركزية." + "هذا المكان الذي تقطن فيه رسائلك — تماماً كاستخدامك مزوّد بريد إلكتروني للاحتفاظ برسائل البريد خاصّتك فيه." + "أنت على وشك تسجيل الدخول إلى %1$s" + "اختر موفّر الحساب" + "أنت على وشك إنشاء حساب في %1$s" + diff --git a/features/login/impl/src/main/res/values-es/translations.xml b/features/login/impl/src/main/res/values-es/translations.xml index 3b9ffbe2dd..33b3741234 100644 --- a/features/login/impl/src/main/res/values-es/translations.xml +++ b/features/login/impl/src/main/res/values-es/translations.xml @@ -13,6 +13,9 @@ "Otro" "Usa un proveedor de cuentas diferente, como tu propio servidor privado o una cuenta de trabajo." "Cambiar proveedor de cuentas" + "Google Play" + "%1$s requiere la aplicación Element Pro. Descárgala de la tienda." + "Se requiere Element Pro" "No hemos podido acceder a este servidor base. Comprueba que has introducido correctamente la dirección. Si es correcta, ponte en contacto con el administrador de tu servidor base para obtener más ayuda." "El servidor no está disponible debido a un problema en el archivo .well-known: %1$s" @@ -25,7 +28,7 @@ "¿Cuál es la dirección de tu servidor?" "Selecciona tu servidor" "Crear cuenta" - "Esta cuenta ha sido desactivada." + "Esta cuenta ha sido eliminada." "Usuario y/o contraseña incorrectos" "Este no es un id de usuario válido. Formato esperado: \'@user:homeserver.org\'" "Este servidor está configurado para utilizar tokens de actualización. Estos no son compatibles cuando se utiliza el inicio de sesión basado en contraseña." @@ -34,11 +37,20 @@ "Matrix es una red abierta para una comunicación segura y descentralizada." "¡Hola de nuevo!" "Iniciar sesión en %1$s" + "Abrir Element Classic" + "Abre Element Classic en tu dispositivo" + "Ve a Ajustes > Seguridad y privacidad" + "En «Gestión de claves criptográficas», selecciona «Recuperación de mensajes cifrados»" + "Sigue las instrucciones para activar tu almacén de claves" + "Vuelve a %1$s" + "Activa tu almacén de claves antes de continuar con %1$s" "Versión %1$s" + "Comprobación de la cuenta" "Iniciar sesión manualmente" "Iniciar sesión en %1$s" "Iniciar sesión con un código QR" "Crear cuenta" + "¡Hola de nuevo!" "Bienvenido al %1$s más rápido de todos los tiempos. Diseñado para la velocidad y la simplicidad." "Bienvenido a %1$s. Vitaminado, para mayor rapidez y sencillez." "Siéntete en tu Elemento" @@ -57,6 +69,8 @@ "Solicitud de inicio de sesión cancelada" "El inicio de sesión se rechazó en el otro dispositivo." "Inicio de sesión rechazado" + "No tienes que hacer nada más." + "Tu otro dispositivo ya está conectado" "El inicio de sesión ha caducado. Inténtalo de nuevo." "El inicio de sesión no se completó a tiempo" "Tu otro dispositivo no admite el inicio de sesión en %s con un código QR. diff --git a/features/login/impl/src/main/res/values-fa/translations.xml b/features/login/impl/src/main/res/values-fa/translations.xml index 38c2c11eaa..ce0ab0da20 100644 --- a/features/login/impl/src/main/res/values-fa/translations.xml +++ b/features/login/impl/src/main/res/values-fa/translations.xml @@ -14,8 +14,14 @@ "استفاده از فراهم کنندهٔ حسابی دیگر چون کارساز خصوصی خوتان یا حسابی کاری." "تغییر فراهم کنندهٔ حساب" "پلی گپگل" + "برنامه Element Pro برای %1$s مورد نیاز است. لطفاً آن را از فروشگاه دانلود کنید." + "المنت پرو مورد نیاز است" "ما نتوانستیم به این کارساز خانگی برسیم. لطفاً بررسی کنید که URL کارساز اصلی را به درستی وارد کرده اید. اگر URL صحیح است، برای کمک بیشتر با مدیر کارساز خانگی خود تماس بگیرید." "سرور به دلیل مشکلی در فایل .well-known در دسترس نیست: %1$s" + "ارائه دهنده حساب انتخاب شده از همگام سازی کشویی پشتیبانی نمی کند. برای استفاده از %1$s، ارتقاء سرور لازم است." + "%1$s اجازه اتصال به %2$s را ندارد." + "این برنامه طوری پیکربندی شده است که اجازه موارد زیر را بدهد: %1$s." + "ارائه دهنده حساب %1$s مجاز نیست." "نشانی کارساز خانگی" "ورود نشانی دامنه." "نشانی کارسازتان چیست؟" @@ -30,11 +36,20 @@ "ماتریکس شبکه‌ای بار برای ارتباطات نامتمرکز و امن است." "خوش برگشتید!" "ورود به %1$s" + "باز کردن Element کلاسیک" + "Element Classic را روی دستگاه خود باز کنید" + "به تنظیمات > امنیت و حریم خصوصی بروید" + "در مدیریت کلیدهای رمزنگاری، بازیابی پیام‌های رمزگذاری‌شده را انتخاب کنید." + "برای فعال کردن فضای ذخیره‌سازی کلید، دستورالعمل‌ها را دنبال کنید" + "به %1$s برگردید" + "قبل از ادامه به %1$s، فضای ذخیره‌سازی کلید خود را فعال کنید" "نگارش %1$s" + "درحال بررسی حساب…" "ورود دستی" "ورود به %1$s" "ورود با کد QR" "ایجاد حساب" + "خوش برگشتید" "به سریع‌ترین %1$s خوش آمدید. بازطرّاحی شده برای سرعت و سادگی." "به %1$s خوش آمدید. بازطرّاحی شده برای سرعت و سادگی." "در المنتتان باشید" @@ -53,6 +68,8 @@ "درخواست ورد لغو شد" "ورود به دست افزارهٔ دیگر رد شد." "ورود رد شد" + "لازم نیست کار دیگری انجام دهید." + "دستگاه دیگر شما قبلاً وارد سیستم شده است" "ورود منقضی شد. لطفاً دوباره تلاش کنید." "ورود در زمان معیّن کامل نشد" "افزارهٔ دیگرتان از ورود به %s با کد پاس پشتیبانی نمی‌کند. @@ -67,6 +84,7 @@ "گزینش %1$s" "«پیوند افزارهٔ جدید»" "پویش کد پاس با این افزاره" + "فقط در صورتی موجود است که ارائه دهنده حساب شما از آن پشتیبانی کند." "گشودن %1$s روی افزاره‌ای دیگر برای گرفتن کد پاس" "استفاده از کد پاس نشان داده روی افزارهٔ دیگر." "تلاش دوباره" @@ -85,5 +103,6 @@ "ماتریکس شبکه‌ای بار برای ارتباطات نامتمرکز و امن است." "جایی که گفت‌وگوهایتان خواهند زیست — درست مثل استفاده‌تان از فراهم کنندهٔ رایانامه‌ای برای نگه داشتن رایانامه‌هایتان." "دارید به %1$s وارد می‌شوید" + "ارائه دهنده حساب را انتخاب کنید" "دارید روی %1$s حساب می‌سازید" diff --git a/features/logout/impl/src/main/res/values-ar/translations.xml b/features/logout/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..6825a5c54d --- /dev/null +++ b/features/logout/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,18 @@ + + + "أمتأكد من إزالة هذا الجهاز؟" + "إزالة هذا الجهاز" + "إزالة هذا الجهاز" + "تجري إزالة الجهاز…" + "هذا هو جهازك الوحيد. إذا أزلته، فستحتاج إلى مفتاح استرداد لتأكيد هويتك الرقمية واستعادة محادثاتك المشفّرة في المرة التالية التي تسجّل فيها الدخول." + "أنت على وشك فقدان الوصول إلى محادثاتك المشفّرة" + "كان النسخ الاحتياطي لمفاتيحك لا يزال جاريًا عندما أصبحت غير متصل. أعد الاتصال حتى يمكن نسخ مفاتيحك احتياطيًا قبل إزالة هذا الجهاز." + "لا يزال النسخ الاحتياطي لمفاتيحك جاريًا" + "يُرجى الانتظار حتى تكتمل هذه العملية قبل إزالة هذا الجهاز." + "لا يزال النسخ الاحتياطي لمفاتيحك جاريًا" + "إزالة هذا الجهاز" + "هذا هو جهازك الوحيد. إذا أزلته، فستحتاج إلى مفتاح استرداد لتأكيد هويتك الرقمية واستعادة محادثاتك المشفّرة في المرة التالية التي تسجّل فيها الدخول." + "أنت على وشك فقدان الوصول إلى محادثاتك المشفّرة" + "هذا هو جهازك الوحيد. إذا أزلته، فستحتاج إلى مفتاح استرداد لتأكيد هويتك الرقمية واستعادة محادثاتك المشفّرة في المرة التالية التي تسجّل فيها الدخول." + "تأكد من أن لديك إمكانية الوصول إلى مفتاح الاسترداد الخاص بك قبل إزالة هذا الجهاز" + diff --git a/features/logout/impl/src/main/res/values-es/translations.xml b/features/logout/impl/src/main/res/values-es/translations.xml index 94d0ec56a8..6c451c0834 100644 --- a/features/logout/impl/src/main/res/values-es/translations.xml +++ b/features/logout/impl/src/main/res/values-es/translations.xml @@ -1,18 +1,18 @@ - "¿Estás seguro de que quieres cerrar sesión?" - "Cerrar sesión" - "Cerrar sesión" - "Cerrando sesión…" - "Estás a punto de cerrar tu última sesión. Si cierras sesión ahora, perderás el acceso a tus mensajes cifrados." - "Has desactivado la copia de seguridad" - "Se estaba haciendo una copia de seguridad de tus claves cuando te desconectaste. Vuelve a conectarte para que se haga una copia de seguridad de tus claves antes de desconectarte." + "¿Estás seguro de que quieres eliminar este dispositivo?" + "Eliminar este dispositivo" + "Eliminar este dispositivo" + "Eliminando dispositivo…" + "Este es tu único dispositivo. Si lo eliminas, necesitarás una clave de recuperación para poder confirmar tu identidad digital y restaurar tus chats cifrados la próxima vez que inicies sesión." + "Estás a punto de perder acceso a tus chats cifrados" + "Se estaba haciendo una copia de seguridad de tus claves cuando te desconectaste. Vuelve a conectarte para que se haga una copia de seguridad de tus claves antes de eliminar este dispositivo." "Se sigue guardando una copia de seguridad de tus claves" - "Espera a que se complete antes de cerrar sesión." + "Espera a que se complete antes de eliminar este dispositivo." "Se sigue guardando una copia de seguridad de tus claves" - "Cerrar sesión" - "Estás a punto de cerrar tu última sesión. Si cierras sesión ahora, perderás el acceso a tus mensajes cifrados." - "La recuperación no está configurada" - "Estás a punto de cerrar tu última sesión. Si cierras la sesión ahora, podrías perder el acceso a tus mensajes cifrados." - "¿Has guardado tu clave de recuperación?" + "Eliminar este dispositivo" + "Este es tu único dispositivo. Si lo eliminas, necesitarás una clave de recuperación para poder confirmar tu identidad digital y restaurar tus chats cifrados la próxima vez que inicies sesión." + "Estás a punto de perder el acceso a tus chats cifrados." + "Este es tu único dispositivo. Si lo eliminas, necesitarás una clave de recuperación para poder confirmar tu identidad digital y restaurar tus chats cifrados la próxima vez que inicies sesión." + "Asegúrate de tener acceso a tu clave de recuperación antes de eliminar este dispositivo" diff --git a/features/messages/impl/src/main/res/values-ar/translations.xml b/features/messages/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..80c296fa94 --- /dev/null +++ b/features/messages/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,114 @@ + + + "مرسل الحدث لا يطابق مالك الجهاز الذي أرسله." + "لا يمكن ضمان أصالة هذه الرسالة المشفّرة على هذا الجهاز." + "تم التشفير بواسطة مستخدم تم التحقق منه سابقًا." + "غير مشفّرة." + "تم التشفير بواسطة جهاز غير معروف أو محذوف." + "تم التشفير بواسطة جهاز لم يتحقق منه مالكه." + "تم التشفير بواسطة مستخدم لم يتم التحقق منه." + "قلب الصورة أفقيًا" + "مقلوبة أفقيًا" + "الأصلية" + "قلب الصورة رأسيًا" + "مقلوبة رأسيًا" + "الأصلية" + "تدوير الصورة إلى اليسار" + + "%1$d درجات" + "%1$d درجة" + "%1$d درجتان" + "%1$d درجات" + "%1$d درجة" + "%1$d درجة" + + "تعديل الصورة" + "قد لا تكون التعليقات التوضيحية مرئية للأشخاص الذين يستخدمون تطبيقات أقدم." + "اضغط لتغيير جودة رفع الفيديو" + "تعذّر رفع الملف." + "تعذّرت معالجة الوسائط من أجل رفعها، يرجى المحاولة مجدداً." + "تعذّر رفع الوسائط، يرجى المحاولة مجدداً." + "الحد الأقصى المسموح به لحجم الملف هو %1$s." + "الملف كبير جدًا ولا يمكن رفعه" + "العنصر %1$d من %2$d" + "تحسين جودة الصورة" + "جارٍ المعالجة…" + "إضافة وسائط" + "حظر المستخدم" + "حدِّد على هذا الخيار إذا كنت تريد إخفاء كل الرسائل الحالية والمستقبلية من هذا المستخدم" + "ستُبلَّغ هذه الرسالة إلى إدارة السيرفر خاصتك. لن يكونوا قادرين على قراءة أي رسالة مشفرة." + "سبب إبلاغك عن هذا المحتوى" + "الكاميرا" + "التقاط صورة" + "تسجيل مقطع فيديو" + "مرفق" + "معرض الصور والفيديوهات" + "مشاركة الموقع الجغرافي" + "استفتاء" + "تنسيق النص" + "سجل الرسائل غير متوفر حالياً." + "سجل الرسائل غير متاح في هذه الغرفة. تحقّق من هذا الجهاز لرؤية سجل رسائلك." + "هل تريد دعوته مجدداً؟" + "أنت لوحدك في هذه المحادثة" + "إشعار الغرفة بأكملها" + "الجميع" + "أرسل مجدداً" + "فشل إرسال رسالتك" + "أضف تفاعل" + "هنا بداية %1$s" + "هنا بداية المحادثة" + "مكالمة غير مدعومة. اسأل المتصل عما إذا كان بإمكانه استخدام تطبيق Element X الجديد." + "أظهر أقل" + "نُسِخت الرسالة" + "لا تملك الإذن بالنشر في هذه الغرفة" + + "تفاعل %1$d أعضاء بـ %2$s" + "تفاعل %1$d عضو بـ %2$s" + "تفاعل %1$d عضوان بـ %2$s" + "تفاعل %1$d أعضاء بـ %2$s" + "تفاعل %1$d عضوًا بـ %2$s" + "تفاعل %1$d عضو بـ %2$s" + + + "تفاعلت أنت و%1$d أعضاء بـ %2$s" + "تفاعلت أنت و%1$d عضو بـ %2$s" + "تفاعلت أنت و%1$d عضوان بـ %2$s" + "تفاعلت أنت و%1$d أعضاء بـ %2$s" + "تفاعلت أنت و%1$d عضوًا بـ %2$s" + "تفاعلت أنت و%1$d عضو بـ %2$s" + + "تفاعلت بـ %1$s" + "أظهر أقل" + "أظهر المزيد" + "اعرض ملخص التفاعلات" + "جديدة" + + "%1$d تغيير في الغرفة" + "%1$d تغيير في الغرفة" + "%1$d تغيير في الغرفة" + "%1$d تغييرات في الغرفة" + "%1$d تغيير في الغرفة" + "%1$d تغيير في الغرفة" + + "الانتقال إلى الغرفة الجديدة" + "استُبدلت هذه الغرفة ولم تعد نشطة" + "عرض الرسائل القديمة" + "هذه الغرفة هي استمرار لغرفة أخرى" + + "%1$s و%2$s و%3$d آخرون" + "%1$s و%2$s و%3$d آخر" + "%1$s و%2$s و%3$d آخران" + "%1$s و%2$s و%3$d آخرون" + "%1$s و%2$s و%3$d آخر" + "%1$s و%2$s و%3$d آخر" + + + "%1$s يكتبون الآن" + "%1$s يكتب الآن" + "%1$s يكتبان الآن" + "%1$s يكتبون الآن" + "%1$s يكتبون الآن" + "%1$s يكتبون الآن" + + "%1$s و%2$s" + diff --git a/features/messages/impl/src/main/res/values-es/translations.xml b/features/messages/impl/src/main/res/values-es/translations.xml index 0a0b57cc5e..ed725bc9d2 100644 --- a/features/messages/impl/src/main/res/values-es/translations.xml +++ b/features/messages/impl/src/main/res/values-es/translations.xml @@ -7,9 +7,29 @@ "Cifrado por un dispositivo desconocido o eliminado." "Cifrado por un dispositivo no verificado por su propietario." "Cifrado por un usuario no verificado." + "Voltear la imagen horizontalmente" + "Volteada horizontalmente" + "Original" + "Voltear la imagen verticalmente" + "Volteada verticalmente" + "Original" + "Rotar la imagen hacia la izquierda" + + "%1$d grado" + "%1$d grados" + + "Editar foto" "Es posible que las leyendas no sean visibles para las personas que usan aplicaciones más antiguas." + "Toca para cambiar la calidad de subida del vídeo" + "No se pudo subir el archivo." "Error al procesar el contenido multimedia, por favor inténtalo de nuevo." "Error al subir el contenido multimedia, por favor inténtalo de nuevo." + "El tamaño máximo permitido de archivo es de %1$s." + "El archivo es demasiado grande para subirlo" + "Elemento %1$d de %2$d" + "Optimizar la calidad de la imagen" + "Procesando…" + "Añadir contenido multimedia" "Bloquear usuario" "Marca esta casilla si quieres ocultar todos los mensajes actuales y futuros de este usuario" "Se denunciará este mensaje al administrador de tu servidor base. No será capaz de leer ningún mensaje cifrado." @@ -19,7 +39,7 @@ "Grabar video" "Archivo adjunto" "Biblioteca de fotos y vídeos" - "Ubicación" + "Compartir ubicación" "Encuesta" "Formato de texto" "El historial de mensajes no está disponible en este momento." @@ -37,10 +57,23 @@ "Mostrar menos" "Mensaje copiado" "No tienes permiso para publicar en esta sala" + + "%1$d miembro reaccionó con %2$s" + "%1$d miembros reaccionaron con %2$s" + + + "Tú y %1$d miembro reaccionasteis con %2$s" + "Tú y %1$d miembros reaccionasteis con %2$s" + + "Reaccionaste con %1$s" "Mostrar menos" "Mostrar más" "Mostrar todas las reacciones" "Nuevos" + + "%1$d mensaje eliminado" + "%1$d mensajes eliminados" + "%1$d cambio en la sala" "%1$d cambios en la sala" diff --git a/features/messages/impl/src/main/res/values-fa/translations.xml b/features/messages/impl/src/main/res/values-fa/translations.xml index 4f8f737f9c..f10d9ead33 100644 --- a/features/messages/impl/src/main/res/values-fa/translations.xml +++ b/features/messages/impl/src/main/res/values-fa/translations.xml @@ -1,14 +1,35 @@ + "فرستنده رویداد با صاحب دستگاهی که آن را ارسال کرده است، مطابقت ندارد." "اعتبار این پیام رمز شده نمی‌تواند روی این افزاره تأیید شود." "رمز شده به دست کاربری از پیش تأیید شده." "رمز نشده." "رمز شده به دست افزاره‌ای ناشناخته یا حذف شده." "رمز شده به دست افزاره‌ای که از سوی مالکش تأیید نشده." "رمز شده به دست کاربری تأیید نشده." + "تصویر را به صورت افقی بچرخانید" + "به صورت افقی برگردانده شده" + "اصلی" + "تصویر را به صورت عمودی بچرخانید" + "به صورت عمودی برگردانده شده" + "اصلی" + "تصویر را به سمت چپ بچرخانید" + + "درجه %1$d" + "درجه‌های %1$d" + + "ویرایش عکس" + "ممکن است زیرنویس‌ها برای افرادی که از برنامه‌های قدیمی‌تر استفاده می‌کنند قابل مشاهده نباشند." + "برای تغییر کیفیت آپلود ویدیو، ضربه بزنید" + "فایل قابل آپلود نبود." "پردازش رسانه برای بارگذاری شکست خورد. لطفاً دوباره تلاش کنید." "بارگذاری رسانه شکست خورد. لطفاً دوباره تلاش کنید." + "حداکثر اندازه مجاز فایل %1$s است." + "فایل برای آپلود خیلی بزرگ است" + "مورد %1$d از %2$d" + "بهینه سازی کیفیت تصویر" "پردازش کردن…" + "افزودن رسانه" "انسداد کاربر" "اگر می‌خواهید همه پیام‌های فعلی و آینده را از این کاربر را پنهان کنید، علامت بزنید" "این پیام به مدیر کارساز خانگی شما گزارش خواهد شد. آنها قادر به خواندن پیام های رمزگذاری شده نخواهند بود." @@ -32,13 +53,27 @@ "افزودن شکلک" "آغاز %1$s است." "این، آغاز گفت‌وگوست." + "تماس پشتیبانی نشده. بپرسید که آیا تماس گیرنده می‌تواند از برنامه جدید Element X استفاده کند یا خیر." "نمایش کم‌تر" "پیام رونوشت شد" "اجازهٔ فرستادن به این اتاق را ندارید" + + "عضو %1$d با %2$s واکنش نشان داد" + "اعضای %1$d با %2$s واکنش نشان دادند" + + + "شما و عضو %1$d با %2$s واکنش نشان دادید" + "شما و اعضای %1$d با %2$s واکنش نشان دادید" + + "شما با %1$s واکنش نشان دادید" "نمایش کم‌تر" "نمایش بیش‌تر" "نمایش خلاصهٔ واکنش‌ها" "جدید" + + "پیام حذف شده %1$d" + "پیام‌های حذف شده %1$d" + "%1$dتغییر اتاق" "%1$dتغییر اتاق" diff --git a/features/messages/impl/src/main/res/values-fi/translations.xml b/features/messages/impl/src/main/res/values-fi/translations.xml index 3705047087..308ae57f2b 100644 --- a/features/messages/impl/src/main/res/values-fi/translations.xml +++ b/features/messages/impl/src/main/res/values-fi/translations.xml @@ -70,6 +70,10 @@ "Näytä lisää" "Näytä reaktioiden yhteenveto" "Uusi" + + "%1$d poistettu viesti" + "%1$d poistettua viestiä" + "%1$d muutos huoneeseen" "%1$d muutosta huoneeseen" diff --git a/features/messages/impl/src/main/res/values-fr/translations.xml b/features/messages/impl/src/main/res/values-fr/translations.xml index 0062421326..6d10d9a493 100644 --- a/features/messages/impl/src/main/res/values-fr/translations.xml +++ b/features/messages/impl/src/main/res/values-fr/translations.xml @@ -70,6 +70,10 @@ "Afficher plus" "Afficher le résumé des réactions" "Nouveau" + + "%1$d message supprimé" + "%1$d messages supprimés" + "%1$d changement dans le salon" "%1$d changements dans le salon" diff --git a/features/poll/api/src/main/res/values-ar/translations.xml b/features/poll/api/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..e55d1c8710 --- /dev/null +++ b/features/poll/api/src/main/res/values-ar/translations.xml @@ -0,0 +1,13 @@ + + + + "%1$d بالمئة من إجمالي الأصوات" + "%1$d بالمئة من إجمالي الأصوات" + "%1$d بالمئة من إجمالي الأصوات" + "%1$d بالمئة من إجمالي الأصوات" + "%1$d بالمئة من إجمالي الأصوات" + "%1$d بالمئة من إجمالي الأصوات" + + "ٍسيتم حذف الإختيار السابق" + "هذه هي الإجابة الفائزة" + diff --git a/features/poll/api/src/main/res/values-es/translations.xml b/features/poll/api/src/main/res/values-es/translations.xml index 10e1193163..b69a550320 100644 --- a/features/poll/api/src/main/res/values-es/translations.xml +++ b/features/poll/api/src/main/res/values-es/translations.xml @@ -1,4 +1,9 @@ + + "%1$d por ciento de todos los votos" + "%1$d por ciento de todos los votos" + + "Eliminará la selección anterior" "Esta es la respuesta ganadora" diff --git a/features/poll/api/src/main/res/values-fa/translations.xml b/features/poll/api/src/main/res/values-fa/translations.xml index af9620c7e8..1885c72e1b 100644 --- a/features/poll/api/src/main/res/values-fa/translations.xml +++ b/features/poll/api/src/main/res/values-fa/translations.xml @@ -1,5 +1,9 @@ + + "درصد %1$d از کل آرا" + "درصد %1$d از کل آرا" + "گزینش پیشین را برخواهد داشت" "این پاسخ برنده است" diff --git a/features/poll/impl/src/main/res/values-ar/translations.xml b/features/poll/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..02c12f72d8 --- /dev/null +++ b/features/poll/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,20 @@ + + + "إضافة خيار" + "أظهر النتائج فقط حين انتهاء الاستفتاء" + "إخفاء الأصوات" + "الخيار %1$d" + "لم تُحفظ تغييراتك. هل أنت متأكد من أنك تريد الرجوع؟" + "حذف الخيار %1$s" + "السؤال أو الموضوع" + "عن ماذا يدور هذا الاستفتاء؟" + "إنشاء استفتاء" + "هل أنت متأكد من رغبتك في حذف هذا الاستطلاع؟" + "حذف الاستطلاع" + "تعديل الاستفتاء" + "تعذّر العثور على أي استطلاعات جارية." + "تعذّر العثور على أي استطلاعات مغلقة." + "جارية" + "مغلقة" + "الاستطلاعات" + diff --git a/features/poll/impl/src/main/res/values-fa/translations.xml b/features/poll/impl/src/main/res/values-fa/translations.xml index eeedc6c7a0..fd6469a389 100644 --- a/features/poll/impl/src/main/res/values-fa/translations.xml +++ b/features/poll/impl/src/main/res/values-fa/translations.xml @@ -5,6 +5,7 @@ "نهفتن رأی‌ها" "گزینهٔ %1$d" "تغییراتتان ذخیره نشده‌اند. مطمئنید که می‌خواهید برگردید؟" + "حذف گزینه %1$s" "پرسش یا موضوع" "این نظرسنجی دربارهٔ چیست؟" "ایجاد نظرسنجی" diff --git a/features/preferences/impl/src/main/res/values-ar/translations.xml b/features/preferences/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..92f4539cd3 --- /dev/null +++ b/features/preferences/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,115 @@ + + + "للتأكد من عدم تفويت أي مكالمة مهمة، يُرجى تغيير إعداداتك للسماح بإشعارات ملء الشاشة عندما يكون هاتفك مقفلاً." + "حسّن تجربة مكالماتك" + "اختر طريقة استقبال الإشعارات" + "وضع المطوّر" + "فعّله للوصول إلى الميزات والوظائف الخاصة بالمطورين." + "عنوان URL الأساسي المخصص لـ Element Call" + "عيّن عنوان URL أساسيًا مخصصًا لـ Element Call." + "عنوان URL غير صالح، يُرجى التأكد من تضمين البروتوكول (http/https) والعنوان الصحيح." + "إخفاء الصور الرمزية في طلبات الدعوة إلى الغرف" + "إخفاء معاينات الوسائط في المخطط الزمني" + "المختبرات" + "المسافة التي يجب أن تتحركها ليتم إرسال تحديث." + "تأكد من تفعيل \"الموقع الدقيق\" لهذا التطبيق. لتغيير الإذن، انتقل إلى %1$s." + "إعدادات التطبيق" + "تحديثات الموقع المباشر" + + "كل %1$d أمتار" + "كل %1$d متر" + "كل %1$d مترين" + "كل %1$d أمتار" + "كل %1$d مترًا" + "كل %1$d متر" + + "رفع الصور ومقاطع الفيديو بسرعة أكبر وتقليل استخدام البيانات" + "تحسين جودة الوسائط" + "الإشراف والسلامة" + "تحسين الصور تلقائيًا لرفعها بسرعة أكبر وتقليل أحجام الملفات." + "تحسين جودة رفع الصور" + "%1$s. اضغط هنا للتغيير." + "عالية (1080p)" + "منخفضة (480p)" + "قياسية (720p)" + "جودة رفع الفيديو" + "موفّر الإشعارات الفورية" + "عطّل محرر النص المنسق لكتابة Markdown يدويًا." + "إيصالات القراءة" + "إذا كان هذا الخيار متوقفًا، فلن تُرسل إيصالات القراءة الخاصة بك إلى أي شخص. ستظل تتلقى إيصالات القراءة من المستخدمين الآخرين." + "مشاركة حالة التواجد" + "إذا كان هذا الخيار متوقفًا، فلن تتمكن من إرسال أو تلقي إيصالات القراءة أو إشعارات الكتابة." + "إخفاء دائمًا" + "إظهار دائمًا" + "في الغرف الخاصة" + "يمكن دائمًا إظهار الوسائط المخفية بالضغط عليها" + "إظهار الوسائط في المخطط الزمني" + "فعّل خيار عرض مصدر الرسالة في الخط الزمني." + "ليس لديك أي مستخدمين محظورين" + "إلغاء الحظر" + "ستتمكن من رؤية كل رسائلهم مجدّداً." + "إلغاء حظر المستخدم" + "جارٍ إلغاء الحظر…" + "الاسم" + "اسمك" + "حدث خطأ غير معروف وتعذّر تغيير المعلومات." + "غير قادر على تحديث الملف الشخصي" + "تعديل الملف الشخصي" + "يتم تحديث الملف الشخصي…" + "تفعيل الردود في السلاسل" + "سيُعاد تشغيل التطبيق لتطبيق هذا التغيير." + "جرّب أحدث أفكارنا قيد التطوير. هذه الميزات ليست نهائية؛ قد تكون غير مستقرة وقد تتغير." + "هل ترغب في التجربة؟" + "المختبرات" + "إعدادات إضافية" + "نغمة رنين المكالمات" + "المكالمات الصوتية والفيديو" + "عدم تطابق الإعدادات" + "لقد بسّطنا إعدادات الإشعارات لتكون الخيارات أسهل للإيجاد. بعض الإعدادات المخصصة التي كنت قد طبّقتها في السابق ليست ظاهرة هنا، ولكنها ما تزال مفعّلة. + +إذا ما تقدّمت، فبعض إعداداتك قد تتغير." + "المحادثات الخاصة" + "إعدادات خاصة لكل محادثة" + "حدث خطأ أثناء تحديث إعدادات الإشعارات." + "كل الرسائل" + "الإشارات والكلمات الرئيسية فقط" + "في المحادثات الخاصة، أرسل لي إشعارات لـ" + "في المحادثات الجماعية، أرسل لي إشعارات لـ" + "تفعيل الإشعارات على هذا الجهاز" + "تعذّر تصحيح الإعدادات، يُرجى المحاولة مرة أخرى." + "المحادثات الجماعية" + "الدعوات" + "لا يدعم خادمك المنزلي هذا الخيار في الغرف المشفّرة، وقد لا تتلقى إشعارات في بعض الغرف." + "الإشارات" + "اختيار صوت آخر…" + "يُستخدم حاليًا %1$s" + "صوت الرسائل" + "صوت الرسائل" + "الكل" + "الإشارات" + "أرسل لي إشعارات لـ" + "أرسل لي إشعاراً عندما يُكتب @room" + "مخصص" + "صوت مخصص…" + "خطأ في حذف الملف" + "افتراضي Element" + "Element Fade" + "خطأ في استيراد الملف" + "مشكلة في معاينة صوت التنبيه" + "الصوت" + "إغلاق خطأ صوت التنبيه" + "مشكلة في تعيين صوت التنبيه" + "صامت" + "افتراضي النظام" + "لتلقي الإشعارات يرجى تغيير الـ %1$s خاصتك" + "إعدادات النظام" + "إشعارات النظام مُطفأة" + "الإشعارات" + "أسود" + "داكن" + "فاتح" + "النظام" + "سجل الإشعارات الفورية" + "استكشاف الأخطاء وإصلاحها" + "استكشاف أخطاء الإشعارات وإصلاحها" + diff --git a/features/preferences/impl/src/main/res/values-es/translations.xml b/features/preferences/impl/src/main/res/values-es/translations.xml index dd496a1273..60ff403b41 100644 --- a/features/preferences/impl/src/main/res/values-es/translations.xml +++ b/features/preferences/impl/src/main/res/values-es/translations.xml @@ -10,9 +10,25 @@ "URL no válida, asegúrate de incluir el protocolo (http/https) y la dirección correcta." "Ocultar avatares en las invitaciones a salas" "Ocultar vistas previas de multimedia en la cronología" + "Experimental" + "La distancia que debes recorrer para que se active una actualización." + "Asegúrate de que la «Ubicación precisa» está activada para esta aplicación. Para cambiar el permiso, ve a %1$s." + "Ajustes de la aplicación" + "Actualizaciones de ubicación en tiempo real" + + "Cada %1$d metros" + "Cada %1$d metros" + "Sube fotos y vídeos más rápido y reduce el uso de datos" - "Optimizar la calidad de los medios" + "Optimizar la calidad multimedia" "Moderación y seguridad" + "Optimizar automáticamente las imágenes para subidas más rápidas y tamaños de archivo más pequeños." + "Optimizar la calidad de subida de imágenes" + "%1$s. Toca aquí para cambiar." + "Alta (1080p)" + "Baja (480p)" + "Estándar (720p)" + "Calidad de subida de vídeos" "Proveedor de notificaciones push" "Desactiva el editor de texto enriquecido para escribir Markdown manualmente." "Confirmaciones de lectura" @@ -36,7 +52,13 @@ "No se puede actualizar el perfil" "Editar perfil" "Actualizando perfil…" + "Activar respuestas en hilo" + "La aplicación se reiniciará para aplicar este cambio." + "Prueba nuestras últimas ideas en desarrollo. Estas funciones aún no están terminadas; pueden ser inestables y están sujetas a cambios." + "¿Ganas de experimentar?" + "Experimental" "Ajustes adicionales" + "Tono de llamada" "Llamadas de audio y vídeo" "La configuración no coincide" "Hemos simplificado la Configuración de Notificaciones para hacer las opciones más fáciles de encontrar. Algunas configuraciones personalizadas que has elegido en el pasado no se muestran aquí, pero siguen activas. @@ -55,14 +77,39 @@ Si continúas, es posible que algunos de tus ajustes cambien." "Invitaciones" "Tu servidor base no admite esta opción en salas cifradas, puede que no recibas notificaciones de algunas salas." "Menciones" + "Elegir otro sonido…" + "Usando actualmente %1$s" + "Sonido de mensaje" + "Sonido de mensaje" "Todos" "Menciones" "Notificarme para" "Notificarme con @room" + "Personalizado" + "Sonido personalizado…" + "Error al eliminar el archivo" + "Predeterminado de Element" + "Desvanecimiento de Element" + "Error al importar el archivo" + "Problema al previsualizar el sonido de alerta" + "Sonido" + "Ignorar el error del sonido de alerta" + "Problema al establecer el sonido de alerta" + "Silencioso" + "Predeterminado del sistema" "Para recibir notificaciones, cambia tus %1$s." "ajustes del sistema" "Notificaciones del sistema desactivadas" "Notificaciones" + "Ausente" + "Vuelvo enseguida" + "Personalizado…" + "Estado personalizado…" + "Hora de concentrarse" + "En una reunión" + "En la carretera" + "¿Cuál es tu estado?" + "Negro" "Oscuro" "Claro" "Sistema" diff --git a/features/preferences/impl/src/main/res/values-fa/translations.xml b/features/preferences/impl/src/main/res/values-fa/translations.xml index df42ca953c..167bf022ca 100644 --- a/features/preferences/impl/src/main/res/values-fa/translations.xml +++ b/features/preferences/impl/src/main/res/values-fa/translations.xml @@ -1,5 +1,6 @@ + "برای اطمینان از اینکه هرگز تماس مهمی را از دست نمی‌دهید، لطفاً تنظیمات خود را تغییر دهید تا وقتی تلفنتان قفل است، اعلان‌ها به صورت تمام صفحه نمایش داده شوند." "بهبود تجریهٔ تماستان" "گزینش چگونگی دریافت آگاهی" "حالت توسعه‌دهنده" @@ -10,8 +11,20 @@ "نهفتن چهرک‌ها در درخواست‌های دعوت اتاق" "نهفتن رسانه در خط زمانی" "آزمایشگاه‌ها" + "مسافتی که باید طی کنید تا به‌روزرسانی انجام شود." + "مطمئن شوید که «موقعیت مکانی دقیق» برای این برنامه فعال شده است. برای تغییر مجوز به %1$s بروید." + "تنظیمات برنامه" + "به‌روزرسانی‌های مکان زنده" + + "هر کنتور %1$d" + "هر کنتور %1$d" + + "عکس‌ها و ویدیوها را سریع‌تر آپلود کنید و مصرف اینترنت را کاهش دهید" "بهینه سازی کیفیت رسانه" "نظارت و امنیت" + "بهینه‌سازی خودکار تصاویر برای آپلود سریع‌تر و حجم کمتر فایل‌ها." + "بهینه سازی کیفیت آپلود تصاویر" + "%1$s. برای تغییر، اینجا را لمس کنید." "زیاد (۱۰۸۰ت)" "کم (۴۸۰ت)" "استاندارد (۷۲۰ت)" @@ -39,8 +52,13 @@ "ناتوان در به‌روز کردن نمایه" "ویرایش نمایه" "به‌روز کردن نمایه…" + "فعال کردن پاسخ‌های تاپیک" + "برنامه برای اعمال این تغییر مجدداً راه‌اندازی خواهد شد." + "آخرین ایده‌های در حال توسعه ما را امتحان کنید. این ویژگی‌ها هنوز نهایی نشده‌اند؛ ممکن است ناپایدار باشند، ممکن است تغییر کنند." + "احساس تجربی دارید؟" "آزمایشگاه‌ها" "تنظیمات اضافی" + "آهنگ زنگ تماس" "تماس‌های صوتی و تصویری" "نامتطابقت در پیکربندی" "تنظمیات آگاهی را ساده کرده‌ایم تا یافتن انتخاب‌ها را ساده‌تر کنیم. برهی تنظمیات سفارسی که در گذشته گزیده‌اید این‌جا نشان داده نمی‌شوند؛ ولی همچنن فعّالند. @@ -59,14 +77,39 @@ "دعوت‌ها" "کارساز خانگیتان از این گزینه در اتاق‌های رمز شده پشتیبانی نمی‌کند. ممکن است در برخی اتاق‌ها آگاه نشوید." "اشاره‌ها" + "صدای دیگری انتخاب کنید…" + "در حال حاضر از %1$s استفاده می‌شود." + "صدای پیام" + "صدای پیام" "همه" "اشاره‌ها" "آگاه کردنم برای" "آگاه کردنم برای ‪@room" + "سفارشی" + "صدای سفارشی…" + "خطا در حذف فایل" + "Element پیش‌فرض" + "Element فید" + "خطا در وارد کردن فایل" + "مشکل در پیش‌نمایش صدای هشدار" + "صدا" + "خطای صدای هشدار را رد کنید" + "مشکل در تنظیم صدای هشدار" + "بی‌صدا" + "پیش‌فرض سیستم" "برای گرفتن آگاهی‌ها لطفاً%1$sتان را تغییر دهید." "تنظیمات سامانه" "آگاهی‌های سامانه‌ای خاموش شدند" "آگاهی‌ها" + "بعدا" + "همین الان برگرد" + "سفارشی…" + "وضعیت سفارشی…" + "زمان تمرکز" + "در یک جلسه" + "در جاده" + "وضعیتت چطوره؟" + "سیاه" "تیره" "روشن" "سامانه" diff --git a/features/preferences/impl/src/main/res/values-fi/translations.xml b/features/preferences/impl/src/main/res/values-fi/translations.xml index f37673427f..c50989e526 100644 --- a/features/preferences/impl/src/main/res/values-fi/translations.xml +++ b/features/preferences/impl/src/main/res/values-fi/translations.xml @@ -68,7 +68,7 @@ Jos jatkat, jotkin asetukset saattavat muuttua." "Keskustelukohtaiset asetukset" "Ilmoitusasetusten muokkaamisessa tapahtui virhe." "Kaikista viesteistä" - "Vain maininnoista ja avainsanoista" + "Vain maininnoista ja vastauksista" "Yksityiskeskusteluissa, ilmoita minulle" "Ryhmäkeskusteluissa, ilmoita minulle" "Ota ilmoitukset käyttöön tällä laitteella" @@ -101,6 +101,14 @@ Jos jatkat, jotkin asetukset saattavat muuttua." "järjestelmäsi asetuksia" "Järjestelmän ilmoitukset on poissa päältä" "Ilmoitukset" + "Poissa" + "Palaan pian" + "Mukautettu…" + "Mukautettu tila…" + "Keskittymisaika" + "Kokouksessa" + "Tien päällä" + "Mikä on tilasi?" "Musta" "Tumma" "Vaalea" diff --git a/features/preferences/impl/src/main/res/values-fr/translations.xml b/features/preferences/impl/src/main/res/values-fr/translations.xml index fc57491f4a..06fe3be814 100644 --- a/features/preferences/impl/src/main/res/values-fr/translations.xml +++ b/features/preferences/impl/src/main/res/values-fr/translations.xml @@ -101,6 +101,14 @@ Si vous continuez, il est possible que certains de vos paramètres soient modifi "paramètres du système" "Les notifications du système sont désactivées" "Notifications" + "Absent" + "Je reviens tout de suite" + "Personnalisé…" + "Statut personnalisé…" + "Concentré" + "En réunion" + "Sur la route" + "Quel est votre statut ?" "Noir" "Sombre" "Clair" diff --git a/features/rageshake/api/src/main/res/values-ar/translations.xml b/features/rageshake/api/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..13f99159db --- /dev/null +++ b/features/rageshake/api/src/main/res/values-ar/translations.xml @@ -0,0 +1,7 @@ + + + "%1$s أُغلِق قسرياً في آخر مرة استخدمه. أتودّ مشاركة بلاغ إغلاق قسري معنا؟" + "يظهر أنك تهز الهاتز بسرعة. أتودّ فتح شاشة الإبلاغ عن عطل؟" + "رج الهاتف للإبلاغ عن خطأ" + "عتبة الكشف" + diff --git a/features/rageshake/impl/src/main/res/values-ar/translations.xml b/features/rageshake/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..5fd8157467 --- /dev/null +++ b/features/rageshake/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,22 @@ + + + "إرفاق لقطة شاشة" + "لا مانع من التواصل معي إذا كان عندكم أي أسئلة إضافية." + "تواصل معي" + "تعديل لقطة الشاشة" + "صِف مشكلتك رجاءً. ما الذي قمت به؟ ما كنت تتوقع أن يحصل؟ وما الذي حصل فعلياً. زوّدنا بأكبر قدر من المعلومات رجاءً." + "صِف المشكلة…" + "إن كان ممكناً فاكتب الوصف بالإنجليزية." + "الوصف قصير جدًا، يُرجى تقديم مزيد من التفاصيل حول ما حدث. شكرًا!" + "يمكنك إدخال رقم مشكلة مرتبطة على GitHub، إن وجدت." + "مشكلة على GitHub" + "أرسل الـcrash logs" + "السماح بالـLogs" + "سجلاتك كبيرة جدًا، لذلك لا يمكن تضمينها في هذا البلاغ. يرجى إرسالها إلينا بطريقة أخرى." + "إرسال لقطة شاشة" + "سيتمّ تضمين السجلّات (logs) مع رسالتك لنتأكد من أن كل شيء يشتغل كما يجب. لكي ترسل الرسالة بلا سجلّات فأطفئ هذا الخيار." + "%1$s أُغلِق قسرياً في آخر مرة استخدمه. أتودّ مشاركة بلاغ إغلاق قسري معنا؟" + "إذا كنت تواجه مشكلات في الإشعارات، يمكن أن يساعد رفع قواعد الإشعارات الفورية في تحديد السبب الجذري. لاحظ أن هذه القواعد قد تحتوي على معلومات خاصة، مثل اسم العرض الخاص بك أو الكلمات المفتاحية التي تريد تلقي إشعارات عنها." + "إرسال إعدادات الإشعارات" + "عرض السجلات" + diff --git a/features/rageshake/impl/src/main/res/values-es/translations.xml b/features/rageshake/impl/src/main/res/values-es/translations.xml index 5c21e4a9bd..5841d8b29b 100644 --- a/features/rageshake/impl/src/main/res/values-es/translations.xml +++ b/features/rageshake/impl/src/main/res/values-es/translations.xml @@ -8,11 +8,15 @@ "Describe el problema…" "Si es posible, escribe la descripción en inglés." "La descripción es demasiado corta. Proporciona más detalles sobre lo sucedido. ¡Gracias!" + "Puedes introducir el número de una incidencia de GitHub asociada, si la hubiere." + "Incidencia de GitHub" "Enviar registros de fallos" "Permitir registros" "Tus registros de errores son demasiado grandes y no pueden añadirse a este informe, por favor envíanoslos de otra manera." "Enviar captura de pantalla" "Los registros se incluirán con tu mensaje para asegurarse de que todo funciona correctamente. Para enviar tu mensaje sin registros, desactiva esta opción." "%1$s se cerró inesperadamente la última vez que se lo usaste. ¿Quieres compartir un informe de error con nosotros?" + "Si tienes problemas con las notificaciones, enviar las reglas de notificaciones push puede ayudarnos a identificar la causa raíz. Ten en cuenta que estas reglas pueden contener información privada, como tu nombre público o las palabras clave para las que quieres recibir notificaciones." + "Enviar ajustes de notificación" "Ver los registros" diff --git a/features/rageshake/impl/src/main/res/values-fa/translations.xml b/features/rageshake/impl/src/main/res/values-fa/translations.xml index 2e27f97ba6..85d07c41cd 100644 --- a/features/rageshake/impl/src/main/res/values-fa/translations.xml +++ b/features/rageshake/impl/src/main/res/values-fa/translations.xml @@ -8,10 +8,15 @@ "شرح مشکل…" "ترجیحاً توضیحات را به زبان انگلیسی بنویسید." "توضیحات خیلی کوتاه است، لطفاً جزئیات بیشتری در مورد آنچه اتفاق افتاده ارائه دهید. متشکرم!" + "در صورت وجود، می‌توانید شماره مشکل مرتبط با GitHub را وارد کنید." + "مسئله GitHub" "ارسال رخدادنگارهای خطا" "اجازه به گزارش‌ها" + "گزارش‌های شما بیش از حد بزرگ هستند، بنابراین نمی‌توان آنها را در این گزارش گنجاند، لطفاً آنها را از طریق دیگری برای ما ارسال کنید." "ارسال تصویر صفحه" "برای اطمینان از درست کار کردن همه‌چیز گزارش‌ها در پیامتان قرار خواهد گرفت. برای فرستادن پیام بدون گزارش‌ها این تنظیم را خاموش کنید." "%1$sآخرین باری که استفاده شد، از کار افتاد. آیا مایلید گزارش خرابی را با ما به اشتراک بگذارید؟" + "اگر با اعلان‌ها مشکل دارید، آپلود قوانین ارسال اعلان می‌تواند به ما در شناسایی علت اصلی کمک کند. توجه داشته باشید که این قوانین می‌توانند حاوی اطلاعات خصوصی مانند نام نمایشی یا کلمات کلیدی شما باشند که باید برای آنها اعلان دریافت کنید." + "تنظیمات ارسال اعلان" "دیدن گزارش‌ها" diff --git a/features/reportroom/impl/src/main/res/values-ar/translations.xml b/features/reportroom/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..1068833e9b --- /dev/null +++ b/features/reportroom/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,8 @@ + + + "تم إرسال بلاغك بنجاح، لكننا واجهنا مشكلة أثناء محاولة مغادرة الغرفة. يرجى المحاولة مرة أخرى." + "تعذّرت مغادرة الغرفة" + "أبلغ مسؤولك عن هذه الغرفة. إذا كانت الرسائل مشفّرة، فلن يتمكن مسؤولك من قراءتها." + "صِف سبب الإبلاغ…" + "الإبلاغ عن الغرفة" + diff --git a/features/reportroom/impl/src/main/res/values-fa/translations.xml b/features/reportroom/impl/src/main/res/values-fa/translations.xml index 9930e9ceac..a75095ff90 100644 --- a/features/reportroom/impl/src/main/res/values-fa/translations.xml +++ b/features/reportroom/impl/src/main/res/values-fa/translations.xml @@ -1,6 +1,8 @@ + "گزارش شما با موفقیت ارسال شد، اما هنگام تلاش برای خروج از اتاق با مشکلی مواجه شدیم. لطفاً دوباره امتحان کنید." "ناتوان از ترک اتاق" + "این اتاق را به مدیر خود گزارش دهید. اگر پیام‌ها رمزگذاری شده باشند، مدیر شما قادر به خواندن آنها نخواهد بود." "شرح دلیل گزارش…" "گزارش اتاق" diff --git a/features/rolesandpermissions/impl/src/main/res/values-ar/translations.xml b/features/rolesandpermissions/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..75633a1273 --- /dev/null +++ b/features/rolesandpermissions/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,98 @@ + + + "مسؤول" + "حظر الأشخاص" + "تغيير الإعدادات" + "إزالة الرسائل" + "عضو" + "دعوة الأشخاص" + "مشاركة الموقع المباشر" + "إدارة المساحة" + "إدارة الغرف" + "إدارة الأعضاء" + "الرسائل والمحتوى" + "مشرف" + "إزالة الأشخاص" + "تغيير الصورة الرمزية" + "تعديل التفاصيل" + "تغيير الاسم" + "تغيير الموضوع" + "إرسال الرسائل" + "الصلاحيات" + "تعديل المسؤولين" + "لن تتمكن من التراجع عن هذا الإجراء. ستتم ترقية المستخدم ليحصل على مستوى الصلاحيات نفسه الذي لديك." + "إضافة مسؤول؟" + "لن تتمكن من التراجع عن هذا الإجراء. ستنقل الملكية إلى المستخدمين المحددين. بمجرد مغادرتك، سيصبح ذلك دائمًا." + "نقل الملكية؟" + "خفض الرتبة" + "لن تتمكن من التراجع عن هذا التغيير لأنك تخفض رتبتك. إذا كنت آخر مستخدم لديه صلاحيات في الغرفة، فسيكون من المستحيل استعادة الصلاحيات." + "خفض رتبتك؟" + "%1$s (قيد الانتظار)" + "(قيد الانتظار)" + "يتمتع المسؤولون تلقائيًا بصلاحيات المشرفين" + "يتمتع المالكون بامتيازات المسؤولين تلقائيًا." + "تعديل المشرفين" + "اختيار المالكين" + "المسؤولون" + "المشرفون" + "الأعضاء" + "لديك تغييرات غير محفوظة." + "حفظ التغييرات؟" + "لا يوجد مستخدمون محظورون." + + "%1$d محظورين" + "%1$d محظور" + "%1$d محظوران" + "%1$d محظورين" + "%1$d محظورًا" + "%1$d محظور" + + "تحقّق من الإملاء أو جرّب بحثًا جديدًا" + "لا توجد نتائج لـ “%1$s”" + + "%1$d شخص" + "%1$d شخص" + "%1$d شخصين" + "%1$d اشخاص" + "%1$d شخص" + "%1$d شخص" + + "حظر المستخدم" + "إزالة العضو فقط" + "إلغاء الحظر" + "يمكن لهذا المستخدم الانضمام إلى هذه الغرفة مرة أخرى عند دعوته." + "إلغاء حظر المستخدم" + "المحظورون" + "الأعضاء" + + "%1$d مدعوّين" + "%1$d مدعو" + "%1$d مدعوّان" + "%1$d مدعوّين" + "%1$d مدعوًا" + "%1$d مدعو" + + "قيد الانتظار" + "مسؤول" + "مشرف" + "مالك" + "أعضاء الغرفة" + "جارٍ رفع حظر %1$s" + "المسؤولون" + "المسؤولون والمالكون" + "تغيير دوري" + "خفض رتبتي إلى عضو" + "خفض رتبتي إلى مشرف" + "الإشراف على الأعضاء" + "الرسائل والمحتوى" + "المشرفون" + "المالكون" + "الصلاحيات" + "إعادة تعيين الصلاحيات" + "بمجرد إعادة تعيين الصلاحيات، ستفقد الإعدادات الحالية." + "إعادة تعيين الصلاحيات؟" + "الأدوار" + "تفاصيل الغرفة" + "تفاصيل المساحة" + "الأدوار والصلاحيات" + diff --git a/features/rolesandpermissions/impl/src/main/res/values-es/translations.xml b/features/rolesandpermissions/impl/src/main/res/values-es/translations.xml index a41489ea1b..defb25b9be 100644 --- a/features/rolesandpermissions/impl/src/main/res/values-es/translations.xml +++ b/features/rolesandpermissions/impl/src/main/res/values-es/translations.xml @@ -2,9 +2,13 @@ "Administrador" "Vetar personas" + "Cambiar ajustes" "Eliminar mensajes" "Miembro" "Invitar a otras personas" + "Compartir ubicación en tiempo real" + "Gestionar el espacio" + "Gestionar salas" "Administrar miembros" "Mensajes y contenido" "Moderador" @@ -14,25 +18,36 @@ "Cambiar el nombre de la sala" "Cambiar el tema de la sala" "Enviar mensajes" + "Permisos" "Editar administradores" "No podrás deshacer esta acción. Estás promocionando al usuario para que tenga el mismo nivel de poder que tú." - "¿Agregar Admin?" + "¿Agregar administrador?" + "Esta acción es irreversible. Estás transfiriendo la propiedad a los usuarios seleccionados. Una vez que salgas, será permanente." + "¿Transferir la propiedad?" "Degradar" "No podrás deshacer este cambio ya que te estás degradando. Si eres el último usuario privilegiado en la sala será imposible recuperar los privilegios." "¿Degradarte?" "%1$s (Pendiente)" "(Pendiente)" "Los administradores tienen privilegios de moderador de forma automática" + "Los propietarios tienen automáticamente privilegios de administrador." "Editar moderadores" + "Elegir propietarios" "Administradores" "Moderadores" "Miembros" "Tienes cambios sin guardar." "¿Guardar cambios?" - "No hay usuarios baneados." + "No hay usuarios vetados." + + "%1$d vetado" + "%1$d vetados" + + "Revisa la ortografía o intenta una nueva búsqueda." + "Ningún resultado para «%1$s»" - "%1$d Persona" - "%1$d Personas" + "%1$d persona" + "%1$d personas" "Sacar y vetar a un miembro" "Solo eliminar miembro" @@ -41,21 +56,31 @@ "Eliminar veto en la sala" "Vetados" "Miembros" + + "%1$d invitado" + "%1$d invitados" + + "Pendiente" "Administrador" "Moderador" + "Propietario" "Miembros de la sala" "Levantando veto a %1$s" "Administradores" + "Administradores y propietarios" "Cambiar mi rol" "Degradar a miembro" "Degradar a moderador" "Moderación de miembros" "Mensajes y contenido" "Moderadores" + "Propietarios" + "Permisos" "Restablecer permisos" "Una vez que restablezca los permisos, perderá la configuración actual." "¿Restablecer los permisos?" "Roles" "Detalles de la sala" + "Detalles del espacio" "Roles y permisos" diff --git a/features/rolesandpermissions/impl/src/main/res/values-fa/translations.xml b/features/rolesandpermissions/impl/src/main/res/values-fa/translations.xml index e381cec856..345a451678 100644 --- a/features/rolesandpermissions/impl/src/main/res/values-fa/translations.xml +++ b/features/rolesandpermissions/impl/src/main/res/values-fa/translations.xml @@ -2,9 +2,13 @@ "ادمین" "تحریم افراد" + "تغییر تنظیمات" "حذف پیام‌ها" "عضو" "دعوت کاربران" + "اشتراک گذاری موقعیت مکانی زنده" + "مدیریت فضا" + "مدیریت اتاق‌ها" "مدیریت اعضا" "پیام‌ها و محتوا" "ناظم" @@ -14,9 +18,11 @@ "تغییر نام اتاق" "دگرگونی موضوع اتاق" "فرستادن پیام‌ها" + "دسترسی‌ها" "ویرایش مدیران" "قادر نخواهید بود این کنش را بازکردانید. داردید کاربر را به سطح قدرت خودتان ارتقا می‌دهید." "افزودن مدیر؟" + "شما قادر به لغو این اقدام نخواهید بود. شما در حال انتقال مالکیت به کاربران انتخاب شده هستید. پس از خروج، این انتقال دائمی خواهد بود." "انتقال مالکیت؟" "تنزل بده" "شما نمی‌توانید این تغییر را بازگردانید زیرا در حال تنزل نقش خود در اتاق هستید، اگر آخرین کاربر ممتاز در اتاق باشید، امکان دستیابی مجدد به دسترسی‌های سطح بالای اتاق غیرممکن است." @@ -33,6 +39,12 @@ "تغییراتی ذخیره نشده دارید." "ذخیرهٔ تغییرات؟" "هیچ کاربری محروم نشده." + + "%1$d محروم شد" + "%1$d محروم شد" + + "املای کلمات را بررسی کنید یا جستجوی جدیدی را امتحان کنید" + "هیچ نتیجه‌ای برای «%1$s» یافت نشد." "%1$d نفر" "%1$d نفر" @@ -44,6 +56,11 @@ "تحریم نکردن از اتاق" "محروم" "اعضا" + + "%1$d دعوت شده" + "%1$d دعوت شده" + + "در حال بررسی" "ادمین" "ناظم" "مالک" @@ -58,10 +75,12 @@ "پیام‌ها و محتوا" "ناظم‌ها" "مالکان" + "دسترسی‌ها" "بازنشانی اجازه‌ها" "پس از بازنشانی اجازه‌ها تنظیمات فعلی را از دست خواهید داد." "بازنشانی اجازه‌ها؟" "نقش‌ها" "جزییات اتاق" + "جزئیات فضا" "نقش‌ها و مجوزها" diff --git a/features/roomaliasresolver/impl/src/main/res/values-ar/translations.xml b/features/roomaliasresolver/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..6500dcebf6 --- /dev/null +++ b/features/roomaliasresolver/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,5 @@ + + + "تعذّر عرض معاينة هذه الغرفة" + "تعذّر حل الاسم المستعار للغرفة." + diff --git a/features/roomaliasresolver/impl/src/main/res/values-fa/translations.xml b/features/roomaliasresolver/impl/src/main/res/values-fa/translations.xml index 4fba81c4f8..f9fdf67b21 100644 --- a/features/roomaliasresolver/impl/src/main/res/values-fa/translations.xml +++ b/features/roomaliasresolver/impl/src/main/res/values-fa/translations.xml @@ -1,4 +1,5 @@ + "ما نتوانستیم پیش‌نمایش این اتاق را نمایش دهیم" "شکست در دریافت نام مستعار اتاق." diff --git a/features/roomdetails/impl/src/main/res/values-ar/translations.xml b/features/roomdetails/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..3d640a615a --- /dev/null +++ b/features/roomdetails/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,188 @@ + + + "لا يرى الأعضاء الجدد السجل" + "يرى الأعضاء الجدد السجل" + "يمكن لأي شخص رؤية السجل" + "تحتاج إلى عنوان حتى تظهر الغرفة في الدليل العام." + "تعديل العنوان" + "حدث خطأ أثناء تحديث إعدادات الإشعارات." + "لا يدعم خادمك المنزلي هذا الخيار في الغرف المشفّرة، وقد لا تتلقى إشعارات في بعض الغرف." + "الاستطلاعات" + "مسؤول" + "حظر الأشخاص" + "إزالة الرسائل" + "عضو" + "دعوة الأشخاص" + "إدارة الأعضاء" + "الرسائل والمحتوى" + "مشرف" + "إزالة الأشخاص" + "تغيير الصورة الرمزية" + "تعديل التفاصيل" + "تغيير الاسم" + "تغيير الموضوع" + "إرسال الرسائل" + "تعديل المسؤولين" + "لن تتمكن من التراجع عن هذا الإجراء. ستتم ترقية المستخدم ليحصل على مستوى الصلاحيات نفسه الذي لديك." + "إضافة مسؤول؟" + "لن تتمكن من التراجع عن هذا الإجراء. ستنقل الملكية إلى المستخدمين المحددين. بمجرد مغادرتك، سيصبح ذلك دائمًا." + "نقل الملكية؟" + "خفض الرتبة" + "لن تتمكن من التراجع عن هذا التغيير لأنك تخفض رتبتك. إذا كنت آخر مستخدم لديه صلاحيات في الغرفة، فسيكون من المستحيل استعادة الصلاحيات." + "خفض رتبتك؟" + "%1$s (قيد الانتظار)" + "(قيد الانتظار)" + "يتمتع المسؤولون تلقائيًا بصلاحيات المشرفين" + "يتمتع المالكون بامتيازات المسؤولين تلقائيًا." + "تعديل المشرفين" + "اختيار المالكين" + "المسؤولون" + "المشرفون" + "الأعضاء" + "لديك تغييرات غير محفوظة." + "حفظ التغييرات؟" + "إضافة موضوع" + "مشفّرة" + "غير مشفّرة" + "غرفة عامة" + "تعديل التفاصيل" + "قد كان هناك خطأ والمعلومات لم تتحدث." + "غير قادر على تعديل الغرفة" + "الرسائل مؤمَّنة بأقفال. أنت والمستقبلون فقط من تملكون المفاتيح الخاصة لفتح أقفالها." + "تشفير الرسائل مفعّل" + "حصل خطأ أثناء تحميل إعدادات الإشعارات." + "تعذّر كتم هذه الغرفة، يرجى المحاولة مجدداً." + "تعذّر إلغاء كتم هذه الغرفة، يرجى المحاولة مجدداً." + "لا تغلق التطبيق حتى الانتهاء." + "جارٍ تحضير الدعوات…" + "دعوة أشخاص" + "دعوة " + "مغادرة المحادثة" + "مغادرة الغرفة" + "الوسائط والملفات" + "مخصص" + "افتراضي" + "الإشعارات" + "الرسائل المثبّتة" + "الملف الشخصي" + "طلبات الانضمام" + "الأدوار والصلاحيات" + "الاسم" + "الأمان والخصوصية" + "الأمان" + "مشاركة الغرفة" + "معلومات الغرفة" + "الموضوع" + "يتم تحديث الغرفة…" + "لا يوجد مستخدمون محظورون." + + "%1$d محظورين" + "%1$d محظور" + "%1$d محظوران" + "%1$d محظورين" + "%1$d محظورًا" + "%1$d محظور" + + "تحقّق من الإملاء أو جرّب بحثًا جديدًا" + "لا توجد نتائج لـ “%1$s”" + + "%1$d شخص" + "%1$d شخص" + "%1$d شخصين" + "%1$d اشخاص" + "%1$d شخص" + "%1$d شخص" + + "حظر المستخدم" + "إزالة العضو فقط" + "إلغاء الحظر" + "يمكن لهذا المستخدم الانضمام إلى هذه الغرفة مرة أخرى عند دعوته." + "إلغاء حظر المستخدم" + "المحظورون" + "الأعضاء" + + "%1$d مدعوّين" + "%1$d مدعو" + "%1$d مدعوّان" + "%1$d مدعوّين" + "%1$d مدعوًا" + "%1$d مدعو" + + "قيد الانتظار" + "مسؤول" + "مشرف" + "مالك" + "أعضاء الغرفة" + "جارٍ رفع حظر %1$s" + "السماح بإعدادات مخصصة" + "سيؤدي تشغيل هذا إلى استبدال إعداداتك الافتراضية" + "أرسل لي إشعارات هذه المحادثة لـ" + "يمكنك تغيير ذلك في الـ %1$s الخاص بك." + "الإعدادات العامة" + "الإعدادات الافتراضية" + "إزالة الإعدادات الخاصة" + "حصل خطأ أثناء تحميل إعدادات الإشعارات." + "تعّذرت استعادة الوضع الافتراضي، يرجى المحاولة مجدداً." + "تعذّر تطبيق الوضع، يرجى المحاولة مجدداً." + "لا يدعم خادمك المنزلي هذا الخيار في الغرف المشفّرة، ولن تتلقى إشعارات في هذه الغرفة." + "كل الرسائل" + "في هذه الغرفة، أرسل لي إشعارات لـ" + "المسؤولون" + "المسؤولون والمالكون" + "تغيير دوري" + "خفض رتبتي إلى عضو" + "خفض رتبتي إلى مشرف" + "الإشراف على الأعضاء" + "الرسائل والمحتوى" + "المشرفون" + "المالكون" + "الصلاحيات" + "إعادة تعيين الصلاحيات" + "بمجرد إعادة تعيين الصلاحيات، ستفقد الإعدادات الحالية." + "إعادة تعيين الصلاحيات؟" + "الأدوار" + "تفاصيل الغرفة" + "الأدوار والصلاحيات" + "وضع علامة كمقروء" + "وضع علامة كغير مقروء" + "إضافة عنوان" + "يمكن لأي شخص في المساحات المصرّح بها الانضمام، لكن يجب على الآخرين طلب الوصول." + "يجب على الجميع طلب الوصول." + "طلب الانضمام" + "يمكن لأي شخص في %1$s الانضمام، لكن يجب على الآخرين طلب الوصول." + "نعم، فعّل التشفير" + "بعد تفعيله، لا يمكن تعطيل التشفير في الغرفة. لن يكون سجل الرسائل مرئيًا لأعضاء الغرفة إلا منذ وقت دعوتهم أو منذ انضمامهم إلى الغرفة. +لن يتمكن أي شخص غير أعضاء الغرفة من قراءة الرسائل. قد يمنع ذلك البوتات والجسور من العمل بشكل صحيح. +لا نوصي بتفعيل التشفير للغرف التي يمكن لأي شخص العثور عليها والانضمام إليها." + "تفعيل التشفير؟" + "بعد تفعيله، لا يمكن تعطيل التشفير." + "التشفير" + "تفعيل التشفير من طرف إلى طرف" + "يمكن لأي شخص الانضمام." + "أي شخص" + "اختر المساحات التي يمكن لأعضائها الانضمام إلى هذه الغرفة دون دعوة. %1$s" + "إدارة المساحات" + "يمكن للأشخاص المدعوين فقط الانضمام." + "بالدعوة فقط" + "الوصول" + "يمكن لأي شخص في المساحات المصرّح بها الانضمام." + "يمكن لأي شخص في %1$s الانضمام." + "أعضاء المساحة" + "المساحات غير مدعومة حاليًا" + "تحتاج إلى عنوان حتى تظهر الغرفة في الدليل العام." + "العنوان" + "السماح بالعثور على هذه الغرفة عند البحث في دليل الغرف العام على %1$s" + "السماح بالعثور عليها عند البحث في الدليل العام." + "مرئية في الدليل العام" + "أي شخص (السجل عام)" + "لن تؤثر التغييرات على الرسائل السابقة، بل على الرسائل الجديدة فقط. %1$s" + "من يمكنه قراءة السجل" + "الأعضاء منذ دعوتهم" + "الأعضاء (السجل الكامل)" + "عناوين الغرف وسيلة للعثور على الغرف والوصول إليها. كما يضمن ذلك إمكانية مشاركة غرفتك بسهولة مع الآخرين. +يمكنك اختيار نشر غرفتك في دليل الغرف العام على خادمك المنزلي." + "نشر الغرفة" + "العناوين وسيلة للعثور على الغرف والمساحات والوصول إليها. كما يضمن ذلك إمكانية مشاركتها بسهولة مع الآخرين." + "الظهور" + "الأمان والخصوصية" + diff --git a/features/roomdetails/impl/src/main/res/values-be/translations.xml b/features/roomdetails/impl/src/main/res/values-be/translations.xml index 2b0b59e359..130912651c 100644 --- a/features/roomdetails/impl/src/main/res/values-be/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-be/translations.xml @@ -88,7 +88,6 @@ "Не ўдалося наладзіць рэжым, паспрабуйце яшчэ раз." "Ваш хатні сервер не падтрымлівае гэту опцыю ў зашыфраваных пакоях, вы не атрымаеце апавяшчэнне ў гэтым пакоі." "Усе паведамленні" - "Толькі згадванні і ключавыя словы" "У гэтым пакоі паведаміце мяне пра" "Адміністратары" "Змяніць маю роль" diff --git a/features/roomdetails/impl/src/main/res/values-bg/translations.xml b/features/roomdetails/impl/src/main/res/values-bg/translations.xml index 7369d78f1d..a7594bc411 100644 --- a/features/roomdetails/impl/src/main/res/values-bg/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-bg/translations.xml @@ -68,7 +68,6 @@ "Неуспешно възстановяване на режима по подразбиране, моля, опитайте отново." "Неуспешно задаване на режима, моля, опитайте отново." "Всички съобщения" - "Само споменавания и ключови думи" "В тази стая, да бъда известяван за" "Администратори" "Промяна на моята роля" diff --git a/features/roomdetails/impl/src/main/res/values-ca/translations.xml b/features/roomdetails/impl/src/main/res/values-ca/translations.xml index 8b9f8d937e..b1a022a17d 100644 --- a/features/roomdetails/impl/src/main/res/values-ca/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-ca/translations.xml @@ -91,8 +91,6 @@ "No s\'ha pogut restaurar el mode predeterminat. Torna-ho a provar." "No s\'ha pogut configurar el mode. Torna-ho a provar." "El servidor no admet aquesta opció en sales xifrades, no rebras notificacions en aquesta sala." - "Tots els missatges" - "Mencions y paraules clau (només)" "En aquesta sala, notifica\'m en" "Administradors" "Canvia el meu rol" diff --git a/features/roomdetails/impl/src/main/res/values-cy/translations.xml b/features/roomdetails/impl/src/main/res/values-cy/translations.xml index f5d4eecac5..68c53ec260 100644 --- a/features/roomdetails/impl/src/main/res/values-cy/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-cy/translations.xml @@ -103,7 +103,7 @@ "Wedi methu gosod y modd, ceisiwch eto." "Nid yw eich gweinydd cartref yn cefnogi\'r dewis hwn mewn ystafelloedd sydd wedi\'u hamgryptio, chewch chi ddim eich hysbysu yn yr ystafell hon." "Pob neges" - "Crybwylliadau ac Allweddeiriau\'n unig" + "Dim ond Crybwylliadau ac Allweddeiriau" "Yn yr ystafell hon, rhowch wybod i mi am" "Gweinyddwyr" "Gweinyddwyr a pherchnogion" diff --git a/features/roomdetails/impl/src/main/res/values-da/translations.xml b/features/roomdetails/impl/src/main/res/values-da/translations.xml index 191df9f059..e727221b74 100644 --- a/features/roomdetails/impl/src/main/res/values-da/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-da/translations.xml @@ -113,8 +113,6 @@ "Gendannelse af standardtilstanden mislykkedes. Prøv igen." "Kunne ikke indstille tilstanden. Prøv igen." "Din hjemmeserver understøtter ikke denne indstilling i krypterede rum, du får ikke besked i dette rum." - "Alle beskeder" - "Kun omtaler og nøgleord" "Giv mig besked i dette rum for" "Administratorer" "Administratorer og ejere" diff --git a/features/roomdetails/impl/src/main/res/values-el/translations.xml b/features/roomdetails/impl/src/main/res/values-el/translations.xml index 5f1a3ce4ab..6350d5de24 100644 --- a/features/roomdetails/impl/src/main/res/values-el/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-el/translations.xml @@ -114,7 +114,6 @@ "Αποτυχία ρύθμισης της λειτουργίας, δοκίμασε ξανά." "Ο αρχικός διακομιστής σας δεν υποστηρίζει αυτή την επιλογή σε κρυπτογραφημένες αίθουσες, δεν θα λάβετε ειδοποιήσεις σε αυτή την αίθουσα." "Όλα τα μηνύματα" - "Μόνο αναφορές και λέξεις-κλειδιά" "Σε αυτήν την αίθουσα, ειδοποιήστε με για" "Διαχειριστές" "Διαχειριστές και κάτοχοι" diff --git a/features/roomdetails/impl/src/main/res/values-es/translations.xml b/features/roomdetails/impl/src/main/res/values-es/translations.xml index 9537596d4e..8b9b5365c8 100644 --- a/features/roomdetails/impl/src/main/res/values-es/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-es/translations.xml @@ -1,5 +1,8 @@ + "Los miembros nuevos no ven el historial" + "Los miembros nuevos ven el historial" + "Cualquiera puede ver el historial" "Necesitarás una dirección de sala para que sea visible en el directorio." "Editar dirección" "Se ha producido un error al actualizar la configuración de notificaciones." @@ -21,14 +24,18 @@ "Enviar mensajes" "Editar administradores" "No podrás deshacer esta acción. Estás promocionando al usuario para que tenga el mismo nivel de poder que tú." - "¿Agregar Admin?" + "¿Agregar administrador?" + "Esta acción es irreversible. Estás transfiriendo la propiedad a los usuarios seleccionados. Una vez que salgas, será permanente." + "¿Transferir la propiedad?" "Degradar" "No podrás deshacer este cambio ya que te estás degradando. Si eres el último usuario privilegiado en la sala será imposible recuperar los privilegios." "¿Degradarte?" "%1$s (Pendiente)" "(Pendiente)" "Los administradores tienen privilegios de moderador de forma automática" + "Los propietarios tienen automáticamente privilegios de administrador." "Editar moderadores" + "Elegir propietarios" "Administradores" "Moderadores" "Miembros" @@ -46,11 +53,13 @@ "Se ha producido un error al cargar la configuración de las notificaciones." "No se ha podido silenciar esta sala, inténtalo de nuevo." "Error al dejar de silenciar esta sala, por favor inténtalo de nuevo." + "No cierres la aplicación hasta que se haya finalizado." + "Preparando invitaciones…" "Invitar personas" "Invitar" "Salir de la conversación" "Salir de la sala" - "Medios y archivos" + "Multimedia y archivos" "Personalizado" "Por defecto" "Notificaciones" @@ -58,16 +67,23 @@ "Perfil" "Solicitudes de unión" "Roles y permisos" + "Nombre" "Seguridad y privacidad" "Seguridad" "Compartir sala" "Información de la sala" "Tema" "Actualizando la sala…" - "No hay usuarios baneados." + "No hay usuarios vetados." + + "%1$d vetado" + "%1$d vetados" + + "Revisa la ortografía o intenta una nueva búsqueda." + "Ningún resultado para «%1$s»" - "%1$d Persona" - "%1$d Personas" + "%1$d persona" + "%1$d personas" "Sacar y vetar a un miembro" "Solo eliminar miembro" @@ -76,8 +92,14 @@ "Eliminar veto en la sala" "Vetados" "Miembros" + + "%1$d invitado" + "%1$d invitados" + + "Pendiente" "Administrador" "Moderador" + "Propietario" "Miembros de la sala" "Levantando veto a %1$s" "Permitir configuración personalizada" @@ -92,15 +114,17 @@ "No se pudo cambiar el modo, por favor inténtalo de nuevo." "Tu servidor base no admite esta opción en salas cifradas, no recibirás notificaciones de esta sala." "Todos los mensajes" - "Únicamente Menciones y Palabras clave" "En esta sala, notificarme por" "Administradores" + "Administradores y propietarios" "Cambiar mi rol" "Degradar a miembro" "Degradar a moderador" "Moderación de miembros" "Mensajes y contenido" "Moderadores" + "Propietarios" + "Permisos" "Restablecer permisos" "Una vez que restablezca los permisos, perderá la configuración actual." "¿Restablecer los permisos?" @@ -110,8 +134,10 @@ "Marcar como leído" "Marcar como no leído" "Agregar dirección" + "Cualquiera en espacios autorizados puede unirse, pero el resto debe solicitar acceso." "Todos deben solicitar acceso." "Solicitar unirse" + "Cualquiera en %1$s puede unirse, pero el resto debe solicitar acceso." "Sí, activar cifrado" "Una vez activado, el cifrado de una sala no se puede desactivar. El historial de mensajes solo será visible para los miembros de la sala desde que fueron invitados o desde que se unieron a la sala. Nadie más que los miembros de la sala podrán leer los mensajes. Esto puede impedir que los bots y los puentes funcionen correctamente. @@ -122,21 +148,29 @@ No recomendamos habilitar el cifrado para las salas que cualquiera pueda encontr "Activar el cifrado de extremo a extremo" "Cualquiera puede unirse" "Cualquiera" + "Elige qué miembros de los espacios pueden unirse a esta sala sin una invitación. %1$s" + "Gestionar espacios" "Solo las personas invitadas pueden unirse." "Solo por invitación" "Acceso" + "Cualquiera en espacios autorizados puede unirse." + "Cualquiera en %1$s puede unirse." + "Miembros del espacio" "No se admiten los espacios por el momento." "Necesitarás una dirección de sala para que sea visible en el directorio." "Dirección" "Permite encontrar esta sala buscando en el directorio de salas públicas de %1$s" + "Permitir que sea encontrada al buscar en el directorio público." "Visible en el directorio público" "Cualquiera (el historial es público)" + "Los cambios no afectarán a los mensajes anteriores, solo a los nuevos. %1$s" "Quién puede leer el historial" - "Solo participantes desde que fueron invitados" - "Miembros (historia completa)" + "Miembros desde su invitación" + "Miembros (historial completo)" "Las direcciones de sala son formas de buscar salas y acceder a ellas. Esto también garantiza que puedas compartir fácilmente tu sala con otras personas. Puedes optar por publicar tu sala en el directorio de salas públicas de tu servidor base." "Publicación de la sala" + "Las direcciones son una forma de encontrar y acceder a salas y espacios. También garantizan que puedas compartirlos fácilmente con otras personas." "Visibilidad" "Seguridad y privacidad" diff --git a/features/roomdetails/impl/src/main/res/values-et/translations.xml b/features/roomdetails/impl/src/main/res/values-et/translations.xml index e6962456ac..329ac267bf 100644 --- a/features/roomdetails/impl/src/main/res/values-et/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-et/translations.xml @@ -113,8 +113,7 @@ "Vaikimisi seadistuste taastamine ei õnnestunud. Palun proovi uuesti." "Seadistuste muutmine ei õnnestunud. Palun proovi uuesti." "Sinu koduserver ei toeta seda võimalust krüptitud jututubades, seega sa ei saa selle jututoa kohta teavitusi." - "Kõikide sõnumite korral" - "Mainimiste ja võtmesõnade alusel" + "Kõik sõnumid" "Selles jututoas teavita mind" "Peakasutajad" "Peakasutajad ja omanikud" diff --git a/features/roomdetails/impl/src/main/res/values-eu/translations.xml b/features/roomdetails/impl/src/main/res/values-eu/translations.xml index 64f32e44d9..e00aff7d4c 100644 --- a/features/roomdetails/impl/src/main/res/values-eu/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-eu/translations.xml @@ -83,7 +83,6 @@ "Errorea gertatu da jakinarazpen-ezarpenak kargatzean." "Zure zerbitzaria ez da bateragarria enkriptatutako gelen aukerarekin; litekeena da gela batzuetako jakinarazpenak ez jasotzea." "Mezu guztiak" - "Aipamenak eta hitz gakoak soilik" "Gela honetan, jakinarazi" "Administratzaileak" "Administratzaileak eta jabeak" diff --git a/features/roomdetails/impl/src/main/res/values-fa/translations.xml b/features/roomdetails/impl/src/main/res/values-fa/translations.xml index 7cdfe409dd..1ea8bc2e69 100644 --- a/features/roomdetails/impl/src/main/res/values-fa/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-fa/translations.xml @@ -1,6 +1,10 @@ - "نشانی اتاق" + "اعضای جدید تاریخچه را نمی‌بینند" + "اعضای جدید تاریخچه را می‌بینند" + "هر کسی می‌تواند تاریخچه را ببیند" + "برای اینکه بتوانید آن را در فهرست عمومی مشاهده کنید، به یک آدرس نیاز دارید." + "ویرایش آدرس" "هنگام به‌روز کردن تنظیمات آگاهی خطایی رخ داد." "کارساز خانگیتان از این گزینه در اتاق‌های رمز شده پشتیبانی نمی‌کند. ممکن است در برخی اتاق‌ها آگاه نشوید." "نظرسنجی‌ها" @@ -21,6 +25,7 @@ "ویرایش مدیران" "قادر نخواهید بود این کنش را بازکردانید. داردید کاربر را به سطح قدرت خودتان ارتقا می‌دهید." "افزودن مدیر؟" + "شما قادر به لغو این اقدام نخواهید بود. شما در حال انتقال مالکیت به کاربران انتخاب شده هستید. پس از خروج، این انتقال دائمی خواهد بود." "انتقال مالکیت؟" "تنزل بده" "شما نمی‌توانید این تغییر را بازگردانید زیرا در حال تنزل نقش خود در اتاق هستید، اگر آخرین کاربر ممتاز در اتاق باشید، امکان دستیابی مجدد به دسترسی‌های سطح بالای اتاق غیرممکن است." @@ -62,6 +67,7 @@ "نمایه" "درخواست‌های پیوستن" "نقش‌ها و مجوزها" + "نام" "امنیت و محرمانگی" "امنیت" "هم‌رسانی اتاق" @@ -69,6 +75,12 @@ "موضوع" "به‌روز کردن اتاق…" "هیچ کاربری محروم نشده." + + "%1$d محروم شد" + "%1$d محروم شد" + + "املای کلمات را بررسی کنید یا جستجوی جدیدی را امتحان کنید" + "هیچ نتیجه‌ای برای «%1$s» یافت نشد." "%1$d نفر" "%1$d نفر" @@ -80,6 +92,11 @@ "تحریم نکردن از اتاق" "محروم" "اعضا" + + "%1$d دعوت شده" + "%1$d دعوت شده" + + "در حال بررسی" "ادمین" "ناظم" "مالک" @@ -108,6 +125,7 @@ "پیام‌ها و محتوا" "ناظم‌ها" "مالکان" + "دسترسی‌ها" "بازنشانی اجازه‌ها" "پس از بازنشانی اجازه‌ها تنظیمات فعلی را از دست خواهید داد." "بازنشانی اجازه‌ها؟" @@ -116,21 +134,44 @@ "نقش‌ها و مجوزها" "علامت‌گذاری به عنوان خوانده شده" "نشان به ناخوانده" - "افزودن نشانی اتاق" + "اضافه کردن آدرس" + "هر کسی که در فضاهای مجاز باشد می‌تواند عضو شود، اما بقیه باید درخواست دسترسی بدهند." + "همه باید درخواست دسترسی بدهند." "درخواست دعوت" + "هر کسی در %1$s می‌تواند عضو شود، اما بقیه باید درخواست دسترسی بدهند." "بله. به کار انداختن رمزنگاری" + "پس از فعال کردن، رمزگذاری برای یک اتاق قابل غیرفعال کردن نیست، تاریخچه پیام فقط برای اعضای اتاق از زمان دعوت یا از زمان پیوستن به اتاق قابل مشاهده خواهد بود. +هیچ کس غیر از اعضای اتاق قادر به خواندن پیام‌ها نخواهد بود. این ممکن است مانع از عملکرد صحیح ربات‌ها و پل‌ها شود. +ما فعال کردن رمزگذاری را برای اتاق‌هایی که هر کسی می‌تواند آنها را پیدا کند و به آنها بپیوندد، توصیه نمی‌کنیم." "رمزگذاری فعال شود؟" "پس از به کار افتادن، رمزنگاری قابل از کار انداختن نیست." "رمزنگاری" - "هرکسی می‌تواند یافته و بپیوندد" - "هرکسی" - "افراد فقط در صورت دعوت می‌توانند بپیوندند" - "فقط دعوتی" - "دسترسی اتاق" + "فعال کردن رمزنگاری سراسری" + "هر کسی می‌تواند عضو شود." + "هر کس" + "انتخاب کنید که اعضای کدام فضاها می‌توانند بدون دعوتنامه به این اتاق بپیوندند. %1$s" + "مدیریت فضاها" + "فقط افراد دعوت شده می‌توانند عضو شوند." + "فقط دعوت" + "دسترسی" + "هر کسی که در فضاهای مجاز باشد می‌تواند عضو شود." + "هر کسی که در %1$s باشد می‌تواند عضو شود." + "اعضای فضا" "در حال حاضر فضاها پشتیبانی نمی‌شوند" - "نشانی اتاق" + "برای اینکه بتوانید آن را در فهرست عمومی مشاهده کنید، به یک آدرس نیاز دارید." + "آدرس" + "با جستجو در فهرست اتاق‌های عمومی %1$s، امکان یافتن این اتاق را فراهم کنید." + "با جستجو در فهرست عمومی، می‌توان آن را پیدا کرد." + "قابل مشاهده در فهرست عمومی" "هرکسی" + "تغییرات روی پیام‌های قبلی تأثیری نخواهند داشت، فقط روی پیام‌های جدید اعمال می‌شوند. %1$s" + "چه کسی می‌تواند تاریخ بخواند؟" + "اعضا از زمان دعوت" + "اعضا (تاریخچه کامل)" + "آدرس‌های اتاق، راه‌هایی برای پیدا کردن و دسترسی به اتاق‌ها هستند. این همچنین تضمین می‌کند که می‌توانید به راحتی اتاق خود را با دیگران به اشتراک بگذارید. +شما می‌توانید اتاق خود را در دایرکتوری عمومی اتاق سرور خانگی خود منتشر کنید." "انتشار اتاق" - "نمایانی اتاق" + "آدرس‌ها راهی برای پیدا کردن و دسترسی به اتاق‌ها و فضاها هستند. این همچنین تضمین می‌کند که می‌توانید به راحتی آنها را با دیگران به اشتراک بگذارید." + "قابلیت مشاهده" "امنیت و محرمانگی" diff --git a/features/roomdetails/impl/src/main/res/values-fi/translations.xml b/features/roomdetails/impl/src/main/res/values-fi/translations.xml index 4eafca087e..b6586d8884 100644 --- a/features/roomdetails/impl/src/main/res/values-fi/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-fi/translations.xml @@ -115,6 +115,7 @@ "Kotipalvelimesi ei tue tätä vaihtoehtoa salatuissa huoneissa, joten et saa ilmoituksia tästä huoneesta." "Kaikista viesteistä" "Vain maininnoista ja avainsanoista" + "Mykistä" "Ilmoita minulle tässä huoneessa" "Ylläpitäjät" "Ylläpitäjät ja omistajat" diff --git a/features/roomdetails/impl/src/main/res/values-fr/translations.xml b/features/roomdetails/impl/src/main/res/values-fr/translations.xml index 0d6844cb7e..237767c82a 100644 --- a/features/roomdetails/impl/src/main/res/values-fr/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-fr/translations.xml @@ -114,8 +114,9 @@ "Échec de la configuration du mode, veuillez réessayer." "Votre serveur d’accueil ne supporte pas cette option pour les salons chiffrés, vous ne serez pas notifié(e) dans ce salon." "Tous les messages" - "Mentions et mots clés uniquement" - "Dans ce salon, prévenez-moi pour" + "Les messages avec mentions et mots clés uniquement" + "Aucun message" + "Pour ce salon, afficher une notification pour" "Administrateurs" "Administrateurs et propriétaires" "Changer mon rôle" diff --git a/features/roomdetails/impl/src/main/res/values-hr/translations.xml b/features/roomdetails/impl/src/main/res/values-hr/translations.xml index 5619164dd2..fffdc33e40 100644 --- a/features/roomdetails/impl/src/main/res/values-hr/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-hr/translations.xml @@ -116,8 +116,6 @@ "Vraćanje zadanog načina rada nije uspjelo, pokušajte ponovno." "Postavljanje načina rada nije uspjelo, pokušajte ponovno." "Vaš matični poslužitelj ne podržava ovu mogućnost u šifriranim sobama; nećete dobiti obavijest u ovoj sobi." - "Sve poruke" - "Samo spominjanja i ključne riječi" "U ovoj sobi obavijesti me za" "Administratori" "Administratori i vlasnici" diff --git a/features/roomdetails/impl/src/main/res/values-it/translations.xml b/features/roomdetails/impl/src/main/res/values-it/translations.xml index b8a18d4421..c876567303 100644 --- a/features/roomdetails/impl/src/main/res/values-it/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-it/translations.xml @@ -114,7 +114,6 @@ "Impossibile impostare la modalità, riprova." "Il tuo homeserver non supporta questa opzione nelle stanze cifrate, quindi non riceverai notifiche in questa stanza." "Tutti i messaggi" - "Solo menzioni e parole chiave" "In questa stanza, avvisami per" "Amministratori" "Amministratori e proprietari" diff --git a/features/roomdetails/impl/src/main/res/values-ja/translations.xml b/features/roomdetails/impl/src/main/res/values-ja/translations.xml index bf0ef7424c..830ebd5452 100644 --- a/features/roomdetails/impl/src/main/res/values-ja/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-ja/translations.xml @@ -110,8 +110,6 @@ "デフォルトの復元に失敗しました。再試行してください。" "設定に失敗しました。再試行してください。" "暗号化されたルームでは、この機能にホームサーバーが対応しないため、このルームからの通知を受信できません。" - "すべてのメッセージ" - "メンションとキーワードのみ" "このルームでは以下の通知を受け取る" "管理者" "管理者と所有者" diff --git a/features/roomdetails/impl/src/main/res/values-ka/translations.xml b/features/roomdetails/impl/src/main/res/values-ka/translations.xml index 8fd0b2c8a6..6bc01b34b9 100644 --- a/features/roomdetails/impl/src/main/res/values-ka/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-ka/translations.xml @@ -79,7 +79,6 @@ "რეჟიმის დაყენება ვერ მოხერხდა, გთხოვთ, სცადოთ ხელახლა." "თქვენი სახლის სერვერი არ უჭერს მხარს ამ პარამეტრს დაშიფრულ ოთახებში, თქვენ არ მიიღებთ შეტყობინებას ამ ოთახში." "ყველა შეტყობინება" - "მხოლოდ ხსენებები და საკვანძო სიტყვები" "ამ ოთახში, შემატყობინეთ:" "ადმინისტრატორები" "ჩემი როლის შეცვლა" diff --git a/features/roomdetails/impl/src/main/res/values-ko/translations.xml b/features/roomdetails/impl/src/main/res/values-ko/translations.xml index 4a32cab45d..3d0a106e25 100644 --- a/features/roomdetails/impl/src/main/res/values-ko/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-ko/translations.xml @@ -111,7 +111,6 @@ "모드 설정이 실패했습니다. 다시 시도해 주세요." "귀하의 홈 서버는 암호화된 방에서 이 옵션을 지원하지 않으므로, 이 방에서 알림을 받지 못합니다." "모든 메시지" - "언급 및 키워드만" "이 방에서, 알림을 주세요" "관리자" "관리자 및 소유자" diff --git a/features/roomdetails/impl/src/main/res/values-nb/translations.xml b/features/roomdetails/impl/src/main/res/values-nb/translations.xml index 0cb3dfc268..8507587f95 100644 --- a/features/roomdetails/impl/src/main/res/values-nb/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-nb/translations.xml @@ -114,7 +114,6 @@ "Innstilling av modus mislyktes, prøv igjen." "Hjemmeserveren din støtter ikke dette alternativet i krypterte rom, og du vil ikke bli varslet i dette rommet." "Alle meldinger" - "Bare omtaler og nøkkelord" "I dette rommet, varsle meg om" "Administratorer" "Administratorer og eiere" diff --git a/features/roomdetails/impl/src/main/res/values-nl/translations.xml b/features/roomdetails/impl/src/main/res/values-nl/translations.xml index 2ee5caca97..a25a674edc 100644 --- a/features/roomdetails/impl/src/main/res/values-nl/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-nl/translations.xml @@ -85,7 +85,6 @@ "Het instellen van de meldingen is mislukt. Probeer het opnieuw." "Je homeserver ondersteunt deze optie niet in versleutelde kamers; in deze kamer krijg je geen meldingen." "Alle berichten" - "Alleen vermeldingen en trefwoorden" "In deze kamer, stuur me een melding voor" "Beheerders" "Mijn rol wijzigen" diff --git a/features/roomdetails/impl/src/main/res/values-pl/translations.xml b/features/roomdetails/impl/src/main/res/values-pl/translations.xml index b79d3014e5..14225bcdf9 100644 --- a/features/roomdetails/impl/src/main/res/values-pl/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-pl/translations.xml @@ -118,6 +118,7 @@ "Twój serwer domowy nie wspiera tej opcji w pokojach szyfrowanych, możesz nie otrzymać powiadomień z tego pokoju." "Wszystkie wiadomości" "Tylko wzmianki i słowa kluczowe" + "Wycisz" "W tym pokoju, powiadamiaj mnie przez" "Administratorzy" "Administratorzy i właściciele" diff --git a/features/roomdetails/impl/src/main/res/values-pt-rBR/translations.xml b/features/roomdetails/impl/src/main/res/values-pt-rBR/translations.xml index f2ddfb86cb..e741c43c90 100644 --- a/features/roomdetails/impl/src/main/res/values-pt-rBR/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-pt-rBR/translations.xml @@ -111,7 +111,6 @@ "Falha ao definir o modo, tente novamente." "Seu servidor-casa não suporta esta opção em salas criptografadas, você não será notificado nesta sala." "Todas as mensagens" - "Somente menções e palavras-chave" "Nesta sala, notifique-me de" "Administradores" "Administradores e proprietários" diff --git a/features/roomdetails/impl/src/main/res/values-pt/translations.xml b/features/roomdetails/impl/src/main/res/values-pt/translations.xml index 04ded84480..53eaebb934 100644 --- a/features/roomdetails/impl/src/main/res/values-pt/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-pt/translations.xml @@ -109,8 +109,7 @@ "Falha ao restaurar o modo predefinido, tenta novamente." "Falha ao definir o modo, tenta novamente." "O teu servidor não suporta esta opção em salas cifradas, pelo que não serás notificado nesta sala." - "Qualquer mensagem" - "Menções ou palavras-chave" + "Todas as mensagens" "Nesta sala, notifica-me se" "Administradores" "Administradores e donos" diff --git a/features/roomdetails/impl/src/main/res/values-ro/translations.xml b/features/roomdetails/impl/src/main/res/values-ro/translations.xml index f3feda811a..ced134da3d 100644 --- a/features/roomdetails/impl/src/main/res/values-ro/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-ro/translations.xml @@ -118,6 +118,7 @@ "Serverul dumneavoastră nu acceptă această opțiune în camerele criptate, nu veți primi notificări în această cameră." "Toate mesajele" "Numai mențiuni și cuvinte cheie" + "Mut" "În această cameră, anunțați-mă pentru" "Administratori" "Administratori și proprietari" diff --git a/features/roomdetails/impl/src/main/res/values-sv/translations.xml b/features/roomdetails/impl/src/main/res/values-sv/translations.xml index aa9f244498..764b18de76 100644 --- a/features/roomdetails/impl/src/main/res/values-sv/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-sv/translations.xml @@ -99,7 +99,6 @@ "Misslyckades att ställa in läget, vänligen pröva igen." "Din hemserver stöder inte det här alternativet i krypterade rum, du blir inte aviserad i det här rummet." "Alla meddelanden" - "Endast omnämnanden och nyckelord" "I det här rummet, meddela mig för" "Administratörer" "Administratörer och ägare" diff --git a/features/roomdetails/impl/src/main/res/values-tr/translations.xml b/features/roomdetails/impl/src/main/res/values-tr/translations.xml index a9bfc6fbe2..9f78649509 100644 --- a/features/roomdetails/impl/src/main/res/values-tr/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-tr/translations.xml @@ -97,7 +97,6 @@ "Ayarlanamadı, lütfen tekrar deneyin." "Ana sunucunuz şifreli odalarda bu seçeneği desteklemiyor, bu odada bildirim almayacaksınız." "Tüm mesajlar" - "Yalnızca Bahsetmeler ve Anahtar Kelimeler" "Bu odada, bana bildir" "Yöneticiler" "Rolümü değiştir" diff --git a/features/roomdetails/impl/src/main/res/values-uk/translations.xml b/features/roomdetails/impl/src/main/res/values-uk/translations.xml index 8f566bb235..edc1fab508 100644 --- a/features/roomdetails/impl/src/main/res/values-uk/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-uk/translations.xml @@ -117,7 +117,8 @@ "Не вдалося встановити режим, спробуйте ще раз." "Ваш домашній сервер не підтримує цю опцію в зашифрованих кімнатах, ви не отримаєте сповіщення в цій кімнаті." "Всі повідомлення" - "Тільки згадки та ключові слова" + "Лише згадки та ключові слова" + "Вимкнути звук" "У цій кімнаті сповіщати мене про" "Адміністратори" "Адміністратори та власники" diff --git a/features/roomdetails/impl/src/main/res/values-ur/translations.xml b/features/roomdetails/impl/src/main/res/values-ur/translations.xml index 5c32811f36..89387da0de 100644 --- a/features/roomdetails/impl/src/main/res/values-ur/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-ur/translations.xml @@ -83,8 +83,6 @@ "متعین وضع کو بحال کرنے میں ناکام، برائے مہربانی دوبارہ کوشش کریں۔" "وضع ترتیب دینے میں ناکام، برائے مہربانی دوبارہ کوشش کریں۔" "آپ کا منزلی خادم مرموز کردہ کمروں میں اس اختیار کی حمایت نہیں کرتا ہے، آپ کو اس کمرے میں مطلع کیا جائے گا۔" - "تمام پیغامات" - "صرف تذکرے اور کلیدی الفاظ" "اس کمرے میں، مجھے مطلع کریں برائے" "منتظمین" "میرا کردار تبدیل کریں" diff --git a/features/roomdetails/impl/src/main/res/values-uz/translations.xml b/features/roomdetails/impl/src/main/res/values-uz/translations.xml index d7778f2df4..10ffe9cf95 100644 --- a/features/roomdetails/impl/src/main/res/values-uz/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-uz/translations.xml @@ -114,7 +114,6 @@ "Rejimni o‘rnatib bo‘lmadi, qayta urinib ko‘ring." "Uy serveringiz shifrlangan xonalarda ushbu imkoniyatni qoʻllab-quvvatlamaydi, shuning uchun bu xonadan bildirishnomalar olmaysiz." "Barcha xabarlar" - "Faqat eslatmalar va kalit so\'zlar" "Bu xonada menga xabar bering" "Adminlar" "Adminlar va egalari" diff --git a/features/roomdetails/impl/src/main/res/values-vi/translations.xml b/features/roomdetails/impl/src/main/res/values-vi/translations.xml index ecc7e4e227..df42b37f77 100644 --- a/features/roomdetails/impl/src/main/res/values-vi/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-vi/translations.xml @@ -90,8 +90,6 @@ "Không thể khôi phục chế độ mặc định, vui lòng thử lại." "Không thể thiết lập chế độ, hãy thử lại nhé." "Máy chủ không hỗ trợ tùy chọn này trong phòng mã hóa, bạn sẽ không nhận thông báo ở đây." - "Tất cả tin nhắn." - "Chỉ đề cập và từ khóa" "Trong phòng này, thông báo cho tôi khi" "Quản trị viên" "Thay đổi vai trò của tôi" diff --git a/features/roomdetails/impl/src/main/res/values-zh/translations.xml b/features/roomdetails/impl/src/main/res/values-zh/translations.xml index 8a5c5734ed..a7592c38c7 100644 --- a/features/roomdetails/impl/src/main/res/values-zh/translations.xml +++ b/features/roomdetails/impl/src/main/res/values-zh/translations.xml @@ -111,7 +111,8 @@ "设置模式失败,请重试。" "主服务器不支持在加密房间中的此选项,因此在此房间你可能无法收到通知。" "所有消息" - "仅限提及和关键词" + "仅提及与关键词" + "静默" "在此房间通知我以下类型" "管理员" "管理员与所有者" diff --git a/features/roomdetails/impl/src/main/res/values/localazy.xml b/features/roomdetails/impl/src/main/res/values/localazy.xml index 31851c2603..8f86015147 100644 --- a/features/roomdetails/impl/src/main/res/values/localazy.xml +++ b/features/roomdetails/impl/src/main/res/values/localazy.xml @@ -114,7 +114,8 @@ "Failed setting the mode, please try again." "Your homeserver does not support this option in encrypted rooms, you won\'t get notified in this room." "All messages" - "Mentions and replies only" + "Mentions and Keywords only" + "Mute" "In this room, notify me for" "Admins" "Admins and owners" diff --git a/features/roomdetailsedit/impl/src/main/res/values-ar/translations.xml b/features/roomdetailsedit/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..5d58de994f --- /dev/null +++ b/features/roomdetailsedit/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,7 @@ + + + "تعديل التفاصيل" + "قد كان هناك خطأ والمعلومات لم تتحدث." + "غير قادر على تعديل الغرفة" + "يتم تحديث الغرفة…" + diff --git a/features/roomdirectory/impl/src/main/res/values-ar/translations.xml b/features/roomdirectory/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..ff40f27f27 --- /dev/null +++ b/features/roomdirectory/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,5 @@ + + + "فشل التحميل" + "دليل الغرف" + diff --git a/features/roommembermoderation/impl/src/main/res/values-ar/translations.xml b/features/roommembermoderation/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..3a425d4d7d --- /dev/null +++ b/features/roommembermoderation/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,22 @@ + + + "حظر المستخدم" + "حظر" + "لن يتمكن هذا العضو من الانضمام مرة أخرى حتى إذا تمت دعوته." + "هل أنت متأكد من أنك تريد حظر هذا العضو؟" + "لن يتمكن هذا المستخدم من الانضمام إلى هذه المساحة مرة أخرى إذا تمت دعوته، لكنه سيظل محتفظًا بعضويته في أي غرف أو مساحات فرعية." + "جارٍ حظر %1$s" + "إزالة" + "يمكن لهذا المستخدم الانضمام إلى هذه الغرفة مرة أخرى عند دعوته." + "هل أنت متأكد من رغبتك في إزالة هذا العضو؟" + "سيتمكن هذا المستخدم من الانضمام إلى هذه المساحة مرة أخرى إذا تمت دعوته، وسيظل محتفظًا بعضويته في أي غرف أو مساحات فرعية." + "عرض الملف الشخصي" + "إزالة المستخدم" + "إزالة العضو وحظره من الانضمام مستقبلًا؟" + "جارٍ إزالة %1$s…" + "إلغاء حظر المستخدم" + "إلغاء الحظر" + "سيتمكن هذا المستخدم من الانضمام مرة أخرى إذا تمت دعوته" + "هل أنت متأكد من رغبتك في إلغاء حظر هذا العضو؟" + "جارٍ رفع حظر %1$s" + diff --git a/features/roommembermoderation/impl/src/main/res/values-es/translations.xml b/features/roommembermoderation/impl/src/main/res/values-es/translations.xml index 7f83f7546e..7f4a1e96cf 100644 --- a/features/roommembermoderation/impl/src/main/res/values-es/translations.xml +++ b/features/roommembermoderation/impl/src/main/res/values-es/translations.xml @@ -4,10 +4,12 @@ "Vetar" "No podrán volver a unirse a esta sala si son invitados." "¿Estás seguro de que quieres vetar a este miembro?" + "No podrá volver a unirse a este espacio aunque le inviten, pero seguirá siendo miembro de cualquier sala o subespacio donde ya lo fuese." "Vetando a %1$s" "Echar" "Podrá volver a unirse a esta sala si se le invita." "¿Seguro que quieres echar a este miembro?" + "Podrá volver a unirse a este espacio si se le invita, y seguirá siendo miembro de cualquier sala o subespacio donde ya lo fuese." "Ver perfil" "Sacar de la sala" "¿Sacar al miembro y prohibirle unirse en el futuro?" diff --git a/features/roommembermoderation/impl/src/main/res/values-fa/translations.xml b/features/roommembermoderation/impl/src/main/res/values-fa/translations.xml index 6ddb482189..d647dd1915 100644 --- a/features/roommembermoderation/impl/src/main/res/values-fa/translations.xml +++ b/features/roommembermoderation/impl/src/main/res/values-fa/translations.xml @@ -4,15 +4,19 @@ "تحریم" "در صورت دعوت نمی‌تواند دوباره به اتاق بپیوندد." "مطمئنید می‌خواهید این عضو را تحریم کنید؟" + "در صورت دعوت، آنها دیگر نمی‌توانند به این فضا بپیوندند، اما همچنان عضویت خود در هر اتاق یا زیرفضا را حفظ خواهند کرد." "تحریم کردن %1$s" "برداشتن" "در صورت دعوت می‌تواند دوباره به اتاق بپیوندد." "مطمئنید می‌خواهید این عضو را بردارید؟" + "در صورت دعوت، آنها می‌توانند دوباره به این فضا بپیوندند و همچنان عضویت خود را در هر اتاق یا زیرفضا حفظ خواهند کرد." "دیدن نمایه" "حذف کاربر" "برداشتن عضو و تحریم پیوستن در آینده؟" "برداشتن %1$s…" "تحریم نکردن از اتاق" "رفع انسداد" + "در صورت دعوت، آنها می‌توانند دوباره بپیوندند" + "آیا مطمئن هستید که می‌خواهید این عضو را از حالت مسدود خارج کنید؟" "رفع تحریم %1$s" diff --git a/features/securebackup/impl/src/main/res/values-ar/translations.xml b/features/securebackup/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..7b3295f49a --- /dev/null +++ b/features/securebackup/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,95 @@ + + + "حذف تخزين المفاتيح" + "تفعيل النسخ الاحتياطي" + "سيتيح لك هذا الاطّلاع على سجل محادثاتك على أي أجهزة جديدة، وهو مطلوب للنسخ الاحتياطي للمحادثات والهوية الرقمية. %1$s." + "تخزين المفاتيح" + "يجب تشغيل تخزين المفاتيح لنسخ دردشاتك احتياطيًا." + "رفع المفاتيح من هذا الجهاز" + "السماح بتخزين المفاتيح" + "تغيير مفتاح الاسترداد" + "يتم نسخ دردشاتك احتياطيًا تلقائيًا بتشفير من طرف إلى طرف. لاستعادة هذه النسخة الاحتياطية والاحتفاظ بهويتك الرقمية إذا فقدت الوصول إلى جميع أجهزتك، ستحتاج إلى مفتاح الاسترداد." + "أدخل مفتاح الاسترداد" + "تخزين المفاتيح لديك غير متزامن حاليًا." + "الحصول على مفتاح الاسترداد" + "يتم نسخ محادثاتك احتياطيًا تلقائيًا باستخدام التشفير التام بين الطرفين. لاستعادة هذه النسخة الاحتياطية والاحتفاظ بهويتك الرقمية عند فقدان الوصول إلى جميع أجهزتك، ستحتاج إلى مفتاح الاسترداد." + "افتح %1$s على جهاز سطح مكتب" + "سجّل الدخول إلى حسابك مرة أخرى" + "عندما يُطلب منك التحقق من جهازك، اختر %1$s" + "“إعادة تعيين الكل”" + "اتّبع التعليمات لإنشاء مفتاح استرداد جديد" + "احفظ مفتاح الاسترداد الجديد في مدير كلمات مرور أو ملاحظة مشفّرة" + "إعادة تعيين تشفير حسابك باستخدام جهاز آخر" + "مفتاح الاسترداد الذي أدخلته غير مطابق" + "إنهاء الإعداد" + "أدخل مفتاح الاسترداد مرة أخرى." + "أكّد مفتاح الاسترداد" + + "الحد الأدنى %1$d أحرف. لا تستخدم كلمة مرور حسابك" + "الحد الأدنى %1$d حرف. لا تستخدم كلمة مرور حسابك" + "الحد الأدنى %1$d حرفان. لا تستخدم كلمة مرور حسابك" + "الحد الأدنى %1$d أحرف. لا تستخدم كلمة مرور حسابك" + "الحد الأدنى %1$d حرفًا. لا تستخدم كلمة مرور حسابك" + "الحد الأدنى %1$d حرف. لا تستخدم كلمة مرور حسابك" + + "القوة" + "قوة عبارة المرور: %1$s" + "متوسط" + "قوي" + "قوي جدًا" + "ضعيف جدًا" + "ضعيف" + "اختر مفتاح استرداد يمكنك تذكّره." + "أدخل مفتاح استرداد" + "جارٍ تحميل متطلبات مفتاح الاسترداد" + "لتغيير مفتاح الاسترداد، انتقل إلى الإعدادات > التشفير > النسخ الاحتياطي" + "يمكنك استخدام مفتاح الاسترداد لتأكيد الأجهزة الجديدة أو استعادة محادثاتك المشفّرة إذا فقدت الوصول إلى جميع أجهزتك." + "تم إعداد نسختك الاحتياطية بالكامل الآن" + "متابعة إعادة التعيين" + "سيتم الاحتفاظ بتفاصيل حسابك وجهات اتصالك وتفضيلاتك وقائمة الدردشات" + "ستفقد أي سجل رسائل مخزّن على الخادم فقط" + "ستحتاج إلى التحقق من جميع أجهزتك وجهات اتصالك الحالية مرة أخرى" + "لا تُعد تعيين هويتك الرقمية إلا إذا لم يكن لديك وصول إلى جهاز آخر تم التحقق منه ولا تملك مفتاح الاسترداد." + "لا يمكنك التأكيد؟ ستحتاج إلى إعادة تعيين هويتك الرقمية." + "حذف" + "ستفقد سجل محادثاتك المشفّر وستحتاج إلى إعادة ضبط هويتك الرقمية إذا أزلت جميع أجهزتك." + "هل أنت متأكد من رغبتك في حذف تخزين المفاتيح؟" + "سيؤدي حذف تخزين المفاتيح إلى إزالة هويتك الرقمية ومفاتيح الرسائل من الخادم وإيقاف ميزات الأمان التالية:" + "لن يتوفر لك سجل الرسائل المشفّرة على الأجهزة الجديدة" + "ستفقد الوصول إلى رسائلك المشفّرة إذا تم تسجيل خروجك من %1$s في كل مكان" + "هل أنت متأكد من رغبتك في إيقاف تخزين المفاتيح وحذفه؟" + "احصل على مفتاح استرداد جديد إذا فقدت مفتاحك الحالي. بعد تغيير مفتاح الاسترداد، لن يعمل مفتاحك القديم بعد ذلك." + "إنشاء مفتاح استرداد جديد" + "لا تشارك هذا مع أي شخص!" + "تم تغيير مفتاح الاسترداد" + "تغيير مفتاح الاسترداد؟" + "إنشاء مفتاح استرداد جديد" + "تأكد من ألا يتمكن أحد من رؤية هذه الشاشة!" + "يُرجى المحاولة مرة أخرى لتأكيد الوصول إلى تخزين المفاتيح." + "مفتاح الاسترداد غير صحيح" + "إذا كان لديك مفتاح أمان أو عبارة أمان، فسيعمل ذلك أيضًا." + "أدخل…" + "هل فقدت مفتاح الاسترداد؟" + "تم تأكيد مفتاح الاسترداد" + "أدخل مفتاح الاسترداد" + "تم نسخ مفتاح الاسترداد" + "جارٍ الإنشاء…" + "حفظ مفتاح الاسترداد" + "دوّن مفتاح الاسترداد هذا في مكان آمن، مثل مدير كلمات مرور أو ملاحظة مشفّرة أو خزنة مادية." + "اضغط لنسخ مفتاح الاسترداد" + "احفظ مفتاح الاسترداد الخاص بك في مكان آمن" + "لن تتمكن من الوصول إلى مفتاح الاسترداد الجديد بعد هذه الخطوة." + "هل حفظت مفتاح الاسترداد الخاص بك؟" + "تخزين المفاتيح لديك محمي بمفتاح استرداد. إذا احتجت إلى مفتاح استرداد جديد بعد الإعداد، يمكنك إعادة إنشائه بتحديد «تغيير مفتاح الاسترداد»." + "إنشاء مفتاح الاسترداد الخاص بك" + "لا تشارك هذا مع أي شخص!" + "تم إعداد الاسترداد بنجاح" + "الحصول على مفتاح الاسترداد" + "نعم، أعد التعيين الآن" + "لا يمكن التراجع عن هذه العملية." + "هل أنت متأكد من أنك تريد إعادة تعيين هويتك الرقمية؟" + "حدث خطأ غير معروف. يُرجى التحقق من صحة كلمة مرور حسابك ثم المحاولة مرة أخرى." + "أدخل…" + "أكّد أنك تريد إعادة تعيين هويتك الرقمية." + "أدخل كلمة مرور حسابك للمتابعة" + diff --git a/features/securebackup/impl/src/main/res/values-es/translations.xml b/features/securebackup/impl/src/main/res/values-es/translations.xml index 0904559a8f..a99c4bf496 100644 --- a/features/securebackup/impl/src/main/res/values-es/translations.xml +++ b/features/securebackup/impl/src/main/res/values-es/translations.xml @@ -2,16 +2,17 @@ "Borrar almacén de claves" "Activar copia de seguridad" - "Almacena tu identidad criptográfica y las claves de tus mensajes de forma segura en el servidor. Esto te permitirá ver tu historial de mensajes en cualquier dispositivo nuevo. %1$s." + "Esto te permitirá ver tu historial de chat en cualquier dispositivo nuevo y es necesario para la copia de seguridad de tus chats y de tu identidad digital. %1$s." "Almacenamiento de claves" - "El almacenamiento de claves debe estar activado para configurar la recuperación." + "El almacenamiento de claves debe estar activado para hacer copias de seguridad de tus chats." "Subir claves desde este dispositivo" "Permitir almacenamiento de claves" "Cambiar la clave de recuperación" - "Recupera tu identidad criptográfica y tu historial de mensajes con una clave de recuperación si has perdido todos tus dispositivos actuales." + "Tus chats se respaldan automáticamente con cifrado de extremo a extremo. Para restaurar esta copia de seguridad y conservar tu identidad digital si pierdes el acceso a todos tus dispositivos, necesitarás tu clave de recuperación." "Introduce la clave de recuperación" "Tu almacén de claves no está sincronizado actualmente." - "Configurar la recuperación" + "Obtener clave de recuperación" + "Tus chats se respaldan automáticamente con cifrado de extremo a extremo. Para restaurar esta copia de seguridad y conservar tu identidad digital si pierdes el acceso a todos tus dispositivos, necesitarás tu clave de recuperación." "Abre %1$s en un dispositivo de escritorio" "Vuelve a iniciar sesión en tu cuenta" "Cuando se te pida que verifiques tu dispositivo, selecciona %1$s" @@ -19,16 +20,37 @@ "Sigue las instrucciones para crear una nueva clave de recuperación" "Guarda tu nueva clave de recuperación en un administrador de contraseñas o en una nota cifrada" "Restablece el cifrado de tu cuenta usando otro dispositivo" + "La clave de recuperación que introdujiste no coincide" + "Finalizar la configuración" + "Introduce de nuevo tu clave de recuperación." + "Confirma tu clave de recuperación" + + "Mínimo %1$d carácter. No uses la contraseña de tu cuenta" + "Mínimo %1$d caracteres. No uses la contraseña de tu cuenta" + + "Fortaleza" + "Fortaleza de la frase de contraseña: %1$s" + "Moderada" + "Fuerte" + "Muy fuerte" + "Muy débil" + "Débil" + "Elige una clave de recuperación que puedas memorizar." + "Introduce una clave de recuperación" + "Cargando requisitos de la clave de recuperación" + "Para cambiar tu clave de recuperación, ve a Ajustes → Cifrado → Copia de seguridad" + "Puedes usar tu clave de recuperación para confirmar dispositivos nuevos o restaurar tus chats cifrados si pierdes el acceso a todos tus dispositivos." + "Tu copia de seguridad está ahora totalmente configurada" "Continuar con el restablecimiento" "Se conservarán los detalles de tu cuenta, tus contactos, tus preferencias y tu lista de chats" "Perderás cualquier historial de mensajes que solo esté almacenado en el servidor" "Tendrás que verificar de nuevo todos tus dispositivos y contactos existentes" - "Restablece tu identidad solo si no tienes acceso a otro dispositivo en el que hayas iniciado sesión y has perdido tu clave de recuperación." - "¿No puedes confirmar? Tendrás que restablecer tu identidad." - "Desactivar" - "Perderás tus mensajes cifrados si cierras sesión en todos los dispositivos." - "¿Estás seguro de que quieres desactivar la copia de seguridad?" - "Al borrar el almacén de claves, se eliminarán del servidor tu identidad criptográfica y claves de los mensajes, y se desactivarán las siguientes funciones de seguridad:" + "Restablece tu identidad digital solo si ya no tienes acceso a ningún otro dispositivo verificado y no tienes tu clave de recuperación." + "¿No puedes confirmar? Tendrás que restablecer tu identidad digital." + "Eliminar" + "Perderás tu historial de chats cifrados y tendrás que restablecer tu identidad digital si eliminas todos tus dispositivos." + "¿Estás seguro de que quieres eliminar el almacén de claves?" + "Al borrar el almacén de claves, se eliminarán del servidor tu identidad digital y claves de los mensajes, y se desactivarán las siguientes funciones de seguridad:" "No tendrás un historial de mensajes cifrados en nuevos dispositivos" "Perderás el acceso a tus mensajes cifrados si cierras sesión en %1$s en todas partes" "¿Estás seguro de que quieres desactivar el almacenamiento de claves y borrarlo?" @@ -58,12 +80,12 @@ "Generar tu clave de recuperación" "¡No la compartas con nadie!" "Configuración de recuperación terminada" - "Configurar la recuperación" + "Obtener clave de recuperación" "Sí, restablecer ahora" "Este proceso es irreversible." - "¿Estás seguro de que quieres restablecer tu identidad?" + "¿Estás seguro de que quieres restablecer tu identidad digital?" "Se ha producido un error desconocido. Comprueba que la contraseña de tu cuenta sea correcta y vuelve a intentarlo." "Introducir…" - "Confirma que quieres restablecer tu identidad." + "Confirma que quieres restablecer tu identidad digital." "Introduce la contraseña de tu cuenta para continuar" diff --git a/features/securebackup/impl/src/main/res/values-fa/translations.xml b/features/securebackup/impl/src/main/res/values-fa/translations.xml index bd7a43ffba..9457bcb2af 100644 --- a/features/securebackup/impl/src/main/res/values-fa/translations.xml +++ b/features/securebackup/impl/src/main/res/values-fa/translations.xml @@ -4,12 +4,15 @@ "روشن کردن پشتیبان" "ذخیرهٔ کلیدهای پیام‌ها و هویت رمزنگاریتان به صورت امن روی کارساز. این کار می‌گذارد تاریخچهٔ پیام‌هایتان را روی هر افزارهٔ جدیدی ببینید. %1$s." "ذخیره‌ساز کلید" + "برای پشتیبان‌گیری از چت‌هایتان، باید گزینه‌ی ذخیره‌سازی کلید (Key Storage) فعال باشد." "بارگذاری کلیدها از ین افزاره" "اجازهٔ ذخیرهٔ کلید" "تغییر کلید بازیابی" + "چت‌های شما به طور خودکار با رمزگذاری سراسری پشتیبان‌گیری می‌شوند. برای بازیابی این پشتیبان‌گیری و حفظ هویت دیجیتال خود در زمانی که دسترسی به تمام دستگاه‌هایتان را از دست می‌دهید، به کلید بازیابی خود نیاز خواهید داشت." "ورود کلید بازیابی" "ذخیره‌ساز کلیدتان از هم‌گام بودن در آمده." "دریافت کلید بازیابی" + "چت‌های شما به طور خودکار با رمزگذاری سراسری پشتیبان‌گیری می‌شوند. برای بازیابی این پشتیبان‌گیری و حفظ هویت دیجیتال خود در زمانی که دسترسی به تمام دستگاه‌هایتان را از دست می‌دهید، به کلید بازیابی خود نیاز خواهید داشت." "گشودن %1$s در افزارهٔ میزکار" "ورود دوباره به حسابتان" "گزینش %1$s هنگام درخواست تأیید افزاره‌تان" @@ -17,12 +20,33 @@ "پیروی از دستورالعمل‌ها برای ایجاد کلید بازیابی جدید" "ذخیرهٔ کلید بازیابی جدیدتان در مدیر گذرواژه یا یادداشت رمز شده" "بازنشانی رمزنگاری برای حسابتان با استفاده از افزاره‌ای دیگر" + "کلید بازیابی که وارد کرده‌اید مطابقت ندارد" + "پایان تنظیمات" + "دوباره کلید بازیابی خود را وارد کنید." + "کلید بازیابی خود را تأیید کنید" + + "حداقل کاراکتر %1$d. از رمز عبور حساب کاربری خود استفاده نکنید." + "حداقل کاراکترهای %1$d. از رمز عبور حساب کاربری خود استفاده نکنید." + + "قدرت" + "قدرت رمز عبور: %1$s" + "متوسط" + "قوی" + "خیلی قوی" + "خیلی ضعیف" + "ضعیف" + "یک کلید بازیابی انتخاب کنید که بتوانید آن را به خاطر بسپارید." + "یک کلید بازیابی وارد کنید" + "بارگذاری الزامات کلید بازیابی" + "برای تغییر کلید بازیابی خود، به تنظیمات → رمزگذاری → پشتیبان‌گیری بروید." + "اگر دسترسی به همه دستگاه‌هایتان را از دست بدهید، می‌توانید از کلید بازیابی خود برای تأیید دستگاه‌های جدید یا بازیابی چت‌های رمزگذاری‌شده‌تان استفاده کنید." + "پشتیبان‌گیری شما اکنون کاملاً راه‌اندازی شده است" "ادامهٔ بازنشانی" "جزییات حساب، آشنایان، ترجیحات و سیاههٔ گپ‌هایتان حفظ خواهند شد" "تاریخچهٔ گپ‌هایتان را از دست خواهید داد" "لازم است دوباره همهٔ آشنایان و افزاره‌های موجودتان را تأیید کنید" - "فقط اگر به افزاره‌ای وارد شده از پیش دسترسی ندارید و کلید بازیابیتان را گم کرده‌اید بازنشانی کنید." - "نمی‌توانید تأیید کنید؟ لازم است هویتتان را بازنشانی کنید." + "فقط در صورتی که به دستگاه تأیید شده دیگری دسترسی ندارید و کلید بازیابی خود را ندارید، هویت دیجیتال خود را بازنشانی کنید." + "نمی‌توانید تأیید کنید؟ باید هویت دیجیتال خود را مجدداً تنظیم کنید." "حذف" "اگر از تمام دستگاه‌هایتان خارج شوید، تاریخچه چت رمزگذاری‌شده خود را از دست خواهید داد و باید هویت دیجیتال خود را مجدداً تنظیم کنید." "آیا مطمئن هستید که می‌خواهید کلید ذخیره‌سازی را حذف کنید؟" @@ -59,5 +83,9 @@ "دریافت کلید بازیابی" "بله. اکنون بازنشانی شود" "این فرایند بازگشت‌ناپذیر است." + "آیا مطمئن هستید که می‌خواهید هویت دیجیتال خود را بازنشانی کنید؟" + "خطای ناشناخته‌ای رخ داده است. لطفاً بررسی کنید که رمز عبور حساب شما صحیح است و دوباره امتحان کنید." "ورود…" + "تأیید کنید که می‌خواهید هویت دیجیتال خود را مجدداً تنظیم کنید." + "برای ادامه، رمز عبور حساب خود را وارد کنید" diff --git a/features/securityandprivacy/impl/src/main/res/values-ar/translations.xml b/features/securityandprivacy/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..d6006ec8f3 --- /dev/null +++ b/features/securityandprivacy/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,50 @@ + + + "تحتاج إلى عنوان حتى تظهر الغرفة في الدليل العام." + "تعديل العنوان" + "المساحات التي يمكن لأعضائها الانضمام إلى الغرفة دون دعوة." + "إدارة المساحات" + "(مساحة غير معروفة)" + "مساحات أخرى لست عضوًا فيها" + "مساحاتك" + "إضافة عنوان" + "يمكن لأي شخص في المساحات المصرّح بها الانضمام، لكن يجب على الآخرين طلب الوصول." + "يجب على الجميع طلب الوصول." + "طلب الانضمام" + "يمكن لأي شخص في %1$s الانضمام، لكن يجب على الآخرين طلب الوصول." + "نعم، فعّل التشفير" + "بعد تفعيله، لا يمكن تعطيل التشفير في الغرفة. لن يكون سجل الرسائل مرئيًا لأعضاء الغرفة إلا منذ وقت دعوتهم أو منذ انضمامهم إلى الغرفة. +لن يتمكن أي شخص غير أعضاء الغرفة من قراءة الرسائل. قد يمنع ذلك البوتات والجسور من العمل بشكل صحيح. +لا نوصي بتفعيل التشفير للغرف التي يمكن لأي شخص العثور عليها والانضمام إليها." + "تفعيل التشفير؟" + "بعد تفعيله، لا يمكن تعطيل التشفير." + "التشفير" + "تفعيل التشفير من طرف إلى طرف" + "يمكن لأي شخص الانضمام." + "أي شخص" + "اختر المساحات التي يمكن لأعضائها الانضمام إلى هذه الغرفة دون دعوة. %1$s" + "إدارة المساحات" + "يمكن للأشخاص المدعوين فقط الانضمام." + "بالدعوة فقط" + "الوصول" + "يمكن لأي شخص في المساحات المصرّح بها الانضمام." + "يمكن لأي شخص في %1$s الانضمام." + "أعضاء المساحة" + "المساحات غير مدعومة حاليًا" + "تحتاج إلى عنوان حتى تظهر الغرفة في الدليل العام." + "العنوان" + "السماح بالعثور على هذه الغرفة عند البحث في دليل الغرف العام على %1$s" + "السماح بالعثور عليها عند البحث في الدليل العام." + "مرئية في الدليل العام" + "أي شخص (السجل عام)" + "لن تؤثر التغييرات على الرسائل السابقة، بل على الرسائل الجديدة فقط. %1$s" + "من يمكنه قراءة السجل" + "الأعضاء منذ دعوتهم" + "الأعضاء (السجل الكامل)" + "عناوين الغرف وسيلة للعثور على الغرف والوصول إليها. كما يضمن ذلك إمكانية مشاركة غرفتك بسهولة مع الآخرين. +يمكنك اختيار نشر غرفتك في دليل الغرف العام على خادمك المنزلي." + "نشر الغرفة" + "العناوين وسيلة للعثور على الغرف والمساحات والوصول إليها. كما يضمن ذلك إمكانية مشاركتها بسهولة مع الآخرين." + "الظهور" + "الأمان والخصوصية" + diff --git a/features/securityandprivacy/impl/src/main/res/values-es/translations.xml b/features/securityandprivacy/impl/src/main/res/values-es/translations.xml index f7e7812914..49547a939e 100644 --- a/features/securityandprivacy/impl/src/main/res/values-es/translations.xml +++ b/features/securityandprivacy/impl/src/main/res/values-es/translations.xml @@ -2,9 +2,16 @@ "Necesitarás una dirección de sala para que sea visible en el directorio." "Editar dirección" + "Espacios donde los miembros pueden unirse a la sala sin invitación." + "Gestionar espacios" + "(Espacio desconocido)" + "Otros espacios de los que no eres miembro" + "Tus espacios" "Agregar dirección" + "Cualquiera en espacios autorizados puede unirse, pero el resto debe solicitar acceso." "Todos deben solicitar acceso." "Solicitar unirse" + "Cualquiera en %1$s puede unirse, pero el resto debe solicitar acceso." "Sí, activar cifrado" "Una vez activado, el cifrado de una sala no se puede desactivar. El historial de mensajes solo será visible para los miembros de la sala desde que fueron invitados o desde que se unieron a la sala. Nadie más que los miembros de la sala podrán leer los mensajes. Esto puede impedir que los bots y los puentes funcionen correctamente. @@ -15,21 +22,29 @@ No recomendamos habilitar el cifrado para las salas que cualquiera pueda encontr "Activar el cifrado de extremo a extremo" "Cualquiera puede unirse" "Cualquiera" + "Elige qué miembros de los espacios pueden unirse a esta sala sin una invitación. %1$s" + "Gestionar espacios" "Solo las personas invitadas pueden unirse." "Solo por invitación" "Acceso" + "Cualquiera en espacios autorizados puede unirse." + "Cualquiera en %1$s puede unirse." + "Miembros del espacio" "No se admiten los espacios por el momento." "Necesitarás una dirección de sala para que sea visible en el directorio." "Dirección" "Permite encontrar esta sala buscando en el directorio de salas públicas de %1$s" + "Permitir que sea encontrada al buscar en el directorio público." "Visible en el directorio público" "Cualquiera (el historial es público)" + "Los cambios no afectarán a los mensajes anteriores, solo a los nuevos. %1$s" "Quién puede leer el historial" - "Solo participantes desde que fueron invitados" - "Miembros (historia completa)" + "Miembros desde su invitación" + "Miembros (historial completo)" "Las direcciones de sala son formas de buscar salas y acceder a ellas. Esto también garantiza que puedas compartir fácilmente tu sala con otras personas. Puedes optar por publicar tu sala en el directorio de salas públicas de tu servidor base." "Publicación de la sala" + "Las direcciones son una forma de encontrar y acceder a salas y espacios. También garantizan que puedas compartirlos fácilmente con otras personas." "Visibilidad" "Seguridad y privacidad" diff --git a/features/securityandprivacy/impl/src/main/res/values-fa/translations.xml b/features/securityandprivacy/impl/src/main/res/values-fa/translations.xml index 6fc141b487..d4a92973cb 100644 --- a/features/securityandprivacy/impl/src/main/res/values-fa/translations.xml +++ b/features/securityandprivacy/impl/src/main/res/values-fa/translations.xml @@ -1,21 +1,50 @@ - "نشانی اتاق" - "افزودن نشانی اتاق" + "برای اینکه بتوانید آن را در فهرست عمومی مشاهده کنید، به یک آدرس نیاز دارید." + "ویرایش آدرس" + "فضاهایی که اعضا می‌توانند بدون دعوت‌نامه به اتاق بپیوندند." + "مدیریت فضاها" + "(فضای ناشناخته)" + "فضاهای دیگری که عضو آنها نیستید" + "فضاهای شما" + "اضافه کردن آدرس" + "هر کسی که در فضاهای مجاز باشد می‌تواند عضو شود، اما بقیه باید درخواست دسترسی بدهند." + "همه باید درخواست دسترسی بدهند." "درخواست دعوت" + "هر کسی در %1$s می‌تواند عضو شود، اما بقیه باید درخواست دسترسی بدهند." "بله. به کار انداختن رمزنگاری" + "پس از فعال کردن، رمزگذاری برای یک اتاق قابل غیرفعال کردن نیست، تاریخچه پیام فقط برای اعضای اتاق از زمان دعوت یا از زمان پیوستن به اتاق قابل مشاهده خواهد بود. +هیچ کس غیر از اعضای اتاق قادر به خواندن پیام‌ها نخواهد بود. این ممکن است مانع از عملکرد صحیح ربات‌ها و پل‌ها شود. +ما فعال کردن رمزگذاری را برای اتاق‌هایی که هر کسی می‌تواند آنها را پیدا کند و به آنها بپیوندد، توصیه نمی‌کنیم." "رمزگذاری فعال شود؟" "پس از به کار افتادن، رمزنگاری قابل از کار انداختن نیست." "رمزنگاری" - "هرکسی می‌تواند یافته و بپیوندد" - "هرکسی" - "افراد فقط در صورت دعوت می‌توانند بپیوندند" - "فقط دعوتی" - "دسترسی اتاق" + "فعال کردن رمزنگاری سراسری" + "هر کسی می‌تواند عضو شود." + "هر کس" + "انتخاب کنید که اعضای کدام فضاها می‌توانند بدون دعوتنامه به این اتاق بپیوندند. %1$s" + "مدیریت فضاها" + "فقط افراد دعوت شده می‌توانند عضو شوند." + "فقط دعوت" + "دسترسی" + "هر کسی که در فضاهای مجاز باشد می‌تواند عضو شود." + "هر کسی که در %1$s باشد می‌تواند عضو شود." + "اعضای فضا" "در حال حاضر فضاها پشتیبانی نمی‌شوند" - "نشانی اتاق" + "برای اینکه بتوانید آن را در فهرست عمومی مشاهده کنید، به یک آدرس نیاز دارید." + "آدرس" + "با جستجو در فهرست اتاق‌های عمومی %1$s، امکان یافتن این اتاق را فراهم کنید." + "با جستجو در فهرست عمومی، می‌توان آن را پیدا کرد." + "قابل مشاهده در فهرست عمومی" "هرکسی" + "تغییرات روی پیام‌های قبلی تأثیری نخواهند داشت، فقط روی پیام‌های جدید اعمال می‌شوند. %1$s" + "چه کسی می‌تواند تاریخ بخواند؟" + "اعضا از زمان دعوت" + "اعضا (تاریخچه کامل)" + "آدرس‌های اتاق، راه‌هایی برای پیدا کردن و دسترسی به اتاق‌ها هستند. این همچنین تضمین می‌کند که می‌توانید به راحتی اتاق خود را با دیگران به اشتراک بگذارید. +شما می‌توانید اتاق خود را در دایرکتوری عمومی اتاق سرور خانگی خود منتشر کنید." "انتشار اتاق" - "نمایانی اتاق" + "آدرس‌ها راهی برای پیدا کردن و دسترسی به اتاق‌ها و فضاها هستند. این همچنین تضمین می‌کند که می‌توانید به راحتی آنها را با دیگران به اشتراک بگذارید." + "قابلیت مشاهده" "امنیت و محرمانگی" diff --git a/features/signedout/impl/src/main/res/values-ar/translations.xml b/features/signedout/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..fecfbc2b3a --- /dev/null +++ b/features/signedout/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,8 @@ + + + "لقد غيّرت كلمة مرورك في جلسة أخرى" + "لقد حذفت هذه الجلسة من جلسة أخرى" + "أبطل مسؤول الخادم صلاحية وصولك" + "ربما تم تسجيل خروجك لأحد الأسباب المذكورة أدناه. يُرجى تسجيل الدخول مرة أخرى لمتابعة استخدام %s." + "تم تسجيل خروجك" + diff --git a/features/space/impl/src/main/res/values-ar/translations.xml b/features/space/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..346752f14e --- /dev/null +++ b/features/space/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,36 @@ + + + "اختيار المالكين" + "%1$s (مسؤول)" + + "مغادرة %1$d غرف والمساحة" + "مغادرة %1$d غرفة والمساحة" + "مغادرة %1$d غرفتين والمساحة" + "مغادرة %1$d غرف والمساحة" + "مغادرة %1$d غرفة والمساحة" + "مغادرة %1$d غرفة والمساحة" + + "اختر الغرف التي تريد مغادرتها، والتي لست المسؤول الوحيد عنها:" + "يجب أن تعيّن مسؤولًا آخر لهذه المساحة قبل أن تتمكن من المغادرة." + "أنت المالك الوحيد لـ %1$s. يجب أن تنقل الملكية إلى شخص آخر قبل المغادرة." + "لن تتم إزالتك من الغرف التالية لأنك المسؤول الوحيد:" + "مغادرة %1$s؟" + "أنت المسؤول الوحيد عن %1$s" + "نقل الملكية" + "غرفة" + "لن تؤثر إضافة غرفة على إمكانية الوصول إلى الغرفة. لتغيير الوصول، انتقل إلى إعدادات الغرفة > الأمان والخصوصية." + "أضف غرفتك الأولى" + "عرض الأعضاء" + "لن تؤثر إزالة غرفة على إمكانية الوصول إلى الغرفة. لتغيير الوصول، انتقل إلى معلومات الغرفة > الخصوصية والأمان." + + "إزالة %1$d غرف من %2$s" + "إزالة %1$d غرفة من %2$s" + "إزالة %1$d غرفتين من %2$s" + "إزالة %1$d غرف من %2$s" + "إزالة %1$d غرفة من %2$s" + "إزالة %1$d غرفة من %2$s" + + "مغادرة المساحة" + "الأدوار والصلاحيات" + "الأمان والخصوصية" + diff --git a/features/space/impl/src/main/res/values-es/translations.xml b/features/space/impl/src/main/res/values-es/translations.xml index 41887088b6..f65375f616 100644 --- a/features/space/impl/src/main/res/values-es/translations.xml +++ b/features/space/impl/src/main/res/values-es/translations.xml @@ -1,5 +1,28 @@ + "Elegir propietarios" + "%1$s (Admin.)" + + "Salir de %1$d sala y del espacio" + "Salir de %1$d salas y del espacio" + + "Elige las salas de las que quieras salir en las que no eres el único administrador:" + "Debes designar otro administrador para este espacio antes de poder salir." + "Eres el único propietario de %1$s. Debes transferir la propiedad a otra persona antes de salir." + "No se te eliminará de las siguientes salas porque eres el único administrador:" + "¿Salir de %1$s?" + "Eres el único administrador de %1$s" + "Transferencia de propiedad" + "Sala" + "Añadir una sala no afectará a su configuración de acceso. Para cambiar el acceso, ve a Ajustes de la sala > Seguridad y privacidad." + "Añade tu primera sala" + "Ver miembros" + "Eliminar una sala no afectará a su configuración de acceso. Para cambiar el acceso, ve a Información de la sala > Privacidad y seguridad." + + "Eliminar %1$d sala de %2$s" + "Eliminar %1$d salas de %2$s" + + "Salir del espacio" "Roles y permisos" "Seguridad y privacidad" diff --git a/features/space/impl/src/main/res/values-fa/translations.xml b/features/space/impl/src/main/res/values-fa/translations.xml index d8f377c0b2..9aa3818f44 100644 --- a/features/space/impl/src/main/res/values-fa/translations.xml +++ b/features/space/impl/src/main/res/values-fa/translations.xml @@ -2,11 +2,26 @@ "گزینش مالکان" "‏%1$s (مدیر)" + + "اتاق و فضای %1$d را ترک کنید" + "اتاق‌ها و فضای %1$d را ترک کنید" + + "اتاق‌هایی را که می‌خواهید از آنها خارج شوید و تنها مدیر آنها نیستید، انتخاب کنید:" "پیش از ترک باید مدیری دیگر به این فضا تخصیص دهید." + "شما تنها مالک %1$s هستید. قبل از ترک محل، باید مالکیت را به شخص دیگری منتقل کنید." "از اتاق(های) زیر برداشته نخواهید شد؛ چرا که تنها مدیر هستید:" "ترک %1$s؟" "تنها مدیر %1$s هستید" + "انتقال مالکیت" + "اتاق" + "اضافه کردن اتاق تاثیری بر دسترسی به اتاق نخواهد داشت. برای تغییر دسترسی، به تنظیمات اتاق > امنیت و حریم خصوصی بروید." + "اولین اتاق خود را اضافه کنید" "دیدن اعضا" + "حذف یک اتاق تاثیری بر دسترسی به آن نخواهد داشت. برای تغییر دسترسی، به اطلاعات اتاق > حریم خصوصی و امنیت بروید." + + "حذف اتاق %1$d از %2$s" + "حذف اتاق‌های %1$d از %2$s" + "ترک فضا" "نقش‌ها و مجوزها" "امنیت و محرمانگی" diff --git a/features/startchat/impl/src/main/res/values-ar/translations.xml b/features/startchat/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..b4e96844c4 --- /dev/null +++ b/features/startchat/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,12 @@ + + + "إنشاء غرفة جديدة" + "دليل الغرف" + "حدث خطأ أثناء محاولة بدء محادثة" + "الانضمام إلى غرفة باستخدام العنوان" + "العنوان غير صالح" + "أدخل العنوان…" + "تم العثور على غرفة مطابقة" + "لم يتم العثور على الغرفة" + "مثلاً: #room-name:matrix.org" + diff --git a/features/startchat/impl/src/main/res/values-es/translations.xml b/features/startchat/impl/src/main/res/values-es/translations.xml index 64a9f02a17..dd4233ce50 100644 --- a/features/startchat/impl/src/main/res/values-es/translations.xml +++ b/features/startchat/impl/src/main/res/values-es/translations.xml @@ -5,7 +5,7 @@ "Se ha producido un error al intentar iniciar un chat" "Unirse a una sala por su dirección" "Dirección no válida" - "Introducir…" + "Introducir dirección…" "Sala encontrada" "No se encontró la sala" "p. ej., #nombre-de-la-sala:matrix.org" diff --git a/features/startchat/impl/src/main/res/values-fa/translations.xml b/features/startchat/impl/src/main/res/values-fa/translations.xml index 7cb1e1baee..4a4cd239de 100644 --- a/features/startchat/impl/src/main/res/values-fa/translations.xml +++ b/features/startchat/impl/src/main/res/values-fa/translations.xml @@ -5,7 +5,7 @@ "هنگام تلاش برای شروع چت خطایی روی داد" "پیوستن به اتاق با نشانی" "نشانی معتبری نیست" - "ورود…" + "آدرس را وارد کنید…" "اتاق مطابق پیدا شد" "اتاق پیدا نشد" "نمونه: ‪#room-name:matrix.org" diff --git a/features/startchat/impl/src/main/res/values-fr/translations.xml b/features/startchat/impl/src/main/res/values-fr/translations.xml index 9aaebd018f..74a099f93a 100644 --- a/features/startchat/impl/src/main/res/values-fr/translations.xml +++ b/features/startchat/impl/src/main/res/values-fr/translations.xml @@ -5,7 +5,7 @@ "Une erreur s’est produite lors de la tentative de création de la discussion" "Saisir une adresse de salon" "Ce n’est pas une adresse valide" - "Saisir…" + "Adresse du salon…" "Ce salon existe" "Salon non trouvé" "ex: #nom-du-salon:matrix.org" diff --git a/features/userprofile/shared/src/main/res/values-ar/translations.xml b/features/userprofile/shared/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..2292e8cb70 --- /dev/null +++ b/features/userprofile/shared/src/main/res/values-ar/translations.xml @@ -0,0 +1,19 @@ + + + "حظر" + "المستخدمون المحظورون لن يتمكّنوا من إرسال رسائل لك وكل رسائلهم ستُحجب. يمكنك إلغاء حظرهم متى ما أردت." + "حظر المستخدم" + "إلغاء الحظر" + "ستتمكن من رؤية كل رسائلهم مجدّداً." + "إلغاء حظر المستخدم" + "حظر" + "المستخدمون المحظورون لن يتمكّنوا من إرسال رسائل لك وكل رسائلهم ستُحجب. يمكنك إلغاء حظرهم متى ما أردت." + "حظر المستخدم" + "الملف الشخصي" + "إلغاء الحظر" + "ستتمكن من رؤية كل رسائلهم مجدّداً." + "إلغاء حظر المستخدم" + "استخدم تطبيق الويب للتحقق من هذا المستخدم." + "تحقّق من %1$s" + "حدث خطأ أثناء محاولة بدء محادثة" + diff --git a/features/verifysession/impl/src/main/res/values-ar/translations.xml b/features/verifysession/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..104dbdacfa --- /dev/null +++ b/features/verifysession/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,54 @@ + + + "لا يمكنك التأكيد؟" + "إنشاء مفتاح استرداد جديد" + "اختر طريقة التحقق لإعداد المراسلة الآمنة." + "تأكيد هويتك الرقمية" + "استخدام جهاز آخر" + "استخدام مفتاح الاسترداد" + "يمكنك الآن قراءة الرسائل أو إرسالها بأمان، ويمكن لأي شخص تدردش معه أن يثق بهذا الجهاز أيضًا." + "تم التحقق من الجهاز" + "استخدام جهاز آخر" + "في انتظار الجهاز الآخر…" + "شيء ما لا يبدو سليماً. إما مهلة الطلب قد انتهت أو أن الطلب رُفِض." + "تأكد من تطابق الرموز التعبيرية أدناه مع تلك الظاهرة في جلستك الأخرى." + "قارن الرموز التعبيرية" + "أكّد أن الرموز التعبيرية أدناه تطابق الرموز المعروضة على جهاز المستخدم الآخر." + "أكّد أن الأرقام أدناه تطابق الأرقام المعروضة في جلستك الأخرى." + "قارن الأرقام" + "تم التحقق من جلستك الحالية. فيها وصول إلى رسائلك المشفّرة والمستخدمون الآخرون يرونها موثوقة." + "يمكنك الآن الوثوق بالهوية الرقمية لهذا المستخدم عند إرسال الرسائل أو تلقيها." + "تم التحقق من الجهاز" + "أدخل مفتاح الاسترداد" + "إما أن الطلب انتهت مهلته، أو تم رفضه، أو حدث عدم تطابق في التحقق." + "أثبت هويتك ليصبح لديك وصول إلى رسائلك المشفّرة السابقة." + "افتح جلسة موجودة" + "إعادة محاولة عملية التحقق" + "جاهز" + "بانتظار التطابق" + "قارِن مجموعة فريدة من الرموز التعبيرية." + "قارن بين الرموز التعبيرية المميزة، متأكداً من ورودها في نفس الترتيب." + "تم تسجيل الدخول" + "إما أن الطلب انتهت مهلته، أو تم رفضه، أو حدث عدم تطابق في التحقق." + "فشل التحقق" + "لا تتابع إلا إذا كنت أنت من بدأ هذا التحقق." + "تحقّق من الجهاز الآخر للحفاظ على أمان سجل رسائلك." + "تم التحقق من جلستك الحالية. فيها وصول إلى رسائلك المشفّرة والمستخدمون الآخرون يرونها موثوقة." + "تم التحقق من الجهاز" + "تم طلب التحقق" + "لا يتطابقون" + "يتطابقون" + "تأكّد من أن التطبيق مفتوح على الجهاز الآخر قبل بدء التحقق من هنا." + "افتح التطبيق على جهاز آخر تم التحقق منه" + "لمزيد من الأمان، تحقّق من هذا المستخدم بمقارنة مجموعة من الرموز التعبيرية على أجهزتكما. افعل ذلك باستخدام وسيلة موثوقة للتواصل." + "هل تريد التحقق من هذا المستخدم؟" + "لمزيد من الأمان، يريد مستخدم آخر التحقق من هويتك الرقمية. ستُعرض لك مجموعة من الرموز التعبيرية لمقارنتها." + "من المفترض أن تظهر نافذة منبثقة على الجهاز الآخر. ابدأ التحقق من هناك الآن." + "ابدأ التحقق على الجهاز الآخر" + "ابدأ التحقق على الجهاز الآخر" + "في انتظار المستخدم الآخر" + "بمجرد القبول، ستتمكن من متابعة التحقق." + "اِقبل طلب بدء عملية التحقق في جلستك الأخرة للاستمرار." + "بانتظار قبول الطلب" + "تجري إزالة الجهاز…" + diff --git a/features/verifysession/impl/src/main/res/values-es/translations.xml b/features/verifysession/impl/src/main/res/values-es/translations.xml index 52422393bf..de23ddc217 100644 --- a/features/verifysession/impl/src/main/res/values-es/translations.xml +++ b/features/verifysession/impl/src/main/res/values-es/translations.xml @@ -2,8 +2,8 @@ "¿No puedes confirmar?" "Crear una nueva clave de recuperación" - "Verifica este dispositivo para configurar la mensajería segura." - "Confirma que eres tú" + "Elige cómo verificar para configurar la mensajería segura." + "Confirma tu identidad digital" "Usar otro dispositivo" "Usar clave de recuperación" "Ahora puedes leer o enviar mensajes de forma segura y cualquier persona con la que chatees también puede confiar en este dispositivo." @@ -17,7 +17,7 @@ "Confirma que los números que aparecen a continuación coinciden con los mostrados en tu otra sesión." "Comparar números" "Ahora puedes leer o enviar mensajes de forma segura en tu otro dispositivo." - "Ahora puedes confiar en la identidad de este usuario al enviar o recibir mensajes." + "Ahora puedes confiar en la identidad digital de este usuario al enviar o recibir mensajes." "Dispositivo verificado" "Introduce la clave de recuperación" "O bien se agotó el tiempo de solicitud, se rechazó la solicitud o hubo una discrepancia en la verificación." @@ -42,7 +42,7 @@ "Abre la aplicación en otro dispositivo verificado" "Para mayor seguridad, verifica a este usuario comparando un conjunto de emojis en vuestros dispositivos. Hazlo utilizando una forma de comunicación de confianza." "¿Verificar a este usuario?" - "Para mayor seguridad, otro usuario quiere verificar tu identidad. Se te mostrará un conjunto de emojis para compararlos." + "Para mayor seguridad, otro usuario quiere verificar tu identidad digital. Se te mostrará un conjunto de emojis para compararlos." "Deberías ver una ventana emergente en el otro dispositivo. Inicia ahora la verificación desde allí." "Iniciar la verificación en el otro dispositivo" "Iniciar la verificación en el otro dispositivo" @@ -50,5 +50,5 @@ "Una vez aceptada, podrás continuar con la verificación." "Acepta la solicitud para iniciar el proceso de verificación en tu otra sesión para continuar." "A la espera de aceptar la solicitud" - "Cerrando sesión…" + "Eliminando dispositivo…" diff --git a/features/verifysession/impl/src/main/res/values-fa/translations.xml b/features/verifysession/impl/src/main/res/values-fa/translations.xml index d68ec29229..5f2b02584c 100644 --- a/features/verifysession/impl/src/main/res/values-fa/translations.xml +++ b/features/verifysession/impl/src/main/res/values-fa/translations.xml @@ -13,11 +13,14 @@ "يه چيزي درست به نظر نمياد یا زمان درخواست به پایان رسید یا درخواست رد شد." "تأیید تطابق شکلک‌های زیر با شکلک‌های نشان داده شده روی افزارهٔ دیگرتان." "مقایسهٔ شکلک‌ها" + "تأیید کنید که ایموجی‌های زیر با ایموجی‌های نمایش داده شده در دستگاه کاربر دیگر مطابقت دارند." "تأیید کنید که اعداد زیر با اعداد نشان داده شده در جلسه دیگر شما مطابقت دارند." "مقایسهٔ اعداد" "اکنون می‌توانید روی افزارهٔ دیگرتان با امنیت پیام فرستاده و بخوانید." + "اکنون می‌توانید هنگام ارسال یا دریافت پیام، به هویت دیجیتال این کاربر اعتماد کنید." "افزاره تأیید شده" "ورود کلید بازیابی" + "یا مهلت درخواست تمام شده، یا درخواست رد شده، یا عدم تطابق تأیید وجود داشته است." "برای دسترسی به تاریخچه پیام‌های رمزگذاری‌شده‌تان، ثابت کنید که خودتان هستید." "گشودن نشستی موجود" "تلاش برای تأیید دوباره" @@ -26,11 +29,25 @@ "مقایسهٔ مجموعه‌ای یکتا از شکلک‌ها." "شکلک‌ها را مقایسه کنید، از ترتیب نمایش آنان نیز مطمئن شوید." "وارد شده" + "یا مهلت درخواست تمام شده، یا درخواست رد شده، یا عدم تطابق تأیید وجود داشته است." "صحت‌سنجی شکست خورد" + "فقط در صورتی ادامه دهید که خودتان این تأیید را آغاز کرده باشید." + "برای ایمن نگه داشتن تاریخچه پیام‌هایتان، دستگاه دیگر را تأیید کنید." "اکنون می‌توانید روی افزارهٔ دیگرتان با امنیت پیام فرستاده و بخوانید." "افزاره تأیید شده" + "درخواست تأیید" "مطابق نیستند" "مطابقند" + "قبل از شروع تأیید از اینجا، مطمئن شوید که برنامه را در دستگاه دیگر باز کرده‌اید." + "برنامه را روی دستگاه تأیید شده دیگری باز کنید" + "برای امنیت بیشتر، با مقایسه مجموعه‌ای از ایموجی‌ها در دستگاه‌های خود، این کاربر را تأیید کنید. این کار را با استفاده از یک روش ارتباطی مطمئن انجام دهید." + "این کاربر را تایید می‌کنید؟" + "برای امنیت بیشتر، اگر کاربر دیگری بخواهد هویت دیجیتالی شما را تأیید کند، مجموعه‌ای از ایموجی‌ها برای مقایسه به شما نشان داده می‌شود." + "باید یک پنجره‌ی پاپ‌آپ روی دستگاه دیگر ببینید. اکنون تأیید را از آنجا شروع کنید." + "شروع تأیید در دستگاه دیگر" + "شروع تأیید در دستگاه دیگر" + "در انتظار کاربر دیگر" + "پس از پذیرش، می‌توانید به تأیید ادامه دهید." "برای ادامه، درخواست شروع فرآیند تأیید را در جلسه دیگر خود بپذیرید." "منظر پذیرش درخواست" "برداشتن افزاره…" diff --git a/libraries/androidutils/src/main/res/values-ar/translations.xml b/libraries/androidutils/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..6449b128d1 --- /dev/null +++ b/libraries/androidutils/src/main/res/values-ar/translations.xml @@ -0,0 +1,4 @@ + + + "لم يُعثر على تطبيق ليتعامل مع هذا الحدث." + diff --git a/libraries/dateformatter/impl/src/main/res/values-ar/translations.xml b/libraries/dateformatter/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..9e8f6c94d4 --- /dev/null +++ b/libraries/dateformatter/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,5 @@ + + + "%1$s في %2$s" + "هذا الشهر" + diff --git a/libraries/emoji/impl/src/main/res/values-ar/translations.xml b/libraries/emoji/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..5a84323379 --- /dev/null +++ b/libraries/emoji/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,13 @@ + + + "أنشطة" + "أعلام" + "أكل وشرب" + "حيوانات وطبيعة" + "أشياء" + "الابتسامات والأشخاص" + "سفر وأماكن" + "الرموز التعبيرية الأخيرة" + "رموز" + "البحث عن رموز تعبيرية" + diff --git a/libraries/emoji/impl/src/main/res/values-es/translations.xml b/libraries/emoji/impl/src/main/res/values-es/translations.xml index 7a694296b2..d32846b145 100644 --- a/libraries/emoji/impl/src/main/res/values-es/translations.xml +++ b/libraries/emoji/impl/src/main/res/values-es/translations.xml @@ -7,5 +7,7 @@ "Objetos" "Emojis y personas" "Viajes y lugares" + "Emojis recientes" "Símbolos" + "Buscar emojis" diff --git a/libraries/emoji/impl/src/main/res/values-pl/translations.xml b/libraries/emoji/impl/src/main/res/values-pl/translations.xml index c59f2c6b54..9ac9d5dff9 100644 --- a/libraries/emoji/impl/src/main/res/values-pl/translations.xml +++ b/libraries/emoji/impl/src/main/res/values-pl/translations.xml @@ -4,7 +4,7 @@ "Flagi" "Jedzenie i napoje" "Zwierzęta i natura" - "Obiekty" + "Przedmioty" "Buźki i osoby" "Podróż i miejsca" "Ostatnie emoji" diff --git a/libraries/eventformatter/impl/src/main/res/values-ar/translations.xml b/libraries/eventformatter/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..8b64ef4f6c --- /dev/null +++ b/libraries/eventformatter/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,73 @@ + + + "(الصورة غُيِّرت أيضاً)" + "غيّرَ %1$s صورته الشخصية" + "قمتَ بتغيير صورتك الشخصية" + "تم خفض رتبة %1$s إلى عضو" + "تم خفض رتبة %1$s إلى مشرف" + "غيّر %1$s اسمه من %2$s إلى %3$s" + "غيّرتَ اسمك من %1$s إلى %2$s" + "أزال %1$s اسمه (كان %2$s سابقاً)" + "قمتَ بحذف اسمك (كان %1$s سابقاً)" + "عيّن %1$s اسمه ليكون %2$s" + "عيّنتَ اسمك ليكون %1$s" + "تمت ترقية %1$s إلى مسؤول" + "تمت ترقية %1$s إلى مشرف" + "غيّر %1$s صورة الغرفة" + "قمتَ بتغيير صورة الغرفة" + "أزال %1$s صورة الغرفة" + "قمتَ بإزالة صورة الغرفة" + "%1$s حظر %2$s" + "قمتَ بحظر %1$s" + "حظرت %1$s: %2$s" + "قام %1$s بحظر %2$s: %3$s" + "%1$s أنشأ الغرفة" + "قمتَ بإنشاء الغرفة" + "%1$s دعا %2$s" + "قَبِل %1$s الدعوة" + "قمتَ بقبول الدعوة" + "قمتَ بدعوة %1$s" + "قام %1$s بدعوتك" + "انضمَّ %1$s إلى الغرفة" + "اِنضممت إلى الغرفة" + "طلب %1$s الانضمام" + "سمح %1$s لـ %2$s بالانضمام" + "قمتَ بالسماح لـ %1$s بالانضمام" + "قمتَ بطلب الانضمام" + "رفض %1$s طلب %2$s بالانضمام" + "قمتَ برفض طلب %1$s للانضمام" + "رفض %1$s طلب انضمامك" + "لم يعد %1$s مهتماً بالانضمام" + "قمتَ بإلغاء طلب انضمامك" + "غادر %1$s المجموعة" + "قمتَ بمغادرة المجموعة" + "غيّر %1$s اسم الغرفة إلى: %2$s" + "قمتَ بتغيير اسم الغرفة إلى: %1$s" + "حذف %1$s اسم الغرفة" + "قمتَ بحذف اسم الغرفة" + "%1$s لم يُجرِ أي تغييرات" + "لم تُجرِ أي تغييرات" + "غيّر %1$s الرسائل المثبّتة" + "غيّرت الرسائل المثبّتة" + "ثبّت %1$s رسالة" + "قمت بتثبيت رسالة" + "ألغى %1$s تثبيت رسالة" + "قمت بإلغاء تثبيت رسالة" + "رفض %1$s الدعوة" + "قمتَ برفض الدعوة" + "%1$s طرد %2$s" + "قمتَ بطرد %1$s" + "أزلت %1$s: %2$s" + "قام %1$s بإزالة %2$s: %3$s" + "أرسل %1$s دعوة إلى %2$s لينضم إلى الغرفة" + "قمتَ بإرسال دعوة إلى %1$s لينضم إلى الغرفة" + "تراجع %1$s عن دعوة %2$s للانضمام إلى الغرفة" + "قمتَ بالتراجع عن دعوة %1$s للانضمام إلى الغرفة" + "غيّر %1$s الموضوع إلى: %2$s" + "قمتَ بتغيير الموضوع إلى: %1$s" + "أزال %1$s موضوع الغرفة" + "قمتَ بإزالة موضوع الغرفة" + "%1$s فكّ الحظر عن %2$s" + "قمتَ بفك الحظر عن %1$s" + "أحدث %1$s تغييراً غير معلوم في عضويته" + diff --git a/libraries/eventformatter/impl/src/main/res/values-fa/translations.xml b/libraries/eventformatter/impl/src/main/res/values-fa/translations.xml index f7fd635d31..259bed9e5e 100644 --- a/libraries/eventformatter/impl/src/main/res/values-fa/translations.xml +++ b/libraries/eventformatter/impl/src/main/res/values-fa/translations.xml @@ -19,6 +19,8 @@ "چهرک اتاق را برداشتید" "%2$s به دست %1$s مسدود کرد" "%1$s را مسدود کردید" + "شما %1$s: %2$s را محروم کردید" + "%1$s محروم شد %2$s: %3$s" "%1$s اتاق را ایجاد کرد" "اتاق را ساختید" "%1$s از %2$s دعوت کرد" @@ -55,6 +57,8 @@ "دعوت را رد کردید" "%2$s به دست %1$s برداشته شد" "%1$s را برداشتید" + "شما %1$s: %2$s را حذف کردید" + "%1$s حذف شد %2$s: %3$s" "%1$s دعوتی برای پیوستن %2$s به اتاق فرستاد" "برای %1$s دعوت پیوستن به اتاق فرستادید" "%1$s دعوت پیوستن به اتاق %2$s را باطل کرد" diff --git a/libraries/matrixui/src/main/res/values-ar/translations.xml b/libraries/matrixui/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..5417a5e89f --- /dev/null +++ b/libraries/matrixui/src/main/res/values-ar/translations.xml @@ -0,0 +1,9 @@ + + + "إرسال دعوة" + "هل تريد بدء دردشة مع %1$s؟" + "إرسال دعوة؟" + "ليست لديك حاليًا أي دردشات مع هذا الشخص. أكّد دعوته قبل المتابعة." + "هل تريد بدء دردشة مع جهة الاتصال الجديدة هذه؟" + "دعاك %1$s (%2$s)" + diff --git a/libraries/matrixui/src/main/res/values-es/translations.xml b/libraries/matrixui/src/main/res/values-es/translations.xml index 5d4ac4cf43..26e15d9b2e 100644 --- a/libraries/matrixui/src/main/res/values-es/translations.xml +++ b/libraries/matrixui/src/main/res/values-es/translations.xml @@ -3,5 +3,7 @@ "Enviar invitación" "¿Quieres iniciar un chat con %1$s?" "¿Enviar invitación?" + "De momento no tienes ningún chat con esta persona. Confirma que quieres invitarla antes de continuar." + "¿Iniciar un chat con este nuevo contacto?" "%1$s (%2$s) te invitó" diff --git a/libraries/matrixui/src/main/res/values-fa/translations.xml b/libraries/matrixui/src/main/res/values-fa/translations.xml index 3f5d32f974..9dfece23b2 100644 --- a/libraries/matrixui/src/main/res/values-fa/translations.xml +++ b/libraries/matrixui/src/main/res/values-fa/translations.xml @@ -3,5 +3,7 @@ "فرستادن دعوت" "می‌خواهید گپی را با %1$s بیاغازید؟" "فرستادن دعوت؟" + "شما در حال حاضر هیچ گفت‌وگویی با این شخص ندارید. قبل از ادامه، دعوت از او را تأیید کنید." + "با این مخاطب جدید گفت‌وگو را شروع کنید؟" "%1$s (%2$s) دعوتتان کرد" diff --git a/libraries/mediaviewer/impl/src/main/res/values-ar/translations.xml b/libraries/mediaviewer/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..0e18b01b6b --- /dev/null +++ b/libraries/mediaviewer/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,22 @@ + + + "ستتم إزالة هذا الملف من الغرفة ولن يتمكن الأعضاء من الوصول إليه." + "إزالة الملف؟" + "تحقّق من اتصالك بالإنترنت وحاول مرة أخرى." + "ستظهر هنا المستندات والملفات الصوتية والرسائل الصوتية التي يتم رفعها إلى هذه الغرفة." + "لم يتم رفع أي ملفات بعد" + "جارٍ تحميل الملفات…" + "جارٍ تحميل الوسائط…" + "الملفات" + "الوسائط" + "ستظهر هنا الصور ومقاطع الفيديو التي يتم رفعها إلى هذه الغرفة." + "لم يتم رفع أي وسائط بعد" + "الوسائط والملفات" + "التنسيق" + "الاسم" + "لا توجد ملفات أخرى لعرضها" + "لا توجد وسائط أخرى لعرضها" + "معلومات الملف" + "تم الرفع بواسطة" + "تم الرفع في" + diff --git a/libraries/mediaviewer/impl/src/main/res/values-es/translations.xml b/libraries/mediaviewer/impl/src/main/res/values-es/translations.xml index 686dc60658..2a98d41e81 100644 --- a/libraries/mediaviewer/impl/src/main/res/values-es/translations.xml +++ b/libraries/mediaviewer/impl/src/main/res/values-es/translations.xml @@ -6,16 +6,17 @@ "Los documentos, archivos de audio y mensajes de voz subidos a esta sala se mostrarán aquí." "Aún no se ha subido ningún archivo" "Cargando archivos…" - "Cargando medios…" + "Cargando multimedia…" "Archivos" - "Medios" + "Multimedia" "Las imágenes y vídeos subidos a esta sala se mostrarán aquí." "Aún no se ha subido ningún medio" - "Medios y archivos" + "Multimedia y archivos" "Formato de archivo" "Nombre del archivo" "No hay más archivos que mostrar" "No hay más medios que mostrar" + "Información del archivo" "Subido por" "Subido el" diff --git a/libraries/mediaviewer/impl/src/main/res/values-fa/translations.xml b/libraries/mediaviewer/impl/src/main/res/values-fa/translations.xml index 81f8f4db2d..30a9add8f3 100644 --- a/libraries/mediaviewer/impl/src/main/res/values-fa/translations.xml +++ b/libraries/mediaviewer/impl/src/main/res/values-fa/translations.xml @@ -1,5 +1,6 @@ + "این فایل از اتاق حذف خواهد شد و اعضا به آن دسترسی نخواهند داشت." "حذف پرونده؟" "بررسی اتّصال اینترنتیتان و تلاش دوباره." "سندها، پرونده‌ها و پیام‌های صوتی بار گذاشته در این اتاق این‌جا نشان داده خواهند شد." @@ -13,6 +14,9 @@ "رسانه‌ها و پرونده‌ها" "قالب پرونده" "نام پرونده" + "فایل بیشتری برای نمایش وجود ندارد" + "رسانه دیگری برای نمایش وجود ندارد" + "اطلاعات فایل" "بارگذاشته به دست" "بارگذاشته در" diff --git a/libraries/permissions/api/src/main/res/values-ar/translations.xml b/libraries/permissions/api/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..4131b6d27c --- /dev/null +++ b/libraries/permissions/api/src/main/res/values-ar/translations.xml @@ -0,0 +1,7 @@ + + + "من أجل جعل التطبيق يستخدم الكاميرا عليك بمنح الإذن لذلك في إعدادات النظام." + "يرجى منح الإذن في إعدادات النظام." + "من أجل جعل التطبيق يستخدم المايكروفون عليك بمنح الإذن لذلك في إعدادت النظام." + "من أجل جعل التطبيق يظهر الإشعارات عليك أن تمنح الإذن في إعدادات النظام." + diff --git a/libraries/permissions/impl/src/main/res/values-ar/translations.xml b/libraries/permissions/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..5d9fb3e1e6 --- /dev/null +++ b/libraries/permissions/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,5 @@ + + + "يتحقق من قدرة التطبيق على عرض الإشعارات." + "التحقق من الأذونات" + diff --git a/libraries/push/impl/src/main/res/values-ar/translations.xml b/libraries/push/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..7b8e847c72 --- /dev/null +++ b/libraries/push/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,140 @@ + + + "إتصال" + "الاستماع إلى الأحداث" + "إشعارات الصاخبة" + "رنين المكالمات" + "إشعارات صامتة" + + "%1$s: %2$d رسائل" + "%1$s: %2$d رسالة" + "%1$s: %2$d رسالتان" + "%1$s: %2$d رسائل" + "%1$s: %2$d رسالة" + "%1$s: %2$d رسالة" + + + "%d إشعارات" + "%d إشعار" + "%d إشعاران" + "%d إشعارات" + "%d إشعار" + "%d إشعار" + + "تعذّر تسجيل موزّع إشعارات UnifiedPush، لذلك لن تتلقى إشعارات بعد الآن. يرجى التحقق من إعدادات إشعارات التطبيق وحالة موزّع الإشعارات الفورية." + "أتتك رسائل جديدة." + + "لديك %d رسائل جديدة." + "لديك %d رسالة جديدة." + "لديك %d رسالتان جديدتان." + "لديك %d رسائل جديدة." + "لديك %d رسالة جديدة." + "لديك %d رسالة جديدة." + + "📞 مكالمة واردة" + "📹 مكالمة واردة" + "** فشل الإرسال - يرجى فتح الغرفة" + "إنضمام" + "رفض" + + "%d دعوة" + "%d دعوة" + "%d دعوات" + "%d دعوات" + "%d دعوات" + "%d دعوات" + + "دعاك للتحدث" + "دعاك %1$s إلى الدردشة" + "طلبت الإنضمام" + "ذكرك: %1$s" + "رسائل جديدة" + + "%d رسالة جديدة" + "%d رسالة جديدة" + "%d من الرسائل الجديدة" + "%d من الرسائل الجديدة" + "%d من الرسائل الجديدة" + "%d من الرسائل الجديدة" + + "تفاعلت بـ %1$s" + "وضع علامة كمقروء" + "رد سريع " + "دعاك للانضمام للغرفة" + "دعاك %1$s للانضمام إلى الغرفة" + "أنا" + "إشارة أو رد من %1$s" + "دعاك للانضمام إلى المساحة" + "دعاك %1$s للانضمام إلى المساحة" + "إنك ترى الإشعارات! اضغط عليّ!" + "سلسلة في %1$s" + "%1$s:%2$s" + "%1$s:%2$s:%3$s" + + "%d رسالة مُعلَمة لم تُقرأ" + "%d رسالة مُعلَمة لم تُقرأ" + "%d من الرسائل المُعلَمة لم تُقرأ" + "%d من الرسائل المُعلَمة لم تُقرأ" + "%d من الرسائل المُعلَمة لم تُقرأ" + "%d من الرسائل المُعلَمة لم تُقرأ" + + "%1$s و %2$s" + "%1$s في %2$s" + "%1$s في %2$s و %3$s" + + "%d غرفة" + "%d غرفة" + "%d من الغرف" + "%d من الغرف" + "%d من الغرف" + "%d من الغرف" + + "المزامنة في الخلفية" + "خدمات Google" + "لم يتم العثور على خدمات Google صالحة. الإشعارات قد لا تعمل كما يجب." + "التحقق من المستخدمين المحظورين" + "عرض المستخدمين المحظورين" + "لا يوجد مستخدمون محظورون." + + "لقد حظرت %1$d مستخدمين. لن تتلقى إشعارات لهؤلاء المستخدمين." + "لقد حظرت %1$d مستخدم. لن تتلقى إشعارات لهذا المستخدم." + "لقد حظرت %1$d مستخدمين. لن تتلقى إشعارات لهذين المستخدمين." + "لقد حظرت %1$d مستخدمين. لن تتلقى إشعارات لهؤلاء المستخدمين." + "لقد حظرت %1$d مستخدمًا. لن تتلقى إشعارات لهؤلاء المستخدمين." + "لقد حظرت %1$d مستخدم. لن تتلقى إشعارات لهؤلاء المستخدمين." + + "المستخدمون المحظورون" + "يحصل على اسم الموفّر الحالي." + "لم يتم تحديد أي موفّر إشعارات فورية." + "موفّر الإشعارات الفورية الحالي: %1$s والموزّع الحالي: %2$s. لكن لم يتم العثور على الموزّع %3$s. ربما تم إلغاء تثبيت التطبيق؟" + "موفّر الإشعارات الفورية الحالي: %1$s، لكن لم يتم إعداد أي موزّعين." + "موفّر الإشعارات الفورية الحالي: %1$s." + "موفّر الإشعارات الفورية الحالي: %1$s (%2$s)" + "موفّر الإشعارات الفورية الحالي" + "يتحقق من أن التطبيق يدعم موفّر إشعارات فورية واحدًا على الأقل." + "لم يتم العثور على دعم لأي موفّر إشعارات فورية." + + "تم العثور على %1$d من موفّري الإشعارات الفورية: %2$s" + "تم العثور على %1$d موفّر إشعارات فورية: %2$s" + "تم العثور على %1$d من موفّري الإشعارات الفورية: %2$s" + "تم العثور على %1$d من موفّري الإشعارات الفورية: %2$s" + "تم العثور على %1$d من موفّري الإشعارات الفورية: %2$s" + "تم العثور على %1$d من موفّري الإشعارات الفورية: %2$s" + + "تم إنشاء التطبيق بدعم لـ: %1$s" + "دعم موفّر الإشعارات الفورية" + "يتحقق من قدرة التطبيق على عرض إشعار." + "لم يتم النقر على الإشعار." + "تعذّر عرض الإشعار." + "تم النقر على الإشعار!" + "عرض إشعار" + "يرجى النقر على الإشعار لمتابعة الاختبار." + "يتحقق من أن التطبيق يستقبل الإشعارات الفورية." + "خطأ: رفض موفّر الإشعارات الفورية الطلب." + "خطأ: %1$s." + "خطأ، تعذّر اختبار الإشعارات الفورية." + "خطأ، انتهت مهلة انتظار الإشعار الفوري." + "خطأ: بوابة الإشعارات الفورية تفرض قيودًا على معدّل استخدام هذا الجهاز، لذا لن تكون الإشعارات موثوقة. يُرجى إعداد بوابة إشعارات فورية أخرى." + "استغرق اختبار إرسال واستقبال الإشعارات الفورية %1$d مللي ثانية." + "اختبار إرسال واستقبال الإشعارات الفورية" + diff --git a/libraries/push/impl/src/main/res/values-es/translations.xml b/libraries/push/impl/src/main/res/values-es/translations.xml index 412d32bfb6..b66e05be05 100644 --- a/libraries/push/impl/src/main/res/values-es/translations.xml +++ b/libraries/push/impl/src/main/res/values-es/translations.xml @@ -13,7 +13,17 @@ "%d notificación" "%d notificaciones" + "No se pudo registrar el distribuidor de notificaciones de UnifiedPush, así que no recibirás más notificaciones. Comprueba los ajustes de notificaciones de la aplicación y el estado del distribuidor de push." "Tienes nuevos mensajes." + + "Tienes %d mensaje nuevo." + "Tienes %d mensajes nuevos." + + + "Se ha compartido %1$d archivo adjunto" + "Se han compartido %1$d archivos adjuntos" + + "📞 Llamada entrante" "📹 Llamada entrante" "** No se ha podido enviar - por favor, abre la sala" "Unirse" @@ -24,6 +34,7 @@ "Te invitó a chatear" "%1$s te invitó a chatear" + "Comenzó a compartir su ubicación en tiempo real" "Te mencionó: %1$s" "Mensajes nuevos" @@ -37,7 +48,10 @@ "%1$s te invitó a unirte a la sala" "Yo" "%1$s mencionó o respondió" + "Te invitó a unirte al espacio" + "%1$s te invitó a unirte al espacio" "¡Estás viendo la notificación! ¡Haz clic en mí!" + "Hilo en %1$s" "%1$s: %2$s" "%1$s: %2$s %3$s" @@ -54,10 +68,20 @@ "Sincronización en segundo plano" "Servicios de Google" "No se han encontrado Servicios de Google Play válidos. Es posible que las notificaciones no funcionen correctamente." + "Comprobando usuarios bloqueados" + "Ver usuarios bloqueados" + "No hay usuarios bloqueados." + + "Has bloqueado %1$d usuario. No recibirás notificaciones de este usuario." + "Has bloqueado %1$d usuarios. No recibirás notificaciones de estos usuarios." + "Usuarios bloqueados" "Obtener el nombre del proveedor actual." "No se ha seleccionado ningún proveedor de push." + "Proveedor de push actual: %1$s y distribuidor actual: %2$s. Pero no se encuentra el distribuidor %3$s. ¿Quizás se ha desinstalado la aplicación?" + "Proveedor de push actual: %1$s, pero no se ha configurado ningún distribuidor." "Proveedor de push actual: %1$s." + "Proveedor de push actual: %1$s (%2$s)" "Proveedor de push actual" "Asegurarse de que la aplicación tiene al menos un proveedor de push." "No se encontró ningún proveedor de push." diff --git a/libraries/push/impl/src/main/res/values-fa/translations.xml b/libraries/push/impl/src/main/res/values-fa/translations.xml index 4afd68e17b..f1c70c7f08 100644 --- a/libraries/push/impl/src/main/res/values-fa/translations.xml +++ b/libraries/push/impl/src/main/res/values-fa/translations.xml @@ -13,7 +13,17 @@ "%dاعلان" "%dاعلان‌" + "توزیع‌کننده اعلان UnifiedPush قابل ثبت نیست، بنابراین دیگر اعلانی دریافت نخواهید کرد. لطفاً تنظیمات اعلان‌های برنامه و وضعیت توزیع‌کننده اعلان را بررسی کنید." "پیام‌های جدیدی دارید." + + "شما یک پیام جدید %d دارید." + "شما پیام‌های جدید %d دارید." + + + "پیوست %1$d مشترک" + "پیوست‌های %1$d مشترک" + + "📞 تماس ورودی" "📹 تماس ورودی" "**‌شکست در فرستادن - لطفاً اتاق را بگشایید" "پیوستن" @@ -24,6 +34,7 @@ "به گپ دعوتتان کرد" "%1$s به گپ دعوتتان کرد" + "شروع به اشتراک گذاری موقعیت مکانی زنده خود کردند" "به شما اشاره کرد: %1$s" "پیام جدید" @@ -37,7 +48,10 @@ "%1$s دعوت کرد به اتاق بپیوندید" "خودم" "%1$s اشاره کرد یا پاسخ داد" + "از شما دعوت شد تا به این فضا بپیوندید" + "%1$s از شما دعوت کرد تا به این فضا بپیوندید" "دارید آگاهی را مشاهده می‌کنید! کلیک کنید!" + "رزوه در %1$s" "%1$s: %2$s" "%1$s: %2$s %3$s" @@ -54,13 +68,28 @@ "همگام سازی پس‌زمینه" "خدمات گوگل" "خدمت پلی گوگل معتبری پیدا نشد. ممکن است آگاهی‌ها به درستی کار نکنند." + "بررسی کاربران مسدود شده" + "مشاهده کاربران مسدود شده" + "هیچ کاربری مسدود نشده است." + + "شما کاربر %1$d را مسدود کرده‌اید. شما اعلان‌هایی برای این کاربر دریافت نخواهید کرد." + "شما کاربران %1$d را مسدود کرده‌اید. برای این کاربران اعلان دریافت نخواهید کرد." + "کاربران مسدود" "گرفتن نام فراهم کنندهٔ کنونی." "هیچ فراهم کنندهٔ ارسالی گزیده نشده." + "ارائه دهنده فعلی پوش: %1$s و توزیع کننده فعلی: %2$s. اما توزیع کننده %3$s پیدا نشد. شاید برنامه حذف نصب شده باشد؟" + "ارائه دهنده فشار فعلی: %1$s، اما هیچ توزیع کننده ای پیکربندی نشده است." "فراهم کنندهٔ ارسال کنونی: %1$s." + "ارائه دهنده خدمات فشار فعلی: %1$s (%2$s)" "فراهم کنندهٔ ارسال کنونی" "ازمینان از پشتیبانی برنامه از لااقل یک فراهم کنندهٔ ارسال." "پشتیبانی از هیچ فراهم کنندهٔ ارسالی پیدا نشد." + + "ارائه دهنده فشار %1$d یافت شد: %2$s" + "ارائه دهندگان فشار %1$d یافت شد: %2$s" + + "این برنامه با پشتیبانی از موارد زیر ساخته شده است: %1$s" "پشتیبانی از فراهم‌کنندهٔ ارسال" "بررسی توانایی برنامه در نمایش آگاهی." "روی آگاهی زده نشد." diff --git a/libraries/push/impl/src/main/res/values-fi/translations.xml b/libraries/push/impl/src/main/res/values-fi/translations.xml index 24c10e8e69..0d8f486663 100644 --- a/libraries/push/impl/src/main/res/values-fi/translations.xml +++ b/libraries/push/impl/src/main/res/values-fi/translations.xml @@ -19,6 +19,10 @@ "Sinulla on %d uusi viesti." "Sinulla on %d uutta viestiä." + + "Jakoi %1$d liitteen" + "Jakoi %1$d liitettä" + "📞 Saapuva puhelu" "📹 Saapuva puhelu" "** Lähetys epäonnistui - avaa huone" @@ -30,6 +34,7 @@ "Kutsui sinut keskustelemaan" "%1$s kutsui sinut keskustelemaan" + "Aloitti reaaliaikaisen sijainnin jakamisen" "Mainitsi sinut: %1$s" "Uusia viestejä" diff --git a/libraries/push/impl/src/main/res/values-fr/translations.xml b/libraries/push/impl/src/main/res/values-fr/translations.xml index 1b0c44d90e..6c129cd3ed 100644 --- a/libraries/push/impl/src/main/res/values-fr/translations.xml +++ b/libraries/push/impl/src/main/res/values-fr/translations.xml @@ -19,6 +19,10 @@ "Vous avez %d nouveau message." "Vous avez %d nouveaux messages." + + "%1$d attachement partagé" + "%1$d attachements partagés" + "📞 Appel entrant" "📹 Appel entrant" "** Échec de l’envoi - veuillez ouvrir le salon" @@ -30,6 +34,7 @@ "Vous a invité(e) à discuter" "%1$s vous a invité à discuter" + "A commencé à partager sa position en direct" "Mentionné(e) : %1$s" "Nouveaux messages" diff --git a/libraries/push/impl/src/main/res/values/localazy.xml b/libraries/push/impl/src/main/res/values/localazy.xml index 4977a9cf3d..bbe6f958b9 100644 --- a/libraries/push/impl/src/main/res/values/localazy.xml +++ b/libraries/push/impl/src/main/res/values/localazy.xml @@ -34,6 +34,7 @@ "Invited you to chat" "%1$s invited you to chat" + "Requested to join" "Started sharing their live location" "Mentioned you: %1$s" "New Messages" @@ -102,6 +103,7 @@ "Error: %1$s." "Error, cannot test push." "Error, timeout waiting for push." + "Error: the push gateway is rate limiting this device, so notifications won\'t be reliable. Please set up a different push gateway." "Push loop back took %1$d ms." "Test Push loop back" diff --git a/libraries/pushproviders/firebase/src/main/res/values-ar/translations.xml b/libraries/pushproviders/firebase/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..e5229be2f3 --- /dev/null +++ b/libraries/pushproviders/firebase/src/main/res/values-ar/translations.xml @@ -0,0 +1,11 @@ + + + "يتحقق من توفر Firebase." + "Firebase غير متاح." + "Firebase متاح." + "التحقق من Firebase" + "يتحقق من توفر رمز Firebase المميز." + "رمز Firebase المميز غير معروف." + "رمز Firebase المميز: %1$s." + "التحقق من رمز Firebase المميز" + diff --git a/libraries/pushproviders/unifiedpush/src/main/res/values-ar/translations.xml b/libraries/pushproviders/unifiedpush/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..355ceef22d --- /dev/null +++ b/libraries/pushproviders/unifiedpush/src/main/res/values-ar/translations.xml @@ -0,0 +1,14 @@ + + + "يتحقق من توفر موزّعي UnifiedPush." + "لم يتم العثور على أي موزّع UnifiedPush." + + "تم العثور على %1$d من موزّعي UnifiedPush: %2$s." + "تم العثور على %1$d موزّع UnifiedPush: %2$s." + "تم العثور على %1$d من موزّعي UnifiedPush: %2$s." + "تم العثور على %1$d من موزّعي UnifiedPush: %2$s." + "تم العثور على %1$d من موزّعي UnifiedPush: %2$s." + "تم العثور على %1$d من موزّعي UnifiedPush: %2$s." + + "التحقق من UnifiedPush" + diff --git a/libraries/pushproviders/unifiedpush/src/main/res/values-fa/translations.xml b/libraries/pushproviders/unifiedpush/src/main/res/values-fa/translations.xml index c80e952967..af2f5f6bad 100644 --- a/libraries/pushproviders/unifiedpush/src/main/res/values-fa/translations.xml +++ b/libraries/pushproviders/unifiedpush/src/main/res/values-fa/translations.xml @@ -2,5 +2,9 @@ "اطمینان از در دسترس بودن توزیعگرهای ارسال یکپارچه." "هیچ توزیعگر ارسال یکپارچه‌ای پیدا نشد." + + "توزیع‌کننده‌ی %1$d پیدا شد: %2$s." + "توزیع‌کنندگان %1$d موارد زیر را یافتند: %2$s." + "بررسی ارسال یکپارچه" diff --git a/libraries/textcomposer/impl/src/main/res/values-ar/translations.xml b/libraries/textcomposer/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..594a06ab15 --- /dev/null +++ b/libraries/textcomposer/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,33 @@ + + + "إضافة مرفق" + "تبديل قائمة النقاط" + "إلغاء وإغلاق خيارات تنسيق النص" + "تبديل كتلة التعليمات البرمجية" + "أضف تعليقًا توضيحيًا" + "رسالة مشفّرة…" + "راسل…" + "رسالة غير مشفّرة…" + "إنشاء رابط" + "تعديل الرابط" + "%1$s، الحالة: %2$s" + "تطبيق التنسيق الغامق" + "تطبيق التنسيق المائل" + "معطّل" + "غير مفعّل" + "مفعّل" + "تطبيق التنسيق الذي يتوسّطه خط" + "تطبيق التنسيق الذي تحته خط" + "تبديل وضع ملء الشاشة" + "ترك مسافة بادئة" + "تطبيق تنسيق الكود المضمن" + "تعيين الرابط" + "تبديل القائمة المرقمة" + "فتح خيارات كتابة الرسالة" + "تبديل الاقتباس" + "حذف الرابط" + "إزالة المسافة البادئة" + "الرابط" + "قد لا تكون التعليقات التوضيحية مرئية للأشخاص الذين يستخدمون تطبيقات أقدم." + "اضغط مطولًا للتسجيل" + diff --git a/libraries/textcomposer/impl/src/main/res/values-es/translations.xml b/libraries/textcomposer/impl/src/main/res/values-es/translations.xml index 68b8b7b02c..16016658e5 100644 --- a/libraries/textcomposer/impl/src/main/res/values-es/translations.xml +++ b/libraries/textcomposer/impl/src/main/res/values-es/translations.xml @@ -10,9 +10,12 @@ "Mensaje no cifrado…" "Crear un enlace" "Editar enlace" + "%1$s, estado: %2$s" "Aplicar formato negrita" "Aplicar formato cursiva" "deshabilitado" + "desactivado" + "activado" "Aplicar formato tachado" "Aplicar formato de subrayado" "Pantalla completa" diff --git a/libraries/textcomposer/impl/src/main/res/values-fa/translations.xml b/libraries/textcomposer/impl/src/main/res/values-fa/translations.xml index fd55fdf9d9..c3fcffc642 100644 --- a/libraries/textcomposer/impl/src/main/res/values-fa/translations.xml +++ b/libraries/textcomposer/impl/src/main/res/values-fa/translations.xml @@ -28,5 +28,6 @@ "برداشتن پیوند" "تونرفتگی" "پیوند" + "ممکن است زیرنویس‌ها برای افرادی که از برنامه‌های قدیمی‌تر استفاده می‌کنند قابل مشاهده نباشند." "نگه داشتن برای ضبط" diff --git a/libraries/troubleshoot/impl/src/main/res/values-ar/translations.xml b/libraries/troubleshoot/impl/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..85331aa86a --- /dev/null +++ b/libraries/troubleshoot/impl/src/main/res/values-ar/translations.xml @@ -0,0 +1,12 @@ + + + "سجل الإشعارات الفورية" + "تشغيل الاختبارات" + "تشغيل الاختبارات مرة أخرى" + "فشلت بعض الاختبارات. يرجى التحقق من التفاصيل." + "شغّل الاختبارات لاكتشاف أي مشكلة في إعداداتك قد تجعل الإشعارات لا تعمل كما هو متوقع." + "محاولة الإصلاح" + "اجتازت جميع الاختبارات بنجاح." + "استكشاف أخطاء الإشعارات وإصلاحها" + "تتطلب بعض الاختبارات انتباهك. يرجى التحقق من التفاصيل." + diff --git a/libraries/ui-strings/src/main/res/values-ar/translations.xml b/libraries/ui-strings/src/main/res/values-ar/translations.xml new file mode 100644 index 0000000000..d8862e6dc7 --- /dev/null +++ b/libraries/ui-strings/src/main/res/values-ar/translations.xml @@ -0,0 +1,611 @@ + + + "أضف صورة رمزية" + "أضف تفاعل: %1$s" + "العنوان" + "الصورة الرمزية" + "مسح حقل البحث" + "تصغير حقل نص الرسالة" + "تقليل عدد الأصوات المسموح بها لكل شخص" + "زيادة عدد الأصوات المسموح بها لكل شخص" + "احذف" + + "تم إدخال %1$d أرقام" + "تم إدخال %1$d رقم" + "تم إدخال %1$d رقمين" + "تم إدخال %1$d أرقام" + "تم إدخال %1$d رقمًا" + "تم إدخال %1$d رقم" + + "المدة: %1$s" + "تعديل الصورة الرمزية" + "العنوان الكامل سيكون %1$s" + "تفاصيل التشفير" + "تكبير حقل نص الرسالة" + "أخفِ كلمة السر" + "معلومات" + "انضم للمكالمة" + "الانتقال للأسفل" + "الانتقال إلى الرسائل غير المقروءة" + "انقل الخريطة إلى موقعي" + "الإشارات فقط" + "مكتوم" + "إشارات جديدة" + "رسائل جديدة" + "مكالمة جارية" + "صورة رمزية لمستخدم آخر" + "الصفحة %1$d" + "إيقاف مؤقت" + "الرسالة الصوتية، المدة: %1$s ، الموضع الحالي: %2$s" + "معاينة الصورة" + "حقل الرمز السري (PIN) " + "موقع محدد" + "تشغيل" + "سرعة التشغيل" + "استفتاء" + "استفتاء منتهٍ" + "الموضع: %1$s" + "رمز QR" + "تفاعل مع %1$s" + "تفاعل مع الرموز التعبيرية الأخرى" + "قرأ %1$s و%2$s الرسالة السابقة" + + "قرأ %1$s و%2$d آخرون الرسالة السابقة" + "قرأ %1$s و%2$d آخر الرسالة السابقة" + "قرأ %1$s و%2$d آخران الرسالة السابقة" + "قرأ %1$s و%2$d آخرون الرسالة السابقة" + "قرأ %1$s و%2$d آخر الرسالة السابقة" + "قرأ %1$s و%2$d آخر الرسالة السابقة" + + "قرأ %1$s الرسالة السابقة" + "إظهار كل إيصالات القراءة" + "أزِل التفاعل: %1$s" + "أزِل التفاعل بـ %1$s" + "الصورة الرمزية للغرفة" + "إرسال ملفات" + "موقع المرسل" + "أرسلها %1$s في %2$s" + "إجراء مقيد زمنياً، لديك دقيقة واحدة للتحقق " + "الإعدادات، إجراء مطلوب" + "إظهار كلمة السر" + "بدء مكالمة" + "بدء مكالمة فيديو" + "بدء مكالمة صوتية" + "سلسلة في %1$s" + "سلاسل في %1$s" + "غرفة مستبدلة" + "الصورة الرمزية للمستخدم" + "قائمة المستخدم" + "معاينة الفيديو" + "عرض الصورة الرمزية" + "عرض التفاصيل" + "رسالة صوتية، المدة: %1$s" + "تسجيل رسالة صوتية." + "إيقاف التسجيل" + "الصورة الرمزية الخاصة بك" + "قبول" + "أضف وصف" + "إضافة غرف موجودة" + "أضف إلى الجدول الزمني" + "رجوع" + "مكالمة" + "الغاء" + "ليس الآن" + "اختيار ملف" + "اختيار صورة" + "مسح" + "إغلاق" + "أتمم التحقق" + "تأكيد" + "تأكيد كلمة المرور" + "المتابعة" + "نسخ" + "نسخ التعليق التوضيحي" + "نسخ الرابط" + "نسخ رابط الرسالة" + "انسخ النص" + "إنشاء" + "إنشاء غرفة" + "إنشاء مساحة" + "تعطيل" + "تعطيل الحساب" + "رفض" + "رفض وحظر" + "حذف" + "حذف الحساب" + "حذف الملف" + "حذف الاستطلاع" + "إلغاء تحديد الكل" + "تعطيل" + "تجاهل" + "إغلاق" + "تم" + "تنزيل" + "تعديل" + "تعديل التعليق التوضيحي" + "تعديل الاستفتاء" + "تمكين" + "إنهاء الاستفتاء" + "إدخال رمز PIN" + "استكشاف المساحات العامة" + "إنهاء" + "أنسيت كلمة السر؟" + "إعادة توجيه" + "ارجع" + "الانتقال إلى الأدوار والصلاحيات" + "اذهب إلى الإعدادات" + "تجاهل" + "دعوة " + "دعوة أشخاص" + "قم بدعوة الأصدقاء إلى %1$s" + "دعوة أشخاص إلى %1$s" + "الدعوات" + "إنضمام" + "تعلم المزيد" + "مغادرة" + "مغادرة المحادثة" + "مغادرة الغرفة" + "مغادرة المساحة" + "تحميل المزيد" + "إدارة الحساب" + "إدارة الحساب والأجهزة" + "إدارة الأجهزة" + "إدارة الغرف" + "إرسال رسالة" + "تصغير" + "التالي" + "لا" + "ليس الآن" + "حسناً" + "فتح قائمة السياق" + "الإعدادات" + "فتح باستخدام" + "تثبيت" + "رد سريع " + "عبارة" + "تفاعَل" + "رفض" + "ازالة" + "إزالة التعليق التوضيحي" + "إزالة الرسالة" + "رد" + "ردّ في ثريد" + "إبلاغ" + "الإبلاغ عن مشكلة" + "الابلاغ عن المحتوى" + "الإبلاغ عن المحادثة" + "الإبلاغ عن الغرفة" + "إعادة تعيين" + "إعادة تعيين الهوية" + "اعادة المحاولة" + "أعد محاولة فك التشفير" + "حفظ" + "بحث" + "تحديد الكل" + "ارسال" + "إرسال الرسالة المعدّلة" + "أرسل رسالة" + "إرسال رسالة صوتية" + "مشاركة" + "مشاركة رابط" + "مشاركة الموقع المباشر" + "إظهار" + "تسجيل الدخول مرة أخرى" + "إزالة هذا الجهاز" + "إزالة هذا الجهاز على أي حال" + "تخطي" + "ابدأ" + "ابدأ المحادثة" + "البدء من جديد" + "ابدأ التحقق" + "انقر لتحميل الخريطة" + "إيقاف" + "التقاط صورة" + "اضغط لعرض الخيارات" + "ترجمة" + "حاول مرة أخرى" + "إلغاء التثبيت" + "مكالمة فيديو" + "عرض" + "عرض في المخطط الزمني" + "عرض المصدر" + "مكالمة صوتية" + "نعم" + "نعم، حاول مرة أخرى" + "يدعم خادمك الآن بروتوكولًا جديدًا أسرع. سجّل الخروج ثم سجّل الدخول مرة أخرى للترقية الآن. سيساعدك القيام بذلك الآن على تجنب تسجيل خروج قسري عند إزالة البروتوكول القديم لاحقًا." + "ترقية متاحة" + "حول التطبيق" + "سياسة الاستخدام المقبول" + "إضافة حساب" + "إضافة حساب آخر" + "جارٍ إضافة تعليق توضيحي" + "إعدادات متقدمة" + "صورة" + "التحليلات" + "قمتَ بمغادرة المجموعة" + "تم تسجيل خروجك من الجلسة" + "المظهر" + "الصوت" + "تجريبي" + "المستخدمون المحظورون" + "فقاعات" + "تم رفض المكالمة" + "مكالمة جارية" + "بدأت المكالمة" + "رفضت مكالمة" + "النسخ الاحتياطي للدردشة" + "تم النسخ إلى الحافظة" + "حقوق الملكية" + "يتم إنشاء الغرفة…" + "جارٍ إنشاء المساحة…" + "تم إلغاء الطلب" + "غادرت الغرفة" + "غادرت المساحة" + "تم رفض الدعوة" + "خطأ في فك التشفير" + "الوصف" + "خيارات المطوِّرين" + "معرّف الجهاز" + "الدردشة المباشرة" + "عدم إظهار هذا مرة أخرى" + "فشل التنزيل" + "جارٍ التنزيل" + "(مُعدّلة)" + "تعديل" + "جارٍ تعديل التعليق التوضيحي" + "* %1$s %2$s" + "ملف فارغ" + "التشفير" + "التشفير مفعّل" + "ينتهي عند %1$s" + "أدخل رمز PIN الخاص بك" + "خطأ" + "حدث خطأ، قد لا تتلقى إشعارات للرسائل الجديدة. يرجى استكشاف أخطاء الإشعارات وإصلاحها من الإعدادات. + +السبب: %1$s." + "الجميع" + "فشل" + "مفضلة" + "مضافة إلى المفضلة" + "جارٍ مزامنة الإشعارات…" + "ملف" + "تمت إزالة الملف" + "تم حفظ الملف" + "تم حفظ الملف في التنزيلات" + "إعادة توجيه الرسالة" + "المستخدمة بكثرة" + "المعرض" + "GIF" + "مكالمة جماعية جارية" + "صورة" + "ردٌّ على %1$s" + "تثبيت ملف الـAPK" + "لم يتم العثور على الـMatrix ID هذا، ولذا فالدعوة قد لا تكون وصلت." + "تتم مغادرة المجموعة" + "جارٍ مغادرة المساحة" + "تم نسخ السطر إلى الحافظة" + "تم نسخ الرابط إلى الحافظة" + "ربط جهاز جديد" + "الموقع المباشر" + "انتهت مشاركة الموقع المباشر" + "جارٍ التحميل…" + "جارٍ تحميل المزيد…" + + "%d آخرون" + "%d آخر" + "%d آخران" + "%d آخرون" + "%d آخر" + "%d آخر" + + + "%1$d أعضاء" + "%1$d عضو" + "%1$d عضو" + "%1$d أعضاء" + "%1$d عضو" + "%1$d عضو" + + "رسالة" + "إجراءات الرسالة" + "فشل إرسال الرسالة" + "مظهر الرسائل" + "حُذِفت الرسالة" + "حديث" + "كتم" + "الاسم" + "%1$s (%2$s)" + "لا نتائج" + "لا يوجد اسم للغرفة" + "لا يوجد اسم للمساحة" + "غير مشفّر" + "غير متصل" + "تراخيص المصادر المفتوحة" + "أو" + "خيارات أخرى" + "كلمة السر" + "الأشخاص" + "الرابط الثابت" + "الإذن" + "مثبّتة" + "يرجى التحقق من اتصالك بالإنترنت" + "يرجى الانتظار…" + "أمتأكد من رغبتك بإنهاء الاستفتاء؟" + "استفتاء: %1$s" + "استطلاع" + "مجموع الأصوات: %1$s" + "ستظهر النتائج في حين انتهاء الاستفتاء" + + "%d صوت" + "%d صوت" + "%d صوت" + "%d أصوات" + "%d صوت" + "%d صوت" + + "جارٍ التحضير…" + "سياسة الخصوصية" + "خاصة" + "غرفة خاصة" + "مساحة خاصة" + "عامة" + "غرفة عامة" + "مساحة عامة" + "التفاعل" + "ردود الفعل" + "السبب" + "مفتاح الاسترداد" + "يتم التحديث…" + "جارٍ الإزالة…" + + "%1$d ردود" + "%1$d رد" + "%1$d ردّان" + "%1$d ردود" + "%1$d ردًا" + "%1$d رد" + + "الرد على %1$s" + "الإبلاغ عن مشكلة" + "أُرسِل الإبلاغ" + "محرر النص المنسق" + "الدور" + "غرفة" + "اسم الغرفة" + "مثال: اسم مشروعك" + + "%1$d غرف" + "%1$d غرفة" + "%1$d غرفتان" + "%1$d غرف" + "%1$d غرفة" + "%1$d غرفة" + + "تم حفظ التغييرات" + "جارٍ الحفظ" + "قفل الشاشة" + "اِبحث عن شخص ما" + "نتائج البحث" + "الأمان" + "شوهد بواسطة" + "اختر حسابًا" + + "تم تحديد %1$d" + "تم تحديد %1$d" + "تم تحديد %1$d" + "تم تحديد %1$d" + "تم تحديد %1$d" + "تم تحديد %1$d" + + "إرسال إلى" + "جارٍ الإرسال…" + "فشل الإرسال" + "تم الإرسال" + ". " + "السيرفر غير مدعوم" + "الخادم غير متاح" + "عنوان URL للسيرفر" + "الإعدادات" + "مشاركة المساحة" + "يمكن للأعضاء الجدد رؤية السجل" + "تمت مشاركة الموقع المباشر" + "الموقع المشارَك" + "مساحة مشتركة" + "جارٍ إزالة الجهاز" + "حدث خطأ ما" + "واجهنا مشكلة. يرجى المحاولة مرة أخرى." + "مساحة" + "أعضاء المساحة" + "ما موضوع هذه المساحة؟" + + "%1$d مساحات" + "%1$d مساحة" + "%1$d مساحتان" + "%1$d مساحات" + "%1$d مساحة" + "%1$d مساحة" + + "يتم بدء المحادثة…" + "مُلصَق" + "تمت العملية بنجاح" + "مقترح" + "اقتراحات" + "تتم المزامنة" + "نص" + "إشعارات الجهات الخارجية" + "ثريد" + "السلاسل" + "الموضوع" + "ما موضوع هذه الغرفة؟" + "غير قادر على فك التشفير" + "أُرسلت من جهاز غير آمن" + "ليس لديك صلاحية الوصول إلى هذه الرسالة" + "تمت إعادة تعيين الهوية الرقمية الموثّقة للمرسل" + "لم يتم التمكن من إرسال الدعوة إلى عضو أو أكثر." + "غير قادر على إرسال الدعوة (الدعوات)" + "إلغاء القفل" + "إلغاء الكتم" + "مكالمة غير مدعومة" + "حدث غير مدعوم" + "بدأ %1$s مكالمة" + "اسم المستخدم" + "أُلغيَ التحقق" + "اكتمل التحقق" + "فشل التحقق" + "تم التحقق" + "التحقّق من الجهاز" + "تحقّق من الهوية" + "تحقّق من المستخدم" + "فيديو" + "جودة عالية" + "أفضل جودة، لكن بحجم ملف أكبر" + "جودة منخفضة" + "أسرع سرعة رفع وأصغر حجم ملف" + "جودة قياسية" + "توازن بين الجودة وسرعة الرفع" + "رسالة صوتية" + "جارٍ الانتظار…" + "في انتظار هذه الرسالة" + "في انتظار الموقع المباشر…" + "يمكن لأي شخص رؤية السجل" + "أنت" + "التنزيل غير متاح." + "لم يتم العثور على الملف" + "جاري المسح…" + "تم تعطيل المعاينة والتنزيل." + "الملف غير آمن" + "شارك %1$s (%2$s) هذه الرسالة لأنك لم تكن في الغرفة عند إرسالها." + "شارك %1$s هذه الرسالة لأنك لم تكن في الغرفة عند إرسالها." + "تم إعداد هذه الغرفة بحيث يمكن للأعضاء الجدد قراءة السجل. %1$s" + "تمت إعادة تعيين الهوية الرقمية لـ %1$s. %2$s" + "تمت إعادة تعيين الهوية الرقمية الخاصة بـ %1$s %2$s. %3$s" + "(%1$s)" + "تمت إعادة تعيين الهوية الرقمية الخاصة بـ %1$s." + "تمت إعادة تعيين الهوية الرقمية الخاصة بـ %1$s %2$s. %3$s" + "إلغاء التحقق" + "السماح بالوصول" + "ينقلك الرابط %1$s إلى موقع آخر %2$s + +هل أنت متأكد من رغبتك في المتابعة؟" + "تحقّق جيدًا من هذا الرابط" + "اختر الجودة الافتراضية للفيديوهات التي ترفعها." + "جودة رفع الفيديو" + "الحد الأقصى المسموح به لحجم الملف هو: %1$s" + "حجم الملف كبير جدًا ولا يمكن رفعه" + "تم الإبلاغ عن الغرفة" + "تم الإبلاغ عن الغرفة ومغادرتها" + "التأكيد" + "خطأ" + "تمت العملية بنجاح" + "تحذير" + "لديك تغييرات غير محفوظة." + "لم تُحفظ تغييراتك. هل أنت متأكد من أنك تريد الرجوع؟" + "حفظ التغييرات؟" + "الحد الأقصى المسموح به لحجم الملف هو: %1$s" + "اختر جودة الفيديو الذي تريد رفعه." + "اختر جودة رفع الفيديو" + "لقد سجّلت الدخول بالفعل على هذا الجهاز باسم %1$s." + "يجب ترقية خادمك المنزلي لدعم Matrix Authentication Service وإنشاء الحسابات." + "فشِل إنشاء رابطٍ دائم (permalink)" + "%1$s لم يستطع تحميل الخريطة. يرجى المحاولة مجدداً لاحقاً." + "فشِل تحميل الرسائل" + "%1$s لم يستطع الوصول إلى موقعك. يرجى المحاولة مجدداً لاحقاً." + "تعذّر رفع رسالتك الصوتية." + "لم تعد الغرفة موجودة أو لم تعد الدعوة صالحة." + "يرجى تفعيل GPS للوصول إلى الميزات المستندة إلى الموقع." + "لم يتم العثور على الرسالة" + "لا يملك %1$s الإذن بالوصول إلى موقعك. يمكنك تفعيل وصوله في الإعدادات." + "لا يملك %1$s الإذن بالوصول إلى موقعك. فعّل وصوله تحت." + "ليس لدى %1$s إذن للوصول إلى الميكروفون. اسمح بالوصول لتسجيل رسالة صوتية." + "قد يكون ذلك بسبب مشكلات في الشبكة أو الخادم." + "عنوان الغرفة هذا موجود بالفعل. يرجى محاولة تعديل حقل عنوان الغرفة أو تغيير اسم الغرفة" + "بعض الأحرف غير مسموح بها. يُسمح فقط بالحروف والأرقام والرموز التالية: ! $ & ‘ ( ) * + / ; = ? @ [ ] - . _" + "لم تُرسَل بعض الرسائل" + "عذراً، قد حدث خطأ" + "🔐️ انضم إليّ في %1$s" + "مرحباً، راسلني في %1$s: %2$s" + "مشاركة الموقع المباشر" + "جارٍ مشاركة الموقع" + "%1$s - الموقع المباشر" + "%1$s Android" + "رجّ الهاتف للإبلاغ عن خطأ" + "لقطة شاشة" + "%1$s: %2$s" + "الخيارات" + "إزالة %1$s" + "الإعدادات" + "الأصوات المسموح بها لكل شخص" + "لا يشارك أحد موقعه" + "مشاركة الموقع المباشر" + + "%1$d أشخاص" + "%1$d شخص" + "%1$d شخصان" + "%1$d أشخاص" + "%1$d شخصًا" + "%1$d شخص" + + "على الخريطة" + "تعذّر اختيار الوسائط، يرجى المحاولة مجدداً." + "اضغط على رسالة واختر “%1$s” لإضافتها هنا." + "ثبّت الرسائل المهمة لتسهيل العثور عليها" + + "%1$d رسائل مثبّتة" + "%1$d رسالة مثبّتة" + "%1$d رسالتان مثبّتتان" + "%1$d رسائل مثبّتة" + "%1$d رسالة مثبّتة" + "%1$d رسالة مثبّتة" + + "الرسائل المثبّتة" + "أنت على وشك الانتقال إلى حسابك على %1$s لإعادة تعيين هويتك الرقمية. بعد ذلك ستعود إلى التطبيق." + "لا يمكنك التأكيد؟ انتقل إلى حسابك لإعادة تعيين هويتك الرقمية." + "إلغاء التحقق والإرسال" + "يمكنك إلغاء التحقق الذي أجريته وإرسال هذه الرسالة على أي حال، أو الإلغاء في الوقت الحالي والمحاولة مرة أخرى لاحقًا بعد إعادة التحقق من %1$s." + "لم تُرسل رسالتك لأن الهوية الرقمية الموثّقة لـ %1$s أُعيد تعيينها" + "إرسال الرسالة على أي حال" + "يستخدم %1$s جهازًا واحدًا أو أكثر لم يتم التحقق منه. يمكنك إرسال الرسالة على أي حال، أو الإلغاء في الوقت الحالي والمحاولة مرة أخرى لاحقًا بعد أن يتحقق %2$s من جميع أجهزته." + "لم تُرسل رسالتك لأن %1$s لم يتحقق من جميع الأجهزة" + "لم يتم التحقق من جهاز واحد أو أكثر من أجهزتك. يمكنك إرسال الرسالة على أي حال، أو الإلغاء في الوقت الحالي والمحاولة مرة أخرى لاحقًا بعد أن تتحقق من جميع أجهزتك." + "لم تُرسل رسالتك لأنك لم تتحقق من جهاز واحد أو أكثر من أجهزتك" + "تعديل المسؤولين أو المالكين" + "تعذّرت معالجة الوسائط من أجل رفعها، يرجى المحاولة مجدداً." + "تعذّر استرداد معلومات المستخدم" + "رسالة في %1$s" + "توسيع" + "طي" + "مشاركة الموقع المباشر" + "أنت في هذه الغرفة بالفعل!" + "%1$s من %2$s" + "%1$s رسائل مثبّتة" + "جارٍ تحميل الرسالة…" + "عرض الكل" + "الدردشة" + "مشاركة موقع" + "شارك موقعي" + "فتح في Apple Maps" + "فتح في Google Maps" + "فتح في OpenStreetMap" + "مشاركة الموقع الجغرافي المُحدّد" + "خيارات المشاركة" + "المساحات التي أنشأتها أو انضممت إليها." + "%1$s • %2$s" + "أنشئ مساحات لتنظيم الغرف" + "مساحة %1$s" + "المساحات" + "تمت المشاركة %1$s" + "على الخريطة" + "لم تُرسل الرسالة لأن الهوية الرقمية الموثّقة لـ %1$s أُعيد تعيينها." + "لم تُرسل الرسالة لأن %1$s لم يتحقق من جميع الأجهزة." + "لم تُرسل الرسالة لأنك لم تتحقق من جهاز واحد أو أكثر من أجهزتك." + "الموقع" + "الإصدار: %1$s (%2$s)" + "ar" + "الرسائل السابقة غير متاحة على هذا الجهاز" + "يجب التحقق من هذا الجهاز للوصول إلى الرسائل السابقة" + "ليس لديك صلاحية الوصول إلى هذه الرسالة" + "تعذّر فك تشفير الرسالة" + "تم حظر هذه الرسالة إما لأنك لم تتحقق من جهازك أو لأن المرسل يحتاج إلى التحقق من هويتك الرقمية." + "جهازك قديم جدًا؛ يلزم جهاز يعمل بنظام Android 8 أو أحدث." + "عرض الخرائط غير مدعوم" + diff --git a/libraries/ui-strings/src/main/res/values-es/translations.xml b/libraries/ui-strings/src/main/res/values-es/translations.xml index c068e23d6c..223b8aa457 100644 --- a/libraries/ui-strings/src/main/res/values-es/translations.xml +++ b/libraries/ui-strings/src/main/res/values-es/translations.xml @@ -1,51 +1,101 @@ + "Añadir avatar" "Añadir reacción: %1$s" + "Dirección" "Avatar" + "Borrar consulta" + "Minimizar el campo de texto del mensaje" + "Disminuir el número de votos permitidos por persona" + "Aumentar el número de votos permitidos por persona" + "Emoji personalizado" "Borrar" "%1$d dígito introducido" "%1$d dígitos introducidos" + "Duración: %1$s" + "Editar avatar" + "La dirección completa será %1$s" + "Detalles de cifrado" + "Expandir campo de texto del mensaje" + "Galería, archivo adjunto %1$d" + "Galería, escaneo fallido %1$d" + "Galería, imagen %1$d" + + "Galería, %1$d elemento multimedia más" + "Galería, %1$d elementos multimedia más" + + "Galería, escaneando %1$d" + "Galería, vídeo %1$d" "Ocultar contraseña" + "Info" "Unirse a la llamada" "Ir al final" + "Ir a los mensajes no leídos" + "Ir al primer mensaje no leído" + "Desplazar el mapa a mi ubicación" "Sólo menciones" "Silenciado" + "Menciones nuevas" + "Mensajes nuevos" + "Llamada en curso" + "Avatar del otro usuario" "Página %1$d" "Pausar" "Mensaje de voz, duración: %1$s, posición actual: %2$s" + "Vista previa de la foto" "Campo PIN" + "Ubicación fijada" "Reproducir" + "Velocidad de reproducción" "Encuesta" "Encuesta finalizada" + "Posición: %1$s" + "Código QR" "Reacciona con %1$s" "Reacciona con otros emojis" - "Leído por %1$s y %2$s" + "Mensaje anterior leído por %1$s y %2$s" - "Leído por %1$s y %2$d otro" - "Leído por %1$s y %2$d otros" + "Mensaje anterior leído por %1$s y %2$d más" + "Mensaje anterior leído por %1$s y %2$d más" - "Leído por %1$s" + "Mensaje anterior leído por %1$s" + "mostrar todas las confirmaciones de lectura" "Elimina la reacción con %1$s" "Retirar la reacción con %1$s" "Avatar de la sala" "Enviar archivos" + "Ubicación del remitente" + "Enviado por %1$s a las %2$s" + "Acción de tiempo limitado requerida, tienes un minuto para hacer la verificación" + "Ajustes, acción requerida" "Mostrar contraseña" "Iniciar llamada" + "Iniciar una videollamada" + "Iniciar una llamada de voz" + "Estado" + "Hilo en %1$s" + "Hilos en %1$s" + "Sala clausurada" + "Avatar del usuario" "Menú de usuario" + "Vista previa del vídeo" "Ver avatar" "Mostrar detalles" "Mensaje de voz, duración: %1$s" "Grabar mensaje de voz" "Detener grabación" + "Tu avatar" "Aceptar" "Agregar leyenda" + "Añadir salas existentes" "Añadir a la cronología" "Atrás" "Llamar" "Cancelar" "Cancelar por ahora" + "Seleccionar archivo" "Elegir foto" "Borrar" "Cerrar" @@ -60,24 +110,34 @@ "Copiar texto" "Crear" "Crear una sala" + "Crear espacio" "Desactivar" "Desactivar cuenta" "Rechazar" "Rechazar y bloquear" + "Eliminar" + "Eliminar cuenta" + "Eliminar archivo" "Eliminar encuesta" + "Deseleccionar todo" "Desactivar" "Descartar" "Descartar" "Hecho" + "Descargar" "Editar" "Editar leyenda" "Editar encuesta" "Activar" "Finalizar encuesta" "Introducir PIN" + "Explorar espacios públicos" + "Finalizar" "¿Olvidaste tu contraseña?" "Reenviar" "Volver atrás" + "Ir a roles y permisos" + "Ir a ajustes" "Ignorar" "Invitar" "Invitar personas" @@ -89,14 +149,20 @@ "Salir" "Salir de la conversación" "Salir de la sala" + "Salir del espacio" "Cargar más" "Gestionar cuenta" + "Gestionar cuenta y dispositivos" "Administrar dispositivos" + "Gestionar salas" + "Marcar como leído" "Enviar mensaje" + "Minimizar" "Siguiente" "No" "Ahora no" "OK" + "Abrir menú contextual" "Ajustes" "Abrir con" "Fijar" @@ -108,7 +174,7 @@ "Quitar leyenda" "Eliminar mensaje" "Responder" - "Responder en el hilo" + "Responder en hilo" "Denunciar" "Informar de un error" "Denunciar contenido" @@ -120,51 +186,69 @@ "Reintentar descifrado" "Guardar" "Buscar" + "Seleccionar todo" "Enviar" + "Enviar mensaje editado" "Enviar mensaje" + "Enviar mensaje de voz" "Compartir" "Compartir enlace" + "Compartir ubicación en directo" "Mostrar" "Inicia sesión de nuevo" - "Cerrar sesión" - "Cerrar sesión de todos modos" + "Eliminar este dispositivo" + "Eliminar este dispositivo de todos modos" "Saltar" "Comenzar" "Iniciar chat" "Empezar de nuevo" "Iniciar la verificación" "Pulsa para cargar el mapa" + "Parar" "Hacer foto" "Toca para ver opciones" + "Traducir" "Intentar de nuevo" "Desprender" + "Videollamada" "Ver" "Ver en la cronología" "Ver fuente" + "Llamada de voz" "Sí" "Sí, intentar de nuevo" "Tu servidor es ahora compatible con un protocolo nuevo y más rápido. Cierra la sesión y vuelve a iniciarla para actualizar ahora. Haciéndolo ahora, evitarás tener que cerrar la sesión cuando se elimine el protocolo antiguo." "Actualización disponible" "Acerca de" "Política de uso aceptable" + "Añadir una cuenta" + "Añadir cuenta" "Añadiendo leyenda" "Ajustes avanzados" "una imagen" "Estadísticas" "Saliste de la sala" + "Se te ha desconectado de la sesión" "Apariencia" "Sonido" + "Beta" "Usuarios bloqueados" "Burbujas" + "Llamada rechazada" + "Llamada en curso" "Llamada iniciada" + "Rechazaste una llamada" "Copia de seguridad del chat" "Copiado al portapapeles" "Derechos de autor" "Creando sala…" + "Creando espacio…" "Solicitud cancelada" "Saliste de la sala" + "Saliste del espacio" "Invitación rechazada" "Error de descifrado" + "Descripción" "Opciones de desarrollador" "ID de dispositivo" "Chat directo" @@ -178,6 +262,7 @@ "Archivo vacío" "Cifrado" "Cifrado activado" + "Termina a las %1$s" "Introduce tu PIN" "Error" "Se ha producido un error, es posible que no recibas notificaciones de mensajes nuevos. Soluciona los problemas con las notificaciones desde los ajustes. @@ -187,20 +272,35 @@ Motivo: %1$s." "Falló" "Favorito" "Marcado como favorito" + "Sincronizando notificaciones…" "Archivo" "Archivo eliminado" "Archivo guardado" "Archivo guardado en Descargas" "Reenviar mensaje" "Usado frecuentemente" + "Galería" + + "%1$d archivo adjunto…" + "%1$d archivos adjuntos…" + + + "%1$d elemento multimedia…" + "%1$d elementos multimedia…" + "GIF" + "Llamada grupal en curso" "Imagen" "En respuesta a %1$s" "Instalar APK" "No se encontró este ID de Matrix, por lo que es posible que no se reciba la invitación." "Saliendo de la sala" + "Saliendo del espacio" "Línea copiada al portapapeles" "Enlace copiado al portapapeles" + "Vincular un dispositivo nuevo" + "Location en directo" + "La ubicación en tiempo real ha terminado" "Cargando…" "Cargando más…" @@ -213,17 +313,22 @@ Motivo: %1$s." "Mensaje" "Acciones del mensaje" + "El mensaje no se pudo enviar" "Diseño de los mensajes" "Mensaje eliminado" "Moderno" "Silenciar" + "Nombre" "%1$s (%2$s)" "No hay resultados" "Sala sin nombre" + "Espacio sin nombre" "No cifrado" "Sin conexión" + "En una llamada" "Licencias de código abierto" "o" + "Otras opciones" "Contraseña" "Personas" "Enlace permanente" @@ -233,27 +338,43 @@ Motivo: %1$s." "Espera, por favor…" "¿Estás seguro de que quieres finalizar esta encuesta?" "Encuesta: %1$s" + "Encuesta" "Total de votos: %1$s" "Los resultados se mostrarán una vez finalizada la encuesta" "%d voto" "%d votos" + "Preparando…" "Política de privacidad" + "Privado" "Sala privada" + "Espacio privado" + "Público" "Sala pública" + "Espacio público" "Reacción" "Reacciones" "Motivo" "Clave de recuperación" "Recargando…" + "Eliminando…" + + "%1$d respuesta" + "%1$d respuestas" + "Respondiendo a %1$s" "Informar de un problema" "Informe enviado" "Editor de texto enriquecido" + "Rol" "Sala" "Nombre de la sala" "p. ej., el nombre de tu proyecto" + + "%1$d sala" + "%1$d salas" + "Cambios guardados" "Guardando" "Bloqueo de pantalla" @@ -261,37 +382,58 @@ Motivo: %1$s." "Buscar resultados" "Seguridad" "Visto por" + "Elige una cuenta" + + "%1$d seleccionado" + "%1$d seleccionados" + "Enviar a" "Enviando…" "Fallo al enviar" "Enviado" + ". " "Servidor no compatible" + "Servidor inaccesible" "Dirección del servidor" "Ajustes" + "Compartir espacio" + "Los miembros nuevos ven el historial" + "Ubicación compartida en directo" "Ubicación compartida" - "Cerrando sesión" + "Espacio compartido" + "Eliminando dispositivo" "Algo salió mal" "Hemos encontrado un problema. Inténtalo de nuevo." + "Espacio" + "Miembros del espacio" + "¿De qué trata este espacio?" + + "%1$d espacio" + "%1$d espacios" + "Iniciando chat…" "Sticker" "Terminado" + "Sugerido" "Sugerencias" "Sincronizando" "Texto" "Avisos de terceros" "Hilo" + "Hilos" "Tema" "¿De qué trata esta sala?" "No se puede descifrar" "Enviado desde un dispositivo no seguro" "No tienes acceso a este mensaje" - "Se restableció la identidad verificada del remitente" + "Se restableció la identidad digital verificada del remitente" "Las invitaciones no se pudieron enviar a uno o más usuarios." "No se pudo enviar la(s) invitación(es)" "Desbloquear" "Dejar de silenciar" "Llamada no compatible" "Evento no compatible" + "%1$s inició una llamada" "Usuario" "Verificación cancelada" "Verificación completada" @@ -301,20 +443,41 @@ Motivo: %1$s." "Verificar identidad" "Verificar usuario" "Vídeo" + "Calidad alta" + "La mejor calidad, pero mayor tamaño de archivo" + "Calidad baja" + "Velocidad de subida más rápida y tamaño de archivo más pequeño" + "Calidad estándar" + "Equilibrio entre calidad y velocidad de subida" "Mensaje de voz" "Esperando…" "Esperando este mensaje" + "Esperando la ubicación en directo…" + "Cualquiera puede ver el historial" "Tú" - "Se restableció la identidad de %1$s. %2$s" - "Se restableció la identidad de %1$s %2$s. %3$s" + "Descarga no disponible." + "Algo salió mal" + "Escaneando…" + "Se ha desactivado la vista previa y la descarga." + "El archivo no es seguro" + "%1$s (%2$s) compartió este mensaje ya que no estabas en la sala cuando se envió." + "%1$s compartió este mensaje ya que no estabas en la sala cuando se envió." + "Esta sala se ha configurado para que los miembros nuevos puedan leer el historial. %1$s" + "Se restableció la identidad digital de %1$s. %2$s" + "Se restableció la identidad digital de %1$s %2$s. %3$s" "(%1$s)" - "Se restableció la identidad de %1$s." - "Se restableció la identidad de %1$s %2$s. %3$s" + "Se restableció la identidad digital de %1$s." + "Se restableció la identidad digital de %1$s %2$s. %3$s" "Retirar la verificación" + "Permitir acceso" "El enlace %1$s te está llevando a otro sitio %2$s ¿Estás seguro de que quieres continuar?" "Revisa este enlace" + "Selecciona la calidad por defecto de los vídeos que subas." + "Calidad de subida de vídeos" + "El tamaño máximo de archivo permitido es: %1$s" + "El archivo es demasiado grande para ser subido" "Sala denunciada" "Denunciaste y saliste de la sala" "Confirmar" @@ -324,6 +487,10 @@ Motivo: %1$s." "Tienes cambios sin guardar." "Tus cambios no se han guardado. ¿Estás seguro de que quieres volver atrás?" "¿Guardar cambios?" + "El tamaño máximo de archivo permitido es: %1$s" + "Selecciona la calidad del vídeo que quieres subir." + "Selecciona la calidad de subida del vídeo" + "Ya has iniciado sesión en este dispositivo como %1$s." "Tu servidor base debe actualizarse para admitir Matrix Authentication Service y la creación de cuentas." "No se pudo crear el enlace permanente" "%1$s no pudo cargar el mapa. Por favor vuelve a intentarlo más tarde." @@ -331,6 +498,7 @@ Motivo: %1$s." "%1$s no ha podido acceder a tu ubicación. Por favor vuelve a intentarlo más tarde." "No se pudo cargar tu mensaje de voz." "La sala ya no existe o la invitación ya no es válida." + "Activa el GPS para acceder a las funciones basadas en la ubicación." "Mensaje no encontrado" "%1$s no tiene permiso para acceder a tu ubicación. Puedes habilitar el acceso en Ajustes." "%1$s no tiene permiso para acceder a tu ubicación. Habilita el acceso a continuación." @@ -342,10 +510,34 @@ Motivo: %1$s." "Lo siento, se ha producido un error" "🔐️ Únete a mí en %1$s" "Hola, puedes hablar conmigo en %1$s: %2$s" + "Compartir la ubicación en directo" + "Se está compartiendo actualmente la ubicación" + "%1$s Ubicación en tiempo real" "%1$s Android" "Agitar con fuerza para informar de un error" + "Captura de pantalla" + "Iniciar sesión" + "Crear cuenta" + "Si tu cuenta te la proporciona tu empresa o una comunidad, cambia el proveedor de la cuenta (ejemplo: nombredeempresa.com)." + "Crea una cuenta gratuita en matrix.org. Si deseas crear una cuenta con otro proveedor, modifícala según corresponda (por ejemplo: communityname.org)." + "Proveedor de cuentas" + "ejemplo.com" + "Introduce tu proveedor de cuenta" + "Elegir proveedor de cuentas" + "%1$s: %2$s" "Opciones" + "Eliminar %1$s" "Ajustes" + "Votos permitidos por persona" + "Nadie está compartiendo su ubicación" + "Compartiendo ubicación en tiempo real" + + "%1$d persona" + "%1$d personas" + + "En el mapa" + "Tu servidor base está en tu red local. Para conectarse, %1$s necesita permiso para acceder a los dispositivos de esta red." + "Permite el acceso a la red local" "Error al seleccionar archivos multimedia, por favor inténtalo de nuevo." "Presiona sobre un mensaje y selecciona «%1$s» para incluirlo aquí." "Fija los mensajes importantes para que se puedan descubrir fácilmente" @@ -354,21 +546,23 @@ Motivo: %1$s." "%1$d mensajes fijados" "Mensajes fijados" - "Estás a punto de ir a tu cuenta de %1$s para restablecer tu identidad. Posteriormente volverás a la aplicación." - "¿No puedes confirmar? Ve a tu cuenta para restablecer tu identidad." + "Estás a punto de ir a tu cuenta de %1$s para restablecer tu identidad digital. Posteriormente volverás a la aplicación." + "¿No puedes confirmarla? Ve a tu cuenta para restablecer tu identidad digital." "Retirar la verificación y enviar" "Puedes retirar tu verificación y enviar este mensaje de todos modos, o puedes cancelarlo por ahora e intentarlo de nuevo más tarde después de volver a verificar a %1$s." - "Tu mensaje no se envió porque la identidad verificada de %1$s fue restablecida" + "Tu mensaje no se envió porque la identidad digital verificada de %1$s fue restablecida" "Enviar mensaje de todos modos" "%1$s utiliza uno o más dispositivos no verificados. Puedes enviar el mensaje de todos modos, o puedes cancelarlo por ahora y volver a intentarlo más tarde, una vez %2$s haya verificado todos sus dispositivos." "Tu mensaje no se envió porque %1$s no ha verificado todos los dispositivos" "Uno o más de tus dispositivos no están verificados. Puedes enviar el mensaje de todos modos, o puedes cancelarlo por ahora e intentarlo de nuevo más tarde, una vez hayas verificado todos tus dispositivos." "Tu mensaje no se envió porque no has verificado uno o más de tus dispositivos" + "Editar administradores o propietarios" "Error al procesar el contenido multimedia, por favor inténtalo de nuevo." "No se pudieron recuperar los detalles del usuario" "Mensaje en %1$s" "Expandir" "Reducir" + "Compartiendo ubicación en tiempo real" "¡Ya estás viendo esta sala!" "%1$s de %2$s" "%1$s mensajes fijados" @@ -380,8 +574,20 @@ Motivo: %1$s." "Abrir en Apple Maps" "Abrir en Google Maps" "Abrir en OpenStreetMap" - "Compartir esta ubicación" - "Mensaje no enviado porque la identidad verificada de %1$s fue restablecida." + "Compartir ubicación seleccionada" + "Cómo compartir" + "Espacios que has creado o a los que te has unido." + "%1$s • %2$s" + "Crea espacios para organizar salas" + "Espacio %1$s" + "Espacios" + "Compartida %1$s" + "En el mapa" + + "Se unió %1$d" + "Se unieron %1$d" + + "Mensaje no enviado porque la identidad digital verificada de %1$s fue restablecida." "Mensaje no enviado porque %1$s no ha verificado todos los dispositivos." "Mensaje no enviado porque no has verificado uno o más de tus dispositivos." "Ubicación" @@ -391,5 +597,7 @@ Motivo: %1$s." "Debes verificar este dispositivo para acceder a los mensajes históricos" "No tienes acceso a este mensaje" "No se ha podido descifrar el mensaje" - "Este mensaje fue bloqueado bien sea porque no verificaste tu dispositivo o porque el remitente necesita verificar tu identidad." + "Este mensaje fue bloqueado bien sea porque no verificaste tu dispositivo o porque el remitente necesita verificar tu identidad digital." + "Tu dispositivo es demasiado antiguo; necesitas un dispositivo con Android 8 o posterior." + "No se admite el renderizado de mapas" diff --git a/libraries/ui-strings/src/main/res/values-fa/translations.xml b/libraries/ui-strings/src/main/res/values-fa/translations.xml index 03d1172040..49a790c2ea 100644 --- a/libraries/ui-strings/src/main/res/values-fa/translations.xml +++ b/libraries/ui-strings/src/main/res/values-fa/translations.xml @@ -1,18 +1,30 @@ + "اضافه کردن آواتار" "افزودن واکنش: %1$s" + "آدرس" "چهرک" + "پاک کردن فیلد جستجو" + "کوچک کردن فیلد متن پیام" + "کاهش آرای مجاز برای هر نفر" + "افزایش تعداد آرای مجاز برای هر نفر" + "ایموجی‌های سفارشی" "حذف" "%1$d رقم وارد شده" "%1$d رقم وارد شده" + "مدت زمان: %1$s" "ویرایش چهرک" "نشانی کامل %1$s خواهد بود" "جزییات رمزنگاری" + "فیلد متن پیام را گسترش دهید" "نهفتن گذرواژه" + "اطلاعات" "پیوستن به تماس" "به پایین بروید" + "پرش به خوانده نشده" + "پرش به اولین پیام خوانده نشده" "جابه‌جایی نقشه به مکانم" "فقط اشاره‌ها" "خموش" @@ -23,10 +35,15 @@ "صفحهٔ %1$d" "مکث" "پیام صوتی. طول %1$s. موقعیت کنونی: %2$s" + "پیش‌نمایش عکس" "زمینهٔ پین" + "مکان پین شده" "پخش" + "سرعت پخش" "نظرسنجی" "نظرسنجی پایان یافته" + "موقعیت: %1$s" + "کد QR" "واکنش با %1$s" "واکنش با شکلک‌های دیگر" "پیام پیشین به دست %1$s و %2$s خوانده شد" @@ -35,15 +52,26 @@ "پیام پیشین به دست %1$s و %2$d دیگر خوانده شد" "پیام قبلی به دست %1$s خوانده شد" + "نمایش همه رسیدهای خوانده شده" "برداشتن واکنش با %1$s" "برداشتن واکنش با %1$s" "چهرک اتاق" "ارسال پرونده‌ها" - "نیازمند کنش محدود به زمان" + "مکان فرستنده" + "ارسال شده توسط %1$s در %2$s" + "اقدام مورد نیاز با محدودیت زمانی، شما یک دقیقه برای تأیید فرصت دارید" + "تنظیمات، اقدام مورد نیاز" "نمایش گذرواژه" "آغاز یک تماس" + "شروع تماس ویدیویی" + "شروع تماس صوتی" + "وضعیت" + "رزوه در %1$s" + "موضوعات در %1$s" + "اتاق سنگ قبر" "چهرک کاربر" "فهرست کاربر" + "پیش‌نمایش ویدیو" "دیدن چهرک" "دیدن جزییات" "پیام صوتی. طول %1$s" @@ -52,11 +80,13 @@ "چهرکتان" "پذیرش" "افزودن عنوان" + "افزودن اتاق‌های موجود" "افزودن به خط زمانی" "بازگشت" "تماس" "لغو" "لغو برای امنون" + "انتخاب فایل" "گزینش عکس" "پاک سازی" "بستن" @@ -71,26 +101,34 @@ "رونوشت از متن" "ایجاد" "ایجاد اتاق" + "ایجاد فضا" "غیرفعّال" "غیرفعّال‌سازی حساب" "رد" "رد و انسداد" + "پاک‌کردن" + "حذف حساب کاربری" + "حذف فایل" "حذف نظرسنجی" "ناگزینش همه" "از کار انداختن" "دور ریختن" "دورانداختن" "انجام شد" + "دانلود" "ویرایش" "ویرایش عنوان" "ویرایش نظرسنجی" "به کار انداختن" "پایان نظرسنجی" "ورود پین" + "کاوش در فضاهای عمومی" "پایان" "گذرواژه را فراموش کردید؟" "پیشروی" "پس‌روی" + "به نقش‌ها و مجوزها بروید" + "به تنظیمات بروید" "نادیده‌گرفتن" "دعوت" "دعوت افراد" @@ -105,8 +143,12 @@ "ترک فضا" "بار کردن بیش‌تر" "مدیریت حساب" + "مدیریت حساب و دستگاه‌ها" "مدیریت افزاره‌ها" + "مدیریت اتاق‌ها" + "علامت‌گذاری به عنوان خوانده شده" "پیام" + "کوچک کردن" "بعدی" "نه" "الآن نه" @@ -120,8 +162,8 @@ "واکنش" "رد کردن" "حذف" - "برداشتن عنوان" - "برداشتن پیام‌ها" + "حذف عنوان" + "حذف پیام" "پاسخ" "پاسخ در رشته" "گزارش" @@ -142,25 +184,31 @@ "فرستادن پیام صوتی" "هم‌رسانی" "هم‌رسانی پیوند" + "اشتراک گذاری موقعیت مکانی زنده" "نمایش" "ورود دوباره" "برداشتن این افزاره" "به هر حال این دستگاه را حذف کنید" - "پرش" + "رد شدن" "آغاز" "آغاز گپ" "آغاز از نو" "آغاز تأیید" "زدن برای بار کردن نقشه" + "توقف" "عکس گرفتن" "زدن برای گزینه‌ها" + "ترجمه" "تلاش دوباره" "سنجاق نکردن" + "تماس تصویری" "نما" "دیدن در خط زمانی" "دیدن منبع" + "تماس صوتی" "بله" "بله. تلاش دوباره" + "سرور شما اکنون از یک پروتکل جدید و سریع‌تر پشتیبانی می‌کند. برای ارتقا، از سیستم خارج شوید و دوباره وارد شوید. انجام این کار در حال حاضر به شما کمک می‌کند تا از خروج اجباری هنگام حذف پروتکل قدیمی در آینده جلوگیری کنید." "ارتقا موجود است" "درباره" "سیاست استفادهٔ پذیرفتنی" @@ -168,18 +216,24 @@ "افزودن حسابی دیگر" "افزودن عنوان" "تنظیمات پیش‌رفته" + "یک تصویر" "تجزیه و تحلیل" "اتاق را ترک کردید" + "شما از جلسه خارج شدید" "ظاهر" "صدا" "آزمایشی" "کاربران مسدود" "حباب‌ها" + "تماس رد شد" + "تماس در جریان است" "تماس آغاز شد" + "شما یک تماس را رد کردید" "پشتیبان گپ" "در تخته‌گیره رونوشت شد" "حق رونوشت" "ایجاد کردن اتاق…" + "ایجاد فضای…" "درخواست لغو شد" "اتاق را ترک کرد" "فضا را ترک کرد" @@ -199,19 +253,34 @@ "پروندهٔ خالی" "رمزنگاری" "رمزنگاری به کار افتاده" + "در %1$s پایان می‌یابد" "پینتان را وارد کنید" "خطا" + "خطایی رخ داده است، ممکن است اعلان‌های مربوط به پیام‌های جدید را دریافت نکنید. لطفاً اعلان‌ها را از تنظیمات عیب‌یابی کنید. + +دلیل: %1$s." "هرکسی" "شکست خورد" "برگزیده" "برگزیده" + "همگام‌سازی اعلان‌ها…" "پرونده" "پرونده حذف شد" "پرونده ذخیره شد" "پرونده در بارگیری‌ها ذخیره شد" "هدایت پیام" "پراستفاده" + "گالری" + + "پیوست %1$d…" + "پیوست‌های %1$d…" + + + "مورد رسانه‌ای %1$d…" + "موارد رسانه‌ای %1$d…" + "جیف" + "تماس گروهی در جریان است" "تصویر" "در پاسخ به %1$s" "نصب APK" @@ -220,6 +289,9 @@ "ترک کردن فضا" "خط در تخته‌گیره رونوشت شد" "پیوند در تخته‌گیره رونوشت شد" + "اتصال دستگاه جدید" + "مکان زنده" + "مکان زنده به پایان رسید" "بار کردن…" "بار کردن بیش‌تر…" @@ -232,18 +304,22 @@ "پیام" "کنش‌های پیام" + "پیام ارسال نشد" "جینش پیام" "پیام برداشته شد" "نوین" "بی‌صدا" + "نام" "%1$s ‏(%2$s)" "بدون نتیجه" "بدون نام اتاق" "بدون نام فضا" "رمزنگاری نشده" "برون‌خط" + "در یک تماس" "پروانه‌های نرم‌افزاری آزاد" "یا" + "گزینه‌های دیگر" "گذرواژه" "افراد" "پایاپیوند" @@ -253,6 +329,7 @@ "لطفا صبر کنید…" "مطئنید که می‌خواهید این نظرسنجی را پایان دهید؟" "نظرسنجی: %1$s" + "نظرسنجی" "مجموع آرا: %1$s" "نتیجه‌ها پس از پایان نظرسنجی نشان داده خواهند شد" @@ -261,8 +338,10 @@ "آماده سازی…" "سیاست محرمانگی" + "خصوصی" "اتاق خصوصی" "فضای خصوصی" + "عمومی" "اتاق عمومی" "فضای عمومی" "واکنش" @@ -270,13 +349,23 @@ "دلیل" "کلید بازیابی" "تازه سازی…" + "در حال حذف…" + + "پاسخ %1$d" + "پاسخ‌های %1$d" + "پاسخ دادن به %1$s" "گزارش مشکل" "گزارش ثبت شد" "ویرایشگر متن غنی" + "نقش" "اتاق" "نام اتاق" "برای نمونه نام پروژه‌تان" + + "اتاق %1$d" + "اتاق‌های %1$d" + "تغییرات ذخیره شده" "ذخیره کردن" "قفل صفحه" @@ -285,6 +374,10 @@ "امنیت" "دیده شده به دست" "گزینش حساب" + + "%1$d انتخاب شد" + "%1$d انتخاب شد" + "فرستادن به" "فرستادن…" "فرستادن شکست خورد" @@ -295,29 +388,43 @@ "نشانی کارساز" "تنظیمات" "هم‌رسانی فضا" + "اعضای جدید تاریخچه را می‌بینند" + "مکان زنده به اشتراک‌گذاری شده" "مکان هم‌رسانده" "فضای اشتراکی" "خارج شدن" "چیزی اشتباه پیش رفت" + "با مشکلی مواجه شدیم. لطفا دوباره امتحان کنید." "فاصله" + "اعضای فضا" + "این فضا مربوط به چیست؟" + + "فضای %1$d" + "فضاهای %1$d" + "آغازیدن گپ…" "عکس برگردان" "موفّقیت" + "پیشنهادی" "پیشنهادها" "هم‌گام ساختن" "متن" "تذکّرهای سوم‌شخص" "رشته" + "موضوعات" "موضوع" "این اتاق دربارهٔ چیست؟" "ناتوان در رمزگشایی" + "ارسال شده از یک دستگاه ناامن" "به این پیام دسترسی ندارید" + "هویت دیجیتال تأیید شده فرستنده بازنشانی شد" "دعوت‌ها نتوانستند به کاربرانی برسند." "ناتوان در فرستادن دعوت(ها)" "قفل‌گشایی" "باصدا" "تماس پشتیبانی نشده" "رویداد پشتیبانی نشده" + "%1$s یک تماس را آغاز کرد" "نام کاربری" "تأیید لغو شد" "تأیید کامل شد" @@ -328,17 +435,40 @@ "تأیید کاربر" "ویدیو" "کیفیت بالا" + "بهترین کیفیت اما حجم فایل بیشتر" "کیفیت پایین" + "سریع‌ترین سرعت آپلود و کمترین حجم فایل" "کیفیت استاندارد" + "تعادل بین کیفیت و سرعت آپلود" "پیام صوتی" "در انتظار…" "در انتظار این پیام" + "در انتظار موقعیت مکانی زنده…" + "هر کسی می‌تواند تاریخچه را ببیند" "شما" - "هویت %1$s بازنشانی شد. %2$s" + "دانلود در دسترس نیست." + "چیزی اشتباه پیش رفت" + "اسکن…" + "پیش‌نمایش و دانلود غیرفعال شده‌اند." + "فایل امن نیست" + "%1$s (%2$s) این پیام را به اشتراک گذاشته است زیرا شما هنگام ارسال آن در اتاق حضور نداشتید." + "%1$s این پیام را به اشتراک گذاشت زیرا شما هنگام ارسال آن در اتاق نبودید." + "این اتاق طوری پیکربندی شده است که اعضای جدید بتوانند تاریخچه را بخوانند. %1$s" + "هویت دیجیتال %1$s بازنشانی شد. %2$s" + "هویت دیجیتال %2$s مربوط به %1$s بازنشانی شد. %3$s" "(%1$s)" + "هویت دیجیتال %1$s بازنشانی شد." + "هویت دیجیتال %2$s مربوط به %1$s بازنشانی شد. %3$s" "انصراف از تأیید" + "اجازه دسترسی" + "لینک %1$s شما را به سایت دیگری هدایت می‌کند %2$s + +آیا مطمئنید که می‌خواهید ادامه دهید؟" "این پیوند را دوباره بررسی کنید" + "کیفیت پیش‌فرض ویدیوهایی که آپلود می‌کنید را انتخاب کنید." "کیفیت بارگذاری ویدیو" + "حداکثر اندازه فایل مجاز: %1$s" + "حجم فایل برای آپلود بسیار زیاد است" "اتاق گزارش شد" "گزارش و از اتاق خارج شد" "تایید" @@ -348,35 +478,75 @@ "تغییراتی ذخیره نشده دارید." "تغییراتتان ذخیره نشده‌اند. مطمئنید که می‌خواهید برگردید؟" "ذخیرهٔ تغییرات؟" + "حداکثر اندازه فایل مجاز: %1$s" + "کیفیت ویدیویی که می‌خواهید آپلود کنید را انتخاب کنید." + "کیفیت آپلود ویدیو را انتخاب کنید" + "شما قبلاً با نام کاربری %1$s در این دستگاه وارد سیستم شده‌اید." + "سرور خانگی شما باید ارتقا یابد تا از سرویس احراز هویت ماتریکس و ایجاد حساب کاربری پشتیبانی کند." "شکست در ایجاد پایاپیوند" "%1$s نتوانست نقشه را بارگیری کند. لطفا بعدا دوباره امتحان کنید." "شکست در بار کردن پیام‌ها" "‏%1$s نمی تواند به مکانتان دسنترسی داشته باشد. لطفا بعدا دوباره امتحان کنید." "شکست در بارگذاری پیام صوتیتان." + "اتاق دیگر وجود ندارد یا دعوتنامه دیگر معتبر نیست." + "برای دسترسی به ویژگی‌های مبتنی بر موقعیت مکانی، لطفاً GPS خود را فعال کنید." "پیام پیدا نشد" "‏%1$s اجازهٔ دسترسی به مکانتان را ندارد. می توانید دسترسی را در تنظیمات به کار بیندازید." "%1$s اجازهٔ دسترسی به مکانتان را ندارد. دسترسی را در زیر به کار بیندازید." "%1$s اجازه دسترسی به میکروفون شما را ندارد. دسترسی را برای ضبط پیام صوتی فعال کنید." + "این مشکل ممکن است به دلیل مشکلات شبکه یا سرور باشد." + "این آدرس اتاق از قبل وجود دارد. لطفاً فیلد آدرس اتاق را ویرایش کنید یا نام اتاق را تغییر دهید." + "بعضی از کاراکترها مجاز نیستند. فقط حروف، ارقام و نمادهای زیر پشتیبانی می‌شوند! $ &amp; ' ( ) * + / ; = ? @ [ ] - . _" "برخی پیام‌ها ارسال نشده‌اند" "متأسفیم ، خطایی رخ داد" "🔐️ پییوستن به من روی %1$s" "درود. با من روی %1$s صحبت کن: %2$s" + "اشتراک‌گذاری موقعیت مکانی زنده" + "اشتراک‌گذاری موقعیت مکانی در حال انجام است" + "موقعیت مکانی زنده %1$s" "%1$s اندروید" "Rageshake برای گزارش اشکال" "نماگرفت" "%1$s: %2$s" "گزینه‌ها" + "حذف %1$s" "تنظیمات" + "تعداد آرای مجاز برای هر نفر" + "هیچ‌کس موقعیت مکانی خود را به اشتراک نمی‌گذارد" + "اشتراک‌گذاری موقعیت مکانی زنده" + + "شخص %1$d" + "افراد %1$d" + + "روی نقشه" + "سرور خانگی شما در شبکه محلی شما قرار دارد. برای اتصال، %1$s برای دسترسی به دستگاه‌های این شبکه به مجوز نیاز دارد." + "اجازه دسترسی به شبکه محلی" "گزینش رسانه شکست خورد. لطفاً دوباره تلاش کنید." + "روی یک پیام کلیک کنید و «%1$s» را برای گنجاندن در اینجا انتخاب کنید." + "پیام‌های مهم را سنجاق کنید تا به راحتی قابل مشاهده باشند" + + "پیام پین شده %1$d" + "پیام‌های پین‌شده %1$d" + "پیام‌های سنجاق شده" - "داردید برای بازنشانی هویتتان به حساب %1$s می‌روید. پس از آن به کاره برگردانده خواهید شد." + "شما در شرف رفتن به حساب %1$s خود برای تنظیم مجدد هویت دیجیتال خود هستید. پس از آن به برنامه بازگردانده خواهید شد." + "نمی‌توانید تأیید کنید؟ برای بازنشانی هویت دیجیتال خود به حساب کاربری خود بروید." + "تأیید را لغو و ارسال کنید" + "شما می‌توانید تأیید خود را پس بگیرید و در هر صورت این پیام را ارسال کنید، یا می‌توانید فعلاً لغو کنید و پس از تأیید مجدد %1$s، بعداً دوباره امتحان کنید." + "پیام شما ارسال نشد زیرا هویت دیجیتال تأیید شده %1$s بازنشانی شده است." "فرستادن پیام به هر روی" + "%1$s از یک یا چند دستگاه تأیید نشده استفاده می‌کند. در هر صورت می‌توانید پیام را ارسال کنید، یا می‌توانید فعلاً لغو کنید و بعداً پس از تأیید تمام دستگاه‌های %2$s دوباره امتحان کنید." + "پیام شما ارسال نشد زیرا %1$s همه دستگاه‌ها را تأیید نکرده است." + "یک یا چند دستگاه شما تأیید نشده‌اند. در هر صورت می‌توانید پیام را ارسال کنید، یا می‌توانید فعلاً لغو کنید و بعداً پس از تأیید همه دستگاه‌هایتان دوباره امتحان کنید." + "پیام شما ارسال نشد زیرا یک یا چند دستگاه خود را تأیید نکرده‌اید" "ویرایش مدیران یا مالکان" "پردازش رسانه برای بارگذاری شکست خورد. لطفاً دوباره تلاش کنید." "نمی توان جزئیات کاربر را بازیابی کرد" "پیام در %1$s" "گسترش" "کاهش" + "اشتراک گذاری موقعیت مکانی زنده" + "درحال مشاهده این اتاق هستید!" "%1$s از %2$s" "%1$s پیام‌های سنجاق شده" "بار کردن پیام‌ها…" @@ -388,13 +558,30 @@ "گشودن در نقشه‌های گوگل" "گشودن در اوپن‌استریت‌مپ" "هم‌رسانی مکان گزیده" + "گزینه‌های اشتراک‌گذاری" "فضاهایی که ساخته یا پیوسته‌اید." "%1$s • %2$s" + "ایجاد فضاهایی برای سازماندهی اتاق‌ها" "‏%1$s فضا" "فضاها" + "%1$s اشتراک‌گذاری شده" + "روی نقشه" + + "%1$d عضو شد" + "%1$d عضو شد" + + "پیام ارسال نشد زیرا هویت دیجیتال تأیید شده %1$s بازنشانی شده است." + "پیام ارسال نشد زیرا %1$s همه دستگاه‌ها را تأیید نکرده است." + "پیام ارسال نشد زیرا شما یک یا چند دستگاه خود را تأیید نکرده‌اید." "مکان" "نگارش : %1$s (%2$s)" "fa" "en" + "پیام‌های تاریخی در این دستگاه موجود نیست" + "برای دسترسی به پیام‌های قدیمی، باید این دستگاه را تأیید کنید" "به این پیام دسترسی ندارید" + "رمزگشایی پیام ممکن نیست" + "این پیام یا به این دلیل مسدود شده است که شما دستگاه خود را تأیید نکرده‌اید یا به این دلیل که فرستنده باید هویت دیجیتال شما را تأیید کند." + "دستگاه شما خیلی قدیمی است، دستگاهی با اندروید ۸ یا جدیدتر مورد نیاز است." + "رندر کردن نقشه‌ها پشتیبانی نمی‌شود" diff --git a/libraries/ui-strings/src/main/res/values-fi/translations.xml b/libraries/ui-strings/src/main/res/values-fi/translations.xml index 52d3bf16e5..b1cc4889a8 100644 --- a/libraries/ui-strings/src/main/res/values-fi/translations.xml +++ b/libraries/ui-strings/src/main/res/values-fi/translations.xml @@ -8,6 +8,7 @@ "Pienennä viestin tekstikenttä" "Vähennä sallittujen äänien määrää per henkilö" "Lisää sallittujen äänien määrää per henkilö" + "Mukautettu emoji" "Poista" "%1$d numero syötetty" @@ -18,11 +19,21 @@ "Täysi osoite tulee olemaan %1$s" "Salauksen tiedot" "Laajenna viestin tekstikenttä" + "Galleria, liite %1$d" + "Galleria, epäonnistunut skannaus %1$d" + "Galleria, kuva %1$d" + + "Galleria, %1$d media lisää" + "Galleria, %1$d mediaa lisää" + + "Galleria, skannataan %1$d" + "Galleria, video %1$d" "Piilota salasana" "Tiedot" "Liity puheluun" "Siirry loppuun" "Siirry lukemattomiin" + "Siirry ensimmäiseen lukemattomaan viestiin" "Siirrä kartta sijaintiini" "Vain maininnat" "Mykistetty" @@ -63,6 +74,7 @@ "Aloita puhelu" "Aloita videopuhelu" "Aloita äänipuhelu" + "Tila" "Viestiketju huoneessa %1$s" "Viestiketjut huoneessa %1$s" "Haudattu huone" @@ -143,6 +155,7 @@ "Hallitse tiliä ja laitteita" "Hallitse laitteita" "Huoneiden hallitseminen" + "Merkitse luetuksi" "Lähetä viesti" "Pienennä" "Seuraava" @@ -503,6 +516,14 @@ Haluatko varmasti jatkaa?" "%1$s Android" "Raivostunut ravistaminen ilmoittaa virheestä" "Näyttökuva" + "Kirjaudu sisään" + "Luo tili" + "Jos tilisi on yrityksesi tai yhteisön tarjoama, vaihda palveluntarjoaja (esimerkki: companyname.com)." + "Luo tili matrix.org -palvelimelle ilmaiseksi. Jos haluat luoda tilin eri palveluntarjoajan kautta, muuta sitä vastaavasti (esimerkiksi: communityname.org)." + "Palveluntarjoaja" + "example.com" + "Anna palveluntarjoajasi" + "Valitse palveluntarjoaja" "%1$s: %2$s" "Vaihtoehdot" "Poista %1$s" @@ -515,6 +536,8 @@ Haluatko varmasti jatkaa?" "%1$d henkilöä" "Kartalla" + "Kotipalvelimesi on paikallisverkossasi. Yhdistääksesi, %1$s tarvitsee luvan tavoittaa laitteita tässä verkossa." + "Salli pääsy paikallisverkkoon" "Median valinta epäonnistui, yritä uudelleen." "Paina viestiä ja valitse “%1$s” lisätäksesi sen tänne." "Kiinnitä tärkeät viestit, jotta ne löytyvät helposti." diff --git a/libraries/ui-strings/src/main/res/values-fr/translations.xml b/libraries/ui-strings/src/main/res/values-fr/translations.xml index 8d550ae51e..105ced1ad5 100644 --- a/libraries/ui-strings/src/main/res/values-fr/translations.xml +++ b/libraries/ui-strings/src/main/res/values-fr/translations.xml @@ -6,6 +6,9 @@ "Avatar" "Effacer le champ de recherche" "Réduire la taille du composeur" + "Diminuer le nombre de votes autorisés par personne" + "Augmenter le nombre de votes autorisés par personne" + "Émojis personnalisés" "Supprimer" "%1$d chiffre saisi" @@ -16,11 +19,21 @@ "L’adresse complète sera %1$s" "Détails du chiffrement" "Augmenter la taille du composeur" + "Galerie, élément %1$d" + "Galerie, échec de l’analyse de l’élément %1$d" + "Galerie, image %1$d" + + "Galerie, %1$d média de plus" + "Galerie, %1$d média de plus" + + "Galerie, analyse en cours de l’élément %1$d" + "Galerie, vidéo %1$d" "Masquer le mot de passe" "Info" "Rejoindre l’appel" "Retourner à la fin de la conversation" "Aller aux messages non lus" + "Aller au premier message non lu" "Déplacer la carte vers ma position" "Mentions uniquement" "En sourdine" @@ -31,6 +44,7 @@ "Page %1$d" "Pause" "Message vocal, durée: %1$s, position actuelle: %2$s" + "Aperçu de la photo" "Code PIN" "Position épinglée" "Lecture" @@ -41,12 +55,13 @@ "Code QR" "Réagir avec %1$s" "Réagir avec d’autres émojis" - "Lu par %1$s et %2$s" + "Message précédent lu par %1$s et %2$s" - "Lu par %1$s et %2$d autre" - "Lu par %1$s et %2$d autres" + "Message précédent lu par %1$s et %2$d autre" + "Message précédent lu par %1$s et %2$d autres" - "Lu par %1$s" + "Message précédent lu par %1$s" + "afficher tous les accusés de réception" "Supprimer la réaction avec %1$s" "Supprimer la réaction avec %1$s" "Avatar du salon" @@ -59,11 +74,13 @@ "Démarrer un appel" "Passer un appel vidéo" "Lancer un appel vocal" + "Statut" "Discussion dans %1$s" "Discussions dans %1$s" "Salon clôturé" "Avatar de l’utilisateur" "Menu utilisateur" + "Aperçu vidéo" "Voir l’avatar" "Afficher les détails" "Message vocal, durée: %1$s" @@ -138,6 +155,7 @@ "Gérer le compte et les appareils" "Gérez les sessions" "Gérer les salons" + "Marquer comme lu" "Message" "Minimiser" "Suivant" @@ -192,9 +210,11 @@ "Traduire" "Essayer à nouveau" "Désépingler" + "Appel vidéo" "Voir" "Voir dans la discussion" "Afficher la source" + "Appel audio" "Oui" "Oui, réessayez" "Votre serveur prend désormais en charge un nouveau protocole plus rapide. Déconnectez-vous, puis reconnectez-vous pour effectuer la mise à niveau dès maintenant. En le faisant tout de suite, vous éviterez une déconnexion forcée lorsque l’ancien protocole sera supprimé." @@ -215,6 +235,7 @@ "Utilisateurs bloqués" "Bulles" "Appel rejeté" + "Appel en cours" "Appel démarré" "Vous avez rejeté un appel" "Sauvegarde des discussions" @@ -258,7 +279,17 @@ Raison : %1$s." "Fichier enregistré dans Téléchargements" "Transférer le message" "Fréquemment utilisé" + "Galerie" + + "%1$d élément…" + "%1$d éléments…" + + + "%1$d élément multimédia…" + "%1$d éléments multimédia…" + "GIF" + "Appel de groupe en cours" "Image" "En réponse à %1$s" "Installer l’APK" @@ -294,6 +325,7 @@ Raison : %1$s." "Espace sans nom" "Non chiffré" "Hors ligne" + "En appel" "Licences open source" "ou" "Autres options" @@ -401,6 +433,7 @@ Raison : %1$s." "Retirer la sourdine" "Appel non pris en charge" "Événement non pris en charge" + "%1$s a commencé un appel" "Nom d’utilisateur" "Vérification annulée" "Vérification terminée" @@ -422,6 +455,11 @@ Raison : %1$s." "En attente de la position en temps réel…" "Tout le monde peut voir les anciens messages" "Vous" + "Téléchargement indisponible." + "Une erreur est survenue" + "Analyse en cours…" + "L’aperçu et le téléchargement ont été désactivés." + "Le fichier n’est pas sûr" "%1$s (%2$s) a partagé ce message avec vous car vous n’étiez pas dans le salon lors de son envoi." "%1$s a partagé ce message avec vous car vous n’étiez pas dans le salon lors de son envoi." "Ce salon a été configuré pour que les nouveaux membres puissent lire l’historique. %1$s" @@ -478,10 +516,19 @@ Raison : %1$s." "%1$s Android" "Rageshake pour signaler un problème" "Capture d’écran" + "Se connecter" + "Créer un compte" + "Si votre fournisseur de compte est fourni par votre entreprise ou une communauté, veuillez le saisir ici (exemple : monentreprise.com)." + "Créez un compte sur matrix.org gratuitement. Si vous souhaitez créer un compte auprès d’un autre fournisseur, veuillez modifier l’adresse ici (exemple : monassociation.org)." + "Fournisseur de compte" + "exemple.com" + "Saisissez votre fournisseur de compte" + "Choisissez un fournisseur de compte" "%1$s: %2$s" "Options" "Supprimer %1$s" "Paramètres" + "Nombre de votes autorisés par personne" "Personne ne partage sa position" "Partage de la position en direct" @@ -489,6 +536,8 @@ Raison : %1$s." "%1$d personnes" "Sur la carte" + "Votre fournisseur de compte se trouve sur votre réseau local. Pour pouvoir communiquer, %1$s a besoin de l’autorisation d’accéder aux appareils de ce réseau." + "Autoriser l’accès au réseau local" "Échec de la sélection du média, veuillez réessayer." "Cliquez (clic long) sur un message et choisissez « %1$s » pour qu‘il apparaisse ici." "Épinglez les messages importants pour leur donner plus de visibilité" @@ -534,6 +583,10 @@ Raison : %1$s." "Espaces" "Partagé %1$s" "Sur la carte" + + "%1$d participant" + "%1$d participants" + "Le message n’a pas été envoyé car l’identité numérique vérifiée de %1$s a été réinitialisée." "Le message n’a pas été envoyé car %1$s n’a pas vérifié tous ses appareils." "Message non envoyé car vous n’avez pas vérifié tous vos appareils." From 5ac1fe24098815bab0833f3841a06d6257e3f4f3 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 17 Aug 2026 11:35:56 +0200 Subject: [PATCH 112/145] Remove temporary string. --- .../impl/src/main/res/values/temporary.xml | 10 ---------- libraries/push/impl/src/main/res/values/temporary.xml | 11 ----------- 2 files changed, 21 deletions(-) delete mode 100644 features/roomdetails/impl/src/main/res/values/temporary.xml delete mode 100644 libraries/push/impl/src/main/res/values/temporary.xml diff --git a/features/roomdetails/impl/src/main/res/values/temporary.xml b/features/roomdetails/impl/src/main/res/values/temporary.xml deleted file mode 100644 index b3194f3323..0000000000 --- a/features/roomdetails/impl/src/main/res/values/temporary.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - Mute - diff --git a/libraries/push/impl/src/main/res/values/temporary.xml b/libraries/push/impl/src/main/res/values/temporary.xml deleted file mode 100644 index 494f2ee441..0000000000 --- a/libraries/push/impl/src/main/res/values/temporary.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - "Requested to join" - From 054d592391b4d818528754afc5d153ed2a57216e Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 17 Aug 2026 12:10:39 +0200 Subject: [PATCH 113/145] Sync again --- features/roomdetails/impl/src/main/res/values/localazy.xml | 2 +- libraries/push/impl/src/main/res/values-zh/translations.xml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/features/roomdetails/impl/src/main/res/values/localazy.xml b/features/roomdetails/impl/src/main/res/values/localazy.xml index 8f86015147..05bdb50d6e 100644 --- a/features/roomdetails/impl/src/main/res/values/localazy.xml +++ b/features/roomdetails/impl/src/main/res/values/localazy.xml @@ -114,7 +114,7 @@ "Failed setting the mode, please try again." "Your homeserver does not support this option in encrypted rooms, you won\'t get notified in this room." "All messages" - "Mentions and Keywords only" + "Mentions and replies only" "Mute" "In this room, notify me for" "Admins" diff --git a/libraries/push/impl/src/main/res/values-zh/translations.xml b/libraries/push/impl/src/main/res/values-zh/translations.xml index eacd1a2040..bbdbabd350 100644 --- a/libraries/push/impl/src/main/res/values-zh/translations.xml +++ b/libraries/push/impl/src/main/res/values-zh/translations.xml @@ -29,6 +29,7 @@ "已邀请你聊天" "%1$s 已邀请你聊天" + "已申请加入" "已开始共享其实时位置" "提到了你:%1$s" "新消息" @@ -92,6 +93,7 @@ "错误:%1$s。" "错误,无法测试推送。" "错误,等待推送超时。" + "错误:推送网关已对此设备限流,因此通知可能不稳定。请更换其它推送网关。" "推送回路耗时 %1$d 毫秒。" "测试推送回路" From 12791406ca5ec1b7a82f62f6679e2d89c3cbc21b Mon Sep 17 00:00:00 2001 From: hayyaksi <193020925+hayaksi1@users.noreply.github.com> Date: Mon, 17 Aug 2026 16:14:15 +0300 Subject: [PATCH 114/145] Explain a rate limiting push gateway in the notification troubleshooter (#7448) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Explain a rate limiting push gateway in the notification troubleshooter The push loop back test printed whatever HTTP status the gateway answered, so a user throttled by the public ntfy.sh gateway was told "Error: HTTP 507", which reads as a server fault rather than as a quota they can wait out or move away from. Map the two statuses that mean the notification was throttled onto a typed failure and give the troubleshooter a message that says what to do. * Import strings from localazy, remove `temporary.xml` in `:libraries:push:impl` --------- Co-authored-by: Jorge Martín --- .../push/api/gateway/PushGatewayFailure.kt | 5 ++ .../pushgateway/PushGatewayNotifyRequest.kt | 43 ++++++++++----- .../impl/troubleshoot/PushLoopbackTest.kt | 7 +++ .../DefaultPushGatewayNotifyRequestTest.kt | 55 +++++++++++++++++++ .../impl/troubleshoot/PushLoopbackTestTest.kt | 19 +++++++ 5 files changed, 114 insertions(+), 15 deletions(-) diff --git a/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/gateway/PushGatewayFailure.kt b/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/gateway/PushGatewayFailure.kt index 975e10e134..3bf065550d 100644 --- a/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/gateway/PushGatewayFailure.kt +++ b/libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/gateway/PushGatewayFailure.kt @@ -10,4 +10,9 @@ package io.element.android.libraries.push.api.gateway sealed class PushGatewayFailure : Exception() { class PusherRejected : PushGatewayFailure() + + /** + * The gateway refused the notification because too many were sent to it. + */ + class RateLimited : PushGatewayFailure() } diff --git a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/pushgateway/PushGatewayNotifyRequest.kt b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/pushgateway/PushGatewayNotifyRequest.kt index 6315285559..e3a7968909 100644 --- a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/pushgateway/PushGatewayNotifyRequest.kt +++ b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/pushgateway/PushGatewayNotifyRequest.kt @@ -12,6 +12,7 @@ import dev.zacsweers.metro.ContributesBinding import io.element.android.libraries.matrix.api.core.EventId import io.element.android.libraries.matrix.api.core.RoomId import io.element.android.libraries.push.api.gateway.PushGatewayFailure +import retrofit2.HttpException interface PushGatewayNotifyRequest { data class Params( @@ -33,26 +34,38 @@ class DefaultPushGatewayNotifyRequest( val pushGatewayApi = pushGatewayApiFactory.create( params.url.substringBefore(PushGatewayConfig.URI_PUSH_GATEWAY_PREFIX_PATH) ) - val response = pushGatewayApi.notify( - PushGatewayNotifyBody( - PushGatewayNotification( - eventId = params.eventId.value, - roomId = params.roomId.value, - devices = listOf( - PushGatewayDevice( - params.appId, - params.pushKey, - PusherData(mapOf( - "cs" to "A_FAKE_SECRET", - )) - ) - ), + val response = try { + pushGatewayApi.notify( + PushGatewayNotifyBody( + PushGatewayNotification( + eventId = params.eventId.value, + roomId = params.roomId.value, + devices = listOf( + PushGatewayDevice( + params.appId, + params.pushKey, + PusherData(mapOf( + "cs" to "A_FAKE_SECRET", + )) + ) + ), + ) ) ) - ) + } catch (httpException: HttpException) { + if (httpException.code() in RATE_LIMITED_STATUS_CODES) { + throw PushGatewayFailure.RateLimited() + } + throw httpException + } if (response.rejectedPushKeys.contains(params.pushKey)) { throw PushGatewayFailure.PusherRejected() } } } + +/** + * 429 is the standard answer, ntfy answers 507 when a device is over its message quota. + */ +private val RATE_LIMITED_STATUS_CODES = setOf(429, 507) diff --git a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/troubleshoot/PushLoopbackTest.kt b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/troubleshoot/PushLoopbackTest.kt index bc89d031a8..0277d7d2c8 100644 --- a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/troubleshoot/PushLoopbackTest.kt +++ b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/troubleshoot/PushLoopbackTest.kt @@ -62,6 +62,13 @@ class PushLoopbackTest( ) job.cancel() return + } catch (_: PushGatewayFailure.RateLimited) { + delegate.updateState( + description = stringProvider.getString(R.string.troubleshoot_notifications_test_push_loop_back_failure_rate_limit), + status = NotificationTroubleshootTestState.Status.Failure() + ) + job.cancel() + return } catch (e: Exception) { Timber.e(e, "Failed to test push") delegate.updateState( diff --git a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/pushgateway/DefaultPushGatewayNotifyRequestTest.kt b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/pushgateway/DefaultPushGatewayNotifyRequestTest.kt index 47dc027b43..97f3bdc540 100644 --- a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/pushgateway/DefaultPushGatewayNotifyRequestTest.kt +++ b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/pushgateway/DefaultPushGatewayNotifyRequestTest.kt @@ -12,8 +12,11 @@ import com.google.common.truth.Truth.assertThat import io.element.android.libraries.push.api.gateway.PushGatewayFailure import io.element.android.libraries.push.impl.test.DefaultTestPush import kotlinx.coroutines.test.runTest +import okhttp3.ResponseBody.Companion.toResponseBody import org.junit.Assert.assertThrows import org.junit.Test +import retrofit2.HttpException +import retrofit2.Response class DefaultPushGatewayNotifyRequestTest { @Test @@ -64,6 +67,58 @@ class DefaultPushGatewayNotifyRequestTest { assertThat(factory.baseUrlParameter).isEqualTo("aUrl") } + @Test + fun `notify with a rate limiting status should throw expected Exception`() { + listOf(429, 507).forEach { statusCode -> + val factory = FakePushGatewayApiFactory( + notifyResponse = { + throw HttpException(Response.error(statusCode, "".toResponseBody())) + } + ) + val pushGatewayNotifyRequest = DefaultPushGatewayNotifyRequest( + pushGatewayApiFactory = factory, + ) + assertThrows(PushGatewayFailure.RateLimited::class.java) { + runTest { + pushGatewayNotifyRequest.execute( + PushGatewayNotifyRequest.Params( + url = "aUrl", + appId = "anAppId", + pushKey = "aPushKey", + eventId = DefaultTestPush.TEST_EVENT_ID, + roomId = DefaultTestPush.TEST_ROOM_ID, + ) + ) + } + } + } + } + + @Test + fun `notify with another http error should not be mapped to a rate limit`() { + val factory = FakePushGatewayApiFactory( + notifyResponse = { + throw HttpException(Response.error(500, "".toResponseBody())) + } + ) + val pushGatewayNotifyRequest = DefaultPushGatewayNotifyRequest( + pushGatewayApiFactory = factory, + ) + assertThrows(HttpException::class.java) { + runTest { + pushGatewayNotifyRequest.execute( + PushGatewayNotifyRequest.Params( + url = "aUrl", + appId = "anAppId", + pushKey = "aPushKey", + eventId = DefaultTestPush.TEST_EVENT_ID, + roomId = DefaultTestPush.TEST_ROOM_ID, + ) + ) + } + } + } + @Test fun `notify with rejected push key should throw expected Exception`() { val factory = FakePushGatewayApiFactory( diff --git a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/troubleshoot/PushLoopbackTestTest.kt b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/troubleshoot/PushLoopbackTestTest.kt index f83fb660ce..447fdd7eb5 100644 --- a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/troubleshoot/PushLoopbackTestTest.kt +++ b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/troubleshoot/PushLoopbackTestTest.kt @@ -59,6 +59,25 @@ class PushLoopbackTestTest { } } + @Test + fun `test PushLoopbackTest RateLimited error`() = runTest { + val sut = createPushLoopbackTest( + pushService = FakePushService( + testPushBlock = { + throw PushGatewayFailure.RateLimited() + } + ), + stringProvider = FakeStringProvider(A_FAILURE_REASON), + ) + sut.runAndTestState { + assertThat(awaitItem().status).isEqualTo(NotificationTroubleshootTestState.Status.Idle(true)) + assertThat(awaitItem().status).isEqualTo(NotificationTroubleshootTestState.Status.InProgress) + val lastItem = awaitItem() + assertThat(lastItem.status).isEqualTo(NotificationTroubleshootTestState.Status.Failure()) + assertThat(lastItem.description).isEqualTo(A_FAILURE_REASON) + } + } + @Test fun `test PushLoopbackTest PusherRejected error with quick fix`() = runTest { val rotateTokenLambda = lambdaRecorder> { Result.success(Unit) } From f94566e44f1a51813410f6299248355fcb721587 Mon Sep 17 00:00:00 2001 From: Cipherd Date: Mon, 17 Aug 2026 13:14:45 +0000 Subject: [PATCH 115/145] Fix outgoing session verification stuck with incomplete recovery setup (#7433) --- .../OutgoingVerificationStateMachine.kt | 9 ++- .../OutgoingVerificationPresenterTest.kt | 80 +++++++++++++++++++ 2 files changed, 86 insertions(+), 3 deletions(-) diff --git a/features/verifysession/impl/src/main/kotlin/io/element/android/features/verifysession/impl/outgoing/OutgoingVerificationStateMachine.kt b/features/verifysession/impl/src/main/kotlin/io/element/android/features/verifysession/impl/outgoing/OutgoingVerificationStateMachine.kt index 465fc20066..c97bf2cd2e 100644 --- a/features/verifysession/impl/src/main/kotlin/io/element/android/features/verifysession/impl/outgoing/OutgoingVerificationStateMachine.kt +++ b/features/verifysession/impl/src/main/kotlin/io/element/android/features/verifysession/impl/outgoing/OutgoingVerificationStateMachine.kt @@ -15,7 +15,6 @@ import com.freeletics.flowredux.dsl.FlowReduxStateMachine import io.element.android.features.verifysession.impl.util.andLogStateChange import io.element.android.features.verifysession.impl.util.logReceivedEvents import io.element.android.libraries.core.bool.orFalse -import io.element.android.libraries.core.data.tryOrNull import io.element.android.libraries.matrix.api.encryption.EncryptionService import io.element.android.libraries.matrix.api.encryption.RecoveryState import io.element.android.libraries.matrix.api.verification.SessionVerificationData @@ -23,6 +22,7 @@ import io.element.android.libraries.matrix.api.verification.SessionVerificationS import io.element.android.libraries.matrix.api.verification.VerificationRequest import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.FlowPreview +import kotlinx.coroutines.TimeoutCancellationException import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.timeout @@ -95,10 +95,13 @@ class OutgoingVerificationStateMachine( // If a key backup exists, wait until it's restored or a timeout happens val hasBackup = encryptionService.doesBackupExistOnServer().getOrNull().orFalse() if (hasBackup) { - tryOrNull { - encryptionService.recoveryStateStateFlow.filter { it == RecoveryState.ENABLED } + try { + encryptionService.recoveryStateStateFlow + .filter { it == RecoveryState.ENABLED || it == RecoveryState.DISABLED || it == RecoveryState.INCOMPLETE } .timeout(10.seconds) .first() + } catch (_: TimeoutCancellationException) { + // The backup was not restored in time, proceed to the Completed state anyway } } state.override { State.Completed.andLogStateChange() } diff --git a/features/verifysession/impl/src/test/kotlin/io/element/android/features/verifysession/impl/outgoing/OutgoingVerificationPresenterTest.kt b/features/verifysession/impl/src/test/kotlin/io/element/android/features/verifysession/impl/outgoing/OutgoingVerificationPresenterTest.kt index c6cbfca281..577683d12e 100644 --- a/features/verifysession/impl/src/test/kotlin/io/element/android/features/verifysession/impl/outgoing/OutgoingVerificationPresenterTest.kt +++ b/features/verifysession/impl/src/test/kotlin/io/element/android/features/verifysession/impl/outgoing/OutgoingVerificationPresenterTest.kt @@ -16,6 +16,7 @@ import io.element.android.features.verifysession.impl.outgoing.OutgoingVerificat import io.element.android.libraries.architecture.AsyncData import io.element.android.libraries.matrix.api.core.UserId import io.element.android.libraries.matrix.api.encryption.EncryptionService +import io.element.android.libraries.matrix.api.encryption.RecoveryState import io.element.android.libraries.matrix.api.verification.SessionVerificationData import io.element.android.libraries.matrix.api.verification.SessionVerificationService import io.element.android.libraries.matrix.api.verification.SessionVerifiedStatus @@ -216,6 +217,85 @@ class OutgoingVerificationPresenterTest { } } + @Test + fun `present - When verification is approved and a backup exists but recovery is disabled, the flow completes`() = runTest { + val service = unverifiedSessionService( + requestUserVerificationLambda = { }, + startSasVerificationLambda = { }, + approveVerificationLambda = { }, + ) + val encryptionService = FakeEncryptionService().apply { + givenDoesBackupExistOnServerResult(Result.success(true)) + recoveryStateStateFlow.value = RecoveryState.DISABLED + } + val presenter = createOutgoingVerificationPresenter( + service = service, + verificationRequest = anOutgoingUserVerificationRequest(), + encryptionService = encryptionService, + ) + presenter.test { + val state = requestVerificationAndAwaitVerifyingState(service) + state.eventSink(OutgoingVerificationViewEvents.ConfirmVerification) + assertThat(awaitItem().step).isInstanceOf(Step.Verifying::class.java) + service.emitVerificationFlowState(VerificationFlowState.DidFinish) + assertThat(awaitItem().step).isEqualTo(Step.Completed) + cancelAndIgnoreRemainingEvents() + } + } + + @Test + fun `present - When verification is approved and a backup exists but recovery is incomplete, the flow completes`() = runTest { + val service = unverifiedSessionService( + requestUserVerificationLambda = { }, + startSasVerificationLambda = { }, + approveVerificationLambda = { }, + ) + val encryptionService = FakeEncryptionService().apply { + givenDoesBackupExistOnServerResult(Result.success(true)) + recoveryStateStateFlow.value = RecoveryState.INCOMPLETE + } + val presenter = createOutgoingVerificationPresenter( + service = service, + verificationRequest = anOutgoingUserVerificationRequest(), + encryptionService = encryptionService, + ) + presenter.test { + val state = requestVerificationAndAwaitVerifyingState(service) + state.eventSink(OutgoingVerificationViewEvents.ConfirmVerification) + assertThat(awaitItem().step).isInstanceOf(Step.Verifying::class.java) + service.emitVerificationFlowState(VerificationFlowState.DidFinish) + assertThat(awaitItem().step).isEqualTo(Step.Completed) + cancelAndIgnoreRemainingEvents() + } + } + + @Test + fun `present - When verification is approved but the recovery state is not determined, the flow completes after the timeout`() = runTest { + val service = unverifiedSessionService( + requestUserVerificationLambda = { }, + startSasVerificationLambda = { }, + approveVerificationLambda = { }, + ) + val encryptionService = FakeEncryptionService().apply { + givenDoesBackupExistOnServerResult(Result.success(true)) + } + val presenter = createOutgoingVerificationPresenter( + service = service, + verificationRequest = anOutgoingUserVerificationRequest(), + encryptionService = encryptionService, + ) + presenter.test { + val state = requestVerificationAndAwaitVerifyingState(service) + state.eventSink(OutgoingVerificationViewEvents.ConfirmVerification) + assertThat(awaitItem().step).isInstanceOf(Step.Verifying::class.java) + service.emitVerificationFlowState(VerificationFlowState.DidFinish) + // The recovery state never leaves UNKNOWN, so the 10 seconds timeout fires and the flow completes anyway + this@runTest.advanceUntilIdle() + assertThat(awaitItem().step).isEqualTo(Step.Completed) + cancelAndIgnoreRemainingEvents() + } + } + @Test fun `present - When verification is declined, the flow is canceled`() = runTest { val service = unverifiedSessionService( From 8b2c2077286697e6e10f99caf3278e8d74c3fd2c Mon Sep 17 00:00:00 2001 From: Jorge Martin Espinosa Date: Mon, 17 Aug 2026 15:21:47 +0200 Subject: [PATCH 116/145] Move the `:libraries:wellknown` logic into `enterprise` modules (#7429) * Extract `IsEnterpriseBuild` use case Having it inside `EnterpriseService` made having DI cycles with the `BuildMeta` provider too easy * Rename `EnterpriseService.defaultHomeserverList()` to `homeserverAllowList()` This seems more aligned with the way this list works * Move most of the logic from `:libraries:wellknown` to `:enterprise:feature:enterprise`, both `shared` and `impl` modules Ideally I would have added everything into `impl`, but some of the classes needed to be shared between the different `:enterprise:features` modules, and those are in the `shared` module, lacking a better name/strategy * Add `EnterpriseService.isElementProEnforced` With this, we don't need to provide the `RemoteEnterpriseConfig` anymore to any consumers, everything goes through `EnterpriseService` or other providers * Remove `EnterpriseService.overriddenElementWellKnown` This leaks the remote enterprise config/element well known contents to the app in a public interface. * Create `CustomMapTilerConfigProvider` to avoid leaking the `RemoteEnterpriseConfig` in public APIs This commit also starts moving some of the well-known related values to the enterprise modules * Add missing docs to `EnterpriseService` and `SessionEnterpriseService` * Fix tests * Fix lint issues * Bump enterprise module --- app/build.gradle.kts | 1 + .../io/element/android/x/di/AppModule.kt | 11 +- .../android/appnav/LoggedInFlowNode.kt | 6 +- enterprise | 2 +- .../enterprise/api/EnterpriseService.kt | 26 +- .../enterprise/api/IsEnterpriseBuild.kt | 18 ++ .../api/SessionEnterpriseService.kt | 6 +- .../CustomMapTilerConfigProvider.kt | 15 ++ .../api/remoteconfig/MapTilerConfig.kt | 19 +- .../remoteconfig/RemoteEnterpriseConfig.kt | 17 -- .../RemoteEnterpriseConfigProvider.kt | 35 --- .../RemoteEnterpriseConfigResult.kt | 15 +- .../impl/DefaultEnterpriseService.kt | 8 +- .../impl/DefaultIsEnterpriseBuild.kt | 17 ++ .../DefaultCustomMapTilerConfigProvider.kt | 18 ++ .../DefaultRemoteEnterpriseConfigProvider.kt | 30 --- .../impl/DefaultEnterpriseServiceTest.kt | 10 +- .../enterprise/test/FakeEnterpriseService.kt | 14 +- .../FakeRemoteEnterpriseConfigProvider.kt | 21 -- ...keRemoteEnterpriseConfigProviderFactory.kt | 17 -- .../enterprise/test/remoteconfig/Fixtures.kt | 22 ++ features/location/api/build.gradle.kts | 1 + .../location/api/LocalMapTilerConfig.kt | 2 +- .../features/location/api/StaticMapView.kt | 2 +- .../internal/MapTilerStaticMapUrlBuilder.kt | 2 +- .../MapTilerTileServerStyleUriBuilder.kt | 2 +- .../api/internal/StaticMapUrlBuilder.kt | 3 +- .../api/internal/TileServerStyleUriBuilder.kt | 2 +- .../MapTilerTileServerStyleUriBuilderTest.kt | 2 +- .../impl/common/ui/MapBottomSheetScaffold.kt | 2 +- .../impl/share/ShareLocationPresenter.kt | 6 +- .../location/impl/share/ShareLocationState.kt | 2 +- .../impl/share/ShareLocationStateProvider.kt | 2 +- .../impl/show/ShowLocationPresenter.kt | 11 +- .../location/impl/show/ShowLocationState.kt | 2 +- .../impl/show/ShowLocationStateProvider.kt | 2 +- .../DefaultShareLocationEntryPointTest.kt | 3 +- .../impl/share/ShareLocationPresenterTest.kt | 15 +- .../show/DefaultShowLocationEntryPointTest.kt | 5 +- .../impl/show/ShowLocationPresenterTest.kt | 28 +- .../DefaultAccountProviderAccessControl.kt | 31 +-- .../AccountProviderDataSource.kt | 2 +- .../ChangeAccountProviderPresenter.kt | 2 +- .../ChooseAccountProviderPresenter.kt | 2 +- .../screens/onboarding/OnBoardingPresenter.kt | 4 +- ...DefaultAccountProviderAccessControlTest.kt | 76 +++--- .../changeserver/ChangeServerPresenterTest.kt | 38 ++- .../onboarding/OnBoardingPresenterTest.kt | 12 +- .../developer/DeveloperSettingsPresenter.kt | 4 +- .../DeveloperSettingsPresenterTest.kt | 10 +- .../wellknown/api/CustomRecoveryPassphrase.kt | 23 -- .../wellknown/api/ElementWellKnownParser.kt | 20 -- .../wellknown/api/ElementWellknownStore.kt | 47 ---- .../api/EnterpriseRemoteConfigSource.kt | 23 -- .../wellknown/api/WellknownRetriever.kt | 39 --- .../impl/DefaultElementWellKnownParser.kt | 27 -- .../wellknown/impl/DefaultWellKnownStore.kt | 77 ------ .../impl/DefaultWellknownRetriever.kt | 142 ----------- .../impl/InternalElementWellKnown.kt | 71 ------ .../wellknown/impl/InternalWellKnown.kt | 34 --- .../impl/InternalWellKnownBaseConfig.kt | 27 -- .../libraries/wellknown/impl/Mapper.kt | 59 ----- .../wellknown/impl/SessionWellknownModule.kt | 41 --- .../libraries/wellknown/impl/WellknownAPI.kt | 19 -- .../api/CustomRecoveryPassphraseTest.kt | 33 --- .../impl/DefaultWellKnownStoreTest.kt | 174 ------------- .../impl/DefaultWellknownRetrieverTest.kt | 241 ------------------ .../test/FakeElementWellknownStore.kt | 53 ---- .../wellknown/test/FakeWellknownRetriever.kt | 24 -- .../test/FakeWellknownRetrieverFactory.kt | 17 -- .../features/wellknown/test/Fixtures.kt | 55 ---- .../posthog/PosthogEndpointConfigProvider.kt | 4 +- 72 files changed, 246 insertions(+), 1607 deletions(-) create mode 100644 features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/IsEnterpriseBuild.kt create mode 100644 features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/CustomMapTilerConfigProvider.kt rename libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellKnown.kt => features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/MapTilerConfig.kt (57%) delete mode 100644 features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/RemoteEnterpriseConfig.kt delete mode 100644 features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/RemoteEnterpriseConfigProvider.kt rename libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/WellknownRetrieverResult.kt => features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/RemoteEnterpriseConfigResult.kt (63%) create mode 100644 features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/DefaultIsEnterpriseBuild.kt create mode 100644 features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/remoteconfig/DefaultCustomMapTilerConfigProvider.kt delete mode 100644 features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/remoteconfig/DefaultRemoteEnterpriseConfigProvider.kt delete mode 100644 features/enterprise/test/src/main/kotlin/io/element/android/features/enterprise/test/remoteconfig/FakeRemoteEnterpriseConfigProvider.kt delete mode 100644 features/enterprise/test/src/main/kotlin/io/element/android/features/enterprise/test/remoteconfig/FakeRemoteEnterpriseConfigProviderFactory.kt create mode 100644 features/enterprise/test/src/main/kotlin/io/element/android/features/enterprise/test/remoteconfig/Fixtures.kt delete mode 100644 libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/CustomRecoveryPassphrase.kt delete mode 100644 libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellKnownParser.kt delete mode 100644 libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellknownStore.kt delete mode 100644 libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/EnterpriseRemoteConfigSource.kt delete mode 100644 libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/WellknownRetriever.kt delete mode 100644 libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/DefaultElementWellKnownParser.kt delete mode 100644 libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/DefaultWellKnownStore.kt delete mode 100644 libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/DefaultWellknownRetriever.kt delete mode 100644 libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/InternalElementWellKnown.kt delete mode 100644 libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/InternalWellKnown.kt delete mode 100644 libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/InternalWellKnownBaseConfig.kt delete mode 100644 libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/Mapper.kt delete mode 100644 libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/SessionWellknownModule.kt delete mode 100644 libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/WellknownAPI.kt delete mode 100644 libraries/wellknown/impl/src/test/kotlin/io/element/android/libraries/wellknown/api/CustomRecoveryPassphraseTest.kt delete mode 100644 libraries/wellknown/impl/src/test/kotlin/io/element/android/libraries/wellknown/impl/DefaultWellKnownStoreTest.kt delete mode 100644 libraries/wellknown/impl/src/test/kotlin/io/element/android/libraries/wellknown/impl/DefaultWellknownRetrieverTest.kt delete mode 100644 libraries/wellknown/test/src/main/kotlin/io/element/android/features/wellknown/test/FakeElementWellknownStore.kt delete mode 100644 libraries/wellknown/test/src/main/kotlin/io/element/android/features/wellknown/test/FakeWellknownRetriever.kt delete mode 100644 libraries/wellknown/test/src/main/kotlin/io/element/android/features/wellknown/test/FakeWellknownRetrieverFactory.kt delete mode 100644 libraries/wellknown/test/src/main/kotlin/io/element/android/features/wellknown/test/Fixtures.kt diff --git a/app/build.gradle.kts b/app/build.gradle.kts index ecd5ed8e7b..f2c7d37baa 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -259,6 +259,7 @@ dependencies { if (isEnterpriseBuild) { allEnterpriseImpl(project) implementation(projects.appicon.enterprise) + implementation(project(":enterprise:features:enterprise:shared")) } else { implementation(projects.features.enterprise.implFoss) implementation(projects.appicon.element) diff --git a/app/src/main/kotlin/io/element/android/x/di/AppModule.kt b/app/src/main/kotlin/io/element/android/x/di/AppModule.kt index 7564db5d95..39c70e35d8 100644 --- a/app/src/main/kotlin/io/element/android/x/di/AppModule.kt +++ b/app/src/main/kotlin/io/element/android/x/di/AppModule.kt @@ -18,7 +18,7 @@ import dev.zacsweers.metro.ContributesTo import dev.zacsweers.metro.Provides import dev.zacsweers.metro.SingleIn import io.element.android.appconfig.ApplicationConfig -import io.element.android.features.enterprise.api.EnterpriseService +import io.element.android.features.enterprise.api.IsEnterpriseBuild import io.element.android.libraries.androidutils.system.getVersionCodeFromManifest import io.element.android.libraries.core.coroutine.CoroutineDispatchers import io.element.android.libraries.core.meta.BuildMeta @@ -74,17 +74,18 @@ object AppModule { fun providesBuildMeta( @ApplicationContext context: Context, buildType: BuildType, - enterpriseService: EnterpriseService, + isEnterpriseBuild: IsEnterpriseBuild, ): BuildMeta { val applicationName = ApplicationConfig.APPLICATION_NAME.takeIf { it.isNotEmpty() } ?: context.getString(R.string.app_name) + val isEnterprise = isEnterpriseBuild() return BuildMeta( isDebuggable = BuildConfig.DEBUG, buildType = buildType, applicationName = applicationName, - productionApplicationName = if (enterpriseService.isEnterpriseBuild) applicationName else ApplicationConfig.PRODUCTION_APPLICATION_NAME, - desktopApplicationName = if (enterpriseService.isEnterpriseBuild) applicationName else ApplicationConfig.DESKTOP_APPLICATION_NAME, + productionApplicationName = if (isEnterprise) applicationName else ApplicationConfig.PRODUCTION_APPLICATION_NAME, + desktopApplicationName = if (isEnterprise) applicationName else ApplicationConfig.DESKTOP_APPLICATION_NAME, applicationId = BuildConfig.APPLICATION_ID, - isEnterpriseBuild = enterpriseService.isEnterpriseBuild, + isEnterpriseBuild = isEnterprise, // TODO EAx Config.LOW_PRIVACY_LOG_ENABLE, lowPrivacyLoggingEnabled = false, versionName = BuildConfig.VERSION_NAME, diff --git a/appnav/src/main/kotlin/io/element/android/appnav/LoggedInFlowNode.kt b/appnav/src/main/kotlin/io/element/android/appnav/LoggedInFlowNode.kt index d7b768132b..cd071131d9 100644 --- a/appnav/src/main/kotlin/io/element/android/appnav/LoggedInFlowNode.kt +++ b/appnav/src/main/kotlin/io/element/android/appnav/LoggedInFlowNode.kt @@ -51,7 +51,7 @@ import io.element.android.compound.colors.SemanticColorsLightDark import io.element.android.features.createroom.api.CreateRoomEntryPoint import io.element.android.features.enterprise.api.EnterpriseService import io.element.android.features.enterprise.api.SessionEnterpriseService -import io.element.android.features.enterprise.api.remoteconfig.RemoteEnterpriseConfigProvider +import io.element.android.features.enterprise.api.remoteconfig.CustomMapTilerConfigProvider import io.element.android.features.ftue.api.FtueEntryPoint import io.element.android.features.ftue.api.state.FtueService import io.element.android.features.ftue.api.state.FtueState @@ -157,7 +157,7 @@ class LoggedInFlowNode( private val analyticsRoomListStateWatcher: AnalyticsRoomListStateWatcher, private val createRoomEntryPoint: CreateRoomEntryPoint, private val activeLiveLocationShareManager: ActiveLiveLocationShareManager, - private val remoteEnterpriseConfigProvider: RemoteEnterpriseConfigProvider, + private val customMapTilerConfigProvider: CustomMapTilerConfigProvider, ) : BaseFlowNode( backstack = BackStack( initialElement = NavTarget.Placeholder, @@ -685,7 +685,7 @@ class LoggedInFlowNode( val currentMapTilerConfig = LocalMapTilerConfig.current val updatedMapTilerConfig by produceState(currentMapTilerConfig) { - value = remoteEnterpriseConfigProvider.get(matrixClient.sessionId).dataOrNull()?.mapTilerConfig ?: currentMapTilerConfig + value = customMapTilerConfigProvider.get().getOrNull() ?: currentMapTilerConfig } ElementThemeApp( diff --git a/enterprise b/enterprise index f5f910856c..3bf0df1f25 160000 --- a/enterprise +++ b/enterprise @@ -1 +1 @@ -Subproject commit f5f910856cfd4f982d1dcce16a80f8fedfbcbd31 +Subproject commit 3bf0df1f25c4df8ee6cc226b00d9b6a675b37a09 diff --git a/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/EnterpriseService.kt b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/EnterpriseService.kt index 7d23ad0ea1..2f1cbe1187 100644 --- a/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/EnterpriseService.kt +++ b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/EnterpriseService.kt @@ -12,7 +12,6 @@ import androidx.compose.ui.graphics.Color import io.element.android.compound.colors.SemanticColorsLightDark import io.element.android.libraries.matrix.api.UrlContentFetcher import io.element.android.libraries.matrix.api.core.SessionId -import io.element.android.libraries.wellknown.api.ElementWellKnown import kotlinx.coroutines.flow.Flow /** @@ -21,9 +20,6 @@ import kotlinx.coroutines.flow.Flow * On a standard build this reports permissive defaults, so callers do not need to branch on the build type themselves. */ interface EnterpriseService { - /** Whether this build is an enterprise one; `false` for the public app. */ - val isEnterpriseBuild: Boolean - /** * Whether the given session belongs to an enterprise deployment, which can be true even on a standard build. * @@ -41,17 +37,26 @@ interface EnterpriseService { suspend fun tweakMasUrl(url: String, homeserver: String, urlContentFetcher: UrlContentFetcher): String /** - * The homeservers the user is allowed to sign in to; an empty list, or one containing [ANY_ACCOUNT_PROVIDER], means no restriction. + * Returns the list of homeservers the user is allowed to sign in to. + * + * If the list is empty or contains the special value [ANY_ACCOUNT_PROVIDER], the user is allowed to sign in to any homeserver. */ - fun defaultHomeserverList(): List + fun homeserverAllowList(): List /** - * Whether the user is allowed to sign in to a given homeserver, according to [defaultHomeserverList]. + * Whether the user is allowed to sign in to a given homeserver, according to [homeserverAllowList]. * * @param homeserverUrl the server the user is trying to use. */ suspend fun isAllowedToConnectToHomeserver(homeserverUrl: String): Boolean + /** + * Whether the given homeserver enforces the use of Element Pro or a derived app. + * + * @param homeserverUrl the homeserver to check. + */ + suspend fun isElementProEnforced(homeserverUrl: String): Boolean + /** * Override the brand color. * @param sessionId the session to override the brand color for, or null to set the brand color to use when there is no session. @@ -94,11 +99,6 @@ interface EnterpriseService { */ fun getNoisyNotificationChannelId(sessionId: SessionId): String? - /** - * Gets the overridden Element Well-Known data if it has been set, or null if not set. - */ - fun overriddenElementWellKnown(): ElementWellKnown? - /** * Gets the Element Server Suite (ESS) config endpoint URL for the given domain. * Returns `null` when this build does not read its configuration from an ESS deployment. @@ -113,7 +113,7 @@ interface EnterpriseService { } fun EnterpriseService.canConnectToAnyHomeserver(): Boolean { - return defaultHomeserverList().let { + return homeserverAllowList().let { it.isEmpty() || it.contains(EnterpriseService.ANY_ACCOUNT_PROVIDER) } } diff --git a/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/IsEnterpriseBuild.kt b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/IsEnterpriseBuild.kt new file mode 100644 index 0000000000..83591ea7bd --- /dev/null +++ b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/IsEnterpriseBuild.kt @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2026 Element Creations Ltd. + * + * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. + * Please see LICENSE files in the repository root for full details. + */ + +package io.element.android.features.enterprise.api + +/** + * A use case to check if this build of the app is an enterprise build. + */ +fun interface IsEnterpriseBuild { + /** + * Returns `true` if this build of the app is an enterprise build, `false` otherwise. + */ + operator fun invoke(): Boolean +} diff --git a/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/SessionEnterpriseService.kt b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/SessionEnterpriseService.kt index 84067ce56f..94f455f2ff 100644 --- a/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/SessionEnterpriseService.kt +++ b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/SessionEnterpriseService.kt @@ -14,6 +14,9 @@ package io.element.android.features.enterprise.api * [init] must have run before the other members return meaningful answers. */ interface SessionEnterpriseService { + /** Loads the deployment configuration of this session; to be called once when the session starts. */ + suspend fun init() + /** Whether Element Call may be used on this session, which a deployment can turn off. */ suspend fun isElementCallAvailable(): Boolean @@ -26,7 +29,4 @@ interface SessionEnterpriseService { /** Whether the homeserver forbids creating encrypted rooms, in which case the app must not offer the option. */ suspend fun isEncryptionDisabledByHomeserver(): Boolean - - /** Loads the deployment configuration of this session; to be called once when the session starts. */ - suspend fun init() } diff --git a/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/CustomMapTilerConfigProvider.kt b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/CustomMapTilerConfigProvider.kt new file mode 100644 index 0000000000..9bfd3c940a --- /dev/null +++ b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/CustomMapTilerConfigProvider.kt @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2026 Element Creations Ltd. + * + * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. + * Please see LICENSE files in the repository root for full details. + */ + +package io.element.android.features.enterprise.api.remoteconfig + +/** + * A provider of a runtime-fetched MapTiler configuration, which can be used to override the default MapTiler configuration. + */ +fun interface CustomMapTilerConfigProvider { + suspend fun get(): Result +} diff --git a/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellKnown.kt b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/MapTilerConfig.kt similarity index 57% rename from libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellKnown.kt rename to features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/MapTilerConfig.kt index 88a89e7a49..3e8b8b14e1 100644 --- a/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellKnown.kt +++ b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/MapTilerConfig.kt @@ -1,29 +1,18 @@ /* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2023-2025 New Vector Ltd. + * Copyright (c) 2026 Element Creations Ltd. * * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. * Please see LICENSE files in the repository root for full details. */ -package io.element.android.libraries.wellknown.api +package io.element.android.features.enterprise.api.remoteconfig -data class ElementWellKnown( - val registrationHelperUrl: String?, - val enforceElementPro: Boolean?, - val rageshakeUrl: String?, - val brandColor: String?, - val notificationSound: String?, - val identityProviderAppScheme: String?, - val customRecoveryPassphrase: CustomRecoveryPassphrase?, - val contentScannerUrl: String?, - val forceDisableE2EE: Boolean?, - val mapTilerConfig: MapTilerConfig?, -) +import androidx.compose.runtime.Immutable /** * A `MapTiler` configuration received from the server. This configuration is used to display maps in the app. */ +@Immutable data class MapTilerConfig( /** The API key to use with MapTiler. This is always not null, but can be empty/blank. */ val apiKey: String, diff --git a/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/RemoteEnterpriseConfig.kt b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/RemoteEnterpriseConfig.kt deleted file mode 100644 index c9adf21eec..0000000000 --- a/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/RemoteEnterpriseConfig.kt +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2026 Element Creations Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.enterprise.api.remoteconfig - -import io.element.android.libraries.wellknown.api.ElementWellKnown - -/** - * Typealias for the well-known configuration used for enterprise features. - * - * This will allow for easier refactoring in the future when we'll want to move as much of its logic as possible to this module. - */ -typealias RemoteEnterpriseConfig = ElementWellKnown diff --git a/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/RemoteEnterpriseConfigProvider.kt b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/RemoteEnterpriseConfigProvider.kt deleted file mode 100644 index 4507b1a72a..0000000000 --- a/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/RemoteEnterpriseConfigProvider.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2026 Element Creations Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.enterprise.api.remoteconfig - -import io.element.android.libraries.matrix.api.UrlContentFetcher -import io.element.android.libraries.matrix.api.core.SessionId -import io.element.android.libraries.wellknown.api.WellknownRetrieverResult - -/** - * Wrapper to fetch the remote enterprise configuration for a given [SessionId], either from a local cache or from a remote source. - */ -interface RemoteEnterpriseConfigProvider { - /** - * Returns the configuration of a session, served from the cache when possible. - * A stale entry is reported as outdated while a refresh runs in the background, so this rarely waits on the network. - * - * @param sessionId the session whose configuration is requested. - */ - suspend fun get(sessionId: SessionId): WellknownRetrieverResult - - /** - * Creates a provider, which needs a fetcher because the configuration is read over HTTP. - */ - interface Factory { - /** - * @param urlContentFetcher used to perform the request; a client that is not authenticated yet also works. - */ - fun create(urlContentFetcher: UrlContentFetcher): RemoteEnterpriseConfigProvider - } -} diff --git a/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/WellknownRetrieverResult.kt b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/RemoteEnterpriseConfigResult.kt similarity index 63% rename from libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/WellknownRetrieverResult.kt rename to features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/RemoteEnterpriseConfigResult.kt index 98af981a66..5f687ff052 100644 --- a/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/WellknownRetrieverResult.kt +++ b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/RemoteEnterpriseConfigResult.kt @@ -1,33 +1,32 @@ /* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2025 New Vector Ltd. + * Copyright (c) 2026 Element Creations Ltd. * * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. * Please see LICENSE files in the repository root for full details. */ -package io.element.android.libraries.wellknown.api +package io.element.android.features.enterprise.api.remoteconfig -sealed interface WellknownRetrieverResult { +sealed interface RemoteEnterpriseConfigResult { /** * Well-known data has been successfully retrieved. */ - data class Success(val data: T) : WellknownRetrieverResult + data class Success(val data: T) : RemoteEnterpriseConfigResult /** * Well-known data has been retrieved from the local cache but is outdated and a manual refresh has been launched. */ - data class Outdated(val data: T) : WellknownRetrieverResult + data class Outdated(val data: T) : RemoteEnterpriseConfigResult /** * Well-known data is not found (file does not exist server side, we got a 404). */ - data object NotFound : WellknownRetrieverResult + data object NotFound : RemoteEnterpriseConfigResult /** * Any other error. */ - data class Error(val exception: Exception) : WellknownRetrieverResult + data class Error(val exception: Exception) : RemoteEnterpriseConfigResult fun dataOrNull(): T? = when (this) { is Success -> data diff --git a/features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/DefaultEnterpriseService.kt b/features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/DefaultEnterpriseService.kt index c75a2cb527..d07c0db569 100644 --- a/features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/DefaultEnterpriseService.kt +++ b/features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/DefaultEnterpriseService.kt @@ -16,18 +16,16 @@ import io.element.android.features.enterprise.api.BugReportUrl import io.element.android.features.enterprise.api.EnterpriseService import io.element.android.libraries.matrix.api.UrlContentFetcher import io.element.android.libraries.matrix.api.core.SessionId -import io.element.android.libraries.wellknown.api.ElementWellKnown import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flowOf @ContributesBinding(AppScope::class) class DefaultEnterpriseService : EnterpriseService { - override val isEnterpriseBuild = false - override suspend fun isEnterpriseUser(sessionId: SessionId) = false override suspend fun tweakMasUrl(url: String, homeserver: String, urlContentFetcher: UrlContentFetcher) = url - override fun defaultHomeserverList(): List = emptyList() + override fun homeserverAllowList(): List = emptyList() override suspend fun isAllowedToConnectToHomeserver(homeserverUrl: String) = true + override suspend fun isElementProEnforced(homeserverUrl: String): Boolean = false override suspend fun overrideBrandColor(sessionId: SessionId?, brandColor: String?) = Unit @@ -48,7 +46,5 @@ class DefaultEnterpriseService : EnterpriseService { override fun getNoisyNotificationChannelId(sessionId: SessionId): String? = null - override fun overriddenElementWellKnown(): ElementWellKnown? = null - override fun essConfigEndpointUrl(domain: String): String? = null } diff --git a/features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/DefaultIsEnterpriseBuild.kt b/features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/DefaultIsEnterpriseBuild.kt new file mode 100644 index 0000000000..73da4d5d03 --- /dev/null +++ b/features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/DefaultIsEnterpriseBuild.kt @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2026 Element Creations Ltd. + * + * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. + * Please see LICENSE files in the repository root for full details. + */ + +package io.element.android.features.enterprise.impl + +import dev.zacsweers.metro.AppScope +import dev.zacsweers.metro.ContributesBinding +import io.element.android.features.enterprise.api.IsEnterpriseBuild + +@ContributesBinding(AppScope::class) +class DefaultIsEnterpriseBuild : IsEnterpriseBuild { + override fun invoke(): Boolean = false +} diff --git a/features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/remoteconfig/DefaultCustomMapTilerConfigProvider.kt b/features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/remoteconfig/DefaultCustomMapTilerConfigProvider.kt new file mode 100644 index 0000000000..2b136d3739 --- /dev/null +++ b/features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/remoteconfig/DefaultCustomMapTilerConfigProvider.kt @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2026 Element Creations Ltd. + * + * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. + * Please see LICENSE files in the repository root for full details. + */ + +package io.element.android.features.enterprise.impl.remoteconfig + +import dev.zacsweers.metro.ContributesBinding +import io.element.android.features.enterprise.api.remoteconfig.CustomMapTilerConfigProvider +import io.element.android.features.enterprise.api.remoteconfig.MapTilerConfig +import io.element.android.libraries.di.SessionScope + +@ContributesBinding(SessionScope::class) +class DefaultCustomMapTilerConfigProvider : CustomMapTilerConfigProvider { + override suspend fun get(): Result = Result.success(null) +} diff --git a/features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/remoteconfig/DefaultRemoteEnterpriseConfigProvider.kt b/features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/remoteconfig/DefaultRemoteEnterpriseConfigProvider.kt deleted file mode 100644 index fbc5cd5827..0000000000 --- a/features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/remoteconfig/DefaultRemoteEnterpriseConfigProvider.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2026 Element Creations Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.enterprise.impl.remoteconfig - -import dev.zacsweers.metro.AppScope -import dev.zacsweers.metro.ContributesBinding -import io.element.android.features.enterprise.api.remoteconfig.RemoteEnterpriseConfig -import io.element.android.features.enterprise.api.remoteconfig.RemoteEnterpriseConfigProvider -import io.element.android.libraries.matrix.api.UrlContentFetcher -import io.element.android.libraries.matrix.api.core.SessionId -import io.element.android.libraries.wellknown.api.WellknownRetrieverResult - -@ContributesBinding(AppScope::class) -class DefaultRemoteEnterpriseConfigProvider : RemoteEnterpriseConfigProvider { - override suspend fun get(sessionId: SessionId): WellknownRetrieverResult { - return WellknownRetrieverResult.NotFound - } - - @ContributesBinding(AppScope::class) - class Factory : RemoteEnterpriseConfigProvider.Factory { - override fun create(urlContentFetcher: UrlContentFetcher): RemoteEnterpriseConfigProvider { - return DefaultRemoteEnterpriseConfigProvider() - } - } -} diff --git a/features/enterprise/impl-foss/src/test/kotlin/io/element/android/features/enterprise/impl/DefaultEnterpriseServiceTest.kt b/features/enterprise/impl-foss/src/test/kotlin/io/element/android/features/enterprise/impl/DefaultEnterpriseServiceTest.kt index 2bee3f8b4d..474990c6d9 100644 --- a/features/enterprise/impl-foss/src/test/kotlin/io/element/android/features/enterprise/impl/DefaultEnterpriseServiceTest.kt +++ b/features/enterprise/impl-foss/src/test/kotlin/io/element/android/features/enterprise/impl/DefaultEnterpriseServiceTest.kt @@ -19,15 +19,9 @@ import org.junit.Test class DefaultEnterpriseServiceTest { @Test - fun `isEnterpriseBuild is false`() { + fun homeserverWhitelist() { val defaultEnterpriseService = DefaultEnterpriseService() - assertThat(defaultEnterpriseService.isEnterpriseBuild).isFalse() - } - - @Test - fun `defaultHomeserverList should return empty list`() { - val defaultEnterpriseService = DefaultEnterpriseService() - assertThat(defaultEnterpriseService.defaultHomeserverList()).isEmpty() + assertThat(defaultEnterpriseService.homeserverAllowList()).isEmpty() } @Test diff --git a/features/enterprise/test/src/main/kotlin/io/element/android/features/enterprise/test/FakeEnterpriseService.kt b/features/enterprise/test/src/main/kotlin/io/element/android/features/enterprise/test/FakeEnterpriseService.kt index 858c46e3bf..e346e5934a 100644 --- a/features/enterprise/test/src/main/kotlin/io/element/android/features/enterprise/test/FakeEnterpriseService.kt +++ b/features/enterprise/test/src/main/kotlin/io/element/android/features/enterprise/test/FakeEnterpriseService.kt @@ -14,7 +14,6 @@ import io.element.android.features.enterprise.api.BugReportUrl import io.element.android.features.enterprise.api.EnterpriseService import io.element.android.libraries.matrix.api.UrlContentFetcher import io.element.android.libraries.matrix.api.core.SessionId -import io.element.android.libraries.wellknown.api.ElementWellKnown import io.element.android.tests.testutils.lambda.lambdaError import io.element.android.tests.testutils.simulateLongTask import kotlinx.coroutines.flow.Flow @@ -22,7 +21,6 @@ import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow class FakeEnterpriseService( - override val isEnterpriseBuild: Boolean = false, private val isEnterpriseUserResult: (SessionId) -> Boolean = { lambdaError() }, private val defaultHomeserverListResult: () -> List = { emptyList() }, private val isAllowedToConnectToHomeserverResult: (String) -> Boolean = { lambdaError() }, @@ -33,8 +31,8 @@ class FakeEnterpriseService( private val unifiedPushDefaultPushGatewayResult: () -> String? = { lambdaError() }, private val getNoisyNotificationChannelIdResult: (SessionId?) -> String? = { lambdaError() }, private val tweakMasUrlResult: (String, String, UrlContentFetcher) -> String = { _, _, _ -> lambdaError() }, - private val overrideWellKnownResult: () -> ElementWellKnown? = { lambdaError() }, private val essConfigEndpointUrlResult: (String) -> String = { lambdaError() }, + private val isElementProEnforcedResult: (String) -> Boolean = { lambdaError() }, ) : EnterpriseService { private val brandColorState = MutableStateFlow(initialBrandColor) private val semanticColorsState = MutableStateFlow(initialSemanticColors) @@ -47,7 +45,7 @@ class FakeEnterpriseService( tweakMasUrlResult(url, homeserver, urlContentFetcher) } - override fun defaultHomeserverList(): List { + override fun homeserverAllowList(): List { return defaultHomeserverListResult() } @@ -55,6 +53,10 @@ class FakeEnterpriseService( isAllowedToConnectToHomeserverResult(homeserverUrl) } + override suspend fun isElementProEnforced(homeserverUrl: String): Boolean = simulateLongTask { + isElementProEnforcedResult(homeserverUrl) + } + override suspend fun overrideBrandColor(sessionId: SessionId?, brandColor: String?) = simulateLongTask { overrideBrandColorResult(sessionId, brandColor) } @@ -84,10 +86,6 @@ class FakeEnterpriseService( return getNoisyNotificationChannelIdResult(sessionId) } - override fun overriddenElementWellKnown(): ElementWellKnown? { - return overrideWellKnownResult() - } - override fun essConfigEndpointUrl(domain: String): String { return essConfigEndpointUrlResult(domain) } diff --git a/features/enterprise/test/src/main/kotlin/io/element/android/features/enterprise/test/remoteconfig/FakeRemoteEnterpriseConfigProvider.kt b/features/enterprise/test/src/main/kotlin/io/element/android/features/enterprise/test/remoteconfig/FakeRemoteEnterpriseConfigProvider.kt deleted file mode 100644 index 2c57dbb530..0000000000 --- a/features/enterprise/test/src/main/kotlin/io/element/android/features/enterprise/test/remoteconfig/FakeRemoteEnterpriseConfigProvider.kt +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2026 Element Creations Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.enterprise.test.remoteconfig - -import io.element.android.features.enterprise.api.remoteconfig.RemoteEnterpriseConfig -import io.element.android.features.enterprise.api.remoteconfig.RemoteEnterpriseConfigProvider -import io.element.android.libraries.matrix.api.core.SessionId -import io.element.android.libraries.wellknown.api.WellknownRetrieverResult - -class FakeRemoteEnterpriseConfigProvider( - private val getResult: (SessionId) -> WellknownRetrieverResult = { WellknownRetrieverResult.NotFound } -) : RemoteEnterpriseConfigProvider { - override suspend fun get(sessionId: SessionId): WellknownRetrieverResult { - return getResult(sessionId) - } -} diff --git a/features/enterprise/test/src/main/kotlin/io/element/android/features/enterprise/test/remoteconfig/FakeRemoteEnterpriseConfigProviderFactory.kt b/features/enterprise/test/src/main/kotlin/io/element/android/features/enterprise/test/remoteconfig/FakeRemoteEnterpriseConfigProviderFactory.kt deleted file mode 100644 index a49bbba279..0000000000 --- a/features/enterprise/test/src/main/kotlin/io/element/android/features/enterprise/test/remoteconfig/FakeRemoteEnterpriseConfigProviderFactory.kt +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2026 Element Creations Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.enterprise.test.remoteconfig - -import io.element.android.features.enterprise.api.remoteconfig.RemoteEnterpriseConfigProvider -import io.element.android.libraries.matrix.api.UrlContentFetcher - -class FakeRemoteEnterpriseConfigProviderFactory( - private val remoteEnterpriseConfigProvider: RemoteEnterpriseConfigProvider = FakeRemoteEnterpriseConfigProvider(), -) : RemoteEnterpriseConfigProvider.Factory { - override fun create(urlContentFetcher: UrlContentFetcher): RemoteEnterpriseConfigProvider = remoteEnterpriseConfigProvider -} diff --git a/features/enterprise/test/src/main/kotlin/io/element/android/features/enterprise/test/remoteconfig/Fixtures.kt b/features/enterprise/test/src/main/kotlin/io/element/android/features/enterprise/test/remoteconfig/Fixtures.kt new file mode 100644 index 0000000000..fd429eada5 --- /dev/null +++ b/features/enterprise/test/src/main/kotlin/io/element/android/features/enterprise/test/remoteconfig/Fixtures.kt @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2026 Element Creations Ltd. + * + * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. + * Please see LICENSE files in the repository root for full details. + */ + +package io.element.android.features.enterprise.test.remoteconfig + +import io.element.android.features.enterprise.api.remoteconfig.MapTilerConfig + +fun aMapTilerConfig( + apiKey: String = "test_api_key", + baseUrl: String? = null, + lightStyleId: String? = null, + darkStyleId: String? = null, +) = MapTilerConfig( + apiKey = apiKey, + baseUrl = baseUrl, + lightStyleId = lightStyleId, + darkStyleId = darkStyleId, +) diff --git a/features/location/api/build.gradle.kts b/features/location/api/build.gradle.kts index b3eeacf87f..8830b39a22 100644 --- a/features/location/api/build.gradle.kts +++ b/features/location/api/build.gradle.kts @@ -71,6 +71,7 @@ dependencies { implementation(projects.libraries.matrixui) implementation(projects.libraries.uiStrings) implementation(projects.libraries.wellknown.api) + implementation(projects.features.enterprise.api) implementation(libs.coil.compose) implementation(libs.datetime) diff --git a/features/location/api/src/main/kotlin/io/element/android/features/location/api/LocalMapTilerConfig.kt b/features/location/api/src/main/kotlin/io/element/android/features/location/api/LocalMapTilerConfig.kt index a2212119f5..752dd2401c 100644 --- a/features/location/api/src/main/kotlin/io/element/android/features/location/api/LocalMapTilerConfig.kt +++ b/features/location/api/src/main/kotlin/io/element/android/features/location/api/LocalMapTilerConfig.kt @@ -8,7 +8,7 @@ package io.element.android.features.location.api import androidx.compose.runtime.staticCompositionLocalOf -import io.element.android.libraries.wellknown.api.MapTilerConfig +import io.element.android.features.enterprise.api.remoteconfig.MapTilerConfig /** * Provides a [MapTilerConfig] for the MapLibre maps. diff --git a/features/location/api/src/main/kotlin/io/element/android/features/location/api/StaticMapView.kt b/features/location/api/src/main/kotlin/io/element/android/features/location/api/StaticMapView.kt index 33e454722f..b3149964e4 100644 --- a/features/location/api/src/main/kotlin/io/element/android/features/location/api/StaticMapView.kt +++ b/features/location/api/src/main/kotlin/io/element/android/features/location/api/StaticMapView.kt @@ -37,6 +37,7 @@ import coil3.compose.rememberAsyncImagePainter import coil3.request.ImageRequest import coil3.request.SuccessResult import io.element.android.compound.theme.ElementTheme +import io.element.android.features.enterprise.api.remoteconfig.MapTilerConfig import io.element.android.features.location.api.internal.StaticMapPlaceholder import io.element.android.features.location.api.internal.centerBottomEdge import io.element.android.features.location.api.internal.rememberStaticMapBuilder @@ -45,7 +46,6 @@ import io.element.android.libraries.designsystem.components.PinVariant import io.element.android.libraries.designsystem.preview.ElementPreview import io.element.android.libraries.designsystem.preview.PreviewsDayNight import io.element.android.libraries.designsystem.utils.CommonDrawables -import io.element.android.libraries.wellknown.api.MapTilerConfig /** * Shows a static map image downloaded via a third party service's static maps API. diff --git a/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/MapTilerStaticMapUrlBuilder.kt b/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/MapTilerStaticMapUrlBuilder.kt index 78eae2f633..cd339f67b0 100644 --- a/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/MapTilerStaticMapUrlBuilder.kt +++ b/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/MapTilerStaticMapUrlBuilder.kt @@ -8,8 +8,8 @@ package io.element.android.features.location.api.internal +import io.element.android.features.enterprise.api.remoteconfig.MapTilerConfig import io.element.android.features.location.api.BuildConfig -import io.element.android.libraries.wellknown.api.MapTilerConfig import kotlin.math.roundToInt /** diff --git a/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/MapTilerTileServerStyleUriBuilder.kt b/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/MapTilerTileServerStyleUriBuilder.kt index 10aef90116..d817a3307f 100644 --- a/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/MapTilerTileServerStyleUriBuilder.kt +++ b/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/MapTilerTileServerStyleUriBuilder.kt @@ -10,8 +10,8 @@ package io.element.android.features.location.api.internal +import io.element.android.features.enterprise.api.remoteconfig.MapTilerConfig import io.element.android.features.location.api.BuildConfig -import io.element.android.libraries.wellknown.api.MapTilerConfig internal class MapTilerTileServerStyleUriBuilder( private val baseUrl: String, diff --git a/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/StaticMapUrlBuilder.kt b/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/StaticMapUrlBuilder.kt index 212da08647..31992b1dd6 100644 --- a/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/StaticMapUrlBuilder.kt +++ b/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/StaticMapUrlBuilder.kt @@ -10,8 +10,7 @@ package io.element.android.features.location.api.internal import androidx.compose.runtime.Composable import androidx.compose.runtime.remember -import io.element.android.libraries.wellknown.api.MapTilerConfig - +import io.element.android.features.enterprise.api.remoteconfig.MapTilerConfig /** * Builds an URL for a 3rd party service provider static maps API. */ diff --git a/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/TileServerStyleUriBuilder.kt b/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/TileServerStyleUriBuilder.kt index 9676005f59..67936525e5 100644 --- a/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/TileServerStyleUriBuilder.kt +++ b/features/location/api/src/main/kotlin/io/element/android/features/location/api/internal/TileServerStyleUriBuilder.kt @@ -11,7 +11,7 @@ package io.element.android.features.location.api.internal import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import io.element.android.compound.theme.ElementTheme -import io.element.android.libraries.wellknown.api.MapTilerConfig +import io.element.android.features.enterprise.api.remoteconfig.MapTilerConfig /** * Builds a style URI for a MapLibre compatible tile server. diff --git a/features/location/api/src/test/kotlin/io/element/android/features/location/api/internal/MapTilerTileServerStyleUriBuilderTest.kt b/features/location/api/src/test/kotlin/io/element/android/features/location/api/internal/MapTilerTileServerStyleUriBuilderTest.kt index 09aae4f310..c153ab1ce4 100644 --- a/features/location/api/src/test/kotlin/io/element/android/features/location/api/internal/MapTilerTileServerStyleUriBuilderTest.kt +++ b/features/location/api/src/test/kotlin/io/element/android/features/location/api/internal/MapTilerTileServerStyleUriBuilderTest.kt @@ -9,7 +9,7 @@ package io.element.android.features.location.api.internal import com.google.common.truth.Truth.assertThat -import io.element.android.libraries.wellknown.api.MapTilerConfig +import io.element.android.features.enterprise.api.remoteconfig.MapTilerConfig import org.junit.Test class MapTilerTileServerStyleUriBuilderTest { diff --git a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/common/ui/MapBottomSheetScaffold.kt b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/common/ui/MapBottomSheetScaffold.kt index eaa238bed0..84c4ab4fba 100644 --- a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/common/ui/MapBottomSheetScaffold.kt +++ b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/common/ui/MapBottomSheetScaffold.kt @@ -43,6 +43,7 @@ import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.max +import io.element.android.features.enterprise.api.remoteconfig.MapTilerConfig import io.element.android.features.location.api.internal.rememberTileStyleUrl import io.element.android.features.location.impl.common.MapDefaults import io.element.android.libraries.architecture.AsyncData @@ -50,7 +51,6 @@ import io.element.android.libraries.core.data.tryOrNull import io.element.android.libraries.designsystem.text.toDp import io.element.android.libraries.designsystem.theme.components.BottomSheetScaffold import io.element.android.libraries.designsystem.theme.components.CircularProgressIndicator -import io.element.android.libraries.wellknown.api.MapTilerConfig import org.maplibre.compose.camera.CameraState import org.maplibre.compose.camera.rememberCameraState import org.maplibre.compose.map.MapOptions diff --git a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationPresenter.kt b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationPresenter.kt index d388e0c5d2..55f1e088d2 100644 --- a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationPresenter.kt +++ b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationPresenter.kt @@ -22,7 +22,7 @@ import dev.zacsweers.metro.Assisted import dev.zacsweers.metro.AssistedFactory import dev.zacsweers.metro.AssistedInject import im.vector.app.features.analytics.plan.Composer -import io.element.android.features.enterprise.api.remoteconfig.RemoteEnterpriseConfigProvider +import io.element.android.features.enterprise.api.remoteconfig.CustomMapTilerConfigProvider import io.element.android.features.location.api.live.ActiveLiveLocationShareManager import io.element.android.features.location.impl.common.LocationConstraintsCheck import io.element.android.features.location.impl.common.MapDefaults @@ -73,7 +73,7 @@ class ShareLocationPresenter( private val liveLocationShareManager: ActiveLiveLocationShareManager, private val liveLocationStore: LiveLocationStore, private val userLocationStateFactory: UserLocationState.Factory, - private val remoteEnterpriseConfigProvider: RemoteEnterpriseConfigProvider, + private val customMapTilerConfigProvider: CustomMapTilerConfigProvider, ) : Presenter { @AssistedFactory fun interface Factory { @@ -96,7 +96,7 @@ class ShareLocationPresenter( val currentUser by client.userProfile.collectAsState() val customMapConfig by produceState(AsyncData.Loading()) { // Ignore errors - value = AsyncData.Success(remoteEnterpriseConfigProvider.get(client.sessionId).dataOrNull()?.mapTilerConfig) + value = AsyncData.Success(customMapTilerConfigProvider.get().getOrNull()) } val sendLiveLocationPermissions by room.permissionsAsState(SendLiveLocationPermissions.DEFAULT) { perms -> perms.sendLiveLocationPermissions() diff --git a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationState.kt b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationState.kt index d2cce94ef8..b29228f866 100644 --- a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationState.kt +++ b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationState.kt @@ -8,12 +8,12 @@ package io.element.android.features.location.impl.share +import io.element.android.features.enterprise.api.remoteconfig.MapTilerConfig import io.element.android.features.location.impl.common.ui.LocationConstraintsDialogState import io.element.android.features.location.impl.common.userlocation.UserLocationState import io.element.android.libraries.architecture.AsyncAction import io.element.android.libraries.architecture.AsyncData import io.element.android.libraries.matrix.api.user.MatrixUser -import io.element.android.libraries.wellknown.api.MapTilerConfig import kotlinx.collections.immutable.ImmutableList data class ShareLocationState( diff --git a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationStateProvider.kt b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationStateProvider.kt index 6d7ff5e612..9214d5a017 100644 --- a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationStateProvider.kt +++ b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/share/ShareLocationStateProvider.kt @@ -9,13 +9,13 @@ package io.element.android.features.location.impl.share import androidx.compose.ui.tooling.preview.PreviewParameterProvider +import io.element.android.features.enterprise.api.remoteconfig.MapTilerConfig import io.element.android.features.location.impl.common.ui.LocationConstraintsDialogState import io.element.android.features.location.impl.common.userlocation.UserLocationState import io.element.android.libraries.architecture.AsyncAction import io.element.android.libraries.architecture.AsyncData import io.element.android.libraries.matrix.api.core.UserId import io.element.android.libraries.matrix.api.user.MatrixUser -import io.element.android.libraries.wellknown.api.MapTilerConfig import kotlinx.collections.immutable.persistentListOf import kotlin.time.Duration.Companion.hours import kotlin.time.Duration.Companion.minutes diff --git a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationPresenter.kt b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationPresenter.kt index 2d9a4900dd..bbec7b449f 100644 --- a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationPresenter.kt +++ b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationPresenter.kt @@ -22,7 +22,7 @@ import androidx.compose.runtime.setValue import dev.zacsweers.metro.Assisted import dev.zacsweers.metro.AssistedFactory import dev.zacsweers.metro.AssistedInject -import io.element.android.features.enterprise.api.remoteconfig.RemoteEnterpriseConfigProvider +import io.element.android.features.enterprise.api.remoteconfig.CustomMapTilerConfigProvider import io.element.android.features.location.api.Location import io.element.android.features.location.api.ShowLocationMode import io.element.android.features.location.api.live.ActiveLiveLocationShareManager @@ -47,7 +47,6 @@ import io.element.android.libraries.dateformatter.api.DateFormatter import io.element.android.libraries.dateformatter.api.DateFormatterMode import io.element.android.libraries.designsystem.components.avatar.AvatarData import io.element.android.libraries.designsystem.components.avatar.AvatarSize -import io.element.android.libraries.matrix.api.core.SessionId import io.element.android.libraries.matrix.api.room.JoinedRoom import io.element.android.libraries.matrix.api.room.getBestName import io.element.android.libraries.matrix.api.room.joinedRoomMembers @@ -58,18 +57,18 @@ import kotlinx.collections.immutable.toImmutableList import kotlinx.coroutines.flow.combine import kotlinx.coroutines.launch -@AssistedInject class ShowLocationPresenter( +@AssistedInject +class ShowLocationPresenter( @Assisted private val mode: ShowLocationMode, permissionsPresenterFactory: PermissionsPresenter.Factory, private val locationActions: LocationActions, private val buildMeta: BuildMeta, private val dateFormatter: DateFormatter, private val stringProvider: StringProvider, - private val sessionId: SessionId, private val joinedRoom: JoinedRoom, private val liveLocationShareManager: ActiveLiveLocationShareManager, private val userLocationStateFactory: UserLocationState.Factory, - private val remoteEnterpriseConfigProvider: RemoteEnterpriseConfigProvider, + private val customMapTilerConfigProvider: CustomMapTilerConfigProvider, ) : Presenter { @AssistedFactory fun interface Factory { fun create(mode: ShowLocationMode): ShowLocationPresenter @@ -89,7 +88,7 @@ import kotlinx.coroutines.launch val customMapTilerConfig by produceState(AsyncData.Loading()) { // Ignore errors - value = AsyncData.Success(remoteEnterpriseConfigProvider.get(sessionId).dataOrNull()?.mapTilerConfig) + value = AsyncData.Success(customMapTilerConfigProvider.get().getOrNull()) } fun checkLocationConstraints() { diff --git a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationState.kt b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationState.kt index 2ae76ef9e9..0472eb94e9 100644 --- a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationState.kt +++ b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationState.kt @@ -8,6 +8,7 @@ package io.element.android.features.location.impl.show +import io.element.android.features.enterprise.api.remoteconfig.MapTilerConfig import io.element.android.features.location.api.Location import io.element.android.features.location.impl.common.ui.LocationConstraintsDialogState import io.element.android.features.location.impl.common.ui.LocationMarkerData @@ -17,7 +18,6 @@ import io.element.android.libraries.designsystem.components.PinVariant import io.element.android.libraries.designsystem.components.avatar.AvatarData import io.element.android.libraries.matrix.api.core.UserId import io.element.android.libraries.matrix.api.room.location.AssetType -import io.element.android.libraries.wellknown.api.MapTilerConfig import kotlinx.collections.immutable.ImmutableList data class ShowLocationState( diff --git a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationStateProvider.kt b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationStateProvider.kt index a1f349d644..bf582eb59a 100644 --- a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationStateProvider.kt +++ b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationStateProvider.kt @@ -9,6 +9,7 @@ package io.element.android.features.location.impl.show import androidx.compose.ui.tooling.preview.PreviewParameterProvider +import io.element.android.features.enterprise.api.remoteconfig.MapTilerConfig import io.element.android.features.location.api.Location import io.element.android.features.location.impl.common.ui.LocationConstraintsDialogState import io.element.android.features.location.impl.common.userlocation.UserLocationState @@ -18,7 +19,6 @@ import io.element.android.libraries.designsystem.components.avatar.AvatarSize import io.element.android.libraries.designsystem.preview.USER_NAME_ALICE import io.element.android.libraries.matrix.api.core.UserId import io.element.android.libraries.matrix.api.room.location.AssetType -import io.element.android.libraries.wellknown.api.MapTilerConfig import kotlinx.collections.immutable.toImmutableList class ShowLocationStateProvider : PreviewParameterProvider { diff --git a/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/share/DefaultShareLocationEntryPointTest.kt b/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/share/DefaultShareLocationEntryPointTest.kt index 9be168e5a2..a37011e1d9 100644 --- a/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/share/DefaultShareLocationEntryPointTest.kt +++ b/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/share/DefaultShareLocationEntryPointTest.kt @@ -11,7 +11,6 @@ package io.element.android.features.location.impl.share import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.bumble.appyx.core.modality.BuildContext import com.google.common.truth.Truth.assertThat -import io.element.android.features.enterprise.test.remoteconfig.FakeRemoteEnterpriseConfigProvider import io.element.android.features.location.impl.common.FakeUserLocationStateFactory import io.element.android.features.location.impl.common.actions.FakeLocationActions import io.element.android.features.location.impl.common.permissions.FakePermissionsPresenter @@ -59,7 +58,7 @@ class DefaultShareLocationEntryPointTest { sessionId = room.sessionId, ), userLocationStateFactory = FakeUserLocationStateFactory(), - remoteEnterpriseConfigProvider = FakeRemoteEnterpriseConfigProvider(), + customMapTilerConfigProvider = { Result.success(null) }, ) }, analyticsService = FakeAnalyticsService(), diff --git a/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/share/ShareLocationPresenterTest.kt b/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/share/ShareLocationPresenterTest.kt index 6748c5a675..d249fdaf69 100644 --- a/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/share/ShareLocationPresenterTest.kt +++ b/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/share/ShareLocationPresenterTest.kt @@ -19,8 +19,8 @@ import app.cash.turbine.ReceiveTurbine import app.cash.turbine.test import com.google.common.truth.Truth.assertThat import im.vector.app.features.analytics.plan.Composer -import io.element.android.features.enterprise.api.remoteconfig.RemoteEnterpriseConfigProvider -import io.element.android.features.enterprise.test.remoteconfig.FakeRemoteEnterpriseConfigProvider +import io.element.android.features.enterprise.api.remoteconfig.MapTilerConfig +import io.element.android.features.enterprise.test.remoteconfig.aMapTilerConfig import io.element.android.features.location.api.Location import io.element.android.features.location.impl.aPermissionsState import io.element.android.features.location.impl.common.FakeUserLocationStateFactory @@ -32,8 +32,6 @@ import io.element.android.features.location.impl.common.ui.LocationConstraintsDi import io.element.android.features.location.impl.live.LiveLocationStore import io.element.android.features.location.test.FakeActiveLiveLocationShareManager import io.element.android.features.messages.test.FakeMessageComposerContext -import io.element.android.features.wellknown.test.aMapTilerConfig -import io.element.android.features.wellknown.test.anElementWellKnown import io.element.android.libraries.dateformatter.test.FakeDurationFormatter import io.element.android.libraries.matrix.api.core.EventId import io.element.android.libraries.matrix.api.core.RoomId @@ -55,7 +53,6 @@ import io.element.android.libraries.matrix.test.room.powerlevels.FakeRoomPermiss import io.element.android.libraries.matrix.test.timeline.FakeTimeline import io.element.android.libraries.preferences.api.store.PreferenceDataStoreFactory import io.element.android.libraries.preferences.test.FakePreferenceDataStoreFactory -import io.element.android.libraries.wellknown.api.WellknownRetrieverResult import io.element.android.services.analytics.test.FakeAnalyticsService import io.element.android.tests.testutils.WarmUpRule import io.element.android.tests.testutils.lambda.assert @@ -92,7 +89,7 @@ class ShareLocationPresenterTest { liveLocationShareManager: FakeActiveLiveLocationShareManager = FakeActiveLiveLocationShareManager(), liveLocationStore: LiveLocationStore = createLiveLocationStore(sessionId = joinedRoom.sessionId), client: FakeMatrixClient = fakeMatrixClient, - remoteEnterpriseConfigProvider: RemoteEnterpriseConfigProvider = FakeRemoteEnterpriseConfigProvider(), + customMapTilerConfigProvider: () -> Result = { Result.success(null) }, ): ShareLocationPresenter = ShareLocationPresenter( permissionsPresenterFactory = { fakePermissionsPresenter }, room = joinedRoom, @@ -106,7 +103,7 @@ class ShareLocationPresenterTest { liveLocationShareManager = liveLocationShareManager, liveLocationStore = liveLocationStore, userLocationStateFactory = FakeUserLocationStateFactory(), - remoteEnterpriseConfigProvider = remoteEnterpriseConfigProvider, + customMapTilerConfigProvider = customMapTilerConfigProvider, ) @Test @@ -134,9 +131,7 @@ class ShareLocationPresenterTest { client = FakeMatrixClient( sessionId = A_USER_ID, ), - remoteEnterpriseConfigProvider = FakeRemoteEnterpriseConfigProvider( - getResult = { WellknownRetrieverResult.Success(anElementWellKnown(mapTilerConfig = mapTilerConfig)) } - ) + customMapTilerConfigProvider = { Result.success(mapTilerConfig) } ) shareLocationPresenter.test { val state = awaitItem() diff --git a/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/DefaultShowLocationEntryPointTest.kt b/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/DefaultShowLocationEntryPointTest.kt index 69451eedb7..db5c6b9f9f 100644 --- a/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/DefaultShowLocationEntryPointTest.kt +++ b/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/DefaultShowLocationEntryPointTest.kt @@ -11,7 +11,6 @@ package io.element.android.features.location.impl.show import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.bumble.appyx.core.modality.BuildContext import com.google.common.truth.Truth.assertThat -import io.element.android.features.enterprise.test.remoteconfig.FakeRemoteEnterpriseConfigProvider import io.element.android.features.location.api.Location import io.element.android.features.location.api.ShowLocationEntryPoint import io.element.android.features.location.api.ShowLocationMode @@ -21,7 +20,6 @@ import io.element.android.features.location.impl.common.permissions.FakePermissi import io.element.android.features.location.test.FakeActiveLiveLocationShareManager import io.element.android.libraries.dateformatter.test.FakeDateFormatter import io.element.android.libraries.matrix.api.core.UserId -import io.element.android.libraries.matrix.test.A_SESSION_ID import io.element.android.libraries.matrix.test.core.aBuildMeta import io.element.android.libraries.matrix.test.room.FakeJoinedRoom import io.element.android.services.analytics.test.FakeAnalyticsService @@ -51,10 +49,9 @@ class DefaultShowLocationEntryPointTest { dateFormatter = FakeDateFormatter(), stringProvider = FakeStringProvider(), joinedRoom = joinedRoom, - sessionId = A_SESSION_ID, liveLocationShareManager = FakeActiveLiveLocationShareManager(), userLocationStateFactory = FakeUserLocationStateFactory(), - remoteEnterpriseConfigProvider = FakeRemoteEnterpriseConfigProvider(), + customMapTilerConfigProvider = { Result.success(null) }, ) }, analyticsService = FakeAnalyticsService(), diff --git a/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/ShowLocationPresenterTest.kt b/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/ShowLocationPresenterTest.kt index 77b26eb66c..7d9b0d5e03 100644 --- a/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/ShowLocationPresenterTest.kt +++ b/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/ShowLocationPresenterTest.kt @@ -12,7 +12,8 @@ import app.cash.molecule.RecompositionMode import app.cash.molecule.moleculeFlow import app.cash.turbine.test import com.google.common.truth.Truth.assertThat -import io.element.android.features.enterprise.test.remoteconfig.FakeRemoteEnterpriseConfigProvider +import io.element.android.features.enterprise.api.remoteconfig.CustomMapTilerConfigProvider +import io.element.android.features.enterprise.test.remoteconfig.aMapTilerConfig import io.element.android.features.location.api.Location import io.element.android.features.location.api.ShowLocationMode import io.element.android.features.location.impl.aPermissionsState @@ -23,20 +24,15 @@ import io.element.android.features.location.impl.common.permissions.PermissionsE import io.element.android.features.location.impl.common.permissions.PermissionsState import io.element.android.features.location.impl.common.ui.LocationConstraintsDialogState import io.element.android.features.location.test.FakeActiveLiveLocationShareManager -import io.element.android.features.wellknown.test.aMapTilerConfig -import io.element.android.features.wellknown.test.anElementWellKnown import io.element.android.libraries.dateformatter.test.FakeDateFormatter -import io.element.android.libraries.matrix.api.core.SessionId import io.element.android.libraries.matrix.api.core.UserId import io.element.android.libraries.matrix.api.room.JoinedRoom import io.element.android.libraries.matrix.api.room.location.AssetType import io.element.android.libraries.matrix.api.room.location.LiveLocationShare -import io.element.android.libraries.matrix.test.A_SESSION_ID import io.element.android.libraries.matrix.test.A_USER_ID import io.element.android.libraries.matrix.test.core.aBuildMeta import io.element.android.libraries.matrix.test.room.FakeJoinedRoom import io.element.android.libraries.matrix.test.room.location.aLiveLocationShare -import io.element.android.libraries.wellknown.api.WellknownRetrieverResult import io.element.android.services.toolbox.test.strings.FakeStringProvider import io.element.android.tests.testutils.WarmUpRule import io.element.android.tests.testutils.test @@ -69,9 +65,8 @@ class ShowLocationPresenterTest { ), locationActions: FakeLocationActions = fakeLocationActions, joinedRoom: JoinedRoom = FakeJoinedRoom(), - sessionId: SessionId = A_SESSION_ID, liveLocationShareManager: FakeActiveLiveLocationShareManager = FakeActiveLiveLocationShareManager(), - remoteEnterpriseConfigProvider: FakeRemoteEnterpriseConfigProvider = FakeRemoteEnterpriseConfigProvider(), + customMapTilerConfigProvider: CustomMapTilerConfigProvider = { Result.success(null) }, ) = ShowLocationPresenter( mode = mode, permissionsPresenterFactory = { fakePermissionsPresenter }, @@ -80,21 +75,15 @@ class ShowLocationPresenterTest { dateFormatter = fakeDateFormatter, stringProvider = FakeStringProvider(), joinedRoom = joinedRoom, - sessionId = sessionId, liveLocationShareManager = liveLocationShareManager, userLocationStateFactory = FakeUserLocationStateFactory(), - remoteEnterpriseConfigProvider = remoteEnterpriseConfigProvider, + customMapTilerConfigProvider = customMapTilerConfigProvider, ) @Test fun `present - non-null customMapStyleUrl`() = runTest { val mapTilerConfig = aMapTilerConfig(apiKey = "A KEY") - val shareLocationPresenter = createShowLocationPresenter( - sessionId = A_SESSION_ID, - remoteEnterpriseConfigProvider = FakeRemoteEnterpriseConfigProvider( - getResult = { WellknownRetrieverResult.Success(anElementWellKnown(mapTilerConfig = mapTilerConfig)) } - ) - ) + val shareLocationPresenter = createShowLocationPresenter(customMapTilerConfigProvider = { Result.success(mapTilerConfig) }) shareLocationPresenter.test { val state = awaitItem() assertThat(state.customMapTilerConfig.isLoading()).isTrue() @@ -131,12 +120,7 @@ class ShowLocationPresenterTest { fun `centers on user location`() = runTest { fakePermissionsPresenter.givenState(aPermissionsState(permissions = PermissionsState.Permissions.AllGranted)) - val presenter = createShowLocationPresenter( - sessionId = A_SESSION_ID, - remoteEnterpriseConfigProvider = FakeRemoteEnterpriseConfigProvider( - getResult = { WellknownRetrieverResult.Success(anElementWellKnown(mapTilerConfig = aMapTilerConfig())) } - ) - ) + val presenter = createShowLocationPresenter(customMapTilerConfigProvider = { Result.success(aMapTilerConfig()) }) presenter.test { val initialState = awaitItem() diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accesscontrol/DefaultAccountProviderAccessControl.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accesscontrol/DefaultAccountProviderAccessControl.kt index 119923c67d..a3a475df2f 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accesscontrol/DefaultAccountProviderAccessControl.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accesscontrol/DefaultAccountProviderAccessControl.kt @@ -11,17 +11,14 @@ package io.element.android.features.login.impl.accesscontrol import dev.zacsweers.metro.AppScope import dev.zacsweers.metro.ContributesBinding import io.element.android.features.enterprise.api.EnterpriseService +import io.element.android.features.enterprise.api.IsEnterpriseBuild import io.element.android.features.login.api.accesscontrol.AccountProviderAccessControl import io.element.android.features.login.impl.changeserver.AccountProviderAccessException -import io.element.android.libraries.matrix.api.TemporaryMatrixClientFactory -import io.element.android.libraries.wellknown.api.EnterpriseRemoteConfigSource -import io.element.android.libraries.wellknown.api.WellknownRetriever @ContributesBinding(AppScope::class) class DefaultAccountProviderAccessControl( + private val isEnterpriseBuild: IsEnterpriseBuild, private val enterpriseService: EnterpriseService, - private val wellknownRetrieverFactory: WellknownRetriever.Factory, - private val temporaryMatrixClientFactory: TemporaryMatrixClientFactory, ) : AccountProviderAccessControl { override suspend fun isAllowedToConnectToAccountProvider(accountProviderUrl: String) = try { assertIsAllowedToConnectToAccountProvider( @@ -38,29 +35,19 @@ class DefaultAccountProviderAccessControl( title: String, accountProviderUrl: String, ) { - if (enterpriseService.isEnterpriseBuild.not()) { + if (isEnterpriseBuild().not()) { // Ensure that Element Pro is not required for this account provider - val temporaryMatrixClient = temporaryMatrixClientFactory.create(accountProviderUrl).getOrThrow() - temporaryMatrixClient.use { - val wellknownRetriever = wellknownRetrieverFactory.create(temporaryMatrixClient) - val wellKnown = wellknownRetriever.getElementWellKnown( - host = accountProviderUrl, - // It's expected this is hardcoded to the well-known endpoint - source = EnterpriseRemoteConfigSource.WELLKNOWN_ENDPOINT, - ).dataOrNull() - - if (wellKnown?.enforceElementPro == true) { - throw AccountProviderAccessException.NeedElementProException( - unauthorisedAccountProviderTitle = title, - applicationId = ELEMENT_PRO_APPLICATION_ID, - ) - } + if (enterpriseService.isElementProEnforced(accountProviderUrl)) { + throw AccountProviderAccessException.NeedElementProException( + unauthorisedAccountProviderTitle = title, + applicationId = ELEMENT_PRO_APPLICATION_ID, + ) } } if (enterpriseService.isAllowedToConnectToHomeserver(accountProviderUrl).not()) { throw AccountProviderAccessException.UnauthorizedAccountProviderException( unauthorisedAccountProviderTitle = title, - authorisedAccountProviderTitles = enterpriseService.defaultHomeserverList(), + authorisedAccountProviderTitles = enterpriseService.homeserverAllowList(), ) } } diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderDataSource.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderDataSource.kt index 931959d4ea..ad016dec26 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderDataSource.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/AccountProviderDataSource.kt @@ -23,7 +23,7 @@ class AccountProviderDataSource( enterpriseService: EnterpriseService, ) { private val defaultAccountProvider = createAccountProvider( - url = enterpriseService.defaultHomeserverList() + url = enterpriseService.homeserverAllowList() .firstOrNull { it != EnterpriseService.ANY_ACCOUNT_PROVIDER } ?: AuthenticationConfig.MATRIX_ORG_URL ) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderPresenter.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderPresenter.kt index 41605352ef..826cca0c2b 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderPresenter.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderPresenter.kt @@ -28,7 +28,7 @@ class ChangeAccountProviderPresenter( @Composable override fun present(): ChangeAccountProviderState { val staticAccountProviderList = remember { - enterpriseService.defaultHomeserverList() + enterpriseService.homeserverAllowList() .filter { it != EnterpriseService.ANY_ACCOUNT_PROVIDER } .map { it.ensureProtocol() } .ifEmpty { listOf(AuthenticationConfig.MATRIX_ORG_URL) } diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/chooseaccountprovider/ChooseAccountProviderPresenter.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/chooseaccountprovider/ChooseAccountProviderPresenter.kt index a9983a19d1..92c3ff0fff 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/chooseaccountprovider/ChooseAccountProviderPresenter.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/chooseaccountprovider/ChooseAccountProviderPresenter.kt @@ -60,7 +60,7 @@ class ChooseAccountProviderPresenter( val staticAccountProviderList = remember { // The list cannot contains ANY_ACCOUNT_PROVIDER ("*") and cannot be empty at this point - enterpriseService.defaultHomeserverList() + enterpriseService.homeserverAllowList() .map { it.ensureProtocol() } .map { url -> AccountProvider( diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingPresenter.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingPresenter.kt index 29e4b1afe5..850e4332dd 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingPresenter.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingPresenter.kt @@ -62,13 +62,13 @@ class OnBoardingPresenter( val forcedAccountProvider = remember { // If defaultHomeserverList() returns a singleton list, this is the default account provider. // In this case, the user can sign in using this homeserver, or use QrCode login - enterpriseService.defaultHomeserverList().singleOrNull() + enterpriseService.homeserverAllowList().singleOrNull() } val canConnectToAnyHomeserver = remember { enterpriseService.canConnectToAnyHomeserver() } val mustChooseAccountProvider = remember { - !canConnectToAnyHomeserver && enterpriseService.defaultHomeserverList().size > 1 + !canConnectToAnyHomeserver && enterpriseService.homeserverAllowList().size > 1 } val linkAccountProvider by produceState(initialValue = null) { // Account provider from the link, if allowed by the enterprise service diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accesscontrol/DefaultAccountProviderAccessControlTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accesscontrol/DefaultAccountProviderAccessControlTest.kt index ee4cea0532..fbfae984fc 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accesscontrol/DefaultAccountProviderAccessControlTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/accesscontrol/DefaultAccountProviderAccessControlTest.kt @@ -11,15 +11,9 @@ package io.element.android.features.login.impl.accesscontrol import com.google.common.truth.Truth.assertThat import io.element.android.features.enterprise.test.FakeEnterpriseService import io.element.android.features.login.impl.changeserver.AccountProviderAccessException -import io.element.android.features.wellknown.test.FakeWellknownRetriever -import io.element.android.features.wellknown.test.FakeWellknownRetrieverFactory -import io.element.android.features.wellknown.test.anElementWellKnown import io.element.android.libraries.matrix.test.AN_ACCOUNT_PROVIDER import io.element.android.libraries.matrix.test.AN_ACCOUNT_PROVIDER_2 import io.element.android.libraries.matrix.test.AN_ACCOUNT_PROVIDER_URL -import io.element.android.libraries.matrix.test.FakeTemporaryMatrixClientFactory -import io.element.android.libraries.wellknown.api.ElementWellKnown -import io.element.android.libraries.wellknown.api.WellknownRetrieverResult import kotlinx.coroutines.test.runTest import org.junit.Assert.assertThrows import org.junit.Test @@ -30,9 +24,7 @@ class DefaultAccountProviderAccessControlTest { val accessControl = createDefaultAccountProviderAccessControl( isEnterpriseBuild = false, isAllowedToConnectToHomeserver = true, - elementWellKnown = anElementWellKnown( - enforceElementPro = true, - ), + enterpriseService = FakeEnterpriseService(isElementProEnforcedResult = { true }), ) accessControl.expectNeedElementProException() } @@ -43,9 +35,7 @@ class DefaultAccountProviderAccessControlTest { isEnterpriseBuild = false, // false here. isAllowedToConnectToHomeserver = false, - elementWellKnown = anElementWellKnown( - enforceElementPro = true, - ), + enterpriseService = FakeEnterpriseService(isElementProEnforcedResult = { true }), ) accessControl.expectNeedElementProException() } @@ -55,8 +45,9 @@ class DefaultAccountProviderAccessControlTest { val accessControl = createDefaultAccountProviderAccessControl( isEnterpriseBuild = false, isAllowedToConnectToHomeserver = true, - elementWellKnown = anElementWellKnown( - enforceElementPro = false, + enterpriseService = FakeEnterpriseService( + isAllowedToConnectToHomeserverResult = { true }, + isElementProEnforcedResult = { false } ), ) accessControl.expectAllowed() @@ -67,19 +58,15 @@ class DefaultAccountProviderAccessControlTest { val accessControl = createDefaultAccountProviderAccessControl( isEnterpriseBuild = false, isAllowedToConnectToHomeserver = true, - elementWellKnown = anElementWellKnown( - enforceElementPro = null, - ), ) accessControl.expectAllowed() } @Test - fun `foss build should allow using account provider twith missing wellknown`() = runTest { + fun `foss build should allow using account provider with missing wellknown`() = runTest { val accessControl = createDefaultAccountProviderAccessControl( isEnterpriseBuild = false, isAllowedToConnectToHomeserver = true, - elementWellKnown = null, ) accessControl.expectAllowed() } @@ -90,8 +77,10 @@ class DefaultAccountProviderAccessControlTest { isEnterpriseBuild = false, isAllowedToConnectToHomeserver = false, allowedAccountProviders = listOf(AN_ACCOUNT_PROVIDER_2), - elementWellKnown = anElementWellKnown( - enforceElementPro = false, + enterpriseService = FakeEnterpriseService( + isAllowedToConnectToHomeserverResult = { false }, + isElementProEnforcedResult = { false }, + defaultHomeserverListResult = { listOf(AN_ACCOUNT_PROVIDER_2) }, ), ) accessControl.expectUnauthorizedAccountProviderException() @@ -102,8 +91,9 @@ class DefaultAccountProviderAccessControlTest { val accessControl = createDefaultAccountProviderAccessControl( isEnterpriseBuild = true, isAllowedToConnectToHomeserver = true, - elementWellKnown = anElementWellKnown( - enforceElementPro = true, + enterpriseService = FakeEnterpriseService( + isAllowedToConnectToHomeserverResult = { true }, + isElementProEnforcedResult = { true }, ), ) accessControl.expectAllowed() @@ -114,8 +104,9 @@ class DefaultAccountProviderAccessControlTest { val accessControl = createDefaultAccountProviderAccessControl( isEnterpriseBuild = true, isAllowedToConnectToHomeserver = true, - elementWellKnown = anElementWellKnown( - enforceElementPro = false, + enterpriseService = FakeEnterpriseService( + isAllowedToConnectToHomeserverResult = { true }, + isElementProEnforcedResult = { false }, ), ) accessControl.expectAllowed() @@ -127,8 +118,10 @@ class DefaultAccountProviderAccessControlTest { isEnterpriseBuild = true, isAllowedToConnectToHomeserver = false, allowedAccountProviders = listOf(AN_ACCOUNT_PROVIDER_2), - elementWellKnown = anElementWellKnown( - enforceElementPro = true, + enterpriseService = FakeEnterpriseService( + isAllowedToConnectToHomeserverResult = { false }, + isElementProEnforcedResult = { true }, + defaultHomeserverListResult = { listOf(AN_ACCOUNT_PROVIDER_2) }, ), ) accessControl.expectUnauthorizedAccountProviderException() @@ -140,8 +133,10 @@ class DefaultAccountProviderAccessControlTest { isEnterpriseBuild = true, isAllowedToConnectToHomeserver = false, allowedAccountProviders = listOf(AN_ACCOUNT_PROVIDER_2), - elementWellKnown = anElementWellKnown( - enforceElementPro = false, + enterpriseService = FakeEnterpriseService( + isAllowedToConnectToHomeserverResult = { false }, + isElementProEnforcedResult = { false }, + defaultHomeserverListResult = { listOf(AN_ACCOUNT_PROVIDER_2) }, ), ) accessControl.expectUnauthorizedAccountProviderException() @@ -151,25 +146,14 @@ class DefaultAccountProviderAccessControlTest { isEnterpriseBuild: Boolean = false, isAllowedToConnectToHomeserver: Boolean = false, allowedAccountProviders: List = emptyList(), - elementWellKnown: ElementWellKnown? = null, - ) = DefaultAccountProviderAccessControl( - enterpriseService = FakeEnterpriseService( - isEnterpriseBuild = isEnterpriseBuild, + enterpriseService: FakeEnterpriseService = FakeEnterpriseService( isAllowedToConnectToHomeserverResult = { isAllowedToConnectToHomeserver }, defaultHomeserverListResult = { allowedAccountProviders }, - ), - wellknownRetrieverFactory = FakeWellknownRetrieverFactory( - wellknownRetriever = FakeWellknownRetriever( - getElementWellKnownResult = { _, _ -> - if (elementWellKnown == null) { - WellknownRetrieverResult.NotFound - } else { - WellknownRetrieverResult.Success(elementWellKnown) - } - }, - ), - ), - temporaryMatrixClientFactory = FakeTemporaryMatrixClientFactory(), + isElementProEnforcedResult = { false }, + ) + ) = DefaultAccountProviderAccessControl( + isEnterpriseBuild = { isEnterpriseBuild }, + enterpriseService = enterpriseService, ) private fun DefaultAccountProviderAccessControl.expectNeedElementProException() { diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenterTest.kt index c28fee77ad..71663c5e7f 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenterTest.kt @@ -16,22 +16,15 @@ import io.element.android.features.login.impl.accountprovider.AccountProvider import io.element.android.features.login.impl.accountprovider.AccountProviderDataSource import io.element.android.features.login.impl.error.ChangeServerError import io.element.android.features.login.impl.localnetwork.LocalNetworkPermissionGate -import io.element.android.features.wellknown.test.FakeWellknownRetriever -import io.element.android.features.wellknown.test.FakeWellknownRetrieverFactory -import io.element.android.features.wellknown.test.anElementWellKnown import io.element.android.libraries.architecture.AsyncData import io.element.android.libraries.matrix.test.AN_EXCEPTION import io.element.android.libraries.matrix.test.A_HOMESERVER_URL -import io.element.android.libraries.matrix.test.FakeTemporaryMatrixClientFactory import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService import io.element.android.libraries.matrix.test.auth.aMatrixHomeServerDetails import io.element.android.libraries.permissions.api.localnetwork.LocalNetworkPermissionDialog import io.element.android.libraries.permissions.test.FakeLocalNetworkPermissionAdvisor import io.element.android.libraries.permissions.test.FakePermissionsPresenter import io.element.android.libraries.permissions.test.FakePermissionsPresenterFactory -import io.element.android.libraries.wellknown.api.EnterpriseRemoteConfigSource -import io.element.android.libraries.wellknown.api.WellknownRetriever -import io.element.android.libraries.wellknown.api.WellknownRetrieverResult import io.element.android.tests.testutils.WarmUpRule import io.element.android.tests.testutils.lambda.lambdaRecorder import io.element.android.tests.testutils.lambda.value @@ -64,6 +57,7 @@ class ChangeServerPresenterTest { authenticationService = authenticationService, enterpriseService = FakeEnterpriseService( isAllowedToConnectToHomeserverResult = { true }, + isElementProEnforcedResult = { false }, ), ).test { val initialState = awaitItem() @@ -86,6 +80,7 @@ class ChangeServerPresenterTest { createPresenter( enterpriseService = FakeEnterpriseService( isAllowedToConnectToHomeserverResult = { true }, + isElementProEnforcedResult = { false }, ), authenticationService = authenticationService, ).test { @@ -113,6 +108,7 @@ class ChangeServerPresenterTest { createPresenter( enterpriseService = FakeEnterpriseService( isAllowedToConnectToHomeserverResult = { true }, + isElementProEnforcedResult = { false }, ), authenticationService = authenticationService, ).test { @@ -136,6 +132,7 @@ class ChangeServerPresenterTest { enterpriseService = FakeEnterpriseService( isAllowedToConnectToHomeserverResult = isAllowedToConnectToHomeserverResult, defaultHomeserverListResult = { listOf("element.io") }, + isElementProEnforcedResult = { false }, ), ).test { val initialState = awaitItem() @@ -159,23 +156,19 @@ class ChangeServerPresenterTest { @Test fun `present - change server element pro required error`() = runTest { - val getElementWellKnownResult = lambdaRecorder { homeserver: String, _: EnterpriseRemoteConfigSource -> - assertThat(homeserver).isEqualTo(A_HOMESERVER_URL) - WellknownRetrieverResult.Success( - anElementWellKnown( - enforceElementPro = true, - ) - ) - } + val isEnterpriseBuildLambda = lambdaRecorder { false } createPresenter( - wellknownRetriever = FakeWellknownRetriever( - getElementWellKnownResult = getElementWellKnownResult, - ), + isEnterpriseBuild = isEnterpriseBuildLambda, + enterpriseService = FakeEnterpriseService( + isElementProEnforcedResult = { true }, + ) ).test { val initialState = awaitItem() assertThat(initialState.changeServerAction).isEqualTo(AsyncData.Uninitialized) val anAccountProvider = AccountProvider(url = A_HOMESERVER_URL) initialState.eventSink.invoke(ChangeServerEvents.ChangeServer(anAccountProvider)) + // Skip loading state + skipItems(1) val failureState = awaitItem() assertThat( (failureState.changeServerAction.errorOrNull() as ChangeServerError.NeedElementPro).unauthorisedAccountProviderTitle @@ -183,7 +176,7 @@ class ChangeServerPresenterTest { assertThat( (failureState.changeServerAction.errorOrNull() as ChangeServerError.NeedElementPro).applicationId ).isEqualTo("io.element.enterprise") - getElementWellKnownResult.assertions().isCalledOnce() + isEnterpriseBuildLambda.assertions().isCalledOnce() } } @@ -237,7 +230,7 @@ class ChangeServerPresenterTest { val permissionsPresenter = FakePermissionsPresenter() createPresenter( authenticationService = authenticationService, - enterpriseService = FakeEnterpriseService(isAllowedToConnectToHomeserverResult = { true }), + enterpriseService = FakeEnterpriseService(isAllowedToConnectToHomeserverResult = { true }, isElementProEnforcedResult = { false }), localNetworkPermissionAdvisor = FakeLocalNetworkPermissionAdvisor(shouldPrompt = true), permissionsPresenter = permissionsPresenter, ).test { @@ -259,16 +252,15 @@ class ChangeServerPresenterTest { authenticationService: FakeMatrixAuthenticationService = FakeMatrixAuthenticationService(), accountProviderDataSource: AccountProviderDataSource = AccountProviderDataSource(FakeEnterpriseService()), enterpriseService: EnterpriseService = FakeEnterpriseService(), - wellknownRetriever: WellknownRetriever = FakeWellknownRetriever(), localNetworkPermissionAdvisor: FakeLocalNetworkPermissionAdvisor = FakeLocalNetworkPermissionAdvisor(), permissionsPresenter: FakePermissionsPresenter = FakePermissionsPresenter(), + isEnterpriseBuild: () -> Boolean = { false }, ) = ChangeServerPresenter( authenticationService = authenticationService, accountProviderDataSource = accountProviderDataSource, defaultAccountProviderAccessControl = DefaultAccountProviderAccessControl( enterpriseService = enterpriseService, - wellknownRetrieverFactory = FakeWellknownRetrieverFactory(wellknownRetriever = wellknownRetriever), - temporaryMatrixClientFactory = FakeTemporaryMatrixClientFactory(), + isEnterpriseBuild = isEnterpriseBuild, ), localNetworkPermissionGate = LocalNetworkPermissionGate( advisor = localNetworkPermissionAdvisor, diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingPresenterTest.kt index fbee19f05e..df3e3d2200 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/onboarding/OnBoardingPresenterTest.kt @@ -12,13 +12,12 @@ import com.google.common.truth.Truth.assertThat import io.element.android.appconfig.AuthenticationConfig import io.element.android.appconfig.OnBoardingConfig import io.element.android.features.enterprise.api.EnterpriseService +import io.element.android.features.enterprise.api.IsEnterpriseBuild import io.element.android.features.enterprise.test.FakeEnterpriseService import io.element.android.features.login.impl.accesscontrol.DefaultAccountProviderAccessControl import io.element.android.features.login.impl.accountprovider.AccountProviderDataSource import io.element.android.features.login.impl.localnetwork.LocalNetworkPermissionGate import io.element.android.features.login.impl.login.LoginModePresenter -import io.element.android.features.wellknown.test.FakeWellknownRetriever -import io.element.android.features.wellknown.test.FakeWellknownRetrieverFactory import io.element.android.libraries.architecture.AsyncData import io.element.android.libraries.core.meta.BuildMeta import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService @@ -29,7 +28,6 @@ import io.element.android.libraries.matrix.test.AN_EXCEPTION import io.element.android.libraries.matrix.test.A_HOMESERVER_URL import io.element.android.libraries.matrix.test.A_HOMESERVER_URL_2 import io.element.android.libraries.matrix.test.A_LOGIN_HINT -import io.element.android.libraries.matrix.test.FakeTemporaryMatrixClientFactory import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService import io.element.android.libraries.matrix.test.core.aBuildMeta import io.element.android.libraries.oauth.api.OAuthActionFlow @@ -41,7 +39,6 @@ import io.element.android.libraries.permissions.test.FakePermissionsPresenterFac import io.element.android.libraries.sessionstorage.api.SessionStore import io.element.android.libraries.sessionstorage.test.InMemorySessionStore import io.element.android.libraries.sessionstorage.test.aSessionData -import io.element.android.libraries.wellknown.api.WellknownRetriever import io.element.android.tests.testutils.WarmUpRule import io.element.android.tests.testutils.test import kotlinx.coroutines.flow.Flow @@ -186,6 +183,7 @@ class OnBoardingPresenterTest { enterpriseService = FakeEnterpriseService( defaultHomeserverListResult = { listOf(ACCOUNT_PROVIDER_FROM_CONFIG, EnterpriseService.ANY_ACCOUNT_PROVIDER) }, isAllowedToConnectToHomeserverResult = { true }, + isElementProEnforcedResult = { false }, ), ) presenter.test { @@ -259,6 +257,7 @@ class OnBoardingPresenterTest { ), enterpriseService = FakeEnterpriseService( isAllowedToConnectToHomeserverResult = { true }, + isElementProEnforcedResult = { false }, ), loginModePresenter = createLoginModePresenter( authenticationService = authenticationService, @@ -295,7 +294,7 @@ private fun createPresenter( ), buildMeta: BuildMeta = aBuildMeta(), enterpriseService: EnterpriseService = FakeEnterpriseService(), - wellknownRetriever: WellknownRetriever = FakeWellknownRetriever(), + isEnterpriseBuild: IsEnterpriseBuild = { false }, rageshakeFeatureAvailability: () -> Flow = { flowOf(true) }, loginModePresenter: LoginModePresenter = createLoginModePresenter(), onBoardingLogoResIdProvider: OnBoardingLogoResIdProvider = OnBoardingLogoResIdProvider { null }, @@ -307,8 +306,7 @@ private fun createPresenter( enterpriseService = enterpriseService, defaultAccountProviderAccessControl = DefaultAccountProviderAccessControl( enterpriseService = enterpriseService, - wellknownRetrieverFactory = FakeWellknownRetrieverFactory(wellknownRetriever = wellknownRetriever), - temporaryMatrixClientFactory = FakeTemporaryMatrixClientFactory(), + isEnterpriseBuild = isEnterpriseBuild, ), rageshakeFeatureAvailability = rageshakeFeatureAvailability, loginModePresenter = loginModePresenter, diff --git a/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/developer/DeveloperSettingsPresenter.kt b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/developer/DeveloperSettingsPresenter.kt index ac1ba06cf6..c5a9b430ee 100644 --- a/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/developer/DeveloperSettingsPresenter.kt +++ b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/developer/DeveloperSettingsPresenter.kt @@ -30,6 +30,7 @@ import io.element.android.libraries.architecture.AsyncData import io.element.android.libraries.architecture.Presenter import io.element.android.libraries.architecture.runCatchingUpdatingState import io.element.android.libraries.core.data.ByteUnit +import io.element.android.libraries.core.meta.BuildMeta import io.element.android.libraries.matrix.api.analytics.GetDatabaseSizesUseCase import io.element.android.libraries.matrix.api.core.DeviceId import io.element.android.libraries.matrix.api.core.SessionId @@ -50,6 +51,7 @@ class DeveloperSettingsPresenter( private val databaseSizesUseCase: GetDatabaseSizesUseCase, private val fileSizeFormatter: FileSizeFormatter, private val markAllRoomsAsRead: MarkAllRoomsAsRead, + private val buildMeta: BuildMeta, ) : Presenter { @Composable override fun present(): DeveloperSettingsState { @@ -117,7 +119,7 @@ class DeveloperSettingsPresenter( databaseSizes = databaseSizes.value, clearCacheAction = clearCacheAction.value, markAllRoomsAsReadAction = markAllRoomsAsReadAction.value, - isEnterpriseBuild = enterpriseService.isEnterpriseBuild, + isEnterpriseBuild = buildMeta.isEnterpriseBuild, showColorPicker = showColorPicker, deviceId = deviceId, eventSink = ::handleEvent, diff --git a/features/preferences/impl/src/test/kotlin/io/element/android/features/preferences/impl/developer/DeveloperSettingsPresenterTest.kt b/features/preferences/impl/src/test/kotlin/io/element/android/features/preferences/impl/developer/DeveloperSettingsPresenterTest.kt index bb688f498d..3b2645783f 100644 --- a/features/preferences/impl/src/test/kotlin/io/element/android/features/preferences/impl/developer/DeveloperSettingsPresenterTest.kt +++ b/features/preferences/impl/src/test/kotlin/io/element/android/features/preferences/impl/developer/DeveloperSettingsPresenterTest.kt @@ -23,12 +23,14 @@ import io.element.android.libraries.androidutils.filesize.FakeFileSizeFormatter import io.element.android.libraries.architecture.AsyncAction import io.element.android.libraries.architecture.AsyncData import io.element.android.libraries.core.data.megaBytes +import io.element.android.libraries.core.meta.BuildMeta import io.element.android.libraries.matrix.api.analytics.GetDatabaseSizesUseCase import io.element.android.libraries.matrix.api.analytics.SdkStoreSizes import io.element.android.libraries.matrix.api.core.DeviceId import io.element.android.libraries.matrix.api.core.SessionId import io.element.android.libraries.matrix.test.A_DEVICE_ID import io.element.android.libraries.matrix.test.A_SESSION_ID +import io.element.android.libraries.matrix.test.core.aBuildMeta import io.element.android.tests.testutils.WarmUpRule import io.element.android.tests.testutils.lambda.lambdaRecorder import io.element.android.tests.testutils.lambda.value @@ -108,10 +110,8 @@ class DeveloperSettingsPresenterTest { fun `present - enterprise build can change the brand color`() = runTest { val overrideBrandColorResult = lambdaRecorder { _, _ -> } val presenter = createDeveloperSettingsPresenter( - enterpriseService = FakeEnterpriseService( - isEnterpriseBuild = true, - overrideBrandColorResult = overrideBrandColorResult, - ) + enterpriseService = FakeEnterpriseService(overrideBrandColorResult = overrideBrandColorResult), + buildMeta = aBuildMeta(isEnterpriseBuild = true), ) presenter.test { skipItems(1) @@ -179,6 +179,7 @@ class DeveloperSettingsPresenterTest { vacuumStoresUseCase: VacuumStoresUseCase = VacuumStoresUseCase {}, databaseSizesUseCase: GetDatabaseSizesUseCase = GetDatabaseSizesUseCase { Result.success(SdkStoreSizes(null, null, null, null)) }, markAllRoomsAsRead: FakeMarkAllRoomsAsRead = FakeMarkAllRoomsAsRead(), + buildMeta: BuildMeta = aBuildMeta(), ): DeveloperSettingsPresenter { return DeveloperSettingsPresenter( appDeveloperSettingsPresenter = { anAppDeveloperSettingsState() }, @@ -191,6 +192,7 @@ class DeveloperSettingsPresenterTest { databaseSizesUseCase = databaseSizesUseCase, fileSizeFormatter = FakeFileSizeFormatter(), markAllRoomsAsRead = markAllRoomsAsRead, + buildMeta = buildMeta, ) } } diff --git a/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/CustomRecoveryPassphrase.kt b/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/CustomRecoveryPassphrase.kt deleted file mode 100644 index c7bc602dde..0000000000 --- a/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/CustomRecoveryPassphrase.kt +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2026 Element Creations Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.libraries.wellknown.api - -/** - * Server-driven settings for a user-chosen recovery passphrase, advertised under the well-known - * `custom_recovery_passphrase` key. Today the only rule is a minimum character count; additional - * settings can be added here as the schema grows. - */ -data class CustomRecoveryPassphrase( - val minCharacterCount: Int, -) { - /** True when [input] meets every active rule. */ - fun isSatisfiedBy(input: String): Boolean = isSatisfiedBy(input.length) - - /** True when an input of [length] characters meets every active rule. */ - fun isSatisfiedBy(length: Int): Boolean = length >= minCharacterCount -} diff --git a/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellKnownParser.kt b/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellKnownParser.kt deleted file mode 100644 index 1466a5b422..0000000000 --- a/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellKnownParser.kt +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2026 Element Creations Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.libraries.wellknown.api - -/** - * Parses the raw JSON of an Element `.well-known` document. - */ -fun interface ElementWellKnownParser { - /** - * Parses the document, failing when it is not valid JSON; unknown fields are ignored so a newer server does not break an older client. - * - * @param json the raw document as served by the server. - */ - fun parse(json: String): Result -} diff --git a/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellknownStore.kt b/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellknownStore.kt deleted file mode 100644 index 93256fa6f1..0000000000 --- a/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/ElementWellknownStore.kt +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2026 Element Creations Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.libraries.wellknown.api - -/** - * On-disk cache of the Element `.well-known` documents already fetched, so the app has a configuration to work with while offline. - */ -interface ElementWellknownStore { - /** - * Reads the cached document of a domain. - * Entries older than a day are reported as outdated rather than missing, so the caller can use them while refreshing; - * a document that no longer parses is reported as an error. - * - * @param domain the server whose cached document is requested. - */ - suspend fun get(domain: String): WellknownRetrieverResult - - /** - * Stores the document of a domain and stamps it as fetched now, replacing any previous entry. - * - * @param domain the server the document belongs to. - * @param wellknown the raw document, stored as-is rather than parsed. - */ - suspend fun update(domain: String, wellknown: String): Result - - /** - * Removes the cached document of a domain, used when the stored value turns out to be unusable. - * - * @param domain the server whose entry is removed. - */ - suspend fun delete(domain: String): Result - - /** - * Creates a store, one per configuration source so that their entries never collide. - */ - fun interface Factory { - /** - * @param prefix namespaces the cache keys, or `null` for the default well-known endpoint. - */ - fun create(prefix: String?): ElementWellknownStore - } -} diff --git a/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/EnterpriseRemoteConfigSource.kt b/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/EnterpriseRemoteConfigSource.kt deleted file mode 100644 index 147f31269d..0000000000 --- a/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/EnterpriseRemoteConfigSource.kt +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2026 Element Creations Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.libraries.wellknown.api - -/** - * The source from which the enterprise remote configuration is retrieved. - */ -enum class EnterpriseRemoteConfigSource { - /** - * Retrieve the enterprise remote configuration from the Element Server Suite configuration (ESS_CONFIG) endpoint. - */ - ESS_CONFIG, - - /** - * Retrieve the enterprise remote configuration from the Element server's well-known endpoint. - */ - WELLKNOWN_ENDPOINT, -} diff --git a/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/WellknownRetriever.kt b/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/WellknownRetriever.kt deleted file mode 100644 index 9e265bc213..0000000000 --- a/libraries/wellknown/api/src/main/kotlin/io/element/android/libraries/wellknown/api/WellknownRetriever.kt +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.libraries.wellknown.api - -import io.element.android.libraries.matrix.api.UrlContentFetcher - -/** - * Retrieves the Element specific `.well-known` configuration of a server, which is how a deployment advertises its own settings. - */ -interface WellknownRetriever { - /** - * Returns the configuration of a host, served from the local cache when possible. - * A cached value that has gone stale is returned as outdated while a refresh runs in the background, so this rarely waits on the network. - * An enterprise build with a hardcoded configuration always short-circuits and returns that instead. - * - * @param host the server to look up; a full URL is accepted and reduced to its host. - * @param source which endpoint to read the configuration from, which also selects the cache it is stored in. - */ - suspend fun getElementWellKnown( - host: String, - source: EnterpriseRemoteConfigSource - ): WellknownRetrieverResult - - /** - * Creates a retriever, which needs a fetcher because the configuration is read over HTTP. - */ - interface Factory { - /** - * @param urlContentFetcher used to perform the request; a client that is not authenticated yet also works. - */ - fun create(urlContentFetcher: UrlContentFetcher): WellknownRetriever - } -} diff --git a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/DefaultElementWellKnownParser.kt b/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/DefaultElementWellKnownParser.kt deleted file mode 100644 index 4cf72366e0..0000000000 --- a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/DefaultElementWellKnownParser.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2026 Element Creations Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.libraries.wellknown.impl - -import dev.zacsweers.metro.AppScope -import dev.zacsweers.metro.ContributesBinding -import io.element.android.libraries.androidutils.json.JsonProvider -import io.element.android.libraries.core.extensions.runCatchingExceptions -import io.element.android.libraries.wellknown.api.ElementWellKnown -import io.element.android.libraries.wellknown.api.ElementWellKnownParser - -@ContributesBinding(AppScope::class) -class DefaultElementWellKnownParser( - private val jsonProvider: JsonProvider, -) : ElementWellKnownParser { - override fun parse(json: String): Result { - return runCatchingExceptions { - val decoder = jsonProvider() - decoder.decodeFromString(json).map() - } - } -} diff --git a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/DefaultWellKnownStore.kt b/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/DefaultWellKnownStore.kt deleted file mode 100644 index 4d58e70db4..0000000000 --- a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/DefaultWellKnownStore.kt +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2026 Element Creations Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.libraries.wellknown.impl - -import dev.zacsweers.metro.AppScope -import dev.zacsweers.metro.Assisted -import dev.zacsweers.metro.AssistedFactory -import dev.zacsweers.metro.AssistedInject -import dev.zacsweers.metro.ContributesBinding -import io.element.android.libraries.cachestore.api.CacheData -import io.element.android.libraries.cachestore.api.CacheStore -import io.element.android.libraries.core.extensions.runCatchingExceptions -import io.element.android.libraries.wellknown.api.ElementWellKnown -import io.element.android.libraries.wellknown.api.ElementWellKnownParser -import io.element.android.libraries.wellknown.api.ElementWellknownStore -import io.element.android.libraries.wellknown.api.WellknownRetrieverResult -import io.element.android.services.toolbox.api.systemclock.SystemClock - -@AssistedInject -class DefaultWellKnownStore( - @Assisted - private val prefix: String?, - private val cacheStore: CacheStore, - private val elementWellKnownParser: ElementWellKnownParser, - private val systemClock: SystemClock, -) : ElementWellknownStore { - @AssistedFactory - @ContributesBinding(AppScope::class) - fun interface Factory : ElementWellknownStore.Factory { - override fun create(prefix: String?): DefaultWellKnownStore - } - override suspend fun get(domain: String): WellknownRetrieverResult { - return runCatchingExceptions { - val cachedData = cacheStore.getData(key(domain)) - if (cachedData != null) { - val data = elementWellKnownParser.parse(cachedData.value).getOrThrow() - if (systemClock.epochMillis() > cachedData.updatedAt + CACHE_VALIDITY_MILLIS) { - WellknownRetrieverResult.Outdated(data) - } else { - WellknownRetrieverResult.Success(data) - } - } else { - WellknownRetrieverResult.NotFound - } - }.recover { - WellknownRetrieverResult.Error(it as Exception) - }.getOrThrow() - } - - override suspend fun update(domain: String, wellknown: String): Result { - return runCatchingExceptions { - cacheStore.storeData(key(domain), CacheData(wellknown, systemClock.epochMillis())) - } - } - - override suspend fun delete(domain: String): Result { - return runCatchingExceptions { - cacheStore.deleteData(key(domain)) - } - } - - private fun key(domain: String): String = if (prefix != null) { - "$prefix-$domain" - } else { - "https://$domain/.well-known/element/element.json" - } - - companion object { - // 1 day - private const val CACHE_VALIDITY_MILLIS = 1 * 24 * 60 * 60 * 1000L - } -} diff --git a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/DefaultWellknownRetriever.kt b/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/DefaultWellknownRetriever.kt deleted file mode 100644 index 60e8c621e2..0000000000 --- a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/DefaultWellknownRetriever.kt +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.libraries.wellknown.impl - -import dev.zacsweers.metro.AppScope -import dev.zacsweers.metro.Assisted -import dev.zacsweers.metro.AssistedFactory -import dev.zacsweers.metro.AssistedInject -import dev.zacsweers.metro.ContributesBinding -import io.element.android.features.enterprise.api.EnterpriseService -import io.element.android.libraries.androidutils.text.takeIfNotBlank -import io.element.android.libraries.core.extensions.mapCatchingExceptions -import io.element.android.libraries.core.extensions.runCatchingExceptions -import io.element.android.libraries.core.uri.ensureProtocol -import io.element.android.libraries.di.annotations.AppCoroutineScope -import io.element.android.libraries.matrix.api.UrlContentFetcher -import io.element.android.libraries.matrix.api.exception.ClientException -import io.element.android.libraries.wellknown.api.ElementWellKnown -import io.element.android.libraries.wellknown.api.ElementWellKnownParser -import io.element.android.libraries.wellknown.api.ElementWellknownStore -import io.element.android.libraries.wellknown.api.EnterpriseRemoteConfigSource -import io.element.android.libraries.wellknown.api.WellknownRetriever -import io.element.android.libraries.wellknown.api.WellknownRetrieverResult -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.launch -import timber.log.Timber -import java.net.URL - -@AssistedInject -class DefaultWellknownRetriever( - private val elementWellknownStoreFactory: ElementWellknownStore.Factory, - private val enterpriseService: EnterpriseService, - private val elementWellKnownParser: ElementWellKnownParser, - @Assisted private val urlContentFetcher: UrlContentFetcher, - @AppCoroutineScope private val coroutineScope: CoroutineScope, -) : WellknownRetriever { - @ContributesBinding(AppScope::class) - @AssistedFactory - fun interface Factory : WellknownRetriever.Factory { - override fun create(urlContentFetcher: UrlContentFetcher): DefaultWellknownRetriever - } - - override suspend fun getElementWellKnown( - host: String, - source: EnterpriseRemoteConfigSource - ): WellknownRetrieverResult { - val overriddenElementWellKnown = enterpriseService.overriddenElementWellKnown() - if (overriddenElementWellKnown != null) { - return WellknownRetrieverResult.Success(overriddenElementWellKnown) - } - - // The passed `host` function may be a full URL, in that case we're only interested in the actual host - val checkedHost = runCatchingExceptions { URL(host.ensureProtocol()).host.takeIfNotBlank() } - .getOrElse { return WellknownRetrieverResult.Error(IllegalArgumentException("host parameter is not valid", it)) } - ?: host - - // We instantiate different stores for different sources, so that we can cache them separately. - // The ESS_CONFIG source is cached with a prefix to differentiate it from the WELLKNOWN_ENDPOINT. - val prefix = when (source) { - EnterpriseRemoteConfigSource.ESS_CONFIG -> "ess_config" - EnterpriseRemoteConfigSource.WELLKNOWN_ENDPOINT -> null - } - val store = elementWellknownStoreFactory.create(prefix) - return when (val cacheData = store.get(checkedHost)) { - is WellknownRetrieverResult.Success -> { - Timber.d("Using cached well-known for domain $checkedHost") - cacheData - } - is WellknownRetrieverResult.Outdated -> { - // Return the outdated data but refresh in the background - // If the cache is missing or outdated, trigger a refresh in background but still return the cached value - Timber.d("Outdated cached well-known for domain $checkedHost, returning existing value and fetching new one from network") - coroutineScope.launch { fetchElementWellKnown(checkedHost, source, store) } - cacheData - } - is WellknownRetrieverResult.NotFound -> { - // Try to fetch from the server - Timber.d("No cached well-known for domain $checkedHost, fetching from network") - fetchElementWellKnown(checkedHost, source, store) - } - is WellknownRetrieverResult.Error -> { - // Return the error - Timber.e(cacheData.exception, "Error retrieving well-known for domain $checkedHost") - cacheData.exception.toWellknownRetrieverResult() - } - } - } - - private suspend fun fetchElementWellKnown( - host: String, - source: EnterpriseRemoteConfigSource, - store: ElementWellknownStore - ): WellknownRetrieverResult { - return urlContentFetcher - .getUrl(url(host, source)) - .mapCatchingExceptions { - val data = String(it) - val parsed = elementWellKnownParser.parse(data).getOrThrow() - // Also store in cache, if valid - store.update(host, data) - .onFailure { exception -> - Timber.e(exception, "Failed to parse cached Element .well-known data for $host, deleting cache") - store.delete(host) - } - parsed - } - .toWellknownRetrieverResult(host) - } - - private fun Result.toWellknownRetrieverResult(host: String): WellknownRetrieverResult = fold( - onSuccess = { - WellknownRetrieverResult.Success(it) - }, - onFailure = { - Timber.e(it, "Failed to retrieve Element .well-known from $host") - // This check on message value is not ideal but this is what we got from the SDK. - it.toWellknownRetrieverResult() - } - ) - - private fun Throwable.toWellknownRetrieverResult(): WellknownRetrieverResult { - return if ((this as? ClientException.Generic)?.message?.contains("404") == true) { - WellknownRetrieverResult.NotFound - } else { - WellknownRetrieverResult.Error(this as Exception) - } - } - - private fun url(host: String, source: EnterpriseRemoteConfigSource): String { - val elementWellKnownUrl = "https://$host/.well-known/element/element.json" - return when (source) { - EnterpriseRemoteConfigSource.ESS_CONFIG -> enterpriseService.essConfigEndpointUrl(host) ?: elementWellKnownUrl - EnterpriseRemoteConfigSource.WELLKNOWN_ENDPOINT -> elementWellKnownUrl - } - } -} diff --git a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/InternalElementWellKnown.kt b/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/InternalElementWellKnown.kt deleted file mode 100644 index 317109a1c0..0000000000 --- a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/InternalElementWellKnown.kt +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.libraries.wellknown.impl - -import kotlinx.serialization.SerialName -import kotlinx.serialization.Serializable - -/** - * Example: - *
- * {
- *     "registration_helper_url": "https://element.io",
- *     "enforce_element_pro": true,
- *     "rageshake_url": "https://example.org/rageshake",
- *     "brand_color": "#FF0000",
- *     "notification_sound": "ring.flac",
- *     "idp_app_scheme": "io.element.app",
- *     "custom_recovery_passphrase": {
- *         "min_character_count": 8
- *     }
- * }
- * 
- * . - */ -@Serializable -data class InternalElementWellKnown( - @SerialName("registration_helper_url") - val registrationHelperUrl: String? = null, - @SerialName("enforce_element_pro") - val enforceElementPro: Boolean? = null, - @SerialName("rageshake_url") - val rageshakeUrl: String? = null, - @SerialName("brand_color") - val brandColor: String? = null, - @SerialName("notification_sound") - val notificationSound: String? = null, - @SerialName("idp_app_scheme") - val identityProviderAppScheme: String? = null, - @SerialName("custom_recovery_passphrase") - val customRecoveryPassphrase: InternalCustomRecoveryPassphrase? = null, - @SerialName("content_scanner_url") - val contentScannerUrl: String? = null, - @SerialName("force_disable_e2ee") - val forceDisableE2EE: Boolean? = null, - @SerialName("map_tiler") - val mapTilerConfig: InternalMapTilerConfig? = null, -) - -@Serializable -data class InternalCustomRecoveryPassphrase( - @SerialName("min_character_count") - val minCharacterCount: Int? = null, -) - -@Serializable -data class InternalMapTilerConfig( - @SerialName("api_key") - val apiKey: String, - @SerialName("light_style_id") - val lightStyleId: String? = null, - @SerialName("dark_style_id") - val darkStyleId: String? = null, - @SerialName("base_url") - val baseUrl: String? = null, -) diff --git a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/InternalWellKnown.kt b/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/InternalWellKnown.kt deleted file mode 100644 index bf43356c45..0000000000 --- a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/InternalWellKnown.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2023-2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.libraries.wellknown.impl - -import kotlinx.serialization.SerialName -import kotlinx.serialization.Serializable - -/** - * https://matrix.org/docs/spec/client_server/r0.4.0.html#server-discovery - *
- * {
- *     "m.homeserver": {
- *         "base_url": "https://matrix.org"
- *     },
- *     "m.identity_server": {
- *         "base_url": "https://vector.im"
- *     },
- * }
- * 
- * . - */ -@Serializable -data class InternalWellKnown( - @SerialName("m.homeserver") - val homeServer: InternalWellKnownBaseConfig? = null, - @SerialName("m.identity_server") - val identityServer: InternalWellKnownBaseConfig? = null, -) diff --git a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/InternalWellKnownBaseConfig.kt b/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/InternalWellKnownBaseConfig.kt deleted file mode 100644 index 342cd43395..0000000000 --- a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/InternalWellKnownBaseConfig.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2023-2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.libraries.wellknown.impl - -import kotlinx.serialization.SerialName -import kotlinx.serialization.Serializable - -/** - * https://matrix.org/docs/spec/client_server/r0.4.0.html#server-discovery - *
- * {
- *     "base_url": "https://element.io"
- * }
- * 
- * . - */ -@Serializable -data class InternalWellKnownBaseConfig( - @SerialName("base_url") - val baseURL: String? = null -) diff --git a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/Mapper.kt b/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/Mapper.kt deleted file mode 100644 index 254036c5c3..0000000000 --- a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/Mapper.kt +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.libraries.wellknown.impl - -import io.element.android.libraries.core.log.logger.LoggerTag -import io.element.android.libraries.wellknown.api.CustomRecoveryPassphrase -import io.element.android.libraries.wellknown.api.ElementWellKnown -import io.element.android.libraries.wellknown.api.MapTilerConfig -import timber.log.Timber - -private val loggerTag = LoggerTag("Wellknown") - -/** - * Floor for the recovery passphrase minimum length. A value of 1 guarantees the derived passphrase is - * never empty (an empty passphrase derives a recoverable but effectively unprotected secret-storage - * key). Anything stronger than non-empty is left to the homeserver operator's configuration. - */ -private const val MINIMUM_PASSPHRASE_CHARACTER_COUNT = 1 - -fun InternalElementWellKnown.map() = ElementWellKnown( - registrationHelperUrl = registrationHelperUrl, - enforceElementPro = enforceElementPro, - rageshakeUrl = rageshakeUrl, - brandColor = brandColor, - notificationSound = notificationSound, - identityProviderAppScheme = identityProviderAppScheme, - customRecoveryPassphrase = customRecoveryPassphrase?.toPublic(), - contentScannerUrl = contentScannerUrl, - forceDisableE2EE = forceDisableE2EE, - mapTilerConfig = mapTilerConfig?.let { - MapTilerConfig( - apiKey = it.apiKey, - lightStyleId = it.lightStyleId, - darkStyleId = it.darkStyleId, - baseUrl = it.baseUrl, - ) - } -) - -private fun InternalCustomRecoveryPassphrase.toPublic(): CustomRecoveryPassphrase { - // Whenever the homeserver advertises the settings block we run the custom passphrase flow, flooring - // the minimum at 1 so the passphrase can never be empty even if the server omits min_character_count - // or advertises a non-positive value. The operator owns any stronger minimum. - val min = (minCharacterCount ?: MINIMUM_PASSPHRASE_CHARACTER_COUNT).coerceAtLeast(MINIMUM_PASSPHRASE_CHARACTER_COUNT) - if (min != minCharacterCount) { - Timber.tag(loggerTag.value).w( - "custom_recovery_passphrase.min_character_count was %s; flooring to %d", - minCharacterCount, - min, - ) - } - return CustomRecoveryPassphrase(minCharacterCount = min) -} diff --git a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/SessionWellknownModule.kt b/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/SessionWellknownModule.kt deleted file mode 100644 index 1587e95765..0000000000 --- a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/SessionWellknownModule.kt +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2026 Element Creations Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.libraries.wellknown.impl - -import dev.zacsweers.metro.BindingContainer -import dev.zacsweers.metro.ContributesTo -import dev.zacsweers.metro.Provides -import io.element.android.features.enterprise.api.EnterpriseService -import io.element.android.libraries.di.SessionScope -import io.element.android.libraries.di.annotations.SessionCoroutineScope -import io.element.android.libraries.matrix.api.UrlContentFetcher -import io.element.android.libraries.wellknown.api.ElementWellKnownParser -import io.element.android.libraries.wellknown.api.ElementWellknownStore -import io.element.android.libraries.wellknown.api.WellknownRetriever -import kotlinx.coroutines.CoroutineScope - -@BindingContainer -@ContributesTo(SessionScope::class) -object SessionWellknownModule { - @Provides - fun provideWellKnownRetriever( - elementWellknownStoreFactory: ElementWellknownStore.Factory, - enterpriseService: EnterpriseService, - elementWellKnownParser: ElementWellKnownParser, - urlContentFetcher: UrlContentFetcher, - @SessionCoroutineScope coroutineScope: CoroutineScope, - ): WellknownRetriever { - return DefaultWellknownRetriever( - elementWellknownStoreFactory = elementWellknownStoreFactory, - enterpriseService = enterpriseService, - elementWellKnownParser = elementWellKnownParser, - urlContentFetcher = urlContentFetcher, - coroutineScope = coroutineScope - ) - } -} diff --git a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/WellknownAPI.kt b/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/WellknownAPI.kt deleted file mode 100644 index 54528f7c42..0000000000 --- a/libraries/wellknown/impl/src/main/kotlin/io/element/android/libraries/wellknown/impl/WellknownAPI.kt +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2023-2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.libraries.wellknown.impl - -import retrofit2.http.GET - -internal interface WellknownAPI { - @GET(".well-known/matrix/client") - suspend fun getWellKnown(): InternalWellKnown - - @GET(".well-known/element/element.json") - suspend fun getElementWellKnown(): InternalElementWellKnown -} diff --git a/libraries/wellknown/impl/src/test/kotlin/io/element/android/libraries/wellknown/api/CustomRecoveryPassphraseTest.kt b/libraries/wellknown/impl/src/test/kotlin/io/element/android/libraries/wellknown/api/CustomRecoveryPassphraseTest.kt deleted file mode 100644 index d4e7ac112e..0000000000 --- a/libraries/wellknown/impl/src/test/kotlin/io/element/android/libraries/wellknown/api/CustomRecoveryPassphraseTest.kt +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2026 Element Creations Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.libraries.wellknown.api - -import com.google.common.truth.Truth.assertThat -import org.junit.Test - -class CustomRecoveryPassphraseTest { - @Test - fun `empty input never satisfies a positive minimum`() { - assertThat(CustomRecoveryPassphrase(minCharacterCount = 1).isSatisfiedBy("")).isFalse() - } - - @Test - fun `input shorter than minimum is not satisfied`() { - assertThat(CustomRecoveryPassphrase(minCharacterCount = 8).isSatisfiedBy("abc")).isFalse() - } - - @Test - fun `input exactly at minimum is satisfied`() { - assertThat(CustomRecoveryPassphrase(minCharacterCount = 8).isSatisfiedBy("abcdefgh")).isTrue() - } - - @Test - fun `input longer than minimum is satisfied`() { - assertThat(CustomRecoveryPassphrase(minCharacterCount = 4).isSatisfiedBy("abcdefgh")).isTrue() - } -} diff --git a/libraries/wellknown/impl/src/test/kotlin/io/element/android/libraries/wellknown/impl/DefaultWellKnownStoreTest.kt b/libraries/wellknown/impl/src/test/kotlin/io/element/android/libraries/wellknown/impl/DefaultWellKnownStoreTest.kt deleted file mode 100644 index dc101c41a0..0000000000 --- a/libraries/wellknown/impl/src/test/kotlin/io/element/android/libraries/wellknown/impl/DefaultWellKnownStoreTest.kt +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (c) 2026 Element Creations Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.libraries.wellknown.impl - -import com.google.common.truth.Truth.assertThat -import io.element.android.features.wellknown.test.anElementWellKnown -import io.element.android.libraries.androidutils.json.DefaultJsonProvider -import io.element.android.libraries.cachestore.api.CacheData -import io.element.android.libraries.sessionstorage.test.InMemoryCacheStore -import io.element.android.libraries.wellknown.api.CustomRecoveryPassphrase -import io.element.android.libraries.wellknown.api.ElementWellKnownParser -import io.element.android.libraries.wellknown.api.WellknownRetrieverResult -import io.element.android.services.toolbox.test.systemclock.A_FAKE_TIMESTAMP -import io.element.android.services.toolbox.test.systemclock.FakeSystemClock -import kotlinx.coroutines.test.runTest -import org.junit.Test - -private const val A_DOMAIN = "matrix.example.com" -private const val A_CACHE_KEY = "https://$A_DOMAIN/.well-known/element/element.json" - -// 1 day in millis -private const val CACHE_VALIDITY_MILLIS = 1 * 24 * 60 * 60 * 1000L - -class DefaultWellKnownStoreTest { - private val jsonProvider = DefaultJsonProvider() - - @Test - fun `get returns NotFound when cache is empty`() = runTest { - val sut = createDefaultWellKnownStore() - assertThat(sut.get(A_DOMAIN)).isEqualTo(WellknownRetrieverResult.NotFound) - } - - @Test - fun `get returns Success when cache has fresh data`() = runTest { - val wellKnown = InternalElementWellKnown(rageshakeUrl = "https://rageshake.example.com") - val jsonString = jsonProvider().encodeToString(wellKnown) - val clock = FakeSystemClock(epochMillisResult = A_FAKE_TIMESTAMP) - val cacheStore = InMemoryCacheStore( - initialData = mapOf(A_CACHE_KEY to CacheData(jsonString, A_FAKE_TIMESTAMP)) - ) - val sut = createDefaultWellKnownStore(cacheStore = cacheStore, systemClock = clock) - - val result = sut.get(A_DOMAIN) - - assertThat(result).isEqualTo(WellknownRetrieverResult.Success(wellKnown.map())) - } - - @Test - fun `get returns Outdated when cached data has expired`() = runTest { - val wellKnown = InternalElementWellKnown(rageshakeUrl = "https://rageshake.example.com") - val jsonString = jsonProvider().encodeToString(wellKnown) - // Store data at timestamp 0, but clock is past the validity window - val expiredTimestamp = 0L - val nowTimestamp = expiredTimestamp + CACHE_VALIDITY_MILLIS + 1 - val clock = FakeSystemClock(epochMillisResult = nowTimestamp) - val cacheStore = InMemoryCacheStore( - initialData = mapOf(A_CACHE_KEY to CacheData(jsonString, expiredTimestamp)) - ) - val sut = createDefaultWellKnownStore(cacheStore = cacheStore, systemClock = clock) - - val result = sut.get(A_DOMAIN) - - assertThat(result).isEqualTo(WellknownRetrieverResult.Outdated(wellKnown.map())) - } - - @Test - fun `get returns Error when cached data is invalid JSON`() = runTest { - val cacheStore = InMemoryCacheStore( - initialData = mapOf(A_CACHE_KEY to CacheData("not valid json at all", A_FAKE_TIMESTAMP)) - ) - val sut = createDefaultWellKnownStore(cacheStore = cacheStore) - - val result = sut.get(A_DOMAIN) - - assertThat(result).isInstanceOf(WellknownRetrieverResult.Error::class.java) - } - - @Test - fun `update stores data and get returns Success`() = runTest { - val wellKnown = """ - { - "registration_helper_url": "https://element.io", - "enforce_element_pro": true, - "rageshake_url": "https://example.org/rageshake", - "brand_color": "#FF0000", - "notification_sound": "ring.flac", - "idp_app_scheme": "io.element.app", - "custom_recovery_passphrase": { - "min_character_count": 8 - } - } - """.trimIndent() - val clock = FakeSystemClock(epochMillisResult = A_FAKE_TIMESTAMP) - val cacheStore = InMemoryCacheStore() - val sut = createDefaultWellKnownStore(cacheStore = cacheStore, systemClock = clock) - - val updateResult = sut.update(A_DOMAIN, wellKnown) - assertThat(updateResult.isSuccess).isTrue() - - val result = sut.get(A_DOMAIN) - assertThat(result).isEqualTo(WellknownRetrieverResult.Success(anElementWellKnown( - registrationHelperUrl = "https://element.io", - enforceElementPro = true, - rageshakeUrl = "https://example.org/rageshake", - brandColor = "#FF0000", - notificationSound = "ring.flac", - identityProviderAppScheme = "io.element.app", - customRecoveryPassphrase = CustomRecoveryPassphrase(8), - ))) - } - - @Test - fun `delete removes data and get returns NotFound`() = runTest { - val wellKnown = InternalElementWellKnown(rageshakeUrl = "https://rageshake.example.com") - val jsonString = jsonProvider().encodeToString(wellKnown) - val clock = FakeSystemClock(epochMillisResult = A_FAKE_TIMESTAMP) - val cacheStore = InMemoryCacheStore( - initialData = mapOf(A_CACHE_KEY to CacheData(jsonString, A_FAKE_TIMESTAMP)) - ) - val sut = createDefaultWellKnownStore(cacheStore = cacheStore, systemClock = clock) - - val deleteResult = sut.delete(A_DOMAIN) - assertThat(deleteResult.isSuccess).isTrue() - - assertThat(sut.get(A_DOMAIN)).isEqualTo(WellknownRetrieverResult.NotFound) - } - - @Test - fun `get returns data at the exact cache validity boundary as Success`() = runTest { - val wellKnown = InternalElementWellKnown(notificationSound = "ping.flac") - val jsonString = jsonProvider().encodeToString(wellKnown) - // Exactly at the boundary: epochMillis == updatedAt + CACHE_VALIDITY_MILLIS → not expired - val storedAt = 1000L - val nowAtBoundary = storedAt + CACHE_VALIDITY_MILLIS - val clock = FakeSystemClock(epochMillisResult = nowAtBoundary) - val cacheStore = InMemoryCacheStore( - initialData = mapOf(A_CACHE_KEY to CacheData(jsonString, storedAt)) - ) - val sut = createDefaultWellKnownStore(cacheStore = cacheStore, systemClock = clock) - - val result = sut.get(A_DOMAIN) - - assertThat(result).isEqualTo(WellknownRetrieverResult.Success(wellKnown.map())) - } - - @Test - fun `prefix is used`() = runTest { - val prefix = "test-prefix" - val clock = FakeSystemClock(epochMillisResult = A_FAKE_TIMESTAMP) - val cacheStore = InMemoryCacheStore( - initialData = mapOf("$prefix-$A_DOMAIN" to CacheData("{}", A_FAKE_TIMESTAMP)) - ) - val sut = createDefaultWellKnownStore(prefix = prefix, cacheStore = cacheStore, systemClock = clock) - - assertThat(sut.get(A_DOMAIN)).isInstanceOf(WellknownRetrieverResult.Success::class.java) - } - - private fun createDefaultWellKnownStore( - prefix: String? = null, - cacheStore: InMemoryCacheStore = InMemoryCacheStore(), - systemClock: FakeSystemClock = FakeSystemClock(), - elementWellKnownParser: ElementWellKnownParser = DefaultElementWellKnownParser(jsonProvider), - ) = DefaultWellKnownStore( - prefix = prefix, - cacheStore = cacheStore, - systemClock = systemClock, - elementWellKnownParser = elementWellKnownParser, - ) -} diff --git a/libraries/wellknown/impl/src/test/kotlin/io/element/android/libraries/wellknown/impl/DefaultWellknownRetrieverTest.kt b/libraries/wellknown/impl/src/test/kotlin/io/element/android/libraries/wellknown/impl/DefaultWellknownRetrieverTest.kt deleted file mode 100644 index a58aa0a347..0000000000 --- a/libraries/wellknown/impl/src/test/kotlin/io/element/android/libraries/wellknown/impl/DefaultWellknownRetrieverTest.kt +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -@file:OptIn(ExperimentalCoroutinesApi::class) - -package io.element.android.libraries.wellknown.impl - -import com.google.common.truth.Truth.assertThat -import io.element.android.features.enterprise.test.FakeEnterpriseService -import io.element.android.features.wellknown.test.FakeElementWellknownStore -import io.element.android.features.wellknown.test.aMapTilerConfig -import io.element.android.features.wellknown.test.anElementWellKnown -import io.element.android.libraries.core.uri.ensureProtocol -import io.element.android.libraries.matrix.api.UrlContentFetcher -import io.element.android.libraries.matrix.api.exception.ClientException -import io.element.android.libraries.wellknown.api.ElementWellKnown -import io.element.android.libraries.wellknown.api.ElementWellKnownParser -import io.element.android.libraries.wellknown.api.ElementWellknownStore -import io.element.android.libraries.wellknown.api.EnterpriseRemoteConfigSource -import io.element.android.libraries.wellknown.api.WellknownRetrieverResult -import io.element.android.tests.testutils.lambda.lambdaRecorder -import io.element.android.tests.testutils.lambda.value -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.test.TestScope -import kotlinx.coroutines.test.runCurrent -import kotlinx.coroutines.test.runTest -import org.junit.Test -import java.net.URL - -class DefaultWellknownRetrieverTest { - @Test - fun `get element wellknown calls resolver and parser`() = runTest { - val parser = lambdaRecorder> { Result.success(anElementWellKnown()) } - val resolver = SpyUrlContentFetcher { Result.success(WELLKNOWN_CONTENT.toByteArray()) } - val sut = createDefaultWellknownRetriever( - elementWellKnownParser = parser, - urlResolver = resolver, - ) - - sut.getElementWellKnown(WELLKNOWN_URL, EnterpriseRemoteConfigSource.WELLKNOWN_ENDPOINT) - - resolver.assertions().isCalledOnce().with(value(WELLKNOWN_URL)) - parser.assertions().isCalledOnce().with(value(WELLKNOWN_CONTENT)) - } - - @Test - fun `get element wellknown parser error`() = runTest { - val sut = createDefaultWellknownRetriever( - elementWellKnownParser = { Result.failure(IllegalStateException("Invalid JSON")) }, - ) - assertThat(sut.getElementWellKnown(WELLKNOWN_URL, EnterpriseRemoteConfigSource.WELLKNOWN_ENDPOINT)) - .isInstanceOf(WellknownRetrieverResult.Error::class.java) - } - - @Test - fun `get element wellknown network error`() = runTest { - val resolver = SpyUrlContentFetcher { Result.failure(IllegalStateException("Network error")) } - val sut = createDefaultWellknownRetriever(urlResolver = resolver) - assertThat(sut.getElementWellKnown(WELLKNOWN_URL, EnterpriseRemoteConfigSource.WELLKNOWN_ENDPOINT)) - .isInstanceOf(WellknownRetrieverResult.Error::class.java) - } - - @Test - fun `get element wellknown 404 http error counts as not found`() = runTest { - val resolver = SpyUrlContentFetcher { Result.failure(ClientException.Generic("Http error: 404", null)) } - val sut = createDefaultWellknownRetriever(urlResolver = resolver) - assertThat(sut.getElementWellKnown(WELLKNOWN_URL, EnterpriseRemoteConfigSource.WELLKNOWN_ENDPOINT)) - .isInstanceOf(WellknownRetrieverResult.NotFound::class.java) - } - - @Test - fun `get element wellknown will return an error if the provided host is not valid`() = runTest { - val sut = createDefaultWellknownRetriever() - assertThat(sut.getElementWellKnown("!not valid", EnterpriseRemoteConfigSource.WELLKNOWN_ENDPOINT)) - .isInstanceOf(WellknownRetrieverResult.Error::class.java) - } - - @Test - fun `get element wellknown will return a cached value if present instead of fetching`() = runTest { - val host = URL(WELLKNOWN_URL).host.ensureProtocol() - val sut = createDefaultWellknownRetriever( - cacheStoreFactory = { FakeElementWellknownStore(initialData = mapOf(host to WellknownRetrieverResult.Success(expectedElementWellKnown))) } - ) - assertThat(sut.getElementWellKnown(WELLKNOWN_URL, EnterpriseRemoteConfigSource.WELLKNOWN_ENDPOINT)) - .isInstanceOf(WellknownRetrieverResult.Success::class.java) - } - - @Test - fun `get element wellknown will return an outdated value first then fetch the current one`() = runTest { - val host = URL(WELLKNOWN_URL).host.ensureProtocol() - val resolver = SpyUrlContentFetcher { Result.success(WELLKNOWN_CONTENT.toByteArray()) } - val sut = createDefaultWellknownRetriever( - urlResolver = resolver, - cacheStoreFactory = { FakeElementWellknownStore(initialData = mapOf(host to WellknownRetrieverResult.Outdated(expectedElementWellKnown))) } - ) - // The first call returns the outdated value - assertThat(sut.getElementWellKnown(WELLKNOWN_URL, EnterpriseRemoteConfigSource.WELLKNOWN_ENDPOINT)) - .isInstanceOf(WellknownRetrieverResult.Outdated::class.java) - // The resolver is not called yet because the fetch is done in the background - resolver.assertions().isNeverCalled() - - // We give it some time to run the background fetch - runCurrent() - - // The resolver is called during the background fetch - resolver.assertions().isCalledOnce().with(value(WELLKNOWN_URL)) - } - - @Test - fun `get element wellknown will return an error if it happens when trying to retrieve the cached value`() = runTest { - val host = URL(WELLKNOWN_URL).host.ensureProtocol() - val sut = createDefaultWellknownRetriever( - cacheStoreFactory = { FakeElementWellknownStore(initialData = mapOf(host to WellknownRetrieverResult.Error(IllegalStateException("BOOM")))) } - ) - assertThat(sut.getElementWellKnown(WELLKNOWN_URL, EnterpriseRemoteConfigSource.WELLKNOWN_ENDPOINT)) - .isInstanceOf(WellknownRetrieverResult.Error::class.java) - } - - @Test - fun `get element wellknown will return an error if it fails to serialize the retrieved value into the cache`() = runTest { - val sut = createDefaultWellknownRetriever( - elementWellKnownParser = { Result.failure(IllegalStateException("BOOM")) }, - ) - assertThat(sut.getElementWellKnown(WELLKNOWN_URL, EnterpriseRemoteConfigSource.WELLKNOWN_ENDPOINT)) - .isInstanceOf(WellknownRetrieverResult.Error::class.java) - } - - @Test - fun `WELLKNOWN_ENDPOINT source creates a store with no prefix`() = runTest { - val storeFactory = lambdaRecorder { FakeElementWellknownStore() } - val sut = createDefaultWellknownRetriever(cacheStoreFactory = storeFactory) - - sut.getElementWellKnown(WELLKNOWN_URL, EnterpriseRemoteConfigSource.WELLKNOWN_ENDPOINT) - - storeFactory.assertions().isCalledOnce().with(value(null)) - } - - @Test - fun `ESS_CONFIG source creates a store with ess prefix and checks the ESS config endpoint`() = runTest { - val essConfigUrl = "https://ess-config.example.com" - val storeFactory = lambdaRecorder { FakeElementWellknownStore() } - val resolver = SpyUrlContentFetcher { Result.success(WELLKNOWN_CONTENT.toByteArray()) } - val sut = createDefaultWellknownRetriever( - cacheStoreFactory = storeFactory, - enterpriseService = FakeEnterpriseService( - overrideWellKnownResult = { null }, - essConfigEndpointUrlResult = { essConfigUrl }, - ), - urlResolver = resolver, - ) - - sut.getElementWellKnown(WELLKNOWN_URL, EnterpriseRemoteConfigSource.ESS_CONFIG) - - storeFactory.assertions().isCalledOnce().with(value("ess_config")) - resolver.assertions().isCalledOnce().with(value(essConfigUrl)) - } - - @Test - fun `get element wellknown was overridden`() = runTest { - val wellKnown = anElementWellKnown() - - val resolver = SpyUrlContentFetcher { Result.success(WELLKNOWN_CONTENT.toByteArray()) } - - val sut = createDefaultWellknownRetriever( - enterpriseService = FakeEnterpriseService( - overrideWellKnownResult = { wellKnown }, - ), - urlResolver = resolver, - ) - - // The overridden value is returned - assertThat(sut.getElementWellKnown(WELLKNOWN_URL, EnterpriseRemoteConfigSource.WELLKNOWN_ENDPOINT)).isEqualTo( - WellknownRetrieverResult.Success(wellKnown) - ) - - // And the endpoint is never hit - resolver.assertions().isNeverCalled() - } - - private fun TestScope.createDefaultWellknownRetriever( - cacheStoreFactory: ElementWellknownStore.Factory = { FakeElementWellknownStore() }, - elementWellKnownParser: ElementWellKnownParser = { Result.success(expectedElementWellKnown) }, - enterpriseService: FakeEnterpriseService = FakeEnterpriseService(overrideWellKnownResult = { null }), - urlResolver: UrlContentFetcher = SpyUrlContentFetcher { Result.success(WELLKNOWN_CONTENT.toByteArray()) }, - ) = DefaultWellknownRetriever( - elementWellknownStoreFactory = cacheStoreFactory, - enterpriseService = enterpriseService, - elementWellKnownParser = elementWellKnownParser, - urlContentFetcher = urlResolver, - coroutineScope = backgroundScope, - ) - - companion object { - private const val WELLKNOWN_URL = "https://user.domain.org/.well-known/element/element.json" - private const val WELLKNOWN_CONTENT = """{ - "registration_helper_url": "a_registration_url", - "enforce_element_pro": true, - "rageshake_url": "a_rageshake_url", - "brand_color": "#FF0000", - "notification_sound": "a_notification_sound.flac", - "idp_app_scheme": "an_app_scheme", - "content_scanner_url": "https://content-scanner.example.com", - "force_disable_e2ee": false, - "map_tiler": { - "api_key": "test_api_key", - "base_url": "https://tile-server.example.com" - } - }""" - - private val expectedElementWellKnown = ElementWellKnown( - registrationHelperUrl = "a_registration_url", - enforceElementPro = true, - rageshakeUrl = "a_rageshake_url", - brandColor = "#FF0000", - notificationSound = "a_notification_sound.flac", - identityProviderAppScheme = "an_app_scheme", - contentScannerUrl = "https://content-scanner.example.com", - customRecoveryPassphrase = null, - forceDisableE2EE = false, - mapTilerConfig = aMapTilerConfig( - apiKey = "test_api_key", - baseUrl = "https://tile-server.example.com", - ) - ) - } -} - -private class SpyUrlContentFetcher(lambda: (String) -> Result) : UrlContentFetcher { - private val spy = lambdaRecorder> { lambda(it) } - - override suspend fun getUrl(url: String): Result { - return spy(url) - } - - fun assertions() = spy.assertions() -} diff --git a/libraries/wellknown/test/src/main/kotlin/io/element/android/features/wellknown/test/FakeElementWellknownStore.kt b/libraries/wellknown/test/src/main/kotlin/io/element/android/features/wellknown/test/FakeElementWellknownStore.kt deleted file mode 100644 index c5e2d2ae5b..0000000000 --- a/libraries/wellknown/test/src/main/kotlin/io/element/android/features/wellknown/test/FakeElementWellknownStore.kt +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2026 Element Creations Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.wellknown.test - -import io.element.android.libraries.androidutils.json.DefaultJsonProvider -import io.element.android.libraries.androidutils.json.JsonProvider -import io.element.android.libraries.wellknown.api.ElementWellKnown -import io.element.android.libraries.wellknown.api.ElementWellknownStore -import io.element.android.libraries.wellknown.api.WellknownRetrieverResult -import io.element.android.libraries.wellknown.impl.InternalElementWellKnown -import io.element.android.libraries.wellknown.impl.map -import kotlinx.serialization.ExperimentalSerializationApi -import kotlinx.serialization.json.JsonDecodingException -import java.net.URL - -class FakeElementWellknownStore( - initialData: Map> = emptyMap(), - private val jsonProvider: JsonProvider = DefaultJsonProvider(), -) : ElementWellknownStore { - private val cachedData = mutableMapOf>() - - init { - initialData.forEach { (url, result) -> - cachedData[URL(url).host] = result - } - } - - override suspend fun get(domain: String): WellknownRetrieverResult { - return cachedData[domain] ?: WellknownRetrieverResult.NotFound - } - - @OptIn(ExperimentalSerializationApi::class) - override suspend fun update(domain: String, wellknown: String): Result { - val json = jsonProvider() - val mapped = try { - json.decodeFromString(wellknown).map() - } catch (e: JsonDecodingException) { - return Result.failure(e) - } - cachedData[domain] = WellknownRetrieverResult.Success(mapped) - return Result.success(Unit) - } - - override suspend fun delete(domain: String): Result { - cachedData.remove(domain) - return Result.success(Unit) - } -} diff --git a/libraries/wellknown/test/src/main/kotlin/io/element/android/features/wellknown/test/FakeWellknownRetriever.kt b/libraries/wellknown/test/src/main/kotlin/io/element/android/features/wellknown/test/FakeWellknownRetriever.kt deleted file mode 100644 index e08969d0f9..0000000000 --- a/libraries/wellknown/test/src/main/kotlin/io/element/android/features/wellknown/test/FakeWellknownRetriever.kt +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.wellknown.test - -import io.element.android.libraries.wellknown.api.ElementWellKnown -import io.element.android.libraries.wellknown.api.EnterpriseRemoteConfigSource -import io.element.android.libraries.wellknown.api.WellknownRetriever -import io.element.android.libraries.wellknown.api.WellknownRetrieverResult - -class FakeWellknownRetriever( - private val getElementWellKnownResult: (String, EnterpriseRemoteConfigSource) -> WellknownRetrieverResult = { _, _ -> - WellknownRetrieverResult.NotFound - }, -) : WellknownRetriever { - override suspend fun getElementWellKnown(host: String, source: EnterpriseRemoteConfigSource): WellknownRetrieverResult { - return getElementWellKnownResult(host, source) - } -} diff --git a/libraries/wellknown/test/src/main/kotlin/io/element/android/features/wellknown/test/FakeWellknownRetrieverFactory.kt b/libraries/wellknown/test/src/main/kotlin/io/element/android/features/wellknown/test/FakeWellknownRetrieverFactory.kt deleted file mode 100644 index 718649dd5d..0000000000 --- a/libraries/wellknown/test/src/main/kotlin/io/element/android/features/wellknown/test/FakeWellknownRetrieverFactory.kt +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2026 Element Creations Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.wellknown.test - -import io.element.android.libraries.matrix.api.UrlContentFetcher -import io.element.android.libraries.wellknown.api.WellknownRetriever - -class FakeWellknownRetrieverFactory( - private val wellknownRetriever: WellknownRetriever = FakeWellknownRetriever(), -) : WellknownRetriever.Factory { - override fun create(urlContentFetcher: UrlContentFetcher): WellknownRetriever = wellknownRetriever -} diff --git a/libraries/wellknown/test/src/main/kotlin/io/element/android/features/wellknown/test/Fixtures.kt b/libraries/wellknown/test/src/main/kotlin/io/element/android/features/wellknown/test/Fixtures.kt deleted file mode 100644 index 36d9f7bc82..0000000000 --- a/libraries/wellknown/test/src/main/kotlin/io/element/android/features/wellknown/test/Fixtures.kt +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.features.wellknown.test - -import io.element.android.libraries.wellknown.api.CustomRecoveryPassphrase -import io.element.android.libraries.wellknown.api.ElementWellKnown -import io.element.android.libraries.wellknown.api.MapTilerConfig - -fun anElementWellKnown( - registrationHelperUrl: String? = null, - enforceElementPro: Boolean? = null, - rageshakeUrl: String? = null, - brandColor: String? = null, - notificationSound: String? = null, - identityProviderAppScheme: String? = null, - customRecoveryPassphrase: CustomRecoveryPassphrase? = null, - contentScannerUrl: String? = null, - forceDisableE2EE: Boolean? = null, - mapTilerConfig: MapTilerConfig? = null, -) = ElementWellKnown( - registrationHelperUrl = registrationHelperUrl, - enforceElementPro = enforceElementPro, - rageshakeUrl = rageshakeUrl, - brandColor = brandColor, - notificationSound = notificationSound, - identityProviderAppScheme = identityProviderAppScheme, - customRecoveryPassphrase = customRecoveryPassphrase, - contentScannerUrl = contentScannerUrl, - forceDisableE2EE = forceDisableE2EE, - mapTilerConfig = mapTilerConfig, -) - -fun aCustomRecoveryPassphrase( - minCharacterCount: Int = 8, -) = CustomRecoveryPassphrase( - minCharacterCount = minCharacterCount, -) - -fun aMapTilerConfig( - apiKey: String = "test_api_key", - baseUrl: String? = null, - lightStyleId: String? = null, - darkStyleId: String? = null, -) = MapTilerConfig( - apiKey = apiKey, - baseUrl = baseUrl, - lightStyleId = lightStyleId, - darkStyleId = darkStyleId, -) diff --git a/services/analyticsproviders/posthog/src/main/kotlin/io/element/android/services/analyticsproviders/posthog/PosthogEndpointConfigProvider.kt b/services/analyticsproviders/posthog/src/main/kotlin/io/element/android/services/analyticsproviders/posthog/PosthogEndpointConfigProvider.kt index eb59579d79..01f4329111 100644 --- a/services/analyticsproviders/posthog/src/main/kotlin/io/element/android/services/analyticsproviders/posthog/PosthogEndpointConfigProvider.kt +++ b/services/analyticsproviders/posthog/src/main/kotlin/io/element/android/services/analyticsproviders/posthog/PosthogEndpointConfigProvider.kt @@ -9,7 +9,6 @@ package io.element.android.services.analyticsproviders.posthog import dev.zacsweers.metro.Inject -import io.element.android.features.enterprise.api.EnterpriseService import io.element.android.libraries.core.extensions.isElement import io.element.android.libraries.core.meta.BuildMeta import io.element.android.libraries.core.meta.BuildType @@ -17,10 +16,9 @@ import io.element.android.libraries.core.meta.BuildType @Inject class PosthogEndpointConfigProvider( private val buildMeta: BuildMeta, - private val enterpriseService: EnterpriseService, ) { fun provide(): PosthogEndpointConfig? { - return if (enterpriseService.isEnterpriseBuild) { + return if (buildMeta.isEnterpriseBuild) { PosthogEndpointConfig( host = BuildConfig.POSTHOG_HOST, apiKey = BuildConfig.POSTHOG_APIKEY, From 1f7635f0e37676a8c2d7db1cfb9419d263f76940 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 17 Aug 2026 15:56:59 +0200 Subject: [PATCH 117/145] Fix API break --- .../mediaviewer/impl/local/player/ExoPlayerForPreview.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/local/player/ExoPlayerForPreview.kt b/libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/local/player/ExoPlayerForPreview.kt index 4da8433cd1..e23cb790db 100644 --- a/libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/local/player/ExoPlayerForPreview.kt +++ b/libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/local/player/ExoPlayerForPreview.kt @@ -266,4 +266,5 @@ class ExoPlayerForPreview( override fun setVideoCodecParameters(codecParameters: CodecParameters) {} override fun addVideoCodecParametersChangeListener(listener: CodecParametersChangeListener, keys: List) {} override fun removeVideoCodecParametersChangeListener(listener: CodecParametersChangeListener) {} + override fun setEnforceAdPlaybackOnTimelineRefresh(enforceAdPlaybackOnTimelineRefresh: Boolean) = throw NotImplementedError() } From bbd6ce134be01c4b093aa182401125ee787adf46 Mon Sep 17 00:00:00 2001 From: Jenna Vassar Date: Mon, 17 Aug 2026 10:31:17 -0700 Subject: [PATCH 118/145] Fix account provider dropped on first Continue and address review comments --- .../ConfirmAccountProviderPresenter.kt | 18 +++++-- .../ConfirmAccountProviderView.kt | 23 +++++---- .../ConfirmAccountProviderPresenterTest.kt | 47 +++++++++++++++++++ .../src/main/res/values/temporary.xml | 6 --- 4 files changed, 75 insertions(+), 19 deletions(-) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt index fbadcddc15..adb02b0f3d 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt @@ -20,6 +20,7 @@ import androidx.compose.runtime.setValue import dev.zacsweers.metro.Assisted import dev.zacsweers.metro.AssistedFactory import dev.zacsweers.metro.AssistedInject +import io.element.android.appconfig.AuthenticationConfig import io.element.android.features.login.impl.accountprovider.AccountProvider import io.element.android.features.login.impl.accountprovider.AccountProviderDataSource import io.element.android.features.login.impl.changeserver.ChangeServerEvents @@ -28,6 +29,7 @@ import io.element.android.features.login.impl.login.LoginModeEvent import io.element.android.features.login.impl.login.LoginModeState import io.element.android.libraries.architecture.AsyncData import io.element.android.libraries.architecture.Presenter +import io.element.android.libraries.core.uri.ensureProtocol import io.element.android.libraries.preferences.api.store.AppPreferencesStore @AssistedInject @@ -58,12 +60,18 @@ class ConfirmAccountProviderPresenter( var userInput by rememberSaveable { mutableStateOf(null) } val accountProviderInput = userInput ?: accountProvider.url - // Offer the most recent previously-used account provider that the current input is a prefix of. + // Offer an account provider that the current input is a prefix of: the most recent previously-used + // one first, then matrix.org. matrix.org is always available for autocomplete even before any + // sign-in, offered both with and without the https:// scheme so it completes whether the user starts + // typing "matrix.org" or "https://matrix.org". val accountProviderSuggestion = remember(accountProviderInput, homeserverHistory) { val input = accountProviderInput.trim() + val candidates = homeserverHistory + + AuthenticationConfig.MATRIX_ORG_URL + + AuthenticationConfig.MATRIX_ORG_URL.removePrefix("https://") input.takeIf { it.isNotEmpty() } ?.let { prefix -> - homeserverHistory.firstOrNull { it.length > prefix.length && it.startsWith(prefix, ignoreCase = true) } + candidates.firstOrNull { it.length > prefix.length && it.startsWith(prefix, ignoreCase = true) } } } @@ -94,9 +102,11 @@ class ConfirmAccountProviderPresenter( // Validate (and persist) the chosen account provider before proceeding. This also enforces the // account-provider access control, which the login submit does not run on its own. is ConfirmAccountProviderEvents.Continue -> { - submittedAccountProvider = event.accountProvider + // Default the scheme to https:// so entering a bare host (e.g. "matrix.org") works. + val accountProviderUrl = event.accountProvider.trim().ensureProtocol() + submittedAccountProvider = accountProviderUrl changeServerState.eventSink( - ChangeServerEvents.ChangeServer(AccountProvider(url = event.accountProvider.trim())) + ChangeServerEvents.ChangeServer(AccountProvider(url = accountProviderUrl)) ) } ConfirmAccountProviderEvents.ClearError -> { diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt index 9cd288bfb1..9a2e2819cc 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt @@ -19,6 +19,7 @@ import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberUpdatedState import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester @@ -88,12 +89,16 @@ fun ConfirmAccountProviderView( ?.substring(input.length) .orEmpty() + // The Continue button lives in a footer slot that is not recomposed while the user types, so a direct + // capture of the field text (via ::submit) goes stale and can submit an empty/prefilled value. Reading + // the value through rememberUpdatedState keeps it current regardless of which composition scope reads it. + val accountProviderToSubmit by rememberUpdatedState(input + suggestionSuffix) + fun submit() { // Dismiss the keyboard and release focus while the account provider is being validated. focusManager.clearFocus(force = true) - // Submit the exact field text (plus any accepted suggestion), read here so it can't lag behind - // fast input such as keyboard autofill. - eventSink(ConfirmAccountProviderEvents.Continue(input + suggestionSuffix)) + // Submit the exact field text (plus any accepted suggestion). + eventSink(ConfirmAccountProviderEvents.Continue(accountProviderToSubmit)) } // Once a validation / login error has been dismissed, return focus and the keyboard to the field so @@ -115,9 +120,9 @@ fun ConfirmAccountProviderView( iconStyle = BigIcon.Style.Default(CompoundIcons.UserProfileSolid()), title = stringResource( id = if (state.isAccountCreation) { - CommonStrings.screen_select_server_title_register + CommonStrings.screen_change_server_title_register } else { - CommonStrings.screen_select_server_title_login + CommonStrings.screen_change_server_title_login } ), subTitle = null, @@ -153,13 +158,13 @@ fun ConfirmAccountProviderView( .focusRequester(focusRequester) .onTabOrEnterKeyFocusNext(focusManager) .testTag(TestTags.changeServerServer), - label = stringResource(id = CommonStrings.screen_select_server_textfield_header), - placeholder = stringResource(id = CommonStrings.screen_select_server_textfield_placeholder), + label = stringResource(id = CommonStrings.screen_change_server_textfield_header), + placeholder = stringResource(id = CommonStrings.screen_change_server_textfield_placeholder), supportingText = stringResource( id = if (state.isAccountCreation) { - CommonStrings.screen_select_server_textfield_footer_register + CommonStrings.screen_change_server_textfield_footer_register } else { - CommonStrings.screen_select_server_textfield_footer_login + CommonStrings.screen_change_server_textfield_footer_login } ), visualTransformation = ghostTransformation, diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt index 687be70c7c..1bb983ff1a 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt @@ -349,6 +349,53 @@ class ConfirmAccountProviderPresenterTest { } } + @Test + fun `present - offers matrix_org as an autocomplete suggestion even without any history`() = runTest { + val presenter = createConfirmAccountProviderPresenter( + appPreferencesStore = InMemoryAppPreferencesStore(homeserverHistory = emptyList()), + ) + presenter.test { + val initialState = awaitItem() + initialState.eventSink(ConfirmAccountProviderEvents.UserInputChanged("https://matr")) + val suggestionState = awaitState { it.accountProviderInput == "https://matr" } + assertThat(suggestionState.accountProviderSuggestion).isEqualTo(AuthenticationConfig.MATRIX_ORG_URL) + } + } + + @Test + fun `present - offers matrix_org without the scheme as an autocomplete suggestion`() = runTest { + val presenter = createConfirmAccountProviderPresenter( + appPreferencesStore = InMemoryAppPreferencesStore(homeserverHistory = emptyList()), + ) + presenter.test { + val initialState = awaitItem() + initialState.eventSink(ConfirmAccountProviderEvents.UserInputChanged("matr")) + val suggestionState = awaitState { it.accountProviderInput == "matr" } + assertThat(suggestionState.accountProviderSuggestion).isEqualTo("matrix.org") + } + } + + @Test + fun `present - continue prepends https to a bare account provider`() = runTest { + val submittedUrls = mutableListOf() + val authenticationService = FakeMatrixAuthenticationService( + setHomeserverResult = { url -> + submittedUrls.add(url) + Result.success(aMatrixHomeServerDetails(supportsOAuthLogin = true)) + }, + ) + val presenter = createConfirmAccountProviderPresenter( + matrixAuthenticationService = authenticationService, + ) + presenter.test { + val initialState = awaitItem() + initialState.eventSink(ConfirmAccountProviderEvents.Continue("matrix.org")) + awaitLoginMode { it is AsyncData.Success } + assertThat(submittedUrls.first()).isEqualTo(AuthenticationConfig.MATRIX_ORG_URL) + cancelAndIgnoreRemainingEvents() + } + } + /** * Awaits until the emitted state's login mode matches [predicate], skipping the intermediate * account-provider validation states, and returns that state. diff --git a/libraries/ui-strings/src/main/res/values/temporary.xml b/libraries/ui-strings/src/main/res/values/temporary.xml index 2b5788042e..c704e811ff 100644 --- a/libraries/ui-strings/src/main/res/values/temporary.xml +++ b/libraries/ui-strings/src/main/res/values/temporary.xml @@ -10,10 +10,4 @@ "Collapsed" Active Inactive - "Enter your account provider" - "Choose an account provider" - "Account provider" - "example.com" - "If your account is provided by your company or a community, then change the account provider (example: companyname.com)." - "Create an account on matrix.org for free. If you want to create an account with a different provider, then change it accordingly (example: communityname.org)." From a6c7042482bd113657ebac6bce3aabec9a751571 Mon Sep 17 00:00:00 2001 From: Jenna Vassar Date: Mon, 17 Aug 2026 10:37:27 -0700 Subject: [PATCH 119/145] Configure the account provider homeserver only once when signing in --- .../changeserver/ChangeServerPresenter.kt | 7 +++- .../impl/changeserver/ChangeServerState.kt | 5 ++- .../changeserver/ChangeServerStateProvider.kt | 3 +- .../login/impl/login/LoginModeEvent.kt | 6 +++ .../login/impl/login/LoginModePresenter.kt | 38 ++++++++++--------- .../ConfirmAccountProviderPresenter.kt | 6 ++- .../changeserver/ChangeServerPresenterTest.kt | 4 +- .../ConfirmAccountProviderPresenterTest.kt | 23 +++++++++++ 8 files changed, 66 insertions(+), 26 deletions(-) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenter.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenter.kt index 79f76d5fb5..b7b04beeb2 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenter.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenter.kt @@ -22,6 +22,7 @@ import io.element.android.libraries.architecture.AsyncData import io.element.android.libraries.architecture.Presenter import io.element.android.libraries.architecture.runCatchingUpdatingState import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService +import io.element.android.libraries.matrix.api.auth.MatrixHomeServerDetails @Inject class ChangeServerPresenter( @@ -32,7 +33,7 @@ class ChangeServerPresenter( ) : Presenter { @Composable override fun present(): ChangeServerState { - val changeServerAction: MutableState> = remember { + val changeServerAction: MutableState> = remember { mutableStateOf(AsyncData.Uninitialized) } @@ -59,7 +60,7 @@ class ChangeServerPresenter( private suspend fun changeServer( data: AccountProvider, - changeServerAction: MutableState>, + changeServerAction: MutableState>, ) { suspend { defaultAccountProviderAccessControl.assertIsAllowedToConnectToAccountProvider( @@ -72,6 +73,8 @@ class ChangeServerPresenter( } // Homeserver is valid, remember user choice accountProviderDataSource.setAccountProvider(data) + // Return the resolved details so the caller can sign in without configuring the homeserver again. + details }.runCatchingUpdatingState(changeServerAction, errorTransform = ChangeServerError::from) } } diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerState.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerState.kt index 6d8ce25d75..3b4f4d9dad 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerState.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerState.kt @@ -9,10 +9,13 @@ package io.element.android.features.login.impl.changeserver import io.element.android.libraries.architecture.AsyncData +import io.element.android.libraries.matrix.api.auth.MatrixHomeServerDetails import io.element.android.libraries.permissions.api.localnetwork.LocalNetworkPermissionDialog data class ChangeServerState( - val changeServerAction: AsyncData, + // On success, carries the resolved homeserver details so the caller can proceed with login without + // configuring (and re-networking) the homeserver a second time. + val changeServerAction: AsyncData, val localNetworkPermissionDialog: LocalNetworkPermissionDialog, val eventSink: (ChangeServerEvents) -> Unit ) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerStateProvider.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerStateProvider.kt index 183158bceb..dd1102e25e 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerStateProvider.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerStateProvider.kt @@ -11,6 +11,7 @@ package io.element.android.features.login.impl.changeserver import androidx.compose.ui.tooling.preview.PreviewParameterProvider import io.element.android.features.login.impl.error.ChangeServerError import io.element.android.libraries.architecture.AsyncData +import io.element.android.libraries.matrix.api.auth.MatrixHomeServerDetails import io.element.android.libraries.permissions.api.localnetwork.LocalNetworkPermissionDialog open class ChangeServerStateProvider : PreviewParameterProvider { @@ -45,7 +46,7 @@ open class ChangeServerStateProvider : PreviewParameterProvider = AsyncData.Uninitialized, + changeServerAction: AsyncData = AsyncData.Uninitialized, localNetworkPermissionDialog: LocalNetworkPermissionDialog = LocalNetworkPermissionDialog.None, ) = ChangeServerState( changeServerAction = changeServerAction, diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/login/LoginModeEvent.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/login/LoginModeEvent.kt index 73400890d5..945b0bc580 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/login/LoginModeEvent.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/login/LoginModeEvent.kt @@ -7,12 +7,18 @@ package io.element.android.features.login.impl.login +import io.element.android.libraries.matrix.api.auth.MatrixHomeServerDetails + sealed interface LoginModeEvent { data class Submit( val isAccountCreation: Boolean, val homeserverUrl: String, val resolvedHomeserverUrl: String?, val loginHint: String?, + // When the caller has already configured the homeserver (e.g. the account provider screen validated + // it first), these are its resolved details. When set, login reuses them instead of calling + // setHomeserver again, avoiding a redundant network round-trip. + val preConfiguredDetails: MatrixHomeServerDetails? = null, ) : LoginModeEvent data object ClearError : LoginModeEvent diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/login/LoginModePresenter.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/login/LoginModePresenter.kt index eccfb6b18f..59d156308f 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/login/LoginModePresenter.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/login/LoginModePresenter.kt @@ -75,26 +75,28 @@ class LoginModePresenter( private suspend fun performSubmit(request: LoginModeEvent.Submit, loginMode: MutableState>) { suspend { - authenticationService.setHomeserver(request.homeserverUrl).recoverCatching { - // Fallback to the well-known-resolved URL if the primary URL failed and the caller supplied one. - if (request.resolvedHomeserverUrl != null && request.resolvedHomeserverUrl != request.homeserverUrl) { - authenticationService.setHomeserver(request.resolvedHomeserverUrl).getOrThrow() - } else { - throw it - } - }.map { matrixHomeServerDetails -> - when { - matrixHomeServerDetails.supportsOAuthLogin -> { - val oAuthPrompt = if (request.isAccountCreation) OAuthPrompt.Create else OAuthPrompt.Login - LoginMode.OAuth( - authenticationService.getOAuthUrl(prompt = oAuthPrompt, loginHint = request.loginHint).getOrThrow() - ) + // Reuse the details the caller already resolved when it configured the homeserver, so we don't + // run setHomeserver (a network round-trip) again. Otherwise configure the homeserver ourselves. + val matrixHomeServerDetails = request.preConfiguredDetails + ?: authenticationService.setHomeserver(request.homeserverUrl).recoverCatching { + // Fallback to the well-known-resolved URL if the primary URL failed and the caller supplied one. + if (request.resolvedHomeserverUrl != null && request.resolvedHomeserverUrl != request.homeserverUrl) { + authenticationService.setHomeserver(request.resolvedHomeserverUrl).getOrThrow() + } else { + throw it } - request.isAccountCreation -> throw AccountCreationNotSupported() - matrixHomeServerDetails.supportsPasswordLogin -> LoginMode.PasswordLogin - else -> error("Unsupported authentication flow") + }.getOrThrow() + when { + matrixHomeServerDetails.supportsOAuthLogin -> { + val oAuthPrompt = if (request.isAccountCreation) OAuthPrompt.Create else OAuthPrompt.Login + LoginMode.OAuth( + authenticationService.getOAuthUrl(prompt = oAuthPrompt, loginHint = request.loginHint).getOrThrow() + ) } - }.getOrThrow() + request.isAccountCreation -> throw AccountCreationNotSupported() + matrixHomeServerDetails.supportsPasswordLogin -> LoginMode.PasswordLogin + else -> error("Unsupported authentication flow") + } }.runCatchingUpdatingState( state = loginMode, errorTransform = { diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt index adb02b0f3d..e025780bc2 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt @@ -27,7 +27,6 @@ import io.element.android.features.login.impl.changeserver.ChangeServerEvents import io.element.android.features.login.impl.changeserver.ChangeServerState import io.element.android.features.login.impl.login.LoginModeEvent import io.element.android.features.login.impl.login.LoginModeState -import io.element.android.libraries.architecture.AsyncData import io.element.android.libraries.architecture.Presenter import io.element.android.libraries.core.uri.ensureProtocol import io.element.android.libraries.preferences.api.store.AppPreferencesStore @@ -81,14 +80,17 @@ class ConfirmAccountProviderPresenter( val latestSubmittedAccountProvider by rememberUpdatedState(submittedAccountProvider) // Once the chosen account provider has been validated and persisted, proceed with the actual sign in / sign up. + // Reuse the details resolved while validating, so login does not configure (and re-network) the homeserver again. LaunchedEffect(changeServerState.changeServerAction) { - if (changeServerState.changeServerAction is AsyncData.Success) { + val homeServerDetails = changeServerState.changeServerAction.dataOrNull() + if (homeServerDetails != null) { loginModeState.eventSink( LoginModeEvent.Submit( isAccountCreation = params.isAccountCreation, homeserverUrl = latestSubmittedAccountProvider.orEmpty().trim(), resolvedHomeserverUrl = null, loginHint = null, + preConfiguredDetails = homeServerDetails, ) ) } diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenterTest.kt index 175b7e3057..38036a8b65 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenterTest.kt @@ -73,7 +73,7 @@ class ChangeServerPresenterTest { val loadingState = awaitItem() assertThat(loadingState.changeServerAction).isInstanceOf(AsyncData.Loading::class.java) val successState = awaitItem() - assertThat(successState.changeServerAction).isEqualTo(AsyncData.Success(Unit)) + assertThat(successState.changeServerAction).isEqualTo(AsyncData.Success(aMatrixHomeServerDetails(supportsOAuthLogin = true))) } } @@ -252,7 +252,7 @@ class ChangeServerPresenterTest { while (finalState.changeServerAction !is AsyncData.Success) { finalState = awaitItem() } - assertThat(finalState.changeServerAction).isEqualTo(AsyncData.Success(Unit)) + assertThat(finalState.changeServerAction).isEqualTo(AsyncData.Success(aMatrixHomeServerDetails(supportsOAuthLogin = true))) } } diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt index 1bb983ff1a..e23dd967cb 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt @@ -396,6 +396,29 @@ class ConfirmAccountProviderPresenterTest { } } + @Test + fun `present - continue configures the homeserver only once`() = runTest { + // The consolidated Continue flow validates the account provider and then signs in. Login reuses the + // details resolved during validation, so setHomeserver runs exactly once rather than once per phase. + val submittedUrls = mutableListOf() + val authenticationService = FakeMatrixAuthenticationService( + setHomeserverResult = { url -> + submittedUrls.add(url) + Result.success(aMatrixHomeServerDetails(supportsOAuthLogin = true)) + }, + ) + val presenter = createConfirmAccountProviderPresenter( + matrixAuthenticationService = authenticationService, + ) + presenter.test { + val initialState = awaitItem() + initialState.eventSink(ConfirmAccountProviderEvents.Continue(AuthenticationConfig.MATRIX_ORG_URL)) + awaitLoginMode { it is AsyncData.Success } + assertThat(submittedUrls).containsExactly(AuthenticationConfig.MATRIX_ORG_URL) + cancelAndIgnoreRemainingEvents() + } + } + /** * Awaits until the emitted state's login mode matches [predicate], skipping the intermediate * account-provider validation states, and returns that state. From e6e93c9bd07564308f97c57abae379a2f6c3b2c3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 17 Aug 2026 21:06:28 +0200 Subject: [PATCH 120/145] Update dependency org.matrix.rustcomponents:sdk-android to v26.08.17 (#7460) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update dependency org.matrix.rustcomponents:sdk-android to v26.08.17 * Fix API breaks: - `ClientBuildException.WellKnownLookupDisabled` should be handled now. - `Client.sendReply` returns a `Result` now. We can ignore it like we do for `Client.send`. --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jorge Martín --- gradle/libs.versions.toml | 2 +- .../libraries/matrix/impl/auth/AuthenticationException.kt | 1 + .../android/libraries/matrix/impl/timeline/RustTimeline.kt | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9c834fd291..a5ebc5b4e7 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -185,7 +185,7 @@ test_detekt_test = { module = "io.gitlab.arturbosch.detekt:detekt-test", version # https://github.com/matrix-org/matrix-rust-components-kotlin/commits/main/sdk/sdk-android/src/main/kotlin/org/matrix/rustcomponents/sdk/matrix_sdk_ffi.kt # All new features should not be implemented in the pull request that upgrades the version, developers should # only fix API breaks and may add some TODOs. -matrix_sdk = "org.matrix.rustcomponents:sdk-android:26.08.13" +matrix_sdk = "org.matrix.rustcomponents:sdk-android:26.08.17" # Others coil = { module = "io.coil-kt.coil3:coil", version.ref = "coil" } diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/auth/AuthenticationException.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/auth/AuthenticationException.kt index fac5227f6a..6a06ac0599 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/auth/AuthenticationException.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/auth/AuthenticationException.kt @@ -29,6 +29,7 @@ fun Throwable.mapAuthenticationException(): AuthenticationException { is ClientBuildException.WellKnownLookupFailed -> AuthenticationException.Generic(message) is ClientBuildException.EventCache -> AuthenticationException.Generic(message) is ClientBuildException.InvalidRawKey -> AuthenticationException.Generic(message) + is ClientBuildException.WellKnownLookupDisabled -> AuthenticationException.Generic(message) } is OAuthException -> when (this) { is OAuthException.Generic -> AuthenticationException.OAuth(message) diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt index bd756bc002..1be2f82314 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt @@ -365,7 +365,7 @@ class RustTimeline( fromNotification: Boolean, msgType: MsgType, ): Result = withContext(dispatcher) { - runCatchingExceptions { + runCatchingExceptions { val msg = MessageEventContent.from( body = body, htmlBody = htmlBody, From 75607c73ecfd00ddfc60cc032f811b265c7e0862 Mon Sep 17 00:00:00 2001 From: hayyaksi <193020925+hayaksi1@users.noreply.github.com> Date: Mon, 17 Aug 2026 22:08:48 +0300 Subject: [PATCH 121/145] Keep transparency when an image is shared into the app with an imprecise mime type (#7452) * Resolve the real image format before choosing the encoder The upload pre-processor picks the encoder from the mime type it is given. When an image is shared from another app that type is often broader than the image really is, so a transparent PNG shared as a wildcard image type is re-encoded as JPEG and its alpha channel is flattened to black. Read the format from the image header when the declared type is not already a concrete PNG or JPEG, and use that to decide both whether the image can be compressed at all and which encoder to use. * Cover the mime type fallbacks the wildcard resolution introduced resolveImageMimeType now decides whether an image is compressible, so two of its outcomes had no test: a GIF shared with a wildcard type has to be recognised and left uncompressed rather than recompressed into a still, and a file the decoder cannot read at all has to fall back to the type it was shared with. The isMimeTypeImage() guard on the decoded type is dropped with them. The BitmapFactory decoders only ever report an image type in outMimeType, so the guard could not fire and there was no way to exercise it. --- .../impl/AndroidMediaPreProcessor.kt | 18 ++++++- .../impl/AndroidMediaPreProcessorTest.kt | 49 ++++++++++++++++++- 2 files changed, 64 insertions(+), 3 deletions(-) diff --git a/libraries/mediaupload/impl/src/main/kotlin/io/element/android/libraries/mediaupload/impl/AndroidMediaPreProcessor.kt b/libraries/mediaupload/impl/src/main/kotlin/io/element/android/libraries/mediaupload/impl/AndroidMediaPreProcessor.kt index b374e530f4..eebbfbeab6 100644 --- a/libraries/mediaupload/impl/src/main/kotlin/io/element/android/libraries/mediaupload/impl/AndroidMediaPreProcessor.kt +++ b/libraries/mediaupload/impl/src/main/kotlin/io/element/android/libraries/mediaupload/impl/AndroidMediaPreProcessor.kt @@ -85,8 +85,9 @@ class AndroidMediaPreProcessor( val result = when { mimeType == MimeTypes.Svg -> processSvgImage(uri, mimeType) mimeType.isMimeTypeImage() -> { - val shouldBeCompressed = mediaOptimizationConfig.compressImages && mimeType !in notCompressibleImageTypes - processImage(uri, mimeType, shouldBeCompressed) + val imageMimeType = resolveImageMimeType(uri, mimeType) + val shouldBeCompressed = mediaOptimizationConfig.compressImages && imageMimeType !in notCompressibleImageTypes + processImage(uri, imageMimeType, shouldBeCompressed) } mimeType.isMimeTypeVideo() -> processVideo(uri, mimeType, mediaOptimizationConfig.videoCompressionPreset) mimeType.isMimeTypeAudio() -> processAudio(uri, mimeType) @@ -155,6 +156,19 @@ class AndroidMediaPreProcessor( } } + /** + * The declared mime type can be broader than the image actually is - a wildcard from a share intent, or a mislabelled file - and the encoder is picked + * from it. Re-encoding a transparent image as JPEG flattens its alpha channel to black, so resolve the real format from the image header first. + */ + private fun resolveImageMimeType(uri: Uri, declaredMimeType: String): String { + if (declaredMimeType == MimeTypes.Png || declaredMimeType == MimeTypes.Jpeg) return declaredMimeType + val options = BitmapFactory.Options().apply { inJustDecodeBounds = true } + tryOrNull { + contentResolver.openInputStream(uri)?.use { BitmapFactory.decodeStream(it, null, options) } + } + return options.outMimeType ?: declaredMimeType + } + private suspend fun processImage(uri: Uri, mimeType: String, shouldBeCompressed: Boolean): MediaUploadInfo { Timber.d("Processing image ${uri.path.orEmpty().hash()}") diff --git a/libraries/mediaupload/impl/src/test/kotlin/io/element/android/libraries/mediaupload/impl/AndroidMediaPreProcessorTest.kt b/libraries/mediaupload/impl/src/test/kotlin/io/element/android/libraries/mediaupload/impl/AndroidMediaPreProcessorTest.kt index 3fb639aa9b..79f6fd10f8 100644 --- a/libraries/mediaupload/impl/src/test/kotlin/io/element/android/libraries/mediaupload/impl/AndroidMediaPreProcessorTest.kt +++ b/libraries/mediaupload/impl/src/test/kotlin/io/element/android/libraries/mediaupload/impl/AndroidMediaPreProcessorTest.kt @@ -70,6 +70,7 @@ class AndroidMediaPreProcessorTest : RobolectricTest() { mediaOptimizationConfig: MediaOptimizationConfig, sdkIntVersion: Int = Build.VERSION_CODES.P, deleteOriginal: Boolean = false, + mimeType: String = asset.mimeType, ): MediaUploadInfo { val context = InstrumentationRegistry.getInstrumentation().context val deleteCallback = lambdaRecorder {} @@ -81,7 +82,7 @@ class AndroidMediaPreProcessorTest : RobolectricTest() { val file = getFileFromAssets(context, asset.filename) val result = sut.process( uri = file.toUri(), - mimeType = asset.mimeType, + mimeType = mimeType, deleteOriginal = deleteOriginal, mediaOptimizationConfig = mediaOptimizationConfig, ) @@ -91,6 +92,52 @@ class AndroidMediaPreProcessorTest : RobolectricTest() { return data } + @Test + fun `a png shared with a wildcard mime type is still encoded as a png`() = runTest { + val mediaUploadInfo = process( + asset = assetImagePng, + mimeType = MimeTypes.Images, + mediaOptimizationConfig = MediaOptimizationConfig( + compressImages = true, + videoCompressionPreset = VideoCompressionPreset.STANDARD, + ), + sdkIntVersion = Build.VERSION_CODES.Q, + ) + val info = mediaUploadInfo as MediaUploadInfo.Image + assertThat(info.imageInfo.mimetype).isEqualTo(MimeTypes.Png) + } + + @Test + fun `a gif shared with a wildcard mime type is recognised and left uncompressed`() = runTest { + val mediaUploadInfo = process( + asset = assetAnimatedGif, + mimeType = MimeTypes.Images, + mediaOptimizationConfig = MediaOptimizationConfig( + compressImages = true, + videoCompressionPreset = VideoCompressionPreset.STANDARD, + ), + sdkIntVersion = Build.VERSION_CODES.Q, + ) + val info = mediaUploadInfo as MediaUploadInfo.Image + assertThat(info.imageInfo.mimetype).isEqualTo(MimeTypes.Gif) + assertThat(info.imageInfo.size).isEqualTo(assetAnimatedGif.size) + } + + @Test + fun `a file that is not an image keeps the wildcard mime type it was shared with`() = runTest { + val mediaUploadInfo = process( + asset = assetText, + mimeType = MimeTypes.Images, + mediaOptimizationConfig = MediaOptimizationConfig( + compressImages = false, + videoCompressionPreset = VideoCompressionPreset.STANDARD, + ), + sdkIntVersion = Build.VERSION_CODES.Q, + ) + val info = mediaUploadInfo as MediaUploadInfo.Image + assertThat(info.imageInfo.mimetype).isEqualTo(MimeTypes.Images) + } + @Test @Ignore("Ignore now that min API for enterprise is 33") fun `test processing png`() = runTest { From cb6ac751cca40592998ee27bcea6486cc376c0fd Mon Sep 17 00:00:00 2001 From: hayyaksi <193020925+hayaksi1@users.noreply.github.com> Date: Mon, 17 Aug 2026 22:10:08 +0300 Subject: [PATCH 122/145] Refresh the room members when a mention is started (#7438) * Refresh the room members when a mention is started The mention suggestions read room.membersStateFlow, which is a cache filled only by an explicit updateMembers() call. Nothing calls it while a room is open, so a member who joined after the room was opened never appears in the suggestion list until the room is left and entered again. Call updateMembers() when a mention search starts. The trigger is distinctUntilChanged on "the current suggestion is a mention", so it fires once per mention rather than on every keystroke, and fetchRoomMembers already no-ops while a fetch is in flight. --- .../MessageComposerPresenter.kt | 11 ++++ .../MessageComposerPresenterTest.kt | 56 ++++++++++++++++++- 2 files changed, 65 insertions(+), 2 deletions(-) diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt index 5f12bf4be1..2974b99696 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt @@ -86,6 +86,7 @@ import io.element.android.libraries.textcomposer.model.MarkdownTextEditorState import io.element.android.libraries.textcomposer.model.Message import io.element.android.libraries.textcomposer.model.MessageComposerMode import io.element.android.libraries.textcomposer.model.Suggestion +import io.element.android.libraries.textcomposer.model.SuggestionType import io.element.android.libraries.textcomposer.model.TextEditorState import io.element.android.libraries.textcomposer.model.rememberMarkdownTextEditorState import io.element.android.services.analytics.api.AnalyticsService @@ -103,7 +104,9 @@ import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.debounce +import kotlinx.coroutines.flow.distinctUntilChangedBy import kotlinx.coroutines.flow.filter +import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.merge import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.launch @@ -459,6 +462,14 @@ class MessageComposerPresenter( val mentionTriggerFlow = merge(mentionStartTrigger, mentionCompletionTrigger) + // Refresh the room members, which are only loaded on demand, when a mention starts + launch { + suggestionSearchTrigger + .distinctUntilChangedBy { it?.type } + .filter { it?.type == SuggestionType.Mention } + .collect { room.updateMembers() } + } + val roomAliasSuggestionsFlow = roomAliasSuggestionsDataSource .getAllRoomAliasSuggestions() .stateIn(this, SharingStarted.Lazily, emptyList()) diff --git a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenterTest.kt b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenterTest.kt index 07b9a4e330..4170ae41ab 100644 --- a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenterTest.kt +++ b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenterTest.kt @@ -1056,7 +1056,8 @@ class MessageComposerPresenterTest : RobolectricTest() { baseRoom = FakeBaseRoom( roomPermissions = FakeRoomPermissions( canTriggerRoomNotification = true, - ) + ), + updateMembersResult = {}, ), typingNoticeResult = { Result.success(Unit) } ).apply { @@ -1103,6 +1104,55 @@ class MessageComposerPresenterTest : RobolectricTest() { } } + @Test + fun `present - mention suggestions refresh the room members`() = runTest { + val currentUser = aRoomMember(userId = A_USER_ID, membership = RoomMembershipState.JOIN) + val bob = aRoomMember(userId = A_USER_ID_2, membership = RoomMembershipState.JOIN) + val updateMembersResult = lambdaRecorder { } + val room = FakeJoinedRoom( + baseRoom = FakeBaseRoom( + roomPermissions = FakeRoomPermissions( + canTriggerRoomNotification = true, + ), + updateMembersResult = updateMembersResult, + ), + typingNoticeResult = { Result.success(Unit) } + ).apply { + givenRoomMembersState( + RoomMembersState.Ready( + persistentListOf(currentUser, bob), + ) + ) + givenRoomInfo(aRoomInfo(isDirect = false)) + } + val presenter = createPresenter( + room = room, + slashCommandService = FakeSlashCommandService( + getSuggestionsResult = { _, _ -> emptyList() }, + ), + ) + presenter.test { + val initialState = awaitItem() + initialState.eventSink(MessageComposerEvent.SuggestionReceived(Suggestion(0, 0, SuggestionType.Mention, ""))) + skipItems(1) + assertThat(awaitItem().suggestions).containsExactly(ResolvedSuggestion.AtRoom, ResolvedSuggestion.Member(bob)) + updateMembersResult.assertions().isCalledOnce() + + // Typing after the `@` must not refresh the members again + initialState.eventSink(MessageComposerEvent.SuggestionReceived(Suggestion(0, 1, SuggestionType.Mention, "b"))) + initialState.eventSink(MessageComposerEvent.SuggestionReceived(Suggestion(0, 2, SuggestionType.Mention, "bo"))) + advanceUntilIdle() + updateMembersResult.assertions().isCalledOnce() + + // Starting a new mention refreshes them again + initialState.eventSink(MessageComposerEvent.SuggestionReceived(null)) + initialState.eventSink(MessageComposerEvent.SuggestionReceived(Suggestion(0, 0, SuggestionType.Mention, ""))) + advanceUntilIdle() + updateMembersResult.assertions().isCalledExactly(2) + cancelAndIgnoreRemainingEvents() + } + } + @Test fun `present - room mention suggestions no permission`() = runTest { val currentUser = aRoomMember(userId = A_USER_ID, membership = RoomMembershipState.JOIN) @@ -1113,7 +1163,8 @@ class MessageComposerPresenterTest : RobolectricTest() { baseRoom = FakeBaseRoom( roomPermissions = FakeRoomPermissions( canTriggerRoomNotification = false, - ) + ), + updateMembersResult = {}, ), typingNoticeResult = { Result.success(Unit) } ).apply { @@ -1144,6 +1195,7 @@ class MessageComposerPresenterTest : RobolectricTest() { val room = FakeJoinedRoom( baseRoom = FakeBaseRoom( roomPermissions = FakeRoomPermissions(canTriggerRoomNotification = true), + updateMembersResult = {}, ), typingNoticeResult = { Result.success(Unit) } ).apply { From 815b2a895eb9a4a3329e19ed8f5acf57251052c9 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 18 Aug 2026 11:18:18 +0200 Subject: [PATCH 123/145] Reorder items and specify type explicitly so that diff is minimal when comparing to a generated file for a variant build. --- plugins/src/main/kotlin/config/BuildTimeConfig.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/plugins/src/main/kotlin/config/BuildTimeConfig.kt b/plugins/src/main/kotlin/config/BuildTimeConfig.kt index 83236f1a5a..ffad44fdc5 100644 --- a/plugins/src/main/kotlin/config/BuildTimeConfig.kt +++ b/plugins/src/main/kotlin/config/BuildTimeConfig.kt @@ -14,15 +14,14 @@ object BuildTimeConfig { const val GOOGLE_APP_ID_RELEASE = "1:912726360885:android:d097de99a4c23d2700427c" const val GOOGLE_APP_ID_DEBUG = "1:912726360885:android:def0a4e454042e9b00427c" const val GOOGLE_APP_ID_NIGHTLY = "1:912726360885:android:e17435e0beb0303000427c" - val METADATA_HOST_REVERSED: String? = null + val OAUTH_CLIENT_URL_PATH: String? = "apps/android" val URL_WEBSITE: String? = null val URL_LOGO: String? = null val URL_COPYRIGHT: String? = null val URL_ACCEPTABLE_USE: String? = null val URL_PRIVACY: String? = null val URL_POLICY: String? = null - val OAUTH_CLIENT_URL_PATH: String? = "apps/android" val SERVICES_MAPTILER_BASE_URL: String? = null val SERVICES_MAPTILER_APIKEY: String? = null val SERVICES_MAPTILER_LIGHT_MAPID: String? = null @@ -33,7 +32,6 @@ object BuildTimeConfig { val SERVICES_SENTRY_DSN_RUST: String? = null val BUG_REPORT_URL: String? = null val BUG_REPORT_APP_NAME: String? = null - - const val PUSH_CONFIG_INCLUDE_FIREBASE = true - const val PUSH_CONFIG_INCLUDE_UNIFIED_PUSH = true + const val PUSH_CONFIG_INCLUDE_FIREBASE: Boolean = true + const val PUSH_CONFIG_INCLUDE_UNIFIED_PUSH: Boolean = true } From ccebb55ca7d9fc8159291899c4792d31d1abf8da Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 18 Aug 2026 15:40:20 +0200 Subject: [PATCH 124/145] Improve documentation --- libraries/pushproviders/firebase/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/pushproviders/firebase/README.md b/libraries/pushproviders/firebase/README.md index a2a7ad97ed..665118d57e 100644 --- a/libraries/pushproviders/firebase/README.md +++ b/libraries/pushproviders/firebase/README.md @@ -2,6 +2,6 @@ ## Configuration -In order to make this module only know about Firebase, the plugin `com.google.gms.google-services` has been disabled from the `app` module. +In order to make only this module know about Firebase, the plugin `com.google.gms.google-services` has been disabled from the `app` module. -To be able to change the values set to `google_app_id` in the file `build.gradle.kts` of this module, you should enable the plugin `com.google.gms.google-services` again, copy the file `google-services.json` to the folder `/app/src/main`, build the project, and check the generated file `app/build/generated/res/google-services//values/values.xml` to import the generated values into the `build.gradle.kts` files. +To be able to change the values set to `google_app_id` in the file `build.gradle.kts` of this module, you should enable the plugin `com.google.gms.google-services` again, copy the file `google-services.json` to the folder `/app`, build the project, and check the generated file `app/build/generated/res/google-services//values/values.xml` to import the generated values into the `build.gradle.kts` files. From 07983221e69da67885c0fbe394130f22aaaf6744 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 18 Aug 2026 16:25:57 +0200 Subject: [PATCH 125/145] Move google_app_id to resource files. --- .../pushproviders/firebase/build.gradle.kts | 18 ------------------ .../firebase/src/debug/res/values/firebase.xml | 4 ++++ .../src/nightly/res/values/firebase.xml | 4 ++++ .../src/release/res/values/firebase.xml | 4 ++++ .../src/main/kotlin/config/BuildTimeConfig.kt | 3 --- 5 files changed, 12 insertions(+), 21 deletions(-) create mode 100644 libraries/pushproviders/firebase/src/debug/res/values/firebase.xml create mode 100644 libraries/pushproviders/firebase/src/nightly/res/values/firebase.xml create mode 100644 libraries/pushproviders/firebase/src/release/res/values/firebase.xml diff --git a/libraries/pushproviders/firebase/build.gradle.kts b/libraries/pushproviders/firebase/build.gradle.kts index 1a8e73a4da..33e88dd94c 100644 --- a/libraries/pushproviders/firebase/build.gradle.kts +++ b/libraries/pushproviders/firebase/build.gradle.kts @@ -8,7 +8,6 @@ @file:Suppress("UnstableApiUsage") -import config.BuildTimeConfig import extension.setupDependencyInjection import extension.testCommonDependencies import org.gradle.kotlin.dsl.withType @@ -28,27 +27,10 @@ android { buildTypes { getByName("release") { consumerProguardFiles("consumer-proguard-rules.pro") - resValue( - type = "string", - name = "google_app_id", - value = BuildTimeConfig.GOOGLE_APP_ID_RELEASE, - ) - } - getByName("debug") { - resValue( - type = "string", - name = "google_app_id", - value = BuildTimeConfig.GOOGLE_APP_ID_DEBUG, - ) } register("nightly") { consumerProguardFiles("consumer-proguard-rules.pro") matchingFallbacks += listOf("release") - resValue( - type = "string", - name = "google_app_id", - value = BuildTimeConfig.GOOGLE_APP_ID_NIGHTLY, - ) } } } diff --git a/libraries/pushproviders/firebase/src/debug/res/values/firebase.xml b/libraries/pushproviders/firebase/src/debug/res/values/firebase.xml new file mode 100644 index 0000000000..e96f163603 --- /dev/null +++ b/libraries/pushproviders/firebase/src/debug/res/values/firebase.xml @@ -0,0 +1,4 @@ + + + 1:912726360885:android:def0a4e454042e9b00427c + diff --git a/libraries/pushproviders/firebase/src/nightly/res/values/firebase.xml b/libraries/pushproviders/firebase/src/nightly/res/values/firebase.xml new file mode 100644 index 0000000000..7275ff2ddd --- /dev/null +++ b/libraries/pushproviders/firebase/src/nightly/res/values/firebase.xml @@ -0,0 +1,4 @@ + + + 1:912726360885:android:e17435e0beb0303000427c + diff --git a/libraries/pushproviders/firebase/src/release/res/values/firebase.xml b/libraries/pushproviders/firebase/src/release/res/values/firebase.xml new file mode 100644 index 0000000000..3a9a4330d1 --- /dev/null +++ b/libraries/pushproviders/firebase/src/release/res/values/firebase.xml @@ -0,0 +1,4 @@ + + + 1:912726360885:android:d097de99a4c23d2700427c + diff --git a/plugins/src/main/kotlin/config/BuildTimeConfig.kt b/plugins/src/main/kotlin/config/BuildTimeConfig.kt index ffad44fdc5..e31ffea658 100644 --- a/plugins/src/main/kotlin/config/BuildTimeConfig.kt +++ b/plugins/src/main/kotlin/config/BuildTimeConfig.kt @@ -11,9 +11,6 @@ package config object BuildTimeConfig { const val APPLICATION_ID = "io.element.android.x" const val APPLICATION_NAME = "Element X" - const val GOOGLE_APP_ID_RELEASE = "1:912726360885:android:d097de99a4c23d2700427c" - const val GOOGLE_APP_ID_DEBUG = "1:912726360885:android:def0a4e454042e9b00427c" - const val GOOGLE_APP_ID_NIGHTLY = "1:912726360885:android:e17435e0beb0303000427c" val METADATA_HOST_REVERSED: String? = null val OAUTH_CLIENT_URL_PATH: String? = "apps/android" val URL_WEBSITE: String? = null From 1fefbc994356b04b4fdee511906789e8f3ecbd4a Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 18 Aug 2026 17:39:21 +0200 Subject: [PATCH 126/145] Firebase configuration location has changed. --- libraries/pushproviders/firebase/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/pushproviders/firebase/README.md b/libraries/pushproviders/firebase/README.md index 665118d57e..d9732af0d0 100644 --- a/libraries/pushproviders/firebase/README.md +++ b/libraries/pushproviders/firebase/README.md @@ -4,4 +4,4 @@ In order to make only this module know about Firebase, the plugin `com.google.gms.google-services` has been disabled from the `app` module. -To be able to change the values set to `google_app_id` in the file `build.gradle.kts` of this module, you should enable the plugin `com.google.gms.google-services` again, copy the file `google-services.json` to the folder `/app`, build the project, and check the generated file `app/build/generated/res/google-services//values/values.xml` to import the generated values into the `build.gradle.kts` files. +To be able to change the values set to `google_app_id` in the file `build.gradle.kts` of this module, you should enable the plugin `com.google.gms.google-services` again, copy the file `google-services.json` to the folder `/app`, build the project, and check the generated file `app/build/generated/res/google-services//values/values.xml` to import the generated values into the `firebase.xml` files. From c31d7e6cce3a9c39d3eab610fdb97ac6a750138d Mon Sep 17 00:00:00 2001 From: Jorge Martin Espinosa Date: Tue, 18 Aug 2026 18:50:57 +0200 Subject: [PATCH 127/145] Don't restart the sync service if the client is shutting down (#7472) * Don't restart the sync service if the client is shutting down This was causing issues when clearing the cache: 1. The client would ask the SDK to clear the caches. 2. The SDK would stop the sync service, clear the caches and set the `pos` value of sliding sync to 0 so the HS returns all the required state the next time the client is used. 3. However, between the sync service being stopped with the `pos=0` change and the client being destroyed, there was enough time for the `SyncOrchestrator` to decide the sync service was stopped for no good reason since there is network connectivity and the app is on foreground, so it restarted the sync, with `pos=0`. 4. This value was persisted, and the next time the new client did an 'initial sync' it had a `pos != 0`, which the HS uses to avoid returning some required state it already fetched. 5. The room list now lacks state events for lots of rooms and room names, avatars, members, etc. are now missing. --------- Co-authored-by: Benoit Marty --- .../android/appnav/di/MatrixSessionCache.kt | 2 +- .../android/appnav/di/SyncOrchestrator.kt | 15 +++-- .../android/appnav/SyncOrchestratorTest.kt | 57 +++++++++++++++---- .../appnav/di/MatrixSessionCacheTest.kt | 6 +- .../libraries/matrix/api/MatrixClient.kt | 3 + .../libraries/matrix/impl/RustMatrixClient.kt | 9 +++ .../libraries/matrix/test/FakeMatrixClient.kt | 4 ++ 7 files changed, 76 insertions(+), 20 deletions(-) diff --git a/appnav/src/main/kotlin/io/element/android/appnav/di/MatrixSessionCache.kt b/appnav/src/main/kotlin/io/element/android/appnav/di/MatrixSessionCache.kt index 11337f2e0a..a4bccfd6d7 100644 --- a/appnav/src/main/kotlin/io/element/android/appnav/di/MatrixSessionCache.kt +++ b/appnav/src/main/kotlin/io/element/android/appnav/di/MatrixSessionCache.kt @@ -115,7 +115,7 @@ class MatrixSessionCache( private fun onNewMatrixClient(matrixClient: MatrixClient) { val syncOrchestrator = syncOrchestratorFactory.create( - syncService = matrixClient.syncService, + matrixClient = matrixClient, sessionCoroutineScope = matrixClient.sessionCoroutineScope, ) sessionIdsToMatrixSession[matrixClient.sessionId] = InMemoryMatrixSession( diff --git a/appnav/src/main/kotlin/io/element/android/appnav/di/SyncOrchestrator.kt b/appnav/src/main/kotlin/io/element/android/appnav/di/SyncOrchestrator.kt index 1ce423a569..35a6a224ae 100644 --- a/appnav/src/main/kotlin/io/element/android/appnav/di/SyncOrchestrator.kt +++ b/appnav/src/main/kotlin/io/element/android/appnav/di/SyncOrchestrator.kt @@ -16,7 +16,7 @@ import io.element.android.features.networkmonitor.api.NetworkMonitor import io.element.android.features.networkmonitor.api.NetworkStatus import io.element.android.libraries.core.coroutine.CoroutineDispatchers import io.element.android.libraries.core.coroutine.childScope -import io.element.android.libraries.matrix.api.sync.SyncService +import io.element.android.libraries.matrix.api.MatrixClient import io.element.android.libraries.matrix.api.sync.SyncState import io.element.android.services.analytics.api.AnalyticsService import io.element.android.services.analytics.api.recordTransaction @@ -37,7 +37,7 @@ import kotlin.time.Duration.Companion.seconds @AssistedInject class SyncOrchestrator( - @Assisted private val syncService: SyncService, + @Assisted private val matrixClient: MatrixClient, @Assisted sessionCoroutineScope: CoroutineScope, private val appForegroundStateService: AppForegroundStateService, private val networkMonitor: NetworkMonitor, @@ -47,13 +47,15 @@ class SyncOrchestrator( @AssistedFactory interface Factory { fun create( - syncService: SyncService, + matrixClient: MatrixClient, sessionCoroutineScope: CoroutineScope, ): SyncOrchestrator } private val tag = "SyncOrchestrator" + private val syncService = matrixClient.syncService + private val coroutineScope = sessionCoroutineScope.childScope(dispatchers.io, tag) private val started = AtomicBoolean(false) @@ -94,7 +96,7 @@ class SyncOrchestrator( appForegroundStateService.isInCall, appForegroundStateService.isSyncingNotificationEvent, appForegroundStateService.hasRingingCall, - appForegroundStateService.isSharingLiveLocation + appForegroundStateService.isSharingLiveLocation, ) val isAppActiveFlow = combine(isAppActiveFlows) { actives -> actives.any { it } } combine( @@ -103,6 +105,11 @@ class SyncOrchestrator( networkMonitor.connectivity, isAppActiveFlow, ) { syncState, networkState, isAppActive -> + if (matrixClient.isShuttingDown) { + Timber.tag(tag).d("Matrix client is shutting down, no need to start the sync service again") + return@combine SyncStateAction.NoOp + } + val isNetworkAvailable = networkState == NetworkStatus.Connected Timber.tag(tag).d("isAppActive=$isAppActive, isNetworkAvailable=$isNetworkAvailable") diff --git a/appnav/src/test/kotlin/io/element/android/appnav/SyncOrchestratorTest.kt b/appnav/src/test/kotlin/io/element/android/appnav/SyncOrchestratorTest.kt index 7309ca6ac2..ab19ae0b54 100644 --- a/appnav/src/test/kotlin/io/element/android/appnav/SyncOrchestratorTest.kt +++ b/appnav/src/test/kotlin/io/element/android/appnav/SyncOrchestratorTest.kt @@ -12,6 +12,7 @@ import io.element.android.appnav.di.SyncOrchestrator import io.element.android.features.networkmonitor.api.NetworkStatus import io.element.android.features.networkmonitor.test.FakeNetworkMonitor import io.element.android.libraries.matrix.api.sync.SyncState +import io.element.android.libraries.matrix.test.FakeMatrixClient import io.element.android.libraries.matrix.test.sync.FakeSyncService import io.element.android.services.analytics.test.FakeAnalyticsService import io.element.android.services.appnavstate.test.FakeAppForegroundStateService @@ -40,7 +41,7 @@ class SyncOrchestratorTest { } val networkMonitor = FakeNetworkMonitor(initialStatus = NetworkStatus.Disconnected) val syncOrchestrator = createSyncOrchestrator( - syncService = syncService, + matrixClient = FakeMatrixClient(syncService = syncService), networkMonitor = networkMonitor, ) @@ -60,7 +61,7 @@ class SyncOrchestratorTest { } val networkMonitor = FakeNetworkMonitor(initialStatus = NetworkStatus.Connected) val syncOrchestrator = createSyncOrchestrator( - syncService = syncService, + matrixClient = FakeMatrixClient(syncService = syncService), networkMonitor = networkMonitor, ) @@ -85,7 +86,7 @@ class SyncOrchestratorTest { val networkMonitor = FakeNetworkMonitor(initialStatus = NetworkStatus.Connected) val appForegroundStateService = FakeAppForegroundStateService(initialForegroundValue = true) val syncOrchestrator = createSyncOrchestrator( - syncService = syncService, + matrixClient = FakeMatrixClient(syncService = syncService), networkMonitor = networkMonitor, appForegroundStateService = appForegroundStateService, ) @@ -117,7 +118,7 @@ class SyncOrchestratorTest { val networkMonitor = FakeNetworkMonitor(initialStatus = NetworkStatus.Connected) val appForegroundStateService = FakeAppForegroundStateService(initialForegroundValue = true) val syncOrchestrator = createSyncOrchestrator( - syncService = syncService, + matrixClient = FakeMatrixClient(syncService = syncService), networkMonitor = networkMonitor, appForegroundStateService = appForegroundStateService, ) @@ -165,7 +166,7 @@ class SyncOrchestratorTest { initialIsSyncingNotificationEventValue = false, ) val syncOrchestrator = createSyncOrchestrator( - syncService = syncService, + matrixClient = FakeMatrixClient(syncService = syncService), networkMonitor = networkMonitor, appForegroundStateService = appForegroundStateService, ) @@ -208,7 +209,7 @@ class SyncOrchestratorTest { initialIsSyncingNotificationEventValue = false, ) val syncOrchestrator = createSyncOrchestrator( - syncService = syncService, + matrixClient = FakeMatrixClient(syncService = syncService), networkMonitor = networkMonitor, appForegroundStateService = appForegroundStateService, ) @@ -252,7 +253,7 @@ class SyncOrchestratorTest { initialHasRingingCall = false, ) val syncOrchestrator = createSyncOrchestrator( - syncService = syncService, + matrixClient = FakeMatrixClient(syncService = syncService), networkMonitor = networkMonitor, appForegroundStateService = appForegroundStateService, ) @@ -296,7 +297,7 @@ class SyncOrchestratorTest { initialIsInCallValue = true, ) val syncOrchestrator = createSyncOrchestrator( - syncService = syncService, + matrixClient = FakeMatrixClient(syncService = syncService), networkMonitor = networkMonitor, appForegroundStateService = appForegroundStateService, ) @@ -339,7 +340,7 @@ class SyncOrchestratorTest { initialIsInCallValue = false, ) val syncOrchestrator = createSyncOrchestrator( - syncService = syncService, + matrixClient = FakeMatrixClient(syncService = syncService), networkMonitor = networkMonitor, appForegroundStateService = appForegroundStateService, ) @@ -369,7 +370,7 @@ class SyncOrchestratorTest { } val networkMonitor = FakeNetworkMonitor(initialStatus = NetworkStatus.Disconnected) val syncOrchestrator = createSyncOrchestrator( - syncService = syncService, + matrixClient = FakeMatrixClient(syncService = syncService), networkMonitor = networkMonitor, ) @@ -381,12 +382,44 @@ class SyncOrchestratorTest { startSyncRecorder.assertions().isNeverCalled() } + @Test + fun `when the client is shutting down, the orchestrator does nothing`() = runTest { + val networkMonitor = FakeNetworkMonitor(initialStatus = NetworkStatus.Disconnected) + val appForegroundStateService = FakeAppForegroundStateService( + initialForegroundValue = false, + initialIsSyncingNotificationEventValue = false, + initialIsInCallValue = false, + ) + + val startSyncRecorder = lambdaRecorder> { Result.success(Unit) } + val syncService = FakeSyncService(initialSyncState = SyncState.Idle).apply { + startSyncLambda = startSyncRecorder + } + val syncOrchestrator = createSyncOrchestrator( + matrixClient = FakeMatrixClient(syncService = syncService, isShuttingDownResult = { true }), + networkMonitor = networkMonitor, + appForegroundStateService = appForegroundStateService, + ) + + // We start observing + syncOrchestrator.observeStates() + + // These should still not trigger a sync, sync the client is shutting down + networkMonitor.givenNetworkBlocked(false) + appForegroundStateService.updateIsInCallState(true) + appForegroundStateService.isInForeground.value = true + + advanceTimeBy(10.seconds) + + startSyncRecorder.assertions().isNeverCalled() + } + private fun TestScope.createSyncOrchestrator( - syncService: FakeSyncService = FakeSyncService(), + matrixClient: FakeMatrixClient = FakeMatrixClient(), networkMonitor: FakeNetworkMonitor = FakeNetworkMonitor(), appForegroundStateService: FakeAppForegroundStateService = FakeAppForegroundStateService(), ) = SyncOrchestrator( - syncService = syncService, + matrixClient = matrixClient, sessionCoroutineScope = backgroundScope, networkMonitor = networkMonitor, appForegroundStateService = appForegroundStateService, diff --git a/appnav/src/test/kotlin/io/element/android/appnav/di/MatrixSessionCacheTest.kt b/appnav/src/test/kotlin/io/element/android/appnav/di/MatrixSessionCacheTest.kt index 36fa471dd0..cba8d06f90 100644 --- a/appnav/src/test/kotlin/io/element/android/appnav/di/MatrixSessionCacheTest.kt +++ b/appnav/src/test/kotlin/io/element/android/appnav/di/MatrixSessionCacheTest.kt @@ -11,7 +11,7 @@ package io.element.android.appnav.di import com.bumble.appyx.core.state.MutableSavedStateMapImpl import com.google.common.truth.Truth.assertThat import io.element.android.features.networkmonitor.test.FakeNetworkMonitor -import io.element.android.libraries.matrix.api.sync.SyncService +import io.element.android.libraries.matrix.api.MatrixClient import io.element.android.libraries.matrix.test.A_SESSION_ID import io.element.android.libraries.matrix.test.FakeMatrixClient import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService @@ -138,11 +138,11 @@ class MatrixSessionCacheTest { return object : SyncOrchestrator.Factory { override fun create( - syncService: SyncService, + matrixClient: MatrixClient, sessionCoroutineScope: CoroutineScope, ): SyncOrchestrator { return SyncOrchestrator( - syncService = syncService, + matrixClient = matrixClient, sessionCoroutineScope = sessionCoroutineScope, appForegroundStateService = FakeAppForegroundStateService(), networkMonitor = FakeNetworkMonitor(), diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt index b83d96af96..92859060dc 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt @@ -136,6 +136,9 @@ interface MatrixClient : UrlContentFetcher { /** Scans media content before it is displayed, or `null` when no content scanner is configured for this session. */ val contentScanner: ContentScanner? + /** Whether the session is in the process of shutting down, either because it is being logged out or its cache is being cleared. */ + val isShuttingDown: Boolean + /** * Returns the room with the given id if the user has joined it, along with its live [Timeline]. * A new instance is created on each call and the caller owns it, so it must be closed once no longer needed. diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt index 0ff563a204..d7fc7b98e2 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt @@ -135,6 +135,7 @@ import org.matrix.rustcomponents.sdk.use import timber.log.Timber import java.io.File import java.util.Optional +import java.util.concurrent.atomic.AtomicBoolean import kotlin.jvm.optionals.getOrNull import kotlin.time.Duration import kotlin.time.Duration.Companion.seconds @@ -304,6 +305,10 @@ class RustMatrixClient( .buffer(Channel.UNLIMITED) .stateIn(sessionCoroutineScope, started = SharingStarted.Eagerly, initialValue = persistentListOf()) + private val _isShuttingDown = AtomicBoolean(false) + override val isShuttingDown: Boolean + get() = _isShuttingDown.get() + init { // Make sure the session delegate has a reference to the client to be able to logout on auth error sessionDelegate.bindClient(this) @@ -666,11 +671,13 @@ class RustMatrixClient( } override suspend fun clearCache() { + _isShuttingDown.set(true) innerClient.clearCaches(innerSyncService) destroy() } override suspend fun logout(userInitiated: Boolean, ignoreSdkError: Boolean) { + _isShuttingDown.set(true) sessionCoroutineScope.cancel() // Remove current delegate so we don't receive an auth error clientDelegateTaskHandle?.cancelAndDestroy() @@ -708,6 +715,8 @@ class RustMatrixClient( } override suspend fun deactivateAccount(password: String, eraseData: Boolean): Result = withContext(sessionDispatcher) { + _isShuttingDown.set(true) + Timber.w("Deactivating account") // Remove current delegate so we don't receive an auth error clientDelegateTaskHandle?.cancelAndDestroy() diff --git a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeMatrixClient.kt b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeMatrixClient.kt index 56d25ed175..408a3a0f3b 100644 --- a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeMatrixClient.kt +++ b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeMatrixClient.kt @@ -133,6 +133,7 @@ class FakeMatrixClient( private val resetWellKnownConfigLambda: () -> Result = { lambdaError() }, private val enableAutomaticCallStatusLambda: (Boolean) -> Unit = { }, override val contentScanner: ContentScanner? = null, + private val isShuttingDownResult: () -> Boolean = { false }, ) : MatrixClient { var setDisplayNameCalled: Boolean = false private set @@ -305,6 +306,9 @@ class FakeMatrixClient( return knockRoomLambda(roomIdOrAlias, message, serverNames) } + override val isShuttingDown: Boolean + get() = isShuttingDownResult() + // Mocks fun givenCreateRoomResult(result: Result) { From 1b2d5b9c92e2ab6efbbfbaff8989f9ccce2c4303 Mon Sep 17 00:00:00 2001 From: Jenna Vassar Date: Tue, 18 Aug 2026 17:03:39 -0700 Subject: [PATCH 128/145] Complete account providers without the https scheme and include the enterprise allow-list --- .../ConfirmAccountProviderPresenter.kt | 44 ++++++++---- .../ConfirmAccountProviderView.kt | 22 ++++-- .../ConfirmAccountProviderPresenterTest.kt | 67 ++++++++++++++++--- 3 files changed, 105 insertions(+), 28 deletions(-) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt index e025780bc2..21bc9077dd 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenter.kt @@ -21,6 +21,7 @@ import dev.zacsweers.metro.Assisted import dev.zacsweers.metro.AssistedFactory import dev.zacsweers.metro.AssistedInject import io.element.android.appconfig.AuthenticationConfig +import io.element.android.features.enterprise.api.EnterpriseService import io.element.android.features.login.impl.accountprovider.AccountProvider import io.element.android.features.login.impl.accountprovider.AccountProviderDataSource import io.element.android.features.login.impl.changeserver.ChangeServerEvents @@ -38,6 +39,7 @@ class ConfirmAccountProviderPresenter( private val loginModePresenter: Presenter, private val changeServerPresenter: Presenter, private val appPreferencesStore: AppPreferencesStore, + private val enterpriseService: EnterpriseService, ) : Presenter { data class Params( val isAccountCreation: Boolean, @@ -55,22 +57,28 @@ class ConfirmAccountProviderPresenter( val changeServerState = changeServerPresenter.present() val homeserverHistory by appPreferencesStore.getHomeserverHistoryFlow().collectAsState(emptyList()) - // Editable input, seeded from the current (history-defaulted) account provider until the user edits it. - var userInput by rememberSaveable { mutableStateOf(null) } - val accountProviderInput = userInput ?: accountProvider.url + // The account providers offered for autocomplete: previously-used ones first, then the + // enterprise/MDM-configured allow-list, then matrix.org (always available, even before any sign-in). + // The "*" wildcard is a routing marker, not a real provider, so it is filtered out. Everything is + // rendered without the https:// scheme (added back at connection time). + val autocompleteCandidates = remember(homeserverHistory) { + (homeserverHistory + enterpriseService.homeserverAllowList() + AuthenticationConfig.MATRIX_ORG_URL) + .filter { it != EnterpriseService.ANY_ACCOUNT_PROVIDER } + .map { it.withoutScheme() } + .distinct() + } - // Offer an account provider that the current input is a prefix of: the most recent previously-used - // one first, then matrix.org. matrix.org is always available for autocomplete even before any - // sign-in, offered both with and without the https:// scheme so it completes whether the user starts - // typing "matrix.org" or "https://matrix.org". - val accountProviderSuggestion = remember(accountProviderInput, homeserverHistory) { + // Editable input, seeded from the current (history-defaulted) account provider until the user edits it. + // Displayed without the scheme, so the field shows e.g. "matrix.org" rather than "https://matrix.org". + var userInput by rememberSaveable { mutableStateOf(null) } + val accountProviderInput = userInput ?: accountProvider.url.withoutScheme() + + // Offer the first candidate that the current input is a (case-insensitive) prefix of. + val accountProviderSuggestion = remember(accountProviderInput, autocompleteCandidates) { val input = accountProviderInput.trim() - val candidates = homeserverHistory + - AuthenticationConfig.MATRIX_ORG_URL + - AuthenticationConfig.MATRIX_ORG_URL.removePrefix("https://") input.takeIf { it.isNotEmpty() } ?.let { prefix -> - candidates.firstOrNull { it.length > prefix.length && it.startsWith(prefix, ignoreCase = true) } + autocompleteCandidates.firstOrNull { it.length > prefix.length && it.startsWith(prefix, ignoreCase = true) } } } @@ -104,8 +112,12 @@ class ConfirmAccountProviderPresenter( // Validate (and persist) the chosen account provider before proceeding. This also enforces the // account-provider access control, which the login submit does not run on its own. is ConfirmAccountProviderEvents.Continue -> { + // Apply the accepted account provider (any accepted completion) back into the field so it + // renders the full server rather than the typed prefix, and survives the OAuth round-trip. + val accountProvider = event.accountProvider.trim() + userInput = accountProvider // Default the scheme to https:// so entering a bare host (e.g. "matrix.org") works. - val accountProviderUrl = event.accountProvider.trim().ensureProtocol() + val accountProviderUrl = accountProvider.ensureProtocol() submittedAccountProvider = accountProviderUrl changeServerState.eventSink( ChangeServerEvents.ChangeServer(AccountProvider(url = accountProviderUrl)) @@ -128,3 +140,9 @@ class ConfirmAccountProviderPresenter( ) } } + +/** + * The host part of an account provider URL, i.e. the value with any `https://` / `http://` scheme removed. + * Returns the input unchanged when it has no scheme (e.g. `matrix.org`). + */ +private fun String.withoutScheme(): String = substringAfter("://") diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt index 9a2e2819cc..c81fd529ef 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderView.kt @@ -50,7 +50,6 @@ import io.element.android.libraries.designsystem.atomic.molecules.IconTitleSubti import io.element.android.libraries.designsystem.atomic.pages.HeaderFooterPage import io.element.android.libraries.designsystem.components.BigIcon import io.element.android.libraries.designsystem.components.form.textFieldState -import io.element.android.libraries.designsystem.modifiers.onTabOrEnterKeyFocusNext import io.element.android.libraries.designsystem.preview.ElementPreview import io.element.android.libraries.designsystem.preview.PreviewsDayNight import io.element.android.libraries.designsystem.theme.components.Button @@ -82,8 +81,9 @@ fun ConfirmAccountProviderView( val keyboardController = LocalSoftwareKeyboardController.current var input by textFieldState(stateValue = state.accountProviderInput) + // Inline autocomplete: the un-typed remainder of the suggested account provider (rendered in grey and - // accepted on Continue). Only valid while the suggestion still starts with the current input. + // accepted on Continue / Enter). Only valid while the suggestion still starts with the current input. val suggestionSuffix = state.accountProviderSuggestion ?.takeIf { it.length > input.length && it.startsWith(input, ignoreCase = true) } ?.substring(input.length) @@ -156,7 +156,6 @@ fun ConfirmAccountProviderView( .fillMaxWidth() .padding(top = 40.dp) .focusRequester(focusRequester) - .onTabOrEnterKeyFocusNext(focusManager) .testTag(TestTags.changeServerServer), label = stringResource(id = CommonStrings.screen_change_server_textfield_header), placeholder = stringResource(id = CommonStrings.screen_change_server_textfield_placeholder), @@ -172,7 +171,22 @@ fun ConfirmAccountProviderView( keyboardType = KeyboardType.Uri, imeAction = ImeAction.Done, ), - keyboardActions = KeyboardActions(onDone = { submit() }), + keyboardActions = KeyboardActions( + onDone = { + if (suggestionSuffix.isNotEmpty()) { + // A completion is showing: accept it into the field and drop focus, dismissing the + // keyboard. This shows the completed server (with no stray mid-text cursor, since the + // field is no longer focused) ready to sign in with Continue. When no completion is + // showing, Done submits directly. + val accepted = input + suggestionSuffix + input = accepted + eventSink(ConfirmAccountProviderEvents.UserInputChanged(accepted)) + focusManager.clearFocus(force = true) + } else { + submit() + } + } + ), singleLine = true, trailingIcon = if (input.isNotEmpty()) { { diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt index 826c5cbfdf..229fc375a2 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt @@ -11,6 +11,7 @@ package io.element.android.features.login.impl.screens.confirmaccountprovider import app.cash.turbine.ReceiveTurbine import com.google.common.truth.Truth.assertThat import io.element.android.appconfig.AuthenticationConfig +import io.element.android.features.enterprise.api.EnterpriseService import io.element.android.features.enterprise.test.FakeEnterpriseService import io.element.android.features.login.impl.accesscontrol.DefaultAccountProviderAccessControl import io.element.android.features.login.impl.accountprovider.AccountProviderDataSource @@ -50,7 +51,7 @@ class ConfirmAccountProviderPresenterTest { val initialState = awaitItem() assertThat(initialState.isAccountCreation).isFalse() assertThat(initialState.submitEnabled).isTrue() - assertThat(initialState.accountProviderInput).isEqualTo(AuthenticationConfig.MATRIX_ORG_URL) + assertThat(initialState.accountProviderInput).isEqualTo("matrix.org") assertThat(initialState.loginModeState.loginMode).isEqualTo(AsyncData.Uninitialized) } } @@ -315,9 +316,10 @@ class ConfirmAccountProviderPresenterTest { presenter.test { val initialState = awaitItem() assertThat(initialState.accountProviderSuggestion).isNull() - initialState.eventSink(ConfirmAccountProviderEvents.UserInputChanged("https://random")) - val suggestionState = awaitState { it.accountProviderInput == "https://random" } - assertThat(suggestionState.accountProviderSuggestion).isEqualTo("https://randomcommunity.org") + initialState.eventSink(ConfirmAccountProviderEvents.UserInputChanged("random")) + val suggestionState = awaitState { it.accountProviderInput == "random" } + // Completion is offered without the https:// scheme, even though history stores the full URL. + assertThat(suggestionState.accountProviderSuggestion).isEqualTo("randomcommunity.org") } } @@ -338,9 +340,9 @@ class ConfirmAccountProviderPresenterTest { ) presenter.test { val initialState = awaitItem() - initialState.eventSink(ConfirmAccountProviderEvents.UserInputChanged("https://random")) + initialState.eventSink(ConfirmAccountProviderEvents.UserInputChanged("random")) val suggestionState = awaitState { it.accountProviderSuggestion != null } - suggestionState.eventSink(ConfirmAccountProviderEvents.Continue("https://randomcommunity.org")) + suggestionState.eventSink(ConfirmAccountProviderEvents.Continue("randomcommunity.org")) awaitLoginMode { it is AsyncData.Success } assertThat(submittedUrls.first()).isEqualTo("https://randomcommunity.org") cancelAndIgnoreRemainingEvents() @@ -348,15 +350,40 @@ class ConfirmAccountProviderPresenterTest { } @Test - fun `present - offers matrix_org as an autocomplete suggestion even without any history`() = runTest { + fun `present - continue applies the completed account provider back into the field`() = runTest { + val authenticationService = FakeMatrixAuthenticationService( + setHomeserverResult = { Result.success(aMatrixHomeServerDetails(supportsPasswordLogin = true)) }, + ) val presenter = createConfirmAccountProviderPresenter( - appPreferencesStore = InMemoryAppPreferencesStore(homeserverHistory = emptyList()), + matrixAuthenticationService = authenticationService, + appPreferencesStore = InMemoryAppPreferencesStore(homeserverHistory = listOf("https://randomcommunity.org")), ) presenter.test { val initialState = awaitItem() - initialState.eventSink(ConfirmAccountProviderEvents.UserInputChanged("https://matr")) - val suggestionState = awaitState { it.accountProviderInput == "https://matr" } - assertThat(suggestionState.accountProviderSuggestion).isEqualTo(AuthenticationConfig.MATRIX_ORG_URL) + initialState.eventSink(ConfirmAccountProviderEvents.UserInputChanged("random")) + val suggestionState = awaitState { it.accountProviderSuggestion != null } + suggestionState.eventSink(ConfirmAccountProviderEvents.Continue("randomcommunity.org")) + // The field now renders the full accepted server rather than the typed prefix. + val appliedState = awaitState { it.accountProviderInput == "randomcommunity.org" } + assertThat(appliedState.accountProviderInput).isEqualTo("randomcommunity.org") + cancelAndIgnoreRemainingEvents() + } + } + + @Test + fun `present - offers the enterprise allow-list servers as autocomplete suggestions`() = runTest { + val presenter = createConfirmAccountProviderPresenter( + appPreferencesStore = InMemoryAppPreferencesStore(homeserverHistory = emptyList()), + enterpriseService = FakeEnterpriseService( + // Preferred servers plus the "*" (any) wildcard: the wildcard is filtered out, the rest complete. + defaultHomeserverListResult = { listOf("https://element.io", EnterpriseService.ANY_ACCOUNT_PROVIDER) }, + ), + ) + presenter.test { + val initialState = awaitItem() + initialState.eventSink(ConfirmAccountProviderEvents.UserInputChanged("ele")) + val suggestionState = awaitState { it.accountProviderInput == "ele" } + assertThat(suggestionState.accountProviderSuggestion).isEqualTo("element.io") } } @@ -373,6 +400,22 @@ class ConfirmAccountProviderPresenterTest { } } + @Test + fun `present - does not autocomplete a scheme-prefixed input`() = runTest { + // Candidates are bare hosts, so a scheme-prefixed input never completes them - the user completes by + // typing the bare host. This also avoids ever suggesting an insecure http scheme. + val presenter = createConfirmAccountProviderPresenter( + appPreferencesStore = InMemoryAppPreferencesStore(homeserverHistory = emptyList()), + ) + presenter.test { + val initialState = awaitItem() + initialState.eventSink(ConfirmAccountProviderEvents.UserInputChanged("https://mat")) + assertThat(awaitState { it.accountProviderInput == "https://mat" }.accountProviderSuggestion).isNull() + initialState.eventSink(ConfirmAccountProviderEvents.UserInputChanged("http://mat")) + assertThat(awaitState { it.accountProviderInput == "http://mat" }.accountProviderSuggestion).isNull() + } + } + @Test fun `present - continue prepends https to a bare account provider`() = runTest { val submittedUrls = mutableListOf() @@ -440,10 +483,12 @@ class ConfirmAccountProviderPresenterTest { matrixAuthenticationService: MatrixAuthenticationService = FakeMatrixAuthenticationService(), defaultOAuthActionFlow: OAuthActionFlow = FakeOAuthActionFlow(), appPreferencesStore: AppPreferencesStore = InMemoryAppPreferencesStore(), + enterpriseService: EnterpriseService = FakeEnterpriseService(), ) = ConfirmAccountProviderPresenter( params = params, accountProviderDataSource = accountProviderDataSource, appPreferencesStore = appPreferencesStore, + enterpriseService = enterpriseService, loginModePresenter = createLoginModePresenter( authenticationService = matrixAuthenticationService, oAuthActionFlow = defaultOAuthActionFlow, From 2e2bf71ad53cfd2fa5bce7c53a18a0dfd6a93a31 Mon Sep 17 00:00:00 2001 From: Jenna Vassar Date: Tue, 18 Aug 2026 17:03:40 -0700 Subject: [PATCH 129/145] Make ensureProtocol case-insensitive --- .../android/libraries/core/uri/UrlUtils.kt | 5 +-- .../libraries/core/uri/UrlUtilsTest.kt | 35 +++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 libraries/core/src/test/kotlin/io/element/android/libraries/core/uri/UrlUtilsTest.kt diff --git a/libraries/core/src/main/kotlin/io/element/android/libraries/core/uri/UrlUtils.kt b/libraries/core/src/main/kotlin/io/element/android/libraries/core/uri/UrlUtils.kt index 666ee1d7ab..91402e3d11 100644 --- a/libraries/core/src/main/kotlin/io/element/android/libraries/core/uri/UrlUtils.kt +++ b/libraries/core/src/main/kotlin/io/element/android/libraries/core/uri/UrlUtils.kt @@ -20,12 +20,13 @@ fun String.isValidUrl(): Boolean { } /** - * Ensure string starts with "http". If it is not the case, "https://" is added, only if the String is not empty + * Ensure string starts with "http" (case-insensitively, so "HTTP://" / "HTTPS://" are respected). If it is + * not the case, "https://" is added, only if the String is not empty. */ fun String.ensureProtocol(): String { return when { isEmpty() -> this - !startsWith("http") -> "https://$this" + !startsWith("http", ignoreCase = true) -> "https://$this" else -> this } } diff --git a/libraries/core/src/test/kotlin/io/element/android/libraries/core/uri/UrlUtilsTest.kt b/libraries/core/src/test/kotlin/io/element/android/libraries/core/uri/UrlUtilsTest.kt new file mode 100644 index 0000000000..9a9d68dcaa --- /dev/null +++ b/libraries/core/src/test/kotlin/io/element/android/libraries/core/uri/UrlUtilsTest.kt @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2026 Element Creations Ltd. + * + * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. + * Please see LICENSE files in the repository root for full details. + */ + +package io.element.android.libraries.core.uri + +import com.google.common.truth.Truth.assertThat +import org.junit.Test + +class UrlUtilsTest { + @Test + fun `ensureProtocol keeps an empty string unchanged`() { + assertThat("".ensureProtocol()).isEqualTo("") + } + + @Test + fun `ensureProtocol prepends https when there is no scheme`() { + assertThat("matrix.org".ensureProtocol()).isEqualTo("https://matrix.org") + } + + @Test + fun `ensureProtocol keeps an existing http or https scheme`() { + assertThat("https://matrix.org".ensureProtocol()).isEqualTo("https://matrix.org") + assertThat("http://matrix.org".ensureProtocol()).isEqualTo("http://matrix.org") + } + + @Test + fun `ensureProtocol keeps an uppercase scheme rather than double-prepending`() { + assertThat("HTTPS://matrix.org".ensureProtocol()).isEqualTo("HTTPS://matrix.org") + assertThat("Http://matrix.org".ensureProtocol()).isEqualTo("Http://matrix.org") + } +} From a1e86ad499d03fc899b86236c3b114a21da4b4e8 Mon Sep 17 00:00:00 2001 From: Jorge Martin Espinosa Date: Wed, 19 Aug 2026 09:24:22 +0200 Subject: [PATCH 130/145] Use the right base URL for the ESS config/well known endpoints (#7469) * Rename `UrlContentFetcher` to `ClientUrlContentFetcher` and add missing base URL data (server name, homeserver URL) * Avoid passing the `homeserverUrl/serverName` around. Calculate the URL in `DefaultRemoteEnterpriseConfigRetriever` using the newly added `homserver` and `server` values as the possible base URLs, depending on the remote config source * Make sure we don't perform blocking requests to fetch the remote config when restoring a session Add a `needsRefresh` parameter to `RemoteEnterpriseConfigResult.NotFound` to handle this, and store a `no-config` value in the store to indicate an endpoint has been checked and no config was found * Bump enterprise module --- enterprise | 2 +- .../enterprise/api/EnterpriseService.kt | 17 ++++----------- .../RemoteEnterpriseConfigResult.kt | 10 +++++---- .../impl/DefaultEnterpriseService.kt | 8 +++---- .../DefaultContentScannerUrlProvider.kt | 4 ++-- .../enterprise/test/FakeEnterpriseService.kt | 17 ++++++--------- ...tFetcher.kt => ClientUrlContentFetcher.kt} | 14 +++++++++++-- .../libraries/matrix/api/MatrixClient.kt | 5 +---- .../matrix/api/TemporaryMatrixClient.kt | 2 +- .../api/TemporaryMatrixClientFactory.kt | 6 +++--- .../api/scanner/ContentScannerUrlProvider.kt | 4 ++-- .../libraries/matrix/impl/RustMatrixClient.kt | 1 + .../matrix/impl/RustTemporaryMatrixClient.kt | 3 +++ .../impl/RustTemporaryMatrixClientFactory.kt | 4 ++-- .../auth/RustMatrixAuthenticationService.kt | 1 - .../matrix/impl/di/SessionMatrixModule.kt | 4 ++-- .../impl/RustTemporaryMatrixClientTest.kt | 3 +-- .../impl/fixtures/fakes/FakeFfiClient.kt | 3 +++ .../test/FakeClientUrlContentFetcher.kt | 21 +++++++++++++++++++ .../libraries/matrix/test/FakeMatrixClient.kt | 1 + .../matrix/test/FakeTemporaryMatrixClient.kt | 3 ++- .../test/FakeTemporaryMatrixClientFactory.kt | 2 +- .../android/libraries/matrix/test/TestData.kt | 1 + 23 files changed, 79 insertions(+), 57 deletions(-) rename libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/{UrlContentFetcher.kt => ClientUrlContentFetcher.kt} (63%) create mode 100644 libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeClientUrlContentFetcher.kt diff --git a/enterprise b/enterprise index 3bf0df1f25..c87b257dd8 160000 --- a/enterprise +++ b/enterprise @@ -1 +1 @@ -Subproject commit 3bf0df1f25c4df8ee6cc226b00d9b6a675b37a09 +Subproject commit c87b257dd87fedc9ca6a4001d0318aae5a453284 diff --git a/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/EnterpriseService.kt b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/EnterpriseService.kt index 2f1cbe1187..2cb4a356be 100644 --- a/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/EnterpriseService.kt +++ b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/EnterpriseService.kt @@ -10,7 +10,7 @@ package io.element.android.features.enterprise.api import androidx.compose.ui.graphics.Color import io.element.android.compound.colors.SemanticColorsLightDark -import io.element.android.libraries.matrix.api.UrlContentFetcher +import io.element.android.libraries.matrix.api.ClientUrlContentFetcher import io.element.android.libraries.matrix.api.core.SessionId import kotlinx.coroutines.flow.Flow @@ -31,10 +31,9 @@ interface EnterpriseService { * Rewrites the authentication server URL when the deployment requires a different one from the one advertised. * * @param url the URL to rewrite. - * @param homeserver the homeserver the URL belongs to. * @param urlContentFetcher used to read the deployment configuration; a client that is not authenticated yet also works. */ - suspend fun tweakMasUrl(url: String, homeserver: String, urlContentFetcher: UrlContentFetcher): String + suspend fun tweakMasUrl(url: String, urlContentFetcher: ClientUrlContentFetcher): String /** * Returns the list of homeservers the user is allowed to sign in to. @@ -53,9 +52,9 @@ interface EnterpriseService { /** * Whether the given homeserver enforces the use of Element Pro or a derived app. * - * @param homeserverUrl the homeserver to check. + * @param serverName the homeserver to check. */ - suspend fun isElementProEnforced(homeserverUrl: String): Boolean + suspend fun isElementProEnforced(serverName: String): Boolean /** * Override the brand color. @@ -99,14 +98,6 @@ interface EnterpriseService { */ fun getNoisyNotificationChannelId(sessionId: SessionId): String? - /** - * Gets the Element Server Suite (ESS) config endpoint URL for the given domain. - * Returns `null` when this build does not read its configuration from an ESS deployment. - * - * @param domain the server whose configuration endpoint is requested. - */ - fun essConfigEndpointUrl(domain: String): String? - companion object { const val ANY_ACCOUNT_PROVIDER = "*" } diff --git a/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/RemoteEnterpriseConfigResult.kt b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/RemoteEnterpriseConfigResult.kt index 5f687ff052..ace0bada0b 100644 --- a/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/RemoteEnterpriseConfigResult.kt +++ b/features/enterprise/api/src/main/kotlin/io/element/android/features/enterprise/api/remoteconfig/RemoteEnterpriseConfigResult.kt @@ -19,9 +19,11 @@ sealed interface RemoteEnterpriseConfigResult { data class Outdated(val data: T) : RemoteEnterpriseConfigResult /** - * Well-known data is not found (file does not exist server side, we got a 404). + * Well-known data is not found (file does not exist server side, we got a 404). `needsRefresh` indicates whether a refresh must be done + * to replace this value: if it's `true`, the caller must trigger a refresh to try to fetch the data again; + * if it's `false`, the caller can assume that the data is not available and no refresh is needed before returning the data. */ - data object NotFound : RemoteEnterpriseConfigResult + data class NotFound(val needsRefresh: Boolean) : RemoteEnterpriseConfigResult /** * Any other error. @@ -32,13 +34,13 @@ sealed interface RemoteEnterpriseConfigResult { is Success -> data is Outdated -> data is Error -> null - NotFound -> null + is NotFound -> null } fun upToDateDataOrNull(): T? = when (this) { is Success -> data is Outdated -> null is Error -> null - NotFound -> null + is NotFound -> null } } diff --git a/features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/DefaultEnterpriseService.kt b/features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/DefaultEnterpriseService.kt index d07c0db569..bb10550369 100644 --- a/features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/DefaultEnterpriseService.kt +++ b/features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/DefaultEnterpriseService.kt @@ -14,7 +14,7 @@ import dev.zacsweers.metro.ContributesBinding import io.element.android.compound.colors.SemanticColorsLightDark import io.element.android.features.enterprise.api.BugReportUrl import io.element.android.features.enterprise.api.EnterpriseService -import io.element.android.libraries.matrix.api.UrlContentFetcher +import io.element.android.libraries.matrix.api.ClientUrlContentFetcher import io.element.android.libraries.matrix.api.core.SessionId import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flowOf @@ -22,10 +22,10 @@ import kotlinx.coroutines.flow.flowOf @ContributesBinding(AppScope::class) class DefaultEnterpriseService : EnterpriseService { override suspend fun isEnterpriseUser(sessionId: SessionId) = false - override suspend fun tweakMasUrl(url: String, homeserver: String, urlContentFetcher: UrlContentFetcher) = url + override suspend fun tweakMasUrl(url: String, urlContentFetcher: ClientUrlContentFetcher) = url override fun homeserverAllowList(): List = emptyList() override suspend fun isAllowedToConnectToHomeserver(homeserverUrl: String) = true - override suspend fun isElementProEnforced(homeserverUrl: String): Boolean = false + override suspend fun isElementProEnforced(serverName: String): Boolean = false override suspend fun overrideBrandColor(sessionId: SessionId?, brandColor: String?) = Unit @@ -45,6 +45,4 @@ class DefaultEnterpriseService : EnterpriseService { } override fun getNoisyNotificationChannelId(sessionId: SessionId): String? = null - - override fun essConfigEndpointUrl(domain: String): String? = null } diff --git a/features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/scanner/DefaultContentScannerUrlProvider.kt b/features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/scanner/DefaultContentScannerUrlProvider.kt index 4d4a800de9..378e4570d9 100644 --- a/features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/scanner/DefaultContentScannerUrlProvider.kt +++ b/features/enterprise/impl-foss/src/main/kotlin/io/element/android/features/enterprise/impl/scanner/DefaultContentScannerUrlProvider.kt @@ -9,7 +9,7 @@ package io.element.android.features.enterprise.impl.scanner import dev.zacsweers.metro.AppScope import dev.zacsweers.metro.ContributesBinding -import io.element.android.libraries.matrix.api.UrlContentFetcher +import io.element.android.libraries.matrix.api.ClientUrlContentFetcher import io.element.android.libraries.matrix.api.core.SessionId import io.element.android.libraries.matrix.api.scanner.ContentScannerUrlProvider @@ -22,7 +22,7 @@ class DefaultContentScannerUrlProvider : ContentScannerUrlProvider { @ContributesBinding(AppScope::class) class Factory : ContentScannerUrlProvider.Factory { - override fun create(urlContentFetcher: UrlContentFetcher): ContentScannerUrlProvider { + override fun create(urlContentFetcher: ClientUrlContentFetcher): ContentScannerUrlProvider { return DefaultContentScannerUrlProvider() } } diff --git a/features/enterprise/test/src/main/kotlin/io/element/android/features/enterprise/test/FakeEnterpriseService.kt b/features/enterprise/test/src/main/kotlin/io/element/android/features/enterprise/test/FakeEnterpriseService.kt index e346e5934a..a8efcb5873 100644 --- a/features/enterprise/test/src/main/kotlin/io/element/android/features/enterprise/test/FakeEnterpriseService.kt +++ b/features/enterprise/test/src/main/kotlin/io/element/android/features/enterprise/test/FakeEnterpriseService.kt @@ -12,7 +12,7 @@ import androidx.compose.ui.graphics.Color import io.element.android.compound.colors.SemanticColorsLightDark import io.element.android.features.enterprise.api.BugReportUrl import io.element.android.features.enterprise.api.EnterpriseService -import io.element.android.libraries.matrix.api.UrlContentFetcher +import io.element.android.libraries.matrix.api.ClientUrlContentFetcher import io.element.android.libraries.matrix.api.core.SessionId import io.element.android.tests.testutils.lambda.lambdaError import io.element.android.tests.testutils.simulateLongTask @@ -30,8 +30,7 @@ class FakeEnterpriseService( private val firebasePushGatewayResult: () -> String? = { lambdaError() }, private val unifiedPushDefaultPushGatewayResult: () -> String? = { lambdaError() }, private val getNoisyNotificationChannelIdResult: (SessionId?) -> String? = { lambdaError() }, - private val tweakMasUrlResult: (String, String, UrlContentFetcher) -> String = { _, _, _ -> lambdaError() }, - private val essConfigEndpointUrlResult: (String) -> String = { lambdaError() }, + private val tweakMasUrlResult: (String, ClientUrlContentFetcher) -> String = { _, _ -> lambdaError() }, private val isElementProEnforcedResult: (String) -> Boolean = { lambdaError() }, ) : EnterpriseService { private val brandColorState = MutableStateFlow(initialBrandColor) @@ -41,8 +40,8 @@ class FakeEnterpriseService( isEnterpriseUserResult(sessionId) } - override suspend fun tweakMasUrl(url: String, homeserver: String, urlContentFetcher: UrlContentFetcher): String = simulateLongTask { - tweakMasUrlResult(url, homeserver, urlContentFetcher) + override suspend fun tweakMasUrl(url: String, urlContentFetcher: ClientUrlContentFetcher): String = simulateLongTask { + tweakMasUrlResult(url, urlContentFetcher) } override fun homeserverAllowList(): List { @@ -53,8 +52,8 @@ class FakeEnterpriseService( isAllowedToConnectToHomeserverResult(homeserverUrl) } - override suspend fun isElementProEnforced(homeserverUrl: String): Boolean = simulateLongTask { - isElementProEnforcedResult(homeserverUrl) + override suspend fun isElementProEnforced(serverName: String): Boolean = simulateLongTask { + isElementProEnforcedResult(serverName) } override suspend fun overrideBrandColor(sessionId: SessionId?, brandColor: String?) = simulateLongTask { @@ -85,8 +84,4 @@ class FakeEnterpriseService( override fun getNoisyNotificationChannelId(sessionId: SessionId): String? { return getNoisyNotificationChannelIdResult(sessionId) } - - override fun essConfigEndpointUrl(domain: String): String { - return essConfigEndpointUrlResult(domain) - } } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/UrlContentFetcher.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/ClientUrlContentFetcher.kt similarity index 63% rename from libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/UrlContentFetcher.kt rename to libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/ClientUrlContentFetcher.kt index a6fb234b86..611bf7bf18 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/UrlContentFetcher.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/ClientUrlContentFetcher.kt @@ -8,9 +8,19 @@ package io.element.android.libraries.matrix.api /** - * An interface to fetch content from a URL using a simple GET request. + * An interface to fetch content from a URL using a simple GET request launched from a Matrix client. */ -fun interface UrlContentFetcher { +interface ClientUrlContentFetcher { + /** + * The domain of the public server for this homeserver. + */ + val server: String? + + /** + * The URL of the actual Matrix homeserver. + */ + val homeserverUrl: String + /** * Execute generic GET requests through the SDKs internal HTTP client. */ diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt index 92859060dc..02ed16e097 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt @@ -60,16 +60,13 @@ import java.util.Optional * One instance exists per session, created on login or session restore and torn down by [logout], [clearCache] or account deactivation. * Suspending members here report failures through a [Result] instead of throwing, and run their work off the main thread. */ -interface MatrixClient : UrlContentFetcher { +interface MatrixClient : ClientUrlContentFetcher { /** Identifier of the logged in user; a [SessionId] and a [UserId] are the same value. */ val sessionId: SessionId /** Identifier of this device, as assigned by the homeserver when the session was created. */ val deviceId: DeviceId - /** Base URL of the homeserver this client is connected to. */ - val homeserverUrl: String - /** Directories holding this session's databases, caches and downloaded media. */ val sessionPaths: SessionPaths diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/TemporaryMatrixClient.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/TemporaryMatrixClient.kt index 1e3ffea154..5013362f85 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/TemporaryMatrixClient.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/TemporaryMatrixClient.kt @@ -15,4 +15,4 @@ import java.lang.AutoCloseable * Note: this client implements an [AutoCloseable] interface, so using [AutoCloseable.close] or [AutoCloseable.use] will clean up any resources associated * with it, such as temporary files. */ -interface TemporaryMatrixClient : UrlContentFetcher, AutoCloseable +interface TemporaryMatrixClient : ClientUrlContentFetcher, AutoCloseable diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/TemporaryMatrixClientFactory.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/TemporaryMatrixClientFactory.kt index 3bd22c64f3..c3244b4742 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/TemporaryMatrixClientFactory.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/TemporaryMatrixClientFactory.kt @@ -12,10 +12,10 @@ package io.element.android.libraries.matrix.api */ interface TemporaryMatrixClientFactory { /** - * Builds an unauthenticated client pointing at [homeServerUrl], backed by a fresh set of temporary session directories. + * Builds an unauthenticated client pointing at [serverName], backed by a fresh set of temporary session directories. * The caller owns the returned client and must close it to delete those directories. * - * @param homeServerUrl the URL of the homeserver the client will talk to. + * @param serverName the domain of the public-facing server for the actual homeserver */ - suspend fun create(homeServerUrl: String): Result + suspend fun create(serverName: String): Result } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/scanner/ContentScannerUrlProvider.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/scanner/ContentScannerUrlProvider.kt index 2c11c750e4..0ed3f8f2a2 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/scanner/ContentScannerUrlProvider.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/scanner/ContentScannerUrlProvider.kt @@ -7,7 +7,7 @@ package io.element.android.libraries.matrix.api.scanner -import io.element.android.libraries.matrix.api.UrlContentFetcher +import io.element.android.libraries.matrix.api.ClientUrlContentFetcher import io.element.android.libraries.matrix.api.core.SessionId /** @@ -26,6 +26,6 @@ fun interface ContentScannerUrlProvider { /** * @param urlContentFetcher used to read the configuration advertised by the homeserver; a client that is not authenticated yet also works. */ - fun create(urlContentFetcher: UrlContentFetcher): ContentScannerUrlProvider + fun create(urlContentFetcher: ClientUrlContentFetcher): ContentScannerUrlProvider } } diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt index d7fc7b98e2..16371fcbf8 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt @@ -163,6 +163,7 @@ class RustMatrixClient( ) : MatrixClient { override val sessionId: UserId = UserId(innerClient.userId()) override val deviceId: DeviceId = DeviceId(innerClient.deviceId()) + override val server: String? = innerClient.server() override val homeserverUrl: String = innerClient.homeserver() override val sessionCoroutineScope = appCoroutineScope.childScope(dispatchers.main, "Session-$sessionId") private val sessionDispatcher = dispatchers.io.limitedParallelism(64) diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustTemporaryMatrixClient.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustTemporaryMatrixClient.kt index 54e4f696d3..f5b1f2ba4e 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustTemporaryMatrixClient.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustTemporaryMatrixClient.kt @@ -22,6 +22,9 @@ class RustTemporaryMatrixClient( client.getUrl(url) }.mapFailure { it.mapClientException() } + override val server: String? = client.server() + override val homeserverUrl: String = client.homeserver() + override fun close() { client.close() paths?.let { diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustTemporaryMatrixClientFactory.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustTemporaryMatrixClientFactory.kt index 70903ba91a..0e7d8bf2c5 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustTemporaryMatrixClientFactory.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustTemporaryMatrixClientFactory.kt @@ -19,7 +19,7 @@ class RustTemporaryMatrixClientFactory( private val sessionPathsFactory: SessionPathsFactory, private val rustMatrixClientFactory: RustMatrixClientFactory, ) : TemporaryMatrixClientFactory { - override suspend fun create(homeServerUrl: String): Result { + override suspend fun create(serverName: String): Result { return runCatchingExceptions { val sessionPaths = sessionPathsFactory.create() val client = rustMatrixClientFactory.getBaseClientBuilder( @@ -28,7 +28,7 @@ class RustTemporaryMatrixClientFactory( slidingSyncType = ClientBuilderSlidingSync.Native, isMessageSearchAvailable = false, ) - .homeserverUrl(homeServerUrl) + .serverName(serverName) .build() RustTemporaryMatrixClient(client, sessionPaths) } diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/auth/RustMatrixAuthenticationService.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/auth/RustMatrixAuthenticationService.kt index 2c936c9b23..153aa6d1d4 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/auth/RustMatrixAuthenticationService.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/auth/RustMatrixAuthenticationService.kt @@ -278,7 +278,6 @@ class RustMatrixAuthenticationService( .let { enterpriseService.tweakMasUrl( url = it, - homeserver = client.server() ?: client.homeserver(), urlContentFetcher = getUrlResolver, ) } diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/di/SessionMatrixModule.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/di/SessionMatrixModule.kt index 46fa885d25..569714181b 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/di/SessionMatrixModule.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/di/SessionMatrixModule.kt @@ -13,9 +13,9 @@ import dev.zacsweers.metro.ContributesTo import dev.zacsweers.metro.Provides import io.element.android.libraries.di.SessionScope import io.element.android.libraries.di.annotations.SessionCoroutineScope +import io.element.android.libraries.matrix.api.ClientUrlContentFetcher import io.element.android.libraries.matrix.api.HomeserverCapabilitiesProvider import io.element.android.libraries.matrix.api.MatrixClient -import io.element.android.libraries.matrix.api.UrlContentFetcher import io.element.android.libraries.matrix.api.core.DeviceId import io.element.android.libraries.matrix.api.core.SessionId import io.element.android.libraries.matrix.api.encryption.EncryptionService @@ -111,7 +111,7 @@ object SessionMatrixModule { } @Provides - fun providesGetUrlResolverClient(matrixClient: MatrixClient): UrlContentFetcher { + fun providesGetUrlResolverClient(matrixClient: MatrixClient): ClientUrlContentFetcher { return matrixClient } } diff --git a/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/RustTemporaryMatrixClientTest.kt b/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/RustTemporaryMatrixClientTest.kt index 322103042b..23e0cf2302 100644 --- a/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/RustTemporaryMatrixClientTest.kt +++ b/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/RustTemporaryMatrixClientTest.kt @@ -16,7 +16,6 @@ import io.element.android.tests.testutils.lambda.value import kotlinx.coroutines.test.runTest import org.junit.Test import org.matrix.rustcomponents.sdk.Client -import org.matrix.rustcomponents.sdk.NoHandle import java.io.File import kotlin.io.path.createTempDirectory import org.matrix.rustcomponents.sdk.ClientException as RustClientException @@ -84,7 +83,7 @@ class RustTemporaryMatrixClientTest { } private fun createRustTemporaryMatrixClient( - client: Client = Client(NoHandle), + client: Client = FakeFfiClient(), paths: SessionPaths, ): RustTemporaryMatrixClient { return RustTemporaryMatrixClient(client, paths) diff --git a/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/fakes/FakeFfiClient.kt b/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/fakes/FakeFfiClient.kt index 13be3cf2d5..f09a350971 100644 --- a/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/fakes/FakeFfiClient.kt +++ b/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/fakes/FakeFfiClient.kt @@ -12,6 +12,7 @@ import io.element.android.libraries.matrix.impl.fixtures.factories.aRustSession import io.element.android.libraries.matrix.impl.fixtures.factories.aRustUserProfile import io.element.android.libraries.matrix.test.A_DEVICE_ID import io.element.android.libraries.matrix.test.A_HOMESERVER_URL +import io.element.android.libraries.matrix.test.A_SERVER_NAME import io.element.android.libraries.matrix.test.A_USER_ID import io.element.android.tests.testutils.lambda.lambdaError import io.element.android.tests.testutils.simulateLongTask @@ -45,6 +46,7 @@ class FakeFfiClient( private val userId: String = A_USER_ID.value, private val deviceId: String = A_DEVICE_ID.value, private val homeserver: String = A_HOMESERVER_URL, + private val server: String? = A_SERVER_NAME, private val notificationClient: NotificationClient = FakeFfiNotificationClient(), private val notificationSettings: NotificationSettings = FakeFfiNotificationSettings(), private val encryption: Encryption = FakeFfiEncryption(), @@ -66,6 +68,7 @@ class FakeFfiClient( override fun userId(): String = userId override fun deviceId(): String = deviceId override fun homeserver(): String = homeserver + override fun server(): String? = server override suspend fun notificationClient(processSetup: NotificationProcessSetup) = notificationClient override suspend fun getNotificationSettings(): NotificationSettings = notificationSettings override fun encryption(): Encryption = encryption diff --git a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeClientUrlContentFetcher.kt b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeClientUrlContentFetcher.kt new file mode 100644 index 0000000000..2018228985 --- /dev/null +++ b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeClientUrlContentFetcher.kt @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2026 Element Creations Ltd. + * + * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. + * Please see LICENSE files in the repository root for full details. + */ + +package io.element.android.libraries.matrix.test + +import io.element.android.libraries.matrix.api.ClientUrlContentFetcher +import io.element.android.tests.testutils.lambda.lambdaError + +class FakeClientUrlContentFetcher( + override val server: String = A_SERVER_NAME, + override val homeserverUrl: String = A_HOMESERVER_URL, + private val getUrlResult: (String) -> Result = { lambdaError() }, +) : ClientUrlContentFetcher { + override suspend fun getUrl(url: String): Result { + return getUrlResult(url) + } +} diff --git a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeMatrixClient.kt b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeMatrixClient.kt index 408a3a0f3b..6f330b6536 100644 --- a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeMatrixClient.kt +++ b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeMatrixClient.kt @@ -79,6 +79,7 @@ class FakeMatrixClient( override val sessionId: SessionId = A_SESSION_ID, override val sessionPaths: SessionPaths = SessionPaths(fileDirectory = File("files"), cacheDirectory = File("cache")), override val deviceId: DeviceId = A_DEVICE_ID, + override val server: String = A_SERVER_NAME, override val homeserverUrl: String = A_HOMESERVER_URL, override val sessionCoroutineScope: CoroutineScope = TestScope(), private val userDisplayName: String? = A_USER_NAME, diff --git a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeTemporaryMatrixClient.kt b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeTemporaryMatrixClient.kt index 83bde4653a..3ee7fb5f2f 100644 --- a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeTemporaryMatrixClient.kt +++ b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeTemporaryMatrixClient.kt @@ -11,10 +11,11 @@ import io.element.android.libraries.matrix.api.TemporaryMatrixClient import io.element.android.tests.testutils.lambda.lambdaError class FakeTemporaryMatrixClient( + override val server: String = A_SERVER_NAME, + override val homeserverUrl: String = A_HOMESERVER_URL, private val getUrlResult: (String) -> Result = { lambdaError() }, private val closeLambda: () -> Unit = {}, ) : TemporaryMatrixClient { override suspend fun getUrl(url: String): Result = getUrlResult(url) - override fun close() = closeLambda() } diff --git a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeTemporaryMatrixClientFactory.kt b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeTemporaryMatrixClientFactory.kt index cdec68bdd1..e906777dcb 100644 --- a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeTemporaryMatrixClientFactory.kt +++ b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeTemporaryMatrixClientFactory.kt @@ -13,5 +13,5 @@ import io.element.android.libraries.matrix.api.TemporaryMatrixClientFactory class FakeTemporaryMatrixClientFactory( private val createResult: (String) -> Result = { Result.success(FakeTemporaryMatrixClient()) }, ) : TemporaryMatrixClientFactory { - override suspend fun create(homeServerUrl: String): Result = createResult(homeServerUrl) + override suspend fun create(serverName: String): Result = createResult(serverName) } diff --git a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/TestData.kt b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/TestData.kt index c41ce0fe3e..c8f49eaf56 100644 --- a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/TestData.kt +++ b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/TestData.kt @@ -72,6 +72,7 @@ const val A_SPACE_NAME = "A space name" const val A_REDACTION_REASON = "A redaction reason" +const val A_SERVER_NAME = "matrix.org" const val A_HOMESERVER_URL = "matrix.org" const val A_HOMESERVER_URL_2 = "matrix-client.org" From ff89302cf5e39fbe3cc8213ab005f4d5a9b49a0a Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 19 Aug 2026 11:56:34 +0200 Subject: [PATCH 131/145] Normalize the applicationName used in user agent, as HTTP spec does not allow UTF-8 chars in headers. --- .../libraries/core/extensions/BasicExtensions.kt | 12 ++++++++++++ .../libraries/core/extensions/BasicExtensionsTest.kt | 6 ++++++ .../network/useragent/DefaultUserAgentProvider.kt | 5 +++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/libraries/core/src/main/kotlin/io/element/android/libraries/core/extensions/BasicExtensions.kt b/libraries/core/src/main/kotlin/io/element/android/libraries/core/extensions/BasicExtensions.kt index fe563138ad..87d6350c65 100644 --- a/libraries/core/src/main/kotlin/io/element/android/libraries/core/extensions/BasicExtensions.kt +++ b/libraries/core/src/main/kotlin/io/element/android/libraries/core/extensions/BasicExtensions.kt @@ -8,6 +8,7 @@ package io.element.android.libraries.core.extensions +import java.text.Normalizer import java.util.Locale fun Boolean.toOnOff() = if (this) "ON" else "OFF" @@ -114,3 +115,14 @@ fun String.toSafeLength( this } } + +/** + * Remove accents and replace special characters by ASCII from the string. + * For instance, "é" will be replaced by "e", "ç" by "c", etc. + */ +fun String.normalized(): String { + // Normalize the string. + return Normalizer.normalize(this, Normalizer.Form.NFD) + // then keep only ASCII characters and replace non-ASCII characters with an empty string. + .replace("[^\\p{ASCII}]".toRegex(), "") +} diff --git a/libraries/core/src/test/kotlin/io/element/android/libraries/core/extensions/BasicExtensionsTest.kt b/libraries/core/src/test/kotlin/io/element/android/libraries/core/extensions/BasicExtensionsTest.kt index 0099a67a79..c3cae14843 100644 --- a/libraries/core/src/test/kotlin/io/element/android/libraries/core/extensions/BasicExtensionsTest.kt +++ b/libraries/core/src/test/kotlin/io/element/android/libraries/core/extensions/BasicExtensionsTest.kt @@ -74,4 +74,10 @@ class BasicExtensionsTest { val result = textWithDirectionOverrides.filterDirectionOverrides() assertEquals("123456789", result) } + + @Test + fun `normalized removes accents and replace special characters from text`() { + assertEquals("Stefan", "Ștefan".normalized()) + assertEquals("ca enleve etre", "ça enlève être".normalized()) + } } diff --git a/libraries/network/src/main/kotlin/io/element/android/libraries/network/useragent/DefaultUserAgentProvider.kt b/libraries/network/src/main/kotlin/io/element/android/libraries/network/useragent/DefaultUserAgentProvider.kt index 3ecd091e0d..2a32c6d273 100644 --- a/libraries/network/src/main/kotlin/io/element/android/libraries/network/useragent/DefaultUserAgentProvider.kt +++ b/libraries/network/src/main/kotlin/io/element/android/libraries/network/useragent/DefaultUserAgentProvider.kt @@ -12,6 +12,7 @@ import android.os.Build import dev.zacsweers.metro.AppScope import dev.zacsweers.metro.ContributesBinding import dev.zacsweers.metro.SingleIn +import io.element.android.libraries.core.extensions.normalized import io.element.android.libraries.core.meta.BuildMeta import io.element.android.libraries.matrix.api.SdkMetadata @@ -26,11 +27,11 @@ class DefaultUserAgentProvider( override fun provide(): String = userAgent /** - * Create an user agent with the application version. + * Create a user agent with the application version. * Ex: Element X/1.5.0 (Xiaomi Mi 9T; Android 11; RKQ1.200826.002; Sdk c344b155c) */ private fun buildUserAgent(): String { - val appName = buildMeta.applicationName + val appName = buildMeta.applicationName.normalized() val appVersion = buildMeta.versionName val deviceManufacturer = Build.MANUFACTURER val deviceModel = Build.MODEL From ee1348e19e47bb51e80c9081789237b57b9eaf80 Mon Sep 17 00:00:00 2001 From: hayyaksi <193020925+hayaksi1@users.noreply.github.com> Date: Wed, 19 Aug 2026 13:29:24 +0300 Subject: [PATCH 132/145] Give the room name in the timeline top bar a 48dp tap target (#7450) * Give the room name in the timeline top bar a 48dp tap target The row carrying the room avatar and name is the control that opens the room details, but it is only as tall as its content, which is under the 48dp minimum recommended for a touch target. Constrain it to a minimum height of 48dp. The children stay centred inside the app bar, so nothing moves visually. * Update screenshots The accessibility snapshot of the timeline is the only one the change affects: the node which opens the room details now reports a 48dp tall bounding box. The room name, the avatar and the icons stay where they were. --- .../features/messages/impl/topbars/MessagesViewTopBar.kt | 2 ++ .../images/features.messages.impl_MessagesViewA11y_en.png | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/topbars/MessagesViewTopBar.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/topbars/MessagesViewTopBar.kt index 6aabf97f2c..d6a55c0563 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/topbars/MessagesViewTopBar.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/topbars/MessagesViewTopBar.kt @@ -16,6 +16,7 @@ import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.asPaddingValues +import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.safeDrawing @@ -84,6 +85,7 @@ internal fun MessagesViewTopBar( val roundedCornerShape = RoundedCornerShape(8.dp) Row( modifier = Modifier + .heightIn(min = 48.dp) .clip(roundedCornerShape) .clickable { onRoomDetailsClick() } .semantics { heading() }, diff --git a/tests/uitests/src/test/snapshots/images/features.messages.impl_MessagesViewA11y_en.png b/tests/uitests/src/test/snapshots/images/features.messages.impl_MessagesViewA11y_en.png index f47e74ab7b..78a758b1e8 100644 --- a/tests/uitests/src/test/snapshots/images/features.messages.impl_MessagesViewA11y_en.png +++ b/tests/uitests/src/test/snapshots/images/features.messages.impl_MessagesViewA11y_en.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5823ae9a382421609200d569799505706180b94c6923f315caa81f8767ac58f8 -size 131340 +oid sha256:996251b2e0e0a28ec167ec137f913ed5bb6f21b443bbf8151bc3203ad853b667 +size 131374 From 6bd841d8381a4e38e2a40e58640fb91544e92af1 Mon Sep 17 00:00:00 2001 From: hayyaksi <193020925+hayaksi1@users.noreply.github.com> Date: Wed, 19 Aug 2026 13:52:11 +0300 Subject: [PATCH 133/145] Close the invite screen once the invite has been declined (#7440) Declining an invite from the full screen invite left the user on that same screen, so they had to press back themselves to get to the room list. Both decline paths are affected: the plain decline handled by AcceptDeclineInviteView, and the decline and block sub screen, which navigated up into the join room flow instead of out of it. Navigate up from the join room flow on a successful decline, and give DeclineInviteAndBlockEntryPoint a callback so the sub screen can report a successful decline separately from a back press. The room list flow supplies the same callback, popping the sub screen once the invite has been declined. --- .../android/features/home/impl/HomeFlowNode.kt | 5 +++++ .../home/impl/DefaultHomeEntryPointTest.kt | 3 ++- .../DeclineInviteAndBlockEntryPoint.kt | 8 +++++++- .../impl/declineandblock/DeclineAndBlockNode.kt | 4 ++++ .../impl/declineandblock/DeclineAndBlockView.kt | 4 +++- .../DefaultDeclineAndBlockEntryPoint.kt | 3 ++- .../declineandblock/DeclineAndBlockViewTest.kt | 17 +++++++++++++++++ .../DefaultDeclineAndBlockEntryPointTest.kt | 9 ++++++++- .../FakeDeclineInviteAndBlockEntryPoint.kt | 1 + .../features/joinroom/impl/JoinRoomFlowNode.kt | 5 ++++- 10 files changed, 53 insertions(+), 6 deletions(-) diff --git a/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/HomeFlowNode.kt b/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/HomeFlowNode.kt index 00f285e3f4..b7b05cca87 100644 --- a/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/HomeFlowNode.kt +++ b/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/HomeFlowNode.kt @@ -269,6 +269,11 @@ class HomeFlowNode( parentNode = this, buildContext = buildContext, inviteData = navTarget.inviteData, + callback = object : DeclineInviteAndBlockEntryPoint.Callback { + override fun onDeclineSuccess() { + backstack.pop() + } + }, ) } is NavTarget.SelectNewOwnersWhenLeavingRoom -> { diff --git a/features/home/impl/src/test/kotlin/io/element/android/features/home/impl/DefaultHomeEntryPointTest.kt b/features/home/impl/src/test/kotlin/io/element/android/features/home/impl/DefaultHomeEntryPointTest.kt index 8eee8e1ee2..5e8570adec 100644 --- a/features/home/impl/src/test/kotlin/io/element/android/features/home/impl/DefaultHomeEntryPointTest.kt +++ b/features/home/impl/src/test/kotlin/io/element/android/features/home/impl/DefaultHomeEntryPointTest.kt @@ -11,6 +11,7 @@ package io.element.android.features.home.impl import com.bumble.appyx.core.modality.BuildContext import com.google.common.truth.Truth.assertThat import io.element.android.features.home.api.HomeEntryPoint +import io.element.android.features.invite.test.declineandblock.FakeDeclineInviteAndBlockEntryPoint import io.element.android.libraries.matrix.api.core.RoomId import io.element.android.libraries.matrix.api.room.JoinedRoom import io.element.android.libraries.matrix.test.FakeMatrixClient @@ -36,7 +37,7 @@ class DefaultHomeEntryPointTest : RobolectricTest() { acceptDeclineInviteView = { _, _, _, _ -> lambdaError() }, directLogoutView = { _ -> lambdaError() }, reportRoomEntryPoint = { _, _, _ -> lambdaError() }, - declineInviteAndBlockUserEntryPoint = { _, _, _ -> lambdaError() }, + declineInviteAndBlockUserEntryPoint = FakeDeclineInviteAndBlockEntryPoint(), changeRoomMemberRolesEntryPoint = { _, _, _, _ -> lambdaError() }, leaveRoomRenderer = { _, _, _ -> lambdaError() }, sessionCoroutineScope = backgroundScope, diff --git a/features/invite/api/src/main/kotlin/io/element/android/features/invite/api/declineandblock/DeclineInviteAndBlockEntryPoint.kt b/features/invite/api/src/main/kotlin/io/element/android/features/invite/api/declineandblock/DeclineInviteAndBlockEntryPoint.kt index 4174d99222..3b9d512d80 100644 --- a/features/invite/api/src/main/kotlin/io/element/android/features/invite/api/declineandblock/DeclineInviteAndBlockEntryPoint.kt +++ b/features/invite/api/src/main/kotlin/io/element/android/features/invite/api/declineandblock/DeclineInviteAndBlockEntryPoint.kt @@ -10,13 +10,19 @@ package io.element.android.features.invite.api.declineandblock import com.bumble.appyx.core.modality.BuildContext import com.bumble.appyx.core.node.Node +import com.bumble.appyx.core.plugin.Plugin import io.element.android.features.invite.api.InviteData import io.element.android.libraries.architecture.FeatureEntryPoint -fun interface DeclineInviteAndBlockEntryPoint : FeatureEntryPoint { +interface DeclineInviteAndBlockEntryPoint : FeatureEntryPoint { fun createNode( parentNode: Node, buildContext: BuildContext, inviteData: InviteData, + callback: Callback, ): Node + + interface Callback : Plugin { + fun onDeclineSuccess() + } } diff --git a/features/invite/impl/src/main/kotlin/io/element/android/features/invite/impl/declineandblock/DeclineAndBlockNode.kt b/features/invite/impl/src/main/kotlin/io/element/android/features/invite/impl/declineandblock/DeclineAndBlockNode.kt index 2fe5c23088..89a2aaf238 100644 --- a/features/invite/impl/src/main/kotlin/io/element/android/features/invite/impl/declineandblock/DeclineAndBlockNode.kt +++ b/features/invite/impl/src/main/kotlin/io/element/android/features/invite/impl/declineandblock/DeclineAndBlockNode.kt @@ -17,7 +17,9 @@ import dev.zacsweers.metro.Assisted import dev.zacsweers.metro.AssistedInject import io.element.android.annotations.ContributesNode import io.element.android.features.invite.api.InviteData +import io.element.android.features.invite.api.declineandblock.DeclineInviteAndBlockEntryPoint import io.element.android.libraries.architecture.NodeInputs +import io.element.android.libraries.architecture.callback import io.element.android.libraries.architecture.inputs import io.element.android.libraries.di.SessionScope @@ -31,6 +33,7 @@ class DeclineAndBlockNode( data class Inputs(val inviteData: InviteData) : NodeInputs private val inviteData = inputs().inviteData + private val callback: DeclineInviteAndBlockEntryPoint.Callback = callback() private val presenter = presenterFactory.create(inviteData) @Composable @@ -39,6 +42,7 @@ class DeclineAndBlockNode( DeclineAndBlockView( state = state, onBackClick = ::navigateUp, + onDeclineSuccess = callback::onDeclineSuccess, modifier = modifier ) } diff --git a/features/invite/impl/src/main/kotlin/io/element/android/features/invite/impl/declineandblock/DeclineAndBlockView.kt b/features/invite/impl/src/main/kotlin/io/element/android/features/invite/impl/declineandblock/DeclineAndBlockView.kt index 1d14df024a..841034516e 100644 --- a/features/invite/impl/src/main/kotlin/io/element/android/features/invite/impl/declineandblock/DeclineAndBlockView.kt +++ b/features/invite/impl/src/main/kotlin/io/element/android/features/invite/impl/declineandblock/DeclineAndBlockView.kt @@ -46,6 +46,7 @@ import io.element.android.libraries.ui.strings.CommonStrings fun DeclineAndBlockView( state: DeclineAndBlockState, onBackClick: () -> Unit, + onDeclineSuccess: () -> Unit, modifier: Modifier = Modifier, ) { val focusManager = LocalFocusManager.current @@ -53,7 +54,7 @@ fun DeclineAndBlockView( val isDeclining = state.declineAction is AsyncAction.Loading AsyncActionView( async = state.declineAction, - onSuccess = { onBackClick() }, + onSuccess = { onDeclineSuccess() }, errorMessage = { stringResource(CommonStrings.error_unknown) }, onRetry = { state.eventSink(DeclineAndBlockEvents.Decline) }, onErrorDismiss = { state.eventSink(DeclineAndBlockEvents.ClearDeclineAction) } @@ -149,5 +150,6 @@ internal fun DeclineAndBlockViewPreview( DeclineAndBlockView( state = state, onBackClick = {}, + onDeclineSuccess = {}, ) } diff --git a/features/invite/impl/src/main/kotlin/io/element/android/features/invite/impl/declineandblock/DefaultDeclineAndBlockEntryPoint.kt b/features/invite/impl/src/main/kotlin/io/element/android/features/invite/impl/declineandblock/DefaultDeclineAndBlockEntryPoint.kt index d6e93fb805..4a5734af45 100644 --- a/features/invite/impl/src/main/kotlin/io/element/android/features/invite/impl/declineandblock/DefaultDeclineAndBlockEntryPoint.kt +++ b/features/invite/impl/src/main/kotlin/io/element/android/features/invite/impl/declineandblock/DefaultDeclineAndBlockEntryPoint.kt @@ -22,8 +22,9 @@ class DefaultDeclineAndBlockEntryPoint : DeclineInviteAndBlockEntryPoint { parentNode: Node, buildContext: BuildContext, inviteData: InviteData, + callback: DeclineInviteAndBlockEntryPoint.Callback, ): Node { val inputs = DeclineAndBlockNode.Inputs(inviteData) - return parentNode.createNode(buildContext, plugins = listOf(inputs)) + return parentNode.createNode(buildContext, plugins = listOf(inputs, callback)) } } diff --git a/features/invite/impl/src/test/kotlin/io/element/android/features/invite/impl/declineandblock/DeclineAndBlockViewTest.kt b/features/invite/impl/src/test/kotlin/io/element/android/features/invite/impl/declineandblock/DeclineAndBlockViewTest.kt index 55c31a09d2..5cfb091e82 100644 --- a/features/invite/impl/src/test/kotlin/io/element/android/features/invite/impl/declineandblock/DeclineAndBlockViewTest.kt +++ b/features/invite/impl/src/test/kotlin/io/element/android/features/invite/impl/declineandblock/DeclineAndBlockViewTest.kt @@ -17,6 +17,7 @@ import androidx.compose.ui.test.onNodeWithText import androidx.compose.ui.test.performTextInput import androidx.compose.ui.test.v2.runAndroidComposeUiTest import io.element.android.features.invite.impl.R +import io.element.android.libraries.architecture.AsyncAction import io.element.android.libraries.ui.strings.CommonStrings import io.element.android.tests.testutils.EnsureNeverCalled import io.element.android.tests.testutils.EventsRecorder @@ -41,6 +42,20 @@ class DeclineAndBlockViewTest : RobolectricTest() { } } + @Test + fun `a successful decline invokes the expected callback`() = runAndroidComposeUiTest { + val eventsRecorder = EventsRecorder(expectEvents = false) + ensureCalledOnce { + setDeclineAndBlockView( + aDeclineAndBlockState( + declineAction = AsyncAction.Success(Unit), + eventSink = eventsRecorder, + ), + onDeclineSuccess = it, + ) + } + } + @Test fun `clicking on decline when enabled emits the expected event`() = runAndroidComposeUiTest { val eventsRecorder = EventsRecorder() @@ -112,11 +127,13 @@ class DeclineAndBlockViewTest : RobolectricTest() { private fun AndroidComposeUiTest.setDeclineAndBlockView( state: DeclineAndBlockState, onBackClick: () -> Unit = EnsureNeverCalled(), + onDeclineSuccess: () -> Unit = EnsureNeverCalled(), ) { setContent { DeclineAndBlockView( state = state, onBackClick = onBackClick, + onDeclineSuccess = onDeclineSuccess, ) } } diff --git a/features/invite/impl/src/test/kotlin/io/element/android/features/invite/impl/declineandblock/DefaultDeclineAndBlockEntryPointTest.kt b/features/invite/impl/src/test/kotlin/io/element/android/features/invite/impl/declineandblock/DefaultDeclineAndBlockEntryPointTest.kt index 13bb13dccf..f09cda2337 100644 --- a/features/invite/impl/src/test/kotlin/io/element/android/features/invite/impl/declineandblock/DefaultDeclineAndBlockEntryPointTest.kt +++ b/features/invite/impl/src/test/kotlin/io/element/android/features/invite/impl/declineandblock/DefaultDeclineAndBlockEntryPointTest.kt @@ -11,7 +11,9 @@ package io.element.android.features.invite.impl.declineandblock import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.bumble.appyx.core.modality.BuildContext import com.google.common.truth.Truth.assertThat +import io.element.android.features.invite.api.declineandblock.DeclineInviteAndBlockEntryPoint import io.element.android.features.invite.test.anInviteData +import io.element.android.tests.testutils.lambda.lambdaError import io.element.android.tests.testutils.node.TestParentNode import org.junit.Rule import org.junit.Test @@ -31,12 +33,17 @@ class DefaultDeclineAndBlockEntryPointTest { ) } val inviteData = anInviteData() + val callback = object : DeclineInviteAndBlockEntryPoint.Callback { + override fun onDeclineSuccess() = lambdaError() + } val result = entryPoint.createNode( parentNode = parentNode, buildContext = BuildContext.root(null), - inviteData = inviteData + inviteData = inviteData, + callback = callback, ) assertThat(result).isInstanceOf(DeclineAndBlockNode::class.java) assertThat(result.plugins).contains(DeclineAndBlockNode.Inputs(inviteData)) + assertThat(result.plugins).contains(callback) } } diff --git a/features/invite/test/src/main/kotlin/io/element/android/features/invite/test/declineandblock/FakeDeclineInviteAndBlockEntryPoint.kt b/features/invite/test/src/main/kotlin/io/element/android/features/invite/test/declineandblock/FakeDeclineInviteAndBlockEntryPoint.kt index 52d4d17790..19625f1473 100644 --- a/features/invite/test/src/main/kotlin/io/element/android/features/invite/test/declineandblock/FakeDeclineInviteAndBlockEntryPoint.kt +++ b/features/invite/test/src/main/kotlin/io/element/android/features/invite/test/declineandblock/FakeDeclineInviteAndBlockEntryPoint.kt @@ -19,6 +19,7 @@ class FakeDeclineInviteAndBlockEntryPoint : DeclineInviteAndBlockEntryPoint { parentNode: Node, buildContext: BuildContext, inviteData: InviteData, + callback: DeclineInviteAndBlockEntryPoint.Callback, ): Node { lambdaError() } diff --git a/features/joinroom/impl/src/main/kotlin/io/element/android/features/joinroom/impl/JoinRoomFlowNode.kt b/features/joinroom/impl/src/main/kotlin/io/element/android/features/joinroom/impl/JoinRoomFlowNode.kt index 93f8f53412..493c180731 100644 --- a/features/joinroom/impl/src/main/kotlin/io/element/android/features/joinroom/impl/JoinRoomFlowNode.kt +++ b/features/joinroom/impl/src/main/kotlin/io/element/android/features/joinroom/impl/JoinRoomFlowNode.kt @@ -69,6 +69,9 @@ class JoinRoomFlowNode( parentNode = this, buildContext = buildContext, inviteData = navTarget.inviteData, + callback = object : DeclineInviteAndBlockEntryPoint.Callback { + override fun onDeclineSuccess() = navigateUp() + }, ) NavTarget.Root -> rootNode(buildContext) } @@ -99,7 +102,7 @@ class JoinRoomFlowNode( acceptDeclineInviteView.Render( state = state.acceptDeclineInviteState, onAcceptInviteSuccess = {}, - onDeclineInviteSuccess = {}, + onDeclineInviteSuccess = { navigateUp() }, modifier = Modifier ) } From cf2ce2bd65fd9ea8231bda0cdc40d9d6aa3fe897 Mon Sep 17 00:00:00 2001 From: ganfra Date: Wed, 19 Aug 2026 13:00:27 +0200 Subject: [PATCH 134/145] Use Profiles sliding sync extension check for own profile subscription (#7403) * Use Profiles sliding sync extension check for own profile subscription --------- Co-authored-by: Jorge Martin Espinosa --- .../android/libraries/matrix/api/MatrixClient.kt | 3 +++ .../android/libraries/matrix/impl/RustMatrixClient.kt | 10 +++++++++- .../matrix/impl/fixtures/fakes/FakeFfiClient.kt | 3 +++ .../android/libraries/matrix/test/FakeMatrixClient.kt | 3 +++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt index 02ed16e097..3f98dcc509 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt @@ -245,6 +245,9 @@ interface MatrixClient : ClientUrlContentFetcher { /** Whether the homeserver advertises support for user status (MSC4426). */ suspend fun isUserStatusSupported(): Result + /** Whether the homeserver advertises support for the Profiles sliding sync extension (MSC4262). */ + suspend fun isProfilesSlidingSyncExtensionSupported(): Result + /** * Enable or disable automatically setting the user's status to "in a call" (m.call) while in a call. * diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt index 16371fcbf8..4be384d923 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt @@ -326,7 +326,9 @@ class RustMatrixClient( } private suspend fun setupUserProfile() { - val supported = isUserStatusSupported().getOrDefault(false) + // Subscribing to own profile updates only requires the Profiles sliding sync extension, + // not the full user status capability (which also needs the status profile field to be settable). + val supported = isProfilesSlidingSyncExtensionSupported().getOrDefault(false) if (supported) { // No need to seed the data here, it's already stored by the sdk. ownProfileTaskHandle = innerClient.subscribeToOwnProfile(ownProfileListener) @@ -536,6 +538,12 @@ class RustMatrixClient( } } + override suspend fun isProfilesSlidingSyncExtensionSupported(): Result = withContext(sessionDispatcher) { + runCatchingExceptions { + innerClient.isProfilesSlidingSyncExtensionSupported() + } + } + override fun enableAutomaticCallStatus(enabled: Boolean) { innerClient.enableAutomaticCallStatus(enabled) } diff --git a/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/fakes/FakeFfiClient.kt b/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/fakes/FakeFfiClient.kt index f09a350971..e91f8bdbed 100644 --- a/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/fakes/FakeFfiClient.kt +++ b/libraries/matrix/impl/src/test/kotlin/io/element/android/libraries/matrix/impl/fixtures/fakes/FakeFfiClient.kt @@ -61,6 +61,7 @@ class FakeFfiClient( private val accountDataResult: (String) -> String? = { lambdaError() }, private val setAccountDataResult: (String, String) -> Unit = { _, _ -> lambdaError() }, private val isUserStatusSupportedResult: () -> Boolean = { false }, + private val isProfilesSlidingSyncExtensionSupportedResult: () -> Boolean = { false }, private val subscribeToOwnProfileResult: (ProfileListener) -> Unit = {}, private val getUrlResult: (String) -> ByteArray = { lambdaError() }, private val closeResult: () -> Unit = {}, @@ -103,6 +104,8 @@ class FakeFfiClient( override suspend fun isUserStatusSupported(): Boolean = isUserStatusSupportedResult() + override suspend fun isProfilesSlidingSyncExtensionSupported(): Boolean = isProfilesSlidingSyncExtensionSupportedResult() + override fun subscribeToOwnProfile(listener: ProfileListener): TaskHandle { subscribeToOwnProfileResult(listener) return FakeFfiTaskHandle() diff --git a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeMatrixClient.kt b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeMatrixClient.kt index 6f330b6536..201f8cbf28 100644 --- a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeMatrixClient.kt +++ b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeMatrixClient.kt @@ -149,6 +149,7 @@ class FakeMatrixClient( var setUserStatusResult: Result = Result.success(Unit) var clearUserStatusResult: Result = Result.success(Unit) var isUserStatusSupportedResult: Result = Result.success(true) + var isProfilesSlidingSyncExtensionSupportedResult: Result = Result.success(true) private val _userProfile: MutableStateFlow = MutableStateFlow(MatrixUser(sessionId, userDisplayName, userAvatarUrl)) override val userProfile: StateFlow = _userProfile @@ -295,6 +296,8 @@ class FakeMatrixClient( override suspend fun isUserStatusSupported(): Result = isUserStatusSupportedResult + override suspend fun isProfilesSlidingSyncExtensionSupported(): Result = isProfilesSlidingSyncExtensionSupportedResult + override fun enableAutomaticCallStatus(enabled: Boolean) = enableAutomaticCallStatusLambda(enabled) override suspend fun joinRoom(roomId: RoomId): Result = joinRoomLambda(roomId) From 7341feeed8907c0787a763eaeb37a066985e6187 Mon Sep 17 00:00:00 2001 From: hayyaksi <193020925+hayaksi1@users.noreply.github.com> Date: Wed, 19 Aug 2026 14:44:11 +0300 Subject: [PATCH 135/145] Model the fake voice recorder on a cancellable recording job (#7466) * Model the fake voice recorder on a cancellable recording job FakeVoiceRecorder pushed a whole recording synchronously from a single suspending call, which made it both weaker and stricter than DefaultVoiceRecorder. Every level emission carried the same elapsed time and the emissions were coalesced by Molecule, so no intermediate recording state was observable and the level-limit test had to skip half the emissions to compensate. Each level now advances the test time source and suspends for its share of the recording duration, so the states arrive one at a time and that magic number is gone. Call verification moved to the constructor lambdas the rest of the repo uses, in place of hand-rolled counters and assertCalls. The counters discarded the argument, so nothing pinned that cancelling a recording stops it with cancelled = true; that is now asserted. Truth is no longer needed by the fixture module. A second startRecord() no longer raises an error where production only warns and returns, and stopping or deleting terminates an in-flight emission loop the way cancelling the real recording job does, so a stale recording state can no longer arrive after the recording has finished. * Keep each recording's level loop to its own recording The level loop checked a single isRecording flag, which cannot tell "this recording was cancelled" from "a later recording has started". After a cancel followed by a new start, the first loop resumed, saw the flag set again, and advanced the shared test time source, so the new recording reported the elapsed time of both. Each recording now carries an id and its loop stops as soon as that id is no longer the active one. --- ...efaultVoiceMessageComposerPresenterTest.kt | 100 +++++++++++++----- libraries/voicerecorder/test/build.gradle.kts | 1 - .../voicerecorder/test/FakeVoiceRecorder.kt | 78 ++++++-------- 3 files changed, 103 insertions(+), 76 deletions(-) diff --git a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/voicemessages/composer/DefaultVoiceMessageComposerPresenterTest.kt b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/voicemessages/composer/DefaultVoiceMessageComposerPresenterTest.kt index 7d3b6cf647..88d8ac38f1 100644 --- a/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/voicemessages/composer/DefaultVoiceMessageComposerPresenterTest.kt +++ b/features/messages/impl/src/test/kotlin/io/element/android/features/messages/impl/voicemessages/composer/DefaultVoiceMessageComposerPresenterTest.kt @@ -47,6 +47,7 @@ import io.element.android.libraries.voicerecorder.api.VoiceRecorder import io.element.android.libraries.voicerecorder.test.FakeVoiceRecorder import io.element.android.services.analytics.test.FakeAnalyticsService import io.element.android.tests.testutils.WarmUpRule +import io.element.android.tests.testutils.consumeItemsUntilTimeout import io.element.android.tests.testutils.lambda.any import io.element.android.tests.testutils.lambda.lambdaRecorder import io.element.android.tests.testutils.lambda.value @@ -60,6 +61,7 @@ import org.junit.Rule import org.junit.Test import java.io.File import kotlin.time.Duration +import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds @Suppress("LargeClass") @@ -67,8 +69,14 @@ class DefaultVoiceMessageComposerPresenterTest { @get:Rule val warmUpRule = WarmUpRule() + private val startRecordResult = lambdaRecorder { } + private val stopRecordResult = lambdaRecorder { } + private val deleteRecordingResult = lambdaRecorder { } private val voiceRecorder = FakeVoiceRecorder( - recordingDuration = RECORDING_DURATION + recordingDuration = RECORDING_DURATION, + startRecordResult = startRecordResult, + stopRecordResult = stopRecordResult, + deleteRecordingResult = deleteRecordingResult, ) private val analyticsService = FakeAnalyticsService() private val sendVoiceMessageResult = @@ -97,7 +105,9 @@ class DefaultVoiceMessageComposerPresenterTest { companion object { private val RECORDING_DURATION = 1.seconds + private val FIRST_LEVEL_DURATION = 500.milliseconds private val RECORDING_STATE = VoiceMessageState.Recording(RECORDING_DURATION, listOf(0.1f, 0.2f).toImmutableList()) + private val FIRST_RECORDING_STATE = VoiceMessageState.Recording(FIRST_LEVEL_DURATION, listOf(0.1f).toImmutableList()) } @Test @@ -106,7 +116,7 @@ class DefaultVoiceMessageComposerPresenterTest { presenter.test { val initialState = awaitItem() assertThat(initialState.voiceMessageState).isEqualTo(VoiceMessageState.Idle) - voiceRecorder.assertCalls(started = 0) + startRecordResult.assertions().isNeverCalled() testPauseAndDestroy(initialState) } @@ -118,9 +128,10 @@ class DefaultVoiceMessageComposerPresenterTest { presenter.test { awaitItem().eventSink(VoiceMessageComposerEvent.RecorderEvent(VoiceMessageRecorderEvent.Start)) + assertThat(awaitItem().voiceMessageState).isEqualTo(FIRST_RECORDING_STATE) val finalState = awaitItem() assertThat(finalState.voiceMessageState).isEqualTo(RECORDING_STATE) - voiceRecorder.assertCalls(started = 1) + startRecordResult.assertions().isCalledOnce() testPauseAndDestroy(finalState) } @@ -133,14 +144,16 @@ class DefaultVoiceMessageComposerPresenterTest { val voiceRecorder = FakeVoiceRecorder( levels = levels, recordingDuration = RECORDING_DURATION, + startRecordResult = { }, + stopRecordResult = { }, + deleteRecordingResult = { }, ) val presenter = createDefaultVoiceMessageComposerPresenter( voiceRecorder = voiceRecorder, ) presenter.test { awaitItem().eventSink(VoiceMessageComposerEvent.RecorderEvent(VoiceMessageRecorderEvent.Start)) - skipItems(numberOfLevels / 2 - 1) - val finalState = awaitItem() + val finalState = consumeItemsUntilTimeout().last() assertThat(finalState.voiceMessageState).isInstanceOf(VoiceMessageState.Recording::class.java) val recordingState = finalState.voiceMessageState as VoiceMessageState.Recording // The number of levels should be limited to 128 items @@ -221,7 +234,8 @@ class DefaultVoiceMessageComposerPresenterTest { val finalState = awaitItem() assertThat(finalState.voiceMessageState).isEqualTo(aPreviewState()) - voiceRecorder.assertCalls(started = 1, stopped = 1) + startRecordResult.assertions().isCalledOnce() + stopRecordResult.assertions().isCalledOnce().with(value(false)) cancelAndIgnoreRemainingEvents() } @@ -235,7 +249,9 @@ class DefaultVoiceMessageComposerPresenterTest { awaitItem().eventSink(VoiceMessageComposerEvent.RecorderEvent(VoiceMessageRecorderEvent.Cancel)) val finalState = awaitItem() assertThat(finalState.voiceMessageState).isEqualTo(VoiceMessageState.Idle) - voiceRecorder.assertCalls(started = 1, stopped = 1, deleted = 1) + startRecordResult.assertions().isCalledOnce() + stopRecordResult.assertions().isCalledOnce().with(value(true)) + deleteRecordingResult.assertions().isCalledOnce() testPauseAndDestroy(finalState) } } @@ -249,7 +265,9 @@ class DefaultVoiceMessageComposerPresenterTest { val finalState = awaitItem() assertThat(finalState.voiceMessageState).isEqualTo(aPreviewState()) - voiceRecorder.assertCalls(started = 1, stopped = 1, deleted = 0) + startRecordResult.assertions().isCalledOnce() + stopRecordResult.assertions().isCalledOnce().with(value(false)) + deleteRecordingResult.assertions().isNeverCalled() testPauseAndDestroy(finalState) } @@ -265,8 +283,10 @@ class DefaultVoiceMessageComposerPresenterTest { } // Nothing should happen - assertThat(finalState.voiceMessageState).isEqualTo(RECORDING_STATE) - voiceRecorder.assertCalls(started = 1, stopped = 0, deleted = 0) + assertThat(finalState.voiceMessageState).isEqualTo(FIRST_RECORDING_STATE) + startRecordResult.assertions().isCalledOnce() + stopRecordResult.assertions().isNeverCalled() + deleteRecordingResult.assertions().isNeverCalled() testPauseAndDestroy(finalState) } @@ -282,7 +302,9 @@ class DefaultVoiceMessageComposerPresenterTest { val finalState = awaitItem().also { assertThat(it.voiceMessageState).isEqualTo(aPlayingState()) } - voiceRecorder.assertCalls(started = 1, stopped = 1, deleted = 0) + startRecordResult.assertions().isCalledOnce() + stopRecordResult.assertions().isCalledOnce().with(value(false)) + deleteRecordingResult.assertions().isNeverCalled() testPauseAndDestroy(finalState) } @@ -299,7 +321,9 @@ class DefaultVoiceMessageComposerPresenterTest { val finalState = awaitItem().also { assertThat(it.voiceMessageState).isEqualTo(aPausedState()) } - voiceRecorder.assertCalls(started = 1, stopped = 1, deleted = 0) + startRecordResult.assertions().isCalledOnce() + stopRecordResult.assertions().isCalledOnce().with(value(false)) + deleteRecordingResult.assertions().isNeverCalled() testPauseAndDestroy(finalState) } @@ -340,7 +364,9 @@ class DefaultVoiceMessageComposerPresenterTest { val finalState = awaitItem() assertThat(finalState.voiceMessageState).isEqualTo(VoiceMessageState.Idle) - voiceRecorder.assertCalls(started = 1, stopped = 1, deleted = 1) + startRecordResult.assertions().isCalledOnce() + stopRecordResult.assertions().isCalledOnce().with(value(false)) + deleteRecordingResult.assertions().isCalledOnce() testPauseAndDestroy(finalState) } @@ -360,7 +386,9 @@ class DefaultVoiceMessageComposerPresenterTest { val finalState = awaitItem() assertThat(finalState.voiceMessageState).isEqualTo(VoiceMessageState.Idle) - voiceRecorder.assertCalls(started = 1, stopped = 1, deleted = 1) + startRecordResult.assertions().isCalledOnce() + stopRecordResult.assertions().isCalledOnce().with(value(false)) + deleteRecordingResult.assertions().isCalledOnce() testPauseAndDestroy(finalState) } @@ -377,7 +405,9 @@ class DefaultVoiceMessageComposerPresenterTest { val finalState = awaitItem() assertThat(finalState.voiceMessageState).isEqualTo(VoiceMessageState.Idle) sendVoiceMessageResult.assertions().isCalledOnce() - voiceRecorder.assertCalls(started = 1, stopped = 1, deleted = 1) + startRecordResult.assertions().isCalledOnce() + stopRecordResult.assertions().isCalledOnce().with(value(false)) + deleteRecordingResult.assertions().isCalledOnce() testPauseAndDestroy(finalState) } @@ -455,7 +485,9 @@ class DefaultVoiceMessageComposerPresenterTest { val finalState = awaitItem() assertThat(finalState.voiceMessageState).isEqualTo(VoiceMessageState.Idle) sendVoiceMessageResult.assertions().isCalledOnce() - voiceRecorder.assertCalls(started = 1, stopped = 1, deleted = 1) + startRecordResult.assertions().isCalledOnce() + stopRecordResult.assertions().isCalledOnce().with(value(false)) + deleteRecordingResult.assertions().isCalledOnce() testPauseAndDestroy(finalState) } @@ -476,7 +508,9 @@ class DefaultVoiceMessageComposerPresenterTest { val finalState = awaitItem() assertThat(finalState.voiceMessageState).isEqualTo(VoiceMessageState.Idle) sendVoiceMessageResult.assertions().isCalledOnce() - voiceRecorder.assertCalls(started = 1, stopped = 1, deleted = 1) + startRecordResult.assertions().isCalledOnce() + stopRecordResult.assertions().isCalledOnce().with(value(false)) + deleteRecordingResult.assertions().isCalledOnce() testPauseAndDestroy(finalState) } @@ -499,7 +533,9 @@ class DefaultVoiceMessageComposerPresenterTest { assertThat(finalState.voiceMessageState).isEqualTo(aPreviewState(isSending = true)) sendVoiceMessageResult.assertions().isNeverCalled() assertThat(analyticsService.trackedErrors).isEmpty() - voiceRecorder.assertCalls(started = 1, stopped = 1, deleted = 0) + startRecordResult.assertions().isCalledOnce() + stopRecordResult.assertions().isCalledOnce().with(value(false)) + deleteRecordingResult.assertions().isNeverCalled() testPauseAndDestroy(finalState) } @@ -527,7 +563,9 @@ class DefaultVoiceMessageComposerPresenterTest { val finalState = awaitItem() assertThat(finalState.voiceMessageState).isEqualTo(VoiceMessageState.Idle) sendVoiceMessageResult.assertions().isCalledOnce() - voiceRecorder.assertCalls(started = 1, stopped = 1, deleted = 1) + startRecordResult.assertions().isCalledOnce() + stopRecordResult.assertions().isCalledOnce().with(value(false)) + deleteRecordingResult.assertions().isCalledOnce() testPauseAndDestroy(finalState) } @@ -577,7 +615,7 @@ class DefaultVoiceMessageComposerPresenterTest { assertThat(initialState.voiceMessageState).isEqualTo(VoiceMessageState.Idle) sendVoiceMessageResult.assertions().isNeverCalled() assertThat(analyticsService.trackedErrors).hasSize(1) - voiceRecorder.assertCalls(started = 0) + startRecordResult.assertions().isNeverCalled() testPauseAndDestroy(initialState) } @@ -586,8 +624,14 @@ class DefaultVoiceMessageComposerPresenterTest { @Test fun `present - record error - security exceptions are tracked`() = runTest { val exception = SecurityException("") - voiceRecorder.givenThrowsSecurityException(exception) - val presenter = createDefaultVoiceMessageComposerPresenter() + val startRecordResult = lambdaRecorder { throw exception } + val voiceRecorder = FakeVoiceRecorder( + recordingDuration = RECORDING_DURATION, + startRecordResult = startRecordResult, + ) + val presenter = createDefaultVoiceMessageComposerPresenter( + voiceRecorder = voiceRecorder, + ) presenter.test { val initialState = awaitItem() initialState.eventSink(VoiceMessageComposerEvent.RecorderEvent(VoiceMessageRecorderEvent.Start)) @@ -596,7 +640,7 @@ class DefaultVoiceMessageComposerPresenterTest { assertThat(analyticsService.trackedErrors).containsExactly( VoiceMessageException.PermissionMissing(message = "Expected permission to record but none", cause = exception) ) - voiceRecorder.assertCalls(started = 1) + startRecordResult.assertions().isCalledOnce() testPauseAndDestroy(initialState) } @@ -616,7 +660,8 @@ class DefaultVoiceMessageComposerPresenterTest { assertThat(awaitItem().voiceMessageState).isEqualTo(VoiceMessageState.Idle) initialState.eventSink(VoiceMessageComposerEvent.RecorderEvent(VoiceMessageRecorderEvent.Stop)) - voiceRecorder.assertCalls(stopped = 1) + startRecordResult.assertions().isNeverCalled() + stopRecordResult.assertions().isCalledOnce().with(value(false)) permissionsPresenter.setPermissionGranted() @@ -625,7 +670,8 @@ class DefaultVoiceMessageComposerPresenterTest { val finalState = expectMostRecentItem() assertThat(finalState.voiceMessageState).isEqualTo(RECORDING_STATE) - voiceRecorder.assertCalls(stopped = 1, started = 1) + startRecordResult.assertions().isCalledOnce() + stopRecordResult.assertions().isCalledOnce().with(value(false)) testPauseAndDestroy(finalState) } @@ -659,7 +705,7 @@ class DefaultVoiceMessageComposerPresenterTest { val finalState = expectMostRecentItem() assertThat(finalState.voiceMessageState).isEqualTo(RECORDING_STATE) - voiceRecorder.assertCalls(started = 1) + startRecordResult.assertions().isCalledOnce() testPauseAndDestroy(finalState) } @@ -696,7 +742,7 @@ class DefaultVoiceMessageComposerPresenterTest { assertThat(it.voiceMessageState).isEqualTo(VoiceMessageState.Idle) assertThat(it.showPermissionRationaleDialog).isTrue() } - voiceRecorder.assertCalls(started = 0) + startRecordResult.assertions().isNeverCalled() cancelAndIgnoreRemainingEvents() testPauseAndDestroy(finalState) diff --git a/libraries/voicerecorder/test/build.gradle.kts b/libraries/voicerecorder/test/build.gradle.kts index c0f74b71e8..f54ef0e8d3 100644 --- a/libraries/voicerecorder/test/build.gradle.kts +++ b/libraries/voicerecorder/test/build.gradle.kts @@ -19,6 +19,5 @@ dependencies { implementation(projects.tests.testutils) implementation(libs.coroutines.test) - implementation(libs.test.truth) implementation(projects.libraries.core) } diff --git a/libraries/voicerecorder/test/src/main/kotlin/io/element/android/libraries/voicerecorder/test/FakeVoiceRecorder.kt b/libraries/voicerecorder/test/src/main/kotlin/io/element/android/libraries/voicerecorder/test/FakeVoiceRecorder.kt index ec62227857..b735bb9fa5 100644 --- a/libraries/voicerecorder/test/src/main/kotlin/io/element/android/libraries/voicerecorder/test/FakeVoiceRecorder.kt +++ b/libraries/voicerecorder/test/src/main/kotlin/io/element/android/libraries/voicerecorder/test/FakeVoiceRecorder.kt @@ -8,13 +8,13 @@ package io.element.android.libraries.voicerecorder.test -import com.google.common.truth.Truth.assertThat import io.element.android.libraries.core.mimetype.MimeTypes import io.element.android.libraries.voicerecorder.api.VoiceRecorder import io.element.android.libraries.voicerecorder.api.VoiceRecorderState +import io.element.android.tests.testutils.lambda.lambdaError +import kotlinx.coroutines.delay import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow -import kotlinx.coroutines.yield import java.io.File import kotlin.time.Duration import kotlin.time.Duration.Companion.seconds @@ -23,51 +23,47 @@ import kotlin.time.TestTimeSource class FakeVoiceRecorder( private val timeSource: TestTimeSource = TestTimeSource(), private val recordingDuration: Duration = 0.seconds, - private val levels: List = listOf(0.1f, 0.2f) + private val levels: List = listOf(0.1f, 0.2f), + val waveform: List = A_WAVEFORM, + private val startRecordResult: () -> Unit = { lambdaError() }, + private val stopRecordResult: (Boolean) -> Unit = { lambdaError() }, + private val deleteRecordingResult: () -> Unit = { lambdaError() }, ) : VoiceRecorder { private val _state = MutableStateFlow(VoiceRecorderState.Idle) override val state: StateFlow = _state - private var curRecording: File? = null + private val levelInterval = if (levels.isEmpty()) Duration.ZERO else recordingDuration / levels.size - private var securityException: SecurityException? = null + private var currentRecording: File? = null + private var lastRecordingId = 0 + private var activeRecordingId = 0 - private var startedCount = 0 - private var stoppedCount = 0 - private var deletedCount = 0 - - var waveform: List = listOf(0f, 1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f, 8f, 7f, 6f, 5f, 4f, 3f, 2f, 1f, 0f) override suspend fun startRecord() { - startedCount += 1 + startRecordResult() + if (activeRecordingId != 0) return + val recordingId = ++lastRecordingId + activeRecordingId = recordingId + currentRecording = File("file.ogg") val startedAt = timeSource.markNow() - securityException?.let { throw it } - - if (curRecording != null) { - error("Previous recording was not cleared") - } - curRecording = File("file.ogg") - - timeSource += recordingDuration for (i in 1..levels.size) { + delay(levelInterval) + if (activeRecordingId != recordingId) return + timeSource += levelInterval _state.emit(VoiceRecorderState.Recording(startedAt.elapsedNow(), levels.take(i))) - yield() } } - override suspend fun stopRecord( - cancelled: Boolean - ) { - stoppedCount++ - + override suspend fun stopRecord(cancelled: Boolean) { + stopRecordResult(cancelled) + activeRecordingId = 0 if (cancelled) { deleteRecording() } - _state.emit( - when (curRecording) { + when (val file = currentRecording) { null -> VoiceRecorderState.Idle else -> VoiceRecorderState.Finished( - file = curRecording!!, + file = file, mimeType = MimeTypes.Ogg, duration = recordingDuration, waveform = waveform, @@ -77,25 +73,11 @@ class FakeVoiceRecorder( } override suspend fun deleteRecording() { - deletedCount++ - curRecording = null - - _state.emit( - VoiceRecorderState.Idle - ) - } - - fun assertCalls( - started: Int = 0, - stopped: Int = 0, - deleted: Int = 0, - ) { - assertThat(startedCount).isEqualTo(started) - assertThat(stoppedCount).isEqualTo(stopped) - assertThat(deletedCount).isEqualTo(deleted) - } - - fun givenThrowsSecurityException(exception: SecurityException) { - this.securityException = exception + deleteRecordingResult() + activeRecordingId = 0 + currentRecording = null + _state.emit(VoiceRecorderState.Idle) } } + +private val A_WAVEFORM = listOf(0f, 1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f, 8f, 7f, 6f, 5f, 4f, 3f, 2f, 1f, 0f) From 7adbd3941aa4371ffc08e8309bdd12f27f0cc86f Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 19 Aug 2026 14:20:31 +0200 Subject: [PATCH 136/145] Make the PUSHER_APP_ID configurable at build time. --- .../element/android/appconfig/PushConfig.kt | 16 ---------- libraries/push/impl/build.gradle.kts | 29 +++++++++++++++++++ .../push/impl/DefaultPusherSubscriber.kt | 5 ++-- .../libraries/push/impl/test/TestPush.kt | 4 +-- .../push/impl/DefaultPusherSubscriberTest.kt | 5 ++-- .../push/impl/test/DefaultTestPushTest.kt | 4 +-- .../src/main/kotlin/config/BuildTimeConfig.kt | 3 ++ 7 files changed, 40 insertions(+), 26 deletions(-) delete mode 100644 appconfig/src/main/kotlin/io/element/android/appconfig/PushConfig.kt diff --git a/appconfig/src/main/kotlin/io/element/android/appconfig/PushConfig.kt b/appconfig/src/main/kotlin/io/element/android/appconfig/PushConfig.kt deleted file mode 100644 index d36fb742b0..0000000000 --- a/appconfig/src/main/kotlin/io/element/android/appconfig/PushConfig.kt +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2025 Element Creations Ltd. - * Copyright 2023-2025 New Vector Ltd. - * - * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. - * Please see LICENSE files in the repository root for full details. - */ - -package io.element.android.appconfig - -object PushConfig { - /** - * Note: pusher_app_id cannot exceed 64 chars. - */ - const val PUSHER_APP_ID: String = "im.vector.app.android" -} diff --git a/libraries/push/impl/build.gradle.kts b/libraries/push/impl/build.gradle.kts index b9082c50f6..8615485bba 100644 --- a/libraries/push/impl/build.gradle.kts +++ b/libraries/push/impl/build.gradle.kts @@ -1,3 +1,5 @@ +import config.BuildTimeConfig +import extension.buildConfigFieldStr import extension.setupDependencyInjection import extension.testCommonDependencies @@ -17,6 +19,33 @@ plugins { android { namespace = "io.element.android.libraries.push.impl" + buildFeatures { + buildConfig = true + } + + buildTypes { + val defaultPusherAppId = "im.vector.app.android" + getByName("release") { + buildConfigFieldStr( + name = "PUSHER_APP_ID", + value = BuildTimeConfig.PUSHER_APP_ID_RELEASE ?: defaultPusherAppId, + ) + } + getByName("debug") { + buildConfigFieldStr( + name = "PUSHER_APP_ID", + value = BuildTimeConfig.PUSHER_APP_ID_DEBUG ?: defaultPusherAppId, + ) + } + register("nightly") { + matchingFallbacks += listOf("release") + buildConfigFieldStr( + name = "PUSHER_APP_ID", + value = BuildTimeConfig.PUSHER_APP_ID_NIGHTLY ?: defaultPusherAppId, + ) + } + } + testOptions { unitTests { isIncludeAndroidResources = true diff --git a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/DefaultPusherSubscriber.kt b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/DefaultPusherSubscriber.kt index 35482aa164..7aa519a791 100644 --- a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/DefaultPusherSubscriber.kt +++ b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/DefaultPusherSubscriber.kt @@ -10,7 +10,6 @@ package io.element.android.libraries.push.impl import dev.zacsweers.metro.AppScope import dev.zacsweers.metro.ContributesBinding -import io.element.android.appconfig.PushConfig import io.element.android.libraries.core.extensions.mapFailure import io.element.android.libraries.core.log.logger.LoggerTag import io.element.android.libraries.core.meta.BuildMeta @@ -74,7 +73,7 @@ class DefaultPusherSubscriber( ): SetHttpPusherData = SetHttpPusherData( pushKey = pushKey, - appId = PushConfig.PUSHER_APP_ID, + appId = BuildConfig.PUSHER_APP_ID, // TODO + abs(activeSessionHolder.getActiveSession().myUserId.hashCode()) profileTag = DEFAULT_PUSHER_FILE_TAG + "_", // TODO localeProvider.current().language @@ -104,7 +103,7 @@ class DefaultPusherSubscriber( .unsetHttpPusher( unsetHttpPusherData = UnsetHttpPusherData( pushKey = pushKey, - appId = PushConfig.PUSHER_APP_ID + appId = BuildConfig.PUSHER_APP_ID ) ) .onSuccess { diff --git a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/test/TestPush.kt b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/test/TestPush.kt index 4ed8ca8338..6921c050db 100644 --- a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/test/TestPush.kt +++ b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/test/TestPush.kt @@ -10,9 +10,9 @@ package io.element.android.libraries.push.impl.test import dev.zacsweers.metro.AppScope import dev.zacsweers.metro.ContributesBinding -import io.element.android.appconfig.PushConfig import io.element.android.libraries.matrix.api.core.EventId import io.element.android.libraries.matrix.api.core.RoomId +import io.element.android.libraries.push.impl.BuildConfig import io.element.android.libraries.push.impl.pushgateway.PushGatewayNotifyRequest import io.element.android.libraries.pushproviders.api.Config @@ -28,7 +28,7 @@ class DefaultTestPush( pushGatewayNotifyRequest.execute( PushGatewayNotifyRequest.Params( url = config.url, - appId = PushConfig.PUSHER_APP_ID, + appId = BuildConfig.PUSHER_APP_ID, pushKey = config.pushKey, eventId = TEST_EVENT_ID, roomId = TEST_ROOM_ID, diff --git a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/DefaultPusherSubscriberTest.kt b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/DefaultPusherSubscriberTest.kt index 8cb1e2a7f6..76479720be 100644 --- a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/DefaultPusherSubscriberTest.kt +++ b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/DefaultPusherSubscriberTest.kt @@ -9,7 +9,6 @@ package io.element.android.libraries.push.impl import com.google.common.truth.Truth.assertThat -import io.element.android.appconfig.PushConfig import io.element.android.libraries.core.meta.BuildMeta import io.element.android.libraries.matrix.api.pusher.SetHttpPusherData import io.element.android.libraries.matrix.api.pusher.UnsetHttpPusherData @@ -96,7 +95,7 @@ class DefaultPusherSubscriberTest { value( SetHttpPusherData( pushKey = "aPushKey", - appId = PushConfig.PUSHER_APP_ID, + appId = BuildConfig.PUSHER_APP_ID, url = "aGateway", appDisplayName = "MyApp", deviceDisplayName = "MyDevice", @@ -163,7 +162,7 @@ class DefaultPusherSubscriberTest { value( UnsetHttpPusherData( pushKey = "aPushKey", - appId = PushConfig.PUSHER_APP_ID, + appId = BuildConfig.PUSHER_APP_ID, ), ) ) diff --git a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/test/DefaultTestPushTest.kt b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/test/DefaultTestPushTest.kt index 9ab0f16b62..3722c09d99 100644 --- a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/test/DefaultTestPushTest.kt +++ b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/test/DefaultTestPushTest.kt @@ -8,7 +8,7 @@ package io.element.android.libraries.push.impl.test -import io.element.android.appconfig.PushConfig +import io.element.android.libraries.push.impl.BuildConfig import io.element.android.libraries.push.impl.pushgateway.PushGatewayNotifyRequest import io.element.android.libraries.pushproviders.test.aSessionPushConfig import io.element.android.tests.testutils.lambda.lambdaRecorder @@ -33,7 +33,7 @@ class DefaultTestPushTest { value( PushGatewayNotifyRequest.Params( url = aConfig.url, - appId = PushConfig.PUSHER_APP_ID, + appId = BuildConfig.PUSHER_APP_ID, pushKey = aConfig.pushKey, eventId = DefaultTestPush.TEST_EVENT_ID, roomId = DefaultTestPush.TEST_ROOM_ID, diff --git a/plugins/src/main/kotlin/config/BuildTimeConfig.kt b/plugins/src/main/kotlin/config/BuildTimeConfig.kt index e31ffea658..4160efeb78 100644 --- a/plugins/src/main/kotlin/config/BuildTimeConfig.kt +++ b/plugins/src/main/kotlin/config/BuildTimeConfig.kt @@ -31,4 +31,7 @@ object BuildTimeConfig { val BUG_REPORT_APP_NAME: String? = null const val PUSH_CONFIG_INCLUDE_FIREBASE: Boolean = true const val PUSH_CONFIG_INCLUDE_UNIFIED_PUSH: Boolean = true + val PUSHER_APP_ID_RELEASE: String? = null + val PUSHER_APP_ID_DEBUG: String? = null + val PUSHER_APP_ID_NIGHTLY: String? = null } From a70cd18563ec2d25289a6f28d10ce5b8eb6e7615 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 19 Aug 2026 12:21:52 +0000 Subject: [PATCH 137/145] Update dependency org.matrix.rustcomponents:sdk-android to v26.08.19 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a5ebc5b4e7..6686b7bd06 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -185,7 +185,7 @@ test_detekt_test = { module = "io.gitlab.arturbosch.detekt:detekt-test", version # https://github.com/matrix-org/matrix-rust-components-kotlin/commits/main/sdk/sdk-android/src/main/kotlin/org/matrix/rustcomponents/sdk/matrix_sdk_ffi.kt # All new features should not be implemented in the pull request that upgrades the version, developers should # only fix API breaks and may add some TODOs. -matrix_sdk = "org.matrix.rustcomponents:sdk-android:26.08.17" +matrix_sdk = "org.matrix.rustcomponents:sdk-android:26.08.19" # Others coil = { module = "io.coil-kt.coil3:coil", version.ref = "coil" } From f2114d94f104f414604a7cba95df39554745f30c Mon Sep 17 00:00:00 2001 From: ElementBot Date: Wed, 19 Aug 2026 14:05:29 +0000 Subject: [PATCH 138/145] Update screenshots --- ...impl.accountprovider_AccountProviderOtherView_Day_0_en.png | 3 --- ...pl.accountprovider_AccountProviderOtherView_Night_0_en.png | 3 --- ...angeaccountprovider_ChangeAccountProviderView_Day_0_en.png | 3 --- ...angeaccountprovider_ChangeAccountProviderView_Day_1_en.png | 3 --- ...geaccountprovider_ChangeAccountProviderView_Night_0_en.png | 3 --- ...geaccountprovider_ChangeAccountProviderView_Night_1_en.png | 3 --- ...irmaccountprovider_ConfirmAccountProviderView_Day_0_en.png | 4 ++-- ...irmaccountprovider_ConfirmAccountProviderView_Day_1_en.png | 4 ++-- ...irmaccountprovider_ConfirmAccountProviderView_Day_2_en.png | 4 ++-- ...irmaccountprovider_ConfirmAccountProviderView_Day_3_en.png | 3 +++ ...maccountprovider_ConfirmAccountProviderView_Night_0_en.png | 4 ++-- ...maccountprovider_ConfirmAccountProviderView_Night_1_en.png | 4 ++-- ...maccountprovider_ConfirmAccountProviderView_Night_2_en.png | 4 ++-- ...maccountprovider_ConfirmAccountProviderView_Night_3_en.png | 3 +++ ....impl.screens.createaccount_CreateAccountView_Day_0_en.png | 3 --- ....impl.screens.createaccount_CreateAccountView_Day_1_en.png | 3 --- ....impl.screens.createaccount_CreateAccountView_Day_2_en.png | 3 --- ....impl.screens.createaccount_CreateAccountView_Day_3_en.png | 3 --- ...mpl.screens.createaccount_CreateAccountView_Night_0_en.png | 3 --- ...mpl.screens.createaccount_CreateAccountView_Night_1_en.png | 3 --- ...mpl.screens.createaccount_CreateAccountView_Night_2_en.png | 3 --- ...mpl.screens.createaccount_CreateAccountView_Night_3_en.png | 3 --- ...archaccountprovider_SearchAccountProviderView_Day_0_en.png | 3 --- ...archaccountprovider_SearchAccountProviderView_Day_1_en.png | 3 --- ...chaccountprovider_SearchAccountProviderView_Night_0_en.png | 3 --- ...chaccountprovider_SearchAccountProviderView_Night_1_en.png | 3 --- 26 files changed, 18 insertions(+), 66 deletions(-) delete mode 100644 tests/uitests/src/test/snapshots/images/features.login.impl.accountprovider_AccountProviderOtherView_Day_0_en.png delete mode 100644 tests/uitests/src/test/snapshots/images/features.login.impl.accountprovider_AccountProviderOtherView_Night_0_en.png delete mode 100644 tests/uitests/src/test/snapshots/images/features.login.impl.screens.changeaccountprovider_ChangeAccountProviderView_Day_0_en.png delete mode 100644 tests/uitests/src/test/snapshots/images/features.login.impl.screens.changeaccountprovider_ChangeAccountProviderView_Day_1_en.png delete mode 100644 tests/uitests/src/test/snapshots/images/features.login.impl.screens.changeaccountprovider_ChangeAccountProviderView_Night_0_en.png delete mode 100644 tests/uitests/src/test/snapshots/images/features.login.impl.screens.changeaccountprovider_ChangeAccountProviderView_Night_1_en.png create mode 100644 tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Day_3_en.png create mode 100644 tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Night_3_en.png delete mode 100644 tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Day_0_en.png delete mode 100644 tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Day_1_en.png delete mode 100644 tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Day_2_en.png delete mode 100644 tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Day_3_en.png delete mode 100644 tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Night_0_en.png delete mode 100644 tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Night_1_en.png delete mode 100644 tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Night_2_en.png delete mode 100644 tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Night_3_en.png delete mode 100644 tests/uitests/src/test/snapshots/images/features.login.impl.screens.searchaccountprovider_SearchAccountProviderView_Day_0_en.png delete mode 100644 tests/uitests/src/test/snapshots/images/features.login.impl.screens.searchaccountprovider_SearchAccountProviderView_Day_1_en.png delete mode 100644 tests/uitests/src/test/snapshots/images/features.login.impl.screens.searchaccountprovider_SearchAccountProviderView_Night_0_en.png delete mode 100644 tests/uitests/src/test/snapshots/images/features.login.impl.screens.searchaccountprovider_SearchAccountProviderView_Night_1_en.png diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.accountprovider_AccountProviderOtherView_Day_0_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.accountprovider_AccountProviderOtherView_Day_0_en.png deleted file mode 100644 index c9bf9e3c1c..0000000000 --- a/tests/uitests/src/test/snapshots/images/features.login.impl.accountprovider_AccountProviderOtherView_Day_0_en.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0990301d92d4862054ba5e54103dac359df37997242498766854d7bb13431657 -size 6068 diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.accountprovider_AccountProviderOtherView_Night_0_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.accountprovider_AccountProviderOtherView_Night_0_en.png deleted file mode 100644 index fb829c4873..0000000000 --- a/tests/uitests/src/test/snapshots/images/features.login.impl.accountprovider_AccountProviderOtherView_Night_0_en.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3022b2b813d9a3f77b0ba72706f0fb870a1c3f7b4a8efc90e611b66b6e9bdf8e -size 5926 diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.changeaccountprovider_ChangeAccountProviderView_Day_0_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.changeaccountprovider_ChangeAccountProviderView_Day_0_en.png deleted file mode 100644 index 23858ce575..0000000000 --- a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.changeaccountprovider_ChangeAccountProviderView_Day_0_en.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c7544e2566517e8692a1cccd4607bc2ab0f2767bbe9e5b39eb439d7695ad2ce5 -size 46905 diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.changeaccountprovider_ChangeAccountProviderView_Day_1_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.changeaccountprovider_ChangeAccountProviderView_Day_1_en.png deleted file mode 100644 index 9b505f3cf9..0000000000 --- a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.changeaccountprovider_ChangeAccountProviderView_Day_1_en.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b5dbf45467305e83f302fd626a2c0adcd27eac6aeea8b7a83efdb6e728d974da -size 44703 diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.changeaccountprovider_ChangeAccountProviderView_Night_0_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.changeaccountprovider_ChangeAccountProviderView_Night_0_en.png deleted file mode 100644 index 815986cbc3..0000000000 --- a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.changeaccountprovider_ChangeAccountProviderView_Night_0_en.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:41907de78c86fca804af2af7dd351db6a1ab87515e71bb906ffa2219ad4f5879 -size 45880 diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.changeaccountprovider_ChangeAccountProviderView_Night_1_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.changeaccountprovider_ChangeAccountProviderView_Night_1_en.png deleted file mode 100644 index f08662715a..0000000000 --- a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.changeaccountprovider_ChangeAccountProviderView_Night_1_en.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:62581b532695d10a42432dfcb37249c28c2bd617ecb49d7f3a8224855b78ae55 -size 43600 diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Day_0_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Day_0_en.png index 721b1f8389..caa1dc1cbb 100644 --- a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Day_0_en.png +++ b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Day_0_en.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9fb394bf8c063e5b4457fc75c171849b1ae7f435941e0d86d09298a846595861 -size 35160 +oid sha256:da11677aad93fcf9461c62a0fb9a1f384950dc69f0666914da5785265d56a4dd +size 35877 diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Day_1_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Day_1_en.png index 3d04fae696..cb6f870735 100644 --- a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Day_1_en.png +++ b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Day_1_en.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4626f30754044cee4438c44f8972f1b643342aea9c7b38f3650874da8c7e7614 -size 37303 +oid sha256:99d28d3547d50e9ae23b012521ef5f8a157aa4b3a8a98b3e138847652f8cacff +size 35761 diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Day_2_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Day_2_en.png index c0d9a71d1d..d9eaefae3c 100644 --- a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Day_2_en.png +++ b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Day_2_en.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ccaed5beab96b32c7ba783136d1fe8483697de44d0ed7c7555cbef9dd3708e66 -size 38953 +oid sha256:84954d900742e981811f1471fbe175f57c927ffc4da9e801d5e5b48f073dc13a +size 39610 diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Day_3_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Day_3_en.png new file mode 100644 index 0000000000..aa987474a3 --- /dev/null +++ b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Day_3_en.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a524b0538ad4204ea66c46c139035671f55d874c45d46476fb885c15879b93f2 +size 31806 diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Night_0_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Night_0_en.png index 0127885711..0b0b5f123c 100644 --- a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Night_0_en.png +++ b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Night_0_en.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5ae87930bb1123d432f7f4e2792ad1e372ec383f968ad335b4f2f069b8faa307 -size 34294 +oid sha256:bb5607ed2e0986d5035120a2e6276ff33e65a7bafa5325a0c0c22f1975b69c2b +size 34986 diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Night_1_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Night_1_en.png index b15dcf0142..4da08d87a3 100644 --- a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Night_1_en.png +++ b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Night_1_en.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:787b3708bfc0bebd19cde31589e175ee0ea593c4bd1461b9593e9705947e6ffc -size 36280 +oid sha256:80c7e798346755382f913f72da9b18fc200867280e6f33adde3622a964f7d2d7 +size 34883 diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Night_2_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Night_2_en.png index b9046df90d..3d6c836738 100644 --- a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Night_2_en.png +++ b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Night_2_en.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e8d1a1013e5eaed74889193e4c6551ae5afa96a1d10fa3d32de3dc96a0c1ae13 -size 36582 +oid sha256:cbe35c9bb9ec509b64a2ce27afa879b8904269ae8f9afbd5ac8a91098d7fccb3 +size 38777 diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Night_3_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Night_3_en.png new file mode 100644 index 0000000000..bada75332c --- /dev/null +++ b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.confirmaccountprovider_ConfirmAccountProviderView_Night_3_en.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:efa31bac320466c41fbf33b462418716c1f4fb6def584b38834320d213d2c819 +size 29777 diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Day_0_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Day_0_en.png deleted file mode 100644 index 34cf030cba..0000000000 --- a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Day_0_en.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:09bf68ea40f2b1c109b015b8e9e9c767931ef70936a956652ac649b8e5a2561e -size 13491 diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Day_1_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Day_1_en.png deleted file mode 100644 index 67186daea6..0000000000 --- a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Day_1_en.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:323218a1ce6e4afaf4632fed871cbc6e17ed6686243523aeb9da0d81a7825d31 -size 13602 diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Day_2_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Day_2_en.png deleted file mode 100644 index c0cc08611c..0000000000 --- a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Day_2_en.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:193e7af1adc71d5e1133694e234671ebb6fefe3766c9891733c3ae46a999b1cd -size 13655 diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Day_3_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Day_3_en.png deleted file mode 100644 index 26e32e2174..0000000000 --- a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Day_3_en.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cb76a05a00c3e41c7edaa853db6d3773fddfb23c750eea4f45d4f4b1acfe5447 -size 15466 diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Night_0_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Night_0_en.png deleted file mode 100644 index da53968272..0000000000 --- a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Night_0_en.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3a153cb8df9aadaa9cee0fef7f140e43f33851f18815674edc9a9682a7c601d2 -size 12942 diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Night_1_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Night_1_en.png deleted file mode 100644 index 5df3ef308b..0000000000 --- a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Night_1_en.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cba9108df3dae3f9968825e13528087fdf5d8b70c03faabbf0b06e276392a7d7 -size 13048 diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Night_2_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Night_2_en.png deleted file mode 100644 index 91a5e6418a..0000000000 --- a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Night_2_en.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:79cd361b36c8be418871a8cf6773bcc8f3626fc8d09012340f6d245ea6b0574e -size 12967 diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Night_3_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Night_3_en.png deleted file mode 100644 index c6b38f80b0..0000000000 --- a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.createaccount_CreateAccountView_Night_3_en.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9063e4d7b900c397dacd964c25ce42865e292ea2a5a41f37cb7dfabd86f9246f -size 14142 diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.searchaccountprovider_SearchAccountProviderView_Day_0_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.searchaccountprovider_SearchAccountProviderView_Day_0_en.png deleted file mode 100644 index 86e3a6a0c1..0000000000 --- a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.searchaccountprovider_SearchAccountProviderView_Day_0_en.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:64ca7f84a90416cac5161e379079edb3edadf1f82240214974a3216cd5d41090 -size 23418 diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.searchaccountprovider_SearchAccountProviderView_Day_1_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.searchaccountprovider_SearchAccountProviderView_Day_1_en.png deleted file mode 100644 index 583a7beb59..0000000000 --- a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.searchaccountprovider_SearchAccountProviderView_Day_1_en.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:bd5189b1079f9011162ff7ba2c9211fbfff543db892b86ea3b57ec78495d2019 -size 50344 diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.searchaccountprovider_SearchAccountProviderView_Night_0_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.searchaccountprovider_SearchAccountProviderView_Night_0_en.png deleted file mode 100644 index fd9fce9c5c..0000000000 --- a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.searchaccountprovider_SearchAccountProviderView_Night_0_en.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5122ee1af4ff4ddc5e4c766f992e9833e4c1329bc634e82b0e52743326328447 -size 22757 diff --git a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.searchaccountprovider_SearchAccountProviderView_Night_1_en.png b/tests/uitests/src/test/snapshots/images/features.login.impl.screens.searchaccountprovider_SearchAccountProviderView_Night_1_en.png deleted file mode 100644 index 1be9bd5d99..0000000000 --- a/tests/uitests/src/test/snapshots/images/features.login.impl.screens.searchaccountprovider_SearchAccountProviderView_Night_1_en.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:96742102f57f2e58027e3402ea01c91ee1eab6010dc46ef8ff8ee3175264a628 -size 49259 From 2432b0ccc6d832f85d0c69876cabf1ef34c09edf Mon Sep 17 00:00:00 2001 From: hayyaksi <193020925+hayaksi1@users.noreply.github.com> Date: Thu, 20 Aug 2026 09:55:03 +0300 Subject: [PATCH 139/145] Keep playing a voice message when another app plays a short sound (#7454) * Request media audio focus when playing a voice message Voice message playback asked for audio focus with USAGE_VOICE_COMMUNICATION, the same bucket as Element Call and voice message recording, while the player itself renders on the media stream. Audio policy layers act on the declared usage, so a car head unit switches to its call audio context and routes the playback away while the player keeps running. Declare USAGE_MEDIA (and STREAM_MUSIC on the legacy path) for playback, which is what the player actually renders. Recording and Element Call keep asking for voice communication focus. * Keep playing a voice message through a short sound from another app A notification, a navigation prompt or any other app taking focus for a moment sends AUDIOFOCUS_LOSS_TRANSIENT or AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK, and DefaultMediaPlayer pauses on it. The voice message stops part way through and the user has to find it again and restart it. Recording already ignores those two, because the capture path is not affected by focus. Give voice message playback the same treatment, moving the requester test into a named function rather than growing the inline condition. A permanent AUDIOFOCUS_LOSS, a real phone call, still pauses, and the media viewer is untouched. --- libraries/audio/impl/build.gradle.kts | 3 + .../libraries/audio/impl/DefaultAudioFocus.kt | 19 +++-- .../audio/impl/DefaultAudioFocusTest.kt | 80 +++++++++++++++++++ 3 files changed, 97 insertions(+), 5 deletions(-) create mode 100644 libraries/audio/impl/src/test/kotlin/io/element/android/libraries/audio/impl/DefaultAudioFocusTest.kt diff --git a/libraries/audio/impl/build.gradle.kts b/libraries/audio/impl/build.gradle.kts index 419e81962c..c0db3c4f86 100644 --- a/libraries/audio/impl/build.gradle.kts +++ b/libraries/audio/impl/build.gradle.kts @@ -1,4 +1,5 @@ import extension.setupDependencyInjection +import extension.testCommonDependencies /* * Copyright (c) 2025 Element Creations Ltd. @@ -22,4 +23,6 @@ dependencies { implementation(libs.androidx.corektx) implementation(projects.libraries.di) + + testCommonDependencies(libs) } diff --git a/libraries/audio/impl/src/main/kotlin/io/element/android/libraries/audio/impl/DefaultAudioFocus.kt b/libraries/audio/impl/src/main/kotlin/io/element/android/libraries/audio/impl/DefaultAudioFocus.kt index bc6a42d2f9..a9bc6fdbfd 100644 --- a/libraries/audio/impl/src/main/kotlin/io/element/android/libraries/audio/impl/DefaultAudioFocus.kt +++ b/libraries/audio/impl/src/main/kotlin/io/element/android/libraries/audio/impl/DefaultAudioFocus.kt @@ -48,9 +48,8 @@ class DefaultAudioFocus( } AudioManager.AUDIOFOCUS_LOSS_TRANSIENT, AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK -> { - // For recording, ignore transient focus losses (e.g., notification sounds). - // The AudioRecord API keeps capturing regardless. - if (requester != AudioFocusRequester.RecordVoiceMessage) { + Timber.d("AudioFocus: transient loss ($it)") + if (requester.pausesOnTransientFocusLoss()) { onFocusLost() } } @@ -96,8 +95,8 @@ class DefaultAudioFocus( private fun AudioFocusRequester.toAudioUsage(): Int { return when (this) { AudioFocusRequester.ElementCall, - AudioFocusRequester.VoiceMessage, AudioFocusRequester.RecordVoiceMessage -> AudioAttributes.USAGE_VOICE_COMMUNICATION + AudioFocusRequester.VoiceMessage, AudioFocusRequester.MediaViewer -> AudioAttributes.USAGE_MEDIA } } @@ -105,12 +104,22 @@ private fun AudioFocusRequester.toAudioUsage(): Int { private fun AudioFocusRequester.toAudioStream(): Int { return when (this) { AudioFocusRequester.ElementCall, - AudioFocusRequester.VoiceMessage, AudioFocusRequester.RecordVoiceMessage -> AudioManager.STREAM_VOICE_CALL + AudioFocusRequester.VoiceMessage, AudioFocusRequester.MediaViewer -> AudioManager.STREAM_MUSIC } } +private fun AudioFocusRequester.pausesOnTransientFocusLoss(): Boolean { + return when (this) { + // The AudioRecord API keeps capturing regardless. + AudioFocusRequester.RecordVoiceMessage, + AudioFocusRequester.VoiceMessage -> false + AudioFocusRequester.ElementCall, + AudioFocusRequester.MediaViewer -> true + } +} + private fun AudioFocusRequester.willPausedWhenDucked(): Boolean { return when (this) { // (note that for Element Call, there is no action when the focus is lost) diff --git a/libraries/audio/impl/src/test/kotlin/io/element/android/libraries/audio/impl/DefaultAudioFocusTest.kt b/libraries/audio/impl/src/test/kotlin/io/element/android/libraries/audio/impl/DefaultAudioFocusTest.kt new file mode 100644 index 0000000000..d0e255dd41 --- /dev/null +++ b/libraries/audio/impl/src/test/kotlin/io/element/android/libraries/audio/impl/DefaultAudioFocusTest.kt @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2026 Element Creations Ltd. + * Copyright 2026 New Vector Ltd. + * + * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. + * Please see LICENSE files in the repository root for full details. + */ + +package io.element.android.libraries.audio.impl + +import android.media.AudioAttributes +import android.media.AudioManager +import androidx.core.content.getSystemService +import com.google.common.truth.Truth.assertThat +import io.element.android.libraries.audio.api.AudioFocusRequester +import io.element.android.tests.testutils.robolectric.RobolectricTest +import org.junit.Test +import org.robolectric.RuntimeEnvironment +import org.robolectric.Shadows.shadowOf + +class DefaultAudioFocusTest : RobolectricTest() { + @Test + fun `voice message playback requests focus for media, not for a call`() { + assertThat(usageOf(AudioFocusRequester.VoiceMessage)).isEqualTo(AudioAttributes.USAGE_MEDIA) + } + + @Test + fun `media viewer playback requests focus for media`() { + assertThat(usageOf(AudioFocusRequester.MediaViewer)).isEqualTo(AudioAttributes.USAGE_MEDIA) + } + + @Test + fun `voice message recording requests focus for voice communication`() { + assertThat(usageOf(AudioFocusRequester.RecordVoiceMessage)).isEqualTo(AudioAttributes.USAGE_VOICE_COMMUNICATION) + } + + @Test + fun `element call requests focus for voice communication`() { + assertThat(usageOf(AudioFocusRequester.ElementCall)).isEqualTo(AudioAttributes.USAGE_VOICE_COMMUNICATION) + } + + @Test + fun `a transient focus loss does not pause a voice message`() { + assertThat(losesFocusOn(AudioFocusRequester.VoiceMessage, AudioManager.AUDIOFOCUS_LOSS_TRANSIENT)).isFalse() + assertThat(losesFocusOn(AudioFocusRequester.VoiceMessage, AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK)).isFalse() + } + + @Test + fun `a permanent focus loss pauses a voice message`() { + assertThat(losesFocusOn(AudioFocusRequester.VoiceMessage, AudioManager.AUDIOFOCUS_LOSS)).isTrue() + } + + @Test + fun `a transient focus loss does not stop a voice message recording`() { + assertThat(losesFocusOn(AudioFocusRequester.RecordVoiceMessage, AudioManager.AUDIOFOCUS_LOSS_TRANSIENT)).isFalse() + } + + @Test + fun `a transient focus loss still pauses the media viewer`() { + assertThat(losesFocusOn(AudioFocusRequester.MediaViewer, AudioManager.AUDIOFOCUS_LOSS_TRANSIENT)).isTrue() + } + + private fun losesFocusOn(requester: AudioFocusRequester, focusChange: Int): Boolean { + val context = RuntimeEnvironment.getApplication() + val audioManager = requireNotNull(context.getSystemService()) + var focusLost = false + DefaultAudioFocus(context).requestAudioFocus(requester) { focusLost = true } + val request = requireNotNull(shadowOf(audioManager).lastAudioFocusRequest) + request.listener.onAudioFocusChange(focusChange) + return focusLost + } + + private fun usageOf(requester: AudioFocusRequester): Int { + val context = RuntimeEnvironment.getApplication() + val audioManager = requireNotNull(context.getSystemService()) + DefaultAudioFocus(context).requestAudioFocus(requester) {} + val request = requireNotNull(shadowOf(audioManager).lastAudioFocusRequest) + return requireNotNull(request.audioFocusRequest).audioAttributes.usage + } +} From c362bca5270f88d8d64b55c914ae6be849c7e404 Mon Sep 17 00:00:00 2001 From: hayyaksi <193020925+hayaksi1@users.noreply.github.com> Date: Thu, 20 Aug 2026 09:55:50 +0300 Subject: [PATCH 140/145] Keep the send button when the composer is emptied while editing a message (#7456) * Keep the send button when the composer is emptied while editing rememberEndButtonParams checked whether the composer had sendable text before it checked whether the user was editing a message, so clearing the text of a message being edited replaced the send button with the voice recorder button. Starting a recording from there abandons the edit. Check the editing branch first, as the formatting composer already does, and let it render a disabled send button when there is nothing to send. * Update screenshots --- .../libraries/textcomposer/TextComposer.kt | 26 +++--- .../textcomposer/TextComposerEndButtonTest.kt | 85 +++++++++++++++++++ ...oser_MarkdownTextComposerEdit_Day_0_en.png | 4 +- ...er_MarkdownTextComposerEdit_Night_0_en.png | 4 +- ...mposer_TextComposerAddCaption_Day_0_en.png | 4 +- ...oser_TextComposerAddCaption_Night_0_en.png | 4 +- ...poser_TextComposerEditCaption_Day_0_en.png | 4 +- ...ser_TextComposerEditCaption_Night_0_en.png | 4 +- ..._TextComposerEditNotEncrypted_Day_0_en.png | 4 +- ...extComposerEditNotEncrypted_Night_0_en.png | 4 +- ...textcomposer_TextComposerEdit_Day_0_en.png | 4 +- ...xtcomposer_TextComposerEdit_Night_0_en.png | 4 +- 12 files changed, 119 insertions(+), 32 deletions(-) create mode 100644 libraries/textcomposer/impl/src/test/kotlin/io/element/android/libraries/textcomposer/TextComposerEndButtonTest.kt diff --git a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/TextComposer.kt b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/TextComposer.kt index 66c9dcba03..980443621c 100644 --- a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/TextComposer.kt +++ b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/TextComposer.kt @@ -245,6 +245,20 @@ fun TextComposer( canSendTextMessage, ) { when { + composerMode.isEditing -> EndButtonParams( + endButtonContentDescriptionResId = CommonStrings.action_send_edited_message, + endButtonClick = { + if (canSendTextMessage) { + onSendMessage() + } + }, + endButtonContent = @Composable { + SendButtonIcon( + canSendMessage = canSendTextMessage, + isEditing = true, + ) + }, + ) !canSendTextMessage -> when (voiceMessageState) { VoiceMessageState.Idle -> EndButtonParams( @@ -296,18 +310,6 @@ fun TextComposer( ) } } - composerMode.isEditing -> EndButtonParams( - endButtonContentDescriptionResId = CommonStrings.action_send_edited_message, - endButtonClick = { - onSendMessage() - }, - endButtonContent = @Composable { - SendButtonIcon( - canSendMessage = true, - isEditing = true, - ) - }, - ) else -> EndButtonParams( endButtonContentDescriptionResId = CommonStrings.action_send_message, endButtonClick = { diff --git a/libraries/textcomposer/impl/src/test/kotlin/io/element/android/libraries/textcomposer/TextComposerEndButtonTest.kt b/libraries/textcomposer/impl/src/test/kotlin/io/element/android/libraries/textcomposer/TextComposerEndButtonTest.kt new file mode 100644 index 0000000000..c979e8c909 --- /dev/null +++ b/libraries/textcomposer/impl/src/test/kotlin/io/element/android/libraries/textcomposer/TextComposerEndButtonTest.kt @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2026 Element Creations Ltd. + * Copyright 2026 New Vector Ltd. + * + * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial. + * Please see LICENSE files in the repository root for full details. + */ + +@file:OptIn(ExperimentalTestApi::class) + +package io.element.android.libraries.textcomposer + +import androidx.activity.ComponentActivity +import androidx.compose.ui.test.AndroidComposeUiTest +import androidx.compose.ui.test.ExperimentalTestApi +import androidx.compose.ui.test.assertIsDisplayed +import androidx.compose.ui.test.onNodeWithContentDescription +import androidx.compose.ui.test.v2.runAndroidComposeUiTest +import io.element.android.libraries.textcomposer.model.MessageComposerMode +import io.element.android.libraries.textcomposer.model.VoiceMessageState +import io.element.android.libraries.textcomposer.model.aTextEditorStateMarkdown +import io.element.android.libraries.ui.strings.CommonStrings +import io.element.android.tests.testutils.robolectric.RobolectricTest +import io.element.android.wysiwyg.display.TextDisplay +import org.junit.Test + +class TextComposerEndButtonTest : RobolectricTest() { + @Test + fun `editing a message with text shows the send edited message button`() = runAndroidComposeUiTest { + setTextComposer(text = "Some text", composerMode = aMessageComposerModeEdit()) + onNodeWithContentDescription(getString(CommonStrings.action_send_edited_message)).assertIsDisplayed() + } + + @Test + fun `emptying the composer while editing keeps the send edited message button`() = runAndroidComposeUiTest { + setTextComposer(text = "", composerMode = aMessageComposerModeEdit()) + onNodeWithContentDescription(getString(CommonStrings.action_send_edited_message)).assertIsDisplayed() + onNodeWithContentDescription(getString(CommonStrings.a11y_voice_message_record)).assertDoesNotExist() + } + + @Test + fun `emptying the composer while editing a caption keeps the send edited message button`() = runAndroidComposeUiTest { + setTextComposer(text = "", composerMode = aMessageComposerModeEditCaption(content = "An existing caption")) + onNodeWithContentDescription(getString(CommonStrings.action_send_edited_message)).assertIsDisplayed() + onNodeWithContentDescription(getString(CommonStrings.a11y_voice_message_record)).assertDoesNotExist() + } + + @Test + fun `an empty composer outside of edition still offers to record a voice message`() = runAndroidComposeUiTest { + setTextComposer(text = "", composerMode = MessageComposerMode.Normal) + onNodeWithContentDescription(getString(CommonStrings.a11y_voice_message_record)).assertIsDisplayed() + } + + private fun AndroidComposeUiTest.getString(resId: Int): String { + return activity!!.getString(resId) + } + + private fun AndroidComposeUiTest.setTextComposer( + text: String, + composerMode: MessageComposerMode, + ) { + setContent { + TextComposer( + state = aTextEditorStateMarkdown(initialText = text, initialFocus = true), + voiceMessageState = VoiceMessageState.Idle, + composerMode = composerMode, + onRequestFocus = {}, + onSendMessage = {}, + onResetComposerMode = {}, + onAddAttachment = {}, + onDismissTextFormatting = {}, + onVoiceRecorderEvent = {}, + onVoicePlayerEvent = {}, + onSendVoiceMessage = {}, + onDeleteVoiceMessage = {}, + onError = {}, + onTyping = {}, + onReceiveSuggestion = {}, + onSelectRichContent = null, + resolveMentionDisplay = { _, _ -> TextDisplay.Plain }, + resolveAtRoomMentionDisplay = { TextDisplay.Plain }, + ) + } + } +} diff --git a/tests/uitests/src/test/snapshots/images/libraries.textcomposer_MarkdownTextComposerEdit_Day_0_en.png b/tests/uitests/src/test/snapshots/images/libraries.textcomposer_MarkdownTextComposerEdit_Day_0_en.png index 96215547bb..bae0e74d1e 100644 --- a/tests/uitests/src/test/snapshots/images/libraries.textcomposer_MarkdownTextComposerEdit_Day_0_en.png +++ b/tests/uitests/src/test/snapshots/images/libraries.textcomposer_MarkdownTextComposerEdit_Day_0_en.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d1622f9765fda65985a369d6958f7a5993696dd629c0c1013c0a1647cfb7b562 -size 50109 +oid sha256:25fdfa4b65263c02e10c6ddea16a3210a84722a742a66cd2d91b8b3f61968466 +size 49924 diff --git a/tests/uitests/src/test/snapshots/images/libraries.textcomposer_MarkdownTextComposerEdit_Night_0_en.png b/tests/uitests/src/test/snapshots/images/libraries.textcomposer_MarkdownTextComposerEdit_Night_0_en.png index 70d41498a8..389ae383c8 100644 --- a/tests/uitests/src/test/snapshots/images/libraries.textcomposer_MarkdownTextComposerEdit_Night_0_en.png +++ b/tests/uitests/src/test/snapshots/images/libraries.textcomposer_MarkdownTextComposerEdit_Night_0_en.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a94de003f65d2fb30ab42e4ac60802707abf1358b0defed7598a3aad69992f40 -size 48136 +oid sha256:dc99c7505aa48b7ccdbae1de6daec75c12b9293172c804ef3cf027f6b46c45ea +size 47883 diff --git a/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerAddCaption_Day_0_en.png b/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerAddCaption_Day_0_en.png index c17cbfdb66..45f5ce2bde 100644 --- a/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerAddCaption_Day_0_en.png +++ b/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerAddCaption_Day_0_en.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fdab4bea33337547250355c29991f45c118e8c2c05abdf69b1824475feced5d6 -size 51241 +oid sha256:c446e3b322a1eb8634f2f643819672cfb626ca9e76c7e1fb5a10fc03a1ae7824 +size 51031 diff --git a/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerAddCaption_Night_0_en.png b/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerAddCaption_Night_0_en.png index ef9c49d6c5..ff238fd979 100644 --- a/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerAddCaption_Night_0_en.png +++ b/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerAddCaption_Night_0_en.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0f92c594febc463911c8418deeff3b94e5a8ce4171461d812a0f4f527ab0cf8e -size 49245 +oid sha256:86260ffd841034c31327df736e0e127271f875a6cf383c688b7ea8c3a9d1dbd4 +size 48943 diff --git a/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerEditCaption_Day_0_en.png b/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerEditCaption_Day_0_en.png index 9ba3d99527..cebea0c88b 100644 --- a/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerEditCaption_Day_0_en.png +++ b/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerEditCaption_Day_0_en.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:81d8acdb1158c3e5c19b5a602e3b9afe7643f1bb77d43f51d3f5c4327478a76a -size 50282 +oid sha256:9669ba8ab19e7f7f1322e973e6f39855113b45ab5f6b26e7b5230a2fe9ec1d68 +size 50067 diff --git a/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerEditCaption_Night_0_en.png b/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerEditCaption_Night_0_en.png index 969e5b04bf..50cd50736a 100644 --- a/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerEditCaption_Night_0_en.png +++ b/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerEditCaption_Night_0_en.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c225ad12c5a32e2392606f9afacc6dbc37478a141d5485e4942012c6b22ad052 -size 48046 +oid sha256:f1f66076e3b06df1471f367bed57f81d15272e3600eebc51cd131794e29d5dfb +size 47767 diff --git a/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerEditNotEncrypted_Day_0_en.png b/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerEditNotEncrypted_Day_0_en.png index a0192f0890..c4b21b86af 100644 --- a/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerEditNotEncrypted_Day_0_en.png +++ b/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerEditNotEncrypted_Day_0_en.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3cfb1d8b7828692d5c318206770f9484822a1749b3e80a618b502811cf512d76 -size 60489 +oid sha256:ffe11074abe52ccd1c34f687f780c5185be370b2b92867ee0b686bad85f28890 +size 60210 diff --git a/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerEditNotEncrypted_Night_0_en.png b/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerEditNotEncrypted_Night_0_en.png index c745fa256a..839c4a88ba 100644 --- a/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerEditNotEncrypted_Night_0_en.png +++ b/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerEditNotEncrypted_Night_0_en.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ca67409e4af247b43d8594d6351419cd12894485357596aff7b26745e2df009a -size 57687 +oid sha256:e9914f3ffd70dd83013ff6059539bda348ae64fc39a2419d621f8d198f6471cc +size 57380 diff --git a/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerEdit_Day_0_en.png b/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerEdit_Day_0_en.png index 635e14be9e..f47016a59f 100644 --- a/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerEdit_Day_0_en.png +++ b/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerEdit_Day_0_en.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8b3a91d104a5949dde83ac38b3127afa342816c631a1e29d78e2ada1bcc906bb -size 50150 +oid sha256:895ba0487ed933f4c8eddc99fe008032fe01454771ccf2987905aec357f3d9c0 +size 49972 diff --git a/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerEdit_Night_0_en.png b/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerEdit_Night_0_en.png index 573b6123ed..adfcb6a616 100644 --- a/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerEdit_Night_0_en.png +++ b/tests/uitests/src/test/snapshots/images/libraries.textcomposer_TextComposerEdit_Night_0_en.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:69c281829fbca15261f196d2134f933b789ff444cd7bebc88d05cdbb7553357f -size 48012 +oid sha256:b5a435c5aa78ffda52d96d611ab869d006e6c95e8aaf4cd005d99128b4f60b1c +size 47736 From b366515d1155122a775db0d902891dc642f71f08 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 20 Aug 2026 08:59:00 +0200 Subject: [PATCH 141/145] Update dependency androidx.compose:compose-bom to v2026.08.00 (#7483) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a314a48c33..cc6e3cdc56 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -22,7 +22,7 @@ camera = "1.6.1" work = "2.11.2" # Compose -compose_bom = "2026.06.01" +compose_bom = "2026.08.00" # Coroutines coroutines = "1.11.0" From 48f26ae33eaa8ff8340e377a50bf77455c55b294 Mon Sep 17 00:00:00 2001 From: hayyaksi <193020925+hayaksi1@users.noreply.github.com> Date: Thu, 20 Aug 2026 10:31:25 +0300 Subject: [PATCH 142/145] Do not open the room again when the app is resumed from the recents list (#7436) MainActivity is a singleTask activity that declares the elementx://open deep link, so tapping a notification makes that deep link the base intent of the task. When the user later brings the app back from the recents list, the system replays that base intent with FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY, the resolver turns it into a navigation again and the user is pushed back into the room they had already left. Ignore any intent the system replayed from the history, the same way the launcher intent is already ignored. --- .../android/appnav/intent/IntentResolver.kt | 1 + .../appnav/intent/IntentResolverTest.kt | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/appnav/src/main/kotlin/io/element/android/appnav/intent/IntentResolver.kt b/appnav/src/main/kotlin/io/element/android/appnav/intent/IntentResolver.kt index ee316f00aa..5d3a85fa9a 100644 --- a/appnav/src/main/kotlin/io/element/android/appnav/intent/IntentResolver.kt +++ b/appnav/src/main/kotlin/io/element/android/appnav/intent/IntentResolver.kt @@ -76,6 +76,7 @@ class IntentResolver( } private fun Intent.canBeIgnored(): Boolean { + if (flags and Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY != 0) return true return action == Intent.ACTION_MAIN && categories?.contains(Intent.CATEGORY_LAUNCHER) == true } diff --git a/appnav/src/test/kotlin/io/element/android/appnav/intent/IntentResolverTest.kt b/appnav/src/test/kotlin/io/element/android/appnav/intent/IntentResolverTest.kt index 841f79678b..ddeae41a78 100644 --- a/appnav/src/test/kotlin/io/element/android/appnav/intent/IntentResolverTest.kt +++ b/appnav/src/test/kotlin/io/element/android/appnav/intent/IntentResolverTest.kt @@ -45,6 +45,24 @@ class IntentResolverTest : RobolectricTest() { assertThat(result).isNull() } + @Test + fun `resolve intent replayed from the history should return null`() { + val sut = createIntentResolver( + deeplinkParserResult = DeeplinkData.Room( + sessionId = A_SESSION_ID, + roomId = A_ROOM_ID, + threadId = null, + eventId = null, + ) + ) + val intent = Intent(RuntimeEnvironment.getApplication(), Activity::class.java).apply { + action = Intent.ACTION_VIEW + addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) + } + val result = sut.resolve(intent) + assertThat(result).isNull() + } + @Test fun `test resolve navigation intent root`() { val sut = createIntentResolver( From 918015b8bbff058b1d7bfa1da2abf12aa429d3b1 Mon Sep 17 00:00:00 2001 From: hayyaksi <193020925+hayaksi1@users.noreply.github.com> Date: Thu, 20 Aug 2026 10:34:15 +0300 Subject: [PATCH 143/145] Stop waiting for a room alias that the remote server never resolves (#7446) Tapping a room alias whose server is down left the resolver screen on a spinner for as long as the screen stayed open, with no way forward other than going back. Bound the resolution with the ten second timeout already used when joining a room by address, so the retry dialog is shown instead. The fake client's resolve lambda becomes suspending so a server that never answers can be simulated. --- .../impl/RoomAliasResolverPresenter.kt | 10 +++++++++- .../impl/RoomAliasHelperPresenterTest.kt | 18 ++++++++++++++++++ .../libraries/matrix/test/FakeMatrixClient.kt | 2 +- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/features/roomaliasresolver/impl/src/main/kotlin/io/element/android/features/roomaliasresolver/impl/RoomAliasResolverPresenter.kt b/features/roomaliasresolver/impl/src/main/kotlin/io/element/android/features/roomaliasresolver/impl/RoomAliasResolverPresenter.kt index 78be168e53..1ec0ce0691 100644 --- a/features/roomaliasresolver/impl/src/main/kotlin/io/element/android/features/roomaliasresolver/impl/RoomAliasResolverPresenter.kt +++ b/features/roomaliasresolver/impl/src/main/kotlin/io/element/android/features/roomaliasresolver/impl/RoomAliasResolverPresenter.kt @@ -24,7 +24,10 @@ import io.element.android.libraries.matrix.api.core.RoomAlias import io.element.android.libraries.matrix.api.room.alias.ResolvedRoomAlias import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch +import kotlinx.coroutines.withTimeoutOrNull +import java.util.concurrent.TimeoutException import kotlin.jvm.optionals.getOrElse +import kotlin.time.Duration.Companion.seconds @AssistedInject class RoomAliasResolverPresenter( @@ -61,9 +64,14 @@ class RoomAliasResolverPresenter( private fun CoroutineScope.resolveAlias(resolveState: MutableState>) = launch { suspend { - matrixClient.resolveRoomAlias(roomAlias) + val result = withTimeoutOrNull(ALIAS_RESOLVE_TIMEOUT_IN_SECONDS.seconds) { + matrixClient.resolveRoomAlias(roomAlias) + } ?: throw TimeoutException("Timed out while resolving ${roomAlias.value}") + result .getOrThrow() .getOrElse { throw RoomAliasResolverFailures.UnknownAlias } }.runCatchingUpdatingState(resolveState) } } + +private const val ALIAS_RESOLVE_TIMEOUT_IN_SECONDS = 10 diff --git a/features/roomaliasresolver/impl/src/test/kotlin/io/element/android/features/roomaliasresolver/impl/RoomAliasHelperPresenterTest.kt b/features/roomaliasresolver/impl/src/test/kotlin/io/element/android/features/roomaliasresolver/impl/RoomAliasHelperPresenterTest.kt index df8b8058be..a50049446b 100644 --- a/features/roomaliasresolver/impl/src/test/kotlin/io/element/android/features/roomaliasresolver/impl/RoomAliasHelperPresenterTest.kt +++ b/features/roomaliasresolver/impl/src/test/kotlin/io/element/android/features/roomaliasresolver/impl/RoomAliasHelperPresenterTest.kt @@ -22,10 +22,12 @@ import io.element.android.libraries.matrix.test.A_ROOM_ID import io.element.android.libraries.matrix.test.A_SERVER_LIST import io.element.android.libraries.matrix.test.FakeMatrixClient import io.element.android.tests.testutils.WarmUpRule +import kotlinx.coroutines.awaitCancellation import kotlinx.coroutines.test.runTest import org.junit.Rule import org.junit.Test import java.util.Optional +import java.util.concurrent.TimeoutException class RoomAliasHelperPresenterTest { @get:Rule @@ -60,6 +62,22 @@ class RoomAliasHelperPresenterTest { } } + @Test + fun `present - a server that never answers ends up in an error state`() = runTest { + val client = FakeMatrixClient( + resolveRoomAliasResult = { awaitCancellation() } + ) + val presenter = createPresenter(matrixClient = client) + moleculeFlow(RecompositionMode.Immediate) { + presenter.present() + }.test { + assertThat(awaitItem().resolveState.isUninitialized()).isTrue() + assertThat(awaitItem().resolveState.isLoading()).isTrue() + val resultState = awaitItem() + assertThat(resultState.resolveState.errorOrNull()).isInstanceOf(TimeoutException::class.java) + } + } + @Test fun `present - resolve alias error and retry`() = runTest { val client = FakeMatrixClient( diff --git a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeMatrixClient.kt b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeMatrixClient.kt index 201f8cbf28..6ba42270fe 100644 --- a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeMatrixClient.kt +++ b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/FakeMatrixClient.kt @@ -100,7 +100,7 @@ class FakeMatrixClient( override val roomMembershipObserver: RoomMembershipObserver = RoomMembershipObserver(), private val homeserverCapabilitiesProvider: FakeHomeserverCapabilitiesProvider = FakeHomeserverCapabilitiesProvider(), private val accountManagementUrlResult: (AccountManagementAction?) -> Result = { lambdaError() }, - private val resolveRoomAliasResult: (RoomAlias) -> Result> = { + private val resolveRoomAliasResult: suspend (RoomAlias) -> Result> = { Result.success( Optional.of(ResolvedRoomAlias(A_ROOM_ID, emptyList())) ) From b774e6a280c142553cb29058a0491c40ccc1ace9 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 20 Aug 2026 10:12:25 +0200 Subject: [PATCH 144/145] Setting version for the release 26.08.2 --- plugins/src/main/kotlin/Versions.kt | 2 +- tools/manifest/gplay/release/aaptDump.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/src/main/kotlin/Versions.kt b/plugins/src/main/kotlin/Versions.kt index 1c77bea7cf..89ad4a63fc 100644 --- a/plugins/src/main/kotlin/Versions.kt +++ b/plugins/src/main/kotlin/Versions.kt @@ -45,7 +45,7 @@ private const val versionMonth = 8 * Release number in the month. Value must be in [0,99]. * Do not update this value. it is updated by the release script. */ -private const val versionReleaseNumber = 1 +private const val versionReleaseNumber = 2 object Versions { /** diff --git a/tools/manifest/gplay/release/aaptDump.txt b/tools/manifest/gplay/release/aaptDump.txt index fcb3669a59..7eae1a5a78 100644 --- a/tools/manifest/gplay/release/aaptDump.txt +++ b/tools/manifest/gplay/release/aaptDump.txt @@ -1,4 +1,4 @@ -package: name='io.element.android.x' versionCode='202608010' versionName='26.08.1' platformBuildVersionName='17' platformBuildVersionCode='37' compileSdkVersion='37' compileSdkVersionCodename='17' +package: name='io.element.android.x' versionCode='202608020' versionName='26.08.2' platformBuildVersionName='17' platformBuildVersionCode='37' compileSdkVersion='37' compileSdkVersionCodename='17' sdkVersion:'24' targetSdkVersion:'37' uses-permission: name='android.permission.POST_NOTIFICATIONS' From 9c867c9fc474865cb40538473462cd9e21e791f0 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 20 Aug 2026 10:12:51 +0200 Subject: [PATCH 145/145] Adding fastlane file for version 26.08.2 --- fastlane/metadata/android/en-US/changelogs/202608020.txt | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 fastlane/metadata/android/en-US/changelogs/202608020.txt diff --git a/fastlane/metadata/android/en-US/changelogs/202608020.txt b/fastlane/metadata/android/en-US/changelogs/202608020.txt new file mode 100644 index 0000000000..a4b397f1bb --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/202608020.txt @@ -0,0 +1,2 @@ +Main changes in this version: bug fixes and improvements. +Full changelog: https://github.com/element-hq/element-x-android/releases \ No newline at end of file