diff options
author | m-stephen <truestyle2005@163.com> | 2019-12-14 13:38:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-14 13:38:46 +0800 |
commit | f9b72842761b8f66fc8e5429e936b840cf807dd7 (patch) | |
tree | 21bac914d27529d29306c511dcb3a41dec5c3897 /platform/darwin/src/MGLNetworkIntegrationManager.m | |
parent | 5538b6f41d9e5a8f7ab1b5b1c16d58fca2e8e181 (diff) | |
download | qtlocation-mapboxgl-f9b72842761b8f66fc8e5429e936b840cf807dd7.tar.gz |
[ios, macos]Remove iOS/macOS codes from native codes (#16031)
* add source/header
* add ios files
* add configs
* modify name
* http_file_source
* add interface delegate when map init
* fix name
* fix delegate name
* support mac os
* add mac os support
* make optional delegate when mac os
* mac/ios difference
* add ios change log
* cancel iOS/mac OS judgement
* cancel iOS/mac OS judgement
* cancel judgement in .m
* update
* update
* update http_file_source
* update ios
* update mac os
* add mac os file
* add mac os file to `.cmake`
* change names
* add log & fix format
* reset changelog commit
* update changelog
* rename iOS network manager
* Add a test configuration(same as default configuration) when mac os run tests
* re-add account type into `http_file_source`
* refactor
Diffstat (limited to 'platform/darwin/src/MGLNetworkIntegrationManager.m')
-rw-r--r-- | platform/darwin/src/MGLNetworkIntegrationManager.m | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLNetworkIntegrationManager.m b/platform/darwin/src/MGLNetworkIntegrationManager.m new file mode 100644 index 0000000000..79c7f15156 --- /dev/null +++ b/platform/darwin/src/MGLNetworkIntegrationManager.m @@ -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 |