From db83f465bf0857c52e6dbd059bf289eac4ffa1d7 Mon Sep 17 00:00:00 2001 From: Bruno Muniz Azevedo Filho <bruno@elixxir.io> Date: Wed, 22 Jun 2022 02:01:19 -0300 Subject: [PATCH] Cleaned PushHandler --- Sources/PushFeature/PushHandler.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/PushFeature/PushHandler.swift b/Sources/PushFeature/PushHandler.swift index fcf5e150..4259476e 100644 --- a/Sources/PushFeature/PushHandler.swift +++ b/Sources/PushFeature/PushHandler.swift @@ -1,6 +1,7 @@ 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) } -- GitLab