Skip to content
Snippets Groups Projects
Commit db83f465 authored by Bruno Muniz's avatar Bruno Muniz :apple:
Browse files

Cleaned PushHandler

parent 09426404
No related branches found
No related tags found
2 merge requests!40v1.1.2b166,!38Using new database structure
import UIKit
import Models
import Defaults
import XXModels
import Integration
import DependencyInjection
......@@ -102,15 +103,14 @@ public final class PushHandler: PushHandling {
return
}
let dbManager = GRDBDatabaseManager()
try? dbManager.setup()
let tuples: [(String, Push)] = pushes.compactMap {
guard let userId = $0.source, let contact: Contact = try? dbManager.fetch(.withUserId(userId)).first else {
guard let userId = $0.source,
let dbManager = try? Database.inMemory(),
let contact = try? dbManager.fetchContacts(.init(id: [userId])).first else {
return ($0.type.unknownSenderContent!, $0)
}
let name = contact.nickname ?? contact.username
let name = contact.nickname ?? contact.username!
return ($0.type.knownSenderContent(name)!, $0)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment