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

presence: fix updates when app returns to active state

Change-Id: I2db33cb2efbdafe9bdb4b212abb89520d2b2c7d4
parent e41e580f
No related branches found
No related tags found
No related merge requests found
......@@ -269,6 +269,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
func applicationDidBecomeActive(_ application: UIApplication) {
self.clearBadgeNumber()
guard let account = self.accountService.currentAccount else { return }
self.presenceService.subscribeBuddies(withAccount: account.id, withContacts: self.contactsService.contacts.value, subscribe: true)
}
func applicationWillResignActive(_ application: UIApplication) {
guard let account = self.accountService.currentAccount else { return }
self.presenceService.subscribeBuddies(withAccount: account.id, withContacts: self.contactsService.contacts.value, subscribe: false)
}
func prepareVideoAcceleration() {
......
......@@ -57,6 +57,10 @@ class PresenceService {
func subscribeBuddy(withAccountId accountId: String,
withUri uri: String,
withFlag flag: Bool) {
if flag && contactPresence[uri] != nil {
// already subscribed
return
}
presenceAdapter.subscribeBuddy(withURI: uri, withAccountId: accountId, withFlag: flag)
if !flag {
contactPresence[uri] = nil
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment