From 456f4fba6ba79304a05ee0ebf4bded3f10133c92 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 18 Jul 2023 23:05:12 +0200 Subject: [PATCH] Format files. --- .../messages/impl/MessagesPresenter.kt | 2 +- .../matrix/impl/room/RustMatrixRoom.kt | 73 ++++++++----------- 2 files changed, 33 insertions(+), 42 deletions(-) diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesPresenter.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesPresenter.kt index 9fed8de105..a0a3e3a286 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesPresenter.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesPresenter.kt @@ -109,7 +109,7 @@ class MessagesPresenter @AssistedInject constructor( val syncUpdateFlow = room.syncUpdateFlow.collectAsState() val userHasPermissionToSendMessage by room.canSendMessageAsState(type = MessageEventType.ROOM_MESSAGE, updateKey = syncUpdateFlow.value) - val roomName by produceState(initialValue = room.displayName, key1 = syncUpdateFlow.value){ + val roomName by produceState(initialValue = room.displayName, key1 = syncUpdateFlow.value) { value = room.displayName } val roomAvatar by produceState(initialValue = room.avatarData(), key1 = syncUpdateFlow.value) { diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustMatrixRoom.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustMatrixRoom.kt index 0f6f9075af..8b1df21845 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustMatrixRoom.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustMatrixRoom.kt @@ -199,19 +199,17 @@ class RustMatrixRoom( } } - override suspend fun userDisplayName(userId: UserId): Result = - withContext(roomDispatcher) { - runCatching { - innerRoom.memberDisplayName(userId.value) - } + override suspend fun userDisplayName(userId: UserId): Result = withContext(roomDispatcher) { + runCatching { + innerRoom.memberDisplayName(userId.value) } + } - override suspend fun userAvatarUrl(userId: UserId): Result = - withContext(roomDispatcher) { - runCatching { - innerRoom.memberAvatarUrl(userId.value) - } + override suspend fun userAvatarUrl(userId: UserId): Result = withContext(roomDispatcher) { + runCatching { + innerRoom.memberAvatarUrl(userId.value) } + } override suspend fun sendMessage(message: String): Result = withContext(roomDispatcher) { val transactionId = genTransactionId() @@ -324,48 +322,42 @@ class RustMatrixRoom( } } - override suspend fun retrySendMessage(transactionId: TransactionId): Result = - withContext(roomDispatcher) { - runCatching { - innerRoom.retrySend(transactionId.value) - } + override suspend fun retrySendMessage(transactionId: TransactionId): Result = withContext(roomDispatcher) { + runCatching { + innerRoom.retrySend(transactionId.value) } + } - override suspend fun cancelSend(transactionId: TransactionId): Result = - withContext(roomDispatcher) { - runCatching { - innerRoom.cancelSend(transactionId.value) - } + override suspend fun cancelSend(transactionId: TransactionId): Result = withContext(roomDispatcher) { + runCatching { + innerRoom.cancelSend(transactionId.value) } + } @OptIn(ExperimentalUnsignedTypes::class) - override suspend fun updateAvatar(mimeType: String, data: ByteArray): Result = - withContext(roomDispatcher) { - runCatching { - innerRoom.uploadAvatar(mimeType, data.toUByteArray().toList()) - } + override suspend fun updateAvatar(mimeType: String, data: ByteArray): Result = withContext(roomDispatcher) { + runCatching { + innerRoom.uploadAvatar(mimeType, data.toUByteArray().toList()) } + } - override suspend fun removeAvatar(): Result = - withContext(roomDispatcher) { - runCatching { - innerRoom.removeAvatar() - } + override suspend fun removeAvatar(): Result = withContext(roomDispatcher) { + runCatching { + innerRoom.removeAvatar() } + } - override suspend fun setName(name: String): Result = - withContext(roomDispatcher) { - runCatching { - innerRoom.setName(name) - } + override suspend fun setName(name: String): Result = withContext(roomDispatcher) { + runCatching { + innerRoom.setName(name) } + } - override suspend fun setTopic(topic: String): Result = - withContext(roomDispatcher) { - runCatching { - innerRoom.setTopic(topic) - } + override suspend fun setTopic(topic: String): Result = withContext(roomDispatcher) { + runCatching { + innerRoom.setTopic(topic) } + } private suspend fun fetchMembers() = withContext(roomDispatcher) { runCatching { @@ -410,4 +402,3 @@ private suspend fun sendAttachment(handle: () -> SendAttachmentJoinHandle): Resu } } } -