mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Restore account presence manager updates
This commit is contained in:
parent
1b3cfcb124
commit
9eb8bf93a7
@ -1196,7 +1196,7 @@ public class Account {
|
|||||||
self.accountPresenceManager.isPerformingUpdate() |> map { presenceUpdate in
|
self.accountPresenceManager.isPerformingUpdate() |> map { presenceUpdate in
|
||||||
if presenceUpdate {
|
if presenceUpdate {
|
||||||
print("accountPresenceManager isPerformingUpdate: true")
|
print("accountPresenceManager isPerformingUpdate: true")
|
||||||
return []
|
//return []
|
||||||
}
|
}
|
||||||
return presenceUpdate ? AccountRunningImportantTasks.other : []
|
return presenceUpdate ? AccountRunningImportantTasks.other : []
|
||||||
},
|
},
|
||||||
|
@ -16,6 +16,8 @@ private final class AccountPresenceManagerImpl {
|
|||||||
private let currentRequestDisposable = MetaDisposable()
|
private let currentRequestDisposable = MetaDisposable()
|
||||||
private var onlineTimer: SignalKitTimer?
|
private var onlineTimer: SignalKitTimer?
|
||||||
|
|
||||||
|
private var wasOnline: Bool = false
|
||||||
|
|
||||||
init(queue: Queue, shouldKeepOnlinePresence: Signal<Bool, NoError>, network: Network) {
|
init(queue: Queue, shouldKeepOnlinePresence: Signal<Bool, NoError>, network: Network) {
|
||||||
self.queue = queue
|
self.queue = queue
|
||||||
self.network = network
|
self.network = network
|
||||||
@ -23,7 +25,13 @@ private final class AccountPresenceManagerImpl {
|
|||||||
self.shouldKeepOnlinePresenceDisposable = (shouldKeepOnlinePresence
|
self.shouldKeepOnlinePresenceDisposable = (shouldKeepOnlinePresence
|
||||||
|> distinctUntilChanged
|
|> distinctUntilChanged
|
||||||
|> deliverOn(self.queue)).start(next: { [weak self] value in
|
|> 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)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user