Commit 8b4e9412 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Andreas Traczyk

build: fix compile error

Fix compile errors was introduced after installing a new XCode
component

Change-Id: Ib8b4f574348f26016fd5ffbda7154a9ebd83d427
Reviewed-by: Andreas Traczyk's avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
parent 0be7410c
......@@ -259,9 +259,11 @@ class ConversationViewModel: ViewModel {
fileprivate var unreadMessagesCount: Int {
let accountHelper = AccountModelHelper(withAccount: self.accountService.currentAccount!)
return self.conversation.messages.filter({ message in
let unreadMessages = self.conversation.messages
.filter({ message in
return message.status != .read && message.author != accountHelper.ringId!
}).count
})
return unreadMessages.count
}
func sendContactRequest() {
......
......@@ -32,15 +32,16 @@ class ChatTabBarItemViewModel: ViewModel, TabBarItemViewModel {
self.itemBadgeValue = {
return conversationService.conversations.map({ conversations in
return conversations.map({ conversation in
return conversation.messages.filter({ message in
let unreadMsg = conversation.messages.filter({ message in
if let account = accountService.currentAccount {
let accountHelper = AccountModelHelper(withAccount: account)
//filtre out read messages, outgoing messages and messages that are displayed in contactrequest conversation
return message.status != .read && message.author != accountHelper.ringId
&& (contactsService.contactRequest(withRingId: message.author) == nil)
&& (contactsService.contactRequest(withRingId: message.author) == nil)
}
return false
}).count
})
return unreadMsg.count
}).reduce(0, +)
})
}()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment