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", "spacing-between-declarations-with-comments",
"no-multi-spaces", "no-multi-spaces",
"experimental:spacing-between-declarations-with-annotations", "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 @JvmStatic
@Provides @Provides
@CryptoDatabase @CryptoDatabase
fun providesClearCacheTask(@CryptoDatabase fun providesClearCacheTask(@CryptoDatabase realmConfiguration: RealmConfiguration): ClearCacheTask {
realmConfiguration: RealmConfiguration): ClearCacheTask {
return RealmClearCacheTask(realmConfiguration) 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 org.matrix.android.sdk.internal.task.TaskExecutor
import javax.inject.Inject import javax.inject.Inject
internal class DefaultCacheService @Inject constructor(@SessionDatabase internal class DefaultCacheService @Inject constructor(
private val clearCacheTask: ClearCacheTask, @SessionDatabase private val clearCacheTask: ClearCacheTask,
private val taskExecutor: TaskExecutor private val taskExecutor: TaskExecutor
) : CacheService { ) : 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 org.matrix.android.sdk.internal.session.sync.model.accountdata.DirectMessagesContent
import javax.inject.Inject import javax.inject.Inject
internal class DirectChatsHelper @Inject constructor(@SessionDatabase internal class DirectChatsHelper @Inject constructor(
private val realmConfiguration: RealmConfiguration) { @SessionDatabase private val realmConfiguration: RealmConfiguration
) {
/** /**
* @return a map of userId <-> list of roomId * @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.room.model.create.CreateRoomParams
import org.matrix.android.sdk.api.session.user.model.User import org.matrix.android.sdk.api.session.user.model.User
class CreateDirectRoomViewModel @AssistedInject constructor(@Assisted class CreateDirectRoomViewModel @AssistedInject constructor(
initialState: CreateDirectRoomViewState, @Assisted initialState: CreateDirectRoomViewState,
private val rawService: RawService, private val rawService: RawService,
val session: Session) : val session: Session
) :
VectorViewModel<CreateDirectRoomViewState, CreateDirectRoomAction, CreateDirectRoomViewEvents>(initialState) { VectorViewModel<CreateDirectRoomViewState, CreateDirectRoomAction, CreateDirectRoomViewEvents>(initialState) {
@AssistedFactory @AssistedFactory

View File

@ -1669,7 +1669,7 @@ class TimelineFragment @Inject constructor(
is MessageComposerViewEvents.SlashCommandNotSupportedInThreads -> { is MessageComposerViewEvents.SlashCommandNotSupportedInThreads -> {
displayCommandError(getString(R.string.command_not_supported_in_threads, sendMessageResult.command.command)) displayCommandError(getString(R.string.command_not_supported_in_threads, sendMessageResult.command.command))
} }
} // }
lockSendButton = false 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. * Information related to an event and used to display preview in contextual bottom sheet.
*/ */
class MessageActionsViewModel @AssistedInject constructor(@Assisted class MessageActionsViewModel @AssistedInject constructor(
private val initialState: MessageActionState, @Assisted private val initialState: MessageActionState,
private val eventHtmlRenderer: Lazy<EventHtmlRenderer>, private val eventHtmlRenderer: Lazy<EventHtmlRenderer>,
private val htmlCompressor: VectorHtmlCompressor, private val htmlCompressor: VectorHtmlCompressor,
private val session: Session, 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 * Used to display the list of members that reacted to a given event
*/ */
class ViewReactionsViewModel @AssistedInject constructor(@Assisted class ViewReactionsViewModel @AssistedInject constructor(
initialState: DisplayReactionsViewState, @Assisted initialState: DisplayReactionsViewState,
session: Session, session: Session,
private val dateFormatter: VectorDateFormatter private val dateFormatter: VectorDateFormatter
) : VectorViewModel<DisplayReactionsViewState, EmptyAction, EmptyViewEvents>(initialState) { ) : 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 im.vector.app.features.userdirectory.PendingSelection
import kotlinx.coroutines.flow.asFlow import kotlinx.coroutines.flow.asFlow
import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.map
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import org.matrix.android.sdk.api.session.Session import org.matrix.android.sdk.api.session.Session
class InviteUsersToRoomViewModel @AssistedInject constructor(@Assisted class InviteUsersToRoomViewModel @AssistedInject constructor(
initialState: InviteUsersToRoomViewState, @Assisted initialState: InviteUsersToRoomViewState,
session: Session, session: Session,
val stringProvider: StringProvider) : val stringProvider: StringProvider
VectorViewModel<InviteUsersToRoomViewState, InviteUsersToRoomAction, InviteUsersToRoomViewEvents>(initialState) { ) : VectorViewModel<InviteUsersToRoomViewState, InviteUsersToRoomAction, InviteUsersToRoomViewEvents>(initialState) {
private val room = session.getRoom(initialState.roomId)!! private val room = session.getRoom(initialState.roomId)!!

View File

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