Skip to content

Commit

Permalink
Merge pull request #712 from Infomaniak/refresh-realm-new-message
Browse files Browse the repository at this point in the history
fix(NotificationService): Refresh realm after fetching messages
  • Loading branch information
PhilippeWeidmann committed Apr 21, 2023
2 parents cc7acd3 + 40aabe6 commit 087977d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion MailNotificationServiceExtension/NotificationService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ class NotificationService: UNNotificationServiceExtension {
}
try await mailboxManager.threads(folder: inboxFolder.freezeIfNeeded())

@ThreadSafe var message = mailboxManager.getRealm().object(ofType: Message.self, forPrimaryKey: uid)
let realm = mailboxManager.getRealm()
realm.refresh()
@ThreadSafe var message = realm.object(ofType: Message.self, forPrimaryKey: uid)

if let message,
!message.fullyDownloaded {
Expand Down

0 comments on commit 087977d

Please sign in to comment.