diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2016-03-06 23:57:09 -0800 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2016-03-10 17:08:58 -0800 |
commit | f5ac63dfeccc185bc198b21f3ff6f87a9017848d (patch) | |
tree | ab9da2f017d31065cbf2d288b3e863cf9fa2c5db /platform/darwin/include | |
parent | e36218a8668316e8c1b0bcc06d43dad31461615c (diff) | |
download | qtlocation-mapboxgl-f5ac63dfeccc185bc198b21f3ff6f87a9017848d.tar.gz |
[ios, osx] Renamed offline classes
Renamed SDK classes related to offline viewing to more closely match the terminology used by mbgl and the Android SDK while remaining consistent with Cocoa naming principles.
Diffstat (limited to 'platform/darwin/include')
-rw-r--r-- | platform/darwin/include/MGLDownloadController.h | 30 | ||||
-rw-r--r-- | platform/darwin/include/MGLDownloadable.h | 49 | ||||
-rw-r--r-- | platform/darwin/include/MGLOfflineRegion.h (renamed from platform/darwin/include/MGLDownloadRegion.h) | 2 | ||||
-rw-r--r-- | platform/darwin/include/MGLOfflineStorage.h | 30 | ||||
-rw-r--r-- | platform/darwin/include/MGLOfflineTask.h | 49 | ||||
-rw-r--r-- | platform/darwin/include/MGLTilePyramidOfflineRegion.h (renamed from platform/darwin/include/MGLTilePyramidDownloadRegion.h) | 4 |
6 files changed, 82 insertions, 82 deletions
diff --git a/platform/darwin/include/MGLDownloadController.h b/platform/darwin/include/MGLDownloadController.h deleted file mode 100644 index 86bd1e6573..0000000000 --- a/platform/darwin/include/MGLDownloadController.h +++ /dev/null @@ -1,30 +0,0 @@ -#import <Foundation/Foundation.h> - -#import "MGLTypes.h" - -NS_ASSUME_NONNULL_BEGIN - -@class MGLDownloadable; -@protocol MGLDownloadRegion; - -typedef void (^MGLDownloadableRegistrationCompletionHandler)(MGLDownloadable *downloadable, NSError *error); -typedef void (^MGLDownloadableRemovalCompletionHandler)(NSError *error); -typedef void (^MGLDownloadablesRequestCompletionHandler)(NS_ARRAY_OF(MGLDownloadable *) *downloadables, NSError *error); - -@interface MGLDownloadController : NSObject - -+ (instancetype)sharedController; - -- (instancetype)init NS_UNAVAILABLE; - -- (void)addDownloadableForRegion:(id <MGLDownloadRegion>)downloadRegion withContext:(NSData *)context completionHandler:(MGLDownloadableRegistrationCompletionHandler)completion; - -- (void)removeDownloadable:(MGLDownloadable *)downloadable withCompletionHandler:(MGLDownloadableRemovalCompletionHandler)completion; - -- (void)requestDownloadablesWithCompletionHandler:(MGLDownloadablesRequestCompletionHandler)completion; - -- (void)setMaximumAllowedMapboxTiles:(uint64_t)maximumCount; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLDownloadable.h b/platform/darwin/include/MGLDownloadable.h deleted file mode 100644 index 522a3c37ab..0000000000 --- a/platform/darwin/include/MGLDownloadable.h +++ /dev/null @@ -1,49 +0,0 @@ -#import <Foundation/Foundation.h> - -#import "MGLDownloadRegion.h" - -NS_ASSUME_NONNULL_BEGIN - -@protocol MGLDownloadableDelegate; - -typedef NS_ENUM (NSInteger, MGLDownloadableState) { - MGLDownloadableStateInactive = 0, - MGLDownloadableStateActive = 1, - MGLDownloadableStateComplete = 2, -}; - -typedef struct MGLDownloadableProgress { - uint64_t countOfResourcesCompleted; - uint64_t countOfBytesCompleted; - uint64_t countOfResourcesExpected; - uint64_t maximumResourcesExpected; -} MGLDownloadableProgress; - -@interface MGLDownloadable : NSObject - -@property (nonatomic, readonly) id <MGLDownloadRegion> region; -@property (nonatomic, readonly) NSData *context; -@property (nonatomic, readonly) MGLDownloadableState state; -@property (nonatomic, readonly) MGLDownloadableProgress progress; -@property (nonatomic, weak, nullable) id <MGLDownloadableDelegate> delegate; - -- (instancetype)init NS_UNAVAILABLE; - -- (void)resume; -- (void)suspend; - -- (void)requestProgress; - -@end - -@protocol MGLDownloadableDelegate <NSObject> - -@optional - -- (void)downloadable:(MGLDownloadable *)downloadable progressDidChange:(MGLDownloadableProgress)progress; -- (void)downloadable:(MGLDownloadable *)downloadable didReceiveError:(NSError *)error; -- (void)downloadable:(MGLDownloadable *)downloadable didReceiveMaximumAllowedMapboxTiles:(uint64_t)maximumCount; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLDownloadRegion.h b/platform/darwin/include/MGLOfflineRegion.h index 5910c2117b..6958e3bffe 100644 --- a/platform/darwin/include/MGLDownloadRegion.h +++ b/platform/darwin/include/MGLOfflineRegion.h @@ -4,7 +4,7 @@ NS_ASSUME_NONNULL_BEGIN -@protocol MGLDownloadRegion <NSObject> +@protocol MGLOfflineRegion <NSObject> @property (nonatomic, readonly) NSURL *styleURL; diff --git a/platform/darwin/include/MGLOfflineStorage.h b/platform/darwin/include/MGLOfflineStorage.h new file mode 100644 index 0000000000..2d33f3ba69 --- /dev/null +++ b/platform/darwin/include/MGLOfflineStorage.h @@ -0,0 +1,30 @@ +#import <Foundation/Foundation.h> + +#import "MGLTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +@class MGLOfflineTask; +@protocol MGLOfflineRegion; + +typedef void (^MGLOfflineTaskRegistrationCompletionHandler)(MGLOfflineTask *task, NSError *error); +typedef void (^MGLOfflineTaskRemovalCompletionHandler)(NSError *error); +typedef void (^MGLOfflineTasksRetrievalCompletionHandler)(NS_ARRAY_OF(MGLOfflineTask *) *tasks, NSError *error); + +@interface MGLOfflineStorage : NSObject + ++ (instancetype)sharedOfflineStorage; + +- (instancetype)init NS_UNAVAILABLE; + +- (void)addTaskForRegion:(id <MGLOfflineRegion>)region withContext:(NSData *)context completionHandler:(MGLOfflineTaskRegistrationCompletionHandler)completion; + +- (void)removeTask:(MGLOfflineTask *)task withCompletionHandler:(MGLOfflineTaskRemovalCompletionHandler)completion; + +- (void)getTasksWithCompletionHandler:(MGLOfflineTasksRetrievalCompletionHandler)completion; + +- (void)setMaximumAllowedMapboxTiles:(uint64_t)maximumCount; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLOfflineTask.h b/platform/darwin/include/MGLOfflineTask.h new file mode 100644 index 0000000000..72e66a50f5 --- /dev/null +++ b/platform/darwin/include/MGLOfflineTask.h @@ -0,0 +1,49 @@ +#import <Foundation/Foundation.h> + +#import "MGLOfflineRegion.h" + +NS_ASSUME_NONNULL_BEGIN + +@protocol MGLOfflineTaskDelegate; + +typedef NS_ENUM (NSInteger, MGLOfflineTaskState) { + MGLOfflineTaskStateInactive = 0, + MGLOfflineTaskStateActive = 1, + MGLOfflineTaskStateComplete = 2, +}; + +typedef struct MGLOfflineTaskProgress { + uint64_t countOfResourcesCompleted; + uint64_t countOfBytesCompleted; + uint64_t countOfResourcesExpected; + uint64_t maximumResourcesExpected; +} MGLOfflineTaskProgress; + +@interface MGLOfflineTask : NSObject + +@property (nonatomic, readonly) id <MGLOfflineRegion> region; +@property (nonatomic, readonly) NSData *context; +@property (nonatomic, readonly) MGLOfflineTaskState state; +@property (nonatomic, readonly) MGLOfflineTaskProgress progress; +@property (nonatomic, weak, nullable) id <MGLOfflineTaskDelegate> delegate; + +- (instancetype)init NS_UNAVAILABLE; + +- (void)resume; +- (void)suspend; + +- (void)requestProgress; + +@end + +@protocol MGLOfflineTaskDelegate <NSObject> + +@optional + +- (void)offlineTask:(MGLOfflineTask *)task progressDidChange:(MGLOfflineTaskProgress)progress; +- (void)offlineTask:(MGLOfflineTask *)task didReceiveError:(NSError *)error; +- (void)offlineTask:(MGLOfflineTask *)task didReceiveMaximumAllowedMapboxTiles:(uint64_t)maximumCount; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLTilePyramidDownloadRegion.h b/platform/darwin/include/MGLTilePyramidOfflineRegion.h index 6269775f19..7beca3390f 100644 --- a/platform/darwin/include/MGLTilePyramidDownloadRegion.h +++ b/platform/darwin/include/MGLTilePyramidOfflineRegion.h @@ -1,11 +1,11 @@ #import <Foundation/Foundation.h> -#import "MGLDownloadRegion.h" +#import "MGLOfflineRegion.h" #import "MGLGeometry.h" NS_ASSUME_NONNULL_BEGIN -@interface MGLTilePyramidDownloadRegion : NSObject <MGLDownloadRegion> +@interface MGLTilePyramidOfflineRegion : NSObject <MGLOfflineRegion> @property (nonatomic, readonly) MGLCoordinateBounds bounds; @property (nonatomic, readonly) double minimumZoomLevel; |