Fix moar ktlint issues

This commit is contained in:
Benoit Marty 2024-01-11 09:41:14 +01:00 committed by Benoit Marty
parent a831f05f6e
commit 5d086ad82d
528 changed files with 146 additions and 629 deletions

View file

@ -31,7 +31,6 @@ import javax.inject.Inject
*/
@ContributesBinding(AppScope::class)
class AESEncryptionDecryptionService @Inject constructor() : EncryptionDecryptionService {
override fun createEncryptionCipher(key: SecretKey): Cipher {
return Cipher.getInstance(AESEncryptionSpecs.CIPHER_TRANSFORMATION).apply {
init(Cipher.ENCRYPT_MODE, key)

View file

@ -27,7 +27,6 @@ internal const val ANDROID_KEYSTORE = "AndroidKeyStore"
@ContributesTo(AppScope::class)
@Module
object CryptographyModule {
@Provides
fun providesAndroidKeyStore(): KeyStore {
return KeyStore.getInstance(ANDROID_KEYSTORE).apply {

View file

@ -38,7 +38,6 @@ import javax.inject.Inject
class KeyStoreSecretKeyRepository @Inject constructor(
private val keyStore: KeyStore,
) : SecretKeyRepository {
// False positive lint issue
@SuppressLint("WrongConstant")
override fun getOrCreateKey(alias: String, requiresUserAuthentication: Boolean): SecretKey {

View file

@ -24,7 +24,6 @@ import java.security.GeneralSecurityException
import javax.crypto.KeyGenerator
class AESEncryptionDecryptionServiceTest {
private val encryptionDecryptionService = AESEncryptionDecryptionService()
@Test

View file

@ -22,7 +22,6 @@ import javax.crypto.KeyGenerator
import javax.crypto.SecretKey
class SimpleSecretKeyRepository : SecretKeyRepository {
private var secretKeyForAlias = HashMap<String, SecretKey>()
override fun getOrCreateKey(alias: String, requiresUserAuthentication: Boolean): SecretKey {

View file

@ -36,7 +36,6 @@ class DateFormatters @Inject constructor(
private val clock: Clock,
private val timeZone: TimeZone,
) {
private val onlyTimeFormatter: DateTimeFormatter by lazy {
val pattern = DateFormat.getBestDateTimePattern(locale, "HH:mm") ?: "HH:mm"
DateTimeFormatter.ofPattern(pattern, locale)

View file

@ -26,7 +26,6 @@ class DefaultDaySeparatorFormatter @Inject constructor(
private val localDateTimeProvider: LocalDateTimeProvider,
private val dateFormatters: DateFormatters,
) : DaySeparatorFormatter {
override fun format(timestamp: Long): String {
val dateToFormat = localDateTimeProvider.providesFromTimestamp(timestamp)
return dateFormatters.formatDateWithYear(dateToFormat)

View file

@ -26,7 +26,6 @@ class DefaultLastMessageTimestampFormatter @Inject constructor(
private val localDateTimeProvider: LocalDateTimeProvider,
private val dateFormatters: DateFormatters,
) : LastMessageTimestampFormatter {
override fun format(timestamp: Long?): String {
if (timestamp == null) return ""
val currentDate = localDateTimeProvider.providesNow()

View file

@ -27,7 +27,6 @@ class LocalDateTimeProvider @Inject constructor(
private val clock: Clock,
private val timezone: TimeZone,
) {
fun providesNow(): LocalDateTime {
val now: Instant = clock.now()
return now.toLocalDateTime(timezone)

View file

@ -25,7 +25,6 @@ import org.junit.Test
import java.util.Locale
class DefaultLastMessageTimestampFormatterTest {
@Test
fun `test null`() {
val now = "1980-04-06T18:35:24.00Z"

View file

@ -19,7 +19,6 @@ package io.element.android.libraries.dateformatter.test
import io.element.android.libraries.dateformatter.api.DaySeparatorFormatter
class FakeDaySeparatorFormatter : DaySeparatorFormatter {
private var format = ""
fun givenFormat(format: String) {

View file

@ -62,7 +62,6 @@ class DefaultRoomLastMessageFormatter @Inject constructor(
private val profileChangeContentFormatter: ProfileChangeContentFormatter,
private val stateContentFormatter: StateContentFormatter,
) : RoomLastMessageFormatter {
companion object {
// Max characters to display in the last message. This works around https://github.com/element-hq/element-x-android/issues/2105
private const val MAX_SAFE_LENGTH = 500

View file

@ -46,7 +46,6 @@ class DefaultTimelineEventFormatter @Inject constructor(
private val profileChangeContentFormatter: ProfileChangeContentFormatter,
private val stateContentFormatter: StateContentFormatter,
) : TimelineEventFormatter {
override fun format(event: EventTimelineItem): CharSequence? {
val isOutgoing = event.isOwn
val senderDisplayName = (event.senderProfile as? ProfileTimelineDetails.Ready)?.displayName ?: event.sender.value

View file

@ -65,7 +65,6 @@ import org.robolectric.annotation.Config
@Suppress("LargeClass")
@RunWith(RobolectricTestRunner::class)
class DefaultRoomLastMessageFormatterTest {
private lateinit var context: Context
private lateinit var fakeMatrixClient: FakeMatrixClient
private lateinit var formatter: DefaultRoomLastMessageFormatter

View file

@ -20,7 +20,6 @@ import io.element.android.libraries.eventformatter.api.RoomLastMessageFormatter
import io.element.android.libraries.matrix.api.timeline.item.event.EventTimelineItem
class FakeRoomLastMessageFormatter : RoomLastMessageFormatter {
private var result: CharSequence? = null
override fun format(event: EventTimelineItem, isDmRoom: Boolean): CharSequence? {

View file

@ -30,7 +30,6 @@ import javax.inject.Inject
class DefaultFeatureFlagService @Inject constructor(
private val providers: Set<@JvmSuppressWildcards FeatureFlagProvider>
) : FeatureFlagService {
override fun isFeatureEnabledFlow(feature: Feature): Flow<Boolean> {
return providers.filter { it.hasFeature(feature) }
.sortedByDescending(FeatureFlagProvider::priority)

View file

@ -28,7 +28,6 @@ import javax.inject.Inject
*/
class StaticFeatureFlagProvider @Inject constructor() :
FeatureFlagProvider {
override val priority = LOW_PRIORITY
override fun isFeatureEnabledFlow(feature: Feature): Flow<Boolean> {

View file

@ -29,7 +29,6 @@ import io.element.android.libraries.featureflag.impl.StaticFeatureFlagProvider
@Module
@ContributesTo(AppScope::class)
object FeatureFlagModule {
@JvmStatic
@Provides
@ElementsIntoSet

View file

@ -23,7 +23,6 @@ import kotlinx.coroutines.test.runTest
import org.junit.Test
class DefaultFeatureFlagServiceTest {
@Test
fun `given service without provider when feature is checked then it returns the default value`() = runTest {
val featureFlagService = DefaultFeatureFlagService(emptySet())

View file

@ -21,7 +21,6 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
class FakeMutableFeatureFlagProvider(override val priority: Int) : MutableFeatureFlagProvider {
private val enabledFeatures = mutableMapOf<String, MutableStateFlow<Boolean>>()
override suspend fun setFeatureEnabled(feature: Feature, enabled: Boolean) {

View file

@ -24,7 +24,6 @@ import kotlinx.coroutines.flow.MutableStateFlow
class FakeFeatureFlagService(
initialState: Map<String, Boolean> = emptyMap()
) : FeatureFlagService {
private val enabledFeatures = initialState
.map {
it.key to MutableStateFlow(it.value)

View file

@ -39,7 +39,6 @@ class DefaultIndicatorService @Inject constructor(
private val encryptionService: EncryptionService,
private val featureFlagService: FeatureFlagService,
) : IndicatorService {
@Composable
override fun showRoomListTopBarIndicator(): State<Boolean> {
val canVerifySession by sessionVerificationService.canVerifySessionFlow.collectAsState(initial = false)

View file

@ -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})?"

View file

@ -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`.")

View file

@ -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`.")

View file

@ -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].

View file

@ -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/"

View file

@ -27,7 +27,6 @@ import kotlinx.collections.immutable.ImmutableList
*/
@Immutable
sealed interface PermalinkData {
data class RoomLink(
val roomIdOrAlias: String,
val isRoomAlias: Boolean,

View file

@ -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].
*/

View file

@ -17,5 +17,7 @@
package io.element.android.libraries.matrix.api.room
enum class CurrentUserMembership {
INVITED, JOINED, LEFT
INVITED,
JOINED,
LEFT
}

View file

@ -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"
}

View file

@ -30,7 +30,11 @@ data class RoomMember(
)
enum class RoomMembershipState {
BAN, INVITE, JOIN, KNOCK, LEAVE
BAN,
INVITE,
JOIN,
KNOCK,
LEAVE
}
fun RoomMember.getBestName(): String {

View file

@ -22,5 +22,7 @@ data class RoomNotificationSettings(
)
enum class RoomNotificationMode {
ALL_MESSAGES, MENTIONS_AND_KEYWORDS_ONLY, MUTE
ALL_MESSAGES,
MENTIONS_AND_KEYWORDS_ONLY,
MUTE
}

View file

@ -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.

View file

@ -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

View file

@ -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

View file

@ -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,

View file

@ -56,7 +56,6 @@ data class PollContent(
data class UnableToDecryptContent(
val data: Data
) : EventContent {
@Immutable
sealed interface Data {
data class OlmV1Curve25519AesSha2(

View file

@ -17,5 +17,6 @@
package io.element.android.libraries.matrix.api.timeline.item.event
enum class MessageFormat {
HTML, UNKNOWN
HTML,
UNKNOWN
}

View file

@ -17,5 +17,7 @@
package io.element.android.libraries.matrix.api.timeline.item.event
enum class TimelineItemEventOrigin {
LOCAL, SYNC, PAGINATION
LOCAL,
SYNC,
PAGINATION
}

View file

@ -17,7 +17,6 @@
package io.element.android.libraries.matrix.api.timeline.item.virtual
sealed interface VirtualTimelineItem {
data class DayDivider(
val timestamp: Long
) : VirtualTimelineItem

View file

@ -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).
*/

View file

@ -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")

View file

@ -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")

View file

@ -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")

View file

@ -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(

View file

@ -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"

View file

@ -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)

View file

@ -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)

View file

@ -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,

View file

@ -52,7 +52,6 @@ internal class RustEncryptionService(
sessionCoroutineScope: CoroutineScope,
private val dispatchers: CoroutineDispatchers,
) : EncryptionService {
private val service: Encryption = client.encryption()
private val backupStateMapper = BackupStateMapper()

View file

@ -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()
}

View file

@ -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

View file

@ -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 ->

View file

@ -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,

View file

@ -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

View file

@ -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()),

View file

@ -31,7 +31,6 @@ class RoomSyncSubscriber(
private val roomListService: RoomListService,
private val dispatchers: CoroutineDispatchers,
) {
private val subscriptionCounts = HashMap<RoomId, Int>()
private val mutex = Mutex()

View file

@ -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 {

View file

@ -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()
}

View file

@ -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)

View file

@ -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()

View file

@ -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,

View file

@ -33,7 +33,6 @@ class RustSyncService(
private val innerSyncService: SyncServiceInterface,
sessionCoroutineScope: CoroutineScope
) : SyncService {
override suspend fun startSync() = runCatching {
Timber.i("Start sync")
innerSyncService.start()

View file

@ -43,7 +43,6 @@ class AsyncMatrixTimeline(
dispatcher: CoroutineDispatcher,
private val timelineProvider: suspend () -> MatrixTimeline
) : MatrixTimeline {
private val _timelineItems: MutableStateFlow<List<MatrixTimelineItem>> =
MutableStateFlow(emptyList())

View file

@ -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>) {

View file

@ -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()

View file

@ -65,7 +65,6 @@ class RustMatrixTimeline(
lastLoginTimestamp: Date?,
private val onNewSyncedEvent: () -> Unit,
) : MatrixTimeline {
private val initLatch = CompletableDeferred<Unit>()
private val isInit = AtomicBoolean(false)

View file

@ -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 {

View file

@ -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),

View file

@ -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 ->

View file

@ -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())

View file

@ -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

View file

@ -24,7 +24,6 @@ data class LogEventLocation(
val file: String,
val line: UInt?,
) {
companion object {
/**
* Create a [LogEventLocation] from a [StackTraceElement].

View file

@ -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(

View file

@ -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()

View file

@ -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(),

View file

@ -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

View file

@ -40,7 +40,6 @@ class RustSessionVerificationService(
private val syncService: RustSyncService,
private val sessionCoroutineScope: CoroutineScope,
) : SessionVerificationService, SessionVerificationControllerDelegate {
var verificationController: SessionVerificationControllerInterface? = null
set(value) {
field = value

View file

@ -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)

View file

@ -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()

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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 = ""

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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() {

View file

@ -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)

View file

@ -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 {

View file

@ -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

View file

@ -21,7 +21,6 @@ import androidx.activity.result.PickVisualMediaRequest
import androidx.compose.runtime.Composable
interface PickerProvider {
@Composable
fun registerGalleryPicker(
onResult: (uri: Uri?, mimeType: String?) -> Unit

View file

@ -27,7 +27,6 @@ import org.robolectric.RobolectricTestRunner
@RunWith(RobolectricTestRunner::class)
class PickerTypeTest {
@Test
fun `ImageAndVideo - assert types`() {
val pickerType = PickerType.ImageAndVideo

View file

@ -38,7 +38,6 @@ import javax.inject.Inject
@ContributesBinding(AppScope::class)
class PickerProviderImpl(private val isInTest: Boolean) : PickerProvider {
@Inject
constructor() : this(false)

View file

@ -23,7 +23,6 @@ import kotlinx.coroutines.flow.StateFlow
* A media player for Element X.
*/
interface MediaPlayer : AutoCloseable {
/**
* The current state of the player.
*/

View file

@ -46,7 +46,6 @@ import kotlin.time.Duration.Companion.seconds
class MediaPlayerImpl @Inject constructor(
private val player: SimplePlayer,
) : MediaPlayer {
private val listener = object : SimplePlayer.Listener {
override fun onIsPlayingChanged(isPlaying: Boolean) {
_state.update {

View file

@ -30,7 +30,6 @@ class FakeMediaPlayer(
private val fakeTotalDurationMs: Long = 10_000L,
private val fakePlayedDurationMs: Long = 1000L,
) : MediaPlayer {
private val _state = MutableStateFlow(
MediaPlayer.State(
isReady = false,

View file

@ -30,7 +30,6 @@ class MediaSender @Inject constructor(
private val preProcessor: MediaPreProcessor,
private val room: MatrixRoom,
) {
private val ongoingUploadJobs = ConcurrentHashMap<Job.Key, MediaUploadHandler>()
val hasOngoingMediaUploads get() = ongoingUploadJobs.isNotEmpty()

View file

@ -23,7 +23,6 @@ import io.element.android.libraries.matrix.api.media.VideoInfo
import java.io.File
sealed interface MediaUploadInfo {
val file: File
data class Image(override val file: File, val imageInfo: ImageInfo, val thumbnailFile: File?) : MediaUploadInfo

Some files were not shown because too many files have changed in this diff Show more