From 87ada1e73515d298533e57d73431b78ca3ddd950 Mon Sep 17 00:00:00 2001 From: Nadia Barbosa Date: Fri, 10 Jan 2020 11:05:11 -0800 Subject: [PATCH] Preparations for ios-v5.7.0-alpha.1 (#139) * Podspec & changelog updates for 5.7.0-alpha.1 * Bump to mapbox-gl-native/d3a5ed * Add files from #16031 (#140) * [ios] Add changed files * [ios] Add files to project * [ios] Bumped submodule * Bump vendor/mapbox-gl-native to master again Co-authored-by: Jordan Kiley --- .../darwin/src/MGLNetworkIntegrationManager.h | 8 ++ .../darwin/src/MGLNetworkIntegrationManager.m | 54 ++++++++++++++ platform/darwin/src/native_apple_interface.m | 73 +++++++++++++++++++ platform/ios/CHANGELOG.md | 2 +- .../Mapbox-iOS-SDK-snapshot-dynamic.podspec | 2 +- platform/ios/Mapbox-iOS-SDK-stripped.podspec | 2 +- platform/ios/Mapbox-iOS-SDK.podspec | 2 +- platform/ios/common.xcconfig | 4 +- platform/ios/ios.xcodeproj/project.pbxproj | 6 ++ vendor/mapbox-gl-native | 2 +- 10 files changed, 148 insertions(+), 7 deletions(-) create mode 100644 platform/darwin/src/MGLNetworkIntegrationManager.h create mode 100644 platform/darwin/src/MGLNetworkIntegrationManager.m create mode 100644 platform/darwin/src/native_apple_interface.m diff --git a/platform/darwin/src/MGLNetworkIntegrationManager.h b/platform/darwin/src/MGLNetworkIntegrationManager.h new file mode 100644 index 000000000..2c929e16f --- /dev/null +++ b/platform/darwin/src/MGLNetworkIntegrationManager.h @@ -0,0 +1,8 @@ +#import +#include + +@interface MGLNetworkIntegrationManager : NSObject + ++ (MGLNetworkIntegrationManager *)sharedManager; + +@end diff --git a/platform/darwin/src/MGLNetworkIntegrationManager.m b/platform/darwin/src/MGLNetworkIntegrationManager.m new file mode 100644 index 000000000..79c7f1515 --- /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 diff --git a/platform/darwin/src/native_apple_interface.m b/platform/darwin/src/native_apple_interface.m new file mode 100644 index 000000000..07dce0d5b --- /dev/null +++ b/platform/darwin/src/native_apple_interface.m @@ -0,0 +1,73 @@ +#import +#import + +@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 diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index a52ba6f67..0a00bfcd4 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -2,7 +2,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started. -## master +## 5.7.0 ### Other changes * Added new property `MGLMapView.panScrollingMode`, which allows you to limit the horizontal or vertical direction a user may pan on the map view. ([#108](https://github.com/mapbox/mapbox-gl-native-ios/pull/108)) diff --git a/platform/ios/Mapbox-iOS-SDK-snapshot-dynamic.podspec b/platform/ios/Mapbox-iOS-SDK-snapshot-dynamic.podspec index da49ae27c..92014431f 100644 --- a/platform/ios/Mapbox-iOS-SDK-snapshot-dynamic.podspec +++ b/platform/ios/Mapbox-iOS-SDK-snapshot-dynamic.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |m| - version = '5.6.0' + version = '5.7.0-alpha.1' m.name = 'Mapbox-iOS-SDK-snapshot-dynamic' m.version = "#{version}-snapshot" diff --git a/platform/ios/Mapbox-iOS-SDK-stripped.podspec b/platform/ios/Mapbox-iOS-SDK-stripped.podspec index d5e6b038c..04841aeca 100644 --- a/platform/ios/Mapbox-iOS-SDK-stripped.podspec +++ b/platform/ios/Mapbox-iOS-SDK-stripped.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |m| - version = '5.6.0' + version = '5.7.0-alpha.1' m.name = 'Mapbox-iOS-SDK-stripped' m.version = "#{version}-stripped" diff --git a/platform/ios/Mapbox-iOS-SDK.podspec b/platform/ios/Mapbox-iOS-SDK.podspec index cf05817de..622049246 100644 --- a/platform/ios/Mapbox-iOS-SDK.podspec +++ b/platform/ios/Mapbox-iOS-SDK.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |m| - version = '5.6.0' + version = '5.7.0-alpha.1' m.name = 'Mapbox-iOS-SDK' m.version = version diff --git a/platform/ios/common.xcconfig b/platform/ios/common.xcconfig index b6d8c8776..9240a6f42 100644 --- a/platform/ios/common.xcconfig +++ b/platform/ios/common.xcconfig @@ -56,7 +56,7 @@ GCC_WARN_UNUSED_FUNCTION = YES GCC_WARN_UNUSED_LABEL = YES GCC_WARN_UNUSED_VARIABLE = YES -HEADER_SEARCH_PATHS = $(inherited) "$(PROJECT_DIR)/../../vendor/mapbox-gl-native/include" "$(PROJECT_DIR)/../../vendor/mapbox-gl-native/platform/default/include" "$(PROJECT_DIR)/../../vendor/mapbox-gl-native/vendor/mapbox-base/mapbox/variant/include" "$(PROJECT_DIR)/../../vendor/mapbox-gl-native/vendor/mapbox-base/mapbox/geometry.hpp/include" "$(PROJECT_DIR)/../../vendor/mapbox-gl-native/vendor/mapbox-base/mapbox/value/include" "$(PROJECT_DIR)/../../vendor/mapbox-gl-native/vendor/mapbox-base/mapbox/geojson.hpp/include" "$(PROJECT_DIR)/../../vendor/mapbox-gl-native/vendor/mapbox-base/mapbox/optional" "$(PROJECT_DIR)/../../vendor/mapbox-gl-native/vendor/mapbox-base/mapbox/typewrapper/include" "$(PROJECT_DIR)/../../vendor/mapbox-gl-native/vendor/mapbox-base/mapbox/weak/include" "$(PROJECT_DIR)/../../vendor/mapbox-gl-native/vendor/mapbox-base/extras/rapidjson/include" "$(PROJECT_DIR)/../../vendor/mapbox-gl-native/vendor/mapbox-base/extras/expected-lite/include" "$(PROJECT_DIR)/../../vendor/mapbox-gl-native/vendor/polylabel/include" "$(PROJECT_DIR)/../../platform/darwin/include" +HEADER_SEARCH_PATHS = $(inherited) "$(PROJECT_DIR)/../../vendor/mapbox-gl-native/include" "$(PROJECT_DIR)/../../vendor/mapbox-gl-native/platform/default/include" "$(PROJECT_DIR)/../../vendor/mapbox-gl-native/vendor/mapbox-base/mapbox/variant/include" "$(PROJECT_DIR)/../../vendor/mapbox-gl-native/vendor/mapbox-base/mapbox/geometry.hpp/include" "$(PROJECT_DIR)/../../vendor/mapbox-gl-native/vendor/mapbox-base/mapbox/value/include" "$(PROJECT_DIR)/../../vendor/mapbox-gl-native/vendor/mapbox-base/mapbox/geojson.hpp/include" "$(PROJECT_DIR)/../../vendor/mapbox-gl-native/vendor/mapbox-base/mapbox/optional" "$(PROJECT_DIR)/../../vendor/mapbox-gl-native/vendor/mapbox-base/mapbox/typewrapper/include" "$(PROJECT_DIR)/../../vendor/mapbox-gl-native/vendor/mapbox-base/mapbox/weak/include" "$(PROJECT_DIR)/../../vendor/mapbox-gl-native/vendor/mapbox-base/extras/rapidjson/include" "$(PROJECT_DIR)/../../vendor/mapbox-gl-native/vendor/mapbox-base/extras/expected-lite/include" "$(PROJECT_DIR)/../../vendor/mapbox-gl-native/vendor/polylabel/include" "$(PROJECT_DIR)/../../platform/darwin/include" "$(PROJECT_DIR)/../../vendor/mapbox-gl-native/platform/darwin/include" LD_GENERATE_MAP_FILE = YES @@ -79,4 +79,4 @@ CLANG_WARN_IMPLICIT_SIGN_CONVERSION = NO CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = NO // Add developer config -#include? "developer.xcconfig" \ No newline at end of file +#include? "developer.xcconfig" diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index df50f76fd..0bce32929 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -384,6 +384,7 @@ 9C6E282D22A9815D0056B7BE /* MGLMapboxEvents.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C6E282922A980E50056B7BE /* MGLMapboxEvents.h */; }; 9C6E282F22A9824B0056B7BE /* MGLTelemetryConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = AC518DFD201BB55A00EBC820 /* MGLTelemetryConfig.h */; }; 9C6E283022A9824F0056B7BE /* MGLMapboxEvents.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C6E282922A980E50056B7BE /* MGLMapboxEvents.h */; }; + A490C46D23C688CD009AC158 /* MGLNetworkIntegrationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A490C46B23C688CC009AC158 /* MGLNetworkIntegrationManager.m */; }; A4DE3DCB23038C98005B3473 /* MGLMockGestureRecognizers.h in Sources */ = {isa = PBXBuildFile; fileRef = A4DE3DCA23038A7F005B3473 /* MGLMockGestureRecognizers.h */; }; A4DE3DCC23038CCA005B3473 /* MGLMockGestureRecognizers.m in Sources */ = {isa = PBXBuildFile; fileRef = A4DE3DC823038A07005B3473 /* MGLMockGestureRecognizers.m */; }; A4F3FB1D2254865900A30170 /* missing_icon.json in Resources */ = {isa = PBXBuildFile; fileRef = A4F3FB1C2254865900A30170 /* missing_icon.json */; }; @@ -1038,6 +1039,8 @@ 9C6E286522A9849E0056B7BE /* release-notes-jazzy.md.ejs */ = {isa = PBXFileReference; lastKnownFileType = text; path = "release-notes-jazzy.md.ejs"; sourceTree = ""; }; 9C6E286622A9849E0056B7BE /* deploy-snapshot.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "deploy-snapshot.sh"; sourceTree = ""; }; 9C6E286722A9849E0056B7BE /* release-notes.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = "release-notes.js"; sourceTree = ""; }; + A490C46B23C688CC009AC158 /* MGLNetworkIntegrationManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLNetworkIntegrationManager.m; sourceTree = ""; }; + A490C46C23C688CC009AC158 /* MGLNetworkIntegrationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLNetworkIntegrationManager.h; sourceTree = ""; }; A4DE3DC823038A07005B3473 /* MGLMockGestureRecognizers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLMockGestureRecognizers.m; sourceTree = ""; }; A4DE3DCA23038A7F005B3473 /* MGLMockGestureRecognizers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLMockGestureRecognizers.h; sourceTree = ""; }; A4F3FB1C2254865900A30170 /* missing_icon.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = missing_icon.json; sourceTree = ""; }; @@ -1956,6 +1959,8 @@ 1F2B94BF221636D800210640 /* MGLNetworkConfiguration_Private.h */, DD0902A21DB18DE700C5BDCE /* MGLNetworkConfiguration.m */, 3EA9337830C7738BF7F5493C /* MGLRendererConfiguration.h */, + A490C46C23C688CC009AC158 /* MGLNetworkIntegrationManager.h */, + A490C46B23C688CC009AC158 /* MGLNetworkIntegrationManager.m */, 3EA931BC4F087E166D538F21 /* MGLRendererConfiguration.mm */, 92F2C3EC1F0E3C3A00268EC0 /* MGLRendererFrontend.h */, DA8847EC1CBAFA5100AB86E3 /* MGLStyle.h */, @@ -2987,6 +2992,7 @@ files = ( DA1DC9971CB6E046006E619F /* main.m in Sources */, 354B839C1D2E9B48005D9406 /* MBXUserLocationAnnotationView.m in Sources */, + A490C46D23C688CD009AC158 /* MGLNetworkIntegrationManager.m in Sources */, 965DF51120F9430500438AAC /* MBXFrameTimeGraphView.m in Sources */, DA1DC9991CB6E054006E619F /* MBXAppDelegate.m in Sources */, 6FA9341721EF372100AA9CA8 /* MBXOrnamentsViewController.m in Sources */, diff --git a/vendor/mapbox-gl-native b/vendor/mapbox-gl-native index a552d151e..86a360534 160000 --- a/vendor/mapbox-gl-native +++ b/vendor/mapbox-gl-native @@ -1 +1 @@ -Subproject commit a552d151ea14f47144acfeec79964537071c21ae +Subproject commit 86a360534994cb37d3dddc53b71a2858d97419c3