Skip to content

Commit

Permalink
feat: Don't forget to create a new Thread if we receive a snoozed Mes…
Browse files Browse the repository at this point in the history
…sage for the 1st time
  • Loading branch information
KevinBoulongne committed Mar 10, 2025
1 parent e3c3822 commit 3f0b73c
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,11 @@ val snoozeRefreshStrategy = object : DefaultRefreshStrategy {
impactedThreadsManaged: MutableSet<Thread>,
realm: MutableRealm,
) {
val localMessage = MessageController.getMessage(remoteMessage.uid, realm)

MessageController.getMessage(remoteMessage.uid, realm)?.let { localMessage ->
if (localMessage == null) {
super.handleAddedMessage(scope, remoteMessage, isConversationMode, impactedThreadsManaged, realm)
} else {
remoteMessage.initLocalValues(
date = localMessage.date,
isFullyDownloaded = localMessage.isFullyDownloaded(),
Expand All @@ -93,11 +96,11 @@ val snoozeRefreshStrategy = object : DefaultRefreshStrategy {
latestCalendarEventResponse = localMessage.latestCalendarEventResponse,
swissTransferFiles = localMessage.swissTransferFiles,
)
remoteMessage.keepHeavyData(localMessage)
}

val updatedMessage = MessageController.upsertMessage(remoteMessage, realm)
remoteMessage.keepHeavyData(localMessage)

impactedThreadsManaged += updatedMessage.threads
val updatedMessage = MessageController.upsertMessage(remoteMessage, realm)
impactedThreadsManaged += updatedMessage.threads
}
}
}

0 comments on commit 3f0b73c

Please sign in to comment.