summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksandar Stojiljkovic <aleksandar.stojiljkovic@mapbox.com>2019-05-17 20:56:31 +0300
committerAleksandar Stojiljkovic <aleksandar.stojiljkovic@mapbox.com>2019-05-17 20:56:31 +0300
commit3ace4b75ef60dce49224d90aee42e6549b0f2d08 (patch)
treeb8e5d86b0b0d9700bfc26ab93daa92079a561de5
parent0b776ff17572d3c89a9f6c0aa92e00d6d36524ee (diff)
downloadqtlocation-mapboxgl-upstream/astojilj-mac-defines.tar.gz
Fix TARGET_OS_IPHONE/IOS & TARGET_OS_MAC/OSX missunderstandingupstream/astojilj-mac-defines
TARGET_OS_MAC is 1 on all Apple devices, use TARGET_OS_OSX for macos. Fold TARGET_OS_SIMULATOR to TARGET_OS_IPHONE: TARGET_OS_IPHONE is 1 also for simulators. TARGET_OS_IPHONE is 1 also for TV and Watch: use TARGET_OS_IOS for iOS.
-rw-r--r--platform/darwin/src/MGLAccountManager.m10
-rw-r--r--platform/darwin/src/MGLAccountManager_Private.h2
-rw-r--r--platform/darwin/src/MGLGeometry.mm4
-rw-r--r--platform/darwin/src/MGLMapSnapshotter.mm4
-rw-r--r--platform/darwin/src/MGLOfflineStorage.mm10
-rw-r--r--platform/darwin/src/MGLShapeOfflineRegion.mm8
-rw-r--r--platform/darwin/src/MGLTilePyramidOfflineRegion.mm8
-rw-r--r--platform/darwin/src/gl_functions.cpp7
-rw-r--r--platform/darwin/src/http_file_source.mm8
9 files changed, 29 insertions, 32 deletions
diff --git a/platform/darwin/src/MGLAccountManager.m b/platform/darwin/src/MGLAccountManager.m
index da2b99c9ac..1e8df98f8c 100644
--- a/platform/darwin/src/MGLAccountManager.m
+++ b/platform/darwin/src/MGLAccountManager.m
@@ -5,7 +5,7 @@
#import "NSProcessInfo+MGLAdditions.h"
#endif
-#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+#if TARGET_OS_IPHONE
#import "MGLMapboxEvents.h"
#import "MBXSKUToken.h"
#endif
@@ -17,7 +17,7 @@ static BOOL _MGLAccountsSDKEnabled;
@property (atomic) NSString *accessToken;
@property (nonatomic) NSURL *apiBaseURL;
-#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+#if TARGET_OS_IPHONE
@property (atomic) NSString *skuToken;
@property (atomic) NSDate *skuTokenExpiration;
#endif
@@ -41,7 +41,7 @@ static BOOL _MGLAccountsSDKEnabled;
[self setAPIBaseURL:[NSURL URLWithString:apiBaseURL]];
}
-#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+#if TARGET_OS_IPHONE
// TODO: Use MGL_OBJC_DYNAMIC_CAST (that requires moving the macro, where it
// doesn't require a C++ header)
NSNumber *accountsSDKNumber = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"MGLMapboxAccountsSDKEnabled"];
@@ -89,7 +89,7 @@ static BOOL _MGLAccountsSDKEnabled;
[MGLAccountManager sharedManager].accessToken = accessToken;
-#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+#if TARGET_OS_IPHONE
dispatch_async(dispatch_get_main_queue(), ^{
[MGLMapboxEvents setupWithAccessToken:accessToken];
});
@@ -110,7 +110,7 @@ static BOOL _MGLAccountsSDKEnabled;
#pragma mark - SKU Tokens
-#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+#if TARGET_OS_IPHONE
+ (BOOL)isAccountsSDKEnabled {
return _MGLAccountsSDKEnabled;
diff --git a/platform/darwin/src/MGLAccountManager_Private.h b/platform/darwin/src/MGLAccountManager_Private.h
index 366e3097f3..38d6c92b22 100644
--- a/platform/darwin/src/MGLAccountManager_Private.h
+++ b/platform/darwin/src/MGLAccountManager_Private.h
@@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
/// The API base URL that is used to access Mapbox resources. The default base URL is `https://api.mapbox.com`. If `nil`, the Mapbox default base API URL is in use.
@property (atomic, readwrite, nullable) NSURL *apiBaseURL;
-#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+#if TARGET_OS_IPHONE
/// The current global SKU.
@property (class, atomic, readonly, nullable) NSString *skuToken;
@property (class, nonatomic, readonly) BOOL isAccountsSDKEnabled;
diff --git a/platform/darwin/src/MGLGeometry.mm b/platform/darwin/src/MGLGeometry.mm
index c6fb5a5fc2..18a84fb330 100644
--- a/platform/darwin/src/MGLGeometry.mm
+++ b/platform/darwin/src/MGLGeometry.mm
@@ -4,7 +4,7 @@
#import <mbgl/util/projection.hpp>
-#if !TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR
+#if !TARGET_OS_IPHONE
#import <Cocoa/Cocoa.h>
#endif
@@ -97,7 +97,7 @@ CLLocationDirection MGLDirectionBetweenCoordinates(CLLocationCoordinate2D firstC
}
CGPoint MGLPointRounded(CGPoint point) {
-#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+#if TARGET_OS_IPHONE
CGFloat scaleFactor = [UIScreen mainScreen].nativeScale;
#elif TARGET_OS_MAC
CGFloat scaleFactor = [NSScreen mainScreen].backingScaleFactor;
diff --git a/platform/darwin/src/MGLMapSnapshotter.mm b/platform/darwin/src/MGLMapSnapshotter.mm
index 65bed2cf42..e380545421 100644
--- a/platform/darwin/src/MGLMapSnapshotter.mm
+++ b/platform/darwin/src/MGLMapSnapshotter.mm
@@ -17,7 +17,7 @@
#import "MGLAttributionInfo_Private.h"
#import "MGLLoggingConfiguration_Private.h"
#import "MGLRendererConfiguration.h"
-#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+#if TARGET_OS_IPHONE
#import "MGLMapboxEvents.h"
#endif
@@ -158,7 +158,7 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64;
#else
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillTerminate:) name:NSApplicationWillTerminateNotification object:nil];
#endif
-#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+#if TARGET_OS_IPHONE
[MGLMapboxEvents pushTurnstileEvent];
#endif
}
diff --git a/platform/darwin/src/MGLOfflineStorage.mm b/platform/darwin/src/MGLOfflineStorage.mm
index 6effd8c3ce..dba688e745 100644
--- a/platform/darwin/src/MGLOfflineStorage.mm
+++ b/platform/darwin/src/MGLOfflineStorage.mm
@@ -12,7 +12,7 @@
#import "NSDate+MGLAdditions.h"
#import "MGLLoggingConfiguration_Private.h"
-#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+#if TARGET_OS_IPHONE
#import "MMEConstants.h"
#import "MGLMapboxEvents.h"
#endif
@@ -60,7 +60,7 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio
static MGLOfflineStorage *sharedOfflineStorage;
dispatch_once(&onceToken, ^{
sharedOfflineStorage = [[self alloc] init];
-#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+#if TARGET_OS_IPHONE
[[NSNotificationCenter defaultCenter] addObserver:sharedOfflineStorage selector:@selector(unpauseFileSource:) name:UIApplicationWillEnterForegroundNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:sharedOfflineStorage selector:@selector(pauseFileSource:) name:UIApplicationDidEnterBackgroundNotification object:nil];
#endif
@@ -70,7 +70,7 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio
return sharedOfflineStorage;
}
-#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+#if TARGET_OS_IPHONE
- (void)pauseFileSource:(__unused NSNotification *)notification {
if (self.isPaused) {
return;
@@ -185,7 +185,7 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio
offline cache.
*/
+ (NSString *)legacyCachePath {
-#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+#if TARGET_OS_IPHONE
// ~/Documents/offline.db
NSArray *legacyPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *legacyCachePath = [legacyPaths.firstObject stringByAppendingPathComponent:MGLOfflineStorageFileName3_2_0_beta_1];
@@ -374,7 +374,7 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio
completion(pack, error);
}
- #if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+ #if TARGET_OS_IPHONE
NSMutableDictionary *offlineDownloadStartEventAttributes = [NSMutableDictionary dictionaryWithObject:MMEventTypeOfflineDownloadStart forKey:MMEEventKeyEvent];
if ([region conformsToProtocol:@protocol(MGLOfflineRegion_Private)]) {
diff --git a/platform/darwin/src/MGLShapeOfflineRegion.mm b/platform/darwin/src/MGLShapeOfflineRegion.mm
index 25b6b8e166..25efa5fdf5 100644
--- a/platform/darwin/src/MGLShapeOfflineRegion.mm
+++ b/platform/darwin/src/MGLShapeOfflineRegion.mm
@@ -1,6 +1,6 @@
#import "MGLShapeOfflineRegion.h"
-#if !TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR
+#if TARGET_OS_OSX
#import <Cocoa/Cocoa.h>
#else
#import <UIKit/UIKit.h>
@@ -13,7 +13,7 @@
#import "MGLStyle.h"
#import "MGLLoggingConfiguration_Private.h"
-#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+#if TARGET_OS_IPHONE
#import "MMEConstants.h"
#endif
@@ -30,7 +30,7 @@
-(NSDictionary *)offlineStartEventAttributes {
return @{
- #if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+ #if TARGET_OS_IPHONE
MMEEventKeyShapeForOfflineRegion: @"shaperegion",
MMEEventKeyMinZoomLevel: @(self.minimumZoomLevel),
MMEEventKeyMaxZoomLevel: @(self.maximumZoomLevel),
@@ -86,7 +86,7 @@
}
- (const mbgl::OfflineRegionDefinition)offlineRegionDefinition {
-#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+#if TARGET_OS_IPHONE
const float scaleFactor = [UIScreen instancesRespondToSelector:@selector(nativeScale)] ? [[UIScreen mainScreen] nativeScale] : [[UIScreen mainScreen] scale];
#elif TARGET_OS_MAC
const float scaleFactor = [NSScreen mainScreen].backingScaleFactor;
diff --git a/platform/darwin/src/MGLTilePyramidOfflineRegion.mm b/platform/darwin/src/MGLTilePyramidOfflineRegion.mm
index a398d6baa4..dad9ea6e36 100644
--- a/platform/darwin/src/MGLTilePyramidOfflineRegion.mm
+++ b/platform/darwin/src/MGLTilePyramidOfflineRegion.mm
@@ -1,6 +1,6 @@
#import "MGLTilePyramidOfflineRegion.h"
-#if !TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR
+#if !TARGET_OS_IPHONE
#import <Cocoa/Cocoa.h>
#endif
@@ -10,7 +10,7 @@
#import "MGLStyle.h"
#import "MGLLoggingConfiguration_Private.h"
-#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+#if TARGET_OS_IPHONE
#import "MMEConstants.h"
#endif
@@ -27,7 +27,7 @@
-(NSDictionary *)offlineStartEventAttributes {
return @{
- #if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+ #if TARGET_OS_IPHONE
MMEEventKeyShapeForOfflineRegion: @"tileregion",
MMEEventKeyMinZoomLevel: @(self.minimumZoomLevel),
MMEEventKeyMaxZoomLevel: @(self.maximumZoomLevel),
@@ -82,7 +82,7 @@
}
- (const mbgl::OfflineRegionDefinition)offlineRegionDefinition {
-#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+#if TARGET_OS_IPHONE
const float scaleFactor = [UIScreen instancesRespondToSelector:@selector(nativeScale)] ? [[UIScreen mainScreen] nativeScale] : [[UIScreen mainScreen] scale];
#elif TARGET_OS_MAC
const float scaleFactor = [NSScreen mainScreen].backingScaleFactor;
diff --git a/platform/darwin/src/gl_functions.cpp b/platform/darwin/src/gl_functions.cpp
index b8828d3117..00d87ad82e 100644
--- a/platform/darwin/src/gl_functions.cpp
+++ b/platform/darwin/src/gl_functions.cpp
@@ -5,9 +5,6 @@
#if TARGET_OS_IPHONE
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
-#elif TARGET_OS_SIMULATOR
- #include <OpenGLES/ES2/gl.h>
- #include <OpenGLES/ES2/glext.h>
#elif TARGET_OS_MAC
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
@@ -36,7 +33,7 @@ void (* const glBufferSubData)(GLenum, GLintptr, GLsizeiptr, const void *) = ::g
GLenum (* const glCheckFramebufferStatus)(GLenum) = ::glCheckFramebufferStatus;
void (* const glClear)(GLbitfield) = ::glClear;
void (* const glClearColor)(GLfloat, GLfloat, GLfloat, GLfloat) = ::glClearColor;
-#if !TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR && TARGET_OS_MAC
+#if TARGET_OS_OSX
void (* const glClearDepthf)(GLfloat) = [](GLfloat depth) { return ::glClearDepth(depth); };
#else
void (* const glClearDepthf)(GLfloat) = ::glClearDepthf;
@@ -59,7 +56,7 @@ void (* const glDeleteShader)(GLuint) = ::glDeleteShader;
void (* const glDeleteTextures)(GLsizei, const GLuint *) = ::glDeleteTextures;
void (* const glDepthFunc)(GLenum) = ::glDepthFunc;
void (* const glDepthMask)(GLboolean) = ::glDepthMask;
-#if !TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR && TARGET_OS_MAC
+#if TARGET_OS_OSX
void (* const glDepthRangef)(GLfloat, GLfloat) = [](GLfloat nearVal, GLfloat farVal) { return ::glDepthRange(nearVal, farVal); };
#else
void (* const glDepthRangef)(GLfloat, GLfloat) = ::glDepthRangef;
diff --git a/platform/darwin/src/http_file_source.mm b/platform/darwin/src/http_file_source.mm
index 20b9ead7af..186bfa9969 100644
--- a/platform/darwin/src/http_file_source.mm
+++ b/platform/darwin/src/http_file_source.mm
@@ -11,7 +11,7 @@
#import "MGLLoggingConfiguration_Private.h"
#import "MGLNetworkConfiguration_Private.h"
-#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+#if TARGET_OS_IPHONE
#import "MGLAccountManager_Private.h"
#endif
@@ -140,9 +140,9 @@ NSString *HTTPFileSource::Impl::getUserAgent() const {
@(mbgl::version::revision)]];
NSString *systemName = @"Darwin";
-#if TARGET_OS_IPHONE
+#if TARGET_OS_IOS
systemName = @"iOS";
-#elif TARGET_OS_MAC
+#elif TARGET_OS_OSX
systemName = @"macOS";
#elif TARGET_OS_WATCH
systemName = @"watchOS";
@@ -204,7 +204,7 @@ std::unique_ptr<AsyncRequest> HTTPFileSource::request(const Resource& resource,
NSURL *url = [NSURL URLWithString:@(resource.url.c_str())];
MGLLogDebug(@"Requesting URI: %@", url.relativePath);
-#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+#if TARGET_OS_IPHONE
if (impl->accountType == 0 &&
([url.host isEqualToString:@"mapbox.com"] || [url.host hasSuffix:@".mapbox.com"])) {
NSURLComponents *components = [NSURLComponents componentsWithURL:url resolvingAgainstBaseURL:NO];