This repository has been archived by the owner on Jun 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [ios] Add changed files * [ios] Add files to project * [ios] Bumped submodule
- Loading branch information
Showing
6 changed files
with
144 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#import <Foundation/Foundation.h> | ||
#include <mbgl/interface/native_apple_interface.h> | ||
|
||
@interface MGLNetworkIntegrationManager : NSObject <MGLNativeNetworkDelegate> | ||
|
||
+ (MGLNetworkIntegrationManager *)sharedManager; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#import "MGLNetworkIntegrationManager.h" | ||
|
||
#import "MGLLoggingConfiguration_Private.h" | ||
#import "MGLNetworkConfiguration_Private.h" | ||
|
||
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR | ||
#import "MGLAccountManager_Private.h" | ||
#endif | ||
|
||
@implementation MGLNetworkIntegrationManager | ||
|
||
static MGLNetworkIntegrationManager *instance = nil; | ||
|
||
+ (MGLNetworkIntegrationManager *)sharedManager { | ||
static dispatch_once_t onceToken; | ||
dispatch_once(&onceToken, ^{ | ||
instance = [[MGLNetworkIntegrationManager alloc] init]; | ||
}); | ||
return instance; | ||
} | ||
|
||
#pragma mark - MGLNativeAppleInterfaceManager delegate - | ||
|
||
- (NSURLSessionConfiguration *)sessionConfiguration { | ||
return [MGLNetworkConfiguration sharedManager].sessionConfiguration; | ||
} | ||
|
||
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR | ||
- (NSString *)skuToken { | ||
return MGLAccountManager.skuToken; | ||
} | ||
#endif | ||
|
||
- (void)startDownloadEvent:(NSString *)event type:(NSString *)type { | ||
[[MGLNetworkConfiguration sharedManager] startDownloadEvent:event type:@"tile"]; | ||
} | ||
|
||
- (void)cancelDownloadEventForResponse:(NSURLResponse *)response { | ||
[[MGLNetworkConfiguration sharedManager] cancelDownloadEventForResponse:response]; | ||
} | ||
|
||
- (void)stopDownloadEventForResponse:(NSURLResponse *)response { | ||
[[MGLNetworkConfiguration sharedManager] stopDownloadEventForResponse:response]; | ||
} | ||
|
||
- (void)debugLog:(NSString *)format, ... { | ||
MGLLogDebug(format); | ||
} | ||
|
||
- (void)errorLog:(NSString *)format, ... { | ||
MGLLogError(format); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <mbgl/interface/native_apple_interface.h> | ||
|
||
@implementation MGLNativeNetworkManager | ||
|
||
static MGLNativeNetworkManager *instance = nil; | ||
|
||
+ (MGLNativeNetworkManager *)sharedManager { | ||
static dispatch_once_t onceToken; | ||
dispatch_once(&onceToken, ^{ | ||
instance = [[MGLNativeNetworkManager alloc] init]; | ||
}); | ||
return instance; | ||
} | ||
|
||
- (NSURLSessionConfiguration *)sessionConfiguration { | ||
if (_delegate && [_delegate respondsToSelector:@selector(sessionConfiguration)]) { | ||
return [_delegate sessionConfiguration]; | ||
} | ||
// For testing. Since we get a `nil` return when SDK is modualar, we use this for testing requests. | ||
// Same as `[MGLNetworkConfiguration defaultSessionConfiguration]` in `MGLNetworkConfiguration.m`. | ||
return [self testSessionConfiguration]; | ||
} | ||
|
||
- (NSURLSessionConfiguration *)testSessionConfiguration { | ||
NSURLSessionConfiguration* sessionConfiguration = [NSURLSessionConfiguration defaultSessionConfiguration]; | ||
|
||
sessionConfiguration.timeoutIntervalForResource = 30; | ||
sessionConfiguration.HTTPMaximumConnectionsPerHost = 8; | ||
sessionConfiguration.requestCachePolicy = NSURLRequestReloadIgnoringLocalCacheData; | ||
sessionConfiguration.URLCache = nil; | ||
|
||
return sessionConfiguration; | ||
} | ||
|
||
- (NSString *)skuToken { | ||
if(_delegate && [_delegate respondsToSelector:@selector(skuToken)]) { | ||
return [_delegate skuToken]; | ||
} | ||
return nil; | ||
} | ||
|
||
- (void)startDownloadEvent:(NSString *)event type:(NSString *)type { | ||
if (_delegate && [_delegate respondsToSelector:@selector(startDownloadEvent:type:)]) { | ||
[_delegate startDownloadEvent:event type:type]; | ||
} | ||
} | ||
|
||
- (void)cancelDownloadEventForResponse:(NSURLResponse *)response { | ||
if (_delegate && [_delegate respondsToSelector:@selector(cancelDownloadEventForResponse:)]) { | ||
return [_delegate cancelDownloadEventForResponse:response]; | ||
} | ||
} | ||
|
||
- (void)stopDownloadEventForResponse:(NSURLResponse *)response { | ||
if (_delegate && [_delegate respondsToSelector:@selector(stopDownloadEventForResponse:)]) { | ||
return [_delegate stopDownloadEventForResponse:response]; | ||
} | ||
} | ||
|
||
- (void)debugLog:(NSString *)format, ...{ | ||
if (_delegate && [_delegate respondsToSelector:@selector(debugLog:)]) { | ||
return [_delegate debugLog:format]; | ||
} | ||
} | ||
|
||
- (void)errorLog:(NSString *)format, ...{ | ||
if (_delegate && [_delegate respondsToSelector:@selector(errorLog:)]) { | ||
return [_delegate errorLog:format]; | ||
} | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule mapbox-gl-native
updated
9 files
+15 −1 | circle.yml | |
+1 −0 | include/mbgl/map/map.hpp | |
+1 −0 | next/platform/ios/ios.cmake | |
+21 −0 | platform/android/src/native_map_view.cpp | |
+2 −0 | platform/android/src/native_map_view.hpp | |
+21 −0 | src/mbgl/map/map.cpp | |
+6 −11 | src/mbgl/style/sources/geojson_source_impl.cpp | |
+1 −0 | src/mbgl/util/thread_pool.hpp | |
+42 −0 | test/map/map.test.cpp |