Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for visionOS #1762

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ + (NSDictionary *)defaultURLRequestHeadersForApplicationId:(NSString *)applicati
NSString *versionPrefix = @"apple-tv";
#elif TARGET_OS_WATCH
NSString *versionPrefix = @"apple-watch";
#elif TARGET_OS_VISION
NSString *versionPrefix = @"vision";
#endif

NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary];
Expand Down
2 changes: 1 addition & 1 deletion Parse/Parse/Internal/PFApplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#import "PFConstants.h"

#if TARGET_OS_IOS || TARGET_OS_TV
#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_VISION
#import <UIKit/UIKit.h>
#elif TARGET_OS_WATCH
@class UIApplication;
Expand Down
2 changes: 1 addition & 1 deletion Parse/Parse/Internal/PFApplication.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#import "PFApplication.h"

#if TARGET_OS_IOS || TARGET_OS_TV
#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_VISION
#import <UIKit/UIKit.h>
#elif PF_TARGET_OS_OSX
#import <AppKit/AppKit.h>
Expand Down
6 changes: 3 additions & 3 deletions Parse/Parse/Internal/PFDevice.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#if TARGET_OS_WATCH
#import <WatchKit/WatchKit.h>
#elif TARGET_OS_IOS || TARGET_OS_TV
#elif TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_VISION
#import <UIKit/UIKit.h>
#elif PF_TARGET_OS_OSX
#import <CoreServices/CoreServices.h>
Expand Down Expand Up @@ -77,7 +77,7 @@ - (NSString *)detailedModel {
if (!name) {
#if TARGET_OS_WATCH
name = [WKInterfaceDevice currentDevice].model;
#elif TARGET_OS_IOS || TARGET_OS_TV
#elif TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_VISION
name = [UIDevice currentDevice].model;
#elif TARGET_OS_MAC
name = @"Mac";
Expand All @@ -95,7 +95,7 @@ - (NSString *)operatingSystemFullVersion {
return version;
}
- (NSString *)operatingSystemVersion {
#if TARGET_OS_IOS
#if TARGET_OS_IOS || TARGET_OS_VISION
return [UIDevice currentDevice].systemVersion;
#elif TARGET_OS_WATCH || TARGET_OS_TV
NSOperatingSystemVersion version = [NSProcessInfo processInfo].operatingSystemVersion;
Expand Down
2 changes: 1 addition & 1 deletion Parse/Parse/Source/PFAnalytics.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ @implementation PFAnalytics
///--------------------------------------

+ (BFTask<NSNumber *> *)trackAppOpenedWithLaunchOptions:(nullable NSDictionary *)launchOptions {
#if TARGET_OS_WATCH || TARGET_OS_TV
#if TARGET_OS_WATCH || TARGET_OS_TV || TARGET_OS_VISION
NSDictionary *userInfo = nil;
#elif TARGET_OS_IOS
NSDictionary *userInfo = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey];
Expand Down
21 changes: 20 additions & 1 deletion Parse/Parse/Source/PFConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -462,9 +462,12 @@ extern NSString *const _Nonnull PFNetworkNotificationURLResponseBodyUserInfoKey;
#ifndef TARGET_OS_TV
# define TARGET_OS_TV 0
#endif
#ifndef TARGET_OS_VISION
# define TARGET_OS_VISION 0
#endif

#ifndef PF_TARGET_OS_OSX
# define PF_TARGET_OS_OSX (TARGET_OS_MAC && !TARGET_OS_IOS && !TARGET_OS_WATCH && !TARGET_OS_TV)
# define PF_TARGET_OS_OSX (TARGET_OS_MAC && !TARGET_OS_IOS && !TARGET_OS_WATCH && !TARGET_OS_TV && !TARGET_OS_VISION)
#endif

///--------------------------------------
Expand All @@ -487,6 +490,22 @@ extern NSString *const _Nonnull PFNetworkNotificationURLResponseBodyUserInfoKey;
# endif
#endif

#ifndef PF_VISION_UNAVAILABLE
# ifdef __VISION_UNAVILABLE
# define PF_VISION_UNAVAILABLE __VISION_UNAVAILABLE
# else
# define PF_VISION_UNAVAILABLE
# endif
#endif

#ifndef PF_VISION_UNAVAILABLE_WARNING
# if TARGET_OS_VISION
# define PF_VISION_UNAVAILABLE_WARNING _Pragma("GCC warning \"This file is unavailable on visionOS.\"")
# else
# define PF_VISION_UNAVAILABLE_WARNING
# endif
#endif

#ifndef PF_OSX_UNAVAILABLE
# if PF_TARGET_OS_OSX
# define PF_OSX_UNAVAILABLE __OSX_UNAVAILABLE
Expand Down
2 changes: 2 additions & 0 deletions Parse/Parse/Source/PFConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
NSString *const kPFDeviceType = @"tvos";
#elif TARGET_OS_WATCH
NSString *const kPFDeviceType = @"applewatch";
#elif TARGET_OS_VISION
NSString *const kPFDeviceType = @"vision";
#endif

NSString *const PFParseErrorDomain = @"Parse";
Expand Down
2 changes: 1 addition & 1 deletion Parse/Parse/Source/PFInstallation.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#import "PFConstants.h"

#if TARGET_OS_IOS || PF_TARGET_OS_OSX || TARGET_OS_TV
#if TARGET_OS_IOS || PF_TARGET_OS_OSX || TARGET_OS_TV || TARGET_OS_VISION

#import "PFInstallation.h"
#import "PFInstallationPrivate.h"
Expand Down
2 changes: 1 addition & 1 deletion Parse/Parse/Source/PFPush.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#import "PFConstants.h"

#if TARGET_OS_IOS || PF_TARGET_OS_OSX || TARGET_OS_TV
#if TARGET_OS_IOS || PF_TARGET_OS_OSX || TARGET_OS_TV || TARGET_OS_VISION
#import "PFPush.h"
#import "PFPushPrivate.h"

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![parse-repository-header-sdk-apple](https://user-images.githubusercontent.com/5673677/198421762-993c89e8-8201-40f1-a650-c2e9dde4da82.png)

<h3 align="center">iOS · iPadOS · macOS · watchOS · tvOS</h3>
<h3 align="center">iOS · iPadOS · macOS · watchOS · tvOS · visionOS</h3>

---

Expand All @@ -27,7 +27,7 @@

---

A library that gives you access to the powerful Parse Server backend from your iOS, iPadOS, macOS, watchOS and tvOS app. For more information about the Parse Platform and its features, see the public [documentation][docs].
A library that gives you access to the powerful Parse Server backend from your iOS, iPadOS, macOS, watchOS, tvOS, and visionOS app. For more information about the Parse Platform and its features, see the public [documentation][docs].

---

Expand Down
Loading