Skip to content
Snippets Groups Projects
Commit 422262d1 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk
Browse files

conversation: fix contact status

This patch fixes the presence status for conversations
imported from another device.

Change-Id: I0959d78d210e63a030367d4bb605870e9b806ec0
parent 13431bd4
No related branches found
No related tags found
No related merge requests found
...@@ -184,7 +184,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD ...@@ -184,7 +184,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
dataTransferService: self.dataTransferService, dataTransferService: self.dataTransferService,
callService: self.callService, callService: self.callService,
locationSharingService: self.locationSharingService, contactsService: self.contactsService, locationSharingService: self.locationSharingService, contactsService: self.contactsService,
callsProvider: self.callsProvider, requestsService: self.requestsService, profileService: self.profileService) callsProvider: self.callsProvider, requestsService: self.requestsService, profileService: self.profileService,
presenceService: self.presenceService)
self.videoManager = VideoManager(with: self.callService, videoService: self.videoService) self.videoManager = VideoManager(with: self.callService, videoService: self.videoService)
self.window?.rootViewController = self.appCoordinator.rootViewController self.window?.rootViewController = self.appCoordinator.rootViewController
self.window?.makeKeyAndVisible() self.window?.makeKeyAndVisible()
......
...@@ -41,6 +41,7 @@ class ConversationsManager { ...@@ -41,6 +41,7 @@ class ConversationsManager {
private let callsProvider: CallsProviderService private let callsProvider: CallsProviderService
private let requestService: RequestsService private let requestService: RequestsService
private let profileService: ProfilesService private let profileService: ProfilesService
private let presenceService: PresenceService
private let disposeBag = DisposeBag() private let disposeBag = DisposeBag()
private let textPlainMIMEType = "text/plain" private let textPlainMIMEType = "text/plain"
...@@ -60,7 +61,8 @@ class ConversationsManager { ...@@ -60,7 +61,8 @@ class ConversationsManager {
contactsService: ContactsService, contactsService: ContactsService,
callsProvider: CallsProviderService, callsProvider: CallsProviderService,
requestsService: RequestsService, requestsService: RequestsService,
profileService: ProfilesService) { profileService: ProfilesService,
presenceService: PresenceService) {
self.conversationService = conversationService self.conversationService = conversationService
self.accountsService = accountsService self.accountsService = accountsService
self.nameService = nameService self.nameService = nameService
...@@ -71,6 +73,7 @@ class ConversationsManager { ...@@ -71,6 +73,7 @@ class ConversationsManager {
self.callsProvider = callsProvider self.callsProvider = callsProvider
self.requestService = requestsService self.requestService = requestsService
self.profileService = profileService self.profileService = profileService
self.presenceService = presenceService
ProfilesAdapter.delegate = self ProfilesAdapter.delegate = self
ConversationsAdapter.messagesDelegate = self ConversationsAdapter.messagesDelegate = self
...@@ -258,12 +261,14 @@ class ConversationsManager { ...@@ -258,12 +261,14 @@ class ConversationsManager {
let accountId: String = event.getEventInput(.accountId), let accountId: String = event.getEventInput(.accountId),
let jamiId: String = event.getEventInput(.peerUri), let jamiId: String = event.getEventInput(.peerUri),
let account = self.accountsService.getAccount(fromAccountId: accountId), let account = self.accountsService.getAccount(fromAccountId: accountId),
account.isJams,
let currentAccount = self.accountsService.currentAccount, let currentAccount = self.accountsService.currentAccount,
account == currentAccount, account == currentAccount,
let contact = self.contactsService.contact(withHash: jamiId), let contact = self.contactsService.contact(withHash: jamiId)
!contact.conversationId.isEmpty
else { return } else { return }
if !contact.banned {
self.presenceService.subscribeBuddy(withAccountId: accountId, withJamiId: jamiId, withFlag: true)
}
guard account.isJams, !contact.conversationId.isEmpty else { return }
self.conversationService.addSwarmConversationId(conversationId: contact.conversationId, accountId: accountId, jamiId: jamiId) self.conversationService.addSwarmConversationId(conversationId: contact.conversationId, accountId: accountId, jamiId: jamiId)
}) })
.disposed(by: self.disposeBag) .disposed(by: self.disposeBag)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment