summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLOfflineStorage.mm
diff options
context:
space:
mode:
authorEimantas Vaiciunas <eimantas@walkingsmarts.com>2017-02-06 15:47:39 +0200
committerMinh Nguyễn <mxn@1ec5.org>2017-02-06 12:39:11 -0800
commit7b0881030fdc60130458c2a798de696888c87c7c (patch)
tree5c018664d3ed3ba54e973a309cd5279b7ad11afb /platform/darwin/src/MGLOfflineStorage.mm
parent631c5a2f9314aaea558986f02a9b158c48fd8771 (diff)
downloadqtlocation-mapboxgl-7b0881030fdc60130458c2a798de696888c87c7c.tar.gz
Make `MGLOfflinePack` instances post notifications
This commit also gets rid of private `MGLOfflinePackDelegate` protocol. `userInfo` dictionary in notification objects retain the `state` and `progress` values for backwards compatibility. They can be removed in later major release.
Diffstat (limited to 'platform/darwin/src/MGLOfflineStorage.mm')
-rw-r--r--platform/darwin/src/MGLOfflineStorage.mm28
1 files changed, 1 insertions, 27 deletions
diff --git a/platform/darwin/src/MGLOfflineStorage.mm b/platform/darwin/src/MGLOfflineStorage.mm
index bdecd101d2..af0f592902 100644
--- a/platform/darwin/src/MGLOfflineStorage.mm
+++ b/platform/darwin/src/MGLOfflineStorage.mm
@@ -26,7 +26,7 @@ NSString * const MGLOfflinePackErrorUserInfoKey = MGLOfflinePackUserInfoKeyError
const MGLOfflinePackUserInfoKey MGLOfflinePackUserInfoKeyMaximumCount = @"MaximumCount";
NSString * const MGLOfflinePackMaximumCountUserInfoKey = MGLOfflinePackUserInfoKeyMaximumCount;
-@interface MGLOfflineStorage () <MGLOfflinePackDelegate>
+@interface MGLOfflineStorage ()
@property (nonatomic, strong, readwrite) NS_MUTABLE_ARRAY_OF(MGLOfflinePack *) *packs;
@property (nonatomic) mbgl::DefaultFileSource *mbglFileSource;
@@ -197,7 +197,6 @@ NSString * const MGLOfflinePackMaximumCountUserInfoKey = MGLOfflinePackUserInfoK
pack.state = MGLOfflinePackStateInactive;
MGLOfflineStorage *strongSelf = weakSelf;
[[strongSelf mutableArrayValueForKey:@"packs"] addObject:pack];
- pack.delegate = strongSelf;
if (completion) {
completion(pack, error);
}
@@ -269,10 +268,6 @@ NSString * const MGLOfflinePackMaximumCountUserInfoKey = MGLOfflinePackUserInfoK
[pack invalidate];
}
self.packs = [packs mutableCopy];
-
- for (MGLOfflinePack *pack in packs) {
- pack.delegate = self;
- }
}];
}
@@ -317,25 +312,4 @@ NSString * const MGLOfflinePackMaximumCountUserInfoKey = MGLOfflinePackUserInfoK
return attributes.fileSize;
}
-#pragma mark MGLOfflinePackDelegate methods
-
-- (void)offlinePack:(MGLOfflinePack *)pack progressDidChange:(__unused MGLOfflinePackProgress)progress {
- [[NSNotificationCenter defaultCenter] postNotificationName:MGLOfflinePackProgressChangedNotification object:pack userInfo:@{
- MGLOfflinePackUserInfoKeyState: @(pack.state),
- MGLOfflinePackUserInfoKeyProgress: [NSValue valueWithMGLOfflinePackProgress:progress],
- }];
-}
-
-- (void)offlinePack:(MGLOfflinePack *)pack didReceiveError:(NSError *)error {
- [[NSNotificationCenter defaultCenter] postNotificationName:MGLOfflinePackErrorNotification object:pack userInfo:@{
- MGLOfflinePackUserInfoKeyError: error,
- }];
-}
-
-- (void)offlinePack:(MGLOfflinePack *)pack didReceiveMaximumAllowedMapboxTiles:(uint64_t)maximumCount {
- [[NSNotificationCenter defaultCenter] postNotificationName:MGLOfflinePackMaximumMapboxTilesReachedNotification object:pack userInfo:@{
- MGLOfflinePackUserInfoKeyMaximumCount: @(maximumCount),
- }];
-}
-
@end