mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Update shared context
This commit is contained in:
@@ -23,6 +23,7 @@ final class SharedNotificationManager {
|
||||
private let episodeId: UInt32
|
||||
|
||||
private let clearNotificationsManager: ClearNotificationsManager
|
||||
private let pollLiveLocationOnce: (AccountRecordId) -> Void
|
||||
|
||||
private var inForeground: Bool = false
|
||||
private var inForegroundDisposable: Disposable?
|
||||
@@ -34,11 +35,12 @@ final class SharedNotificationManager {
|
||||
|
||||
private var pollStateContexts: [AccountRecordId: PollStateContext] = [:]
|
||||
|
||||
init(episodeId: UInt32, clearNotificationsManager: ClearNotificationsManager, inForeground: Signal<Bool, NoError>, accounts: Signal<[(Account, Bool)], NoError>) {
|
||||
init(episodeId: UInt32, clearNotificationsManager: ClearNotificationsManager, inForeground: Signal<Bool, NoError>, accounts: Signal<[(Account, Bool)], NoError>, pollLiveLocationOnce: @escaping (AccountRecordId) -> Void) {
|
||||
assert(Queue.mainQueue().isCurrent())
|
||||
|
||||
self.episodeId = episodeId
|
||||
self.clearNotificationsManager = clearNotificationsManager
|
||||
self.pollLiveLocationOnce = pollLiveLocationOnce
|
||||
|
||||
self.inForegroundDisposable = (inForeground
|
||||
|> deliverOnMainQueue).start(next: { [weak self] value in
|
||||
@@ -348,7 +350,9 @@ final class SharedNotificationManager {
|
||||
}
|
||||
}
|
||||
if isLocationPolling {
|
||||
//addedWakeups.insert(.backgroundLocation)
|
||||
if !self.inForeground || !isCurrent {
|
||||
self.pollLiveLocationOnce(account.id)
|
||||
}
|
||||
}
|
||||
|
||||
if let readMessageId = readMessageId {
|
||||
|
||||
Reference in New Issue
Block a user