refactor: add sender to be the person to trigger the legacy message send (in case of closed group updates)

This commit is contained in:
0x330a
2023-11-13 10:33:48 +11:00
parent d12bce54bd
commit 56878dbd35
5 changed files with 36 additions and 8 deletions

View File

@@ -175,6 +175,8 @@ interface StorageProtocol {
fun isPinned(threadID: Long): Boolean
fun deleteConversation(threadID: Long)
fun setThreadDate(threadId: Long, newDate: Long)
fun getLastLegacyRecipient(threadRecipient: String): String?
fun setLastLegacyRecipient(threadRecipient: String, senderRecipient: String?)
// Contacts
fun getContactWithSessionID(sessionID: String): Contact?
@@ -226,7 +228,11 @@ interface StorageProtocol {
fun getExpirationConfiguration(threadId: Long): ExpirationConfiguration?
fun setExpirationConfiguration(config: ExpirationConfiguration)
fun getExpiringMessages(messageIds: List<Long> = emptyList()): List<Pair<Long, Long>>
fun updateDisappearingState(threadID: Long, disappearingState: Recipient.DisappearingState)
fun updateDisappearingState(
messageSender: String,
threadID: Long,
disappearingState: Recipient.DisappearingState
)
// Shared configs
fun notifyConfigUpdates(forConfigObject: ConfigBase, messageTimestamp: Long)

View File

@@ -307,7 +307,7 @@ fun MessageReceiver.updateExpiryIfNeeded(
if (!recipient.isGroupRecipient && !recipient.isLocalNumber) {
val disappearingState = if (proto.hasExpirationType()) Recipient.DisappearingState.UPDATED else Recipient.DisappearingState.LEGACY
storage.updateDisappearingState(threadID, disappearingState)
storage.updateDisappearingState(message.sender!!, threadID, disappearingState)
}
remoteConfig.takeIf { localConfig == null || it.updatedTimestampMs > localConfig.updatedTimestampMs }