1313// limitations under the License.
1414
1515import Foundation
16- #if os(iOS) || os(tvOS)
16+ #if os(iOS) || os(tvOS) || os(visionOS)
1717 import UIKit
1818#elseif os(macOS)
1919 import AppKit
@@ -22,17 +22,6 @@ import Foundation
2222 import WatchKit
2323#endif // os(iOS) || os(tvOS)
2424
25- // swift(>=5.9) implies Xcode 15+
26- // Need to have this Swift version check to use os(visionOS) macro, VisionOS support.
27- // TODO: Remove this check and add `os(visionOS)` to the `os(iOS) || os(tvOS)` conditional above
28- // when Xcode 15 is the minimum supported by Firebase.
29- #if swift(>=5.9)
30- #if os(visionOS)
31- import UIKit
32- #endif // os(visionOS)
33- #endif // swift(>=5.9)
34-
35- ///
3625/// The SessionInitiator is responsible for:
3726/// 1) Running the initiate callback whenever a Session Start Event should
3827/// begin sending. This can happen at a cold start of the app, and when it
@@ -55,7 +44,7 @@ class SessionInitiator {
5544 self . initiateSessionStart ( )
5645
5746 let notificationCenter = NotificationCenter . default
58- #if os(iOS) || os(tvOS)
47+ #if os(iOS) || os(tvOS) || os(visionOS)
5948 notificationCenter. addObserver (
6049 self ,
6150 selector: #selector( appBackgrounded) ,
@@ -98,27 +87,6 @@ class SessionInitiator {
9887 )
9988 }
10089 #endif // os(iOS) || os(tvOS)
101-
102- // swift(>=5.9) implies Xcode 15+
103- // Need to have this Swift version check to use os(visionOS) macro, VisionOS support.
104- // TODO: Remove this check and add `os(visionOS)` to the `os(iOS) || os(tvOS)` conditional above
105- // when Xcode 15 is the minimum supported by Firebase.
106- #if swift(>=5.9)
107- #if os(visionOS)
108- notificationCenter. addObserver (
109- self ,
110- selector: #selector( appBackgrounded) ,
111- name: UIApplication . didEnterBackgroundNotification,
112- object: nil
113- )
114- notificationCenter. addObserver (
115- self ,
116- selector: #selector( appForegrounded) ,
117- name: UIApplication . didBecomeActiveNotification,
118- object: nil
119- )
120- #endif // os(visionOS)
121- #endif // swift(>=5.9)
12290 }
12391
12492 @objc private func appBackgrounded( ) {
0 commit comments