diff options
author | Julian Rex <julian.rex@mapbox.com> | 2018-07-10 16:31:29 -0400 |
---|---|---|
committer | Julian Rex <julian.rex@mapbox.com> | 2018-08-29 10:47:16 -0400 |
commit | 56bd1228e8ab980f1108cb11ea4ee01e1c4415e6 (patch) | |
tree | 57aa744892dc394ebff605f5589c396c58bfd440 | |
parent | 5ae9e57eca555987d4ec24dbc7ce81f8cecf80ca (diff) | |
download | qtlocation-mapboxgl-56bd1228e8ab980f1108cb11ea4ee01e1c4415e6.tar.gz |
Updated change logs. Changed error code to be clear that it was developer initiated.
-rw-r--r-- | platform/darwin/src/MGLMapSnapshotter.h | 3 | ||||
-rw-r--r-- | platform/darwin/src/MGLMapSnapshotter.mm | 4 | ||||
-rw-r--r-- | platform/darwin/src/MGLTypes.h | 2 | ||||
-rw-r--r-- | platform/ios/Integration Tests/Snapshotter Tests/MGLMapSnapshotterTest.m | 2 | ||||
-rw-r--r-- | platform/macos/CHANGELOG.md | 2 |
5 files changed, 9 insertions, 4 deletions
diff --git a/platform/darwin/src/MGLMapSnapshotter.h b/platform/darwin/src/MGLMapSnapshotter.h index a5ddcac0ac..82d1d65efd 100644 --- a/platform/darwin/src/MGLMapSnapshotter.h +++ b/platform/darwin/src/MGLMapSnapshotter.h @@ -197,6 +197,9 @@ MGL_EXPORT Once you call this method, you cannot resume the snapshot. In order to obtain the snapshot, create a new `MGLMapSnapshotter` object. + + The completion handler will be called with an `NSError` with domain + `MGLErrorDomain` and error code `MGLErrorCodeSnapshotUserCancelled`. */ - (void)cancel; diff --git a/platform/darwin/src/MGLMapSnapshotter.mm b/platform/darwin/src/MGLMapSnapshotter.mm index 3454275618..4a7d95c607 100644 --- a/platform/darwin/src/MGLMapSnapshotter.mm +++ b/platform/darwin/src/MGLMapSnapshotter.mm @@ -505,8 +505,8 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64; - (void)cancel { if (_snapshotCallback) { - [MGLMapSnapshotter completeWithErrorCode:MGLErrorCodeSnapshotCancelled - description:@"MGLMapSnapshotter cancelled." + [MGLMapSnapshotter completeWithErrorCode:MGLErrorCodeSnapshotUserCancelled + description:[NSString stringWithFormat:@"MGLMapSnapshotter cancelled from %s", __PRETTY_FUNCTION__] onQueue:self.resultQueue completion:self.completion]; self.completion = nil; diff --git a/platform/darwin/src/MGLTypes.h b/platform/darwin/src/MGLTypes.h index c0590e4d7f..f2ea6e3a6c 100644 --- a/platform/darwin/src/MGLTypes.h +++ b/platform/darwin/src/MGLTypes.h @@ -51,7 +51,7 @@ typedef NS_ENUM(NSInteger, MGLErrorCode) { /** An error occurred while snapshotting the map. */ MGLErrorCodeSnapshotFailed = 6, /** The user cancelled a map snapshot. */ - MGLErrorCodeSnapshotCancelled = 7, + MGLErrorCodeSnapshotUserCancelled = 7, }; /** Options for enabling debugging features in an `MGLMapView` instance. */ diff --git a/platform/ios/Integration Tests/Snapshotter Tests/MGLMapSnapshotterTest.m b/platform/ios/Integration Tests/Snapshotter Tests/MGLMapSnapshotterTest.m index 67815ed96d..de8bc5c23a 100644 --- a/platform/ios/Integration Tests/Snapshotter Tests/MGLMapSnapshotterTest.m +++ b/platform/ios/Integration Tests/Snapshotter Tests/MGLMapSnapshotterTest.m @@ -170,7 +170,7 @@ MGLMapSnapshotter* snapshotterWithCoordinates(CLLocationCoordinate2D coordinates MGLTestAssertNil(strongself, snapshot); MGLTestAssert(strongself, - ([error.domain isEqualToString:MGLErrorDomain] && error.code == MGLErrorCodeSnapshotCancelled), + ([error.domain isEqualToString:MGLErrorDomain] && error.code == MGLErrorCodeSnapshotUserCancelled), @"Should have been cancelled"); [expectation fulfill]; }]; diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md index d8a0067ad6..503685ac72 100644 --- a/platform/macos/CHANGELOG.md +++ b/platform/macos/CHANGELOG.md @@ -42,6 +42,8 @@ * Fixed an issue where `-[MGLMapShapshot pointForCoordinate:]` returned incorrect points. ([#12221](https://github.com/mapbox/mapbox-gl-native/pull/12221)) * Improved caching performance. ([#12072](https://github.com/mapbox/mapbox-gl-native/pull/12072)) * Remove unnecessary memory use when collision debug mode is disabled. ([#12294](https://github.com/mapbox/mapbox-gl-native/issues/12294)) +* Changed `-[MGLMapSnapshotter cancel]` to call the completion block (originally passed to `-[MGLMapSnapshotter startWithQueue:completionHandler:]`) with an `NSError` (error code `MGLErrorCodeSnapshotUserCancelled`) if the snapshot has not finished. ([#12355](https://github.com/mapbox/mapbox-gl-native/pull/12355)) + ## 0.8.0 - June 20, 2018 |