Skip to content
Snippets Groups Projects
Commit 22c94d14 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Kateryna Kostiuk
Browse files

presence: unsubscribe when app is in background

Change-Id: Ie15efebd03ea57e1ba9b7c33c406ac4e940a75ae
parent 99e288b9
No related branches found
No related tags found
No related merge requests found
......@@ -240,16 +240,21 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
}
func reloadDataFor(account: AccountModel) {
self.contactsService.loadContacts(withAccount: account)
self.contactsService.loadContactRequests(withAccount: account.id)
self.presenceService.subscribeBuddies(withAccount: account.id, withContacts: self.contactsService.contacts.value, subscribe: true)
self.conversationManager?
.prepareConversationsForAccount(accountId: account.id)
let state = UIApplication.shared.applicationState
if state == .active {
self.contactsService.loadContacts(withAccount: account)
self.contactsService.loadContactRequests(withAccount: account.id)
self.presenceService.subscribeBuddies(withAccount: account.id, withContacts: self.contactsService.contacts.value, subscribe: true)
self.conversationManager?
.prepareConversationsForAccount(accountId: account.id)
}
}
func applicationDidEnterBackground(_ application: UIApplication) {
self.log.warning("entering background")
self.callService.muteCurrentCallVideoVideo( mute: true)
guard let account = self.accountService.currentAccount else { return }
self.presenceService.subscribeBuddies(withAccount: account.id, withContacts: self.contactsService.contacts.value, subscribe: false)
}
func applicationWillEnterForeground(_ application: UIApplication) {
......@@ -257,6 +262,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
self.daemonService.connectivityChanged()
self.updateNotificationAvailability()
self.callService.muteCurrentCallVideoVideo( mute: false)
guard let account = self.accountService.currentAccount else { return }
self.presenceService.subscribeBuddies(withAccount: account.id, withContacts: self.contactsService.contacts.value, subscribe: true)
}
func applicationWillTerminate(_ application: UIApplication) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment