diff options
author | Nadia Barbosa <nadiabarbosa@me.com> | 2018-10-05 19:10:58 -0400 |
---|---|---|
committer | Nadia Barbosa <nadiabarbosa@me.com> | 2018-10-23 11:57:50 -0700 |
commit | 009082b6948ec31c01ea1e1b60937b76c33bee8e (patch) | |
tree | e98a9aa70eed980bd7830e873e706211bc962506 /platform/darwin/src/MGLOfflineStorage.mm | |
parent | 62af756ab8250e00a63776c2d32bf3123909eddb (diff) | |
download | qtlocation-mapboxgl-upstream/add-offline-event.tar.gz |
[ios] Log event when offline pack is createdupstream/add-offline-event
Only run MME code for iOS
Diffstat (limited to 'platform/darwin/src/MGLOfflineStorage.mm')
-rw-r--r-- | platform/darwin/src/MGLOfflineStorage.mm | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLOfflineStorage.mm b/platform/darwin/src/MGLOfflineStorage.mm index fd6dd2f998..e4fd525774 100644 --- a/platform/darwin/src/MGLOfflineStorage.mm +++ b/platform/darwin/src/MGLOfflineStorage.mm @@ -7,9 +7,15 @@ #import "MGLOfflinePack_Private.h" #import "MGLOfflineRegion_Private.h" #import "MGLTilePyramidOfflineRegion.h" +#import "MGLShapeOfflineRegion.h" #import "NSBundle+MGLAdditions.h" #import "NSValue+MGLAdditions.h" +#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR +#import "MMEConstants.h" +#import "MGLMapboxEvents.h" +#endif + #include <mbgl/actor/actor.hpp> #include <mbgl/actor/scheduler.hpp> #include <mbgl/storage/resource_transform.hpp> @@ -357,6 +363,17 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio [[strongSelf mutableArrayValueForKey:@"packs"] addObject:pack]; if (completion) { completion(pack, error); + + #if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR + NSMutableDictionary *offlineDownloadStartEventAttributes = [NSMutableDictionary dictionaryWithObject:MMEventTypeOfflineDownloadStart forKey:MMEEventKeyEvent]; + + if ([region conformsToProtocol:@protocol(MGLOfflineRegion_Private)]) { + NSDictionary *regionAttributes = ((id<MGLOfflineRegion_Private>)region).offlineStartEventAttributes; + [offlineDownloadStartEventAttributes addEntriesFromDictionary:regionAttributes]; + } + + [MGLMapboxEvents pushEvent:MMEventTypeOfflineDownloadStart withAttributes:offlineDownloadStartEventAttributes]; + #endif } }]; } |