fix(deps): update dependency org.matrix.rustcomponents:sdk-android to v25 (#4273)
* fix(deps): update dependency org.matrix.rustcomponents:sdk-android to v25 * Adapt to SDK changes: - Remove logic related to sliding sync proxy, leaving just the minimum needed to detect its usage on the current session data. - Remove code associated with the opt-in migration to native sliding sync, since it's now mandatory. - Remove toggle between proxy/native sliding sync. - Some fixes to session verification API breaks. * Update forced logout dialog message, remove `NativeSlidingSyncMigrationBanner` * Update screenshots * Update all strings * Remove `SuccessfulLogoutPendingAction` --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jorge Martín <jorgem@element.io> Co-authored-by: ElementBot <android@element.io>
This commit is contained in:
parent
e128eca991
commit
beffba11b6
95 changed files with 103 additions and 532 deletions
|
|
@ -13,7 +13,6 @@ import io.element.android.libraries.featureflag.ui.model.FeatureUiModel
|
|||
sealed interface DeveloperSettingsEvents {
|
||||
data class UpdateEnabledFeature(val feature: FeatureUiModel, val isEnabled: Boolean) : DeveloperSettingsEvents
|
||||
data class SetCustomElementCallBaseUrl(val baseUrl: String?) : DeveloperSettingsEvents
|
||||
data class SetSimplifiedSlidingSyncEnabled(val isEnabled: Boolean) : DeveloperSettingsEvents
|
||||
data class SetHideImagesAndVideos(val value: Boolean) : DeveloperSettingsEvents
|
||||
data class SetTracingLogLevel(val logLevel: LogLevelItem) : DeveloperSettingsEvents
|
||||
data object ClearCache : DeveloperSettingsEvents
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ import androidx.compose.runtime.remember
|
|||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.snapshots.SnapshotStateMap
|
||||
import io.element.android.appconfig.ElementCallConfig
|
||||
import io.element.android.features.logout.api.LogoutUseCase
|
||||
import io.element.android.features.preferences.impl.developer.tracing.toLogLevel
|
||||
import io.element.android.features.preferences.impl.developer.tracing.toLogLevelItem
|
||||
import io.element.android.features.preferences.impl.tasks.ClearCacheUseCase
|
||||
|
|
@ -51,7 +50,6 @@ class DeveloperSettingsPresenter @Inject constructor(
|
|||
private val rageshakePresenter: Presenter<RageshakePreferencesState>,
|
||||
private val appPreferencesStore: AppPreferencesStore,
|
||||
private val buildMeta: BuildMeta,
|
||||
private val logoutUseCase: LogoutUseCase,
|
||||
) : Presenter<DeveloperSettingsState> {
|
||||
@Composable
|
||||
override fun present(): DeveloperSettingsState {
|
||||
|
|
@ -72,9 +70,6 @@ class DeveloperSettingsPresenter @Inject constructor(
|
|||
val customElementCallBaseUrl by appPreferencesStore
|
||||
.getCustomElementCallBaseUrlFlow()
|
||||
.collectAsState(initial = null)
|
||||
val isSimplifiedSlidingSyncEnabled by appPreferencesStore
|
||||
.isSimplifiedSlidingSyncEnabledFlow()
|
||||
.collectAsState(initial = false)
|
||||
val hideImagesAndVideos by appPreferencesStore
|
||||
.doesHideImagesAndVideosFlow()
|
||||
.collectAsState(initial = false)
|
||||
|
|
@ -122,12 +117,6 @@ class DeveloperSettingsPresenter @Inject constructor(
|
|||
appPreferencesStore.setCustomElementCallBaseUrl(urlToSave)
|
||||
}
|
||||
DeveloperSettingsEvents.ClearCache -> coroutineScope.clearCache(clearCacheAction)
|
||||
is DeveloperSettingsEvents.SetSimplifiedSlidingSyncEnabled -> coroutineScope.launch {
|
||||
appPreferencesStore.setSimplifiedSlidingSyncEnabled(event.isEnabled)
|
||||
runCatching {
|
||||
logoutUseCase.logout(ignoreSdkError = true)
|
||||
}
|
||||
}
|
||||
is DeveloperSettingsEvents.SetHideImagesAndVideos -> coroutineScope.launch {
|
||||
appPreferencesStore.setHideImagesAndVideos(event.value)
|
||||
}
|
||||
|
|
@ -147,7 +136,6 @@ class DeveloperSettingsPresenter @Inject constructor(
|
|||
defaultUrl = ElementCallConfig.DEFAULT_BASE_URL,
|
||||
validator = ::customElementCallUrlValidator,
|
||||
),
|
||||
isSimpleSlidingSyncEnabled = isSimplifiedSlidingSyncEnabled,
|
||||
hideImagesAndVideos = hideImagesAndVideos,
|
||||
tracingLogLevel = tracingLogLevel,
|
||||
eventSink = ::handleEvents
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ data class DeveloperSettingsState(
|
|||
val rageshakeState: RageshakePreferencesState,
|
||||
val clearCacheAction: AsyncAction<Unit>,
|
||||
val customElementCallBaseUrlState: CustomElementCallBaseUrlState,
|
||||
val isSimpleSlidingSyncEnabled: Boolean,
|
||||
val hideImagesAndVideos: Boolean,
|
||||
val tracingLogLevel: AsyncData<LogLevelItem>,
|
||||
val eventSink: (DeveloperSettingsEvents) -> Unit
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ open class DeveloperSettingsStateProvider : PreviewParameterProvider<DeveloperSe
|
|||
fun aDeveloperSettingsState(
|
||||
clearCacheAction: AsyncAction<Unit> = AsyncAction.Uninitialized,
|
||||
customElementCallBaseUrlState: CustomElementCallBaseUrlState = aCustomElementCallBaseUrlState(),
|
||||
isSimplifiedSlidingSyncEnabled: Boolean = false,
|
||||
hideImagesAndVideos: Boolean = false,
|
||||
eventSink: (DeveloperSettingsEvents) -> Unit = {},
|
||||
) = DeveloperSettingsState(
|
||||
|
|
@ -41,7 +40,6 @@ fun aDeveloperSettingsState(
|
|||
cacheSize = AsyncData.Success("1.2 MB"),
|
||||
clearCacheAction = clearCacheAction,
|
||||
customElementCallBaseUrlState = customElementCallBaseUrlState,
|
||||
isSimpleSlidingSyncEnabled = isSimplifiedSlidingSyncEnabled,
|
||||
hideImagesAndVideos = hideImagesAndVideos,
|
||||
tracingLogLevel = AsyncData.Success(LogLevelItem.INFO),
|
||||
eventSink = eventSink,
|
||||
|
|
|
|||
|
|
@ -60,14 +60,6 @@ fun DeveloperSettingsView(
|
|||
state.eventSink(DeveloperSettingsEvents.SetTracingLogLevel(logLevel))
|
||||
}
|
||||
)
|
||||
PreferenceSwitch(
|
||||
title = "Enable Simplified Sliding Sync",
|
||||
subtitle = "When toggled you'll be logged out of the app and will need to log in again.",
|
||||
isChecked = state.isSimpleSlidingSyncEnabled,
|
||||
onCheckedChange = {
|
||||
state.eventSink(DeveloperSettingsEvents.SetSimplifiedSlidingSyncEnabled(it))
|
||||
}
|
||||
)
|
||||
}
|
||||
PreferenceCategory(title = "Showkase") {
|
||||
PreferenceText(
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ package io.element.android.features.preferences.impl.developer
|
|||
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import io.element.android.appconfig.ElementCallConfig
|
||||
import io.element.android.features.logout.test.FakeLogoutUseCase
|
||||
import io.element.android.features.preferences.impl.developer.tracing.LogLevelItem
|
||||
import io.element.android.features.preferences.impl.tasks.FakeClearCacheUseCase
|
||||
import io.element.android.features.preferences.impl.tasks.FakeComputeCacheSizeUseCase
|
||||
|
|
@ -25,11 +24,9 @@ import io.element.android.libraries.featureflag.test.FakeFeatureFlagService
|
|||
import io.element.android.libraries.matrix.test.core.aBuildMeta
|
||||
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.test
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.test.advanceUntilIdle
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
|
@ -48,7 +45,6 @@ class DeveloperSettingsPresenterTest {
|
|||
assertThat(state.cacheSize).isEqualTo(AsyncData.Uninitialized)
|
||||
assertThat(state.customElementCallBaseUrlState).isNotNull()
|
||||
assertThat(state.customElementCallBaseUrlState.baseUrl).isNull()
|
||||
assertThat(state.isSimpleSlidingSyncEnabled).isFalse()
|
||||
assertThat(state.hideImagesAndVideos).isFalse()
|
||||
assertThat(state.rageshakeState.isEnabled).isFalse()
|
||||
assertThat(state.rageshakeState.isSupported).isTrue()
|
||||
|
|
@ -153,34 +149,6 @@ class DeveloperSettingsPresenterTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `present - toggling simplified sliding sync changes the preferences and logs out the user`() = runTest {
|
||||
val logoutCallRecorder = lambdaRecorder<Boolean, String?> { "" }
|
||||
val logoutUseCase = FakeLogoutUseCase(logoutLambda = logoutCallRecorder)
|
||||
val preferences = InMemoryAppPreferencesStore()
|
||||
val presenter = createDeveloperSettingsPresenter(preferencesStore = preferences, logoutUseCase = logoutUseCase)
|
||||
presenter.test {
|
||||
skipItems(2)
|
||||
awaitItem().also { state ->
|
||||
assertThat(state.isSimpleSlidingSyncEnabled).isFalse()
|
||||
state.eventSink(DeveloperSettingsEvents.SetSimplifiedSlidingSyncEnabled(true))
|
||||
}
|
||||
awaitItem().also { state ->
|
||||
assertThat(state.isSimpleSlidingSyncEnabled).isTrue()
|
||||
assertThat(preferences.isSimplifiedSlidingSyncEnabledFlow().first()).isTrue()
|
||||
advanceUntilIdle()
|
||||
logoutCallRecorder.assertions().isCalledOnce()
|
||||
state.eventSink(DeveloperSettingsEvents.SetSimplifiedSlidingSyncEnabled(false))
|
||||
}
|
||||
awaitItem().also { state ->
|
||||
assertThat(state.isSimpleSlidingSyncEnabled).isFalse()
|
||||
assertThat(preferences.isSimplifiedSlidingSyncEnabledFlow().first()).isFalse()
|
||||
advanceUntilIdle()
|
||||
logoutCallRecorder.assertions().isCalledExactly(2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `present - toggling hide image and video`() = runTest {
|
||||
val preferences = InMemoryAppPreferencesStore()
|
||||
|
|
@ -225,7 +193,6 @@ class DeveloperSettingsPresenterTest {
|
|||
clearCacheUseCase: FakeClearCacheUseCase = FakeClearCacheUseCase(),
|
||||
preferencesStore: InMemoryAppPreferencesStore = InMemoryAppPreferencesStore(),
|
||||
buildMeta: BuildMeta = aBuildMeta(),
|
||||
logoutUseCase: FakeLogoutUseCase = FakeLogoutUseCase(logoutLambda = { "" })
|
||||
): DeveloperSettingsPresenter {
|
||||
return DeveloperSettingsPresenter(
|
||||
featureFlagService = featureFlagService,
|
||||
|
|
@ -234,7 +201,6 @@ class DeveloperSettingsPresenterTest {
|
|||
rageshakePresenter = { aRageshakePreferencesState() },
|
||||
appPreferencesStore = preferencesStore,
|
||||
buildMeta = buildMeta,
|
||||
logoutUseCase = logoutUseCase,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,19 +102,6 @@ class DeveloperSettingsViewTest {
|
|||
eventsRecorder.assertSingle(DeveloperSettingsEvents.ClearCache)
|
||||
}
|
||||
|
||||
@Config(qualifiers = "h1500dp")
|
||||
@Test
|
||||
fun `clicking on the simplified sliding sync switch emits the expected event`() {
|
||||
val eventsRecorder = EventsRecorder<DeveloperSettingsEvents>()
|
||||
rule.setDeveloperSettingsView(
|
||||
state = aDeveloperSettingsState(
|
||||
eventSink = eventsRecorder
|
||||
),
|
||||
)
|
||||
rule.onNodeWithText("Enable Simplified Sliding Sync").performClick()
|
||||
eventsRecorder.assertSingle(DeveloperSettingsEvents.SetSimplifiedSlidingSyncEnabled(true))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `clicking on the hide images and videos switch emits the expected event`() {
|
||||
val eventsRecorder = EventsRecorder<DeveloperSettingsEvents>()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue