Skip to content

Commit 822f547

Browse files
authored
Fix Firestore visionOS build on Xcode 15.1 (#12029)
1 parent b850d1a commit 822f547

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

Firestore/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Unreleased
2+
- [fixed] Fix Firestore build for visionOS on Xcode 15.1. (#12023)
3+
14
# 10.17.0
25
- [feature] Add support for sum and average aggregate queries.
36
- [feature] The `FirebaseFirestore` module now contains Firebase Firestore's

Firestore/core/src/remote/connectivity_monitor_apple.mm

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818

1919
#if defined(__APPLE__)
2020

21-
#if TARGET_OS_IOS || TARGET_OS_TV
21+
#if TARGET_OS_IOS || TARGET_OS_TV || \
22+
(defined(TARGET_OS_VISION) && TARGET_OS_VISION)
2223
#import <UIKit/UIKit.h>
2324
#endif
2425

@@ -49,7 +50,7 @@ NetworkStatus ToNetworkStatus(SCNetworkReachabilityFlags flags) {
4950
return NetworkStatus::Unavailable;
5051
}
5152

52-
#if TARGET_OS_IPHONE
53+
#if TARGET_OS_IPHONE || (defined(TARGET_OS_VISION) && TARGET_OS_VISION)
5354
if (flags & kSCNetworkReachabilityFlagsIsWWAN) {
5455
return NetworkStatus::AvailableViaCellular;
5556
}
@@ -112,7 +113,8 @@ explicit ConnectivityMonitorApple(
112113
return;
113114
}
114115

115-
#if TARGET_OS_IOS || TARGET_OS_TV
116+
#if TARGET_OS_IOS || TARGET_OS_TV || \
117+
(defined(TARGET_OS_VISION) && TARGET_OS_VISION)
116118
this->observer_ = [[NSNotificationCenter defaultCenter]
117119
addObserverForName:UIApplicationWillEnterForegroundNotification
118120
object:nil
@@ -124,7 +126,8 @@ explicit ConnectivityMonitorApple(
124126
}
125127

126128
~ConnectivityMonitorApple() {
127-
#if TARGET_OS_IOS || TARGET_OS_TV
129+
#if TARGET_OS_IOS || TARGET_OS_TV || \
130+
(defined(TARGET_OS_VISION) && TARGET_OS_VISION)
128131
[[NSNotificationCenter defaultCenter] removeObserver:this->observer_];
129132
#endif
130133

@@ -139,7 +142,8 @@ explicit ConnectivityMonitorApple(
139142
}
140143
}
141144

142-
#if TARGET_OS_IOS || TARGET_OS_TV
145+
#if TARGET_OS_IOS || TARGET_OS_TV || \
146+
(defined(TARGET_OS_VISION) && TARGET_OS_VISION)
143147
void OnEnteredForeground() {
144148
SCNetworkReachabilityFlags flags{};
145149
if (!SCNetworkReachabilityGetFlags(reachability_, &flags)) return;
@@ -167,7 +171,8 @@ void OnReachabilityChanged(SCNetworkReachabilityFlags flags) {
167171

168172
private:
169173
SCNetworkReachabilityRef reachability_ = nil;
170-
#if TARGET_OS_IOS || TARGET_OS_TV
174+
#if TARGET_OS_IOS || TARGET_OS_TV || \
175+
(defined(TARGET_OS_VISION) && TARGET_OS_VISION)
171176
id<NSObject> observer_ = nil;
172177
#endif
173178
};

Firestore/core/src/util/filesystem_apple.mm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
}
4545

4646
StatusOr<Path> Filesystem::AppDataDir(absl::string_view app_name) {
47-
#if TARGET_OS_IOS || TARGET_OS_OSX
47+
#if TARGET_OS_IOS || TARGET_OS_OSX || \
48+
(defined(TARGET_OS_VISION) && TARGET_OS_VISION)
4849
NSArray<NSString*>* directories = NSSearchPathForDirectoriesInDomains(
4950
NSApplicationSupportDirectory, NSUserDomainMask, YES);
5051
return Path::FromNSString(directories[0]).AppendUtf8(app_name);
@@ -60,7 +61,7 @@
6061
}
6162

6263
StatusOr<Path> Filesystem::LegacyDocumentsDir(absl::string_view app_name) {
63-
#if TARGET_OS_IOS
64+
#if TARGET_OS_IOS || (defined(TARGET_OS_VISION) && TARGET_OS_VISION)
6465
NSArray<NSString*>* directories = NSSearchPathForDirectoriesInDomains(
6566
NSDocumentDirectory, NSUserDomainMask, YES);
6667
return Path::FromNSString(directories[0]).AppendUtf8(app_name);

0 commit comments

Comments
 (0)