summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLOfflineStorage.h
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/src/MGLOfflineStorage.h')
-rw-r--r--platform/darwin/src/MGLOfflineStorage.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLOfflineStorage.h b/platform/darwin/src/MGLOfflineStorage.h
index f8ea6e7453..d512c60845 100644
--- a/platform/darwin/src/MGLOfflineStorage.h
+++ b/platform/darwin/src/MGLOfflineStorage.h
@@ -135,6 +135,18 @@ typedef void (^MGLOfflinePackAdditionCompletionHandler)(MGLOfflinePack * _Nullab
typedef void (^MGLOfflinePackRemovalCompletionHandler)(NSError * _Nullable error);
/**
+ A block to be called once the contents of a file are copied into the current packs.
+
+ @param fileURL The file URL of the offline database containing the offline packs
+ that were copied.
+ @param packs An array of all known offline packs, or `nil` if there was an error
+ creating or adding the pack.
+ @param error A pointer to an error object (if any) indicating why the pack could
+ not be created or added.
+ */
+typedef void (^MGLBatchedOfflinePackAdditionCompletionHandler)(NSURL *fileURL, NSArray<MGLOfflinePack *> * _Nullable packs, NSError * _Nullable error);
+
+/**
The type of resource that is requested.
*/
typedef NS_ENUM(NSUInteger, MGLResourceKind) {
@@ -174,6 +186,42 @@ MGL_EXPORT
*/
@property (class, nonatomic, readonly) MGLOfflineStorage *sharedOfflineStorage;
+#pragma mark - Adding Contents of File
+
+/**
+ Adds the offline packs located at the given file path to offline storage.
+
+ The file must be a valid offline region database bundled with the application
+ or downloaded separately.
+
+ The resulting packs are added or updated to the shared offline storage object’s `packs`
+ property, then the `completion` block is executed.
+
+ @param filePath A string representation of the file path. The file path must be
+ writable as schema updates may be perfomed.
+ @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)addContentsOfFile:(NSString *)filePath withCompletionHandler:(nullable MGLBatchedOfflinePackAdditionCompletionHandler)completion;
+
+/**
+ Adds the offline packs located at the given URL to offline storage.
+
+ The file must be a valid offline region database bundled with the application
+ or downloaded separately.
+
+ The resulting packs are added or updated to the shared offline storage object’s `packs`
+ property, then the `completion` block is executed.
+
+ @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 MGLBatchedOfflinePackAdditionCompletionHandler)completion;
+
#pragma mark - Accessing the Delegate
/**