From 58f970322c057051f98abea2dc41d060034b4f4d Mon Sep 17 00:00:00 2001
From: Bruno Muniz <bf2002@gmail.com>
Date: Sat, 25 Jun 2022 17:18:53 -0300
Subject: [PATCH] Fixed issue on db and working on fix drawer table cell model
 crash

---
 Package.swift                                                 | 2 +-
 Sources/ChatListFeature/ViewModel/ChatListViewModel.swift     | 4 +++-
 Sources/DrawerFeature/Items/DrawerTable.swift                 | 3 +++
 .../ViewModels/RequestsReceivedViewModel.swift                | 2 ++
 client-ios.xcworkspace/xcshareddata/swiftpm/Package.resolved  | 4 ++--
 5 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/Package.swift b/Package.swift
index 8c432a07..617ab061 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.4")),
+        .package(url: "https://git.xx.network/elixxir/client-ios-db.git", .upToNextMajor(from: "1.0.5")),
         .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/ChatListFeature/ViewModel/ChatListViewModel.swift b/Sources/ChatListFeature/ViewModel/ChatListViewModel.swift
index 15d1a2a0..98febff0 100644
--- a/Sources/ChatListFeature/ViewModel/ChatListViewModel.swift
+++ b/Sources/ChatListFeature/ViewModel/ChatListViewModel.swift
@@ -129,7 +129,9 @@ final class ChatListViewModel {
                     userId: session.myId,
                     authStatus: [.friend]
                 ),
-                groupChatInfoQuery: GroupChatInfo.Query(),
+                groupChatInfoQuery: GroupChatInfo.Query(
+                    authStatus: [.participating]
+                ),
                 groupQuery: Group.Query(
                     withMessages: false,
                     authStatus: [.participating]
diff --git a/Sources/DrawerFeature/Items/DrawerTable.swift b/Sources/DrawerFeature/Items/DrawerTable.swift
index bf1b8d44..726dae9f 100644
--- a/Sources/DrawerFeature/Items/DrawerTable.swift
+++ b/Sources/DrawerFeature/Items/DrawerTable.swift
@@ -74,17 +74,20 @@ public final class DrawerTable: DrawerItem {
 }
 
 public struct DrawerTableCellModel: Hashable {
+    let id: Data
     let title: String
     let image: Data?
     let isCreator: Bool
     let isConnection: Bool
 
     public init(
+        id: Data,
         title: String,
         image: Data? = nil,
         isCreator: Bool = false,
         isConnection: Bool = true
     ) {
+        self.id = id
         self.title = title
         self.image = image
         self.isCreator = isCreator
diff --git a/Sources/RequestsFeature/ViewModels/RequestsReceivedViewModel.swift b/Sources/RequestsFeature/ViewModels/RequestsReceivedViewModel.swift
index 78c9c7b9..158021d9 100644
--- a/Sources/RequestsFeature/ViewModels/RequestsReceivedViewModel.swift
+++ b/Sources/RequestsFeature/ViewModels/RequestsReceivedViewModel.swift
@@ -174,6 +174,7 @@ final class RequestsReceivedViewModel {
                         .filter { $0.username != nil }
                         .map {
                             DrawerTableCellModel(
+                                id: $0.id,
                                 title: $0.nickname ?? $0.username!,
                                 image: $0.photo,
                                 isCreator: $0.id == group.leaderId,
@@ -185,6 +186,7 @@ final class RequestsReceivedViewModel {
                         .filter { $0.username == nil }
                         .map {
                             DrawerTableCellModel(
+                                id: $0.id,
                                 title: "Fetching username...",
                                 image: $0.photo,
                                 isCreator: $0.id == group.leaderId,
diff --git a/client-ios.xcworkspace/xcshareddata/swiftpm/Package.resolved b/client-ios.xcworkspace/xcshareddata/swiftpm/Package.resolved
index c3d515c0..eeb145af 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" : "0c7f8f2219cde03d3fb6b2354da738a4b09234e9",
-        "version" : "1.0.4"
+        "revision" : "adf3c4b906870ecbd0d1d7208f0666939fd08665",
+        "version" : "1.0.5"
       }
     },
     {
-- 
GitLab