summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2016-03-16 09:57:45 -0400
committerJoel Fischer <joeljfischer@gmail.com>2016-03-16 09:57:45 -0400
commit7ab8a233805a5e71b515798c57459713c5a03835 (patch)
tree5f71df7a75866ab70870f7abaef52594baa0dc17
parent20c42daf99261aba12aa8949ca8fcfd3d84579f4 (diff)
downloadsdl_ios-7ab8a233805a5e71b515798c57459713c5a03835.tar.gz
Update system version checking with a macro
-rw-r--r--SmartDeviceLink-iOS/SmartDeviceLink/SDLGlobals.h2
-rw-r--r--SmartDeviceLink-iOS/SmartDeviceLink/SDLProxy.m2
-rw-r--r--SmartDeviceLink-iOS/SmartDeviceLink/SDLStreamingMediaManager.m4
3 files changed, 5 insertions, 3 deletions
diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLGlobals.h b/SmartDeviceLink-iOS/SmartDeviceLink/SDLGlobals.h
index 03bc9afed..b3778f62e 100644
--- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLGlobals.h
+++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLGlobals.h
@@ -8,6 +8,8 @@
#import <Foundation/Foundation.h>
+#define SDL_SYSTEM_VERSION_LESS_THAN(version) ([[[UIDevice currentDevice] systemVersion] compare:version options:NSNumericSearch] == NSOrderedAscending)
+
@interface SDLGlobals : NSObject
@property (assign, nonatomic, readonly) NSUInteger protocolVersion;
diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLProxy.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLProxy.m
index 458760e07..00e197a32 100644
--- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLProxy.m
+++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLProxy.m
@@ -363,7 +363,7 @@ const int POLICIES_CORRELATION_ID = 65535;
return;
}
// If system version is less than 9.0 http://stackoverflow.com/a/5337804/1370927
- if ([[[UIDevice currentDevice] systemVersion] compare:@"9.0" options:NSNumericSearch] == NSOrderedAscending) {
+ if (SDL_SYSTEM_VERSION_LESS_THAN(@"9.0")) {
// Return early if we can't openURL because openURL will crash instead of fail silently in < 9.0
if (![[UIApplication sharedApplication] canOpenURL:URLScheme]) {
return;
diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLStreamingMediaManager.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLStreamingMediaManager.m
index 1ef3a526f..62682c9dc 100644
--- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLStreamingMediaManager.m
+++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLStreamingMediaManager.m
@@ -11,6 +11,7 @@
@import UIKit;
#import "SDLAbstractProtocol.h"
+#import "SDLGlobals.h"
NSString *const SDLErrorDomainStreamingMediaVideo = @"com.sdl.streamingmediamanager.video";
@@ -63,8 +64,7 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Streaming media lifecycle
- (void)startVideoSessionWithStartBlock:(SDLStreamingStartBlock)startBlock {
- // If system version is less than 8.0
- if ([[[UIDevice currentDevice] systemVersion] compare:@"8.0" options:NSNumericSearch] == NSOrderedAscending) {
+ if (SDL_SYSTEM_VERSION_LESS_THAN(@"8.0")) {
NSAssert(NO, @"SDL Video Sessions can only be run on iOS 8+ devices");
startBlock(NO, [NSError errorWithDomain:SDLErrorDomainStreamingMediaVideo code:SDLSTreamingVideoErrorInvalidOperatingSystemVersion userInfo:nil]);