diff --git a/build.gradle b/build.gradle index b9792511d6..8ac546ac54 100644 --- a/build.gradle +++ b/build.gradle @@ -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", ] } } diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/gossiping/WithHeldTests.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/gossiping/WithHeldTests.kt index 65c65660b5..e8f6eea460 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/gossiping/WithHeldTests.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/gossiping/WithHeldTests.kt @@ -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!! diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/CryptoModule.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/CryptoModule.kt index 3130a6382f..2265526484 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/CryptoModule.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/CryptoModule.kt @@ -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) } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/model/MXUsersDevicesMap.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/model/MXUsersDevicesMap.kt index 662541428e..bdb00dce8e 100755 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/model/MXUsersDevicesMap.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/model/MXUsersDevicesMap.kt @@ -130,7 +130,7 @@ inline fun MXUsersDevicesMap.forEach(action: (String, String, T) -> Unit) } } -internal fun MXUsersDevicesMap.toDebugString() = +internal fun MXUsersDevicesMap.toDebugString() = map.entries.joinToString { "${it.key} [${it.value.keys.joinToString { it }}]" } internal fun MXUsersDevicesMap.toDebugCount() = diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/tools/HkdfSha256.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/tools/HkdfSha256.kt index 6839ccd326..04ce0d8500 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/tools/HkdfSha256.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/tools/HkdfSha256.kt @@ -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) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/DefaultVerificationService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/DefaultVerificationService.kt index 388ecb9659..bd623575fa 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/DefaultVerificationService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/verification/DefaultVerificationService.kt @@ -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. */ } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/cache/DefaultCacheService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/cache/DefaultCacheService.kt index 6d0cd37e1f..93b0dba13e 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/cache/DefaultCacheService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/cache/DefaultCacheService.kt @@ -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() { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/user/accountdata/DirectChatsHelper.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/user/accountdata/DirectChatsHelper.kt index c7b125b5d6..c4fbdc75ab 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/user/accountdata/DirectChatsHelper.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/user/accountdata/DirectChatsHelper.kt @@ -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 diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/DefaultWidgetPostAPIMediator.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/DefaultWidgetPostAPIMediator.kt index 07f7c7cb86..1fa5e5f771 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/DefaultWidgetPostAPIMediator.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/widgets/DefaultWidgetPostAPIMediator.kt @@ -88,10 +88,10 @@ internal class DefaultWidgetPostAPIMediator @Inject constructor(private val mosh } /* - * ********************************************************************************************* - * Message sending methods - * ********************************************************************************************* - */ + * ********************************************************************************************* + * Message sending methods + * ********************************************************************************************* + */ /** * Send a boolean response diff --git a/vector/src/debug/java/im/vector/app/features/debug/TestLinkifyActivity.kt b/vector/src/debug/java/im/vector/app/features/debug/TestLinkifyActivity.kt index 88e55d6760..59c60e0e15 100644 --- a/vector/src/debug/java/im/vector/app/features/debug/TestLinkifyActivity.kt +++ b/vector/src/debug/java/im/vector/app/features/debug/TestLinkifyActivity.kt @@ -93,7 +93,7 @@ class TestLinkifyActivity : AppCompatActivity() { .show() } }) - */ + */ } subViews.testLinkifyCustomText.apply { @@ -108,7 +108,7 @@ class TestLinkifyActivity : AppCompatActivity() { .show() } }) - */ + */ // TODO Call VectorLinkify.addLinks(text) } diff --git a/vector/src/main/java/im/vector/app/features/badge/BadgeProxy.kt b/vector/src/main/java/im/vector/app/features/badge/BadgeProxy.kt index 3df33b0c9b..fb597d1ef9 100644 --- a/vector/src/main/java/im/vector/app/features/badge/BadgeProxy.kt +++ b/vector/src/main/java/im/vector/app/features/badge/BadgeProxy.kt @@ -90,7 +90,7 @@ object BadgeProxy { } } } - */ + */ } /** @@ -124,6 +124,6 @@ object BadgeProxy { Timber.v("## updateBadgeCount(): badge update count=$unreadRoomsCount") updateBadgeCount(aContext, unreadRoomsCount) } - */ + */ } } diff --git a/vector/src/main/java/im/vector/app/features/createdirect/CreateDirectRoomViewModel.kt b/vector/src/main/java/im/vector/app/features/createdirect/CreateDirectRoomViewModel.kt index d3011496d2..9ce8e68dab 100644 --- a/vector/src/main/java/im/vector/app/features/createdirect/CreateDirectRoomViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/createdirect/CreateDirectRoomViewModel.kt @@ -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(initialState) { @AssistedFactory diff --git a/vector/src/main/java/im/vector/app/features/crypto/keysbackup/restore/KeysBackupRestoreActivity.kt b/vector/src/main/java/im/vector/app/features/crypto/keysbackup/restore/KeysBackupRestoreActivity.kt index 6e5d7f5fab..a4f6587be4 100644 --- a/vector/src/main/java/im/vector/app/features/crypto/keysbackup/restore/KeysBackupRestoreActivity.kt +++ b/vector/src/main/java/im/vector/app/features/crypto/keysbackup/restore/KeysBackupRestoreActivity.kt @@ -52,7 +52,7 @@ class KeysBackupRestoreActivity : SimpleFragmentActivity() { super.onBackPressed() } - @Inject lateinit var activeSessionHolder: ActiveSessionHolder + @Inject lateinit var activeSessionHolder: ActiveSessionHolder override fun initUiAndData() { super.initUiAndData() diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt index 9c754e042c..81b037e016 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt @@ -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 } diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/action/MessageActionsViewModel.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/action/MessageActionsViewModel.kt index bd4e93b25d..aaaecb0a13 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/action/MessageActionsViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/action/MessageActionsViewModel.kt @@ -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, - 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, + 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(initialState) { private val informationData = initialState.informationData diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/reactions/ViewReactionsViewModel.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/reactions/ViewReactionsViewModel.kt index 25d6f907b5..29b8c207df 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/reactions/ViewReactionsViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/reactions/ViewReactionsViewModel.kt @@ -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(initialState) { private val roomId = initialState.roomId diff --git a/vector/src/main/java/im/vector/app/features/invite/InviteUsersToRoomViewModel.kt b/vector/src/main/java/im/vector/app/features/invite/InviteUsersToRoomViewModel.kt index 891194040e..42f08c334e 100644 --- a/vector/src/main/java/im/vector/app/features/invite/InviteUsersToRoomViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/invite/InviteUsersToRoomViewModel.kt @@ -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(initialState) { +class InviteUsersToRoomViewModel @AssistedInject constructor( + @Assisted initialState: InviteUsersToRoomViewState, + session: Session, + val stringProvider: StringProvider +) : VectorViewModel(initialState) { private val room = session.getRoom(initialState.roomId)!! diff --git a/vector/src/main/java/im/vector/app/features/login/LoginViewModel.kt b/vector/src/main/java/im/vector/app/features/login/LoginViewModel.kt index 246c3ad464..73f5c064e7 100644 --- a/vector/src/main/java/im/vector/app/features/login/LoginViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/login/LoginViewModel.kt @@ -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)) diff --git a/vector/src/main/java/im/vector/app/features/login2/LoginViewModel2.kt b/vector/src/main/java/im/vector/app/features/login2/LoginViewModel2.kt index 8125c6e089..62f0007104 100644 --- a/vector/src/main/java/im/vector/app/features/login2/LoginViewModel2.kt +++ b/vector/src/main/java/im/vector/app/features/login2/LoginViewModel2.kt @@ -771,7 +771,7 @@ class LoginViewModel2 @AssistedInject constructor( ), httpCode = 403 ) - */ + */ LoginViewEvents2.OpenSignUpChooseUsernameScreen } catch (throwable: Throwable) { diff --git a/vector/src/main/java/im/vector/app/features/notifications/NotificationBroadcastReceiver.kt b/vector/src/main/java/im/vector/app/features/notifications/NotificationBroadcastReceiver.kt index 01c1117ab2..505f4cc4a0 100644 --- a/vector/src/main/java/im/vector/app/features/notifications/NotificationBroadcastReceiver.kt +++ b/vector/src/main/java/im/vector/app/features/notifications/NotificationBroadcastReceiver.kt @@ -202,7 +202,7 @@ class NotificationBroadcastReceiver : BroadcastReceiver() { VectorApp.getInstance().notificationDrawerManager.refreshNotificationDrawer(null) } }) - */ + */ } private fun getReplyMessage(intent: Intent?): String? { diff --git a/vector/src/main/java/im/vector/app/features/roomdirectory/roompreview/RoomPreviewNoPreviewFragment.kt b/vector/src/main/java/im/vector/app/features/roomdirectory/roompreview/RoomPreviewNoPreviewFragment.kt index 6d0195fae3..90f1a4785d 100644 --- a/vector/src/main/java/im/vector/app/features/roomdirectory/roompreview/RoomPreviewNoPreviewFragment.kt +++ b/vector/src/main/java/im/vector/app/features/roomdirectory/roompreview/RoomPreviewNoPreviewFragment.kt @@ -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 diff --git a/vector/src/main/java/im/vector/app/features/settings/VectorSettingsGeneralFragment.kt b/vector/src/main/java/im/vector/app/features/settings/VectorSettingsGeneralFragment.kt index ffb9fc4af4..db6b4002a0 100644 --- a/vector/src/main/java/im/vector/app/features/settings/VectorSettingsGeneralFragment.kt +++ b/vector/src/main/java/im/vector/app/features/settings/VectorSettingsGeneralFragment.kt @@ -359,7 +359,7 @@ class VectorSettingsGeneralFragment @Inject constructor( startActivityForResult(intent, REQUEST_PHONEBOOK_COUNTRY) true } - */ + */ } // ============================================================================================================== diff --git a/vector/src/main/java/im/vector/app/features/settings/VectorSettingsPreferencesFragment.kt b/vector/src/main/java/im/vector/app/features/settings/VectorSettingsPreferencesFragment.kt index 50e32ae453..fa020c8d26 100644 --- a/vector/src/main/java/im/vector/app/features/settings/VectorSettingsPreferencesFragment.kt +++ b/vector/src/main/java/im/vector/app/features/settings/VectorSettingsPreferencesFragment.kt @@ -117,7 +117,7 @@ class VectorSettingsPreferencesFragment @Inject constructor( false } } - */ + */ // update keep medias period findPreference(VectorPreferences.SETTINGS_MEDIA_SAVING_PERIOD_KEY)!!.let {