Update plugin ktlint to v12.1.0 (#2200)

* Update plugin ktlint to v12.1.0

* Run `./gradlew ktlintFormat` and fix some issues manually.

* Fix other issues reproted by Ktlint

* Limit false positives, KtLint removes unnecessary curly brace in String templates.

* Remove useless Unit

* Minor improvements over ktlint changes

* Restore `AlertDialogContent` behaviour

* Update screenshots

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Benoit Marty <benoit@matrix.org>
Co-authored-by: Jorge Martín <jorgem@element.io>
Co-authored-by: ElementBot <benoitm+elementbot@element.io>
This commit is contained in:
renovate[bot] 2024-01-10 16:22:24 +01:00 committed by GitHub
parent 7e1866818e
commit c8bd362397
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
442 changed files with 1091 additions and 1081 deletions

View file

@ -105,7 +105,7 @@ class RustMatrixClient(
override val sessionId: UserId = UserId(client.userId())
private val innerRoomListService = syncService.roomListService()
private val sessionDispatcher = dispatchers.io.limitedParallelism(64)
private val sessionCoroutineScope = appCoroutineScope.childScope(dispatchers.main, "Session-${sessionId}")
private val sessionCoroutineScope = appCoroutineScope.childScope(dispatchers.main, "Session-$sessionId")
private val rustSyncService = RustSyncService(syncService, sessionCoroutineScope)
private val verificationService = RustSessionVerificationService(rustSyncService, sessionCoroutineScope)
private val pushersService = RustPushersService(
@ -137,7 +137,7 @@ class RustMatrixClient(
Timber.w("didReceiveAuthError(isSoftLogout=$isSoftLogout)")
if (isLoggingOut.getAndSet(true).not()) {
Timber.v("didReceiveAuthError -> do the cleanup")
//TODO handle isSoftLogout parameter.
// TODO handle isSoftLogout parameter.
appCoroutineScope.launch {
val existingData = sessionStore.getSession(client.userId())
if (existingData != null) {
@ -204,7 +204,7 @@ class RustMatrixClient(
// Check if already in memory...
var cachedPairOfRoom = pairOfRoom(roomId)
if (cachedPairOfRoom == null) {
//... otherwise, lets wait for the SS to load all rooms and check again.
// ... otherwise, lets wait for the SS to load all rooms and check again.
roomListService.allRooms.awaitLoaded()
cachedPairOfRoom = pairOfRoom(roomId)
}

View file

@ -29,7 +29,7 @@ class MediaUploadHandlerImpl(
runCatching {
sendAttachmentJoinHandle.join()
}
.also { cleanUpFiles() }
.also { cleanUpFiles() }
override fun cancel() {
sendAttachmentJoinHandle.cancel()

View file

@ -43,7 +43,7 @@ class MatrixRoomInfoMapper(
canonicalAlias = it.canonicalAlias,
alternativeAliases = it.alternativeAliases.toImmutableList(),
currentUserMembership = it.membership.map(),
latestEvent = it.latestEvent?.use (timelineItemMapper::map),
latestEvent = it.latestEvent?.use(timelineItemMapper::map),
inviter = it.inviter?.use(RoomMemberMapper::map),
activeMembersCount = it.activeMembersCount.toLong(),
invitedMembersCount = it.invitedMembersCount.toLong(),
@ -57,13 +57,13 @@ class MatrixRoomInfoMapper(
}
}
fun RustMembership.map(): CurrentUserMembership = when(this) {
fun RustMembership.map(): CurrentUserMembership = when (this) {
RustMembership.INVITED -> CurrentUserMembership.INVITED
RustMembership.JOINED -> CurrentUserMembership.JOINED
RustMembership.LEFT -> CurrentUserMembership.LEFT
}
fun RustRoomNotificationMode.map(): RoomNotificationMode = when(this) {
fun RustRoomNotificationMode.map(): RoomNotificationMode = when (this) {
RustRoomNotificationMode.ALL_MESSAGES -> RoomNotificationMode.ALL_MESSAGES
RustRoomNotificationMode.MENTIONS_AND_KEYWORDS_ONLY -> RoomNotificationMode.MENTIONS_AND_KEYWORDS_ONLY
RustRoomNotificationMode.MUTE -> RoomNotificationMode.MUTE

View file

@ -122,7 +122,7 @@ class RustMatrixRoom(
// Create a dispatcher for all room methods...
private val roomDispatcher = coroutineDispatchers.io.limitedParallelism(32)
//...except getMember methods as it could quickly fill the roomDispatcher...
// ...except getMember methods as it could quickly fill the roomDispatcher...
private val roomMembersDispatcher = coroutineDispatchers.io.limitedParallelism(8)
private val roomCoroutineScope = sessionCoroutineScope.childScope(coroutineDispatchers.main, "RoomScope-$roomId")

View file

@ -135,4 +135,3 @@ private fun DynamicRoomList.Filter.toRustFilter(): RoomListEntriesDynamicFilterK
DynamicRoomList.Filter.AllNonLeft -> RoomListEntriesDynamicFilterKind.AllNonLeft
}
}

View file

@ -45,4 +45,3 @@ class RoomSummaryDetailsFactory(private val roomMessageFactory: RoomMessageFacto
)
}
}

View file

@ -257,7 +257,7 @@ class RustMatrixTimeline(
private fun List<MatrixTimelineItem>.hasEncryptionHistoryBanner(): Boolean {
val firstItem = firstOrNull()
return firstItem is MatrixTimelineItem.Virtual
&& firstItem.virtual is VirtualTimelineItem.EncryptedHistoryBanner
return firstItem is MatrixTimelineItem.Virtual &&
firstItem.virtual is VirtualTimelineItem.EncryptedHistoryBanner
}
}

View file

@ -100,11 +100,11 @@ private fun List<Reaction>?.map(): ImmutableList<EventReaction> {
private fun Map<String, RustReceipt>.map(): ImmutableList<Receipt> {
return map {
Receipt(
userId = UserId(it.key),
timestamp = it.value.timestamp?.toLong() ?: 0
)
}
Receipt(
userId = UserId(it.key),
timestamp = it.value.timestamp?.toLong() ?: 0
)
}
.sortedByDescending { it.timestamp }
.toImmutableList()
}

View file

@ -147,7 +147,7 @@ private fun RustMembershipChange.map(): MembershipChange {
}
}
//TODO extract state events?
// TODO extract state events?
private fun RustOtherState.map(): OtherState {
return when (this) {
is RustOtherState.Custom -> OtherState.Custom(eventType)

View file

@ -34,7 +34,7 @@ class RustWidgetDriver(
widgetSettings: MatrixWidgetSettings,
private val room: Room,
private val widgetCapabilitiesProvider: WidgetCapabilitiesProvider,
): MatrixWidgetDriver {
) : 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

@ -41,12 +41,12 @@ class AuthenticationExceptionMappingTest {
@Test
fun `mapping specific exceptions map to their kotlin counterparts`() {
assertThat(RustAuthenticationException.ClientMissing("Client missing").mapAuthenticationException())
.isException<AuthenticationException.ClientMissing>("Client missing")
.isException<AuthenticationException.ClientMissing>("Client missing")
assertThat(RustAuthenticationException.Generic("Generic").mapAuthenticationException()).isException<AuthenticationException.Generic>("Generic")
assertThat(RustAuthenticationException.InvalidServerName("Invalid server name").mapAuthenticationException())
.isException<AuthenticationException.InvalidServerName>("Invalid server name")
.isException<AuthenticationException.InvalidServerName>("Invalid server name")
assertThat(RustAuthenticationException.SessionMissing("Session missing").mapAuthenticationException())
.isException<AuthenticationException.SessionMissing>("Session missing")