mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-16 08:19:23 +00:00
Add postbox transaction guard
This commit is contained in:
parent
841ecaba39
commit
f00b1ea21b
@ -324,6 +324,8 @@ public final class SharedWakeupManager {
|
||||
private func updateAccounts(hasTasks: Bool) {
|
||||
if self.inForeground || self.hasActiveAudioSession || self.isInBackgroundExtension || (hasTasks && self.currentExternalCompletion != nil) || self.activeExplicitExtensionTimer != nil {
|
||||
for (account, primary, tasks) in self.accountsAndTasks {
|
||||
account.postbox.setCanBeginTransactions(true)
|
||||
|
||||
if (self.inForeground && primary) || !tasks.isEmpty || (self.activeExplicitExtensionTimer != nil && primary) {
|
||||
account.shouldBeServiceTaskMaster.set(.single(.always))
|
||||
} else {
|
||||
@ -335,6 +337,7 @@ public final class SharedWakeupManager {
|
||||
}
|
||||
} else {
|
||||
for (account, _, _) in self.accountsAndTasks {
|
||||
account.postbox.setCanBeginTransactions(false)
|
||||
account.shouldBeServiceTaskMaster.set(.single(.never))
|
||||
account.shouldKeepOnlinePresence.set(.single(false))
|
||||
account.shouldKeepBackgroundDownloadConnections.set(.single(false))
|
||||
|
Loading…
x
Reference in New Issue
Block a user