13
13
// limitations under the License.
14
14
15
15
import Foundation
16
- #if os(iOS) || os(tvOS)
16
+ #if os(iOS) || os(tvOS) || os(visionOS)
17
17
import UIKit
18
18
#elseif os(macOS)
19
19
import AppKit
@@ -22,17 +22,6 @@ import Foundation
22
22
import WatchKit
23
23
#endif // os(iOS) || os(tvOS)
24
24
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
- ///
36
25
/// The SessionInitiator is responsible for:
37
26
/// 1) Running the initiate callback whenever a Session Start Event should
38
27
/// begin sending. This can happen at a cold start of the app, and when it
@@ -55,7 +44,7 @@ class SessionInitiator {
55
44
self . initiateSessionStart ( )
56
45
57
46
let notificationCenter = NotificationCenter . default
58
- #if os(iOS) || os(tvOS)
47
+ #if os(iOS) || os(tvOS) || os(visionOS)
59
48
notificationCenter. addObserver (
60
49
self ,
61
50
selector: #selector( appBackgrounded) ,
@@ -98,27 +87,6 @@ class SessionInitiator {
98
87
)
99
88
}
100
89
#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)
122
90
}
123
91
124
92
@objc private func appBackgrounded( ) {
0 commit comments