Fix threading bug

This commit is contained in:
Niels Andriesse 2021-08-03 09:58:50 +10:00
parent 9b525f77b6
commit e8d8377a04
1 changed files with 5 additions and 1 deletions

View File

@ -288,7 +288,11 @@ extension MessageReceiver {
// Notify the user if needed
guard (isMainAppAndActive || isBackgroundPoll), let tsIncomingMessage = TSMessage.fetch(uniqueId: tsMessageID, transaction: transaction) as? TSIncomingMessage,
let thread = TSThread.fetch(uniqueId: threadID, transaction: transaction) else { return tsMessageID }
SSKEnvironment.shared.notificationsManager!.notifyUser(for: tsIncomingMessage, in: thread, transaction: transaction)
DispatchQueue.main.async {
Storage.read { transaction in
SSKEnvironment.shared.notificationsManager!.notifyUser(for: tsIncomingMessage, in: thread, transaction: transaction)
}
}
return tsMessageID
}