File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
app/src/main/java/com/infomaniak/mail/data Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff 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)
Original file line number Diff line number Diff 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.
You can’t perform that action at this time.
0 commit comments