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

@ -138,7 +138,7 @@ class WithHeldTests : InstrumentedTest {
@Test
@Ignore("This test will be ignored until it is fixed")
fun test_WithHeldNoOlm() {
fun test_WithHeldNoOlm() {
val testData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoom()
val aliceSession = testData.firstSession
val bobSession = testData.secondSession!!

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

@ -130,7 +130,7 @@ inline fun <T> MXUsersDevicesMap<T>.forEach(action: (String, String, T) -> Unit)
}
}
internal fun <T> MXUsersDevicesMap<T>.toDebugString() =
internal fun <T> MXUsersDevicesMap<T>.toDebugString() =
map.entries.joinToString { "${it.key} [${it.value.keys.joinToString { it }}]" }
internal fun <T> MXUsersDevicesMap<T>.toDebugCount() =

View File

@ -70,7 +70,7 @@ object HkdfSha256 {
T(2) = HMAC-Hash(PRK, T(1) | info | 0x02)
T(3) = HMAC-Hash(PRK, T(2) | info | 0x03)
...
*/
*/
val n = ceil(outputLength.toDouble() / HASH_LEN.toDouble()).toInt()
var stepHash = ByteArray(0) // T(0) empty string (zero length)

View File

@ -364,14 +364,14 @@ internal class DefaultVerificationService @Inject constructor(
dispatchRequestAdded(pendingVerificationRequest)
/*
* After the m.key.verification.ready event is sent, either party can send an m.key.verification.start event
* to begin the verification.
* If both parties send an m.key.verification.start event, and they both specify the same verification method,
* then the event sent by the user whose user ID is the smallest is used, and the other m.key.verification.start
* event is ignored.
* In the case of a single user verifying two of their devices, the device ID is compared instead.
* If both parties send an m.key.verification.start event, but they specify different verification methods,
* the verification should be cancelled with a code of m.unexpected_message.
* After the m.key.verification.ready event is sent, either party can send an m.key.verification.start event
* to begin the verification.
* If both parties send an m.key.verification.start event, and they both specify the same verification method,
* then the event sent by the user whose user ID is the smallest is used, and the other m.key.verification.start
* event is ignored.
* In the case of a single user verifying two of their devices, the device ID is compared instead.
* If both parties send an m.key.verification.start event, but they specify different verification methods,
* the verification should be cancelled with a code of m.unexpected_message.
*/
}

View File

@ -21,9 +21,9 @@ 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,
private val taskExecutor: TaskExecutor
internal class DefaultCacheService @Inject constructor(
@SessionDatabase private val clearCacheTask: ClearCacheTask,
private val taskExecutor: TaskExecutor
) : CacheService {
override suspend fun clearCache() {

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

@ -88,10 +88,10 @@ internal class DefaultWidgetPostAPIMediator @Inject constructor(private val mosh
}
/*
* *********************************************************************************************
* Message sending methods
* *********************************************************************************************
*/
* *********************************************************************************************
* Message sending methods
* *********************************************************************************************
*/
/**
* Send a boolean response

View File

@ -93,7 +93,7 @@ class TestLinkifyActivity : AppCompatActivity() {
.show()
}
})
*/
*/
}
subViews.testLinkifyCustomText.apply {
@ -108,7 +108,7 @@ class TestLinkifyActivity : AppCompatActivity() {
.show()
}
})
*/
*/
// TODO Call VectorLinkify.addLinks(text)
}

View File

@ -90,7 +90,7 @@ object BadgeProxy {
}
}
}
*/
*/
}
/**
@ -124,6 +124,6 @@ object BadgeProxy {
Timber.v("## updateBadgeCount(): badge update count=$unreadRoomsCount")
updateBadgeCount(aContext, unreadRoomsCount)
}
*/
*/
}
}

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,
private val rawService: RawService,
val session: Session) :
class CreateDirectRoomViewModel @AssistedInject constructor(
@Assisted initialState: CreateDirectRoomViewState,
private val rawService: RawService,
val session: Session
) :
VectorViewModel<CreateDirectRoomViewState, CreateDirectRoomAction, CreateDirectRoomViewEvents>(initialState) {
@AssistedFactory

View File

@ -52,7 +52,7 @@ class KeysBackupRestoreActivity : SimpleFragmentActivity() {
super.onBackPressed()
}
@Inject lateinit var activeSessionHolder: ActiveSessionHolder
@Inject lateinit var activeSessionHolder: ActiveSessionHolder
override fun initUiAndData() {
super.initUiAndData()

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,16 +69,16 @@ 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,
private val eventHtmlRenderer: Lazy<EventHtmlRenderer>,
private val htmlCompressor: VectorHtmlCompressor,
private val session: Session,
private val noticeEventFormatter: NoticeEventFormatter,
private val errorFormatter: ErrorFormatter,
private val stringProvider: StringProvider,
private val pillsPostProcessorFactory: PillsPostProcessor.Factory,
private val vectorPreferences: VectorPreferences
class MessageActionsViewModel @AssistedInject constructor(
@Assisted private val initialState: MessageActionState,
private val eventHtmlRenderer: Lazy<EventHtmlRenderer>,
private val htmlCompressor: VectorHtmlCompressor,
private val session: Session,
private val noticeEventFormatter: NoticeEventFormatter,
private val errorFormatter: ErrorFormatter,
private val stringProvider: StringProvider,
private val pillsPostProcessorFactory: PillsPostProcessor.Factory,
private val vectorPreferences: VectorPreferences
) : VectorViewModel<MessageActionState, MessageActionsAction, EmptyViewEvents>(initialState) {
private val informationData = initialState.informationData

View File

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

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,
session: Session,
val stringProvider: StringProvider) :
VectorViewModel<InviteUsersToRoomViewState, InviteUsersToRoomAction, InviteUsersToRoomViewEvents>(initialState) {
class InviteUsersToRoomViewModel @AssistedInject constructor(
@Assisted initialState: InviteUsersToRoomViewState,
session: Session,
val stringProvider: StringProvider
) : VectorViewModel<InviteUsersToRoomViewState, InviteUsersToRoomAction, InviteUsersToRoomViewEvents>(initialState) {
private val room = session.getRoom(initialState.roomId)!!

View File

@ -275,7 +275,7 @@ class LoginViewModel @AssistedInject constructor(
code = MatrixError.FORBIDDEN,
message = "Registration is disabled"
), 403))
*/
*/
} catch (failure: Throwable) {
if (failure !is CancellationException) {
_viewEvents.post(LoginViewEvents.Failure(failure))

View File

@ -771,7 +771,7 @@ class LoginViewModel2 @AssistedInject constructor(
),
httpCode = 403
)
*/
*/
LoginViewEvents2.OpenSignUpChooseUsernameScreen
} catch (throwable: Throwable) {

View File

@ -202,7 +202,7 @@ class NotificationBroadcastReceiver : BroadcastReceiver() {
VectorApp.getInstance().notificationDrawerManager.refreshNotificationDrawer(null)
}
})
*/
*/
}
private fun getReplyMessage(intent: Intent?): String? {

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

View File

@ -359,7 +359,7 @@ class VectorSettingsGeneralFragment @Inject constructor(
startActivityForResult(intent, REQUEST_PHONEBOOK_COUNTRY)
true
}
*/
*/
}
// ==============================================================================================================

View File

@ -117,7 +117,7 @@ class VectorSettingsPreferencesFragment @Inject constructor(
false
}
}
*/
*/
// update keep medias period
findPreference<VectorPreference>(VectorPreferences.SETTINGS_MEDIA_SAVING_PERIOD_KEY)!!.let {