mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 01:07:47 +00:00
few little fixes
This commit is contained in:
parent
c0e7f05d91
commit
e378d11692
@ -38,7 +38,7 @@ class ClosedGroupControlMessage() : ControlMessage() {
|
|||||||
object MemberLeft : Kind()
|
object MemberLeft : Kind()
|
||||||
object EncryptionKeyPairRequest: Kind()
|
object EncryptionKeyPairRequest: Kind()
|
||||||
|
|
||||||
val description: String = run {
|
val description: String =
|
||||||
when(this) {
|
when(this) {
|
||||||
is New -> "new"
|
is New -> "new"
|
||||||
is Update -> "update"
|
is Update -> "update"
|
||||||
@ -50,7 +50,6 @@ class ClosedGroupControlMessage() : ControlMessage() {
|
|||||||
EncryptionKeyPairRequest -> "encryptionKeyPairRequest"
|
EncryptionKeyPairRequest -> "encryptionKeyPairRequest"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val TAG = "ClosedGroupControlMessage"
|
const val TAG = "ClosedGroupControlMessage"
|
||||||
|
@ -14,25 +14,23 @@ class DataExtractionNotification(): ControlMessage() {
|
|||||||
class Screenshot() : Kind()
|
class Screenshot() : Kind()
|
||||||
class MediaSaved(val timestanp: Long) : Kind()
|
class MediaSaved(val timestanp: Long) : Kind()
|
||||||
|
|
||||||
val description: String = run {
|
val description: String =
|
||||||
when(this) {
|
when(this) {
|
||||||
is Screenshot -> "screenshot"
|
is Screenshot -> "screenshot"
|
||||||
is MediaSaved -> "mediaSaved"
|
is MediaSaved -> "mediaSaved"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val TAG = "DataExtractionNotification"
|
const val TAG = "DataExtractionNotification"
|
||||||
|
|
||||||
fun fromProto(proto: SignalServiceProtos.Content): DataExtractionNotification? {
|
fun fromProto(proto: SignalServiceProtos.Content): DataExtractionNotification? {
|
||||||
val dataExtractionNotification = proto.dataExtractionNotification ?: return null
|
val dataExtractionNotification = proto.dataExtractionNotification ?: return null
|
||||||
val kind: Kind
|
val kind: Kind = when(dataExtractionNotification.type) {
|
||||||
when(dataExtractionNotification.type) {
|
SignalServiceProtos.DataExtractionNotification.Type.SCREENSHOT -> Kind.Screenshot()
|
||||||
SignalServiceProtos.DataExtractionNotification.Type.SCREENSHOT -> kind = Kind.Screenshot()
|
|
||||||
SignalServiceProtos.DataExtractionNotification.Type.MEDIA_SAVED -> {
|
SignalServiceProtos.DataExtractionNotification.Type.MEDIA_SAVED -> {
|
||||||
val timestamp = if (dataExtractionNotification.hasTimestamp()) dataExtractionNotification.timestamp else 0
|
val timestamp = if (dataExtractionNotification.hasTimestamp()) dataExtractionNotification.timestamp else return null
|
||||||
kind = Kind.MediaSaved(timestamp)
|
Kind.MediaSaved(timestamp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return DataExtractionNotification(kind)
|
return DataExtractionNotification(kind)
|
||||||
|
@ -35,7 +35,7 @@ class ReadReceipt() : ControlMessage() {
|
|||||||
override fun toProto(): SignalServiceProtos.Content? {
|
override fun toProto(): SignalServiceProtos.Content? {
|
||||||
val timestamps = timestamps
|
val timestamps = timestamps
|
||||||
if (timestamps == null) {
|
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
|
return null
|
||||||
}
|
}
|
||||||
val receiptProto = SignalServiceProtos.ReceiptMessage.newBuilder()
|
val receiptProto = SignalServiceProtos.ReceiptMessage.newBuilder()
|
||||||
@ -46,7 +46,7 @@ class ReadReceipt() : ControlMessage() {
|
|||||||
contentProto.receiptMessage = receiptProto.build()
|
contentProto.receiptMessage = receiptProto.build()
|
||||||
return contentProto.build()
|
return contentProto.build()
|
||||||
} catch (e: Exception) {
|
} 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
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user