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

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

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

@ -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 }}]" } map.entries.joinToString { "${it.key} [${it.value.keys.joinToString { it }}]" }
internal fun <T> MXUsersDevicesMap<T>.toDebugCount() = internal fun <T> MXUsersDevicesMap<T>.toDebugCount() =

View File

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

View File

@ -364,14 +364,14 @@ internal class DefaultVerificationService @Inject constructor(
dispatchRequestAdded(pendingVerificationRequest) dispatchRequestAdded(pendingVerificationRequest)
/* /*
* After the m.key.verification.ready event is sent, either party can send an m.key.verification.start event * After the m.key.verification.ready event is sent, either party can send an m.key.verification.start event
* to begin the verification. * to begin the verification.
* If both parties send an m.key.verification.start event, and they both specify the same verification method, * 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 * 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. * event is ignored.
* In the case of a single user verifying two of their devices, the device ID is compared instead. * 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, * 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. * 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 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 {
override suspend fun clearCache() { 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 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

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

View File

@ -93,7 +93,7 @@ class TestLinkifyActivity : AppCompatActivity() {
.show() .show()
} }
}) })
*/ */
} }
subViews.testLinkifyCustomText.apply { subViews.testLinkifyCustomText.apply {
@ -108,7 +108,7 @@ class TestLinkifyActivity : AppCompatActivity() {
.show() .show()
} }
}) })
*/ */
// TODO Call VectorLinkify.addLinks(text) // 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") Timber.v("## updateBadgeCount(): badge update count=$unreadRoomsCount")
updateBadgeCount(aContext, 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.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

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

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,16 +69,16 @@ 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,
private val noticeEventFormatter: NoticeEventFormatter, private val noticeEventFormatter: NoticeEventFormatter,
private val errorFormatter: ErrorFormatter, private val errorFormatter: ErrorFormatter,
private val stringProvider: StringProvider, private val stringProvider: StringProvider,
private val pillsPostProcessorFactory: PillsPostProcessor.Factory, private val pillsPostProcessorFactory: PillsPostProcessor.Factory,
private val vectorPreferences: VectorPreferences private val vectorPreferences: VectorPreferences
) : VectorViewModel<MessageActionState, MessageActionsAction, EmptyViewEvents>(initialState) { ) : VectorViewModel<MessageActionState, MessageActionsAction, EmptyViewEvents>(initialState) {
private val informationData = initialState.informationData 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 * 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) {
private val roomId = initialState.roomId 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 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

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

View File

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

View File

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

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

View File

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

View File

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