diff --git a/libsession/src/main/java/org/session/libsession/messaging/messages/control/ClosedGroupControlMessage.kt b/libsession/src/main/java/org/session/libsession/messaging/messages/control/ClosedGroupControlMessage.kt index d7e440fe98..70c75ddce3 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/messages/control/ClosedGroupControlMessage.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/messages/control/ClosedGroupControlMessage.kt @@ -38,7 +38,7 @@ class ClosedGroupControlMessage() : ControlMessage() { object MemberLeft : Kind() object EncryptionKeyPairRequest: Kind() - val description: String = run { + val description: String = when(this) { is New -> "new" is Update -> "update" @@ -49,7 +49,6 @@ class ClosedGroupControlMessage() : ControlMessage() { MemberLeft -> "memberLeft" EncryptionKeyPairRequest -> "encryptionKeyPairRequest" } - } } companion object { diff --git a/libsession/src/main/java/org/session/libsession/messaging/messages/control/DataExtractionNotification.kt b/libsession/src/main/java/org/session/libsession/messaging/messages/control/DataExtractionNotification.kt index a612584af8..1888f66a49 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/messages/control/DataExtractionNotification.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/messages/control/DataExtractionNotification.kt @@ -14,12 +14,11 @@ class DataExtractionNotification(): ControlMessage() { class Screenshot() : Kind() class MediaSaved(val timestanp: Long) : Kind() - val description: String = run { + val description: String = when(this) { is Screenshot -> "screenshot" is MediaSaved -> "mediaSaved" } - } } companion object { @@ -27,12 +26,11 @@ class DataExtractionNotification(): ControlMessage() { fun fromProto(proto: SignalServiceProtos.Content): DataExtractionNotification? { val dataExtractionNotification = proto.dataExtractionNotification ?: return null - val kind: Kind - when(dataExtractionNotification.type) { - SignalServiceProtos.DataExtractionNotification.Type.SCREENSHOT -> kind = Kind.Screenshot() + val kind: Kind = when(dataExtractionNotification.type) { + SignalServiceProtos.DataExtractionNotification.Type.SCREENSHOT -> Kind.Screenshot() SignalServiceProtos.DataExtractionNotification.Type.MEDIA_SAVED -> { - val timestamp = if (dataExtractionNotification.hasTimestamp()) dataExtractionNotification.timestamp else 0 - kind = Kind.MediaSaved(timestamp) + val timestamp = if (dataExtractionNotification.hasTimestamp()) dataExtractionNotification.timestamp else return null + Kind.MediaSaved(timestamp) } } return DataExtractionNotification(kind) diff --git a/libsession/src/main/java/org/session/libsession/messaging/messages/control/ReadReceipt.kt b/libsession/src/main/java/org/session/libsession/messaging/messages/control/ReadReceipt.kt index 0ee1f0acf9..b430f09c41 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/messages/control/ReadReceipt.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/messages/control/ReadReceipt.kt @@ -35,7 +35,7 @@ class ReadReceipt() : ControlMessage() { override fun toProto(): SignalServiceProtos.Content? { val timestamps = timestamps if (timestamps == null) { - Log.w(ExpirationTimerUpdate.TAG, "Couldn't construct read receipt proto from: $this") + Log.w(TAG, "Couldn't construct read receipt proto from: $this") return null } val receiptProto = SignalServiceProtos.ReceiptMessage.newBuilder() @@ -46,7 +46,7 @@ class ReadReceipt() : ControlMessage() { contentProto.receiptMessage = receiptProto.build() return contentProto.build() } catch (e: Exception) { - Log.w(ExpirationTimerUpdate.TAG, "Couldn't construct read receipt proto from: $this") + Log.w(TAG, "Couldn't construct read receipt proto from: $this") return null } }