Remove the green badge on a pending invite after a first preview (#4532)
* Remove condition on displayType as I believe, that it has no effect. * Remove the green badge on a pending invite after a first preview * Update screenshots * Fix test * Improve DefaultSeenInvitesStore, clear it on logout, and on clear cache. Also create a store per session. * Remember the returned flow. --------- Co-authored-by: ElementBot <android@element.io>
This commit is contained in:
parent
77a7c0b2e5
commit
ef8eeb804e
26 changed files with 326 additions and 29 deletions
29
features/invite/test/build.gradle.kts
Normal file
29
features/invite/test/build.gradle.kts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (c) 2025 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
id("io.element.android-library")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "io.element.android.features.invite.test"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(libs.coroutines.core)
|
||||
implementation(projects.libraries.matrix.api)
|
||||
api(projects.features.invite.api)
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* 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.invite.test
|
||||
|
||||
import io.element.android.features.invite.api.SeenInvitesStore
|
||||
import io.element.android.libraries.matrix.api.core.RoomId
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
||||
class InMemorySeenInvitesStore(
|
||||
initialRoomIds: Set<RoomId> = emptySet(),
|
||||
) : SeenInvitesStore {
|
||||
private val roomIds = MutableStateFlow(initialRoomIds)
|
||||
|
||||
override fun seenRoomIds(): Flow<Set<RoomId>> = roomIds
|
||||
|
||||
override suspend fun markAsSeen(roomId: RoomId) {
|
||||
roomIds.value += roomId
|
||||
}
|
||||
|
||||
override suspend fun markAsUnSeen(roomId: RoomId) {
|
||||
roomIds.value -= roomId
|
||||
}
|
||||
|
||||
override suspend fun clear() {
|
||||
roomIds.value = emptySet()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue