Fix moar ktlint issues
This commit is contained in:
parent
a831f05f6e
commit
5d086ad82d
528 changed files with 146 additions and 629 deletions
|
|
@ -24,7 +24,6 @@ import timber.log.Timber
|
|||
* Ref: https://matrix.org/docs/spec/appendices#identifier-grammar
|
||||
*/
|
||||
object MatrixPatterns {
|
||||
|
||||
// Note: TLD is not mandatory (localhost, IP address...)
|
||||
private const val DOMAIN_REGEX = ":[A-Z0-9.-]+(:[0-9]{2,5})?"
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import java.io.Serializable
|
|||
|
||||
@JvmInline
|
||||
value class RoomId(val value: String) : Serializable {
|
||||
|
||||
init {
|
||||
if (BuildConfig.DEBUG && !MatrixPatterns.isRoomId(value)) {
|
||||
error("`$value` is not a valid room id.\n Example room id: `!room_id:domain`.")
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import java.io.Serializable
|
|||
*/
|
||||
@JvmInline
|
||||
value class UserId(val value: String) : Serializable {
|
||||
|
||||
init {
|
||||
if (BuildConfig.DEBUG && !MatrixPatterns.isUserId(value)) {
|
||||
error("`$value` is not a valid user id.\nExample user id: `@name:domain`.")
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import io.element.android.appconfig.MatrixConfiguration
|
|||
* Mapping of an input URI to a matrix.to compliant URI.
|
||||
*/
|
||||
object MatrixToConverter {
|
||||
|
||||
/**
|
||||
* Try to convert a URL from an element web instance or from a client permalink to a matrix.to url.
|
||||
* To be successfully converted, URL path should contain one of the [SUPPORTED_PATHS].
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import io.element.android.libraries.matrix.api.core.RoomId
|
|||
import io.element.android.libraries.matrix.api.core.UserId
|
||||
|
||||
object PermalinkBuilder {
|
||||
|
||||
private const val ROOM_PATH = "room/"
|
||||
private const val USER_PATH = "user/"
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import kotlinx.collections.immutable.ImmutableList
|
|||
*/
|
||||
@Immutable
|
||||
sealed interface PermalinkData {
|
||||
|
||||
data class RoomLink(
|
||||
val roomIdOrAlias: String,
|
||||
val isRoomAlias: Boolean,
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ import java.net.URLDecoder
|
|||
* or client permalinks (e.g. <clientPermalinkBaseUrl>user/@chagai95:matrix.org)
|
||||
*/
|
||||
object PermalinkParser {
|
||||
|
||||
/**
|
||||
* Turns a uri string to a [PermalinkData].
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -17,5 +17,7 @@
|
|||
package io.element.android.libraries.matrix.api.room
|
||||
|
||||
enum class CurrentUserMembership {
|
||||
INVITED, JOINED, LEFT
|
||||
INVITED,
|
||||
JOINED,
|
||||
LEFT
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,5 @@ import io.element.android.libraries.matrix.api.core.RoomId
|
|||
class ForwardEventException(
|
||||
val roomIds: List<RoomId>
|
||||
) : Exception() {
|
||||
|
||||
override val message: String? = "Failed to deliver event to $roomIds rooms"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,11 @@ data class RoomMember(
|
|||
)
|
||||
|
||||
enum class RoomMembershipState {
|
||||
BAN, INVITE, JOIN, KNOCK, LEAVE
|
||||
BAN,
|
||||
INVITE,
|
||||
JOIN,
|
||||
KNOCK,
|
||||
LEAVE
|
||||
}
|
||||
|
||||
fun RoomMember.getBestName(): String {
|
||||
|
|
|
|||
|
|
@ -22,5 +22,7 @@ data class RoomNotificationSettings(
|
|||
)
|
||||
|
||||
enum class RoomNotificationMode {
|
||||
ALL_MESSAGES, MENTIONS_AND_KEYWORDS_ONLY, MUTE
|
||||
ALL_MESSAGES,
|
||||
MENTIONS_AND_KEYWORDS_ONLY,
|
||||
MUTE
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ import kotlinx.coroutines.flow.onEach
|
|||
* It lets load rooms on demand and filter them.
|
||||
*/
|
||||
interface DynamicRoomList : RoomList {
|
||||
|
||||
sealed interface Filter {
|
||||
/**
|
||||
* No filter applied.
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ import kotlin.time.Duration
|
|||
* Can be retrieved from [RoomListService] methods.
|
||||
*/
|
||||
interface RoomList {
|
||||
|
||||
sealed interface LoadingState {
|
||||
data object NotLoaded : LoadingState
|
||||
data class Loaded(val numberOfRooms: Int) : LoadingState
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import kotlinx.coroutines.flow.StateFlow
|
|||
* It requires the SyncService to be started to receive updates.
|
||||
*/
|
||||
interface RoomListService {
|
||||
|
||||
@Immutable
|
||||
sealed interface State {
|
||||
data object Idle : State
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import kotlinx.coroutines.flow.Flow
|
|||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
interface MatrixTimeline : AutoCloseable {
|
||||
|
||||
data class PaginationState(
|
||||
val isBackPaginating: Boolean,
|
||||
val hasMoreToLoadBackwards: Boolean,
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ data class PollContent(
|
|||
data class UnableToDecryptContent(
|
||||
val data: Data
|
||||
) : EventContent {
|
||||
|
||||
@Immutable
|
||||
sealed interface Data {
|
||||
data class OlmV1Curve25519AesSha2(
|
||||
|
|
|
|||
|
|
@ -17,5 +17,6 @@
|
|||
package io.element.android.libraries.matrix.api.timeline.item.event
|
||||
|
||||
enum class MessageFormat {
|
||||
HTML, UNKNOWN
|
||||
HTML,
|
||||
UNKNOWN
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,5 +17,7 @@
|
|||
package io.element.android.libraries.matrix.api.timeline.item.event
|
||||
|
||||
enum class TimelineItemEventOrigin {
|
||||
LOCAL, SYNC, PAGINATION
|
||||
LOCAL,
|
||||
SYNC,
|
||||
PAGINATION
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
package io.element.android.libraries.matrix.api.timeline.item.virtual
|
||||
|
||||
sealed interface VirtualTimelineItem {
|
||||
|
||||
data class DayDivider(
|
||||
val timestamp: Long
|
||||
) : VirtualTimelineItem
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import kotlinx.coroutines.flow.Flow
|
|||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
interface SessionVerificationService {
|
||||
|
||||
/**
|
||||
* State of the current verification flow ([VerificationFlowState.Initial] if not started).
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import com.google.common.truth.Truth.assertThat
|
|||
import org.junit.Test
|
||||
|
||||
class AuthErrorCodeTest {
|
||||
|
||||
@Test
|
||||
fun `errorCode finds UNKNOWN code`() {
|
||||
val error = AuthenticationException.Generic("M_UNKNOWN")
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import org.robolectric.RobolectricTestRunner
|
|||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
class MatrixToConverterTest {
|
||||
|
||||
@Test
|
||||
fun `converting a matrix-to url does nothing`() {
|
||||
val url = Uri.parse("https://matrix.to/#/#element-android:matrix.org")
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import io.element.android.tests.testutils.isInDebug
|
|||
import org.junit.Test
|
||||
|
||||
class PermalinkBuilderTest {
|
||||
|
||||
fun `building a permalink for an invalid user id throws when verifying the id`() {
|
||||
assertThrowsInDebug {
|
||||
val userId = UserId("some invalid user id")
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import kotlinx.collections.immutable.persistentListOf
|
|||
import org.junit.Test
|
||||
|
||||
class PermalinkDataTest {
|
||||
|
||||
@Test
|
||||
fun `getRoomId() returns value when isRoomAlias is false`() {
|
||||
val permalinkData = PermalinkData.RoomLink(
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import org.robolectric.RobolectricTestRunner
|
|||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
class PermalinkParserTest {
|
||||
|
||||
@Test
|
||||
fun `parsing an invalid url returns a fallback link`() {
|
||||
val url = "https://element.io"
|
||||
|
|
|
|||
|
|
@ -101,7 +101,6 @@ class RustMatrixClient(
|
|||
baseCacheDirectory: File,
|
||||
private val clock: SystemClock,
|
||||
) : MatrixClient {
|
||||
|
||||
override val sessionId: UserId = UserId(client.userId())
|
||||
private val innerRoomListService = syncService.roomListService()
|
||||
private val sessionDispatcher = dispatchers.io.limitedParallelism(64)
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ class RustMatrixClientFactory @Inject constructor(
|
|||
private val userAgentProvider: UserAgentProvider,
|
||||
private val clock: SystemClock,
|
||||
) {
|
||||
|
||||
suspend fun create(sessionData: SessionData): RustMatrixClient = withContext(coroutineDispatchers.io) {
|
||||
val client = ClientBuilder()
|
||||
.basePath(baseDirectory.absolutePath)
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ class RustMatrixAuthenticationService @Inject constructor(
|
|||
userAgentProvider: UserAgentProvider,
|
||||
private val rustMatrixClientFactory: RustMatrixClientFactory,
|
||||
) : MatrixAuthenticationService {
|
||||
|
||||
private val authService: RustAuthenticationService = RustAuthenticationService(
|
||||
basePath = baseDirectory.absolutePath,
|
||||
passphrase = null,
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ internal class RustEncryptionService(
|
|||
sessionCoroutineScope: CoroutineScope,
|
||||
private val dispatchers: CoroutineDispatchers,
|
||||
) : EncryptionService {
|
||||
|
||||
private val service: Encryption = client.encryption()
|
||||
|
||||
private val backupStateMapper = BackupStateMapper()
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import io.element.android.libraries.matrix.api.media.MediaFile
|
|||
import org.matrix.rustcomponents.sdk.MediaFileHandle
|
||||
|
||||
class RustMediaFile(private val inner: MediaFileHandle) : MediaFile {
|
||||
|
||||
override fun path(): String {
|
||||
return inner.path()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ class RustMediaLoader(
|
|||
dispatchers: CoroutineDispatchers,
|
||||
private val innerClient: Client,
|
||||
) : MatrixMediaLoader {
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
private val mediaDispatcher = dispatchers.io.limitedParallelism(32)
|
||||
private val cacheDirectory
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ import org.matrix.rustcomponents.sdk.use
|
|||
import javax.inject.Inject
|
||||
|
||||
class TimelineEventToNotificationContentMapper @Inject constructor() {
|
||||
|
||||
fun map(timelineEvent: TimelineEvent): NotificationContent {
|
||||
return timelineEvent.use {
|
||||
timelineEvent.eventType().use { eventType ->
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ import org.matrix.rustcomponents.sdk.RoomNotificationMode as RustRoomNotificatio
|
|||
class MatrixRoomInfoMapper(
|
||||
private val timelineItemMapper: EventTimelineItemMapper = EventTimelineItemMapper(),
|
||||
) {
|
||||
|
||||
fun map(rustRoomInfo: RustRoomInfo): MatrixRoomInfo = rustRoomInfo.use {
|
||||
return MatrixRoomInfo(
|
||||
id = it.id,
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ import kotlin.time.Duration.Companion.milliseconds
|
|||
class RoomContentForwarder(
|
||||
private val roomListService: RoomListService,
|
||||
) {
|
||||
|
||||
/**
|
||||
* Forwards the event with the given [eventId] from the [fromTimeline] to the given [toRoomIds].
|
||||
* @param fromTimeline the room to forward the event from
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import org.matrix.rustcomponents.sdk.MembershipState as RustMembershipState
|
|||
import org.matrix.rustcomponents.sdk.RoomMember as RustRoomMember
|
||||
|
||||
object RoomMemberMapper {
|
||||
|
||||
fun map(roomMember: RustRoomMember): RoomMember = roomMember.use {
|
||||
RoomMember(
|
||||
UserId(it.userId()),
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ class RoomSyncSubscriber(
|
|||
private val roomListService: RoomListService,
|
||||
private val dispatchers: CoroutineDispatchers,
|
||||
) {
|
||||
|
||||
private val subscriptionCounts = HashMap<RoomId, Int>()
|
||||
private val mutex = Mutex()
|
||||
|
||||
|
|
|
|||
|
|
@ -104,7 +104,6 @@ class RustMatrixRoom(
|
|||
private val roomSyncSubscriber: RoomSyncSubscriber,
|
||||
private val matrixRoomInfoMapper: MatrixRoomInfoMapper,
|
||||
) : MatrixRoom {
|
||||
|
||||
override val roomId = RoomId(innerRoom.id())
|
||||
|
||||
override val roomInfoFlow: Flow<MatrixRoomInfo> = mxCallbackFlow {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ internal class RoomListFactory(
|
|||
private val dispatcher: CoroutineDispatcher,
|
||||
private val roomSummaryDetailsFactory: RoomSummaryDetailsFactory = RoomSummaryDetailsFactory(),
|
||||
) {
|
||||
|
||||
/**
|
||||
* Creates a room list that can be used to load more rooms and filter them dynamically.
|
||||
*/
|
||||
|
|
@ -98,7 +97,6 @@ private class RustDynamicRoomList(
|
|||
private val processor: RoomSummaryListProcessor,
|
||||
override val pageSize: Int,
|
||||
) : DynamicRoomList {
|
||||
|
||||
override suspend fun rebuildSummaries() {
|
||||
processor.rebuildRoomSummaries()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import org.matrix.rustcomponents.sdk.RoomInfo
|
|||
import org.matrix.rustcomponents.sdk.use
|
||||
|
||||
class RoomSummaryDetailsFactory(private val roomMessageFactory: RoomMessageFactory = RoomMessageFactory()) {
|
||||
|
||||
fun create(roomInfo: RoomInfo): RoomSummaryDetails {
|
||||
val latestRoomMessage = roomInfo.latestEvent?.use {
|
||||
roomMessageFactory.create(it)
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ class RoomSummaryListProcessor(
|
|||
private val dispatcher: CoroutineDispatcher,
|
||||
private val roomSummaryDetailsFactory: RoomSummaryDetailsFactory = RoomSummaryDetailsFactory(),
|
||||
) {
|
||||
|
||||
private val roomSummariesByIdentifier = HashMap<String, RoomSummary>()
|
||||
private val mutex = Mutex()
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ internal class RustRoomListService(
|
|||
private val sessionCoroutineScope: CoroutineScope,
|
||||
roomListFactory: RoomListFactory,
|
||||
) : RoomListService {
|
||||
|
||||
override val allRooms: DynamicRoomList = roomListFactory.createRoomList(
|
||||
pageSize = DEFAULT_PAGE_SIZE,
|
||||
initialFilter = DynamicRoomList.Filter.AllNonLeft,
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ class RustSyncService(
|
|||
private val innerSyncService: SyncServiceInterface,
|
||||
sessionCoroutineScope: CoroutineScope
|
||||
) : SyncService {
|
||||
|
||||
override suspend fun startSync() = runCatching {
|
||||
Timber.i("Start sync")
|
||||
innerSyncService.start()
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ class AsyncMatrixTimeline(
|
|||
dispatcher: CoroutineDispatcher,
|
||||
private val timelineProvider: suspend () -> MatrixTimeline
|
||||
) : MatrixTimeline {
|
||||
|
||||
private val _timelineItems: MutableStateFlow<List<MatrixTimelineItem>> =
|
||||
MutableStateFlow(emptyList())
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ internal class MatrixTimelineDiffProcessor(
|
|||
private val timelineItems: MutableStateFlow<List<MatrixTimelineItem>>,
|
||||
private val timelineItemFactory: MatrixTimelineItemMapper,
|
||||
) {
|
||||
|
||||
private val mutex = Mutex()
|
||||
|
||||
suspend fun postItems(items: List<TimelineItem>) {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ class MatrixTimelineItemMapper(
|
|||
private val virtualTimelineItemMapper: VirtualTimelineItemMapper = VirtualTimelineItemMapper(),
|
||||
private val eventTimelineItemMapper: EventTimelineItemMapper = EventTimelineItemMapper(),
|
||||
) {
|
||||
|
||||
fun map(timelineItem: TimelineItem): MatrixTimelineItem = timelineItem.use {
|
||||
val uniqueId = timelineItem.uniqueId().toString()
|
||||
val asEvent = it.asEvent()
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@ class RustMatrixTimeline(
|
|||
lastLoginTimestamp: Date?,
|
||||
private val onNewSyncedEvent: () -> Unit,
|
||||
) : MatrixTimeline {
|
||||
|
||||
private val initLatch = CompletableDeferred<Unit>()
|
||||
private val isInit = AtomicBoolean(false)
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ import org.matrix.rustcomponents.sdk.MessageFormat as RustMessageFormat
|
|||
import org.matrix.rustcomponents.sdk.MessageType as RustMessageType
|
||||
|
||||
class EventMessageMapper {
|
||||
|
||||
private val timelineEventContentMapper by lazy { TimelineEventContentMapper() }
|
||||
|
||||
fun map(message: Message): MessageContent = message.use {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ import org.matrix.rustcomponents.sdk.ProfileDetails as RustProfileDetails
|
|||
import org.matrix.rustcomponents.sdk.Receipt as RustReceipt
|
||||
|
||||
class EventTimelineItemMapper(private val contentMapper: TimelineEventContentMapper = TimelineEventContentMapper()) {
|
||||
|
||||
fun map(eventTimelineItem: RustEventTimelineItem): EventTimelineItem = eventTimelineItem.use {
|
||||
EventTimelineItem(
|
||||
eventId = it.eventId()?.let(::EventId),
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ import org.matrix.rustcomponents.sdk.MembershipChange as RustMembershipChange
|
|||
import org.matrix.rustcomponents.sdk.OtherState as RustOtherState
|
||||
|
||||
class TimelineEventContentMapper(private val eventMessageMapper: EventMessageMapper = EventMessageMapper()) {
|
||||
|
||||
fun map(content: TimelineItemContent): EventContent {
|
||||
return content.use {
|
||||
content.kind().use { kind ->
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import io.element.android.libraries.matrix.api.timeline.item.virtual.VirtualTime
|
|||
import org.matrix.rustcomponents.sdk.VirtualTimelineItem as RustVirtualTimelineItem
|
||||
|
||||
class VirtualTimelineItemMapper {
|
||||
|
||||
fun map(virtualTimelineItem: RustVirtualTimelineItem): VirtualTimelineItem {
|
||||
return when (virtualTimelineItem) {
|
||||
is RustVirtualTimelineItem.DayDivider -> VirtualTimelineItem.DayDivider(virtualTimelineItem.ts.toLong())
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ class TimelineEncryptedHistoryPostProcessor(
|
|||
private val isRoomEncrypted: Boolean,
|
||||
private val isKeyBackupEnabled: Boolean,
|
||||
) {
|
||||
|
||||
suspend fun process(items: List<MatrixTimelineItem>): List<MatrixTimelineItem> = withContext(dispatcher) {
|
||||
Timber.d("Process on Thread=${Thread.currentThread()}")
|
||||
if (!isRoomEncrypted || isKeyBackupEnabled || lastLoginTimestamp == null) return@withContext items
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ data class LogEventLocation(
|
|||
val file: String,
|
||||
val line: UInt?,
|
||||
) {
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* Create a [LogEventLocation] from a [StackTraceElement].
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ import javax.inject.Inject
|
|||
|
||||
@ContributesBinding(AppScope::class)
|
||||
class RustTracingService @Inject constructor(private val buildMeta: BuildMeta) : TracingService {
|
||||
|
||||
override fun setupTracing(tracingConfiguration: TracingConfiguration) {
|
||||
val filter = tracingConfiguration.filterConfiguration
|
||||
val rustTracingConfiguration = org.matrix.rustcomponents.sdk.TracingConfiguration(
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ private val fqcnIgnore = listOf(
|
|||
* A Timber tree that passes logs to the Rust SDK.
|
||||
*/
|
||||
internal class RustTracingTree(private val retrieveFromStackTrace: Boolean) : Timber.Tree() {
|
||||
|
||||
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
|
||||
val location = if (retrieveFromStackTrace) {
|
||||
getLogEventLocationFromStackTrace()
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import kotlinx.collections.immutable.toImmutableList
|
|||
import org.matrix.rustcomponents.sdk.SearchUsersResults
|
||||
|
||||
object UserSearchResultMapper {
|
||||
|
||||
fun map(result: SearchUsersResults): MatrixSearchUserResults {
|
||||
return MatrixSearchUserResults(
|
||||
results = result.results.map(UserProfileMapper::map).toImmutableList(),
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ fun TaskHandle.cancelAndDestroy() {
|
|||
}
|
||||
|
||||
class TaskHandleBag(private val taskHandles: MutableSet<TaskHandle> = CopyOnWriteArraySet()) : Set<TaskHandle> by taskHandles {
|
||||
|
||||
operator fun plusAssign(taskHandle: TaskHandle?) {
|
||||
if (taskHandle == null) return
|
||||
taskHandles += taskHandle
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ class RustSessionVerificationService(
|
|||
private val syncService: RustSyncService,
|
||||
private val sessionCoroutineScope: CoroutineScope,
|
||||
) : SessionVerificationService, SessionVerificationControllerDelegate {
|
||||
|
||||
var verificationController: SessionVerificationControllerInterface? = null
|
||||
set(value) {
|
||||
field = value
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ class RustWidgetDriver(
|
|||
private val room: Room,
|
||||
private val widgetCapabilitiesProvider: WidgetCapabilitiesProvider,
|
||||
) : MatrixWidgetDriver {
|
||||
|
||||
// It's important to have extra capacity here to make sure we don't drop any messages
|
||||
override val incomingMessages = MutableSharedFlow<String>(extraBufferCapacity = 10)
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import org.junit.Test
|
|||
import org.matrix.rustcomponents.sdk.AuthenticationException as RustAuthenticationException
|
||||
|
||||
class AuthenticationExceptionMappingTest {
|
||||
|
||||
@Test
|
||||
fun `mapping an exception with no message returns 'Unknown error' message`() {
|
||||
val exception = Exception()
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ import org.matrix.rustcomponents.sdk.TaskHandle
|
|||
// NOTE: this class is using a fake implementation of a Rust SDK interface which returns actual Rust objects with pointers.
|
||||
// Since we don't access the data in those objects, this is fine for our tests, but that's as far as we can test this class.
|
||||
class RoomSummaryListProcessorTests {
|
||||
|
||||
private val summaries = MutableStateFlow<List<RoomSummary>>(emptyList())
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ import java.util.Date
|
|||
private const val FAKE_UNIQUE_ID = "FAKE_UNIQUE_ID"
|
||||
|
||||
class TimelineEncryptedHistoryPostProcessorTest {
|
||||
|
||||
private val defaultLastLoginTimestamp = Date(1_689_061_264L)
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ class FakeMatrixClient(
|
|||
private val encryptionService: FakeEncryptionService = FakeEncryptionService(),
|
||||
private val accountManagementUrlString: Result<String?> = Result.success(null),
|
||||
) : MatrixClient {
|
||||
|
||||
var setDisplayNameCalled: Boolean = false
|
||||
private set
|
||||
var uploadAvatarCalled: Boolean = false
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import io.element.android.libraries.matrix.api.media.MediaSource
|
|||
import io.element.android.tests.testutils.simulateLongTask
|
||||
|
||||
class FakeMediaLoader : MatrixMediaLoader {
|
||||
|
||||
var shouldFail = false
|
||||
var path: String = ""
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,6 @@ class FakeMatrixRoom(
|
|||
private val matrixTimeline: MatrixTimeline = FakeMatrixTimeline(),
|
||||
canRedact: Boolean = false,
|
||||
) : MatrixRoom {
|
||||
|
||||
private var ignoreResult: Result<Unit> = Result.success(Unit)
|
||||
private var unignoreResult: Result<Unit> = Result.success(Unit)
|
||||
private var userDisplayNameResult = Result.success<String?>(null)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
|||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
class FakeRoomListService : RoomListService {
|
||||
|
||||
private val allRoomSummariesFlow = MutableStateFlow<List<RoomSummary>>(emptyList())
|
||||
private val inviteRoomSummariesFlow = MutableStateFlow<List<RoomSummary>>(emptyList())
|
||||
private val allRoomsLoadingStateFlow = MutableStateFlow<RoomList.LoadingState>(RoomList.LoadingState.NotLoaded)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ data class SimplePagedRoomList(
|
|||
override val loadingState: StateFlow<RoomList.LoadingState>,
|
||||
override val currentFilter: MutableStateFlow<DynamicRoomList.Filter>
|
||||
) : DynamicRoomList {
|
||||
|
||||
override val pageSize: Int = Int.MAX_VALUE
|
||||
override val loadedPages = MutableStateFlow(1)
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
|||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
class FakeSyncService : SyncService {
|
||||
|
||||
private val syncStateFlow = MutableStateFlow(SyncState.Idle)
|
||||
|
||||
fun simulateError() {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ class FakeMatrixTimeline(
|
|||
beginningOfRoomReached = false,
|
||||
)
|
||||
) : MatrixTimeline {
|
||||
|
||||
private val _paginationState: MutableStateFlow<MatrixTimeline.PaginationState> = MutableStateFlow(initialPaginationState)
|
||||
private val _timelineItems: MutableStateFlow<List<MatrixTimelineItem>> = MutableStateFlow(initialTimelineItems)
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import io.element.android.libraries.matrix.api.widget.MatrixWidgetSettings
|
|||
class FakeCallWidgetSettingsProvider(
|
||||
private val provideFn: (String, String) -> MatrixWidgetSettings = { _, _ -> MatrixWidgetSettings("id", true, "url") }
|
||||
) : CallWidgetSettingsProvider {
|
||||
|
||||
val providedBaseUrls = mutableListOf<String>()
|
||||
|
||||
override fun provide(baseUrl: String, widgetId: String): MatrixWidgetSettings {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import java.util.UUID
|
|||
class FakeWidgetDriver(
|
||||
override val id: String = UUID.randomUUID().toString(),
|
||||
) : MatrixWidgetDriver {
|
||||
|
||||
private val _sentMessages = mutableListOf<String>()
|
||||
val sentMessages: List<String> = _sentMessages
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue