From 6ecee083d6030c20f89b7c2a0c81e2322a06d200 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Fri, 5 Feb 2016 13:17:49 -0800 Subject: [PATCH 01/20] ios-v3.1.0-pre.4 --- CHANGELOG.md | 2 -- ios/Mapbox-iOS-SDK.podspec | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f70cf17b4..d31b6f903 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,8 +49,6 @@ Known issues: - Black Screen On Ice Cream Sandwich and Jelly Bean devices ([#2802](https://github.com/mapbox/mapbox-gl-native/issues/2802)) - Resolved in 2.2.0 -## iOS master - ## iOS 3.1.0 - The SDK is now distributed as a dynamic framework instead of a static library, resulting in a simpler installation workflow and significantly reduced download size. The framework contains both simulator and device content; due to [an Xcode bug](http://www.openradar.me/radar?id=6409498411401216), you’ll need to strip out the simulator content before submitting your application to the App Store. ([#3183](https://github.com/mapbox/mapbox-gl-native/pull/3183)) diff --git a/ios/Mapbox-iOS-SDK.podspec b/ios/Mapbox-iOS-SDK.podspec index 4e759db61..956a37a6f 100644 --- a/ios/Mapbox-iOS-SDK.podspec +++ b/ios/Mapbox-iOS-SDK.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |m| m.name = 'Mapbox-iOS-SDK' - m.version = '3.1.0-pre.3-symbols' + m.version = '3.1.0-pre.4-symbols' m.summary = 'Open source vector map solution for iOS with full styling capabilities.' m.description = 'Open source, OpenGL-based vector map solution for iOS with full styling capabilities and Cocoa Touch APIs.' From 8f48d64c0f16a2d0ba73affe62d6da68ca6f3fcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Fri, 5 Feb 2016 16:31:41 -0800 Subject: [PATCH 02/20] ios-v3.1.0 --- ios/Mapbox-iOS-SDK.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Mapbox-iOS-SDK.podspec b/ios/Mapbox-iOS-SDK.podspec index 956a37a6f..197538807 100644 --- a/ios/Mapbox-iOS-SDK.podspec +++ b/ios/Mapbox-iOS-SDK.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |m| m.name = 'Mapbox-iOS-SDK' - m.version = '3.1.0-pre.4-symbols' + m.version = '3.1.0' m.summary = 'Open source vector map solution for iOS with full styling capabilities.' m.description = 'Open source, OpenGL-based vector map solution for iOS with full styling capabilities and Cocoa Touch APIs.' From 35fdf32de5af7aef1b2d8f221ff74d631a40bcb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Sun, 7 Feb 2016 17:51:15 -0800 Subject: [PATCH 03/20] [ios] Load categories in MGLAccountManager for Fabric MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These categories need to be loaded explicitly so that they’re linked into the application binary. In the dynamic framework, they’re loaded inside the InitializeMapbox() framework initializer; for static frameworks, we recommend setting the -ObjC flag. Fabric uses the static framework without setting the -ObjC flag, so these redundant calls are needed. --- CHANGELOG.md | 6 +++++- platform/ios/src/MGLAccountManager.m | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d31b6f903..b02f7323c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,9 +49,13 @@ Known issues: - Black Screen On Ice Cream Sandwich and Jelly Bean devices ([#2802](https://github.com/mapbox/mapbox-gl-native/issues/2802)) - Resolved in 2.2.0 +## iOS 3.1.1 + +- Fixed Fabric compatibility. ([#3847](https://github.com/mapbox/mapbox-gl-native/pull/3847)) + ## iOS 3.1.0 -- The SDK is now distributed as a dynamic framework instead of a static library, resulting in a simpler installation workflow and significantly reduced download size. The framework contains both simulator and device content; due to [an Xcode bug](http://www.openradar.me/radar?id=6409498411401216), you’ll need to strip out the simulator content before submitting your application to the App Store. ([#3183](https://github.com/mapbox/mapbox-gl-native/pull/3183)) +- The SDK is now distributed as a dynamic framework instead of a static library, resulting in a simpler installation workflow and significantly reduced download size. The framework contains both simulator and device content. If you install the dynamic framework manually, you’ll need to strip out the simulator content before submitting your application to the App Store due to [an Xcode bug](http://www.openradar.me/radar?id=6409498411401216); see the installation instructions included with the framework for details. ([#3183](https://github.com/mapbox/mapbox-gl-native/pull/3183)) - Fixed an issue causing the entire MGLMapView to leak. ([#3447](https://github.com/mapbox/mapbox-gl-native/pull/3447)) - `MGLMapView` methods that alter the viewport now accept optional completion handlers. ([#3090](https://github.com/mapbox/mapbox-gl-native/pull/3090)) - You can now modify an annotation’s image after adding the annotation to the map. ([#3146](https://github.com/mapbox/mapbox-gl-native/pull/3146)) diff --git a/platform/ios/src/MGLAccountManager.m b/platform/ios/src/MGLAccountManager.m index 764f9f097..6b98d5286 100644 --- a/platform/ios/src/MGLAccountManager.m +++ b/platform/ios/src/MGLAccountManager.m @@ -1,7 +1,9 @@ #import "MGLAccountManager_Private.h" #import "MGLMapboxEvents.h" +#import "MGLMapView.h" #import "NSBundle+MGLAdditions.h" #import "NSProcessInfo+MGLAdditions.h" +#import "NSString+MGLAdditions.h" #import "FABKitProtocol.h" #import "Fabric+FABKits.h" @@ -93,6 +95,14 @@ } else { NSLog(@"MGLAccountManager is used in a project that doesn't have Fabric."); } + + // https://github.com/mapbox/mapbox-gl-native/issues/2966 + mgl_linkBundleCategory(); + mgl_linkStringCategory(); + mgl_linkProcessInfoCategory(); + + // https://github.com/mapbox/mapbox-gl-native/issues/3113 + [MGLMapView class]; } @end From 832334128145cb4431b45baf9a8e25d2b8a3eef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Tue, 9 Feb 2016 16:07:13 -0800 Subject: [PATCH 04/20] [ios] Set dynamic framework minimum deployment target to iOS 8.0 Fixes #3870. --- CHANGELOG.md | 1 + ios/framework/framework-ios.gypi | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b02f7323c..f49b766f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,7 @@ Known issues: ## iOS 3.1.1 +- Corrected the dynamic framework’s minimum deployment target to iOS 8.0. ([#3872](https://github.com/mapbox/mapbox-gl-native/pull/3872)) - Fixed Fabric compatibility. ([#3847](https://github.com/mapbox/mapbox-gl-native/pull/3847)) ## iOS 3.1.0 diff --git a/ios/framework/framework-ios.gypi b/ios/framework/framework-ios.gypi index 8c83523e5..241b69752 100644 --- a/ios/framework/framework-ios.gypi +++ b/ios/framework/framework-ios.gypi @@ -23,6 +23,7 @@ 'DEFINES_MODULE': 'YES', 'DYLIB_INSTALL_NAME_BASE': '@rpath', 'INFOPLIST_FILE': '../ios/framework/Info.plist', + 'IPHONEOS_DEPLOYMENT_TARGET': '8.0', 'LD_RUNPATH_SEARCH_PATHS': [ '$(inherited)', '@executable_path/Frameworks', From 2080d1976456bb4e70d657558eab0e4aa7a03605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Tue, 9 Feb 2016 23:56:25 -0800 Subject: [PATCH 05/20] [ios] Conform to SMCalloutViewDelegate #3322 #3456 replaced SMCalloutViewDelegate conformance with MGLCalloutViewDelegate conformance. Unfortunately, the two protocols differ in some symbols. This change restores SMCalloutViewDelegate methods alongside MGLCalloutViewDelegate methods. Fixes #3871. --- CHANGELOG.md | 1 + platform/ios/src/MGLMapView.mm | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f49b766f4..418d5c1ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ Known issues: - Corrected the dynamic framework’s minimum deployment target to iOS 8.0. ([#3872](https://github.com/mapbox/mapbox-gl-native/pull/3872)) - Fixed Fabric compatibility. ([#3847](https://github.com/mapbox/mapbox-gl-native/pull/3847)) +- Fixed an issue preventing `-[MGLMapViewDelegate mapView:tapOnCalloutForAnnotation:]` from being called when a non-custom callout view is tapped. ([#3875](https://github.com/mapbox/mapbox-gl-native/pull/3875)) ## iOS 3.1.0 diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 126328b5f..2040c40da 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -147,6 +147,7 @@ public: GLKViewDelegate, CLLocationManagerDelegate, UIActionSheetDelegate, + SMCalloutViewDelegate, MGLCalloutViewDelegate, UIAlertViewDelegate, MGLMultiPointDelegate, @@ -1482,6 +1483,14 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration) return [self.delegate respondsToSelector:@selector(mapView:tapOnCalloutForAnnotation:)]; } +- (void)calloutViewClicked:(__unused SMCalloutView *)calloutView +{ + if ([self.delegate respondsToSelector:@selector(mapView:tapOnCalloutForAnnotation:)]) + { + [self.delegate mapView:self tapOnCalloutForAnnotation:self.selectedAnnotation]; + } +} + - (void)calloutViewTapped:(__unused MGLCompactCalloutView *)calloutView { if ([self.delegate respondsToSelector:@selector(mapView:tapOnCalloutForAnnotation:)]) From 71611ec61247593aa6e9b568595114647363532d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Wed, 10 Feb 2016 09:34:19 -0800 Subject: [PATCH 06/20] [ios, osx] Fixed crash reselecting annotation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Handle the case where the currently selected annotation isn’t one of the nearby annotations. This hasn’t come up before on OS X because clicking an annotation while another annotation is selected only dismisses the callout popover. Fixes #3284. --- CHANGELOG.md | 1 + platform/ios/src/MGLMapView.mm | 21 +++++++++++++++------ platform/osx/src/MGLMapView.mm | 18 ++++++++++++------ 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 418d5c1ce..ebb4e0f49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ Known issues: - Corrected the dynamic framework’s minimum deployment target to iOS 8.0. ([#3872](https://github.com/mapbox/mapbox-gl-native/pull/3872)) - Fixed Fabric compatibility. ([#3847](https://github.com/mapbox/mapbox-gl-native/pull/3847)) +- Fixed a crash that can occur when reselecting an annotation. ([#3881](https://github.com/mapbox/mapbox-gl-native/pull/3881)) - Fixed an issue preventing `-[MGLMapViewDelegate mapView:tapOnCalloutForAnnotation:]` from being called when a non-custom callout view is tapped. ([#3875](https://github.com/mapbox/mapbox-gl-native/pull/3875)) ## iOS 3.1.0 diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 2040c40da..bb71a4c63 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -2698,19 +2698,28 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration) if (_selectedAnnotationTag == MGLAnnotationTagNotFound || _selectedAnnotationTag == _annotationsNearbyLastTap.back()) { - // Either an annotation from this set hasn’t been selected - // before or the last annotation in the set was selected. Wrap - // around to the first annotation in the set. + // Either no annotation is selected or the last annotation in + // the set was selected. Wrap around to the first annotation in + // the set. hitAnnotationTag = _annotationsNearbyLastTap.front(); } else { - // Step to the next annotation in the set. auto result = std::find(_annotationsNearbyLastTap.begin(), _annotationsNearbyLastTap.end(), _selectedAnnotationTag); - auto distance = std::distance(_annotationsNearbyLastTap.begin(), result); - hitAnnotationTag = _annotationsNearbyLastTap[distance + 1]; + if (result == _annotationsNearbyLastTap.end()) + { + // An annotation from this set hasn’t been selected before. + // Select the first (nearest) one. + hitAnnotationTag = _annotationsNearbyLastTap.front(); + } + else + { + // Step to the next annotation in the set. + auto distance = std::distance(_annotationsNearbyLastTap.begin(), result); + hitAnnotationTag = _annotationsNearbyLastTap[distance + 1]; + } } } else diff --git a/platform/osx/src/MGLMapView.mm b/platform/osx/src/MGLMapView.mm index 3a92c1901..065a3a00c 100644 --- a/platform/osx/src/MGLMapView.mm +++ b/platform/osx/src/MGLMapView.mm @@ -1757,17 +1757,23 @@ public: // set of annotations as we do now. Cycle through them. if (_lastSelectedAnnotationTag == MGLAnnotationTagNotFound || _lastSelectedAnnotationTag == _annotationsNearbyLastClick.back()) { - // Either an annotation from this set hasn’t been selected - // before or the last annotation in the set was selected. Wrap - // around to the first annotation in the set. + // Either no annotation is selected or the last annotation in + // the set was selected. Wrap around to the first annotation in + // the set. hitAnnotationTag = _annotationsNearbyLastClick.front(); } else { - // Step to the next annotation in the set. auto result = std::find(_annotationsNearbyLastClick.begin(), _annotationsNearbyLastClick.end(), _lastSelectedAnnotationTag); - auto distance = std::distance(_annotationsNearbyLastClick.begin(), result); - hitAnnotationTag = _annotationsNearbyLastClick[distance + 1]; + if (result == _annotationsNearbyLastClick.end()) { + // An annotation from this set hasn’t been selected before. + // Select the first (nearest) one. + hitAnnotationTag = _annotationsNearbyLastClick.front(); + } else { + // Step to the next annotation in the set. + auto distance = std::distance(_annotationsNearbyLastClick.begin(), result); + hitAnnotationTag = _annotationsNearbyLastClick[distance + 1]; + } } } else { // Remember the nearby annotations for the next time this method is From bd59ab9a5285bf56ecc7a02e180a21f269ad68c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Wed, 10 Feb 2016 15:15:29 -0800 Subject: [PATCH 07/20] [core, ios, osx] Only constrain after adding to a window Introduced a setter/getter for constrain mode. On iOS and OS X, the zoom level inspectable causes the zoom level to be set independently from the longitude and latitude. Thus, the latitude inspectable had no effect because the latitude was constrained to 0 at z0. Temporarily removing the heightwise constraint allows the map to center on the intended location before zooming, which is the usual case for storyboards and XIBs. On iOS, the only guarantee we have timing-wise is that all the inspectables are applied after initialization but before the view is added to a window. So we reimpose the heightwise constraint as soon as the view is added to a window, that is, before the user has a chance to pan the map out of bounds. Fixes #3868. --- CHANGELOG.md | 1 + include/mbgl/map/map.hpp | 4 ++++ include/mbgl/map/mode.hpp | 1 + platform/ios/src/MGLMapView.mm | 7 ++++++- platform/osx/src/MGLMapView.mm | 25 +++++++++++++++---------- src/mbgl/map/map.cpp | 10 ++++++++++ src/mbgl/map/transform.cpp | 11 +++++++++++ src/mbgl/map/transform.hpp | 4 ++++ src/mbgl/map/transform_state.cpp | 12 ++++++++++-- src/mbgl/map/transform_state.hpp | 3 +++ 10 files changed, 65 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ebb4e0f49..edb6743fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ Known issues: - Corrected the dynamic framework’s minimum deployment target to iOS 8.0. ([#3872](https://github.com/mapbox/mapbox-gl-native/pull/3872)) - Fixed Fabric compatibility. ([#3847](https://github.com/mapbox/mapbox-gl-native/pull/3847)) - Fixed a crash that can occur when reselecting an annotation. ([#3881](https://github.com/mapbox/mapbox-gl-native/pull/3881)) +- Fixed an issue preventing the Latitude inspectable from working when it is set before setting the Zoom Level inspectable in Interface Builder. ([#3886](https://github.com/mapbox/mapbox-gl-native/pull/3886)) - Fixed an issue preventing `-[MGLMapViewDelegate mapView:tapOnCalloutForAnnotation:]` from being called when a non-custom callout view is tapped. ([#3875](https://github.com/mapbox/mapbox-gl-native/pull/3875)) ## iOS 3.1.0 diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index 3a8503016..1afe7e86f 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -138,6 +138,10 @@ public: // North Orientation void setNorthOrientation(NorthOrientation); NorthOrientation getNorthOrientation() const; + + // Constrain mode + void setConstrainMode(ConstrainMode); + ConstrainMode getConstrainMode() const; // Size uint16_t getWidth() const; diff --git a/include/mbgl/map/mode.hpp b/include/mbgl/map/mode.hpp index c197b2858..7fd1a7f52 100644 --- a/include/mbgl/map/mode.hpp +++ b/include/mbgl/map/mode.hpp @@ -24,6 +24,7 @@ enum class GLContextMode : EnumType { // We can choose to constrain the map both horizontally or vertically, or only // vertically e.g. while panning. enum class ConstrainMode : EnumType { + None, HeightOnly, WidthAndHeight, }; diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index bb71a4c63..31058c3de 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -314,7 +314,7 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration) _mbglFileSource = new mbgl::DefaultFileSource([fileCachePath UTF8String], [[[[NSBundle mainBundle] resourceURL] path] UTF8String]); // setup mbgl map - _mbglMap = new mbgl::Map(*_mbglView, *_mbglFileSource, mbgl::MapMode::Continuous); + _mbglMap = new mbgl::Map(*_mbglView, *_mbglFileSource, mbgl::MapMode::Continuous, mbgl::GLContextMode::Unique, mbgl::ConstrainMode::None); // start paused if in IB if (_isTargetingInterfaceBuilder || background) { @@ -920,6 +920,11 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration) BOOL isVisible = self.superview && self.window; if (isVisible && ! _displayLink) { + if (_mbglMap->getConstrainMode() == mbgl::ConstrainMode::None) + { + _mbglMap->setConstrainMode(mbgl::ConstrainMode::HeightOnly); + } + _displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(updateFromDisplayLink)]; _displayLink.frameInterval = MGLTargetFrameInterval; [_displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes]; diff --git a/platform/osx/src/MGLMapView.mm b/platform/osx/src/MGLMapView.mm index 065a3a00c..73cbb7fe8 100644 --- a/platform/osx/src/MGLMapView.mm +++ b/platform/osx/src/MGLMapView.mm @@ -249,7 +249,7 @@ public: NSString *cachePath = cacheURL ? cacheURL.path : @""; _mbglFileSource = new mbgl::DefaultFileSource(cachePath.UTF8String, [[[[NSBundle mainBundle] resourceURL] path] UTF8String]); - _mbglMap = new mbgl::Map(*_mbglView, *_mbglFileSource, mbgl::MapMode::Continuous); + _mbglMap = new mbgl::Map(*_mbglView, *_mbglFileSource, mbgl::MapMode::Continuous, mbgl::GLContextMode::Unique, mbgl::ConstrainMode::None); // Install the OpenGL layer. Interface Builder’s synchronous drawing means // we can’t display a map, so don’t even bother to have a map layer. @@ -559,19 +559,24 @@ public: } - (void)viewDidMoveToWindow { - if (self.dormant && self.window) { + NSWindow *window = self.window; + if (self.dormant && window) { _mbglMap->resume(); self.dormant = NO; } - [self.window addObserver:self - forKeyPath:@"contentLayoutRect" - options:NSKeyValueObservingOptionInitial - context:NULL]; - [self.window addObserver:self - forKeyPath:@"titlebarAppearsTransparent" - options:NSKeyValueObservingOptionInitial - context:NULL]; + if (window && _mbglMap->getConstrainMode() == mbgl::ConstrainMode::None) { + _mbglMap->setConstrainMode(mbgl::ConstrainMode::HeightOnly); + } + + [window addObserver:self + forKeyPath:@"contentLayoutRect" + options:NSKeyValueObservingOptionInitial + context:NULL]; + [window addObserver:self + forKeyPath:@"titlebarAppearsTransparent" + options:NSKeyValueObservingOptionInitial + context:NULL]; } - (BOOL)wantsLayer { diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index 2df86a8f1..7e0fdd29f 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -395,6 +395,16 @@ NorthOrientation Map::getNorthOrientation() const { return transform->getNorthOrientation(); } +#pragma mark - Constrain mode + +void Map::setConstrainMode(mbgl::ConstrainMode mode) { + transform->setConstrainMode(mode); + update(Update::Repaint); +} + +ConstrainMode Map::getConstrainMode() const { + return transform->getConstrainMode(); +} #pragma mark - Projection diff --git a/src/mbgl/map/transform.cpp b/src/mbgl/map/transform.cpp index b8c816ddc..0f7af8c9e 100644 --- a/src/mbgl/map/transform.cpp +++ b/src/mbgl/map/transform.cpp @@ -560,6 +560,17 @@ NorthOrientation Transform::getNorthOrientation() const { return state.getNorthOrientation(); } +#pragma mark - Constrain mode + +void Transform::setConstrainMode(mbgl::ConstrainMode mode) { + state.constrainMode = mode; + state.constrain(state.scale, state.x, state.y); +} + +ConstrainMode Transform::getConstrainMode() const { + return state.getConstrainMode(); +} + #pragma mark - Transition void Transform::startTransition(const CameraOptions& camera, diff --git a/src/mbgl/map/transform.hpp b/src/mbgl/map/transform.hpp index 806413058..48615421f 100644 --- a/src/mbgl/map/transform.hpp +++ b/src/mbgl/map/transform.hpp @@ -119,6 +119,10 @@ public: // North Orientation void setNorthOrientation(NorthOrientation); NorthOrientation getNorthOrientation() const; + + // Constrain mode + void setConstrainMode(ConstrainMode); + ConstrainMode getConstrainMode() const; // Transitions bool inTransition() const; diff --git a/src/mbgl/map/transform_state.cpp b/src/mbgl/map/transform_state.cpp index 5e74f7622..009534fc8 100644 --- a/src/mbgl/map/transform_state.cpp +++ b/src/mbgl/map/transform_state.cpp @@ -94,6 +94,12 @@ double TransformState::getNorthOrientationAngle() const { return angleOrientation; } +#pragma mark - Constrain mode + +ConstrainMode TransformState::getConstrainMode() const { + return constrainMode; +} + #pragma mark - Position LatLng TransformState::getLatLng() const { @@ -367,8 +373,10 @@ void TransformState::constrain(double& scale_, double& x_, double& y_) const { x_ = std::max(-max_x, std::min(x_, max_x)); } - double max_y = (scale_ * util::tileSize - (rotatedNorth() ? width : height)) / 2; - y_ = std::max(-max_y, std::min(y_, max_y)); + if (constrainMode != ConstrainMode::None) { + double max_y = (scale_ * util::tileSize - (rotatedNorth() ? width : height)) / 2; + y_ = std::max(-max_y, std::min(y_, max_y)); + } } void TransformState::moveLatLng(const LatLng& latLng, const PrecisionPoint& anchor) { diff --git a/src/mbgl/map/transform_state.hpp b/src/mbgl/map/transform_state.hpp index 2aef5707f..dfcc1ed1a 100644 --- a/src/mbgl/map/transform_state.hpp +++ b/src/mbgl/map/transform_state.hpp @@ -36,6 +36,9 @@ public: // North Orientation NorthOrientation getNorthOrientation() const; double getNorthOrientationAngle() const; + + // Constrain mode + ConstrainMode getConstrainMode() const; // Position LatLng getLatLng() const; From 51d7d204dbed99ffec67002c6e27cce7f33d4077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Wed, 10 Feb 2016 22:02:40 -0800 Subject: [PATCH 08/20] [ios, osx] Exclude misses from nearby annotations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After filtering out elements of a vector using std::remove_if(), it’s apparently necessary to resize the vector. Otherwise, removing only has the effect of shifting the non-matching items to the end of the vector. This change reduces the annotation tap target back to almost what it was before #3261, except that these days the target is centered around the annotation image rather than the center point. There remains a much smaller slop area around the annotation, but nothing close to the effective padding before this change. Fixes #3880. --- CHANGELOG.md | 1 + platform/ios/src/MGLMapView.mm | 4 +++- platform/osx/src/MGLMapView.mm | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index edb6743fa..e6bc54a9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,7 @@ Known issues: - Fixed Fabric compatibility. ([#3847](https://github.com/mapbox/mapbox-gl-native/pull/3847)) - Fixed a crash that can occur when reselecting an annotation. ([#3881](https://github.com/mapbox/mapbox-gl-native/pull/3881)) - Fixed an issue preventing the Latitude inspectable from working when it is set before setting the Zoom Level inspectable in Interface Builder. ([#3886](https://github.com/mapbox/mapbox-gl-native/pull/3886)) +- Fixed an issue that incorrectly expanded the tappable area of an annotation and prevented the annotation’s alignment rect insets from having any effect on the tappable area. ([#3898](https://github.com/mapbox/mapbox-gl-native/pull/3898)) - Fixed an issue preventing `-[MGLMapViewDelegate mapView:tapOnCalloutForAnnotation:]` from being called when a non-custom callout view is tapped. ([#3875](https://github.com/mapbox/mapbox-gl-native/pull/3875)) ## iOS 3.1.0 diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 31058c3de..c4f6cd39a 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -2657,7 +2657,8 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration) // Filter out any annotation whose image is unselectable or for which // hit testing fails. - std::remove_if(nearbyAnnotations.begin(), nearbyAnnotations.end(), [&](const MGLAnnotationTag annotationTag) + auto end = std::remove_if(nearbyAnnotations.begin(), nearbyAnnotations.end(), + [&](const MGLAnnotationTag annotationTag) { id annotation = [self annotationWithTag:annotationTag]; NSAssert(annotation, @"Unknown annotation found nearby tap"); @@ -2674,6 +2675,7 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration) centeredAtCoordinate:annotation.coordinate]; return !!!CGRectIntersectsRect(annotationRect, hitRect); }); + nearbyAnnotations.resize(std::distance(nearbyAnnotations.begin(), end)); } MGLAnnotationTag hitAnnotationTag = MGLAnnotationTagNotFound; diff --git a/platform/osx/src/MGLMapView.mm b/platform/osx/src/MGLMapView.mm index 73cbb7fe8..ca282facd 100644 --- a/platform/osx/src/MGLMapView.mm +++ b/platform/osx/src/MGLMapView.mm @@ -1717,7 +1717,7 @@ public: // Filter out any annotation whose image is unselectable or for which // hit testing fails. - std::remove_if(nearbyAnnotations.begin(), nearbyAnnotations.end(), [&](const MGLAnnotationTag annotationTag) { + auto end = std::remove_if(nearbyAnnotations.begin(), nearbyAnnotations.end(), [&](const MGLAnnotationTag annotationTag) { NSAssert(_annotationContextsByAnnotationTag.count(annotationTag) != 0, @"Unknown annotation found nearby click"); id annotation = [self annotationWithTag:annotationTag]; if (!annotation) { @@ -1736,6 +1736,7 @@ public: return !!![annotationImage.image hitTestRect:hitRect withImageDestinationRect:annotationRect context:nil hints:nil flipped:NO]; }); + nearbyAnnotations.resize(std::distance(nearbyAnnotations.begin(), end)); } MGLAnnotationTag hitAnnotationTag = MGLAnnotationTagNotFound; From 49f070bdc32a0e41092b1074f29ed19a9859c57c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Wed, 10 Feb 2016 23:07:24 -0800 Subject: [PATCH 09/20] ios-v3.1.1-pre.1 --- ios/Mapbox-iOS-SDK.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Mapbox-iOS-SDK.podspec b/ios/Mapbox-iOS-SDK.podspec index 197538807..8298b0c6c 100644 --- a/ios/Mapbox-iOS-SDK.podspec +++ b/ios/Mapbox-iOS-SDK.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |m| m.name = 'Mapbox-iOS-SDK' - m.version = '3.1.0' + m.version = '3.1.1-pre.1-symbols' m.summary = 'Open source vector map solution for iOS with full styling capabilities.' m.description = 'Open source, OpenGL-based vector map solution for iOS with full styling capabilities and Cocoa Touch APIs.' From c5e3b2089181ff2467252dd7cf196df5f1f479d3 Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Fri, 12 Feb 2016 15:56:12 -0800 Subject: [PATCH 10/20] [ios] Update linked library extension to .tbd [skip ci] --- ios/docs/pod-README.md | 6 +++--- platform/ios/INSTALL.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ios/docs/pod-README.md b/ios/docs/pod-README.md index f0e28673b..37521fbe3 100644 --- a/ios/docs/pod-README.md +++ b/ios/docs/pod-README.md @@ -42,9 +42,9 @@ If your application targets iOS 7.x, you’ll need to install the static framewo - `MobileCoreServices.framework` - `QuartzCore.framework` - `SystemConfiguration.framework` - - `libc++.dylib` - - `libsqlite3.dylib` - - `libz.dylib` + - `libc++.tbd` + - `libsqlite3.tbd` + - `libz.tbd` 1. In the Build Settings tab, add `-ObjC` to the “Other Linker Flags” (`OTHER_LDFLAGS`) build setting. diff --git a/platform/ios/INSTALL.md b/platform/ios/INSTALL.md index 9b5d30661..1da173d3d 100644 --- a/platform/ios/INSTALL.md +++ b/platform/ios/INSTALL.md @@ -104,9 +104,9 @@ If your application targets iOS 7.x, you’ll need to install the static framewo - `MobileCoreServices.framework` - `QuartzCore.framework` - `SystemConfiguration.framework` - - `libc++.dylib` - - `libsqlite3.dylib` - - `libz.dylib` + - `libc++.tbd` + - `libsqlite3.tbd` + - `libz.tbd` 1. In the Build Settings tab, add `-ObjC` to the “Other Linker Flags” (`OTHER_LDFLAGS`) build setting. From a7e61bee541c882e7dda1585d93f2d8cc58c96e7 Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Fri, 12 Feb 2016 19:43:49 -0800 Subject: [PATCH 11/20] [ios] Fix screenshot link in generated docs [skip ci] --- ios/docs/doc-README.md | 2 +- ios/docs/pod-README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ios/docs/doc-README.md b/ios/docs/doc-README.md index 0565d65cd..d3c4bd5e4 100644 --- a/ios/docs/doc-README.md +++ b/ios/docs/doc-README.md @@ -2,7 +2,7 @@ The Mapbox iOS SDK is an open-source framework for embedding interactive map views with scalable, customizable vector maps into Cocoa Touch applications on iOS 7.0 and above using Objective-C, Swift, or Interface Builder. It takes stylesheets that conform to the [Mapbox GL Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/), applies them to vector tiles that conform to the [Mapbox Vector Tile Specification](https://www.mapbox.com/developers/vector-tiles/), and renders them using OpenGL. -[![](https://raw.githubusercontent.com/mapbox/mapbox-gl-native/master/ios/screenshot.png)]() +[![](https://raw.githubusercontent.com/mapbox/mapbox-gl-native/master/platform/ios/screenshot.png)]() For setup information, check out the [Mapbox iOS SDK homepage](https://www.mapbox.com/ios-sdk/). For detailed usage instructions, read “[First steps with the Mapbox iOS SDK](https://www.mapbox.com/help/first-steps-ios-sdk/)” and consult the [online examples](https://www.mapbox.com/ios-sdk/examples/). A [full changelog](https://github.com/mapbox/mapbox-gl-native/blob/master/CHANGELOG.md) is also available. diff --git a/ios/docs/pod-README.md b/ios/docs/pod-README.md index 37521fbe3..ff1cd1199 100644 --- a/ios/docs/pod-README.md +++ b/ios/docs/pod-README.md @@ -4,7 +4,7 @@ The Mapbox iOS SDK is an open-source framework for embedding interactive map vie For more information, check out the [Mapbox iOS SDK homepage](https://www.mapbox.com/ios-sdk/) and the [full changelog](https://github.com/mapbox/mapbox-gl-native/blob/master/CHANGELOG.md) online. -[![](https://raw.githubusercontent.com/mapbox/mapbox-gl-native/master/ios/screenshot.png)]() +[![](https://raw.githubusercontent.com/mapbox/mapbox-gl-native/master/platform/ios/screenshot.png)]() ## Installation From 55fca26ea5cd76c681456462beeddcaa8f8202c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Sat, 13 Feb 2016 09:56:44 -0800 Subject: [PATCH 12/20] [ios] Distinguish between AGV and semver Distinguish between Apple Generic Versioning and Semantic Versioning in Info.plist. Also fill in the build number in the dynamic framework. Fixes #3911. --- platform/ios/scripts/package.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/platform/ios/scripts/package.sh b/platform/ios/scripts/package.sh index 97f0c74fc..47bee960c 100755 --- a/platform/ios/scripts/package.sh +++ b/platform/ios/scripts/package.sh @@ -191,7 +191,8 @@ if [[ ${BUILD_STATIC} == true ]]; then fi step "Copying library resources…" -SHORT_VERSION=$( git describe --tags --match=ios-v*.*.* --abbrev=0 | sed 's/^ios-v//' ) +SEM_VERSION=$( git describe --tags --match=ios-v*.*.* --abbrev=0 | sed 's/^ios-v//' ) +SHORT_VERSION=${SEM_VERSION%-*} cp -pv LICENSE.md "${OUTPUT}" cp -rv ios/app/Settings.bundle "${OUTPUT}" if [[ ${BUILD_STATIC} == true ]]; then @@ -202,11 +203,16 @@ if [[ ${BUILD_STATIC} == true ]]; then plutil -replace CFBundleName -string ${NAME} "${OUTPUT}/static/${NAME}.framework/Info.plist" plutil -replace CFBundleShortVersionString -string "${SHORT_VERSION}" "${OUTPUT}/static/${NAME}.framework/Info.plist" plutil -replace CFBundleVersion -string ${PROJ_VERSION} "${OUTPUT}/static/${NAME}.framework/Info.plist" + plutil -replace MGLSemanticVersionString -string "${SEM_VERSION}" "${OUTPUT}/static/${NAME}.framework/Info.plist" + plutil -replace MGLCommitHash -string "${HASH}" "${OUTPUT}/static/${NAME}.framework/Info.plist" mkdir "${OUTPUT}/static/${NAME}.framework/Modules" cp -pv ios/framework/modulemap "${OUTPUT}/static/${NAME}.framework/Modules/module.modulemap" fi if [[ ${BUILD_DYNAMIC} == true ]]; then plutil -replace CFBundleShortVersionString -string "${SHORT_VERSION}" "${OUTPUT}/dynamic/${NAME}.framework/Info.plist" + plutil -replace CFBundleVersion -string "${PROJ_VERSION}" "${OUTPUT}/dynamic/${NAME}.framework/Info.plist" + plutil -replace MGLSemanticVersionString -string "${SEM_VERSION}" "${OUTPUT}/dynamic/${NAME}.framework/Info.plist" + plutil -replace MGLCommitHash -string "${HASH}" "${OUTPUT}/dynamic/${NAME}.framework/Info.plist" cp -pv ios/framework/strip-frameworks.sh "${OUTPUT}/dynamic/${NAME}.framework/strip-frameworks.sh" fi sed -n -e '/^## iOS/,$p' CHANGELOG.md > "${OUTPUT}/CHANGELOG.md" From c7e885643da4097cac18ab0d854a73217065eca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Sat, 13 Feb 2016 11:23:45 -0800 Subject: [PATCH 13/20] ios-v3.1.1-pre.2 --- ios/Mapbox-iOS-SDK.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Mapbox-iOS-SDK.podspec b/ios/Mapbox-iOS-SDK.podspec index 8298b0c6c..f54ed541f 100644 --- a/ios/Mapbox-iOS-SDK.podspec +++ b/ios/Mapbox-iOS-SDK.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |m| m.name = 'Mapbox-iOS-SDK' - m.version = '3.1.1-pre.1-symbols' + m.version = '3.1.1-pre.2-symbols' m.summary = 'Open source vector map solution for iOS with full styling capabilities.' m.description = 'Open source, OpenGL-based vector map solution for iOS with full styling capabilities and Cocoa Touch APIs.' From 16d4aa29333291fc82ddc3ec7e3f896b21d2a51d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Mon, 15 Feb 2016 10:25:37 -0800 Subject: [PATCH 14/20] ios-v3.1.1 --- ios/Mapbox-iOS-SDK.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Mapbox-iOS-SDK.podspec b/ios/Mapbox-iOS-SDK.podspec index f54ed541f..a6f2779ba 100644 --- a/ios/Mapbox-iOS-SDK.podspec +++ b/ios/Mapbox-iOS-SDK.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |m| m.name = 'Mapbox-iOS-SDK' - m.version = '3.1.1-pre.2-symbols' + m.version = '3.1.1' m.summary = 'Open source vector map solution for iOS with full styling capabilities.' m.description = 'Open source, OpenGL-based vector map solution for iOS with full styling capabilities and Cocoa Touch APIs.' From a503048457d154fff091f2e507c9b898efdd28fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Mon, 15 Feb 2016 11:52:23 -0800 Subject: [PATCH 15/20] [ios] Updated podspec screenshot URL --- ios/Mapbox-iOS-SDK.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Mapbox-iOS-SDK.podspec b/ios/Mapbox-iOS-SDK.podspec index a6f2779ba..5f7238d31 100644 --- a/ios/Mapbox-iOS-SDK.podspec +++ b/ios/Mapbox-iOS-SDK.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |m| m.homepage = 'https://www.mapbox.com/ios-sdk/' m.license = { :type => 'BSD', :file => 'LICENSE.md' } m.author = { 'Mapbox' => 'mobile@mapbox.com' } - m.screenshot = 'https://raw.githubusercontent.com/mapbox/mapbox-gl-native/master/ios/screenshot.png' + m.screenshot = 'https://raw.githubusercontent.com/mapbox/mapbox-gl-native/master/platform/ios/screenshot.png' m.social_media_url = 'https://twitter.com/mapbox' m.documentation_url = 'https://www.mapbox.com/ios-sdk/' From 1c25dc098e837256a990225f2a2cc82a1eb6d1e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Thu, 18 Feb 2016 14:41:47 -0800 Subject: [PATCH 16/20] [ios] Import required frameworks with static framework umbrella The umbrella header inside the static framework now imports the required iOS SDK frameworks so manual linking is unnecessary. This change corrects a regression introduced in #3183, when the umbrella header used in version 3.0.1 was removed. --- ios/docs/pod-README.md | 9 ++------- ios/framework/Mapbox-static.h | 3 +++ platform/ios/INSTALL.md | 9 ++------- platform/ios/scripts/package.sh | 2 ++ 4 files changed, 9 insertions(+), 14 deletions(-) create mode 100644 ios/framework/Mapbox-static.h diff --git a/ios/docs/pod-README.md b/ios/docs/pod-README.md index ff1cd1199..9a901dec0 100644 --- a/ios/docs/pod-README.md +++ b/ios/docs/pod-README.md @@ -16,7 +16,7 @@ The Mapbox iOS SDK may be installed as either a dynamic framework or a static fr This is the recommended workflow for manually integrating the SDK into an application targeting iOS 8 and above: -1. Open the project editor and select your application target. Drag `Mapbox.framework` from the `dynamic` folder into the “Embedded Binaries” section of the General tab. In the sheet that appears, make sure “Copy items if needed” is checked, then click Finish. +1. Open the project editor and select your application target. Drag `Mapbox.framework` from the `dynamic` folder into the “Embedded Binaries” section of the General tab. (Don’t drag it into the “Linked Frameworks and Libraries” section; Xcode will add it there automatically.) In the sheet that appears, make sure “Copy items if needed” is checked, then click Finish. 1. In the Build Phases tab, click the + button at the top and select “New Run Script Phase”. Enter the following code into the script text field: @@ -33,18 +33,13 @@ bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/Mapbox.framework/strip-fra If your application targets iOS 7.x, you’ll need to install the static framework instead: -1. Open the project editor and select your application target. Drag `Mapbox.framework` from the `static` folder into the “Embedded Binaries” section of the General tab. In the sheet that appears, make sure “Copy items if needed” is checked, then click Finish. +1. Open the project editor and select your application target. Drag `Mapbox.framework` from the `static` folder into the “Embedded Binaries” section of the General tab. (Don’t drag it into the “Linked Frameworks and Libraries” section; Xcode will add it there automatically.) In the sheet that appears, make sure “Copy items if needed” is checked, then click Finish. 1. Add the following Cocoa Touch frameworks and libraries to the “Linked Frameworks and Libraries” section: - `GLKit.framework` - `ImageIO.framework` - `MobileCoreServices.framework` - - `QuartzCore.framework` - - `SystemConfiguration.framework` - - `libc++.tbd` - - `libsqlite3.tbd` - - `libz.tbd` 1. In the Build Settings tab, add `-ObjC` to the “Other Linker Flags” (`OTHER_LDFLAGS`) build setting. diff --git a/ios/framework/Mapbox-static.h b/ios/framework/Mapbox-static.h new file mode 100644 index 000000000..d3674b0b6 --- /dev/null +++ b/ios/framework/Mapbox-static.h @@ -0,0 +1,3 @@ +#import +#import +#import diff --git a/platform/ios/INSTALL.md b/platform/ios/INSTALL.md index 1da173d3d..776c02ecf 100644 --- a/platform/ios/INSTALL.md +++ b/platform/ios/INSTALL.md @@ -79,7 +79,7 @@ This is the recommended workflow for manually integrating the SDK into an applic 1. Build from source manually per above. -1. Open the project editor and select your application target. Drag `build/ios/pkg/dynamic/Mapbox.framework` into the “Embedded Binaries” section of the General tab. In the sheet that appears, make sure “Copy items if needed” is checked, then click Finish. +1. Open the project editor and select your application target. Drag `build/ios/pkg/dynamic/Mapbox.framework` into the “Embedded Binaries” section of the General tab. (Don’t drag it into the “Linked Frameworks and Libraries” section; Xcode will add it there automatically.) In the sheet that appears, make sure “Copy items if needed” is checked, then click Finish. 1. In the Build Phases tab, click the + button at the top and select “New Run Script Phase”. Enter the following code into the script text field: @@ -95,18 +95,13 @@ If your application targets iOS 7.x, you’ll need to install the static framewo 1. Build from source manually per above. -1. Open the project editor and select your application target. Drag `build/ios/pkg/static/Mapbox.framework` into the “Embedded Binaries” section of the General tab. In the sheet that appears, make sure “Copy items if needed” is checked, then click Finish. +1. Open the project editor and select your application target. Drag `build/ios/pkg/static/Mapbox.framework` into the “Embedded Binaries” section of the General tab. (Don’t drag it into the “Linked Frameworks and Libraries” section; Xcode will add it there automatically.) In the sheet that appears, make sure “Copy items if needed” is checked, then click Finish. 1. Add the following Cocoa Touch frameworks and libraries to the “Linked Frameworks and Libraries” section: - `GLKit.framework` - `ImageIO.framework` - `MobileCoreServices.framework` - - `QuartzCore.framework` - - `SystemConfiguration.framework` - - `libc++.tbd` - - `libsqlite3.tbd` - - `libz.tbd` 1. In the Build Settings tab, add `-ObjC` to the “Other Linker Flags” (`OTHER_LDFLAGS`) build setting. diff --git a/platform/ios/scripts/package.sh b/platform/ios/scripts/package.sh index 47bee960c..4a964d434 100755 --- a/platform/ios/scripts/package.sh +++ b/platform/ios/scripts/package.sh @@ -188,6 +188,8 @@ if [[ ${BUILD_STATIC} == true ]]; then step "Copying static library headers…" mkdir -p "${OUTPUT}/static/${NAME}.framework/Headers" cp -pv include/mbgl/{darwin,ios}/*.h "${OUTPUT}/static/${NAME}.framework/Headers" + cat ios/framework/Mapbox-static.h > "${OUTPUT}/static/${NAME}.framework/Headers/Mapbox.h" + cat ios/framework/Mapbox.h >> "${OUTPUT}/static/${NAME}.framework/Headers/Mapbox.h" fi step "Copying library resources…" From 9f4e8dd676a61289361ed8a0a79bd6582a6854d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Thu, 18 Feb 2016 14:51:51 -0800 Subject: [PATCH 17/20] [ios] Removed manual framework linking from installation instructions Even these three are no longer needed, now that the umbrella header pulls them in. --- ios/docs/pod-README.md | 6 ------ platform/ios/INSTALL.md | 6 ------ 2 files changed, 12 deletions(-) diff --git a/ios/docs/pod-README.md b/ios/docs/pod-README.md index 9a901dec0..f5c306147 100644 --- a/ios/docs/pod-README.md +++ b/ios/docs/pod-README.md @@ -35,12 +35,6 @@ If your application targets iOS 7.x, you’ll need to install the static framewo 1. Open the project editor and select your application target. Drag `Mapbox.framework` from the `static` folder into the “Embedded Binaries” section of the General tab. (Don’t drag it into the “Linked Frameworks and Libraries” section; Xcode will add it there automatically.) In the sheet that appears, make sure “Copy items if needed” is checked, then click Finish. -1. Add the following Cocoa Touch frameworks and libraries to the “Linked Frameworks and Libraries” section: - - - `GLKit.framework` - - `ImageIO.framework` - - `MobileCoreServices.framework` - 1. In the Build Settings tab, add `-ObjC` to the “Other Linker Flags” (`OTHER_LDFLAGS`) build setting. {{/STATIC}} diff --git a/platform/ios/INSTALL.md b/platform/ios/INSTALL.md index 776c02ecf..fab16bbfe 100644 --- a/platform/ios/INSTALL.md +++ b/platform/ios/INSTALL.md @@ -97,12 +97,6 @@ If your application targets iOS 7.x, you’ll need to install the static framewo 1. Open the project editor and select your application target. Drag `build/ios/pkg/static/Mapbox.framework` into the “Embedded Binaries” section of the General tab. (Don’t drag it into the “Linked Frameworks and Libraries” section; Xcode will add it there automatically.) In the sheet that appears, make sure “Copy items if needed” is checked, then click Finish. -1. Add the following Cocoa Touch frameworks and libraries to the “Linked Frameworks and Libraries” section: - - - `GLKit.framework` - - `ImageIO.framework` - - `MobileCoreServices.framework` - 1. In the Build Settings tab, add `-ObjC` to the “Other Linker Flags” (`OTHER_LDFLAGS`) build setting. ### Use From 15b9f3171a1c41d5a4c2b454fcce9b92350e28f2 Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Wed, 20 Jan 2016 20:04:12 -0500 Subject: [PATCH 18/20] [ios] Refactor MGLMapView's location services MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Pause location services when the app goes to sleep; address iOS 8 blue bar issue. - Only ask for location permissions if not already granted/denied. - Cleanup usage of `.isDormant` → `.dormant` Partially addresses #2945, for which a full and complete fix waits until #4030. --- platform/ios/src/MGLMapView.mm | 85 ++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 35 deletions(-) diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index c4f6cd39a..83904f168 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -760,7 +760,7 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration) // This is the delegate of the GLKView object's display call. - (void)glkView:(__unused GLKView *)view drawInRect:(__unused CGRect)rect { - if ( ! self.isDormant) + if ( ! self.dormant) { CGFloat zoomFactor = _mbglMap->getMaxZoom() - _mbglMap->getMinZoom() + 1; CGFloat cpuFactor = (CGFloat)[[NSProcessInfo processInfo] processorCount]; @@ -906,7 +906,7 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration) { MGLAssertIsMainThread(); - if ( ! self.isDormant) + if ( ! self.dormant) { [self validateDisplayLink]; self.dormant = YES; @@ -957,6 +957,8 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration) { self.dormant = YES; + [self validateLocationServices]; + [MGLMapboxEvents flush]; _displayLink.paused = YES; @@ -1006,6 +1008,8 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration) _mbglMap->resume(); _displayLink.paused = NO; + + [self validateLocationServices]; } } @@ -3022,6 +3026,48 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration) #pragma mark - User Location - +- (void)validateLocationServices +{ + BOOL shouldEnableLocationServices = self.showsUserLocation && !self.dormant; + + if (shouldEnableLocationServices && ! self.locationManager) + { + self.locationManager = [[CLLocationManager alloc] init]; + +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000 + if ([CLLocationManager instancesRespondToSelector:@selector(requestWhenInUseAuthorization)] && [CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined) + { + BOOL hasLocationDescription = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationAlwaysUsageDescription"] || [[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationWhenInUseUsageDescription"]; + if (!hasLocationDescription) + { + [NSException raise:@"Missing Location Services usage description" format: + @"In iOS 8 and above, this app must have a value for NSLocationAlwaysUsageDescription or NSLocationWhenInUseUsageDescription in its Info.plist."]; + } + + if ([[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationAlwaysUsageDescription"]) + { + [self.locationManager requestAlwaysAuthorization]; + } + else if ([[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationWhenInUseUsageDescription"]) + { + [self.locationManager requestWhenInUseAuthorization]; + } + } +#endif + + self.locationManager.headingFilter = 5.0; + self.locationManager.delegate = self; + [self.locationManager startUpdatingLocation]; + } + else if ( ! shouldEnableLocationServices && self.locationManager) + { + [self.locationManager stopUpdatingLocation]; + [self.locationManager stopUpdatingHeading]; + self.locationManager.delegate = nil; + self.locationManager = nil; + } +} + - (void)setShowsUserLocation:(BOOL)showsUserLocation { if (showsUserLocation == _showsUserLocation || _isTargetingInterfaceBuilder) return; @@ -3039,42 +3085,11 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration) self.userLocationAnnotationView.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin); - self.locationManager = [CLLocationManager new]; - -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000 - // enable iOS 8+ location authorization API - // - if ([CLLocationManager instancesRespondToSelector:@selector(requestWhenInUseAuthorization)]) - { - BOOL hasLocationDescription = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationWhenInUseUsageDescription"] || - [[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationAlwaysUsageDescription"]; - if (!hasLocationDescription) - { - [NSException raise:@"Missing Location Services usage description" format: - @"In iOS 8 and above, this app must have a value for NSLocationWhenInUseUsageDescription or NSLocationAlwaysUsageDescription in its Info.plist."]; - } - // request location permissions, if both keys exist ask for less permissive - if ([[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationWhenInUseUsageDescription"]) - { - [self.locationManager requestWhenInUseAuthorization]; - } - else if ([[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationAlwaysUsageDescription"]) - { - [self.locationManager requestAlwaysAuthorization]; - } - } -#endif - - self.locationManager.headingFilter = 5.0; - self.locationManager.delegate = self; - [self.locationManager startUpdatingLocation]; + [self validateLocationServices]; } else { - [self.locationManager stopUpdatingLocation]; - [self.locationManager stopUpdatingHeading]; - self.locationManager.delegate = nil; - self.locationManager = nil; + [self validateLocationServices]; if ([self.delegate respondsToSelector:@selector(mapViewDidStopLocatingUser:)]) { From 7bed2cebd2d78762650dbe2cbf895fc1673ba8da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Mon, 22 Feb 2016 10:44:49 -0800 Subject: [PATCH 19/20] [ios] Restored framework dependencies to static installation instructions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backed out documentation about #4029 because it doesn’t apply when using a storyboard, and the installation instructions use a storyboard. --- CHANGELOG.md | 5 +++++ ios/docs/pod-README.md | 11 +++++++++++ platform/ios/INSTALL.md | 11 +++++++++++ 3 files changed, 27 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6bc54a9b..9324d8be8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,11 @@ Known issues: - Black Screen On Ice Cream Sandwich and Jelly Bean devices ([#2802](https://github.com/mapbox/mapbox-gl-native/issues/2802)) - Resolved in 2.2.0 +## iOS 3.1.2 + +- You can once again install the static framework without manually linking several framework and library dependencies. ([#4029](https://github.com/mapbox/mapbox-gl-native/pull/4029)) +- The location manager used by MGLMapView to show the user’s location is now paused when the application is sent to the background. ([#4034](https://github.com/mapbox/mapbox-gl-native/pull/4034)) + ## iOS 3.1.1 - Corrected the dynamic framework’s minimum deployment target to iOS 8.0. ([#3872](https://github.com/mapbox/mapbox-gl-native/pull/3872)) diff --git a/ios/docs/pod-README.md b/ios/docs/pod-README.md index f5c306147..e2c8ff813 100644 --- a/ios/docs/pod-README.md +++ b/ios/docs/pod-README.md @@ -35,6 +35,17 @@ If your application targets iOS 7.x, you’ll need to install the static framewo 1. Open the project editor and select your application target. Drag `Mapbox.framework` from the `static` folder into the “Embedded Binaries” section of the General tab. (Don’t drag it into the “Linked Frameworks and Libraries” section; Xcode will add it there automatically.) In the sheet that appears, make sure “Copy items if needed” is checked, then click Finish. +1. Add the following Cocoa Touch frameworks and libraries to the “Linked Frameworks and Libraries” section: + + - `GLKit.framework` + - `ImageIO.framework` + - `MobileCoreServices.framework` + - `QuartzCore.framework` + - `SystemConfiguration.framework` + - `libc++.tbd` + - `libsqlite3.tbd` + - `libz.tbd` + 1. In the Build Settings tab, add `-ObjC` to the “Other Linker Flags” (`OTHER_LDFLAGS`) build setting. {{/STATIC}} diff --git a/platform/ios/INSTALL.md b/platform/ios/INSTALL.md index fab16bbfe..b4e27acde 100644 --- a/platform/ios/INSTALL.md +++ b/platform/ios/INSTALL.md @@ -97,6 +97,17 @@ If your application targets iOS 7.x, you’ll need to install the static framewo 1. Open the project editor and select your application target. Drag `build/ios/pkg/static/Mapbox.framework` into the “Embedded Binaries” section of the General tab. (Don’t drag it into the “Linked Frameworks and Libraries” section; Xcode will add it there automatically.) In the sheet that appears, make sure “Copy items if needed” is checked, then click Finish. +1. Add the following Cocoa Touch frameworks and libraries to the “Linked Frameworks and Libraries” section: + + - `GLKit.framework` + - `ImageIO.framework` + - `MobileCoreServices.framework` + - `QuartzCore.framework` + - `SystemConfiguration.framework` + - `libc++.tbd` + - `libsqlite3.tbd` + - `libz.tbd` + 1. In the Build Settings tab, add `-ObjC` to the “Other Linker Flags” (`OTHER_LDFLAGS`) build setting. ### Use From f74900e7046d31721cc4b3e0c0678e85a989cf12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Mon, 22 Feb 2016 10:47:09 -0800 Subject: [PATCH 20/20] ios-v3.1.2 --- ios/Mapbox-iOS-SDK.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Mapbox-iOS-SDK.podspec b/ios/Mapbox-iOS-SDK.podspec index 5f7238d31..51e1a2725 100644 --- a/ios/Mapbox-iOS-SDK.podspec +++ b/ios/Mapbox-iOS-SDK.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |m| m.name = 'Mapbox-iOS-SDK' - m.version = '3.1.1' + m.version = '3.1.2' m.summary = 'Open source vector map solution for iOS with full styling capabilities.' m.description = 'Open source, OpenGL-based vector map solution for iOS with full styling capabilities and Cocoa Touch APIs.'