From 21bef5bcd9e1545da600008d8c27004f7b7e9453 Mon Sep 17 00:00:00 2001
From: Bruno Muniz Azevedo Filho <bruno@elixxir.io>
Date: Fri, 24 Jun 2022 12:25:09 -0300
Subject: [PATCH] Updated version of db package an fixed push handler

---
 Package.swift                                              | 2 +-
 Sources/PushFeature/PushHandler.swift                      | 7 ++++++-
 .../xcshareddata/swiftpm/Package.resolved                  | 4 ++--
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/Package.swift b/Package.swift
index e57b0998..13d77d0c 100644
--- a/Package.swift
+++ b/Package.swift
@@ -66,7 +66,7 @@ let package = Package(
         .package(url: "https://github.com/pointfreeco/combine-schedulers", from: "0.5.0"),
         .package(url: "https://github.com/kishikawakatsumi/KeychainAccess", from: "4.2.1"),
         .package(url: "https://github.com/google/google-api-objectivec-client-for-rest", from: "1.6.0"),
-        .package(url: "https://git.xx.network/elixxir/client-ios-db.git", .upToNextMajor(from: "1.0.1")),
+        .package(url: "https://git.xx.network/elixxir/client-ios-db.git", .upToNextMajor(from: "1.0.2")),
         .package(url: "https://github.com/firebase/firebase-ios-sdk.git", .upToNextMajor(from: "8.10.0")),
         .package(url: "https://github.com/pointfreeco/swift-composable-architecture.git",.upToNextMajor(from: "0.32.0"))
     ],
diff --git a/Sources/PushFeature/PushHandler.swift b/Sources/PushFeature/PushHandler.swift
index adb0feb4..f750c575 100644
--- a/Sources/PushFeature/PushHandler.swift
+++ b/Sources/PushFeature/PushHandler.swift
@@ -103,9 +103,14 @@ public final class PushHandler: PushHandling {
             return
         }
 
+        let dbPath = FileManager.default
+            .containerURL(forSecurityApplicationGroupIdentifier: "group.elixxir.messenger")!
+            .appendingPathComponent("xxm_database")
+            .appendingPathExtension("sqlite").path
+
         let tuples: [(String, Push)] = pushes.compactMap {
             guard let userId = $0.source,
-                  let dbManager = try? Database.inMemory(),
+                  let dbManager = try? Database.onDisk(path: dbPath),
                   let contact = try? dbManager.fetchContacts(.init(id: [userId])).first else {
                 return ($0.type.unknownSenderContent!, $0)
             }
diff --git a/client-ios.xcworkspace/xcshareddata/swiftpm/Package.resolved b/client-ios.xcworkspace/xcshareddata/swiftpm/Package.resolved
index ac651bcc..f47e17c7 100644
--- a/client-ios.xcworkspace/xcshareddata/swiftpm/Package.resolved
+++ b/client-ios.xcworkspace/xcshareddata/swiftpm/Package.resolved
@@ -50,8 +50,8 @@
       "kind" : "remoteSourceControl",
       "location" : "https://git.xx.network/elixxir/client-ios-db.git",
       "state" : {
-        "revision" : "8674619071b9e2aa909b0626b0b37e64129c4841",
-        "version" : "1.0.1"
+        "revision" : "0fde5504ee087c13c5181b205869ea7dbffed900",
+        "version" : "1.0.2"
       }
     },
     {
-- 
GitLab