Restore account presence manager updates

This commit is contained in:
Ali 2023-09-26 18:47:51 +04:00
parent 1b3cfcb124
commit 9eb8bf93a7
2 changed files with 10 additions and 2 deletions

View File

@ -1196,7 +1196,7 @@ public class Account {
self.accountPresenceManager.isPerformingUpdate() |> map { presenceUpdate in
if presenceUpdate {
print("accountPresenceManager isPerformingUpdate: true")
return []
//return []
}
return presenceUpdate ? AccountRunningImportantTasks.other : []
},

View File

@ -16,6 +16,8 @@ private final class AccountPresenceManagerImpl {
private let currentRequestDisposable = MetaDisposable()
private var onlineTimer: SignalKitTimer?
private var wasOnline: Bool = false
init(queue: Queue, shouldKeepOnlinePresence: Signal<Bool, NoError>, network: Network) {
self.queue = queue
self.network = network
@ -23,7 +25,13 @@ private final class AccountPresenceManagerImpl {
self.shouldKeepOnlinePresenceDisposable = (shouldKeepOnlinePresence
|> distinctUntilChanged
|> deliverOn(self.queue)).start(next: { [weak self] value in
self?.updatePresence(value)
guard let self else {
return
}
if self.wasOnline != value {
self.wasOnline = value
self.updatePresence(value)
}
})
}