diff --git a/Sources/ChatFeature/Controllers/GroupChatController.swift b/Sources/ChatFeature/Controllers/GroupChatController.swift index c4da099e02c599f90cf55f6c49f28ca3676c90a4..cbcabb54ac827e27e98614ad1ae5a2d81c5dc613 100644 --- a/Sources/ChatFeature/Controllers/GroupChatController.swift +++ b/Sources/ChatFeature/Controllers/GroupChatController.swift @@ -326,7 +326,9 @@ extension GroupChatController: UICollectionViewDataSource { ) -> UICollectionViewCell { let item = sections[indexPath.section].elements[indexPath.item] - let canReply: () -> Bool = { item.status == .sent || item.status == .received } + let canReply: () -> Bool = { + (item.status == .sent || item.status == .received) && item.networkId != nil + } let performReply: () -> Void = { [weak self] in self?.viewModel.didRequestReply(item) @@ -337,13 +339,13 @@ extension GroupChatController: UICollectionViewDataSource { let replyContent: (Data) -> (String, String) = viewModel.getReplyContent(for:) if item.status == .received { - if item.replyMessageId != nil { + if let replyMessageId = item.replyMessageId { let cell: IncomingGroupReplyCell = collectionView.dequeueReusableCell(forIndexPath: indexPath) Bubbler.buildReplyGroup( bubble: cell.leftView, with: item, - reply: replyContent(item.replyMessageId!), + reply: replyContent(replyMessageId), sender: name(item.senderId) ) @@ -367,13 +369,13 @@ extension GroupChatController: UICollectionViewDataSource { return cell } } else if item.status == .sendingFailed { - if item.replyMessageId != nil { + if let replyMessageId = item.replyMessageId { let cell: OutgoingFailedGroupReplyCell = collectionView.dequeueReusableCell(forIndexPath: indexPath) Bubbler.buildReplyGroup( bubble: cell.rightView, with: item, - reply: replyContent(item.replyMessageId!), + reply: replyContent(item.replyMessageId), sender: name(item.senderId) ) @@ -396,13 +398,13 @@ extension GroupChatController: UICollectionViewDataSource { return cell } } else { - if item.replyMessageId != nil { + if let replyMessageId = item.replyMessageId { let cell: OutgoingGroupReplyCell = collectionView.dequeueReusableCell(forIndexPath: indexPath) Bubbler.buildReplyGroup( bubble: cell.rightView, with: item, - reply: replyContent(item.replyMessageId!), + reply: replyContent(item.replyMessageId), sender: name(item.senderId) ) diff --git a/Sources/ContactListFeature/ViewModels/ContactListViewModel.swift b/Sources/ContactListFeature/ViewModels/ContactListViewModel.swift index a21ec093a9c251354bd208804076212166a749d4..3ef0466bb3c985f4237a4f5c8f872d78bad6a30d 100644 --- a/Sources/ContactListFeature/ViewModels/ContactListViewModel.swift +++ b/Sources/ContactListFeature/ViewModels/ContactListViewModel.swift @@ -24,8 +24,8 @@ final class ContactListViewModel { ]) return Publishers.CombineLatest( - session.dbManager.fetchContactsPublisher(contactsQuery).catch { _ in Just([]) }, - session.dbManager.fetchGroupsPublisher(groupQuery).catch { _ in Just([]) } + session.dbManager.fetchContactsPublisher(contactsQuery).assertNoFailure(), + session.dbManager.fetchGroupsPublisher(groupQuery).assertNoFailure() ) .map { $0.0.count + $0.1.count } .eraseToAnyPublisher()