diff options
author | jmkiley <jordan.kiley@mapbox.com> | 2019-06-24 15:14:56 -0700 |
---|---|---|
committer | jmkiley <jordan.kiley@mapbox.com> | 2019-07-09 15:03:39 -0700 |
commit | 474fe9f5fee3a393efddf5be04f0062693c5f486 (patch) | |
tree | 9aebb0042fc0e981479f3a24a19c4585d36116f6 | |
parent | 6b4541b516293ec61bbdb86b4cf9f98cc78e320a (diff) | |
download | qtlocation-mapboxgl-474fe9f5fee3a393efddf5be04f0062693c5f486.tar.gz |
[ios] add callback method
-rw-r--r-- | platform/darwin/src/MGLOfflineStorage.h | 4 | ||||
-rw-r--r-- | platform/darwin/src/MGLOfflineStorage.mm | 21 |
2 files changed, 21 insertions, 4 deletions
diff --git a/platform/darwin/src/MGLOfflineStorage.h b/platform/darwin/src/MGLOfflineStorage.h index a827a1261d..8ec70a7c7d 100644 --- a/platform/darwin/src/MGLOfflineStorage.h +++ b/platform/darwin/src/MGLOfflineStorage.h @@ -352,7 +352,7 @@ MGL_EXPORT This method should be called before using the database. */ -- (void)setMaximumAmbientCacheSize:(uint64_t)cacheSize; +- (void)setMaximumAmbientCacheSize:(void (^)(unsigned long cacheSize, NSError * _Nullable error))completion; /* Forces cache tiles to be invalidated and updated from the tile server. This ensures that the @@ -360,6 +360,8 @@ MGL_EXPORT - (void)invalidateAmbientCache; +- (void)clearAmbientCache; + /* Inserts the provided resource into the ambient cache. diff --git a/platform/darwin/src/MGLOfflineStorage.mm b/platform/darwin/src/MGLOfflineStorage.mm index 6e15b01bbe..c7462b5548 100644 --- a/platform/darwin/src/MGLOfflineStorage.mm +++ b/platform/darwin/src/MGLOfflineStorage.mm @@ -488,17 +488,32 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio #pragma mark - Ambient Cache management -- (void)setMaximumAmbientCacheSize:(uint64_t)cacheSize { + +void maxCacheSizeCallback(std::exception_ptr result) { + + - if ( ! (cacheSize > 0) ) { /* give a warning*/ } ; - _mbglFileSource->setMaximumAmbientCacheSize(cacheSize, nil); // I should do something with the std::exception_ptr here but i don't know what + // if ( ! (cacheSize > 0) ) { /* give a warning*/ } ; + + // + // ERROR: Too few arguments to function call, expected 2, } +- (void)setMaximumAmbientCacheSize:(NSInteger)cacheSize withCallback:(void (^)(NSError *))callback { + + + _mbglFileSource->setMaximumAmbientCacheSize(cacheSize, maxCacheSizeCallback); + + } + - (void)invalidateAmbientCache { _mbglFileSource->invalidateAmbientCache(nil); // Do something with the std::exception_ptr here } +- (void)clearAmbientCache { + +} #pragma mark - - (unsigned long long)countOfBytesCompleted { |