Enable detekt rules DataClassShouldBeImmutable and fix existing issues.

This commit is contained in:
Benoit Marty
2023-07-26 11:15:52 +02:00
committed by Benoit Marty
parent d433c3cbaa
commit 8458a9e937
6 changed files with 20 additions and 21 deletions

View File

@@ -23,17 +23,15 @@ import io.element.android.libraries.matrix.api.core.SessionId
* Data class to hold information about a group of notifications for a room.
*/
data class RoomEventGroupInfo(
val sessionId: SessionId,
val roomId: RoomId,
val roomDisplayName: String,
val isDirect: Boolean = false
) {
val sessionId: SessionId,
val roomId: RoomId,
val roomDisplayName: String,
val isDirect: Boolean = false,
// An event in the list has not yet been display
var hasNewEvent: Boolean = false
val hasNewEvent: Boolean = false,
// true if at least one on the not yet displayed event is noisy
var shouldBing: Boolean = false
var customSound: String? = null
var hasSmartReplyError: Boolean = false
var isUpdated: Boolean = false
}
val shouldBing: Boolean = false,
val customSound: String? = null,
val hasSmartReplyError: Boolean = false,
val isUpdated: Boolean = false,
)

View File

@@ -85,12 +85,11 @@ class RoomGroupMessageCreator @Inject constructor(
roomId = roomId,
roomDisplayName = roomName,
isDirect = !roomIsGroup,
).also {
it.hasSmartReplyError = smartReplyErrors.isNotEmpty()
it.shouldBing = meta.shouldBing
it.customSound = events.last().soundName
it.isUpdated = events.last().isUpdated
},
hasSmartReplyError = smartReplyErrors.isNotEmpty(),
shouldBing = meta.shouldBing,
customSound = events.last().soundName,
isUpdated = events.last().isUpdated,
),
threadId = lastKnownRoomEvent.threadId,
largeIcon = largeBitmap,
lastMessageTimestamp,

View File

@@ -30,7 +30,7 @@ data class SimpleNotifiableEvent(
val type: String?,
val timestamp: Long,
val soundName: String?,
override var canBeReplaced: Boolean,
override val canBeReplaced: Boolean,
override val isRedacted: Boolean = false,
override val isUpdated: Boolean = false
) : NotifiableEvent

View File

@@ -36,7 +36,7 @@ import io.element.android.libraries.pushproviders.api.PushData
data class PushDataFirebase(
val eventId: String?,
val roomId: String?,
var unread: Int?,
val unread: Int?,
val clientSecret: String?
)

View File

@@ -47,7 +47,7 @@ data class PushDataUnifiedPush(
data class PushDataUnifiedPushNotification(
@SerialName("event_id") val eventId: String? = null,
@SerialName("room_id") val roomId: String? = null,
@SerialName("counts") var counts: PushDataUnifiedPushCounts? = null,
@SerialName("counts") val counts: PushDataUnifiedPushCounts? = null,
)
@Serializable

View File

@@ -6,6 +6,8 @@ style:
CascadingCallWrapping:
active: true
includeElvis: true
DataClassShouldBeImmutable:
active: true
MaxLineLength:
# Default is 120
maxLineLength: 160