Closed keyboardseokmin closed 2 years ago
If swipe down the notification center screen to the bottom of screen iOS call observer like this
private var appDidBecomeActiveWorkItem: DispatchWorkItem? private extension Siren { /// Adds an observer that listens for app launching/relaunching. func addForegroundObservers() { guard applicationDidBecomeActiveObserver == nil else { return } applicationDidBecomeActiveObserver = NotificationCenter .default .addObserver(forName: UIApplication.didBecomeActiveNotification, object: nil, queue: nil) { [weak self] _ in guard let self = self else { return } self.appDidBecomeActiveWorkItem = DispatchWorkItem { self.performVersionCheck() } DispatchQueue.main.asyncAfter(deadline: .now() + 0.02, execute: self.appDidBecomeActiveWorkItem!) } } /// Adds an observer that listens for when the user enters the app switcher /// and when the app is sent to the background. func addBackgroundObservers() { if applicationWillResignActiveObserver == nil { applicationWillResignActiveObserver = NotificationCenter .default .addObserver(forName: UIApplication.willResignActiveNotification, object: nil, queue: nil) { [weak self] _ in guard let self = self else { return } self.appDidBecomeActiveWorkItem?.cancel() self.appDidBecomeActiveWorkItem = nil self.presentationManager.cleanUp() } } if applicationDidEnterBackgroundObserver == nil { applicationDidEnterBackgroundObserver = NotificationCenter .default .addObserver(forName: UIApplication.didEnterBackgroundNotification, object: nil, queue: nil) { [weak self] _ in guard let self = self else { return } self.presentationManager.cleanUp() } } } }
Can you open a PR to show the differences? Thanks.
Of course, just opened a PR : )
Info
Problem
Reason
If swipe down the notification center screen to the bottom of screen iOS call observer like this
What i solved