From 40aabe6f9beb3816d02e82f5bc9b2e7639aab951 Mon Sep 17 00:00:00 2001 From: Philippe Weidmann Date: Fri, 21 Apr 2023 08:27:16 +0200 Subject: [PATCH] fix(NotificationService): Refresh realm after fetching messages --- MailNotificationServiceExtension/NotificationService.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MailNotificationServiceExtension/NotificationService.swift b/MailNotificationServiceExtension/NotificationService.swift index 14a8018ac..bb0a85a20 100644 --- a/MailNotificationServiceExtension/NotificationService.swift +++ b/MailNotificationServiceExtension/NotificationService.swift @@ -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 {