Skip to content

Commit e740072

Browse files
authored
[visionOS] Replace TARGET_OS_XR with TARGET_OS_VISION (#11603)
In Xcode 15 beta 5, TARGET_OS_XR was replaced with TARGET_OS_VISION in ObjC and os(xrOS) was replaced with os(visionOS) in Swift.
1 parent 3676437 commit e740072

27 files changed

+101
-86
lines changed

Crashlytics/Crashlytics/Components/FIRCLSBinaryImage.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ static FIRCLSMachOSegmentCommand FIRCLSBinaryImageMachOGetSegmentCommand(
242242

243243
return segmentCommand;
244244
}
245-
#if !CLS_TARGET_OS_XR
245+
#if !CLS_TARGET_OS_VISION
246246
static bool FIRCLSBinaryImageMachOSliceInitSectionByName(FIRCLSMachOSliceRef slice,
247247
const char* segName,
248248
const char* sectionName,
@@ -345,7 +345,7 @@ static bool FIRCLSBinaryImageFillInImageDetails(FIRCLSBinaryImageDetails* detail
345345
FIRCLSMachOSection section;
346346

347347
#if CLS_COMPACT_UNWINDING_SUPPORTED
348-
#if !CLS_TARGET_OS_XR
348+
#if !CLS_TARGET_OS_VISION
349349
if (FIRCLSBinaryImageMachOSliceInitSectionByName(&details->slice, SEG_TEXT, "__unwind_info",
350350
&section)) {
351351
details->node.unwindInfo = (void*)(section.addr + details->vmaddr_slide);
@@ -358,7 +358,7 @@ static bool FIRCLSBinaryImageFillInImageDetails(FIRCLSBinaryImageDetails* detail
358358
#endif
359359

360360
#if CLS_DWARF_UNWINDING_SUPPORTED
361-
#if !CLS_TARGET_OS_XR
361+
#if !CLS_TARGET_OS_VISION
362362
if (FIRCLSBinaryImageMachOSliceInitSectionByName(&details->slice, SEG_TEXT, "__eh_frame",
363363
&section)) {
364364
details->node.ehFrame = (void*)(section.addr + details->vmaddr_slide);
@@ -370,7 +370,7 @@ static bool FIRCLSBinaryImageFillInImageDetails(FIRCLSBinaryImageDetails* detail
370370
#endif
371371
#endif
372372

373-
#if !CLS_TARGET_OS_XR
373+
#if !CLS_TARGET_OS_VISION
374374
if (FIRCLSBinaryImageMachOSliceInitSectionByName(&details->slice, SEG_DATA, "__crash_info",
375375
&section)) {
376376
details->node.crashInfo = (void*)(section.addr + details->vmaddr_slide);

Crashlytics/Crashlytics/Controllers/FIRCLSNotificationManager.m

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ - (void)registerNotificationListener {
3939
selector:@selector(didBecomeInactive:)
4040
name:UIApplicationDidEnterBackgroundNotification
4141
object:nil];
42-
#if !CLS_TARGET_OS_XR
42+
#if !CLS_TARGET_OS_VISION
4343
[[NSNotificationCenter defaultCenter] addObserver:self
4444
selector:@selector(didChangeOrientation:)
4545
name:UIDeviceOrientationDidChangeNotification
@@ -53,7 +53,7 @@ - (void)registerNotificationListener {
5353
name:UIApplicationDidChangeStatusBarOrientationNotification
5454
object:nil];
5555
#pragma clang diagnostic pop
56-
#endif // !CLS_TARGET_OS_XR
56+
#endif // !CLS_TARGET_OS_VISION
5757

5858
#elif CLS_TARGET_OS_OSX
5959
[[NSNotificationCenter defaultCenter] addObserver:self
@@ -68,22 +68,22 @@ - (void)registerNotificationListener {
6868
}
6969

7070
- (void)captureInitialNotificationStates {
71-
#if TARGET_OS_IOS && (!CLS_TARGET_OS_XR)
71+
#if TARGET_OS_IOS && (!CLS_TARGET_OS_VISION)
7272
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
7373
UIInterfaceOrientation statusBarOrientation =
7474
[FIRCLSApplicationSharedInstance() statusBarOrientation];
75-
#endif // TARGET_OS_IOS && (!CLS_TARGET_OS_XR)
75+
#endif // TARGET_OS_IOS && (!CLS_TARGET_OS_VISION)
7676

7777
// It's nice to do this async, so we don't hold up the main thread while doing three
7878
// consecutive IOs here.
7979
dispatch_async(FIRCLSGetLoggingQueue(), ^{
8080
FIRCLSUserLoggingWriteInternalKeyValue(FIRCLSInBackgroundKey, @"0");
81-
#if TARGET_OS_IOS && (!CLS_TARGET_OS_XR)
81+
#if TARGET_OS_IOS && (!CLS_TARGET_OS_VISION)
8282
FIRCLSUserLoggingWriteInternalKeyValue(FIRCLSDeviceOrientationKey,
8383
[@(orientation) description]);
8484
FIRCLSUserLoggingWriteInternalKeyValue(FIRCLSUIOrientationKey,
8585
[@(statusBarOrientation) description]);
86-
#endif // TARGET_OS_IOS && (!CLS_TARGET_OS_XR)
86+
#endif // TARGET_OS_IOS && (!CLS_TARGET_OS_VISION)
8787
});
8888
}
8989

@@ -95,7 +95,7 @@ - (void)didBecomeInactive:(NSNotification *)notification {
9595
FIRCLSUserLoggingRecordInternalKeyValue(FIRCLSInBackgroundKey, @YES);
9696
}
9797

98-
#if TARGET_OS_IOS && (!CLS_TARGET_OS_XR)
98+
#if TARGET_OS_IOS && (!CLS_TARGET_OS_VISION)
9999
- (void)didChangeOrientation:(NSNotification *)notification {
100100
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
101101

@@ -108,6 +108,6 @@ - (void)didChangeUIOrientation:(NSNotification *)notification {
108108

109109
FIRCLSUserLoggingRecordInternalKeyValue(FIRCLSUIOrientationKey, @(statusBarOrientation));
110110
}
111-
#endif // TARGET_OS_IOS && (!CLS_TARGET_OS_XR)
111+
#endif // TARGET_OS_IOS && (!CLS_TARGET_OS_VISION)
112112

113113
@end

Crashlytics/Crashlytics/Helpers/FIRCLSDefines.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@
5858
#endif
5959

6060
// VisionOS support
61-
#if defined(TARGET_OS_XR) && TARGET_OS_XR
62-
#define CLS_TARGET_OS_XR 1
61+
#if defined(TARGET_OS_VISION) && TARGET_OS_VISION
62+
#define CLS_TARGET_OS_VISION 1
6363
#else
64-
#define CLS_TARGET_OS_XR 0
64+
#define CLS_TARGET_OS_VISION 0
6565
#endif
6666

6767
#if defined(__arm__)

Crashlytics/Shared/FIRCLSMachO/FIRCLSMachO.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ struct FIRCLSMachOSlice FIRCLSMachOSliceGetCurrent(void) {
267267
void* executableSymbol;
268268
Dl_info dlinfo;
269269

270-
#if !CLS_TARGET_OS_XR
270+
#if !CLS_TARGET_OS_VISION
271271
const NXArchInfo* archInfo;
272272
archInfo = NXGetLocalArchInfo();
273273

@@ -342,7 +342,7 @@ struct FIRCLSMachOSlice FIRCLSMachOSliceWithHeader(void* machHeader) {
342342
return "armv7k";
343343
}
344344

345-
#if !CLS_TARGET_OS_XR
345+
#if !CLS_TARGET_OS_VISION
346346
const NXArchInfo* archInfo;
347347

348348
archInfo = NXGetArchInfoFromCpuType(slice->cputype, slice->cpusubtype);

Crashlytics/UnitTests/FIRCLSMachO/FIRCLSMachOTests.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ - (void)testReadArmv7kSection {
317317
XCTAssert(ptr != NULL);
318318
}
319319

320-
#if !CLS_TARGET_OS_XR
320+
#if !CLS_TARGET_OS_VISION
321321
- (void)testReadArm64Section {
322322
NSString* path = [[self resourcePath] stringByAppendingPathComponent:@"armv7-armv7s-arm64.dylib"];
323323
struct FIRCLSMachOFile file;
@@ -340,7 +340,7 @@ - (void)testReadArm64Section {
340340
}
341341
#endif
342342

343-
#if CLS_TARGET_OS_XR
343+
#if CLS_TARGET_OS_VISION
344344

345345
- (void)testVisionProGetSlice {
346346
struct FIRCLSMachOSlice slice = FIRCLSMachOSliceGetCurrent();

FirebaseAuth/Sources/Auth/FIRAuth.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -475,9 +475,9 @@ - (instancetype)initWithApp:(FIRApp *)app {
475475
appCheck:FIR_COMPONENT(FIRAppCheckInterop, app.container)];
476476
if (self) {
477477
_app = app;
478-
#if TARGET_OS_IOS && (!defined(TARGET_OS_XR) || !TARGET_OS_XR)
478+
#if TARGET_OS_IOS && (!defined(TARGET_OS_VISION) || !TARGET_OS_VISION)
479479
_authURLPresenter = [[FIRAuthURLPresenter alloc] init];
480-
#endif // TARGET_OS_IOS && (!defined(TARGET_OS_XR) || !TARGET_OS_XR)
480+
#endif // TARGET_OS_IOS && (!defined(TARGET_OS_VISION) || !TARGET_OS_VISION)
481481
}
482482
return self;
483483
}
@@ -654,7 +654,7 @@ - (nullable FIRUser *)currentUser {
654654
- (void)signInWithProvider:(id<FIRFederatedAuthProvider>)provider
655655
UIDelegate:(nullable id<FIRAuthUIDelegate>)UIDelegate
656656
completion:(nullable FIRAuthDataResultCallback)completion {
657-
#if TARGET_OS_IOS && (!defined(TARGET_OS_XR) || !TARGET_OS_XR)
657+
#if TARGET_OS_IOS && (!defined(TARGET_OS_VISION) || !TARGET_OS_VISION)
658658
dispatch_async(FIRAuthGlobalWorkQueue(), ^{
659659
FIRAuthDataResultCallback decoratedCallback =
660660
[self signInFlowAuthDataResultCallbackByDecoratingCallback:completion];
@@ -671,7 +671,7 @@ - (void)signInWithProvider:(id<FIRFederatedAuthProvider>)provider
671671
callback:decoratedCallback];
672672
}];
673673
});
674-
#endif // TARGET_OS_IOS && (!defined(TARGET_OS_XR) || !TARGET_OS_XR)
674+
#endif // TARGET_OS_IOS && (!defined(TARGET_OS_VISION) || !TARGET_OS_VISION)
675675
}
676676

677677
- (void)fetchSignInMethodsForEmail:(nonnull NSString *)email
@@ -1875,11 +1875,11 @@ - (BOOL)canHandleNotification:(NSDictionary *)userInfo {
18751875

18761876
- (BOOL)canHandleURL:(NSURL *)URL {
18771877
__block BOOL result = NO;
1878-
#if TARGET_OS_IOS && (!defined(TARGET_OS_XR) || !TARGET_OS_XR)
1878+
#if TARGET_OS_IOS && (!defined(TARGET_OS_VISION) || !TARGET_OS_VISION)
18791879
dispatch_sync(FIRAuthGlobalWorkQueue(), ^{
18801880
result = [self->_authURLPresenter canHandleURL:URL];
18811881
});
1882-
#endif // TARGET_OS_IOS && (!defined(TARGET_OS_XR) || !TARGET_OS_XR)
1882+
#endif // TARGET_OS_IOS && (!defined(TARGET_OS_VISION) || !TARGET_OS_VISION)
18831883
return result;
18841884
}
18851885

FirebaseAuth/Sources/AuthProvider/OAuth/FIROAuthProvider.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ + (instancetype)providerWithProviderID:(NSString *)providerID auth:(FIRAuth *)au
149149
return [[self alloc] initWithProviderID:providerID auth:auth];
150150
}
151151

152-
#if TARGET_OS_IOS && (!defined(TARGET_OS_XR) || !TARGET_OS_XR)
152+
#if TARGET_OS_IOS && (!defined(TARGET_OS_VISION) || !TARGET_OS_VISION)
153153
- (void)getCredentialWithUIDelegate:(nullable id<FIRAuthUIDelegate>)UIDelegate
154154
completion:(nullable FIRAuthCredentialCallback)completion {
155155
if (![FIRAuthWebUtils isCallbackSchemeRegisteredForCustomURLScheme:self->_callbackScheme]) {
@@ -216,7 +216,7 @@ - (void)getCredentialWithUIDelegate:(nullable id<FIRAuthUIDelegate>)UIDelegate
216216
}];
217217
});
218218
}
219-
#endif // TARGET_OS_IOS && (!defined(TARGET_OS_XR) || !TARGET_OS_XR)
219+
#endif // TARGET_OS_IOS && (!defined(TARGET_OS_VISION) || !TARGET_OS_VISION)
220220

221221
#pragma mark - Internal Methods
222222

FirebaseAuth/Sources/AuthProvider/Phone/FIRPhoneAuthProvider.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
#import <TargetConditionals.h>
18-
#if TARGET_OS_IOS && (!defined(TARGET_OS_XR) || !TARGET_OS_XR)
18+
#if TARGET_OS_IOS && (!defined(TARGET_OS_VISION) || !TARGET_OS_VISION)
1919

2020
#import "FirebaseAuth/Sources/Public/FirebaseAuth/FIRAuthSettings.h"
2121
#import "FirebaseAuth/Sources/Public/FirebaseAuth/FIRMultiFactorResolver.h"
@@ -789,4 +789,4 @@ - (void)reCAPTCHAURLWithEventID:(NSString *)eventID completion:(FIRReCAPTCHAURLC
789789

790790
NS_ASSUME_NONNULL_END
791791

792-
#endif // TARGET_OS_IOS && (!defined(TARGET_OS_XR) || !TARGET_OS_XR)
792+
#endif // TARGET_OS_IOS && (!defined(TARGET_OS_VISION) || !TARGET_OS_VISION)

FirebaseAuth/Sources/Public/FirebaseAuth/FIRFederatedAuthProvider.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ typedef void (^FIRAuthCredentialCallback)(FIRAuthCredential *_Nullable credentia
5050
API_UNAVAILABLE(macos,
5151
tvos,
5252
watchos
53-
#if defined(TARGET_OS_XR)
53+
#if defined(TARGET_OS_VISION)
5454
,
55-
xros
56-
#endif // defined(TARGET_OS_XR)
55+
visionos
56+
#endif // defined(TARGET_OS_VISION)
5757
);
5858

5959
@end

FirebaseAuth/Sources/SystemService/FIRAuthAPNSTokenManager.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ - (void)getTokenWithCallback:(FIRAuthAPNSTokenCallback)callback {
7979
} else {
8080
#pragma clang diagnostic push
8181
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
82-
#if TARGET_OS_IOS && (!defined(TARGET_OS_XR) || !TARGET_OS_XR)
82+
#if TARGET_OS_IOS && (!defined(TARGET_OS_VISION) || !TARGET_OS_VISION)
8383
[self->_application registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert];
84-
#endif // TARGET_OS_IOS && (!defined(TARGET_OS_XR) || !TARGET_OS_XR)
84+
#endif // TARGET_OS_IOS && (!defined(TARGET_OS_VISION) || !TARGET_OS_VISION)
8585
#pragma clang diagnostic pop
8686
}
8787
});

0 commit comments

Comments
 (0)