Skip to content

Commit 9d66c15

Browse files
committed
change session background listener for session background
1 parent a9503fd commit 9d66c15

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

FirebaseSessions/Sources/SessionInitiator.swift

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,22 @@ class SessionInitiator {
4545

4646
let notificationCenter = NotificationCenter.default
4747
#if os(iOS) || os(tvOS) || os(visionOS)
48-
notificationCenter.addObserver(
49-
self,
50-
selector: #selector(appBackgrounded),
51-
name: UIApplication.didEnterBackgroundNotification,
52-
object: nil
53-
)
48+
// Change background update event listerner for iPadOS 26 multi-windowing supoort
49+
if #available(iOS 26, *), UIDevice.current.systemName.lowercased().contains("ipados") {
50+
notificationCenter.addObserver(
51+
self,
52+
selector: #selector(appBackgrounded),
53+
name: UIApplication.willResignActiveNotification,
54+
object: nil
55+
)
56+
} else {
57+
notificationCenter.addObserver(
58+
self,
59+
selector: #selector(appBackgrounded),
60+
name: UIApplication.didEnterBackgroundNotification,
61+
object: nil
62+
)
63+
}
5464
notificationCenter.addObserver(
5565
self,
5666
selector: #selector(appForegrounded),

0 commit comments

Comments
 (0)