Files prefix changed from MGL to MLN (#919)
This commit is contained in:
@@ -87,7 +87,7 @@ public:
|
||||
Impl(const ResourceOptions& resourceOptions_, const ClientOptions& clientOptions_)
|
||||
: resourceOptions(resourceOptions_.clone()), clientOptions(clientOptions_.clone()) {
|
||||
@autoreleasepool {
|
||||
NSURLSessionConfiguration *sessionConfig = MGLNativeNetworkManager.sharedManager.sessionConfiguration;
|
||||
NSURLSessionConfiguration *sessionConfig = MLNNativeNetworkManager.sharedManager.sessionConfiguration;
|
||||
session = [NSURLSession sessionWithConfiguration:sessionConfig];
|
||||
|
||||
userAgent = getUserAgent();
|
||||
@@ -141,7 +141,7 @@ NSString *HTTPFileSource::Impl::getUserAgent() const {
|
||||
|
||||
NSBundle *sdkBundle = HTTPFileSource::Impl::getSDKBundle();
|
||||
if (sdkBundle) {
|
||||
NSString *versionString = sdkBundle.infoDictionary[@"MGLSemanticVersionString"];
|
||||
NSString *versionString = sdkBundle.infoDictionary[@"MLNSemanticVersionString"];
|
||||
if (!versionString) {
|
||||
versionString = sdkBundle.infoDictionary[@"CFBundleShortVersionString"];
|
||||
}
|
||||
@@ -213,7 +213,7 @@ HTTPFileSource::HTTPFileSource(const ResourceOptions& resourceOptions, const Cli
|
||||
|
||||
HTTPFileSource::~HTTPFileSource() = default;
|
||||
|
||||
MGL_APPLE_EXPORT
|
||||
MLN_APPLE_EXPORT
|
||||
BOOL isValidMapboxEndpoint(NSURL *url) {
|
||||
return ([url.host isEqualToString:@"mapbox.com"] ||
|
||||
[url.host hasSuffix:@".mapbox.com"] ||
|
||||
@@ -221,7 +221,7 @@ BOOL isValidMapboxEndpoint(NSURL *url) {
|
||||
[url.host hasSuffix:@".mapbox.cn"]);
|
||||
}
|
||||
|
||||
MGL_APPLE_EXPORT
|
||||
MLN_APPLE_EXPORT
|
||||
NSURL *resourceURL(const Resource& resource) {
|
||||
|
||||
NSURL *url = [NSURL URLWithString:@(resource.url.c_str())];
|
||||
@@ -252,7 +252,7 @@ std::unique_ptr<AsyncRequest> HTTPFileSource::request(const Resource& resource,
|
||||
|
||||
@autoreleasepool {
|
||||
NSURL *url = resourceURL(resource);
|
||||
[MGLNativeNetworkManager.sharedManager debugLog:@"Requesting URI: %@", url.relativePath];
|
||||
[MLNNativeNetworkManager.sharedManager debugLog:@"Requesting URI: %@", url.relativePath];
|
||||
|
||||
NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url];
|
||||
if (resource.priorEtag) {
|
||||
@@ -268,14 +268,14 @@ std::unique_ptr<AsyncRequest> HTTPFileSource::request(const Resource& resource,
|
||||
const bool isTile = resource.kind == mbgl::Resource::Kind::Tile;
|
||||
|
||||
if (isTile) {
|
||||
[MGLNativeNetworkManager.sharedManager startDownloadEvent:url.relativePath type:@"tile"];
|
||||
[MLNNativeNetworkManager.sharedManager startDownloadEvent:url.relativePath type:@"tile"];
|
||||
}
|
||||
|
||||
__block NSURLSession *session;
|
||||
|
||||
// Use the delegate's session if there is one, otherwise use the one that
|
||||
// was created when this class was constructed.
|
||||
MGLNativeNetworkManager *networkManager = MGLNativeNetworkManager.sharedManager;
|
||||
MLNNativeNetworkManager *networkManager = MLNNativeNetworkManager.sharedManager;
|
||||
if ([networkManager.delegate respondsToSelector:@selector(sessionForNetworkManager:)]) {
|
||||
session = [networkManager.delegate sessionForNetworkManager:networkManager];
|
||||
}
|
||||
@@ -292,15 +292,15 @@ std::unique_ptr<AsyncRequest> HTTPFileSource::request(const Resource& resource,
|
||||
session = nil;
|
||||
|
||||
if (error && [error code] == NSURLErrorCancelled) {
|
||||
[MGLNativeNetworkManager.sharedManager cancelDownloadEventForResponse:res];
|
||||
[MLNNativeNetworkManager.sharedManager cancelDownloadEventForResponse:res];
|
||||
return;
|
||||
}
|
||||
[MGLNativeNetworkManager.sharedManager stopDownloadEventForResponse:res];
|
||||
[MLNNativeNetworkManager.sharedManager stopDownloadEventForResponse:res];
|
||||
Response response;
|
||||
using Error = Response::Error;
|
||||
|
||||
if (error) {
|
||||
[MGLNativeNetworkManager.sharedManager errorLog:@"Requesting: %@ failed with error: %@", req.URL, error.debugDescription];
|
||||
[MLNNativeNetworkManager.sharedManager errorLog:@"Requesting: %@ failed with error: %@", req.URL, error.debugDescription];
|
||||
|
||||
if (data) {
|
||||
response.data =
|
||||
@@ -333,7 +333,7 @@ std::unique_ptr<AsyncRequest> HTTPFileSource::request(const Resource& resource,
|
||||
}
|
||||
} else if ([res isKindOfClass:[NSHTTPURLResponse class]]) {
|
||||
const long responseCode = [(NSHTTPURLResponse *)res statusCode];
|
||||
[MGLNativeNetworkManager.sharedManager debugLog:@"Requesting %@ returned responseCode: %lu", res.URL.relativePath, responseCode];
|
||||
[MLNNativeNetworkManager.sharedManager debugLog:@"Requesting %@ returned responseCode: %lu", res.URL.relativePath, responseCode];
|
||||
|
||||
NSDictionary *headers = [(NSHTTPURLResponse *)res allHeaderFields];
|
||||
NSString *cache_control = [headers objectForKey:@"Cache-Control"];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <mbgl/util/image+MGLAdditions.hpp>
|
||||
#include <mbgl/util/image+MLNAdditions.hpp>
|
||||
|
||||
#import <ImageIO/ImageIO.h>
|
||||
|
||||
@@ -11,7 +11,7 @@ using CGDataProviderHandle = CFHandle<CGDataProviderRef, CGDataProviderRef, CGDa
|
||||
using CGColorSpaceHandle = CFHandle<CGColorSpaceRef, CGColorSpaceRef, CGColorSpaceRelease>;
|
||||
using CGContextHandle = CFHandle<CGContextRef, CGContextRef, CGContextRelease>;
|
||||
|
||||
CGImageRef CGImageCreateWithMGLPremultipliedImage(mbgl::PremultipliedImage&& src) {
|
||||
CGImageRef CGImageCreateWithMLNPremultipliedImage(mbgl::PremultipliedImage&& src) {
|
||||
// We're converting the PremultipliedImage's backing store to a CGDataProvider, and are taking
|
||||
// over ownership of the memory.
|
||||
CGDataProviderHandle provider(CGDataProviderCreateWithData(
|
||||
@@ -41,7 +41,7 @@ CGImageRef CGImageCreateWithMGLPremultipliedImage(mbgl::PremultipliedImage&& src
|
||||
NULL, false, kCGRenderingIntentDefault);
|
||||
}
|
||||
|
||||
mbgl::PremultipliedImage MGLPremultipliedImageFromCGImage(CGImageRef src) {
|
||||
mbgl::PremultipliedImage MLNPremultipliedImageFromCGImage(CGImageRef src) {
|
||||
const size_t width = CGImageGetWidth(src);
|
||||
const size_t height = CGImageGetHeight(src);
|
||||
|
||||
@@ -89,7 +89,7 @@ PremultipliedImage decodeImage(const std::string& source) {
|
||||
throw std::runtime_error("CGImageSourceCreateImageAtIndex failed");
|
||||
}
|
||||
|
||||
return MGLPremultipliedImageFromCGImage(*image);
|
||||
return MLNPremultipliedImageFromCGImage(*image);
|
||||
}
|
||||
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -64,9 +64,9 @@ public:
|
||||
Creates a new rasterizer with the given font names as a fallback.
|
||||
|
||||
The fallback font names can also be specified in the style as a font stack
|
||||
or in the `MGLIdeographicFontFamilyName` key of
|
||||
or in the `MLNIdeographicFontFamilyName` key of
|
||||
`NSUserDefaults.standardUserDefaults`. The font stack takes precedence,
|
||||
followed by the `MGLIdeographicFontFamilyName` user default, then finally
|
||||
followed by the `MLNIdeographicFontFamilyName` user default, then finally
|
||||
the `fallbackFontNames_` parameter as a last resort.
|
||||
|
||||
@param fallbackFontNames_ A list of font names, one per line. Each font
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
*/
|
||||
Impl(const std::optional<std::string> fallbackFontNames_)
|
||||
{
|
||||
fallbackFontNames = [[NSUserDefaults standardUserDefaults] stringArrayForKey:@"MGLIdeographicFontFamilyName"];
|
||||
fallbackFontNames = [[NSUserDefaults standardUserDefaults] stringArrayForKey:@"MLNIdeographicFontFamilyName"];
|
||||
if (fallbackFontNames_) {
|
||||
fallbackFontNames = [fallbackFontNames ?: @[] arrayByAddingObjectsFromArray:[@(fallbackFontNames_->c_str()) componentsSeparatedByString:@"\n"]];
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <mbgl/interface/native_apple_interface.h>
|
||||
|
||||
@implementation MGLNativeNetworkManager
|
||||
@implementation MLNNativeNetworkManager
|
||||
|
||||
static MGLNativeNetworkManager *instance = nil;
|
||||
static MLNNativeNetworkManager *instance = nil;
|
||||
|
||||
+ (MGLNativeNetworkManager *)sharedManager {
|
||||
+ (MLNNativeNetworkManager *)sharedManager {
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
instance = [[MGLNativeNetworkManager alloc] init];
|
||||
instance = [[MLNNativeNetworkManager alloc] init];
|
||||
});
|
||||
return instance;
|
||||
}
|
||||
@@ -32,9 +32,9 @@ static MGLNativeNetworkManager *instance = nil;
|
||||
if (!configuration) {
|
||||
// For testing. Since we get a `nil` return when SDK is modular, we use
|
||||
// this for testing requests.
|
||||
// Same as `[MGLNetworkConfiguration defaultSessionConfiguration]` in
|
||||
// `MGLNetworkConfiguration.mm`.
|
||||
configuration = [MGLNativeNetworkManager testSessionConfiguration];
|
||||
// Same as `[MLNNetworkConfiguration defaultSessionConfiguration]` in
|
||||
// `MLNNetworkConfiguration.mm`.
|
||||
configuration = [MLNNativeNetworkManager testSessionConfiguration];
|
||||
}
|
||||
|
||||
return configuration;
|
||||
|
||||
@@ -35,10 +35,10 @@
|
||||
#import <netdb.h>
|
||||
|
||||
|
||||
NSString *const kMGLReachabilityChangedNotification = @"kMGLReachabilityChangedNotification";
|
||||
NSString *const kMLNReachabilityChangedNotification = @"kMLNReachabilityChangedNotification";
|
||||
|
||||
|
||||
@interface MGLReachability ()
|
||||
@interface MLNReachability ()
|
||||
|
||||
@property (nonatomic, assign) SCNetworkReachabilityRef reachabilityRef;
|
||||
@property (nonatomic, strong) dispatch_queue_t reachabilitySerialQueue;
|
||||
@@ -73,7 +73,7 @@ static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRea
|
||||
{
|
||||
#pragma unused (target)
|
||||
|
||||
MGLReachability *reachability = ((__bridge MGLReachability*)info);
|
||||
MLNReachability *reachability = ((__bridge MLNReachability*)info);
|
||||
|
||||
// We probably don't need an autoreleasepool here, as GCD docs state each queue has its own autorelease pool,
|
||||
// but what the heck eh?
|
||||
@@ -84,13 +84,13 @@ static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRea
|
||||
}
|
||||
|
||||
|
||||
@implementation MGLReachability
|
||||
@implementation MLNReachability
|
||||
|
||||
// MARK: - Class Constructor Methods
|
||||
|
||||
+(instancetype)reachabilityWithHostName:(NSString*)hostname
|
||||
{
|
||||
return [MGLReachability reachabilityWithHostname:hostname];
|
||||
return [MLNReachability reachabilityWithHostname:hostname];
|
||||
}
|
||||
|
||||
+(instancetype)reachabilityWithHostname:(NSString*)hostname
|
||||
@@ -456,7 +456,7 @@ static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRea
|
||||
|
||||
// this makes sure the change notification happens on the MAIN THREAD
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:kMGLReachabilityChangedNotification
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:kMLNReachabilityChangedNotification
|
||||
object:self];
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user