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

Files prefix changed from MGL to MLN #919

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion bin/offline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ int main(int argc, char *argv[]) {
}
}();

const char* apiEnv = getenv("MGL_API_KEY");
const char* apiEnv = getenv("MLN_API_KEY");
const std::string apiKey = tokenValue ? args::get(tokenValue) : (apiEnv ? apiEnv : std::string());

if (apiBaseValue) {
Expand Down
2 changes: 1 addition & 1 deletion bin/render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int main(int argc, char *argv[]) {
const std::string asset_root = assetsValue ? args::get(assetsValue) : ".";

// Try to load the apikey from the environment.
const char* apikeyEnv = getenv("MGL_API_KEY");
const char* apikeyEnv = getenv("MLN_API_KEY");
const std::string apikey = apikeyValue ? args::get(apikeyValue) : (apikeyEnv ? apikeyEnv : std::string());

const bool debug = debugFlag ? args::get(debugFlag) : false;
Expand Down
2 changes: 1 addition & 1 deletion platform/android/DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ With buck build support, Android Studio can complain about duplicate source file

_The test application (used for development purposes) uses MapTiler vector tiles, which require a MapTiler account and API key._

With the first gradle invocation, gradle will take the value of the `MGL_API_KEY` environment variable and save it to `MapboxGLAndroidSDKTestApp/src/main/res/values/developer-config.xml`. If the environment variable wasn't set, you can edit `developer-config.xml` manually and add your api key to the `api_key` resource.
With the first gradle invocation, gradle will take the value of the `MLN_API_KEY` environment variable and save it to `MapboxGLAndroidSDKTestApp/src/main/res/values/developer-config.xml`. If the environment variable wasn't set, you can edit `developer-config.xml` manually and add your api key to the `api_key` resource.

## Running project

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ open class MapLibreApplication : MultiDexApplication() {
private const val API_KEY_NOT_SET_MESSAGE =
(
"In order to run the Test App you need to set a valid " +
"API key. During development, you can set the MGL_API_KEY environment variable for the SDK to " +
"API key. During development, you can set the MLN_API_KEY environment variable for the SDK to " +
"automatically include it in the Test App. Otherwise, you can manually include it in the " +
"res/values/developer-config.xml file in the MapboxGLAndroidSDKTestApp folder."
)
Expand Down
4 changes: 2 additions & 2 deletions platform/android/gradle/gradle-config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
task apiKey {
def tokenFile = new File("${projectDir}/src/main/res/values/developer-config.xml")
if (!tokenFile.exists()) {
String apiKey = "$System.env.MGL_API_KEY"
String apiKey = "$System.env.MLN_API_KEY"
if (apiKey == "null") {
System.out.println("You should set the MGL_API_KEY environment variable.")
System.out.println("You should set the MLN_API_KEY environment variable.")
apiKey = "YOUR_API_KEY_GOES_HERE"
}
String tokenFileContents = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
Expand Down
4 changes: 2 additions & 2 deletions platform/darwin/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ objc_library(
hdrs = [
"include/mbgl/interface/native_apple_interface.h",
"include/mbgl/storage/reachability.h",
"include/mbgl/util/image+MGLAdditions.hpp",
"include/mbgl/util/image+MLNAdditions.hpp",
],
copts = WARNING_FLAGS + MAPLIBRE_FLAGS + [
"-fmodules",
Expand Down Expand Up @@ -42,7 +42,7 @@ objc_library(
hdrs = [
"include/mbgl/interface/native_apple_interface.h",
"include/mbgl/storage/reachability.h",
"include/mbgl/util/image+MGLAdditions.hpp",
"include/mbgl/util/image+MLNAdditions.hpp",
],
copts = CPP_FLAGS + MAPLIBRE_FLAGS + [
"-fcxx-modules",
Expand Down
14 changes: 7 additions & 7 deletions platform/darwin/include/mbgl/interface/native_apple_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

NS_ASSUME_NONNULL_BEGIN

@class MGLNativeNetworkManager;
@class MLNNativeNetworkManager;

@protocol MGLNativeNetworkDelegate <NSObject>
@protocol MLNNativeNetworkDelegate <NSObject>

@optional

- (NSURLSession *)sessionForNetworkManager:(MGLNativeNetworkManager *)networkManager;
- (NSURLSession *)sessionForNetworkManager:(MLNNativeNetworkManager *)networkManager;

@required

Expand All @@ -26,13 +26,13 @@ NS_ASSUME_NONNULL_BEGIN

@end

#define MGL_APPLE_EXPORT __attribute__((visibility ("default")))
#define MLN_APPLE_EXPORT __attribute__((visibility ("default")))

@interface MGLNativeNetworkManager: NSObject
@interface MLNNativeNetworkManager: NSObject

+ (MGLNativeNetworkManager *)sharedManager;
+ (MLNNativeNetworkManager *)sharedManager;

@property (nonatomic, weak) id<MGLNativeNetworkDelegate> delegate;
@property (nonatomic, weak) id<MLNNativeNetworkDelegate> delegate;

@property (nonatomic, readonly) NSURLSessionConfiguration *sessionConfiguration;

Expand Down
10 changes: 5 additions & 5 deletions platform/darwin/include/mbgl/storage/reachability.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
#endif

extern NSString *const kMGLReachabilityChangedNotification;
extern NSString *const kMLNReachabilityChangedNotification;

typedef NS_ENUM(NSInteger, NetworkStatus) {
// Apple NetworkStatus Compatible Names.
Expand All @@ -47,13 +47,13 @@ typedef NS_ENUM(NSInteger, NetworkStatus) {
ReachableViaWWAN = 1
};

@class MGLReachability;
@class MLNReachability;

typedef void (^NetworkReachable)(MGLReachability * reachability);
typedef void (^NetworkUnreachable)(MGLReachability * reachability);
typedef void (^NetworkReachable)(MLNReachability * reachability);
typedef void (^NetworkUnreachable)(MLNReachability * reachability);


@interface MGLReachability : NSObject
@interface MLNReachability : NSObject

@property (nonatomic, copy) NetworkReachable reachableBlock;
@property (nonatomic, copy) NetworkUnreachable unreachableBlock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include <CoreGraphics/CGImage.h>

// Creates a CGImage from a PremultipliedImage, taking over the memory ownership.
CGImageRef CGImageCreateWithMGLPremultipliedImage(mbgl::PremultipliedImage&&);
CGImageRef CGImageCreateWithMLNPremultipliedImage(mbgl::PremultipliedImage&&);

// Creates a PremultipliedImage by copying the pixels of the CGImage.
// Does not alter the retain count of the supplied CGImage.
mbgl::PremultipliedImage MGLPremultipliedImageFromCGImage(CGImageRef);
mbgl::PremultipliedImage MLNPremultipliedImageFromCGImage(CGImageRef);
22 changes: 11 additions & 11 deletions platform/darwin/src/http_file_source.mm
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void cancel() {
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();
Expand Down Expand Up @@ -141,7 +141,7 @@ void cancel() {

NSBundle *sdkBundle = HTTPFileSource::Impl::getSDKBundle();
if (sdkBundle) {
NSString *versionString = sdkBundle.infoDictionary[@"MGLSemanticVersionString"];
NSString *versionString = sdkBundle.infoDictionary[@"MLNSemanticVersionString"];
if (!versionString) {
versionString = sdkBundle.infoDictionary[@"CFBundleShortVersionString"];
}
Expand Down Expand Up @@ -213,15 +213,15 @@ void cancel() {

HTTPFileSource::~HTTPFileSource() = default;

MGL_APPLE_EXPORT
MLN_APPLE_EXPORT
BOOL isValidMapboxEndpoint(NSURL *url) {
return ([url.host isEqualToString:@"mapbox.com"] ||
[url.host hasSuffix:@".mapbox.com"] ||
[url.host isEqualToString:@"mapbox.cn"] ||
[url.host hasSuffix:@".mapbox.cn"]);
}

MGL_APPLE_EXPORT
MLN_APPLE_EXPORT
NSURL *resourceURL(const Resource& resource) {

NSURL *url = [NSURL URLWithString:@(resource.url.c_str())];
Expand Down Expand Up @@ -252,7 +252,7 @@ BOOL isValidMapboxEndpoint(NSURL *url) {

@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) {
Expand All @@ -268,14 +268,14 @@ BOOL isValidMapboxEndpoint(NSURL *url) {
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];
}
Expand All @@ -292,15 +292,15 @@ BOOL isValidMapboxEndpoint(NSURL *url) {
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 =
Expand Down Expand Up @@ -333,7 +333,7 @@ BOOL isValidMapboxEndpoint(NSURL *url) {
}
} 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"];
Expand Down
8 changes: 4 additions & 4 deletions platform/darwin/src/image.mm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <mbgl/util/image+MGLAdditions.hpp>
#include <mbgl/util/image+MLNAdditions.hpp>

#import <ImageIO/ImageIO.h>

Expand All @@ -11,7 +11,7 @@
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(
Expand Down Expand Up @@ -41,7 +41,7 @@ CGDataProviderHandle provider(CGDataProviderCreateWithData(
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);

Expand Down Expand Up @@ -89,7 +89,7 @@ CFDataHandle data(CFDataCreateWithBytesNoCopy(
throw std::runtime_error("CGImageSourceCreateImageAtIndex failed");
}

return MGLPremultipliedImageFromCGImage(*image);
return MLNPremultipliedImageFromCGImage(*image);
}

} // namespace mbgl
6 changes: 3 additions & 3 deletions platform/darwin/src/local_glyph_rasterizer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ the font (but not the font size).
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
Expand All @@ -77,7 +77,7 @@ the font (but not the font size).
*/
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"]];
}
Expand Down
14 changes: 7 additions & 7 deletions platform/darwin/src/native_apple_interface.m
Original file line number Diff line number Diff line change
@@ -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;
}
Expand All @@ -32,9 +32,9 @@ - (NSURLSessionConfiguration *)sessionConfiguration {
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;
Expand Down
12 changes: 6 additions & 6 deletions platform/darwin/src/reachability.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
#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;
Expand Down Expand Up @@ -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?
Expand All @@ -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
Expand Down Expand Up @@ -456,7 +456,7 @@ -(void)reachabilityChanged:(SCNetworkReachabilityFlags)flags

// 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];
});
}
Expand Down
2 changes: 1 addition & 1 deletion platform/default/src/mbgl/gfx/headless_frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ HeadlessFrontend::HeadlessFrontend(Size size_,
gfx::BackendScope guard {*getBackend()};

// onStyleImageMissing might be called during a render. The user implemented method
// could trigger a call to MGLRenderFrontend#update which overwrites `updateParameters`.
// could trigger a call to MLNRenderFrontend#update which overwrites `updateParameters`.
// Copy the shared pointer here so that the parameters aren't destroyed while `render(...)` is
// still using them.
auto updateParameters_ = updateParameters;
Expand Down
2 changes: 1 addition & 1 deletion platform/glfw/glfw_renderer_frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void GLFWRendererFrontend::render() {
mbgl::gfx::BackendScope guard { glfwView.getRendererBackend(), mbgl::gfx::BackendScope::ScopeType::Implicit };

// onStyleImageMissing might be called during a render. The user implemented method
// could trigger a call to MGLRenderFrontend#update which overwrites `updateParameters`.
// could trigger a call to MLNRenderFrontend#update which overwrites `updateParameters`.
// Copy the shared pointer here so that the parameters aren't destroyed while `render(...)` is
// still using them.
auto updateParameters_ = updateParameters;
Expand Down
2 changes: 1 addition & 1 deletion platform/glfw/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ int main(int argc, char *argv[]) {
}

// Set access token if present
const char* apikeyEnv = getenv("MGL_API_KEY");
const char* apikeyEnv = getenv("MLN_API_KEY");
const std::string apikey = apikeyValue ? args::get(apikeyValue) : (apikeyEnv ? apikeyEnv : std::string());

auto mapTilerConfiguration = mbgl::TileServerOptions::MapTilerConfiguration();
Expand Down
Loading