Skip to content

Commit

Permalink
Merge pull request #2057 from Infomaniak/fix-BIMI-blink
Browse files Browse the repository at this point in the history
Add missing parameters in `Mailbox.initLocalValues()`
  • Loading branch information
KevinBoulongne authored Sep 27, 2024
2 parents e4ca206 + d7f5168 commit 0662115
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,12 @@ class MailboxController @Inject constructor(
it.initLocalValues(
userId = userId,
quotas = localMailbox?.quotas,
inboxUnreadCount = localMailbox?.unreadCountLocal ?: 0,
inboxUnreadCount = localMailbox?.unreadCountLocal,
permissions = localMailbox?.permissions,
signatures = localMailbox?.signatures,
featureFlags = localMailbox?._featureFlags,
externalMailFlagEnabled = localMailbox?.externalMailFlagEnabled,
trustedDomains = localMailbox?.trustedDomains,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ class Mailbox : RealmObject {
@Transient
var signatures = realmListOf<Signature>()
@Transient
private var _featureFlags = realmSetOf<String>()
var _featureFlags = realmSetOf<String>()
private set
@Transient
var externalMailFlagEnabled: Boolean = false
@Transient
Expand Down Expand Up @@ -108,12 +109,25 @@ class Mailbox : RealmObject {

private fun createObjectId(userId: Int): String = "${userId}_${this.mailboxId}"

fun initLocalValues(userId: Int, quotas: Quotas?, inboxUnreadCount: Int, permissions: MailboxPermissions?) {
fun initLocalValues(
userId: Int,
quotas: Quotas?,
inboxUnreadCount: Int?,
permissions: MailboxPermissions?,
signatures: List<Signature>?,
featureFlags: Set<String>?,
externalMailFlagEnabled: Boolean?,
trustedDomains: List<String>?,
) {
this.objectId = createObjectId(userId)
this.userId = userId
this.quotas = quotas
this.unreadCountLocal = inboxUnreadCount
inboxUnreadCount?.let { this.unreadCountLocal = it }
this.permissions = permissions
signatures?.let(this.signatures::addAll)
featureFlags?.let(this._featureFlags::addAll)
externalMailFlagEnabled?.let { this.externalMailFlagEnabled = it }
trustedDomains?.let(this.trustedDomains::addAll)
}

fun getDefaultSignatureWithFallback(draftMode: DraftMode? = null): Signature {
Expand Down

0 comments on commit 0662115

Please sign in to comment.