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

contacts: subscribe to contact presence when accepting an invite



Change-Id: If3f3550118cace5499d204fbcc920ee779dff769
Reviewed-by: Kateryna Kostiuk's avatarKateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
parent fea7a91b
...@@ -34,6 +34,7 @@ class ContactRequestsViewModel: Stateable, ViewModel { ...@@ -34,6 +34,7 @@ class ContactRequestsViewModel: Stateable, ViewModel {
let accountsService: AccountsService let accountsService: AccountsService
let conversationService: ConversationsService let conversationService: ConversationsService
let nameService: NameService let nameService: NameService
let presenceService: PresenceService
fileprivate let disposeBag = DisposeBag() fileprivate let disposeBag = DisposeBag()
fileprivate let log = SwiftyBeaver.self fileprivate let log = SwiftyBeaver.self
...@@ -45,6 +46,7 @@ class ContactRequestsViewModel: Stateable, ViewModel { ...@@ -45,6 +46,7 @@ class ContactRequestsViewModel: Stateable, ViewModel {
self.accountsService = injectionBag.accountService self.accountsService = injectionBag.accountService
self.conversationService = injectionBag.conversationsService self.conversationService = injectionBag.conversationsService
self.nameService = injectionBag.nameService self.nameService = injectionBag.nameService
self.presenceService = injectionBag.presenceService
self.injectionBag = injectionBag self.injectionBag = injectionBag
...@@ -97,6 +99,10 @@ class ContactRequestsViewModel: Stateable, ViewModel { ...@@ -97,6 +99,10 @@ class ContactRequestsViewModel: Stateable, ViewModel {
}) })
.disposed(by: disposeBag) .disposed(by: disposeBag)
self.presenceService.subscribeBuddy(withAccountId: (self.accountsService.currentAccount?.id)!,
withUri: item.contactRequest.ringId,
withFlag: true)
if let vCard = item.contactRequest.vCard { if let vCard = item.contactRequest.vCard {
let saveVCardCompleted = self.contactsService.saveVCard(vCard: vCard, forContactWithRingId: item.contactRequest.ringId) let saveVCardCompleted = self.contactsService.saveVCard(vCard: vCard, forContactWithRingId: item.contactRequest.ringId)
return Observable<Void>.zip(acceptCompleted, saveVCardCompleted) { _, _ in return Observable<Void>.zip(acceptCompleted, saveVCardCompleted) { _, _ in
......
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