Merge pull request #3620 from dreampiggy/feature/visionOS_15_1
Update the TargetConditionals check for visionOS on Xcode 15.1
This commit is contained in:
commit
9a24bfd425
|
@ -21,14 +21,6 @@
|
||||||
#define SD_MAC 0
|
#define SD_MAC 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// iOS and tvOS are very similar, UIKit exists on both platforms
|
|
||||||
// Note: watchOS also has UIKit, but it's very limited
|
|
||||||
#if TARGET_OS_IOS || TARGET_OS_TV
|
|
||||||
#define SD_UIKIT 1
|
|
||||||
#else
|
|
||||||
#define SD_UIKIT 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if TARGET_OS_IOS
|
#if TARGET_OS_IOS
|
||||||
#define SD_IOS 1
|
#define SD_IOS 1
|
||||||
#else
|
#else
|
||||||
|
@ -54,6 +46,14 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// iOS/tvOS/visionOS are very similar, UIKit exists on both platforms
|
||||||
|
// Note: watchOS also has UIKit, but it's very limited
|
||||||
|
#if SD_IOS || SD_TV || SD_VISION
|
||||||
|
#define SD_UIKIT 1
|
||||||
|
#else
|
||||||
|
#define SD_UIKIT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#if SD_MAC
|
#if SD_MAC
|
||||||
#import <AppKit/AppKit.h>
|
#import <AppKit/AppKit.h>
|
||||||
#ifndef UIImage
|
#ifndef UIImage
|
||||||
|
|
|
@ -109,8 +109,10 @@
|
||||||
|
|
||||||
/// default-style progress indicator
|
/// default-style progress indicator
|
||||||
@property (nonatomic, class, nonnull, readonly) SDWebImageProgressIndicator *defaultIndicator;
|
@property (nonatomic, class, nonnull, readonly) SDWebImageProgressIndicator *defaultIndicator;
|
||||||
|
#if SD_UIKIT
|
||||||
/// bar-style progress indicator
|
/// bar-style progress indicator
|
||||||
@property (nonatomic, class, nonnull, readonly) SDWebImageProgressIndicator *barIndicator API_UNAVAILABLE(macos, tvos);
|
@property (nonatomic, class, nonnull, readonly) SDWebImageProgressIndicator *barIndicator API_UNAVAILABLE(tvos);
|
||||||
|
#endif
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -278,8 +278,8 @@
|
||||||
return indicator;
|
return indicator;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SD_IOS
|
#if SD_UIKIT
|
||||||
+ (SDWebImageProgressIndicator *)barIndicator {
|
+ (SDWebImageProgressIndicator *)barIndicator API_UNAVAILABLE(tvos) {
|
||||||
SDWebImageProgressIndicator *indicator = [SDWebImageProgressIndicator new];
|
SDWebImageProgressIndicator *indicator = [SDWebImageProgressIndicator new];
|
||||||
indicator.indicatorView.progressViewStyle = UIProgressViewStyleBar;
|
indicator.indicatorView.progressViewStyle = UIProgressViewStyleBar;
|
||||||
return indicator;
|
return indicator;
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#import "SDWeakProxy.h"
|
#import "SDWeakProxy.h"
|
||||||
#if SD_MAC
|
#if SD_MAC
|
||||||
#import <CoreVideo/CoreVideo.h>
|
#import <CoreVideo/CoreVideo.h>
|
||||||
#elif SD_IOS || SD_TV
|
#elif SD_UIKIT
|
||||||
#import <QuartzCore/QuartzCore.h>
|
#import <QuartzCore/QuartzCore.h>
|
||||||
#endif
|
#endif
|
||||||
#include <mach/mach_time.h>
|
#include <mach/mach_time.h>
|
||||||
|
@ -30,7 +30,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
|
||||||
@property (nonatomic, assign) CVDisplayLinkRef displayLink;
|
@property (nonatomic, assign) CVDisplayLinkRef displayLink;
|
||||||
@property (nonatomic, assign) CVTimeStamp outputTime;
|
@property (nonatomic, assign) CVTimeStamp outputTime;
|
||||||
@property (nonatomic, copy) NSRunLoopMode runloopMode;
|
@property (nonatomic, copy) NSRunLoopMode runloopMode;
|
||||||
#elif SD_IOS || SD_TV
|
#elif SD_UIKIT
|
||||||
@property (nonatomic, strong) CADisplayLink *displayLink;
|
@property (nonatomic, strong) CADisplayLink *displayLink;
|
||||||
#else
|
#else
|
||||||
@property (nonatomic, strong) NSTimer *displayLink;
|
@property (nonatomic, strong) NSTimer *displayLink;
|
||||||
|
@ -49,7 +49,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
|
||||||
CVDisplayLinkRelease(_displayLink);
|
CVDisplayLinkRelease(_displayLink);
|
||||||
_displayLink = NULL;
|
_displayLink = NULL;
|
||||||
}
|
}
|
||||||
#elif SD_IOS || SD_TV
|
#elif SD_UIKIT
|
||||||
[_displayLink invalidate];
|
[_displayLink invalidate];
|
||||||
_displayLink = nil;
|
_displayLink = nil;
|
||||||
#else
|
#else
|
||||||
|
@ -69,7 +69,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
|
||||||
CVDisplayLinkCreateWithActiveCGDisplays(&_displayLink);
|
CVDisplayLinkCreateWithActiveCGDisplays(&_displayLink);
|
||||||
// Simulate retain for target, the target is weak proxy to self
|
// Simulate retain for target, the target is weak proxy to self
|
||||||
CVDisplayLinkSetOutputCallback(_displayLink, DisplayLinkCallback, (__bridge_retained void *)weakProxy);
|
CVDisplayLinkSetOutputCallback(_displayLink, DisplayLinkCallback, (__bridge_retained void *)weakProxy);
|
||||||
#elif SD_IOS || SD_TV
|
#elif SD_UIKIT
|
||||||
_displayLink = [CADisplayLink displayLinkWithTarget:weakProxy selector:@selector(displayLinkDidRefresh:)];
|
_displayLink = [CADisplayLink displayLinkWithTarget:weakProxy selector:@selector(displayLinkDidRefresh:)];
|
||||||
#else
|
#else
|
||||||
_displayLink = [NSTimer timerWithTimeInterval:kSDDisplayLinkInterval target:weakProxy selector:@selector(displayLinkDidRefresh:) userInfo:nil repeats:YES];
|
_displayLink = [NSTimer timerWithTimeInterval:kSDDisplayLinkInterval target:weakProxy selector:@selector(displayLinkDidRefresh:) userInfo:nil repeats:YES];
|
||||||
|
@ -123,7 +123,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
|
||||||
} else {
|
} else {
|
||||||
duration = kSDDisplayLinkInterval;
|
duration = kSDDisplayLinkInterval;
|
||||||
}
|
}
|
||||||
#elif SD_IOS || SD_TV
|
#elif SD_UIKIT
|
||||||
// Fallback
|
// Fallback
|
||||||
duration = self.displayLink.duration;
|
duration = self.displayLink.duration;
|
||||||
#else
|
#else
|
||||||
|
@ -137,7 +137,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
|
||||||
- (BOOL)isRunning {
|
- (BOOL)isRunning {
|
||||||
#if SD_MAC
|
#if SD_MAC
|
||||||
return CVDisplayLinkIsRunning(self.displayLink);
|
return CVDisplayLinkIsRunning(self.displayLink);
|
||||||
#elif SD_IOS || SD_TV
|
#elif SD_UIKIT
|
||||||
return !self.displayLink.isPaused;
|
return !self.displayLink.isPaused;
|
||||||
#else
|
#else
|
||||||
return self.displayLink.isValid;
|
return self.displayLink.isValid;
|
||||||
|
@ -150,7 +150,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
|
||||||
}
|
}
|
||||||
#if SD_MAC
|
#if SD_MAC
|
||||||
self.runloopMode = mode;
|
self.runloopMode = mode;
|
||||||
#elif SD_IOS || SD_TV
|
#elif SD_UIKIT
|
||||||
[self.displayLink addToRunLoop:runloop forMode:mode];
|
[self.displayLink addToRunLoop:runloop forMode:mode];
|
||||||
#else
|
#else
|
||||||
self.runloop = runloop;
|
self.runloop = runloop;
|
||||||
|
@ -173,7 +173,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
|
||||||
}
|
}
|
||||||
#if SD_MAC
|
#if SD_MAC
|
||||||
self.runloopMode = nil;
|
self.runloopMode = nil;
|
||||||
#elif SD_IOS || SD_TV
|
#elif SD_UIKIT
|
||||||
[self.displayLink removeFromRunLoop:runloop forMode:mode];
|
[self.displayLink removeFromRunLoop:runloop forMode:mode];
|
||||||
#else
|
#else
|
||||||
self.runloop = nil;
|
self.runloop = nil;
|
||||||
|
@ -193,7 +193,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
|
||||||
- (void)start {
|
- (void)start {
|
||||||
#if SD_MAC
|
#if SD_MAC
|
||||||
CVDisplayLinkStart(self.displayLink);
|
CVDisplayLinkStart(self.displayLink);
|
||||||
#elif SD_IOS || SD_TV
|
#elif SD_UIKIT
|
||||||
self.displayLink.paused = NO;
|
self.displayLink.paused = NO;
|
||||||
#else
|
#else
|
||||||
if (self.displayLink.isValid) {
|
if (self.displayLink.isValid) {
|
||||||
|
@ -209,7 +209,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
|
||||||
- (void)stop {
|
- (void)stop {
|
||||||
#if SD_MAC
|
#if SD_MAC
|
||||||
CVDisplayLinkStop(self.displayLink);
|
CVDisplayLinkStop(self.displayLink);
|
||||||
#elif SD_IOS || SD_TV
|
#elif SD_UIKIT
|
||||||
self.displayLink.paused = YES;
|
self.displayLink.paused = YES;
|
||||||
#else
|
#else
|
||||||
[self.displayLink invalidate];
|
[self.displayLink invalidate];
|
||||||
|
@ -219,7 +219,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)displayLinkDidRefresh:(id)displayLink {
|
- (void)displayLinkDidRefresh:(id)displayLink {
|
||||||
#if SD_IOS || SD_TV
|
#if SD_UIKIT
|
||||||
if (@available(iOS 10.0, tvOS 10.0, *)) {
|
if (@available(iOS 10.0, tvOS 10.0, *)) {
|
||||||
self.nextFireTime = self.displayLink.targetTimestamp;
|
self.nextFireTime = self.displayLink.targetTimestamp;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue