Skip to content

Commit 8eb85e8

Browse files
committed
[Sessions] Remove Swift 5.9 guard statements
1 parent 4e1ff95 commit 8eb85e8

File tree

2 files changed

+3
-34
lines changed

2 files changed

+3
-34
lines changed

FirebaseSessions/Sources/SessionInitiator.swift

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
import 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() {

FirebaseSessions/Tests/Unit/Mocks/MockSubscriber.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ final class MockSubscriber: SessionsSubscriber, Sendable {
3232

3333
private let _sessionThatChanged = FIRAllocatedUnfairLock<FirebaseSessions.SessionDetails?>(
3434
initialState: nil
35+
initialState: nil
3536
)
3637
private let _isDataCollectionEnabled = FIRAllocatedUnfairLock<Bool>(initialState: true)
3738

0 commit comments

Comments
 (0)