Fix expirationTime for call links.
This commit is contained in:
parent
7611b2421d
commit
d473ff6e86
1 changed files with 8 additions and 5 deletions
|
@ -10,6 +10,7 @@ import okio.ByteString.Companion.toByteString
|
|||
import org.signal.ringrtc.CallLinkState
|
||||
import org.thoughtcrime.securesms.backup.v2.ArchiveRecipient
|
||||
import org.thoughtcrime.securesms.backup.v2.proto.CallLink
|
||||
import org.thoughtcrime.securesms.backup.v2.util.clampToValidBackupRange
|
||||
import org.thoughtcrime.securesms.database.CallLinkTable
|
||||
import java.io.Closeable
|
||||
|
||||
|
@ -28,17 +29,19 @@ class CallLinkArchiveExporter(private val cursor: Cursor) : Iterator<ArchiveReci
|
|||
}
|
||||
|
||||
val callLink = CallLinkTable.CallLinkDeserializer.deserialize(cursor)
|
||||
val expirationTime = try {
|
||||
callLink.state.expiration.toEpochMilli()
|
||||
} catch (e: ArithmeticException) {
|
||||
Long.MAX_VALUE
|
||||
}
|
||||
|
||||
return ArchiveRecipient(
|
||||
id = callLink.recipientId.toLong(),
|
||||
callLink = CallLink(
|
||||
rootKey = callLink.credentials!!.linkKeyBytes.toByteString(),
|
||||
adminKey = callLink.credentials.adminPassBytes?.toByteString(),
|
||||
name = callLink.state.name,
|
||||
expirationMs = try {
|
||||
callLink.state.expiration.toEpochMilli()
|
||||
} catch (e: ArithmeticException) {
|
||||
Long.MAX_VALUE
|
||||
},
|
||||
expirationMs = expirationTime.takeIf { it != Long.MAX_VALUE }?.clampToValidBackupRange() ?: 0,
|
||||
restrictions = callLink.state.restrictions.toRemote()
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue