Skip to content

Commit c76c5a7

Browse files
Merge pull request #1685 from Infomaniak/Fix-Attachments-search
Fix Search with Attachment filter
2 parents 08214c6 + 592dfeb commit c76c5a7

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

app/src/main/java/com/infomaniak/mail/data/cache/mailboxContent/ThreadController.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ class ThreadController @Inject constructor(
9797
isFullyDownloaded = localMessage?.isFullyDownloaded() ?: false,
9898
isTrashed = folderRole == FolderRole.TRASH,
9999
isFromSearch = localMessage == null,
100-
latestCalendarEventResponse = localMessage?.latestCalendarEventResponse,
101100
draftLocalUuid = localMessage?.draftLocalUuid,
101+
latestCalendarEventResponse = null,
102102
)
103103

104104
localMessage?.let(remoteMessage::keepHeavyData)

app/src/main/java/com/infomaniak/mail/data/models/message/Message.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ class Message : RealmObject {
108108
//endregion
109109

110110
//region Local data (Transient)
111+
112+
// ------------- !IMPORTANT! -------------
113+
// Every field that is added in this Transient region should be declared in 'initLocalValue()' too
114+
// to avoid loosing data when updating from API.
115+
// If the Field is a "heavy data" (i.e an embedded object), it should also be added in 'keepHeavyData()'
116+
111117
@Transient
112118
@PersistedName("isFullyDownloaded")
113119
private var _isFullyDownloaded: Boolean = false
@@ -210,6 +216,7 @@ class Message : RealmObject {
210216

211217
fun keepHeavyData(message: Message) {
212218
attachments = message.attachments.copyFromRealm().toRealmList()
219+
latestCalendarEventResponse = message.latestCalendarEventResponse?.copyFromRealm(UInt.MAX_VALUE)
213220
body = message.body?.copyFromRealm()
214221

215222
// TODO: Those are unused for now, but if we ever want to use them, we need to save them here.

0 commit comments

Comments
 (0)