diff options
author | Fabian Guerra <fabian.guerra@mapbox.com> | 2018-09-10 11:26:16 -0700 |
---|---|---|
committer | Fabian Guerra <fabian.guerra@mapbox.com> | 2018-09-13 15:42:02 -0700 |
commit | 15773e7f62c55fa51a806fb6a36a956a36fd99ac (patch) | |
tree | a0c4c7296b339406a969ecbd41e613adad332f73 | |
parent | 448a56e5a671687fe6260350633f2c7b0df9fcc9 (diff) | |
download | qtlocation-mapboxgl-15773e7f62c55fa51a806fb6a36a956a36fd99ac.tar.gz |
[ios, macos] Update MGLOfflineStorage's add contents of file documentation.
-rw-r--r-- | platform/darwin/src/MGLOfflineStorage.h | 14 | ||||
-rw-r--r-- | platform/darwin/src/MGLOfflineStorage.mm | 6 | ||||
-rw-r--r-- | platform/ios/CHANGELOG.md | 2 | ||||
-rw-r--r-- | platform/macos/CHANGELOG.md | 2 |
4 files changed, 12 insertions, 12 deletions
diff --git a/platform/darwin/src/MGLOfflineStorage.h b/platform/darwin/src/MGLOfflineStorage.h index c9e0ec6426..3b942b1e6d 100644 --- a/platform/darwin/src/MGLOfflineStorage.h +++ b/platform/darwin/src/MGLOfflineStorage.h @@ -140,7 +140,7 @@ typedef void (^MGLOfflinePackRemovalCompletionHandler)(NSError * _Nullable error @param error Contains a pointer to an error object (if any) indicating why the pack could not be created or added. */ -typedef void (^MGLOfflinePacksAdditionCompletionHandler)(NSError * _Nullable error); +typedef void (^MGLBatchedOfflinePackAdditionCompletionHandler)(NSError * _Nullable error); /** The type of resource that is requested. @@ -191,7 +191,7 @@ MGL_EXPORT or downloaded separately. Refer to this <a href="https://www.mapbox.com/ios-sdk/maps/examples/offline-pack/">example</a> - to learn how to create additional offline packs. + to learn how to download offline packs. The resulting packs are added or updated to the shared offline storage object’s `packs` property, then the `completion` block is executed. @@ -202,7 +202,7 @@ MGL_EXPORT file has been added to offline storage. This handler is executed asynchronously on the main queue. */ -- (void)addContentsOfFile:(NSString *)filePath withCompletionHandler:(nullable MGLOfflinePacksAdditionCompletionHandler)completion; +- (void)addContentsOfFile:(NSString *)filePath withCompletionHandler:(nullable MGLBatchedOfflinePackAdditionCompletionHandler)completion; /** Adds the offline packs located at the given URL to offline storage. @@ -211,18 +211,18 @@ MGL_EXPORT or downloaded separately. Refer to this <a href="https://www.mapbox.com/ios-sdk/maps/examples/offline-pack/">example</a> - to learn how to create additional offline packs. + to learn how to download offline packs. The resulting packs are added or updated to the shared offline storage object’s `packs` property, then the `completion` block is executed. - @param fileURL An URL representation of the file. The file URL must be - writable as schema updates may be perfomed. + @param fileURL A file URL specifying the file to add. URL should be a valid system path. + The file URL must be writable as schema updates may be performed. @param completion The completion handler to call once the contents of the given file has been added to offline storage. This handler is executed asynchronously on the main queue. */ -- (void)addContentsOfURL:(NSURL *)fileURL withCompletionHandler:(nullable MGLOfflinePacksAdditionCompletionHandler)completion; +- (void)addContentsOfURL:(NSURL *)fileURL withCompletionHandler:(nullable MGLBatchedOfflinePackAdditionCompletionHandler)completion; #pragma mark - Accessing the Delegate diff --git a/platform/darwin/src/MGLOfflineStorage.mm b/platform/darwin/src/MGLOfflineStorage.mm index 0d296f36a5..e55d4214d2 100644 --- a/platform/darwin/src/MGLOfflineStorage.mm +++ b/platform/darwin/src/MGLOfflineStorage.mm @@ -266,7 +266,7 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio #pragma mark Offline merge methods -- (void)addContentsOfFile:(NSString *)filePath withCompletionHandler:(MGLOfflinePacksAdditionCompletionHandler)completion { +- (void)addContentsOfFile:(NSString *)filePath withCompletionHandler:(MGLBatchedOfflinePackAdditionCompletionHandler)completion { NSFileManager *fileManager = [NSFileManager defaultManager]; if (![fileManager isWritableFileAtPath:filePath]) { [NSException raise:NSInvalidArgumentException format:@"The file path must be writable"]; @@ -292,11 +292,11 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio }]; } -- (void)addContentsOfURL:(NSURL *)fileURL withCompletionHandler:(MGLOfflinePacksAdditionCompletionHandler)completion { +- (void)addContentsOfURL:(NSURL *)fileURL withCompletionHandler:(MGLBatchedOfflinePackAdditionCompletionHandler)completion { [self addContentsOfFile:fileURL.absoluteString withCompletionHandler:completion]; } -- (void)_addContentsOfFile:(NSString *)filePath withCompletionHandler:(MGLOfflinePacksAdditionCompletionHandler)completion { +- (void)_addContentsOfFile:(NSString *)filePath withCompletionHandler:(MGLBatchedOfflinePackAdditionCompletionHandler)completion { self.mbglFileSource->mergeOfflineRegions(std::string(static_cast<const char *>([filePath UTF8String])), [&, completion](mbgl::expected<mbgl::OfflineRegions, std::exception_ptr> result) { NSError *error; NSMutableArray *packs; diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 15b168fd1d..e7179fba0c 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -31,7 +31,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT * Added the `MGLShapeOfflineRegion` class for creating an offline pack that covers an arbitrary shape. ([#11447](https://github.com/mapbox/mapbox-gl-native/pull/11447)) * Fixed crashes when offline storage encountered certain SQLite errors. ([#12224](https://github.com/mapbox/mapbox-gl-native/pull/12224)) -* Added an `-[MGLOfflineStorage addContentesOfFile:withCompletionHandler:]` method to add pregenerated offline packs to offline storage. ([#12791](https://github.com/mapbox/mapbox-gl-native/pull/12791)) +* Added `-[MGLOfflineStorage addContentsOfFile:withCompletionHandler:]` and `-[MGLOfflineStorage addContentsOfURL:withCompletionHandler:]` methods to add pregenerated offline packs to offline storage. ([#12791](https://github.com/mapbox/mapbox-gl-native/pull/12791)) ### Other changes diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md index 5fb4d1bc00..993371490e 100644 --- a/platform/macos/CHANGELOG.md +++ b/platform/macos/CHANGELOG.md @@ -29,7 +29,7 @@ * Added the `MGLShapeOfflineRegion` class for creating an offline pack that covers an arbitrary shape. ([#11447](https://github.com/mapbox/mapbox-gl-native/pull/11447)) * Fixed crashes when offline storage encountered certain SQLite errors. ([#12224](https://github.com/mapbox/mapbox-gl-native/pull/12224)) -* Added an `-[MGLOfflineStorage addContentesOfFile:withCompletionHandler:]` method to add pregenerated offline packs to offline storage. ([#12791](https://github.com/mapbox/mapbox-gl-native/pull/12791)) +* Added `-[MGLOfflineStorage addContentsOfFile:withCompletionHandler:]` and `-[MGLOfflineStorage addContentsOfURL:withCompletionHandler:]` methods to add pregenerated offline packs to offline storage. ([#12791](https://github.com/mapbox/mapbox-gl-native/pull/12791)) ### Other changes |