Remove Room.clearEventCacheStorage since it's not supported by the SDK anymore
This commit is contained in:
committed by
Jorge Martin Espinosa
parent
f62030ac5b
commit
b38b5a924f
-16
@@ -69,10 +69,6 @@ fun RoomListContextMenu(
|
||||
onFavoriteChange = { isFavorite ->
|
||||
eventSink(RoomListEvent.SetRoomIsFavorite(contextMenu.roomId, isFavorite))
|
||||
},
|
||||
onClearCacheRoomClick = {
|
||||
eventSink(RoomListEvent.HideContextMenu)
|
||||
eventSink(RoomListEvent.ClearCacheOfRoom(contextMenu.roomId))
|
||||
},
|
||||
onReportRoomClick = {
|
||||
eventSink(RoomListEvent.HideContextMenu)
|
||||
onReportRoomClick(contextMenu.roomId)
|
||||
@@ -90,7 +86,6 @@ private fun RoomListModalBottomSheetContent(
|
||||
onFavoriteChange: (isFavorite: Boolean) -> Unit,
|
||||
onRoomMarkReadClick: () -> Unit,
|
||||
onRoomMarkUnreadClick: () -> Unit,
|
||||
onClearCacheRoomClick: () -> Unit,
|
||||
onReportRoomClick: () -> Unit,
|
||||
) {
|
||||
Column(
|
||||
@@ -198,17 +193,6 @@ private fun RoomListModalBottomSheetContent(
|
||||
),
|
||||
style = ListItemStyle.Destructive,
|
||||
)
|
||||
if (contextMenu.displayClearRoomCacheAction) {
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
Text(text = "Clear cache for this room")
|
||||
},
|
||||
modifier = Modifier.clickable { onClearCacheRoomClick() },
|
||||
leadingContent = ListItemContent.Icon(
|
||||
iconSource = IconSource.Vector(CompoundIcons.Delete())
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-1
@@ -30,5 +30,4 @@ sealed interface RoomListEvent {
|
||||
data class MarkAsRead(val roomId: RoomId) : ContextMenuEvent
|
||||
data class MarkAsUnread(val roomId: RoomId) : ContextMenuEvent
|
||||
data class SetRoomIsFavorite(val roomId: RoomId, val isFavorite: Boolean) : ContextMenuEvent
|
||||
data class ClearCacheOfRoom(val roomId: RoomId) : ContextMenuEvent
|
||||
}
|
||||
|
||||
-11
@@ -28,7 +28,6 @@ import im.vector.app.features.analytics.plan.Interaction
|
||||
import io.element.android.features.announcement.api.Announcement
|
||||
import io.element.android.features.announcement.api.AnnouncementService
|
||||
import io.element.android.features.home.impl.datasource.RoomListDataSource
|
||||
import io.element.android.features.home.impl.filters.RoomListFilter.Rooms
|
||||
import io.element.android.features.home.impl.filters.RoomListFiltersState
|
||||
import io.element.android.features.home.impl.filters.into
|
||||
import io.element.android.features.home.impl.search.RoomListSearchEvent
|
||||
@@ -54,7 +53,6 @@ import io.element.android.libraries.matrix.api.roomlist.RoomList
|
||||
import io.element.android.libraries.matrix.api.roomlist.RoomListFilter
|
||||
import io.element.android.libraries.matrix.api.timeline.ReceiptType
|
||||
import io.element.android.libraries.matrix.ui.safety.rememberHideInvitesAvatar
|
||||
import io.element.android.libraries.preferences.api.store.AppPreferencesStore
|
||||
import io.element.android.libraries.preferences.api.store.SessionPreferencesStore
|
||||
import io.element.android.libraries.push.api.battery.BatteryOptimizationState
|
||||
import io.element.android.libraries.push.api.notifications.NotificationCleaner
|
||||
@@ -87,7 +85,6 @@ class RoomListPresenter(
|
||||
private val fullScreenIntentPermissionsPresenter: Presenter<FullScreenIntentPermissionsState>,
|
||||
private val batteryOptimizationPresenter: Presenter<BatteryOptimizationState>,
|
||||
private val notificationCleaner: NotificationCleaner,
|
||||
private val appPreferencesStore: AppPreferencesStore,
|
||||
private val seenInvitesStore: SeenInvitesStore,
|
||||
private val announcementService: AnnouncementService,
|
||||
private val coldStartWatcher: AnalyticsColdStartWatcher,
|
||||
@@ -157,7 +154,6 @@ class RoomListPresenter(
|
||||
}
|
||||
is RoomListEvent.ShowDeclineInviteMenu -> declineInviteMenu.value = RoomListState.DeclineInviteMenu.Shown(event.roomSummary)
|
||||
RoomListEvent.HideDeclineInviteMenu -> declineInviteMenu.value = RoomListState.DeclineInviteMenu.Hidden
|
||||
is RoomListEvent.ClearCacheOfRoom -> coroutineScope.clearCacheOfRoom(event.roomId)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,7 +276,6 @@ class RoomListPresenter(
|
||||
isDm = event.roomSummary.isDm,
|
||||
isFavorite = event.roomSummary.isFavorite,
|
||||
hasNewContent = event.roomSummary.hasNewContent,
|
||||
displayClearRoomCacheAction = appPreferencesStore.isDeveloperModeEnabledFlow().first(),
|
||||
)
|
||||
contextMenuState.value = initialState
|
||||
|
||||
@@ -336,10 +331,4 @@ class RoomListPresenter(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun CoroutineScope.clearCacheOfRoom(roomId: RoomId) = launch {
|
||||
client.getRoom(roomId)?.use { room ->
|
||||
room.clearEventCacheStorage()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -44,7 +44,6 @@ data class RoomListState(
|
||||
val isDm: Boolean,
|
||||
val isFavorite: Boolean,
|
||||
val hasNewContent: Boolean,
|
||||
val displayClearRoomCacheAction: Boolean,
|
||||
) : ContextMenu
|
||||
}
|
||||
|
||||
|
||||
-1
@@ -31,5 +31,4 @@ internal fun aContextMenuShown(
|
||||
isDm = isDm,
|
||||
hasNewContent = hasNewContent,
|
||||
isFavorite = isFavorite,
|
||||
displayClearRoomCacheAction = false,
|
||||
)
|
||||
|
||||
-35
@@ -63,9 +63,7 @@ import io.element.android.libraries.matrix.test.roomlist.FakeDynamicRoomList
|
||||
import io.element.android.libraries.matrix.test.roomlist.FakeRoomListService
|
||||
import io.element.android.libraries.matrix.test.sync.FakeSyncService
|
||||
import io.element.android.libraries.matrix.test.verification.FakeSessionVerificationService
|
||||
import io.element.android.libraries.preferences.api.store.AppPreferencesStore
|
||||
import io.element.android.libraries.preferences.api.store.SessionPreferencesStore
|
||||
import io.element.android.libraries.preferences.test.InMemoryAppPreferencesStore
|
||||
import io.element.android.libraries.preferences.test.InMemorySessionPreferencesStore
|
||||
import io.element.android.libraries.push.api.battery.aBatteryOptimizationState
|
||||
import io.element.android.libraries.push.api.notifications.NotificationCleaner
|
||||
@@ -230,7 +228,6 @@ class RoomListPresenterTest {
|
||||
isDm = false,
|
||||
isFavorite = false,
|
||||
hasNewContent = false,
|
||||
displayClearRoomCacheAction = false,
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -247,35 +244,6 @@ class RoomListPresenterTest {
|
||||
isDm = false,
|
||||
isFavorite = true,
|
||||
hasNewContent = false,
|
||||
displayClearRoomCacheAction = false,
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `present - show context menu with view source on`() = runTest {
|
||||
val presenter = createRoomListPresenter(
|
||||
appPreferencesStore = InMemoryAppPreferencesStore(
|
||||
isDeveloperModeEnabled = true,
|
||||
)
|
||||
)
|
||||
presenter.test {
|
||||
val initialState = awaitItem()
|
||||
val summary = createRoomListRoomSummary()
|
||||
initialState.eventSink(RoomListEvent.ShowContextMenu(summary))
|
||||
awaitItem().also { state ->
|
||||
assertThat(state.contextMenu)
|
||||
.isEqualTo(
|
||||
RoomListState.ContextMenu.Shown(
|
||||
roomId = summary.roomId,
|
||||
roomName = summary.name,
|
||||
isDm = false,
|
||||
isFavorite = false,
|
||||
// true here.
|
||||
hasNewContent = false,
|
||||
displayClearRoomCacheAction = true,
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -303,7 +271,6 @@ class RoomListPresenterTest {
|
||||
isDm = false,
|
||||
isFavorite = false,
|
||||
hasNewContent = false,
|
||||
displayClearRoomCacheAction = false,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -668,7 +635,6 @@ class RoomListPresenterTest {
|
||||
spaceFiltersPresenter: Presenter<SpaceFiltersState> = Presenter { aDisabledSpaceFiltersState() },
|
||||
acceptDeclineInvitePresenter: Presenter<AcceptDeclineInviteState> = Presenter { anAcceptDeclineInviteState() },
|
||||
notificationCleaner: NotificationCleaner = FakeNotificationCleaner(),
|
||||
appPreferencesStore: AppPreferencesStore = InMemoryAppPreferencesStore(),
|
||||
seenInvitesStore: SeenInvitesStore = InMemorySeenInvitesStore(),
|
||||
announcementService: AnnouncementService = FakeAnnouncementService(),
|
||||
featureFlagService: FeatureFlagService = FakeFeatureFlagService(),
|
||||
@@ -696,7 +662,6 @@ class RoomListPresenterTest {
|
||||
fullScreenIntentPermissionsPresenter = { aFullScreenIntentPermissionsState() },
|
||||
batteryOptimizationPresenter = { aBatteryOptimizationState() },
|
||||
notificationCleaner = notificationCleaner,
|
||||
appPreferencesStore = appPreferencesStore,
|
||||
seenInvitesStore = seenInvitesStore,
|
||||
announcementService = announcementService,
|
||||
coldStartWatcher = FakeAnalyticsColdStartWatcher(),
|
||||
|
||||
-5
@@ -157,11 +157,6 @@ interface BaseRoom : Closeable {
|
||||
*/
|
||||
suspend fun setUnreadFlag(isUnread: Boolean): Result<Unit>
|
||||
|
||||
/**
|
||||
* Clear the event cache storage for the current room.
|
||||
*/
|
||||
suspend fun clearEventCacheStorage(): Result<Unit>
|
||||
|
||||
/**
|
||||
* Get the permalink for the room.
|
||||
*/
|
||||
|
||||
-6
@@ -200,12 +200,6 @@ class RustBaseRoom(
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun clearEventCacheStorage(): Result<Unit> = withContext(roomDispatcher) {
|
||||
runCatchingExceptions {
|
||||
innerRoom.clearEventCacheStorage()
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun setIsFavorite(isFavorite: Boolean): Result<Unit> = withContext(roomDispatcher) {
|
||||
runCatchingExceptions {
|
||||
innerRoom.setIsFavourite(isFavorite, null)
|
||||
|
||||
-4
@@ -186,10 +186,6 @@ class FakeBaseRoom(
|
||||
membersStateFlow.value = state
|
||||
}
|
||||
|
||||
override suspend fun clearEventCacheStorage(): Result<Unit> {
|
||||
return Result.success(Unit)
|
||||
}
|
||||
|
||||
override suspend fun reportRoom(reason: String?) = reportRoomResult(reason)
|
||||
|
||||
override suspend fun declineCall(notificationEventId: EventId): Result<Unit> {
|
||||
|
||||
Reference in New Issue
Block a user