From 2cbc4d4282d57841977f603fba7360676e4e6618 Mon Sep 17 00:00:00 2001 From: ialokim <ialokim@mailbox.org> Date: Wed, 20 Oct 2021 23:47:31 +0200 Subject: [PATCH] run ktLintFormat --- .../briar/desktop/contact/ContactItem.kt | 14 +++++++------- .../desktop/contact/ContactListViewModel.kt | 16 +++++++++------- .../briar/desktop/contact/ContactsViewModel.kt | 16 +++++++++------- .../contact/add/remote/AddContactDialog.kt | 2 +- .../introduction/IntroductionViewModel.kt | 2 +- 5 files changed, 27 insertions(+), 23 deletions(-) diff --git a/src/main/kotlin/org/briarproject/briar/desktop/contact/ContactItem.kt b/src/main/kotlin/org/briarproject/briar/desktop/contact/ContactItem.kt index a20bb5bf3f..7d18451058 100644 --- a/src/main/kotlin/org/briarproject/briar/desktop/contact/ContactItem.kt +++ b/src/main/kotlin/org/briarproject/briar/desktop/contact/ContactItem.kt @@ -13,13 +13,13 @@ data class ContactItem( val timestamp: Long ) { - constructor(contact: Contact, isConnected: Boolean, groupCount: MessageTracker.GroupCount) - : this( - contact, isConnected, - isEmpty = groupCount.msgCount == 0, - unread = groupCount.unreadCount, - timestamp = groupCount.latestMsgTime - ) + constructor(contact: Contact, isConnected: Boolean, groupCount: MessageTracker.GroupCount) : + this( + contact, isConnected, + isEmpty = groupCount.msgCount == 0, + unread = groupCount.unreadCount, + timestamp = groupCount.latestMsgTime + ) fun updateFromMessageHeader(h: ConversationMessageHeader): ContactItem { return copy( diff --git a/src/main/kotlin/org/briarproject/briar/desktop/contact/ContactListViewModel.kt b/src/main/kotlin/org/briarproject/briar/desktop/contact/ContactListViewModel.kt index f9a3438af8..ef763a604c 100644 --- a/src/main/kotlin/org/briarproject/briar/desktop/contact/ContactListViewModel.kt +++ b/src/main/kotlin/org/briarproject/briar/desktop/contact/ContactListViewModel.kt @@ -28,13 +28,13 @@ constructor( } init { - //todo: where/when to remove listener again? + // todo: where/when to remove listener again? eventBus.addListener(this) } private val _filteredContactList = mutableStateListOf<ContactItem>() private val _filterBy = mutableStateOf("") - private var _selectedContactIndex = -1; + private var _selectedContactIndex = -1 private val _selectedContact = mutableStateOf<ContactItem?>(null) override val contactList: List<ContactItem> = _filteredContactList @@ -56,10 +56,12 @@ constructor( private fun updateFilteredList() { _filteredContactList.apply { clear() - addAll(_contactList.filter { - // todo: also filter on alias? - it.contact.author.name.lowercase().contains(_filterBy.value) - }) + addAll( + _contactList.filter { + // todo: also filter on alias? + it.contact.author.name.lowercase().contains(_filterBy.value) + } + ) } } @@ -75,7 +77,7 @@ constructor( LOG.info("Conversation message received, updating item") updateItem(e.contactId) { it.updateFromMessageHeader(e.messageHeader) } } - //is AvatarUpdatedEvent -> {} + // is AvatarUpdatedEvent -> {} is ContactAliasChangedEvent -> { updateItem(e.contactId) { it.updateAlias(e.alias) } } diff --git a/src/main/kotlin/org/briarproject/briar/desktop/contact/ContactsViewModel.kt b/src/main/kotlin/org/briarproject/briar/desktop/contact/ContactsViewModel.kt index 61a5622903..ffd994358e 100644 --- a/src/main/kotlin/org/briarproject/briar/desktop/contact/ContactsViewModel.kt +++ b/src/main/kotlin/org/briarproject/briar/desktop/contact/ContactsViewModel.kt @@ -34,13 +34,15 @@ abstract class ContactsViewModel( open fun loadContacts() { _contactList.apply { clear() - addAll(contactManager.contacts.filter(::filterContact).map { contact -> - ContactItem( - contact, - connectionRegistry.isConnected(contact.id), - conversationManager.getGroupCount(contact.id), - ) - }) + addAll( + contactManager.contacts.filter(::filterContact).map { contact -> + ContactItem( + contact, + connectionRegistry.isConnected(contact.id), + conversationManager.getGroupCount(contact.id), + ) + } + ) } } diff --git a/src/main/kotlin/org/briarproject/briar/desktop/contact/add/remote/AddContactDialog.kt b/src/main/kotlin/org/briarproject/briar/desktop/contact/add/remote/AddContactDialog.kt index f6da667938..db2f6dc506 100644 --- a/src/main/kotlin/org/briarproject/briar/desktop/contact/add/remote/AddContactDialog.kt +++ b/src/main/kotlin/org/briarproject/briar/desktop/contact/add/remote/AddContactDialog.kt @@ -25,7 +25,7 @@ import androidx.compose.ui.unit.sp @Composable fun AddContactDialog(viewModel: AddContactViewModel, onClose: () -> Unit) { LaunchedEffect("fetchHandshake") { - //todo: should instead be done automatically as soon as DB is loaded -> in view model + // todo: should instead be done automatically as soon as DB is loaded -> in view model viewModel.fetchHandshakeLink() } AlertDialog( diff --git a/src/main/kotlin/org/briarproject/briar/desktop/introduction/IntroductionViewModel.kt b/src/main/kotlin/org/briarproject/briar/desktop/introduction/IntroductionViewModel.kt index 0d64fda2b8..3b2e3f393c 100644 --- a/src/main/kotlin/org/briarproject/briar/desktop/introduction/IntroductionViewModel.kt +++ b/src/main/kotlin/org/briarproject/briar/desktop/introduction/IntroductionViewModel.kt @@ -26,7 +26,7 @@ constructor( } init { - //todo: where/when to remove listener again? + // todo: where/when to remove listener again? eventBus.addListener(this) } -- GitLab