Commit f756586e authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Andreas Traczyk
Browse files

fix: Tab Bar

Fix badge value on Conversation TabBarItem:
- handle case when account does not exists
- filter out messages that shown on contact request conversation

Change-Id: Ife44a70b2d0b728876be648ebad2e3d772128ce5
Reviewed-by: Andreas Traczyk's avatarAndreas Traczyk <>
parent 743768be
......@@ -28,12 +28,18 @@ class ChatTabBarItemViewModel: ViewModel, TabBarItemViewModel {
required init(with injectionBag: InjectionBag) {
let accountService = injectionBag.accountService
let conversationService = injectionBag.conversationsService
let accountHelper = AccountModelHelper(withAccount: accountService.currentAccount!)
let contactsService = injectionBag.contactsService
self.itemBadgeValue = {
return{ conversations in
return{ conversation in
return conversation.messages.filter({ message in
return message.status != .read && != accountHelper.ringId!
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 && != accountHelper.ringId
&& (contactsService.contactRequest(withRingId: == nil)
return false
}).reduce(0, +)
Supports Markdown
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