File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed
app/src/main/java/com/infomaniak/mail Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,6 @@ import com.infomaniak.lib.core.utils.Utils.enumValueOfOrNull
24
24
import com.infomaniak.mail.data.models.Attachment
25
25
import com.infomaniak.mail.data.models.correspondent.Recipient
26
26
import com.infomaniak.mail.ui.newMessage.BodyContentPayload
27
- import com.infomaniak.mail.ui.newMessage.BodyContentType
28
27
import io.realm.kotlin.ext.realmListOf
29
28
import io.realm.kotlin.serializers.RealmListKSerializer
30
29
import io.realm.kotlin.types.RealmList
@@ -89,7 +88,7 @@ class Draft : RealmObject {
89
88
// region UI data (Transient & Ignore)
90
89
@Transient
91
90
@Ignore
92
- var uiBody: BodyContentPayload = BodyContentPayload ( " " , BodyContentType . TEXT_PLAIN_WITHOUT_HTML , isSanitized = true )
91
+ var uiBody: BodyContentPayload = BodyContentPayload .emptyBody( )
93
92
@Transient
94
93
@Ignore
95
94
var uiSignature: String? = null
Original file line number Diff line number Diff line change @@ -24,6 +24,12 @@ package com.infomaniak.mail.ui.newMessage
24
24
* @param isSanitized Is only required and cannot be omitted when [type] is [BodyContentType.HTML]. This describes whether or not
25
25
* the HTML can skip sanitization when we know it's already been sanitized earlier.
26
26
*/
27
- data class BodyContentPayload (val content : String , val type : BodyContentType , val isSanitized : Boolean? = null )
27
+ data class BodyContentPayload (val content : String , val type : BodyContentType , val isSanitized : Boolean? = null ) {
28
+ companion object {
29
+ fun emptyBody (): BodyContentPayload {
30
+ return BodyContentPayload (" " , BodyContentType .TEXT_PLAIN_WITHOUT_HTML )
31
+ }
32
+ }
33
+ }
28
34
29
35
enum class BodyContentType { HTML , TEXT_PLAIN_WITH_HTML , TEXT_PLAIN_WITHOUT_HTML }
Original file line number Diff line number Diff line change @@ -598,7 +598,7 @@ class NewMessageViewModel @Inject constructor(
598
598
599
599
val bodyContent: String? = mailToIntent?.body?.takeIf (String ::isNotEmpty) ? : intent?.getStringExtra(Intent .EXTRA_TEXT )
600
600
val mailToPayload = bodyContent?.let { BodyContentPayload (it, BodyContentType .TEXT_PLAIN_WITH_HTML ) }
601
- uiBody = mailToPayload ? : BodyContentPayload ( " " , BodyContentType . TEXT_PLAIN_WITHOUT_HTML )
601
+ uiBody = mailToPayload ? : BodyContentPayload .emptyBody( )
602
602
}
603
603
}
604
604
You can’t perform that action at this time.
0 commit comments