Fix some ktlint issues, ignore some others

This commit is contained in:
Benoit Marty 2022-03-28 16:35:03 +02:00 committed by Benoit Marty
parent 4c40615871
commit ff1fb63bf6
23 changed files with 72 additions and 69 deletions

View File

@ -101,7 +101,16 @@ allprojects {
"spacing-between-declarations-with-comments",
"no-multi-spaces",
"experimental:spacing-between-declarations-with-annotations",
"experimental:annotation"
"experimental:annotation",
// - Missing newline after "("
// - Missing newline before ")"
"wrapping",
// - Unnecessary trailing comma before ")"
"experimental:trailing-comma",
// - A block comment in between other elements on the same line is disallowed
"experimental:comment-wrapping",
// - A KDoc comment after any other element on the same line must be separated by a new line
"experimental:kdoc-wrapping",
]
}
}

View File

@ -137,8 +137,7 @@ internal abstract class CryptoModule {
@JvmStatic
@Provides
@CryptoDatabase
fun providesClearCacheTask(@CryptoDatabase
realmConfiguration: RealmConfiguration): ClearCacheTask {
fun providesClearCacheTask(@CryptoDatabase realmConfiguration: RealmConfiguration): ClearCacheTask {
return RealmClearCacheTask(realmConfiguration)
}

View File

@ -21,8 +21,8 @@ import org.matrix.android.sdk.internal.di.SessionDatabase
import org.matrix.android.sdk.internal.task.TaskExecutor
import javax.inject.Inject
internal class DefaultCacheService @Inject constructor(@SessionDatabase
private val clearCacheTask: ClearCacheTask,
internal class DefaultCacheService @Inject constructor(
@SessionDatabase private val clearCacheTask: ClearCacheTask,
private val taskExecutor: TaskExecutor
) : CacheService {

View File

@ -24,8 +24,9 @@ import org.matrix.android.sdk.internal.di.SessionDatabase
import org.matrix.android.sdk.internal.session.sync.model.accountdata.DirectMessagesContent
import javax.inject.Inject
internal class DirectChatsHelper @Inject constructor(@SessionDatabase
private val realmConfiguration: RealmConfiguration) {
internal class DirectChatsHelper @Inject constructor(
@SessionDatabase private val realmConfiguration: RealmConfiguration
) {
/**
* @return a map of userId <-> list of roomId

View File

@ -38,10 +38,11 @@ import org.matrix.android.sdk.api.session.permalinks.PermalinkParser
import org.matrix.android.sdk.api.session.room.model.create.CreateRoomParams
import org.matrix.android.sdk.api.session.user.model.User
class CreateDirectRoomViewModel @AssistedInject constructor(@Assisted
initialState: CreateDirectRoomViewState,
class CreateDirectRoomViewModel @AssistedInject constructor(
@Assisted initialState: CreateDirectRoomViewState,
private val rawService: RawService,
val session: Session) :
val session: Session
) :
VectorViewModel<CreateDirectRoomViewState, CreateDirectRoomAction, CreateDirectRoomViewEvents>(initialState) {
@AssistedFactory

View File

@ -1669,7 +1669,7 @@ class TimelineFragment @Inject constructor(
is MessageComposerViewEvents.SlashCommandNotSupportedInThreads -> {
displayCommandError(getString(R.string.command_not_supported_in_threads, sendMessageResult.command.command))
}
} //
}
lockSendButton = false
}

View File

@ -69,8 +69,8 @@ import org.matrix.android.sdk.flow.unwrap
/**
* Information related to an event and used to display preview in contextual bottom sheet.
*/
class MessageActionsViewModel @AssistedInject constructor(@Assisted
private val initialState: MessageActionState,
class MessageActionsViewModel @AssistedInject constructor(
@Assisted private val initialState: MessageActionState,
private val eventHtmlRenderer: Lazy<EventHtmlRenderer>,
private val htmlCompressor: VectorHtmlCompressor,
private val session: Session,

View File

@ -56,8 +56,8 @@ data class ReactionInfo(
/**
* Used to display the list of members that reacted to a given event
*/
class ViewReactionsViewModel @AssistedInject constructor(@Assisted
initialState: DisplayReactionsViewState,
class ViewReactionsViewModel @AssistedInject constructor(
@Assisted initialState: DisplayReactionsViewState,
session: Session,
private val dateFormatter: VectorDateFormatter
) : VectorViewModel<DisplayReactionsViewState, EmptyAction, EmptyViewEvents>(initialState) {

View File

@ -28,16 +28,15 @@ import im.vector.app.core.resources.StringProvider
import im.vector.app.features.userdirectory.PendingSelection
import kotlinx.coroutines.flow.asFlow
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.launch
import org.matrix.android.sdk.api.session.Session
class InviteUsersToRoomViewModel @AssistedInject constructor(@Assisted
initialState: InviteUsersToRoomViewState,
class InviteUsersToRoomViewModel @AssistedInject constructor(
@Assisted initialState: InviteUsersToRoomViewState,
session: Session,
val stringProvider: StringProvider) :
VectorViewModel<InviteUsersToRoomViewState, InviteUsersToRoomAction, InviteUsersToRoomViewEvents>(initialState) {
val stringProvider: StringProvider
) : VectorViewModel<InviteUsersToRoomViewState, InviteUsersToRoomAction, InviteUsersToRoomViewEvents>(initialState) {
private val room = session.getRoom(initialState.roomId)!!

View File

@ -110,8 +110,7 @@ class RoomPreviewNoPreviewFragment @Inject constructor(
PeekingState.FOUND -> {
// show join buttons
views.roomPreviewNoPreviewJoin.isVisible = true
renderState(bestName, state.matrixItem(), state.roomTopic
/**, state.roomType*/)
renderState(bestName, state.matrixItem(), state.roomTopic)
if (state.fromEmailInvite != null && !state.isEmailBoundToAccount) {
views.roomPreviewNoPreviewLabel.text =
span {
@ -152,15 +151,13 @@ class RoomPreviewNoPreviewFragment @Inject constructor(
views.roomPreviewNoPreviewJoin.isVisible = true
views.roomPreviewNoPreviewLabel.isVisible = true
views.roomPreviewNoPreviewLabel.setText(R.string.room_preview_no_preview_join)
renderState(bestName, state.matrixItem().takeIf { state.roomAlias != null }, state.roomTopic
/**, state.roomType*/)
renderState(bestName, state.matrixItem().takeIf { state.roomAlias != null }, state.roomTopic)
}
else -> {
views.roomPreviewNoPreviewJoin.isVisible = false
views.roomPreviewNoPreviewLabel.isVisible = true
views.roomPreviewNoPreviewLabel.setText(R.string.room_preview_not_found)
renderState(bestName, null, state.roomTopic
/**, state.roomType*/)
renderState(bestName, null, state.roomTopic)
}
}
}
@ -168,16 +165,13 @@ class RoomPreviewNoPreviewFragment @Inject constructor(
// Render with initial state, no peeking
views.roomPreviewPeekingProgress.isVisible = false
views.roomPreviewNoPreviewJoin.isVisible = true
renderState(bestName, state.matrixItem(), state.roomTopic
/**, state.roomType*/)
renderState(bestName, state.matrixItem(), state.roomTopic)
views.roomPreviewNoPreviewLabel.isVisible = false
}
}
}
private fun renderState(roomName: String, matrixItem: MatrixItem?, topic: String?
/**, roomType: String?*/
) {
private fun renderState(roomName: String, matrixItem: MatrixItem?, topic: String?) {
// Toolbar
if (matrixItem != null) {
views.roomPreviewNoPreviewToolbarAvatar.isVisible = true