From 5c8719f86d9dfaf70b719483349ec5cc64e1a8d3 Mon Sep 17 00:00:00 2001 From: Petr Pokorny Date: Sun, 24 Jan 2021 10:15:41 +0100 Subject: [PATCH 01/11] Removed mapbox mobile events submodules --- .gitmodules | 6 ------ platform/android/vendor/mapbox-events-android | 1 - platform/ios/platform/ios/vendor/mapbox-events-ios | 1 - 3 files changed, 8 deletions(-) delete mode 160000 platform/android/vendor/mapbox-events-android delete mode 160000 platform/ios/platform/ios/vendor/mapbox-events-ios diff --git a/.gitmodules b/.gitmodules index 52ba48274d4..0f24d947d0b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -46,15 +46,9 @@ [submodule "platform/android/vendor/mapbox-gestures-android"] path = platform/android/vendor/mapbox-gestures-android url = https://github.com/mapbox/mapbox-gestures-android.git -[submodule "platform/ios/platform/ios/vendor/mapbox-events-ios"] - path = platform/ios/platform/ios/vendor/mapbox-events-ios - url = https://github.com/mapbox/mapbox-events-ios.git [submodule "platform/ios/platform/darwin/docs/theme"] path = platform/ios/platform/darwin/docs/theme url = https://github.com/mapbox/jazzy-theme.git -[submodule "platform/android/vendor/mapbox-events-android"] - path = platform/android/vendor/mapbox-events-android - url = https://github.com/mapbox/mapbox-events-android.git [submodule "maplibre-gl-js"] path = maplibre-gl-js url = https://github.com/maplibre/maplibre-gl-js.git diff --git a/platform/android/vendor/mapbox-events-android b/platform/android/vendor/mapbox-events-android deleted file mode 160000 index 8ee3e93c3bc..00000000000 --- a/platform/android/vendor/mapbox-events-android +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8ee3e93c3bcfc07af3fb2f778b804590eda2c61f diff --git a/platform/ios/platform/ios/vendor/mapbox-events-ios b/platform/ios/platform/ios/vendor/mapbox-events-ios deleted file mode 160000 index 5c955a030d0..00000000000 --- a/platform/ios/platform/ios/vendor/mapbox-events-ios +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5c955a030d0dad8b55c89a33d8502c49f001f72f From 38763fe65bf0cab56daaa6f0c93f4ecb92f55563 Mon Sep 17 00:00:00 2001 From: Petr Pokorny Date: Sun, 24 Jan 2021 12:09:51 +0100 Subject: [PATCH 02/11] Removing telemetry and mapbox mobile events --- .../mbgl/interface/native_apple_interface.h | 4 - platform/darwin/src/http_file_source.mm | 3 - platform/darwin/src/native_apple_interface.m | 9 - .../platform/darwin/src/MGLAccountManager.m | 30 --- .../darwin/src/MGLAccountManager_Private.h | 5 - .../platform/darwin/src/MGLMapSnapshotter.mm | 11 +- .../darwin/src/MGLNetworkConfiguration.m | 6 - .../ios/platform/darwin/src/MGLOfflinePack.mm | 7 - .../platform/darwin/src/MGLOfflineStorage.mm | 43 ---- .../darwin/src/MGLSDKMetricsManager.h | 79 ------- .../darwin/src/MGLSDKMetricsManager.m | 134 ----------- .../darwin/src/MGLSDKMetricsManager_Private.h | 11 - platform/ios/platform/darwin/src/MGLShape.mm | 10 - .../darwin/src/MGLShapeOfflineRegion.mm | 13 +- platform/ios/platform/darwin/src/MGLSource.mm | 11 - .../darwin/src/MGLTilePyramidOfflineRegion.mm | 13 +- .../platform/darwin/test/MGLResourceTests.mm | 20 -- ...MGLNetworkConfigurationIntegrationTests.mm | 2 - .../ios/platform/ios/app/MBXAppDelegate.m | 11 +- .../ios/ios.xcodeproj/project.pbxproj | 110 +-------- .../ios.xcworkspace/contents.xcworkspacedata | 6 - .../ios/scripts/deploy-swift-package.sh | 9 - .../ios/scripts/swift_package_template.swift | 11 +- .../ios/platform/ios/scripts/xcpackage.sh | 11 - .../ios/platform/ios/src/MGLMapView+Impl.mm | 8 +- .../ios/platform/ios/src/MGLMapView+OpenGL.mm | 13 -- platform/ios/platform/ios/src/MGLMapView.h | 11 +- platform/ios/platform/ios/src/MGLMapView.mm | 90 +------- .../ios/platform/ios/src/MGLMapboxEvents.h | 21 -- .../ios/platform/ios/src/MGLMapboxEvents.m | 216 ------------------ .../platform/ios/src/MGLSDKUpdateChecker.h | 13 -- .../platform/ios/src/MGLSDKUpdateChecker.mm | 37 --- .../ios/platform/ios/src/MGLTelemetryConfig.h | 18 -- .../ios/platform/ios/src/MGLTelemetryConfig.m | 35 --- platform/ios/platform/ios/src/Mapbox.h | 1 - .../ios/test/MGLAccountManagerTests.m | 25 -- .../vendor/mapbox-accounts-ios/MBXSKUToken.h | 36 --- platform/ios/platform/macos/src/Mapbox.h | 1 - 38 files changed, 13 insertions(+), 1081 deletions(-) delete mode 100644 platform/ios/platform/darwin/src/MGLSDKMetricsManager.h delete mode 100644 platform/ios/platform/darwin/src/MGLSDKMetricsManager.m delete mode 100644 platform/ios/platform/darwin/src/MGLSDKMetricsManager_Private.h delete mode 100644 platform/ios/platform/ios/src/MGLMapboxEvents.h delete mode 100644 platform/ios/platform/ios/src/MGLMapboxEvents.m delete mode 100644 platform/ios/platform/ios/src/MGLSDKUpdateChecker.h delete mode 100644 platform/ios/platform/ios/src/MGLSDKUpdateChecker.mm delete mode 100644 platform/ios/platform/ios/src/MGLTelemetryConfig.h delete mode 100644 platform/ios/platform/ios/src/MGLTelemetryConfig.m delete mode 100644 platform/ios/platform/ios/test/MGLAccountManagerTests.m delete mode 100644 platform/ios/platform/ios/vendor/mapbox-accounts-ios/MBXSKUToken.h diff --git a/platform/darwin/include/mbgl/interface/native_apple_interface.h b/platform/darwin/include/mbgl/interface/native_apple_interface.h index 5453e798cf8..bcdf7b8aa91 100644 --- a/platform/darwin/include/mbgl/interface/native_apple_interface.h +++ b/platform/darwin/include/mbgl/interface/native_apple_interface.h @@ -8,8 +8,6 @@ NS_ASSUME_NONNULL_BEGIN @optional -- (NSString *)skuToken; - - (NSURLSession *)sessionForNetworkManager:(MGLNativeNetworkManager *)networkManager; @required @@ -36,8 +34,6 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, weak) id delegate; -@property (nonatomic, readonly) NSString *skuToken; - @property (nonatomic, readonly) NSURLSessionConfiguration *sessionConfiguration; - (void)startDownloadEvent:(NSString *)event type:(NSString *)type; diff --git a/platform/darwin/src/http_file_source.mm b/platform/darwin/src/http_file_source.mm index 61428df8d40..dcd5dc0bd00 100644 --- a/platform/darwin/src/http_file_source.mm +++ b/platform/darwin/src/http_file_source.mm @@ -206,9 +206,6 @@ BOOL isValidMapboxEndpoint(NSURL *url) { if (resource.usage == Resource::Usage::Offline) { [queryItems addObject:[NSURLQueryItem queryItemWithName:@"offline" value:@"true"]]; - } else { - // Only add SKU token to requests not tagged as "offline" usage. - [queryItems addObject:[NSURLQueryItem queryItemWithName:@"sku" value:MGLNativeNetworkManager.sharedManager.skuToken]]; } if (components.queryItems) { diff --git a/platform/darwin/src/native_apple_interface.m b/platform/darwin/src/native_apple_interface.m index 3c58dfb7d1d..bff08927e1c 100644 --- a/platform/darwin/src/native_apple_interface.m +++ b/platform/darwin/src/native_apple_interface.m @@ -24,15 +24,6 @@ + (NSURLSessionConfiguration *)testSessionConfiguration { return sessionConfiguration; } -#pragma mark - Optionals - -- (NSString *)skuToken { - if([self.delegate respondsToSelector:@selector(skuToken)]) { - return [self.delegate skuToken]; - } - return nil; -} - #pragma mark - Required - (NSURLSessionConfiguration *)sessionConfiguration { diff --git a/platform/ios/platform/darwin/src/MGLAccountManager.m b/platform/ios/platform/darwin/src/MGLAccountManager.m index c37195967a0..82cdd1e6e5a 100644 --- a/platform/ios/platform/darwin/src/MGLAccountManager.m +++ b/platform/ios/platform/darwin/src/MGLAccountManager.m @@ -5,14 +5,6 @@ #import "NSProcessInfo+MGLAdditions.h" #endif -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR -#import "MGLMapboxEvents.h" -#import "MBXSKUToken.h" - -static NSString * const MGLAccountManagerExternalClassName = @"MBXAccounts"; -static NSString * const MGLAccountManagerExternalMethodName = @"skuToken"; -#endif - NSString * const MGLMapboxAccountTypeKey = @"MGLMapboxAccountType"; @interface MGLAccountManager () @@ -73,12 +65,6 @@ + (void)setAccessToken:(NSString *)accessToken { } [MGLAccountManager sharedManager].accessToken = accessToken; - -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - dispatch_async(dispatch_get_main_queue(), ^{ - [MGLMapboxEvents setupWithAccessToken:accessToken]; - }); -#endif } + (NSString *)accessToken { @@ -93,20 +79,4 @@ + (NSURL *)apiBaseURL { return [MGLAccountManager sharedManager].apiBaseURL; } -#pragma mark - SKU Tokens - -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - -+ (NSString *)skuToken { - Class mbx = NSClassFromString(MGLAccountManagerExternalClassName); - - if ([mbx respondsToSelector:NSSelectorFromString(MGLAccountManagerExternalMethodName)]) { - return (NSString *)[mbx valueForKeyPath:MGLAccountManagerExternalMethodName]; - } - - return MBXSKUToken.skuToken; -} - -#endif - @end diff --git a/platform/ios/platform/darwin/src/MGLAccountManager_Private.h b/platform/ios/platform/darwin/src/MGLAccountManager_Private.h index 4bf79631822..60bce0631f6 100644 --- a/platform/ios/platform/darwin/src/MGLAccountManager_Private.h +++ b/platform/ios/platform/darwin/src/MGLAccountManager_Private.h @@ -16,11 +16,6 @@ FOUNDATION_EXTERN NSString * const MGLMapboxAccountTypeKey; /// The API base URL that is used to access Mapbox resources. The default base URL is `https://api.mapbox.com`. If `nil`, the Mapbox default base API URL is in use. @property (atomic, readwrite, nullable) NSURL *apiBaseURL; -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR -/// The current global SKU. -@property (class, atomic, readonly) NSString *skuToken; -#endif - @end NS_ASSUME_NONNULL_END diff --git a/platform/ios/platform/darwin/src/MGLMapSnapshotter.mm b/platform/ios/platform/darwin/src/MGLMapSnapshotter.mm index 358a6f588fb..55556ab763c 100644 --- a/platform/ios/platform/darwin/src/MGLMapSnapshotter.mm +++ b/platform/ios/platform/darwin/src/MGLMapSnapshotter.mm @@ -17,10 +17,6 @@ #import "MGLRendererConfiguration.h" #import "MGLMapSnapshotter_Private.h" -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR -#import "MGLMapboxEvents.h" -#endif - #if TARGET_OS_IPHONE #import "UIImage+MGLAdditions.h" #else @@ -268,9 +264,6 @@ - (instancetype)initWithOptions:(MGLMapSnapshotOptions *)options [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillTerminate:) name:UIApplicationWillTerminateNotification object:nil]; #else [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillTerminate:) name:NSApplicationWillTerminateNotification object:nil]; -#endif -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - [MGLMapboxEvents pushTurnstileEvent]; #endif } return self; @@ -336,9 +329,7 @@ - (void)startWithQueue:(dispatch_queue_t)queue overlayHandler:(MGLMapSnapshotOve NSString *description = @(mbgl::util::toString(mbglError).c_str()); NSDictionary *userInfo = @{NSLocalizedDescriptionKey: description}; NSError *error = [NSError errorWithDomain:MGLErrorDomain code:MGLErrorCodeSnapshotFailed userInfo:userInfo]; -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - [[MMEEventsManager sharedManager] reportError:error]; -#endif + // Dispatch to result queue dispatch_async(queue, ^{ strongSelf.loading = NO; diff --git a/platform/ios/platform/darwin/src/MGLNetworkConfiguration.m b/platform/ios/platform/darwin/src/MGLNetworkConfiguration.m index de96d554201..cdaa0ef92b2 100644 --- a/platform/ios/platform/darwin/src/MGLNetworkConfiguration.m +++ b/platform/ios/platform/darwin/src/MGLNetworkConfiguration.m @@ -105,12 +105,6 @@ - (void)setSessionConfiguration:(NSURLSessionConfiguration *)sessionConfiguratio } } -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR -- (NSString *)skuToken { - return MGLAccountManager.skuToken; -} -#endif - - (void)startDownloadEvent:(NSString *)urlString type:(NSString *)resourceType { if (urlString && resourceType && ![self eventDictionaryForKey:urlString]) { NSDate *startDate = [NSDate date]; diff --git a/platform/ios/platform/darwin/src/MGLOfflinePack.mm b/platform/ios/platform/darwin/src/MGLOfflinePack.mm index a3fc2798f83..e5f742bf312 100644 --- a/platform/ios/platform/darwin/src/MGLOfflinePack.mm +++ b/platform/ios/platform/darwin/src/MGLOfflinePack.mm @@ -10,10 +10,6 @@ #import "NSValue+MGLAdditions.h" -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - #import "MGLMapboxEvents.h" -#endif - #include #include @@ -130,9 +126,6 @@ - (void)setContext:(NSData *)context completionHandler:(void (^_Nullable)(NSErro error = [NSError errorWithDomain:MGLErrorDomain code:MGLErrorCodeModifyingOfflineStorageFailed userInfo:errorDescription ? @{ NSLocalizedDescriptionKey: errorDescription, } : nil]; -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - [[MMEEventsManager sharedManager] reportError:error]; -#endif } dispatch_async(dispatch_get_main_queue(), [&, completion, weakSelf, error](void) { [weakSelf reloadWithCompletionHandler:^(NSError * _Nullable reloadingError) { diff --git a/platform/ios/platform/darwin/src/MGLOfflineStorage.mm b/platform/ios/platform/darwin/src/MGLOfflineStorage.mm index 56d8d920c26..eb91297f220 100644 --- a/platform/ios/platform/darwin/src/MGLOfflineStorage.mm +++ b/platform/ios/platform/darwin/src/MGLOfflineStorage.mm @@ -13,11 +13,6 @@ #import "MGLLoggingConfiguration_Private.h" #import "MGLNetworkConfiguration_Private.h" -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR -#import -#import "MGLMapboxEvents.h" -#endif - #include #include #include @@ -390,9 +385,6 @@ - (void)_addContentsOfFile:(NSString *)filePath withCompletionHandler:(void (^)( NSLocalizedDescriptionKey: description, NSLocalizedFailureReasonErrorKey: @(mbgl::util::toString(result.error()).c_str()) }]; -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - [[MMEEventsManager sharedManager] reportError:error]; -#endif } else { auto& regions = result.value(); packs = [NSMutableArray arrayWithCapacity:regions.size()]; @@ -421,17 +413,6 @@ - (void)addPackForRegion:(id )region withContext:(NSData *)con 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)region).offlineStartEventAttributes; - [offlineDownloadStartEventAttributes addEntriesFromDictionary:regionAttributes]; - } - - [MGLMapboxEvents pushEvent:MMEventTypeOfflineDownloadStart withAttributes:offlineDownloadStartEventAttributes]; - #endif }]; } @@ -452,9 +433,6 @@ - (void)_addPackForRegion:(id )region withContext:(NSData *)co error = [NSError errorWithDomain:MGLErrorDomain code:MGLErrorCodeModifyingOfflineStorageFailed userInfo:errorDescription ? @{ NSLocalizedDescriptionKey: errorDescription, } : nil]; -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - [[MMEEventsManager sharedManager] reportError:error]; -#endif } if (completion) { MGLOfflinePack *pack = mbglOfflineRegion ? [[MGLOfflinePack alloc] initWithMBGLRegion:new mbgl::OfflineRegion(std::move(mbglOfflineRegion.value()))] : nil; @@ -492,9 +470,6 @@ - (void)_removePack:(MGLOfflinePack *)pack withCompletionHandler:(MGLOfflinePack error = [NSError errorWithDomain:MGLErrorDomain code:MGLErrorCodeModifyingOfflineStorageFailed userInfo:@{ NSLocalizedDescriptionKey: @(mbgl::util::toString(exception).c_str()), }]; -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - [[MMEEventsManager sharedManager] reportError:error]; -#endif } if (completion) { dispatch_async(dispatch_get_main_queue(), [&, completion, error](void) { @@ -518,9 +493,6 @@ - (void)invalidatePack:(MGLOfflinePack *)pack withCompletionHandler:(void (^)(NS error = [NSError errorWithDomain:MGLErrorDomain code:MGLErrorCodeModifyingOfflineStorageFailed userInfo:@{ NSLocalizedDescriptionKey: @(mbgl::util::toString(exception).c_str()), }]; -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - [[MMEEventsManager sharedManager] reportError:error]; -#endif } }); if (completion) { @@ -548,9 +520,6 @@ - (void)getPacksWithCompletionHandler:(void (^)(NSArray *packs error = [NSError errorWithDomain:MGLErrorDomain code:MGLErrorCodeUnknown userInfo:@{ NSLocalizedDescriptionKey: @(mbgl::util::toString(result.error()).c_str()), }]; -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - [[MMEEventsManager sharedManager] reportError:error]; -#endif } else { auto& regions = result.value(); packs = [NSMutableArray arrayWithCapacity:regions.size()]; @@ -582,9 +551,6 @@ - (void)setMaximumAmbientCacheSize:(NSUInteger)cacheSize withCompletionHandler:( error = [NSError errorWithDomain:MGLErrorDomain code:MGLErrorCodeModifyingOfflineStorageFailed userInfo:@{ NSLocalizedDescriptionKey: @(mbgl::util::toString(exception).c_str()), }]; -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - [[MMEEventsManager sharedManager] reportError:error]; -#endif } dispatch_sync(dispatch_get_main_queue(), ^ { completion(error); @@ -602,9 +568,6 @@ - (void)invalidateAmbientCacheWithCompletionHandler:(void (^)(NSError *_Nullable error = [NSError errorWithDomain:MGLErrorDomain code:MGLErrorCodeModifyingOfflineStorageFailed userInfo:@{ NSLocalizedDescriptionKey: @(mbgl::util::toString(exception).c_str()), }]; -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - [[MMEEventsManager sharedManager] reportError:error]; -#endif } dispatch_async(dispatch_get_main_queue(), ^ { completion(error); @@ -621,9 +584,6 @@ - (void)clearAmbientCacheWithCompletionHandler:(void (^)(NSError *_Nullable erro error = [NSError errorWithDomain:MGLErrorDomain code:MGLErrorCodeModifyingOfflineStorageFailed userInfo:@{ NSLocalizedDescriptionKey: @(mbgl::util::toString(exception).c_str()), }]; -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - [[MMEEventsManager sharedManager] reportError:error]; -#endif } dispatch_async(dispatch_get_main_queue(), [&, completion, error](void) { completion(error); @@ -640,9 +600,6 @@ - (void)resetDatabaseWithCompletionHandler:(void (^)(NSError *_Nullable error))c error = [NSError errorWithDomain:MGLErrorDomain code:MGLErrorCodeUnknown userInfo:@{ NSLocalizedDescriptionKey: @(mbgl::util::toString(exception).c_str()), }]; -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - [[MMEEventsManager sharedManager] reportError:error]; -#endif } dispatch_async(dispatch_get_main_queue(), ^{ completion(error); diff --git a/platform/ios/platform/darwin/src/MGLSDKMetricsManager.h b/platform/ios/platform/darwin/src/MGLSDKMetricsManager.h deleted file mode 100644 index 49b3391a727..00000000000 --- a/platform/ios/platform/darwin/src/MGLSDKMetricsManager.h +++ /dev/null @@ -1,79 +0,0 @@ -#import -#import "MGLFoundation.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - :nodoc: - The metrics type used to handle metrics events. - */ -typedef NS_ENUM(NSUInteger, MGLMetricType) { - /** :nodoc: - Metric that measures performance. - */ - MGLMetricTypePerformance = 0, -}; - -FOUNDATION_EXTERN MGL_EXPORT NSString* MGLStringFromMetricType(MGLMetricType metricType); - -@class MGLMetricsManager; - -/** - :nodoc: - The `MGLMetricsManagerDelegate` protocol defines a set of methods that you - can use to receive metric events. - */ -@protocol MGLMetricsManagerDelegate - -/** - :nodoc: - Asks the delegate whether the metrics manager should handle metric events. - - @param metricsManager The metrics manager object. - @param metricType The metric type event. - */ -- (BOOL)metricsManager:(MGLMetricsManager *)metricsManager shouldHandleMetric:(MGLMetricType)metricType; - -/** - :nodoc: - Asks the delegate to handle metric events. - - @param metricsManager The metrics manager object. - @param metricType The metric type event. - @param attributes The metric attributes. - */ -- (void)metricsManager:(MGLMetricsManager *)metricsManager didCollectMetric:(MGLMetricType)metricType withAttributes:(NSDictionary *)attributes; - -@end - -/** - :nodoc: - The `MGLMetricsManager` object provides a single poin to collect SDK metrics - such as tile download latency. - */ -MGL_EXPORT -@interface MGLMetricsManager : NSObject - -/** - :nodoc: - Returns the shared metrics manager object. - */ -@property (class, nonatomic, readonly) MGLMetricsManager *sharedManager; - -/** - :nodoc: - The metrics manager delegate that will recieve metric events. - */ -@property (nonatomic, weak) id delegate; - -#if TARGET_OS_IOS -/** - :nodoc: - Sends metric events to Mapbox. - */ -- (void)pushMetric:(MGLMetricType)metricType withAttributes:(NSDictionary *)attributes; -#endif - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/ios/platform/darwin/src/MGLSDKMetricsManager.m b/platform/ios/platform/darwin/src/MGLSDKMetricsManager.m deleted file mode 100644 index 0ef9ecda101..00000000000 --- a/platform/ios/platform/darwin/src/MGLSDKMetricsManager.m +++ /dev/null @@ -1,134 +0,0 @@ -#import "MGLSDKMetricsManager_Private.h" -#import "MGLNetworkConfiguration_Private.h" -#if TARGET_OS_IOS -#import "MGLMapboxEvents.h" -#import -#import -#import -#endif - -NSString* MGLStringFromMetricType(MGLMetricType metricType) { - NSString *eventName; - - switch (metricType) { - case MGLMetricTypePerformance: - eventName = kMGLDownloadPerformanceEvent; - break; - } - return eventName; -} - -// Taken verbatim from NXFreeArchInfo header documentation -#if TARGET_OS_IOS -static void MGLFreeArchInfo(const NXArchInfo *x) -{ - const NXArchInfo *p; - - p = NXGetAllArchInfos(); - while(p->name != NULL){ - if(x == p) - return; - p++; - } - free((char *)x->description); - free((NXArchInfo *)x); -} -#endif - -@interface MGLMetricsManager() - -@property (strong, nonatomic) NSDictionary *metadata; - -@end - -@implementation MGLMetricsManager - -+ (instancetype)sharedManager -{ - static dispatch_once_t once; - static MGLMetricsManager *sharedConfiguration; - dispatch_once(&once, ^{ - sharedConfiguration = [[self alloc] init]; - [MGLNetworkConfiguration sharedManager].metricsDelegate = sharedConfiguration; -#if TARGET_OS_IOS - UIDevice *currentDevice = [UIDevice currentDevice]; - - NSString *osVersion = currentDevice.systemVersion; - - NSString *screenSize = [NSString stringWithFormat:@"%.fx%.f", [UIScreen mainScreen].bounds.size.width, - [UIScreen mainScreen].bounds.size.height]; - - NSLocale *currentLocale = [NSLocale currentLocale]; - - NSString *country = [currentLocale objectForKey:NSLocaleCountryCode] ?: @"unknown"; - - NSString *device = deviceName(); - - NSString *abi = @"unknown"; - - { - const NXArchInfo *localArchInfo = NXGetLocalArchInfo(); - - if (localArchInfo) { - abi = @(localArchInfo->description); - - NSProcessInfo *processInfo = [NSProcessInfo processInfo]; - - // Although NXFreeArchInfo appears to be weakly linked, it does - // not have the weak_import attribute, so check the OS version. - if (&NXFreeArchInfo && [processInfo isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){10, 0, 0}]) { - NXFreeArchInfo(localArchInfo); - } else { - MGLFreeArchInfo(localArchInfo); - } - } - } - - NSString *ram = [NSString stringWithFormat:@"%llu", [NSProcessInfo processInfo].physicalMemory]; - - NSString *os = currentDevice.systemName; - - sharedConfiguration.metadata = @{ @"version" : osVersion, - @"screenSize" : screenSize, - @"country" : country, - @"device" : device, - @"abi" : abi, - @"brand" : @"Apple", - @"ram" : ram, - @"os" : os - }; -#endif - }); - return sharedConfiguration; -} - -- (void)handleMetricsEvent:(MGLMetricType)metricType withAttributes:(NSDictionary *)attributes { - if ([self.delegate metricsManager:self shouldHandleMetric:metricType]) { - [self.delegate metricsManager:self didCollectMetric:metricType withAttributes:attributes]; - } -} - -#if TARGET_OS_IOS -- (void)pushMetric:(MGLMetricType)metricType withAttributes:(NSDictionary *)attributes { - NSString *eventName = MGLStringFromMetricType(metricType); - NSMutableDictionary *mutableAttributes = [NSMutableDictionary dictionaryWithDictionary:attributes]; - [mutableAttributes setObject:self.metadata forKey:@"metadata"]; - - [MGLMapboxEvents pushEvent:eventName withAttributes:mutableAttributes]; -} - -NSString* deviceName() -{ - struct utsname systemInfo; - uname(&systemInfo); - - return [NSString stringWithCString:systemInfo.machine - encoding:NSUTF8StringEncoding]; -} -#endif - -- (void)networkConfiguration:(MGLNetworkConfiguration *)networkConfiguration didGenerateMetricEvent:(NSDictionary *)metricEvent { - [self handleMetricsEvent:MGLMetricTypePerformance withAttributes:metricEvent]; -} - -@end diff --git a/platform/ios/platform/darwin/src/MGLSDKMetricsManager_Private.h b/platform/ios/platform/darwin/src/MGLSDKMetricsManager_Private.h deleted file mode 100644 index a3cdfca7944..00000000000 --- a/platform/ios/platform/darwin/src/MGLSDKMetricsManager_Private.h +++ /dev/null @@ -1,11 +0,0 @@ -#import "MGLSDKMetricsManager.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface MGLMetricsManager (Private) - -- (void)handleMetricsEvent:(MGLMetricType)metricType withAttributes:(NSDictionary *)attributes; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/ios/platform/darwin/src/MGLShape.mm b/platform/ios/platform/darwin/src/MGLShape.mm index 6f525e89e06..59643dcb6ab 100644 --- a/platform/ios/platform/darwin/src/MGLShape.mm +++ b/platform/ios/platform/darwin/src/MGLShape.mm @@ -5,10 +5,6 @@ #import "NSString+MGLAdditions.h" #import "MGLTypes.h" -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR -#import -#endif - #import bool operator==(const CLLocationCoordinate2D lhs, const CLLocationCoordinate2D rhs) { @@ -22,9 +18,6 @@ + (nullable MGLShape *)shapeWithData:(NSData *)data encoding:(NSStringEncoding)e if (!string) { if (outError) { *outError = [NSError errorWithDomain:MGLErrorDomain code:MGLErrorCodeUnknown userInfo:nil]; -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - [[MMEEventsManager sharedManager] reportError:*outError]; -#endif } return nil; } @@ -37,9 +30,6 @@ + (nullable MGLShape *)shapeWithData:(NSData *)data encoding:(NSStringEncoding)e *outError = [NSError errorWithDomain:MGLErrorDomain code:MGLErrorCodeUnknown userInfo:@{ NSLocalizedFailureReasonErrorKey: @(err.what()), }]; -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - [[MMEEventsManager sharedManager] reportError:*outError]; -#endif } return nil; } diff --git a/platform/ios/platform/darwin/src/MGLShapeOfflineRegion.mm b/platform/ios/platform/darwin/src/MGLShapeOfflineRegion.mm index b18599c7137..19d2b0beb38 100644 --- a/platform/ios/platform/darwin/src/MGLShapeOfflineRegion.mm +++ b/platform/ios/platform/darwin/src/MGLShapeOfflineRegion.mm @@ -13,10 +13,6 @@ #import "MGLStyle.h" #import "MGLLoggingConfiguration_Private.h" -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR -#import -#endif - @interface MGLShapeOfflineRegion () @end @@ -29,14 +25,7 @@ @implementation MGLShapeOfflineRegion { @synthesize includesIdeographicGlyphs = _includesIdeographicGlyphs; -(NSDictionary *)offlineStartEventAttributes { - return @{ - #if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - MMEEventKeyShapeForOfflineRegion: @"shaperegion", - MMEEventKeyMinZoomLevel: @(self.minimumZoomLevel), - MMEEventKeyMaxZoomLevel: @(self.maximumZoomLevel), - MMEEventKeyStyleURL: self.styleURL.absoluteString ?: [NSNull null] - #endif - }; + return @{}; } + (BOOL)supportsSecureCoding { diff --git a/platform/ios/platform/darwin/src/MGLSource.mm b/platform/ios/platform/darwin/src/MGLSource.mm index 51f1fd9cc13..49d5b533b01 100644 --- a/platform/ios/platform/darwin/src/MGLSource.mm +++ b/platform/ios/platform/darwin/src/MGLSource.mm @@ -3,10 +3,6 @@ #import "MGLMapView_Private.h" #import "NSBundle+MGLAdditions.h" -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR -#import -#endif - #include #include #include @@ -90,10 +86,6 @@ - (BOOL)removeFromStylable:(id )mapView error:(NSError * __nullable *outError = [NSError errorWithDomain:MGLErrorDomain code:MGLErrorCodeSourceIsInUseCannotRemove userInfo:@{ NSLocalizedDescriptionKey : localizedDescription }]; -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - [[MMEEventsManager sharedManager] reportError:*outError]; -#endif - } } else if (outError) { // TODO: Consider raising an exception here @@ -104,9 +96,6 @@ - (BOOL)removeFromStylable:(id )mapView error:(NSError * __nullable *outError = [NSError errorWithDomain:MGLErrorDomain code:MGLErrorCodeSourceIdentifierMismatch userInfo:@{ NSLocalizedDescriptionKey : localizedDescription }]; -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - [[MMEEventsManager sharedManager] reportError:*outError]; -#endif } return removed; diff --git a/platform/ios/platform/darwin/src/MGLTilePyramidOfflineRegion.mm b/platform/ios/platform/darwin/src/MGLTilePyramidOfflineRegion.mm index b782cd7827d..8d84a9e1bfd 100644 --- a/platform/ios/platform/darwin/src/MGLTilePyramidOfflineRegion.mm +++ b/platform/ios/platform/darwin/src/MGLTilePyramidOfflineRegion.mm @@ -10,10 +10,6 @@ #import "MGLStyle.h" #import "MGLLoggingConfiguration_Private.h" -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR -#import -#endif - @interface MGLTilePyramidOfflineRegion () @end @@ -26,14 +22,7 @@ @implementation MGLTilePyramidOfflineRegion { @synthesize includesIdeographicGlyphs = _includesIdeographicGlyphs; -(NSDictionary *)offlineStartEventAttributes { - return @{ - #if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - MMEEventKeyShapeForOfflineRegion: @"tileregion", - MMEEventKeyMinZoomLevel: @(self.minimumZoomLevel), - MMEEventKeyMaxZoomLevel: @(self.maximumZoomLevel), - MMEEventKeyStyleURL: self.styleURL.absoluteString ?: [NSNull null] - #endif - }; + return @{}; } + (BOOL)supportsSecureCoding { diff --git a/platform/ios/platform/darwin/test/MGLResourceTests.mm b/platform/ios/platform/darwin/test/MGLResourceTests.mm index a72b0f7dc46..989eef8fe77 100644 --- a/platform/ios/platform/darwin/test/MGLResourceTests.mm +++ b/platform/ios/platform/darwin/test/MGLResourceTests.mm @@ -40,26 +40,6 @@ - (void)internalTestOfflineQueryParameterIsAddedForOfflineResource:(std::string) Resource resource(Resource::Kind::Unknown, testURL); - // By default, resources are NOT offline - { - bool skuTokenQueryItemFound; - NSURL *url = resourceURL(resource); - NSURLComponents *components = [NSURLComponents componentsWithURL:url resolvingAgainstBaseURL:NO]; - for (NSURLQueryItem *item in components.queryItems) { - XCTAssertFalse([item.name isEqualToString:@"offline"]); - if ([item.name isEqualToString:@"sku"]) { - skuTokenQueryItemFound = YES; - } - } - - // https://github.com/mapbox/mapbox-gl-native-ios/pull/296 -//#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - XCTAssertTrue(skuTokenQueryItemFound, "Default resource URL should have SKU token query item"); -//#else -// XCTAssertFalse(skuTokenQueryItemFound, "Non-iOS platforms should not have a SKU token query item"); -//#endif - } - // Now check offline resource.setUsage(Resource::Usage::Offline); diff --git a/platform/ios/platform/ios/Integration Tests/MGLNetworkConfigurationIntegrationTests.mm b/platform/ios/platform/ios/Integration Tests/MGLNetworkConfigurationIntegrationTests.mm index 96de541bfc6..7482b1b88e0 100644 --- a/platform/ios/platform/ios/Integration Tests/MGLNetworkConfigurationIntegrationTests.mm +++ b/platform/ios/platform/ios/Integration Tests/MGLNetworkConfigurationIntegrationTests.mm @@ -54,7 +54,6 @@ - (void)test0_NativeNetworkManagerDelegateIsSet XCTAssertNotNil(manager); // Expected properties - XCTAssertNotNil([manager skuToken]); XCTAssertNotNil([manager sessionConfiguration]); [MGLNetworkConfiguration sharedManager]; @@ -77,7 +76,6 @@ - (void)test1_NativeNetworkManagerDelegateIsSetBySharedManager XCTAssertNotNil(manager); // Expected properties - XCTAssertNotNil([manager skuToken]); XCTAssertNotNil([manager sessionConfiguration]); } diff --git a/platform/ios/platform/ios/app/MBXAppDelegate.m b/platform/ios/platform/ios/app/MBXAppDelegate.m index bf62866b8eb..d808616690b 100644 --- a/platform/ios/platform/ios/app/MBXAppDelegate.m +++ b/platform/ios/platform/ios/app/MBXAppDelegate.m @@ -3,7 +3,7 @@ #import "MBXAppDelegate.h" #import "MBXViewController.h" -@interface MBXAppDelegate() +@interface MBXAppDelegate() @end @@ -15,7 +15,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( [MGLLoggingConfiguration sharedConfiguration].loggingLevel = MGLLoggingLevelFault; #endif - [MGLMetricsManager sharedManager].delegate = self; return YES; } @@ -37,12 +36,4 @@ - (BOOL)handleShortcut:(UIApplicationShortcutItem *)shortcut { return NO; } -- (BOOL)metricsManager:(MGLMetricsManager *)metricsManager shouldHandleMetric:(MGLMetricType)metricType { - return YES; -} - -- (void)metricsManager:(MGLMetricsManager *)metricsManager didCollectMetric:(MGLMetricType)metricType withAttributes:(NSDictionary *)attributes { - [[MGLMetricsManager sharedManager] pushMetric:metricType withAttributes:attributes]; -} - @end diff --git a/platform/ios/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/platform/ios/ios.xcodeproj/project.pbxproj index b2c6db5c7d5..6d75c11b30f 100644 --- a/platform/ios/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/platform/ios/ios.xcodeproj/project.pbxproj @@ -61,12 +61,6 @@ 1FCAE2A520B872A400C577DD /* MGLLocationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 1FCAE2A120B872A400C577DD /* MGLLocationManager.m */; }; 1FCAE2A820B88B3800C577DD /* MGLLocationManager_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 1FCAE2A620B88B3800C577DD /* MGLLocationManager_Private.h */; }; 1FCAE2A920B88B3800C577DD /* MGLLocationManager_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 1FCAE2A620B88B3800C577DD /* MGLLocationManager_Private.h */; }; - 1FCCEC34222605C400302E3B /* MGLSDKMetricsManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1FCCEC32222605C400302E3B /* MGLSDKMetricsManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 1FCCEC35222605C400302E3B /* MGLSDKMetricsManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1FCCEC32222605C400302E3B /* MGLSDKMetricsManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 1FCCEC36222605C400302E3B /* MGLSDKMetricsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 1FCCEC33222605C400302E3B /* MGLSDKMetricsManager.m */; }; - 1FCCEC37222605C400302E3B /* MGLSDKMetricsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 1FCCEC33222605C400302E3B /* MGLSDKMetricsManager.m */; }; - 1FCCEC3A222607A500302E3B /* MGLSDKMetricsManager_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 1FCCEC38222607A500302E3B /* MGLSDKMetricsManager_Private.h */; }; - 1FCCEC3B222607A500302E3B /* MGLSDKMetricsManager_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 1FCCEC38222607A500302E3B /* MGLSDKMetricsManager_Private.h */; }; 1FF48587223710BE00F19727 /* MGLAttributedExpression.h in Headers */ = {isa = PBXBuildFile; fileRef = 1FF48585223710BE00F19727 /* MGLAttributedExpression.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1FF48588223710BE00F19727 /* MGLAttributedExpression.h in Headers */ = {isa = PBXBuildFile; fileRef = 1FF48585223710BE00F19727 /* MGLAttributedExpression.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1FF48589223710BE00F19727 /* MGLAttributedExpression.m in Sources */ = {isa = PBXBuildFile; fileRef = 1FF48586223710BE00F19727 /* MGLAttributedExpression.m */; }; @@ -306,10 +300,6 @@ 96036A0620059BBA00510F3D /* MGLNSOrthographyAdditionsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 96036A0520059BBA00510F3D /* MGLNSOrthographyAdditionsTests.m */; }; 960D0C361ECF5AAF008E151F /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 960D0C351ECF5AAF008E151F /* Images.xcassets */; }; 960D0C371ECF5AAF008E151F /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 960D0C351ECF5AAF008E151F /* Images.xcassets */; }; - 9620BB381E69FE1700705A1D /* MGLSDKUpdateChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 9620BB361E69FE1700705A1D /* MGLSDKUpdateChecker.h */; }; - 9620BB391E69FE1700705A1D /* MGLSDKUpdateChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 9620BB361E69FE1700705A1D /* MGLSDKUpdateChecker.h */; }; - 9620BB3A1E69FE1700705A1D /* MGLSDKUpdateChecker.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9620BB371E69FE1700705A1D /* MGLSDKUpdateChecker.mm */; }; - 9620BB3B1E69FE1700705A1D /* MGLSDKUpdateChecker.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9620BB371E69FE1700705A1D /* MGLSDKUpdateChecker.mm */; }; 9621F2502091020E005B3800 /* NSExpression+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 3510FFEE1D6D9D8C00F413B2 /* NSExpression+MGLAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; 96381C0222C6F3950053497D /* MGLMapViewPitchTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 96381C0122C6F3950053497D /* MGLMapViewPitchTests.m */; }; 9641771F22D546DA00332422 /* MGLCompassButton_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 9641771E22D546DA00332422 /* MGLCompassButton_Private.h */; }; @@ -328,8 +318,6 @@ 967C864C210A9D3C004DF794 /* UIDevice+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 967C8649210A9D3C004DF794 /* UIDevice+MGLAdditions.h */; }; 967C864D210A9D3C004DF794 /* UIDevice+MGLAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 967C864A210A9D3C004DF794 /* UIDevice+MGLAdditions.m */; }; 967C864E210A9D3C004DF794 /* UIDevice+MGLAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 967C864A210A9D3C004DF794 /* UIDevice+MGLAdditions.m */; }; - 9680273F22653B84006BA4A1 /* MBXSKUToken.h in Headers */ = {isa = PBXBuildFile; fileRef = 9680273E22653B84006BA4A1 /* MBXSKUToken.h */; }; - 9680274022653B84006BA4A1 /* MBXSKUToken.h in Headers */ = {isa = PBXBuildFile; fileRef = 9680273E22653B84006BA4A1 /* MBXSKUToken.h */; }; 9680276422655696006BA4A1 /* libmbxaccounts.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9680274122653C3E006BA4A1 /* libmbxaccounts.a */; }; 96802766226556C5006BA4A1 /* libmbxaccounts.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9680274122653C3E006BA4A1 /* libmbxaccounts.a */; }; 9686D1BD22D9357700194EA0 /* MGLMapViewZoomTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9686D1BC22D9357700194EA0 /* MGLMapViewZoomTests.mm */; }; @@ -374,29 +362,17 @@ 96E6145C22CC169000109F14 /* MGLCompassButton.mm in Sources */ = {isa = PBXBuildFile; fileRef = 96E6145822CC169000109F14 /* MGLCompassButton.mm */; }; 96ED34DE22374C0900E9FCA9 /* MGLMapViewDirectionTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 96ED34DD22374C0900E9FCA9 /* MGLMapViewDirectionTests.mm */; }; 96F3F73C1F57124B003E2D2C /* MGLUserLocationHeadingIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 96F3F73B1F5711F1003E2D2C /* MGLUserLocationHeadingIndicator.h */; }; - 9C6E282B22A981570056B7BE /* MGLMapboxEvents.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C6E282A22A980E50056B7BE /* MGLMapboxEvents.m */; }; - 9C6E282C22A981580056B7BE /* MGLMapboxEvents.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C6E282A22A980E50056B7BE /* MGLMapboxEvents.m */; }; - 9C6E282D22A9815D0056B7BE /* MGLMapboxEvents.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C6E282922A980E50056B7BE /* MGLMapboxEvents.h */; }; - 9C6E282F22A9824B0056B7BE /* MGLTelemetryConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = AC518DFD201BB55A00EBC820 /* MGLTelemetryConfig.h */; }; - 9C6E283022A9824F0056B7BE /* MGLMapboxEvents.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C6E282922A980E50056B7BE /* MGLMapboxEvents.h */; }; A4DE3DCB23038C98005B3473 /* MGLMockGestureRecognizers.h in Sources */ = {isa = PBXBuildFile; fileRef = A4DE3DCA23038A7F005B3473 /* MGLMockGestureRecognizers.h */; }; A4DE3DCC23038CCA005B3473 /* MGLMockGestureRecognizers.m in Sources */ = {isa = PBXBuildFile; fileRef = A4DE3DC823038A07005B3473 /* MGLMockGestureRecognizers.m */; }; A4F3FB1D2254865900A30170 /* missing_icon.json in Resources */ = {isa = PBXBuildFile; fileRef = A4F3FB1C2254865900A30170 /* missing_icon.json */; }; - AC518DFF201BB55A00EBC820 /* MGLTelemetryConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = AC518DFD201BB55A00EBC820 /* MGLTelemetryConfig.h */; }; - AC518E03201BB56000EBC820 /* MGLTelemetryConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = AC518DFE201BB55A00EBC820 /* MGLTelemetryConfig.m */; }; - AC518E04201BB56100EBC820 /* MGLTelemetryConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = AC518DFE201BB55A00EBC820 /* MGLTelemetryConfig.m */; }; CA0B3C022329DE9A00E4B493 /* MGLTestAssertionHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = CAAA65D82321BBA900F08A39 /* MGLTestAssertionHandler.m */; }; CA0C27922076C804001CE5B7 /* MGLShapeSourceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CA0C27912076C804001CE5B7 /* MGLShapeSourceTests.m */; }; CA0C27942076CA19001CE5B7 /* MGLMapViewIntegrationTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CA0C27932076CA19001CE5B7 /* MGLMapViewIntegrationTest.m */; }; CA0FAA05237B3BB700C9F3C9 /* Mapbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA8847D21CBAF91600AB86E3 /* Mapbox.framework */; }; - CA0FAA06237B3BB700C9F3C9 /* MapboxMobileEvents.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA96299B23731199004F1330 /* MapboxMobileEvents.framework */; }; CA0FAA07237B3BC600C9F3C9 /* Mapbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA8847D21CBAF91600AB86E3 /* Mapbox.framework */; }; - CA0FAA08237B3BC600C9F3C9 /* MapboxMobileEvents.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA96299B23731199004F1330 /* MapboxMobileEvents.framework */; }; CA0FAA09237B3BEA00C9F3C9 /* Mapbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA8847D21CBAF91600AB86E3 /* Mapbox.framework */; }; CA17464E23D8A93C008B7A43 /* MGLNetworkConfigurationIntegrationTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = CA17464D23D8A93C008B7A43 /* MGLNetworkConfigurationIntegrationTests.mm */; }; CA1B4A512099FB2200EDD491 /* MGLMapSnapshotterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CA1B4A502099FB2200EDD491 /* MGLMapSnapshotterTest.m */; }; - CA488BAB23FCE6B900AEE226 /* MapboxMobileEvents.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA96299B23731199004F1330 /* MapboxMobileEvents.framework */; }; - CA488BAC23FCE6B900AEE226 /* MapboxMobileEvents.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = CA96299B23731199004F1330 /* MapboxMobileEvents.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; CA4C54FE2324948100A81659 /* MGLSourceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA4C54FD2324948100A81659 /* MGLSourceTests.swift */; }; CA4EB8C720863487006AB465 /* MGLStyleLayerIntegrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CA4EB8C620863487006AB465 /* MGLStyleLayerIntegrationTests.m */; }; CA4F3BDE230F74C3008BAFEA /* MGLMapViewPendingBlockTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CA4F3BDD230F74C3008BAFEA /* MGLMapViewPendingBlockTests.m */; }; @@ -415,11 +391,9 @@ CA8FBC0921A47BB100D1203C /* MGLRendererConfigurationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CA8FBC0821A47BB100D1203C /* MGLRendererConfigurationTests.m */; }; CA94E5FB237D21030037AEA0 /* Mapbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA8847D21CBAF91600AB86E3 /* Mapbox.framework */; }; CA94E5FC237D21030037AEA0 /* Mapbox.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DA8847D21CBAF91600AB86E3 /* Mapbox.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - CA94E601237EF4110037AEA0 /* MapboxMobileEvents.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA96299B23731199004F1330 /* MapboxMobileEvents.framework */; }; CAA69DA5206DCD0E007279CD /* Mapbox.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DA4A26961CB6E795000B7809 /* Mapbox.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; CAAA65D92321BBA900F08A39 /* MGLTestAssertionHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = CAAA65D82321BBA900F08A39 /* MGLTestAssertionHandler.m */; }; CAB369E5237471D600592F74 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 1F7839A3235E11FC00D4D606 /* libz.tbd */; }; - CAB36C3B2374D11600592F74 /* libMapboxMobileEvents.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CAB36C3A2374D11600592F74 /* libMapboxMobileEvents.a */; }; CABC52C22368CB5100B7E543 /* sideload_sat.db in Resources */ = {isa = PBXBuildFile; fileRef = 1F7839A5235E137000D4D606 /* sideload_sat.db */; }; CAD9D0AA22A86D6F001B25EE /* MGLResourceTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = CAD9D0A922A86D6F001B25EE /* MGLResourceTests.mm */; }; CAE7AD5520F46EF5003B6782 /* MGLMapSnapshotterSwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAE7AD5420F46EF5003B6782 /* MGLMapSnapshotterSwiftTests.swift */; }; @@ -431,7 +405,6 @@ DA00FC8F1D5EEB0D009AABC8 /* MGLAttributionInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = DA00FC8C1D5EEB0D009AABC8 /* MGLAttributionInfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; DA00FC901D5EEB0D009AABC8 /* MGLAttributionInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA00FC8D1D5EEB0D009AABC8 /* MGLAttributionInfo.mm */; }; DA00FC911D5EEB0D009AABC8 /* MGLAttributionInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA00FC8D1D5EEB0D009AABC8 /* MGLAttributionInfo.mm */; }; - DA0BDD1E2407C07F00DAA576 /* MapboxMobileEvents.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA96299B23731199004F1330 /* MapboxMobileEvents.framework */; }; DA0BDD1F2407C09C00DAA576 /* libmbgl-vendor-icu.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 358B3DBA2359EA0F007BEB26 /* libmbgl-vendor-icu.a */; }; DA0BDD202407C12600DAA576 /* libmbgl-core.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1F78399D235AA1E600D4D606 /* libmbgl-core.a */; }; DA0BDD212407C13000DAA576 /* libmbgl-core.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1F78399D235AA1E600D4D606 /* libmbgl-core.a */; }; @@ -504,7 +477,6 @@ DA72620E1DEEE3480043BB89 /* MGLOpenGLStyleLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA72620A1DEEE3480043BB89 /* MGLOpenGLStyleLayer.mm */; }; DA737EE11D056A4E005BDA16 /* MGLMapViewDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = DA737EE01D056A4E005BDA16 /* MGLMapViewDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; DA737EE21D056A4E005BDA16 /* MGLMapViewDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = DA737EE01D056A4E005BDA16 /* MGLMapViewDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DA74F0BD2436AFE600E2E089 /* MapboxMobileEvents.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = CA96299B23731199004F1330 /* MapboxMobileEvents.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; DA821D061CCC6D59007508D4 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DA821D041CCC6D59007508D4 /* LaunchScreen.storyboard */; }; DA821D071CCC6D59007508D4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DA821D051CCC6D59007508D4 /* Main.storyboard */; }; DA8847EF1CBAFA5100AB86E3 /* MGLAccountManager.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8847DF1CBAFA5100AB86E3 /* MGLAccountManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -737,7 +709,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - DA74F0BD2436AFE600E2E089 /* MapboxMobileEvents.framework in Embed Frameworks */, CA94E5FC237D21030037AEA0 /* Mapbox.framework in Embed Frameworks */, ); name = "Embed Frameworks"; @@ -749,7 +720,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - CA488BAC23FCE6B900AEE226 /* MapboxMobileEvents.framework in Embed Frameworks */, CAA69DA5206DCD0E007279CD /* Mapbox.framework in Embed Frameworks */, ); name = "Embed Frameworks"; @@ -821,16 +791,13 @@ 1F7454A61ED08AB400021D39 /* MGLLightTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLLightTest.mm; path = ../../darwin/test/MGLLightTest.mm; sourceTree = ""; }; 1F78399D235AA1E600D4D606 /* libmbgl-core.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libmbgl-core.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 1F7839A3235E11FC00D4D606 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/libz.tbd; sourceTree = DEVELOPER_DIR; }; - 1F7839A5235E137000D4D606 /* sideload_sat.db */ = {isa = PBXFileReference; lastKnownFileType = file; name = sideload_sat.db; path = "../../../../test/fixtures/offline_database/sideload_sat.db"; sourceTree = ""; }; + 1F7839A5235E137000D4D606 /* sideload_sat.db */ = {isa = PBXFileReference; lastKnownFileType = file; name = sideload_sat.db; path = ../../../../test/fixtures/offline_database/sideload_sat.db; sourceTree = ""; }; 1F8E8A80233A9FD9009B51ED /* MGLMapViewGestureRecognizerTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLMapViewGestureRecognizerTests.mm; sourceTree = ""; }; 1F95931C1E6DE2E900D5B294 /* MGLNSDateAdditionsTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLNSDateAdditionsTests.mm; path = ../../darwin/test/MGLNSDateAdditionsTests.mm; sourceTree = ""; }; 1FC4817B2098CBC0000D09B4 /* NSPredicate+MGLPrivateAdditions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSPredicate+MGLPrivateAdditions.h"; sourceTree = ""; }; 1FCAE2A020B872A400C577DD /* MGLLocationManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLLocationManager.h; sourceTree = ""; }; 1FCAE2A120B872A400C577DD /* MGLLocationManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGLLocationManager.m; sourceTree = ""; }; 1FCAE2A620B88B3800C577DD /* MGLLocationManager_Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLLocationManager_Private.h; sourceTree = ""; }; - 1FCCEC32222605C400302E3B /* MGLSDKMetricsManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLSDKMetricsManager.h; sourceTree = ""; }; - 1FCCEC33222605C400302E3B /* MGLSDKMetricsManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGLSDKMetricsManager.m; sourceTree = ""; }; - 1FCCEC38222607A500302E3B /* MGLSDKMetricsManager_Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLSDKMetricsManager_Private.h; sourceTree = ""; }; 1FDB00C721F8F14E00D21389 /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/Localizable.strings; sourceTree = ""; }; 1FDB00C821F8F14F00D21389 /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/Foundation.strings; sourceTree = ""; }; 1FDB00C921F8F15000D21389 /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = cs; path = cs.lproj/Foundation.stringsdict; sourceTree = ""; }; @@ -987,8 +954,6 @@ 96036A00200565C700510F3D /* NSOrthography+MGLAdditions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSOrthography+MGLAdditions.m"; sourceTree = ""; }; 96036A0520059BBA00510F3D /* MGLNSOrthographyAdditionsTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGLNSOrthographyAdditionsTests.m; sourceTree = ""; }; 960D0C351ECF5AAF008E151F /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - 9620BB361E69FE1700705A1D /* MGLSDKUpdateChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLSDKUpdateChecker.h; sourceTree = ""; }; - 9620BB371E69FE1700705A1D /* MGLSDKUpdateChecker.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = MGLSDKUpdateChecker.mm; sourceTree = ""; }; 96381C0122C6F3950053497D /* MGLMapViewPitchTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLMapViewPitchTests.m; sourceTree = ""; }; 9641771E22D546DA00332422 /* MGLCompassButton_Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLCompassButton_Private.h; sourceTree = ""; }; 9654C1251FFC1AB900DB6A19 /* MGLPolyline_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLPolyline_Private.h; sourceTree = ""; }; @@ -1007,7 +972,6 @@ 966FCF511F3C321000F2B6DE /* MGLUserLocationHeadingArrowLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLUserLocationHeadingArrowLayer.m; sourceTree = ""; }; 967C8649210A9D3C004DF794 /* UIDevice+MGLAdditions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIDevice+MGLAdditions.h"; sourceTree = ""; }; 967C864A210A9D3C004DF794 /* UIDevice+MGLAdditions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIDevice+MGLAdditions.m"; sourceTree = ""; }; - 9680273E22653B84006BA4A1 /* MBXSKUToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MBXSKUToken.h; path = "../vendor/mapbox-accounts-ios/MBXSKUToken.h"; sourceTree = ""; }; 9680274122653C3E006BA4A1 /* libmbxaccounts.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmbxaccounts.a; path = "vendor/mapbox-accounts-ios/libmbxaccounts.a"; sourceTree = SOURCE_ROOT; }; 9686D1BC22D9357700194EA0 /* MGLMapViewZoomTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLMapViewZoomTests.mm; sourceTree = ""; }; 968F36B41E4D0FC6003A5522 /* ja */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = ""; }; @@ -1026,8 +990,6 @@ 96ED34DD22374C0900E9FCA9 /* MGLMapViewDirectionTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLMapViewDirectionTests.mm; sourceTree = ""; }; 96F017292118FBAE00892778 /* MGLMapView_Experimental.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLMapView_Experimental.h; sourceTree = ""; }; 96F3F73B1F5711F1003E2D2C /* MGLUserLocationHeadingIndicator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLUserLocationHeadingIndicator.h; sourceTree = ""; }; - 9C6E282922A980E50056B7BE /* MGLMapboxEvents.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MGLMapboxEvents.h; path = src/MGLMapboxEvents.h; sourceTree = SOURCE_ROOT; }; - 9C6E282A22A980E50056B7BE /* MGLMapboxEvents.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = MGLMapboxEvents.m; path = src/MGLMapboxEvents.m; sourceTree = SOURCE_ROOT; }; 9C6E284822A984120056B7BE /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; name = Makefile; path = ../../Makefile; sourceTree = ""; }; 9C6E285A22A9849E0056B7BE /* install-packaging-dependencies.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "install-packaging-dependencies.sh"; sourceTree = ""; }; 9C6E285B22A9849E0056B7BE /* ios-code-coverage.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "ios-code-coverage.sh"; sourceTree = ""; }; @@ -1044,8 +1006,6 @@ A4DE3DC823038A07005B3473 /* MGLMockGestureRecognizers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLMockGestureRecognizers.m; sourceTree = ""; }; A4DE3DCA23038A7F005B3473 /* MGLMockGestureRecognizers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLMockGestureRecognizers.h; sourceTree = ""; }; A4F3FB1C2254865900A30170 /* missing_icon.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = missing_icon.json; sourceTree = ""; }; - AC518DFD201BB55A00EBC820 /* MGLTelemetryConfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLTelemetryConfig.h; sourceTree = ""; }; - AC518DFE201BB55A00EBC820 /* MGLTelemetryConfig.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGLTelemetryConfig.m; sourceTree = ""; }; CA0C27912076C804001CE5B7 /* MGLShapeSourceTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGLShapeSourceTests.m; sourceTree = ""; }; CA0C27932076CA19001CE5B7 /* MGLMapViewIntegrationTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGLMapViewIntegrationTest.m; sourceTree = ""; wrapsLines = 0; }; CA0C27952076CA50001CE5B7 /* MGLMapViewIntegrationTest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLMapViewIntegrationTest.h; sourceTree = ""; }; @@ -1065,10 +1025,8 @@ CA86FF0D22D8D5A0009EB14A /* MGLNetworkConfigurationTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGLNetworkConfigurationTests.m; sourceTree = ""; }; CA88DC2F21C85D900059ED5A /* MGLStyleURLIntegrationTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGLStyleURLIntegrationTest.m; sourceTree = ""; }; CA8FBC0821A47BB100D1203C /* MGLRendererConfigurationTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = MGLRendererConfigurationTests.m; path = ../../darwin/test/MGLRendererConfigurationTests.m; sourceTree = ""; }; - CA96299B23731199004F1330 /* MapboxMobileEvents.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = MapboxMobileEvents.framework; sourceTree = BUILT_PRODUCTS_DIR; }; CAAA65D72321BBA900F08A39 /* MGLTestAssertionHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MGLTestAssertionHandler.h; path = ../../darwin/test/MGLTestAssertionHandler.h; sourceTree = ""; }; CAAA65D82321BBA900F08A39 /* MGLTestAssertionHandler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = MGLTestAssertionHandler.m; path = ../../darwin/test/MGLTestAssertionHandler.m; sourceTree = ""; }; - CAB36C3A2374D11600592F74 /* libMapboxMobileEvents.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libMapboxMobileEvents.a; sourceTree = BUILT_PRODUCTS_DIR; }; CAD9D0A922A86D6F001B25EE /* MGLResourceTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLResourceTests.mm; path = ../../darwin/test/MGLResourceTests.mm; sourceTree = ""; }; CAE5AE2B2389FBF000E4A5A1 /* ios.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ios.xcconfig; sourceTree = ""; }; CAE7AD5320F46EF5003B6782 /* integration-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "integration-Bridging-Header.h"; sourceTree = ""; }; @@ -1283,8 +1241,8 @@ DAC49C621CD07D74009E1AA3 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = ""; }; DAC832642404AF9000A61BF8 /* darwin.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = darwin.xcconfig; path = ../darwin/darwin.xcconfig; sourceTree = ""; }; DAC832672404AFBB00A61BF8 /* ci.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = ci.xcconfig; path = ../darwin/ci.xcconfig; sourceTree = ""; }; - DAC8A47F24527EDB00C795BB /* glyphs.pbf */ = {isa = PBXFileReference; lastKnownFileType = file; name = glyphs.pbf; path = "../../../../../test/fixtures/resources/glyphs.pbf"; sourceTree = ""; }; - DAC8A4812452971B00C795BB /* mixed.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = mixed.json; path = "../../../../../test/fixtures/local_glyphs/mixed.json"; sourceTree = ""; }; + DAC8A47F24527EDB00C795BB /* glyphs.pbf */ = {isa = PBXFileReference; lastKnownFileType = file; name = glyphs.pbf; path = ../../../../../test/fixtures/resources/glyphs.pbf; sourceTree = ""; }; + DAC8A4812452971B00C795BB /* mixed.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = mixed.json; path = ../../../../../test/fixtures/local_glyphs/mixed.json; sourceTree = ""; }; DACA86242019218500E9693A /* MGLRasterDEMSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLRasterDEMSource.h; sourceTree = ""; }; DACA86252019218500E9693A /* MGLRasterDEMSource.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLRasterDEMSource.mm; sourceTree = ""; }; DACBC60B20118ABE00C4D7E2 /* he */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = he; path = he.lproj/Localizable.strings; sourceTree = ""; }; @@ -1344,7 +1302,6 @@ buildActionMask = 2147483647; files = ( CA0FAA07237B3BC600C9F3C9 /* Mapbox.framework in Frameworks */, - CA0FAA08237B3BC600C9F3C9 /* MapboxMobileEvents.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1352,7 +1309,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - CA488BAB23FCE6B900AEE226 /* MapboxMobileEvents.framework in Frameworks */, CA0FAA09237B3BEA00C9F3C9 /* Mapbox.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1361,7 +1317,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - DA0BDD1E2407C07F00DAA576 /* MapboxMobileEvents.framework in Frameworks */, CA94E5FB237D21030037AEA0 /* Mapbox.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1374,7 +1329,6 @@ DA35D9D6240992760013ECB0 /* libz.tbd in Frameworks */, DA35D9D4240992400013ECB0 /* libmbgl-vendor-csscolorparser.a in Frameworks */, CA0FAA05237B3BB700C9F3C9 /* Mapbox.framework in Frameworks */, - CA0FAA06237B3BB700C9F3C9 /* MapboxMobileEvents.framework in Frameworks */, 1F78399E235AA1E600D4D606 /* libmbgl-core.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1390,7 +1344,6 @@ DA35D9D1240920B60013ECB0 /* libmbgl-vendor-parsedate.a in Frameworks */, 358B3DB92359E4A0007BEB26 /* libsqlite3.tbd in Frameworks */, 96802766226556C5006BA4A1 /* libmbxaccounts.a in Frameworks */, - CA94E601237EF4110037AEA0 /* MapboxMobileEvents.framework in Frameworks */, DA27C24E1CBB3811000B0ECD /* GLKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1399,7 +1352,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - CAB36C3B2374D11600592F74 /* libMapboxMobileEvents.a in Frameworks */, DA0BDD212407C13000DAA576 /* libmbgl-core.a in Frameworks */, DA35D9CF240920AC0013ECB0 /* libmbgl-vendor-csscolorparser.a in Frameworks */, DA0BDD1F2407C09C00DAA576 /* libmbgl-vendor-icu.a in Frameworks */, @@ -1644,15 +1596,6 @@ name = "Test Helpers"; sourceTree = ""; }; - 40834BA11FE05CFD00C1BD0D /* Development */ = { - isa = PBXGroup; - children = ( - 9620BB361E69FE1700705A1D /* MGLSDKUpdateChecker.h */, - 9620BB371E69FE1700705A1D /* MGLSDKUpdateChecker.mm */, - ); - name = Development; - sourceTree = ""; - }; 409F43FB1E9E77D10048729D /* Swift Integration */ = { isa = PBXGroup; children = ( @@ -1690,14 +1633,6 @@ name = Fixtures; sourceTree = ""; }; - 9680276322655623006BA4A1 /* Accounts */ = { - isa = PBXGroup; - children = ( - 9680273E22653B84006BA4A1 /* MBXSKUToken.h */, - ); - name = Accounts; - sourceTree = ""; - }; 9C6E285922A9849E0056B7BE /* Scripts */ = { isa = PBXGroup; children = ( @@ -1835,8 +1770,6 @@ children = ( DA27C24D1CBB3811000B0ECD /* GLKit.framework */, DA4A26961CB6E795000B7809 /* Mapbox.framework */, - CA96299B23731199004F1330 /* MapboxMobileEvents.framework */, - CAB36C3A2374D11600592F74 /* libMapboxMobileEvents.a */, 554180411D2E97DE00012372 /* OpenGLES.framework */, 1F78399D235AA1E600D4D606 /* libmbgl-core.a */, DA35D9CC240920910013ECB0 /* libmbgl-vendor-csscolorparser.a */, @@ -1934,11 +1867,8 @@ DA00FC8C1D5EEB0D009AABC8 /* MGLAttributionInfo.h */, DAF0D8171DFE6B2800B28378 /* MGLAttributionInfo_Private.h */, DA00FC8D1D5EEB0D009AABC8 /* MGLAttributionInfo.mm */, - 1FCCEC32222605C400302E3B /* MGLSDKMetricsManager.h */, 1FF48585223710BE00F19727 /* MGLAttributedExpression.h */, 1FF48586223710BE00F19727 /* MGLAttributedExpression.m */, - 1FCCEC38222607A500302E3B /* MGLSDKMetricsManager_Private.h */, - 1FCCEC33222605C400302E3B /* MGLSDKMetricsManager.m */, 556660C91E1BF3A900E2C41B /* MGLFoundation.h */, 558DE79E1E5615E400C7916D /* MGLFoundation_Private.h */, 558DE79F1E5615E400C7916D /* MGLFoundation.mm */, @@ -1978,7 +1908,6 @@ DAD165841CF4D06B001FF4B9 /* Annotations */, 35CE617F1D4165C2004F2359 /* Categories */, DA8848881CBB036000AB86E3 /* SMCalloutView */, - DAD165851CF4D08B001FF4B9 /* Telemetry */, 355ADFF91E9281C300F3939D /* Views */, CA55CD3E202C16AA00CE7095 /* MGLCameraChangeReason.h */, DA704CC01F65A475004B3F28 /* MGLMapAccessibilityElement.h */, @@ -2227,19 +2156,6 @@ name = Annotations; sourceTree = ""; }; - DAD165851CF4D08B001FF4B9 /* Telemetry */ = { - isa = PBXGroup; - children = ( - 9680276322655623006BA4A1 /* Accounts */, - 40834BA11FE05CFD00C1BD0D /* Development */, - AC518DFD201BB55A00EBC820 /* MGLTelemetryConfig.h */, - AC518DFE201BB55A00EBC820 /* MGLTelemetryConfig.m */, - 9C6E282922A980E50056B7BE /* MGLMapboxEvents.h */, - 9C6E282A22A980E50056B7BE /* MGLMapboxEvents.m */, - ); - name = Telemetry; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -2282,7 +2198,6 @@ 3510FFF01D6D9D8C00F413B2 /* NSExpression+MGLAdditions.h in Headers */, 74CB5EBF219B280400102936 /* MGLHeatmapStyleLayer_Private.h in Headers */, 1FC4817D2098CBC0000D09B4 /* NSPredicate+MGLPrivateAdditions.h in Headers */, - 1FCCEC3A222607A500302E3B /* MGLSDKMetricsManager_Private.h in Headers */, 1F2B94C0221636D900210640 /* MGLNetworkConfiguration_Private.h in Headers */, 353AFA141D65AB17005A69F4 /* NSDate+MGLAdditions.h in Headers */, DA8848531CBAFB9800AB86E3 /* MGLCompactCalloutView.h in Headers */, @@ -2321,7 +2236,6 @@ DD0902AB1DB192A800C5BDCE /* MGLNetworkConfiguration.h in Headers */, 35D3A1E61E9BE7EB002B38EE /* MGLScaleBar.h in Headers */, 0778DD431F67556700A73B34 /* MGLComputedShapeSource.h in Headers */, - 1FCCEC34222605C400302E3B /* MGLSDKMetricsManager.h in Headers */, 1F6A82A221360F9D00BA5B41 /* MGLLoggingConfiguration.h in Headers */, DA8848311CBAFA6200AB86E3 /* NSString+MGLAdditions.h in Headers */, 967C864B210A9D3C004DF794 /* UIDevice+MGLAdditions.h in Headers */, @@ -2345,7 +2259,6 @@ DA88483D1CBAFB8500AB86E3 /* MGLMapView+IBAdditions.h in Headers */, DA17BE301CC4BAC300402C41 /* MGLMapView_Private.h in Headers */, DAD165781CF4CDFF001FF4B9 /* MGLShapeCollection.h in Headers */, - 9C6E282D22A9815D0056B7BE /* MGLMapboxEvents.h in Headers */, DAED38631D62D0FC00D7640F /* NSURL+MGLAdditions.h in Headers */, DA88481E1CBAFA6200AB86E3 /* MGLMultiPoint_Private.h in Headers */, 3566C7661D4A77BA008152BC /* MGLShapeSource.h in Headers */, @@ -2355,7 +2268,6 @@ DA35A29E1CC9E94C00E826B2 /* MGLCoordinateFormatter.h in Headers */, DAF0D8181DFE6B2800B28378 /* MGLAttributionInfo_Private.h in Headers */, DAAF722B1DA903C700312FA4 /* MGLStyleValue.h in Headers */, - 9680273F22653B84006BA4A1 /* MBXSKUToken.h in Headers */, DA8847F71CBAFA5100AB86E3 /* MGLOverlay.h in Headers */, DA35A2B11CCA141D00E826B2 /* MGLCompassDirectionFormatter.h in Headers */, DA88488B1CBB037E00AB86E3 /* SMCalloutView.h in Headers */, @@ -2376,7 +2288,6 @@ 1FF48587223710BE00F19727 /* MGLAttributedExpression.h in Headers */, DAD1656C1CF41981001FF4B9 /* MGLFeature.h in Headers */, 40EDA1C01CFE0E0200D9EA68 /* MGLAnnotationContainerView.h in Headers */, - 9620BB381E69FE1700705A1D /* MGLSDKUpdateChecker.h in Headers */, DA88484F1CBAFB9800AB86E3 /* MGLAnnotationImage_Private.h in Headers */, 1753ED421E53CE6F00A9FD90 /* MGLConversion.h in Headers */, DA8847F21CBAFA5100AB86E3 /* MGLMapCamera.h in Headers */, @@ -2384,7 +2295,6 @@ DA8847F51CBAFA5100AB86E3 /* MGLOfflineRegion.h in Headers */, DA737EE11D056A4E005BDA16 /* MGLMapViewDelegate.h in Headers */, 92FC0AEC207CEE16007B6B54 /* MGLShapeOfflineRegion_Private.h in Headers */, - AC518DFF201BB55A00EBC820 /* MGLTelemetryConfig.h in Headers */, DA88481B1CBAFA6200AB86E3 /* MGLGeometry_Private.h in Headers */, 3510FFF91D6DCC4700F413B2 /* NSCompoundPredicate+MGLAdditions.h in Headers */, 3557F7B01E1D27D300CCA5E6 /* MGLDistanceFormatter.h in Headers */, @@ -2450,7 +2360,6 @@ DABFB86D1CBE9A0F00D62B32 /* MGLAnnotationImage.h in Headers */, DABFB8721CBE9A0F00D62B32 /* MGLUserLocation.h in Headers */, 92FC0AED207CEE16007B6B54 /* MGLShapeOfflineRegion_Private.h in Headers */, - 1FCCEC35222605C400302E3B /* MGLSDKMetricsManager.h in Headers */, 927FBD001F4DB05500F8BF1F /* MGLMapSnapshotter.h in Headers */, 3566C7721D4A9198008152BC /* MGLSource_Private.h in Headers */, 353933FF1D3FB7DD003F57D7 /* MGLSymbolStyleLayer.h in Headers */, @@ -2462,7 +2371,6 @@ 96E516E92000560B00A02306 /* MGLAnnotationImage_Private.h in Headers */, 96E516E52000560B00A02306 /* MGLOfflinePack_Private.h in Headers */, DD9BE4F91EB263D20079A3AF /* UIViewController+MGLAdditions.h in Headers */, - 9680274022653B84006BA4A1 /* MBXSKUToken.h in Headers */, DAF2571C201901E200367EF5 /* MGLHillshadeStyleLayer.h in Headers */, 74CB5EC4219B282500102936 /* MGLCircleStyleLayer_Private.h in Headers */, DABFB8621CBE99E500D62B32 /* MGLOfflinePack.h in Headers */, @@ -2477,7 +2385,6 @@ DABFB86C1CBE99E500D62B32 /* MGLTypes.h in Headers */, 96E516F720005A2700A02306 /* MGLAnnotationContainerView.h in Headers */, DABFB8691CBE99E500D62B32 /* MGLShape.h in Headers */, - 9620BB391E69FE1700705A1D /* MGLSDKUpdateChecker.h in Headers */, 3510FFEB1D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.h in Headers */, 35E1A4D91D74336F007AA97F /* MGLValueEvaluator.h in Headers */, DABFB8701CBE9A0F00D62B32 /* MGLMapView+IBAdditions.h in Headers */, @@ -2502,7 +2409,6 @@ DABFB8671CBE99E500D62B32 /* MGLPolygon.h in Headers */, 404C26E81D89C55D000AA13D /* MGLTileSource_Private.h in Headers */, 74CB5EBC219B280400102936 /* MGLFillExtrusionStyleLayer_Private.h in Headers */, - 9C6E282F22A9824B0056B7BE /* MGLTelemetryConfig.h in Headers */, 1F7454931ECBB43F00021D39 /* MGLLight.h in Headers */, DAAF722C1DA903C700312FA4 /* MGLStyleValue.h in Headers */, DABFB8651CBE99E500D62B32 /* MGLOverlay.h in Headers */, @@ -2510,7 +2416,6 @@ 350098DD1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.h in Headers */, 74CB5EBE219B280400102936 /* MGLFillStyleLayer_Private.h in Headers */, DABFB8681CBE99E500D62B32 /* MGLPolyline.h in Headers */, - 9C6E283022A9824F0056B7BE /* MGLMapboxEvents.h in Headers */, 96E516DF200054FB00A02306 /* MGLShape_Private.h in Headers */, DABFB86F1CBE9A0F00D62B32 /* MGLMapView.h in Headers */, DA6408DC1DA4E7D300908C90 /* MGLVectorStyleLayer.h in Headers */, @@ -2551,7 +2456,6 @@ 353933F91D3FB79F003F57D7 /* MGLLineStyleLayer.h in Headers */, 96E516EB2000560B00A02306 /* MGLUserLocation_Private.h in Headers */, 35D13AB81D3D15E300AFB4E0 /* MGLStyleLayer.h in Headers */, - 1FCCEC3B222607A500302E3B /* MGLSDKMetricsManager_Private.h in Headers */, 35136D4D1D4277FC00C20EFD /* MGLSource.h in Headers */, DA35A2BC1CCA9A6900E826B2 /* MGLClockDirectionFormatter.h in Headers */, 96E516E82000560B00A02306 /* MGLAnnotationContainerView_Private.h in Headers */, @@ -3084,7 +2988,6 @@ 35136D391D42271A00C20EFD /* MGLBackgroundStyleLayer.mm in Sources */, 3510FFEC1D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.mm in Sources */, DAED38651D62D0FC00D7640F /* NSURL+MGLAdditions.m in Sources */, - 9620BB3A1E69FE1700705A1D /* MGLSDKUpdateChecker.mm in Sources */, 354B83981D2E873E005D9406 /* MGLUserLocationAnnotationView.m in Sources */, DA88485D1CBAFB9800AB86E3 /* MGLFaux3DUserLocationAnnotationView.m in Sources */, DAD165701CF41981001FF4B9 /* MGLFeature.mm in Sources */, @@ -3125,8 +3028,6 @@ DA8848211CBAFA6200AB86E3 /* MGLOfflinePack.mm in Sources */, 0778DD441F67556C00A73B34 /* MGLComputedShapeSource.mm in Sources */, 3557F7B21E1D27D300CCA5E6 /* MGLDistanceFormatter.m in Sources */, - 9C6E282B22A981570056B7BE /* MGLMapboxEvents.m in Sources */, - 1FCCEC36222605C400302E3B /* MGLSDKMetricsManager.m in Sources */, 96E6145B22CC169000109F14 /* MGLCompassButton.mm in Sources */, DA8848591CBAFB9800AB86E3 /* MGLMapView.mm in Sources */, DA8848501CBAFB9800AB86E3 /* MGLAnnotationImage.m in Sources */, @@ -3170,7 +3071,6 @@ DA72620D1DEEE3480043BB89 /* MGLOpenGLStyleLayer.mm in Sources */, DA88481A1CBAFA6200AB86E3 /* MGLAccountManager.m in Sources */, 3510FFFB1D6DCC4700F413B2 /* NSCompoundPredicate+MGLAdditions.mm in Sources */, - AC518E03201BB56000EBC820 /* MGLTelemetryConfig.m in Sources */, DA8848271CBAFA6200AB86E3 /* MGLPolyline.mm in Sources */, 35CE61841D4165D9004F2359 /* UIColor+MGLAdditions.mm in Sources */, 3EA93369F61CF70AFA50465D /* MGLRendererConfiguration.m in Sources */, @@ -3184,7 +3084,6 @@ 35136D3A1D42271A00C20EFD /* MGLBackgroundStyleLayer.mm in Sources */, 3510FFED1D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.mm in Sources */, 354B83991D2E873E005D9406 /* MGLUserLocationAnnotationView.m in Sources */, - 9620BB3B1E69FE1700705A1D /* MGLSDKUpdateChecker.mm in Sources */, DAA4E4221CBB730400178DFB /* MGLPointAnnotation.mm in Sources */, DAED38661D62D0FC00D7640F /* NSURL+MGLAdditions.m in Sources */, DAD165711CF41981001FF4B9 /* MGLFeature.mm in Sources */, @@ -3224,8 +3123,6 @@ CF75A91622D85E860058A5C4 /* MGLLoggingConfiguration.mm in Sources */, DAA32CC31E4C6B65006F8D24 /* MGLDistanceFormatter.m in Sources */, DAA4E41D1CBB730400178DFB /* MGLGeometry.mm in Sources */, - 1FCCEC37222605C400302E3B /* MGLSDKMetricsManager.m in Sources */, - 9C6E282C22A981580056B7BE /* MGLMapboxEvents.m in Sources */, DAA4E41F1CBB730400178DFB /* MGLMultiPoint.mm in Sources */, 96E6145C22CC169000109F14 /* MGLCompassButton.mm in Sources */, DD0902AA1DB1929D00C5BDCE /* MGLNetworkConfiguration.m in Sources */, @@ -3268,7 +3165,6 @@ DA72620E1DEEE3480043BB89 /* MGLOpenGLStyleLayer.mm in Sources */, DAA4E42F1CBB730400178DFB /* MGLCompactCalloutView.m in Sources */, 3510FFFC1D6DCC4700F413B2 /* NSCompoundPredicate+MGLAdditions.mm in Sources */, - AC518E04201BB56100EBC820 /* MGLTelemetryConfig.m in Sources */, DAA4E4271CBB730400178DFB /* MGLTilePyramidOfflineRegion.mm in Sources */, DAA4E41C1CBB730400178DFB /* MGLAccountManager.m in Sources */, 35CE61851D4165D9004F2359 /* UIColor+MGLAdditions.mm in Sources */, diff --git a/platform/ios/platform/ios/ios.xcworkspace/contents.xcworkspacedata b/platform/ios/platform/ios/ios.xcworkspace/contents.xcworkspacedata index dda42015867..cbb22b49173 100644 --- a/platform/ios/platform/ios/ios.xcworkspace/contents.xcworkspacedata +++ b/platform/ios/platform/ios/ios.xcworkspace/contents.xcworkspacedata @@ -4,10 +4,4 @@ - - - - diff --git a/platform/ios/platform/ios/scripts/deploy-swift-package.sh b/platform/ios/platform/ios/scripts/deploy-swift-package.sh index e7a4b9c96a8..f59b30faaf6 100755 --- a/platform/ios/platform/ios/scripts/deploy-swift-package.sh +++ b/platform/ios/platform/ios/scripts/deploy-swift-package.sh @@ -104,16 +104,11 @@ make xcframework step "Zipping xcframeworks…" MAPBOX_ZIP_FILE="Mapbox-${PUBLISH_VERSION}.zip" (cd ${BINARY_DIRECTORY} && rm -f ${MAPBOX_ZIP_FILE} && zip -yr ${MAPBOX_ZIP_FILE} Mapbox.xcframework) -MAPBOX_EVENTS_ZIP_FILE="MapboxMobileEvents-${PUBLISH_VERSION}.zip" -(cd ${BINARY_DIRECTORY} && rm -f ${MAPBOX_EVENTS_ZIP_FILE} && zip -yr ${MAPBOX_EVENTS_ZIP_FILE} MapboxMobileEvents.xcframework) if [[ ${S3_DISTRIBUTION} == true ]]; then step "Uploading ${BINARY_DIRECTORY}/${MAPBOX_ZIP_FILE} to s3" uploadToS3 "${BINARY_DIRECTORY}/${MAPBOX_ZIP_FILE}" false MAPBOX_ZIP_FILE_URL=$EXT_TARGET_S3_URL - step "Uploading ${BINARY_DIRECTORY}/${MAPBOX_EVENTS_ZIP_FILE} to s3" - uploadToS3 "${BINARY_DIRECTORY}/${MAPBOX_EVENTS_ZIP_FILE}" false - MAPBOX_EVENTS_ZIP_FILE_URL=$EXT_TARGET_S3_URL fi step "Create GitHub release…" @@ -132,9 +127,6 @@ github-release release \ step "Uploading ${BINARY_DIRECTORY}/${MAPBOX_ZIP_FILE} to github release [${VERSION_TAG}]" uploadToGithub "${BINARY_DIRECTORY}/${MAPBOX_ZIP_FILE}" "${VERSION_TAG}" MAPBOX_ZIP_FILE_URL=$EXT_TARGET_GITHUB_URL -step "Uploading ${BINARY_DIRECTORY}/${MAPBOX_EVENTS_ZIP_FILE} to github releases" -uploadToGithub "${BINARY_DIRECTORY}/${MAPBOX_EVENTS_ZIP_FILE}" "${VERSION_TAG}" -MAPBOX_EVENTS_ZIP_FILE_URL=$EXT_TARGET_GITHUB_URL step "Creating Swift package…" @@ -156,7 +148,6 @@ setTarget() { } setTarget "MAPBOX" "${BINARY_DIRECTORY}/${MAPBOX_ZIP_FILE}" "${MAPBOX_ZIP_FILE_URL}" -setTarget "MAPBOX_EVENTS" "${BINARY_DIRECTORY}/${MAPBOX_EVENTS_ZIP_FILE}" "${MAPBOX_EVENTS_ZIP_FILE_URL}" step "Publishing Swift package…" diff --git a/platform/ios/platform/ios/scripts/swift_package_template.swift b/platform/ios/platform/ios/scripts/swift_package_template.swift index 1684e4aedf3..ba262344120 100644 --- a/platform/ios/platform/ios/scripts/swift_package_template.swift +++ b/platform/ios/platform/ios/scripts/swift_package_template.swift @@ -6,10 +6,7 @@ let package = Package( products: [ .library( name: "Mapbox", - targets: ["Mapbox"]), - .library( - name: "MapboxMobileEvents", - targets: ["MapboxMobileEvents"]) + targets: ["Mapbox"]) ], dependencies: [ ], @@ -17,10 +14,6 @@ let package = Package( .binaryTarget( name: "Mapbox", url: "MAPBOX_PACKAGE_URL", - checksum: "MAPBOX_PACKAGE_CHECKSUM"), - .binaryTarget( - name: "MapboxMobileEvents", - url: "MAPBOX_EVENTS_PACKAGE_URL", - checksum: "MAPBOX_EVENTS_PACKAGE_CHECKSUM") + checksum: "MAPBOX_PACKAGE_CHECKSUM") ] ) \ No newline at end of file diff --git a/platform/ios/platform/ios/scripts/xcpackage.sh b/platform/ios/platform/ios/scripts/xcpackage.sh index 931e84a8272..0666c689dc8 100755 --- a/platform/ios/platform/ios/scripts/xcpackage.sh +++ b/platform/ios/platform/ios/scripts/xcpackage.sh @@ -110,10 +110,8 @@ function addFramework { fi } - step "Creating ${NAME} xcframework" -EVENTS_NAME=MapboxMobileEvents INCLUDE_DEBUG_SYMBOLS=false if [[ $BUILDTYPE='RelWithDebInfo' || $BUILDTYPE='Debug' ]]; then INCLUDE_DEBUG_SYMBOLS=true @@ -129,15 +127,6 @@ echo "Creating ${NAME}.xcframework with args: $BUILD_ARGS" xcodebuild -create-xcframework $BUILD_ARGS echo "${NAME}.xcframework created" -# Mapbox mobile events -BUILD_ARGS="" -BUILD_ARGS="$BUILD_ARGS -output ${BINOUT}/${EVENTS_NAME}.xcframework" -addFramework "${BINOUT}/${NAME}-iphoneos.xcarchive" ${EVENTS_NAME} ${INCLUDE_DEBUG_SYMBOLS} -addFramework "${BINOUT}/${NAME}-iphonesimulator.xcarchive" ${EVENTS_NAME} ${INCLUDE_DEBUG_SYMBOLS} -echo "Creating ${EVENTS_NAME}.xcframework with args: $BUILD_ARGS" -xcodebuild -create-xcframework $BUILD_ARGS -echo "${EVENTS_NAME}.xcframework created" - step "Copying library resources…" cp -pv LICENSE.md ${OUTPUT} sed -n -e '/^## /,$p' platform/ios/CHANGELOG.md > "${OUTPUT}/CHANGELOG.md" diff --git a/platform/ios/platform/ios/src/MGLMapView+Impl.mm b/platform/ios/platform/ios/src/MGLMapView+Impl.mm index 7d8a69ab179..5702fe0c188 100644 --- a/platform/ios/platform/ios/src/MGLMapView+Impl.mm +++ b/platform/ios/platform/ios/src/MGLMapView+Impl.mm @@ -3,10 +3,6 @@ #import "MGLStyle_Private.h" #import "NSBundle+MGLAdditions.h" -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR -#import -#endif - std::unique_ptr MGLMapViewImpl::Create(MGLMapView* nativeView) { return std::make_unique(nativeView); } @@ -65,9 +61,7 @@ NSLocalizedFailureReasonErrorKey: @(what.c_str()), }; NSError *error = [NSError errorWithDomain:MGLErrorDomain code:code userInfo:userInfo]; -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - [[MMEEventsManager sharedManager] reportError:error]; -#endif + [mapView mapViewDidFailLoadingMapWithError:error]; } diff --git a/platform/ios/platform/ios/src/MGLMapView+OpenGL.mm b/platform/ios/platform/ios/src/MGLMapView+OpenGL.mm index 934433d4a61..c96bfa9e87c 100644 --- a/platform/ios/platform/ios/src/MGLMapView+OpenGL.mm +++ b/platform/ios/platform/ios/src/MGLMapView+OpenGL.mm @@ -2,10 +2,6 @@ #import "MGLLoggingConfiguration_Private.h" #import "MGLMapView+OpenGL.h" -#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR -#import -#endif - #include #import @@ -114,15 +110,6 @@ void bind() override { dispatch_async(dispatch_get_main_queue(), ^{ emergencyRecreateGL(); }); -#else - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - NSError *error = [NSError errorWithDomain:MGLErrorDomain - code:MGLErrorCodeRenderingError - userInfo:@{ NSLocalizedFailureReasonErrorKey : - @"https://github.com/mapbox/mapbox-gl-native/issues/14232" }]; - [[MMEEventsManager sharedManager] reportError:error]; - }); #endif } } else { diff --git a/platform/ios/platform/ios/src/MGLMapView.h b/platform/ios/platform/ios/src/MGLMapView.h index a131deea7a8..f2eb51dd13d 100644 --- a/platform/ios/platform/ios/src/MGLMapView.h +++ b/platform/ios/platform/ios/src/MGLMapView.h @@ -377,7 +377,7 @@ MGL_EXPORT /** - A view showing legally required copyright notices and telemetry settings, + A view showing legally required copyright notices, positioned at the bottom-right of the map view. If you choose to reimplement this view, assign the `-showAttribution:` method @@ -391,13 +391,6 @@ MGL_EXPORT data. If that applies to this map view, do not hide this view or remove any notices from it. - @note You are additionally - required - to provide users with the option to disable anonymous usage and location - sharing (telemetry). If this view is hidden, you must implement this - setting elsewhere in your app or via `Settings.bundle`. See our - website for - implementation help. */ @property (nonatomic, readonly) UIButton *attributionButton; @@ -412,7 +405,7 @@ MGL_EXPORT @property (nonatomic, assign) CGPoint attributionButtonMargins; /** - Show the attribution and telemetry action sheet. + Show the attribution action sheet. This action is performed when the user taps on the attribution button provided by default via the `attributionButton` property. If you implement a custom diff --git a/platform/ios/platform/ios/src/MGLMapView.mm b/platform/ios/platform/ios/src/MGLMapView.mm index 793264027e3..f16883b22cd 100644 --- a/platform/ios/platform/ios/src/MGLMapView.mm +++ b/platform/ios/platform/ios/src/MGLMapView.mm @@ -58,8 +58,6 @@ #import "MGLScaleBar.h" #import "MGLStyle_Private.h" #import "MGLStyleLayer_Private.h" -#import "MGLMapboxEvents.h" -#import "MGLSDKUpdateChecker.h" #import "MGLCompactCalloutView.h" #import "MGLAnnotationContainerView.h" #import "MGLAnnotationContainerView_Private.h" @@ -69,7 +67,6 @@ #import "MGLLoggingConfiguration_Private.h" #import "MGLNetworkConfiguration_Private.h" #import "MGLReachability.h" -#import #include #include @@ -379,14 +376,6 @@ - (instancetype)initWithCoder:(nonnull NSCoder *)decoder return self; } -+ (void)initialize -{ - if (self == [MGLMapView class]) - { - [MGLSDKUpdateChecker checkForUpdates]; - } -} - + (NSSet *)keyPathsForValuesAffectingStyle { return [NSSet setWithObject:@"styleURL"]; @@ -676,12 +665,6 @@ - (void)commonInit _pendingLatitude = NAN; _pendingLongitude = NAN; _targetCoordinate = kCLLocationCoordinate2DInvalid; - - if ([UIApplication sharedApplication].applicationState != UIApplicationStateBackground) { - [MGLMapboxEvents pushTurnstileEvent]; - [MGLMapboxEvents pushEvent:MMEEventTypeMapLoad withAttributes:@{}]; - } - } - (mbgl::Size)size @@ -1566,8 +1549,6 @@ - (void)pauseRendering:(__unused NSNotification *)notification [self validateLocationServices]; - [MGLMapboxEvents flush]; - _displayLink.paused = YES; [self processPendingBlocks]; @@ -1612,9 +1593,6 @@ - (void)resumeRendering:(__unused NSNotification *)notification _displayLink.paused = NO; [self validateLocationServices]; - - [MGLMapboxEvents pushTurnstileEvent]; - [MGLMapboxEvents pushEvent:MMEEventTypeMapLoad withAttributes:@{}]; } } @@ -2511,14 +2489,6 @@ - (void)showAttribution:(id)sender [attributionController addAction:action]; } - NSString *telemetryTitle = NSLocalizedStringWithDefaultValue(@"TELEMETRY_NAME", nil, nil, @"Mapbox Telemetry", @"Action in attribution sheet"); - UIAlertAction *telemetryAction = [UIAlertAction actionWithTitle:telemetryTitle - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * _Nonnull action) { - [self presentTelemetryAlertController]; - }]; - [attributionController addAction:telemetryAction]; - NSString *cancelTitle = NSLocalizedStringWithDefaultValue(@"CANCEL", nil, nil, @"Cancel", @"Title of button for dismissing attribution action sheet"); UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:cancelTitle style:UIAlertActionStyleCancel @@ -2533,69 +2503,11 @@ - (void)showAttribution:(id)sender self.attributionController = attributionController; } -- (void)presentTelemetryAlertController -{ - NSString *title = NSLocalizedStringWithDefaultValue(@"TELEMETRY_TITLE", nil, nil, @"Make Mapbox Maps Better", @"Telemetry prompt title"); - NSString *message; - NSString *participateTitle; - NSString *declineTitle; - if ([[NSUserDefaults standardUserDefaults] boolForKey:MGLMapboxMetricsEnabledKey]) - { - message = NSLocalizedStringWithDefaultValue(@"TELEMETRY_ENABLED_MSG", nil, nil, @"You are helping to make OpenStreetMap and Mapbox maps better by contributing anonymous usage data.", @"Telemetry prompt message"); - participateTitle = NSLocalizedStringWithDefaultValue(@"TELEMETRY_ENABLED_ON", nil, nil, @"Keep Participating", @"Telemetry prompt button"); - declineTitle = NSLocalizedStringWithDefaultValue(@"TELEMETRY_ENABLED_OFF", nil, nil, @"Stop Participating", @"Telemetry prompt button"); - } - else - { - message = NSLocalizedStringWithDefaultValue(@"TELEMETRY_DISABLED_MSG", nil, nil, @"You can help make OpenStreetMap and Mapbox maps better by contributing anonymous usage data.", @"Telemetry prompt message"); - participateTitle = NSLocalizedStringWithDefaultValue(@"TELEMETRY_DISABLED_ON", nil, nil, @"Participate", @"Telemetry prompt button"); - declineTitle = NSLocalizedStringWithDefaultValue(@"TELEMETRY_DISABLED_OFF", nil, nil, @"Don’t Participate", @"Telemetry prompt button"); - } - - UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title - message:message - preferredStyle:UIAlertControllerStyleAlert]; - - NSString *moreTitle = NSLocalizedStringWithDefaultValue(@"TELEMETRY_MORE", nil, nil, @"Tell Me More", @"Telemetry prompt button"); - UIAlertAction *moreAction = [UIAlertAction actionWithTitle:moreTitle - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * _Nonnull action) { - [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.mapbox.com/telemetry/"]]; - }]; - [alertController addAction:moreAction]; - - UIAlertAction *declineAction = [UIAlertAction actionWithTitle:declineTitle - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * _Nonnull action) { - [[NSUserDefaults standardUserDefaults] setBool:NO forKey:MGLMapboxMetricsEnabledKey]; - }]; - [alertController addAction:declineAction]; - - UIAlertAction *participateAction = [UIAlertAction actionWithTitle:participateTitle - style:UIAlertActionStyleCancel - handler:^(UIAlertAction * _Nonnull action) { - [[NSUserDefaults standardUserDefaults] setBool:YES forKey:MGLMapboxMetricsEnabledKey]; - }]; - [alertController addAction:participateAction]; - - UIViewController *viewController = [self.window.rootViewController mgl_topMostViewController]; - [viewController presentViewController:alertController animated:YES completion:NULL]; -} - #pragma mark - Properties - - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { - if ([keyPath isEqualToString:@"hidden"] && object == _attributionButton) - { - NSNumber *hiddenNumber = change[NSKeyValueChangeNewKey]; - BOOL attributionButtonWasHidden = [hiddenNumber boolValue]; - if (attributionButtonWasHidden) - { - [MGLMapboxEvents ensureMetricsOptoutExists]; - } - } - else if ([keyPath isEqualToString:@"coordinate"] && [object conformsToProtocol:@protocol(MGLAnnotation)] && ![object isKindOfClass:[MGLMultiPoint class]]) + if ([keyPath isEqualToString:@"coordinate"] && [object conformsToProtocol:@protocol(MGLAnnotation)] && ![object isKindOfClass:[MGLMultiPoint class]]) { id annotation = object; MGLAnnotationTag annotationTag = (MGLAnnotationTag)(NSUInteger)context; diff --git a/platform/ios/platform/ios/src/MGLMapboxEvents.h b/platform/ios/platform/ios/src/MGLMapboxEvents.h deleted file mode 100644 index 7594b21e5e3..00000000000 --- a/platform/ios/platform/ios/src/MGLMapboxEvents.h +++ /dev/null @@ -1,21 +0,0 @@ -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/// NSUserDefaults key that controls telemetry user opt-out status -FOUNDATION_EXTERN NSString * const MGLMapboxMetricsEnabledKey; - -@interface MGLMapboxEvents : NSObject - -+ (nullable instancetype)sharedInstance; - -+ (void)setupWithAccessToken:(NSString *)accessToken; -+ (void)pushTurnstileEvent; -+ (void)pushEvent:(NSString *)event withAttributes:(MMEMapboxEventAttributes *)attributeDictionary; -+ (void)flush; -+ (void)ensureMetricsOptoutExists; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/ios/platform/ios/src/MGLMapboxEvents.m b/platform/ios/platform/ios/src/MGLMapboxEvents.m deleted file mode 100644 index c174c6673a6..00000000000 --- a/platform/ios/platform/ios/src/MGLMapboxEvents.m +++ /dev/null @@ -1,216 +0,0 @@ -@import Foundation; - -#import "MGLMapboxEvents.h" -#import "MBXSKUToken.h" -#import "NSBundle+MGLAdditions.h" -#import "MGLAccountManager_Private.h" - -// NSUserDefaults and Info.plist keys -NSString * const MGLMapboxMetricsEnabledKey = @"MGLMapboxMetricsEnabled"; -static NSString * const MGLMapboxMetricsDebugLoggingEnabledKey = @"MGLMapboxMetricsDebugLoggingEnabled"; -static NSString * const MGLMapboxMetricsEnabledSettingShownInAppKey = @"MGLMapboxMetricsEnabledSettingShownInApp"; -static NSString * const MGLTelemetryAccessTokenKey = @"MGLTelemetryAccessToken"; -static NSString * const MGLTelemetryBaseURLKey = @"MGLTelemetryBaseURL"; - -static NSString * const MGLAPIClientUserAgentBase = @"mapbox-maps-ios"; - -static void * MGLMapboxMetricsEnabledKeyContext = &MGLMapboxMetricsEnabledKeyContext; -static void * MGLMapboxMetricsDebugLoggingEnabledKeyContext = &MGLMapboxMetricsDebugLoggingEnabledKeyContext; -static void * MGLTelemetryAccessTokenKeyContext = &MGLTelemetryAccessTokenKeyContext; - -@interface MGLMapboxEvents () - -@property (nonatomic) MMEEventsManager *eventsManager; -@property (nonatomic) NSURL *baseURL; -@property (nonatomic, copy) NSString *accessToken; - -@end - -// TODO: Move to private/public header -@interface MMEEventsManager (TODO) -@property (nonatomic, getter=isDebugLoggingEnabled) BOOL debugLoggingEnabled; -@end - -@implementation MGLMapboxEvents - -+ (void)initialize { - if (self == [MGLMapboxEvents class]) { - NSBundle *bundle = [NSBundle mainBundle]; - NSNumber *accountTypeNumber = [bundle objectForInfoDictionaryKey:MGLMapboxAccountTypeKey]; - [[NSUserDefaults standardUserDefaults] registerDefaults:@{MGLMapboxAccountTypeKey: accountTypeNumber ?: @0, - MGLMapboxMetricsEnabledKey: @YES, - MGLMapboxMetricsDebugLoggingEnabledKey: @NO}]; - } -} - -+ (nullable instancetype)sharedInstance { - - static dispatch_once_t onceToken; - static MGLMapboxEvents *_sharedInstance; - dispatch_once(&onceToken, ^{ - _sharedInstance = [[self alloc] init]; - }); - return _sharedInstance; -} - -- (instancetype)init { - self = [super init]; - if (self) { - _eventsManager = MMEEventsManager.sharedManager; - _eventsManager.debugLoggingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:MGLMapboxMetricsDebugLoggingEnabledKey]; - - BOOL collectionEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:MGLMapboxMetricsEnabledKey]; - NSUserDefaults.mme_configuration.mme_isCollectionEnabled = collectionEnabled; - - // It is possible for the shared instance of this class to be created because of a call to - // +[MGLAccountManager load] early on in the app lifecycle of the host application. - // If user default values for access token and base URL are available, they are stored here - // on local properties so that they can be applied later once MMEEventsManager is fully initialized - // (once -[MMEEventsManager initializeWithAccessToken:userAgentBase:hostSDKVersion:] is called. - // Normally, the telem access token and base URL are not set this way. However, overriding these values - // with user defaults can be useful for testing with an alternative (test) backend system. - if ([[[[NSUserDefaults standardUserDefaults] dictionaryRepresentation] allKeys] containsObject:MGLTelemetryAccessTokenKey]) { - self.accessToken = [[NSUserDefaults standardUserDefaults] objectForKey:MGLTelemetryAccessTokenKey]; - } - if ([[[[NSUserDefaults standardUserDefaults] dictionaryRepresentation] allKeys] containsObject:MGLTelemetryBaseURLKey]) { - self.baseURL = [NSURL URLWithString:[[NSUserDefaults standardUserDefaults] objectForKey:MGLTelemetryBaseURLKey]]; - } - - // Guard against over calling pause / resume if the values this implementation actually - // cares about have not changed. We guard because the pause and resume method checks CoreLocation's - // authorization status and that can drag on the main thread if done too many times (e.g. if the host - // app heavily uses the user defaults API and this method is called very frequently) - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - [defaults addObserver:self - forKeyPath:MGLMapboxMetricsEnabledKey - options:NSKeyValueObservingOptionNew - context:MGLMapboxMetricsEnabledKeyContext]; - [defaults addObserver:self - forKeyPath:MGLMapboxMetricsDebugLoggingEnabledKey - options:NSKeyValueObservingOptionNew - context:MGLMapboxMetricsDebugLoggingEnabledKeyContext]; - [defaults addObserver:self - forKeyPath:MGLTelemetryAccessTokenKey - options:NSKeyValueObservingOptionNew - context:MGLTelemetryAccessTokenKeyContext]; - } - return self; -} - -- (void)dealloc { - @try { - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - [defaults removeObserver:self forKeyPath:MGLMapboxMetricsEnabledKey]; - [defaults removeObserver:self forKeyPath:MGLMapboxMetricsDebugLoggingEnabledKey]; - [defaults removeObserver:self forKeyPath:MGLTelemetryAccessTokenKey]; - } - @catch (NSException *exception) { - [self.eventsManager reportException:exception]; - } //If the observer is removed by a superclass this may fail since we are removing it twice. -} - -- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { - //KVO callback can happen on any thread. Even two threads concurrently for the same key. - if (context == MGLMapboxMetricsEnabledKeyContext) { - dispatch_async(dispatch_get_main_queue(), ^{ - [self updateDisablingConfigurationValues]; - }); - } else if (context == MGLMapboxMetricsDebugLoggingEnabledKeyContext) { - dispatch_async(dispatch_get_main_queue(), ^{ - self.eventsManager.debugLoggingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:MGLMapboxMetricsDebugLoggingEnabledKey]; - }); - } else if (context == MGLTelemetryAccessTokenKeyContext) { - dispatch_async(dispatch_get_main_queue(), ^{ - [self updateNonDisablingConfigurationValues]; - }); - } else { - [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; - } -} - -- (void)updateNonDisablingConfigurationValues { - if ([[[[NSUserDefaults standardUserDefaults] dictionaryRepresentation] allKeys] containsObject:MGLTelemetryAccessTokenKey]) { - NSString *telemetryAccessToken = [[NSUserDefaults standardUserDefaults] objectForKey:MGLTelemetryAccessTokenKey]; - NSUserDefaults.mme_configuration.mme_accessToken = telemetryAccessToken; - } -} - -- (void)updateDisablingConfigurationValues { - BOOL collectionEnabled = [NSUserDefaults.standardUserDefaults boolForKey:MGLMapboxMetricsEnabledKey]; - NSUserDefaults.mme_configuration.mme_isCollectionEnabled = collectionEnabled; - - [self.eventsManager pauseOrResumeMetricsCollectionIfRequired]; -} - -+ (void)setupWithAccessToken:(NSString *)accessToken { - - MGLMapboxEvents *events = [MGLMapboxEvents sharedInstance]; - - // From https://github.com/mapbox/mapbox-events-ios - NSString *semanticVersion = [NSBundle mgl_frameworkInfoDictionary][@"MGLSemanticVersionString"]; - NSString *shortVersion = [NSBundle mgl_frameworkInfoDictionary][@"CFBundleShortVersionString"]; - NSString *sdkVersion = semanticVersion ?: shortVersion; - - MMEEventsManager *eventsManager = MMEEventsManager.sharedManager; - - // It is possible that an alternative access token was already set on this instance when the class was loaded - // Use it if it exists - NSString *resolvedAccessToken = [MGLMapboxEvents sharedInstance].accessToken ?: accessToken; - - [eventsManager initializeWithAccessToken:resolvedAccessToken - userAgentBase:MGLAPIClientUserAgentBase - hostSDKVersion:sdkVersion]; - - eventsManager.skuId = MBXAccountsSKUIDMapsUser; - eventsManager.debugLoggingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey :MGLMapboxMetricsDebugLoggingEnabledKey]; - - - events.eventsManager = eventsManager; -} - -+ (void)pushTurnstileEvent { - [[[self sharedInstance] eventsManager] sendTurnstileEvent]; -} - -+ (void)pushEvent:(NSString *)event withAttributes:(MMEMapboxEventAttributes *)attributeDictionary { - [[[self sharedInstance] eventsManager] enqueueEventWithName:event attributes:attributeDictionary]; -} - -+ (void)flush { - [[[self sharedInstance] eventsManager] flush]; -} - -+ (void)ensureMetricsOptoutExists { - NSNumber *shownInAppNumber = [[NSBundle mainBundle] objectForInfoDictionaryKey:MGLMapboxMetricsEnabledSettingShownInAppKey]; - BOOL metricsEnabledSettingShownInAppFlag = [shownInAppNumber boolValue]; - - if (!metricsEnabledSettingShownInAppFlag && - [[NSUserDefaults mme_configuration] integerForKey:MGLMapboxAccountTypeKey] == 0) { - // Opt-out is not configured in UI, so check for Settings.bundle - BOOL defaultEnabledValue = NO; - NSString *appSettingsBundle = [[NSBundle mainBundle] pathForResource:@"Settings" ofType:@"bundle"]; - - if (appSettingsBundle) { - // Dynamic Settings.bundle loading based on http://stackoverflow.com/a/510329/2094275 - NSDictionary *settings = [NSDictionary dictionaryWithContentsOfFile:[appSettingsBundle stringByAppendingPathComponent:@"Root.plist"]]; - NSArray *preferences = settings[@"PreferenceSpecifiers"]; - for (NSDictionary *prefSpecification in preferences) { - if ([prefSpecification[@"Key"] isEqualToString:MGLMapboxMetricsEnabledKey]) { - NSNumber *defaultValue = prefSpecification[@"DefaultValue"]; - defaultEnabledValue = [defaultValue boolValue]; - } - } - } - - if (!defaultEnabledValue) { - [NSException raise:@"Telemetry opt-out missing" format: - @"End users must be able to opt out of Mapbox Telemetry in your app, either inside Settings (via Settings.bundle) or inside this app. " - @"By default, this opt-out control is included as a menu item in the attribution action sheet. " - @"If you reimplement the opt-out control inside this app, disable this assertion by setting MGLMapboxMetricsEnabledSettingShownInApp to YES in Info.plist." - @"\n\nSee https://docs.mapbox.com/help/how-mapbox-works/attribution/#mapbox-maps-sdk-for-ios for more information." - @"\n\nAdditionally, by hiding this attribution control you agree to display the required attribution elsewhere in this app."]; - } - } -} - -@end diff --git a/platform/ios/platform/ios/src/MGLSDKUpdateChecker.h b/platform/ios/platform/ios/src/MGLSDKUpdateChecker.h deleted file mode 100644 index 13cef46ad49..00000000000 --- a/platform/ios/platform/ios/src/MGLSDKUpdateChecker.h +++ /dev/null @@ -1,13 +0,0 @@ -#import - -#import "MGLFoundation.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface MGLSDKUpdateChecker : NSObject - -+ (void)checkForUpdates; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/ios/platform/ios/src/MGLSDKUpdateChecker.mm b/platform/ios/platform/ios/src/MGLSDKUpdateChecker.mm deleted file mode 100644 index 3e9bd43020b..00000000000 --- a/platform/ios/platform/ios/src/MGLSDKUpdateChecker.mm +++ /dev/null @@ -1,37 +0,0 @@ -#import "MGLSDKUpdateChecker.h" -#import "NSBundle+MGLAdditions.h" - -@implementation MGLSDKUpdateChecker - -+ (void)checkForUpdates { -#if TARGET_IPHONE_SIMULATOR - // Abort if running in a playground. - if ([[NSBundle mainBundle].bundleIdentifier hasPrefix:@"com.apple.dt.playground."]) { - return; - } - - NSString *currentVersion = [NSBundle mgl_frameworkInfoDictionary][@"MGLSemanticVersionString"]; - - // Skip version check if weʼre doing gl-native development, as the framework - // version is `1` until built for packaging. - if ([currentVersion isEqualToString:@"1.0.0"]) { - return; - } - - NSURL *url = [NSURL URLWithString:@"https://docs.mapbox.com/ios/maps/latest_version.txt"]; - [[NSURLSession.sharedSession dataTaskWithURL:url completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { - if (error || ((NSHTTPURLResponse *)response).statusCode != 200) { - return; - } - - NSString *latestVersion = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; - latestVersion = [latestVersion stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; - if (![currentVersion isEqualToString:latestVersion]) { - NSString *updateAvailable = [NSString stringWithFormat:NSLocalizedStringWithDefaultValue(@"SDK_UPDATE_AVAILABLE", nil, nil, @"Mapbox Maps SDK for iOS version %@ is now available:", @"Developer-only SDK update notification; {latest version, in format x.x.x}"), latestVersion]; - NSLog(@"%@ https://github.com/mapbox/mapbox-gl-native-ios/releases/tag/ios-v%@", updateAvailable, latestVersion); - } - }] resume]; -#endif -} - -@end diff --git a/platform/ios/platform/ios/src/MGLTelemetryConfig.h b/platform/ios/platform/ios/src/MGLTelemetryConfig.h deleted file mode 100644 index 96e525c9694..00000000000 --- a/platform/ios/platform/ios/src/MGLTelemetryConfig.h +++ /dev/null @@ -1,18 +0,0 @@ -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface MGLTelemetryConfig : NSObject - -@property (nonatomic) CLLocationDistance MGLLocationManagerHibernationRadius; - -extern NSString *const MGLMapboxMetricsProfile; - -@property (class, nullable, nonatomic, readonly) MGLTelemetryConfig *sharedConfig; - -- (void)configurationFromKey:(NSString *)key; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/ios/platform/ios/src/MGLTelemetryConfig.m b/platform/ios/platform/ios/src/MGLTelemetryConfig.m deleted file mode 100644 index 828bafb14f7..00000000000 --- a/platform/ios/platform/ios/src/MGLTelemetryConfig.m +++ /dev/null @@ -1,35 +0,0 @@ -#import "MGLTelemetryConfig.h" - -static const CLLocationDistance MGLConfigHibernationRadiusDefault = 300.0; -static const CLLocationDistance MGLConfigHibernationRadiusWide = 600.0; - -NSString *const MGLMapboxMetricsProfile = @"MGLMapboxMetricsProfile"; - -static NSString *const MGLConfigHibernationRadiusWideKey = @"WideGeoFence"; - -@implementation MGLTelemetryConfig - -- (instancetype) init { - self = [super init]; - if (self) { - _MGLLocationManagerHibernationRadius = MGLConfigHibernationRadiusDefault; - } - return self; -} - -+ (nullable instancetype)sharedConfig { - static dispatch_once_t onceToken; - static MGLTelemetryConfig *_sharedConfig; - dispatch_once(&onceToken, ^{ - _sharedConfig = [[self alloc] init]; - }); - return _sharedConfig; -} - -- (void)configurationFromKey:(NSString *)key { - if ([key isEqualToString:MGLConfigHibernationRadiusWideKey]) { - _MGLLocationManagerHibernationRadius = MGLConfigHibernationRadiusWide; - } -} - -@end diff --git a/platform/ios/platform/ios/src/Mapbox.h b/platform/ios/platform/ios/src/Mapbox.h index 98e673577c9..b5fd86e851a 100644 --- a/platform/ios/platform/ios/src/Mapbox.h +++ b/platform/ios/platform/ios/src/Mapbox.h @@ -74,4 +74,3 @@ FOUNDATION_EXPORT MGL_EXPORT const unsigned char MapboxVersionString[]; #import "MGLLoggingConfiguration.h" #import "MGLNetworkConfiguration.h" #import "MGLAttributedExpression.h" -#import "MGLSDKMetricsManager.h" diff --git a/platform/ios/platform/ios/test/MGLAccountManagerTests.m b/platform/ios/platform/ios/test/MGLAccountManagerTests.m deleted file mode 100644 index fd59de2fd58..00000000000 --- a/platform/ios/platform/ios/test/MGLAccountManagerTests.m +++ /dev/null @@ -1,25 +0,0 @@ -#import -#import - -@interface MBXAccounts: NSObject -@property (class, nonatomic, readonly) NSString *skuToken; -@end - -@implementation MBXAccounts - -+ (NSString *)skuToken { - return @"foo"; -} - -@end - -@interface MGLAccountManagerTests : XCTestCase -@end - -@implementation MGLAccountManagerTests - -- (void)testSKU { - XCTAssertTrue([[MGLAccountManager valueForKeyPath:@"skuToken"] isEqualToString:@"foo"]); -} - -@end diff --git a/platform/ios/platform/ios/vendor/mapbox-accounts-ios/MBXSKUToken.h b/platform/ios/platform/ios/vendor/mapbox-accounts-ios/MBXSKUToken.h deleted file mode 100644 index c93b323b065..00000000000 --- a/platform/ios/platform/ios/vendor/mapbox-accounts-ios/MBXSKUToken.h +++ /dev/null @@ -1,36 +0,0 @@ -#import - -NS_ASSUME_NONNULL_BEGIN - -typedef NSString *MBXAccountsSKUID NS_TYPED_ENUM; -FOUNDATION_EXTERN const MBXAccountsSKUID MBXAccountsSKUIDMapsUser; -FOUNDATION_EXTERN const MBXAccountsSKUID MBXAccountsSKUIDNavigationUser; -FOUNDATION_EXTERN const MBXAccountsSKUID MBXAccountsSKUIDNavigationSession; - - -@interface MBXSKUToken : NSObject - -/** - Activates a specific SKU identifier. - - Defaults to `MBXAccountsSKUIDMapsUser`. - - See https://www.mapbox.com/pricing/ for more information - */ -+ (void)activateSKUID:(MBXAccountsSKUID)skuId; - -/** - Resets the current session. Calling this method has no effect unless the type - of the SKU id is of kind session. - */ -+ (void)resetSession; - -/** - Returns the current SKU token. `+[MBXSKUToken activateSKUID:]` must be called - before accessing this property unless an `MBXAccountsSKUIDMapsUser` token is preferred. - */ -@property (class, nonatomic, readonly) NSString *skuToken; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/ios/platform/macos/src/Mapbox.h b/platform/ios/platform/macos/src/Mapbox.h index 6728992d6bc..a11867657d3 100644 --- a/platform/ios/platform/macos/src/Mapbox.h +++ b/platform/ios/platform/macos/src/Mapbox.h @@ -68,4 +68,3 @@ FOUNDATION_EXPORT MGL_EXPORT const unsigned char MapboxVersionString[]; #import "MGLLoggingConfiguration.h" #import "MGLNetworkConfiguration.h" #import "MGLAttributedExpression.h" -#import "MGLSDKMetricsManager.h" From e14070b4b0ac2a76c165a76bf921604e8ff720ee Mon Sep 17 00:00:00 2001 From: Petr Pokorny Date: Sun, 24 Jan 2021 17:18:19 +0100 Subject: [PATCH 03/11] Removing telemetry and mapbox mobile events --- platform/android/LICENSE.md | 6 - .../android/MapboxGLAndroidSDK/build.gradle | 5 +- .../MapboxGLAndroidSDK/proguard-rules.pro | 5 +- .../com/mapbox/mapboxsdk/AccountsManager.java | 71 +---- .../java/com/mapbox/mapboxsdk/Mapbox.java | 51 ---- .../com/mapbox/mapboxsdk/ModuleProvider.java | 10 - .../mapbox/mapboxsdk/ModuleProviderImpl.java | 8 - .../mapboxsdk/attribution/Attribution.java | 2 - .../attribution/AttributionParser.java | 49 +--- .../mapboxsdk/constants/MapboxConstants.java | 6 - .../constants/TelemetryConstants.java | 14 - .../mapbox/mapboxsdk/http/HttpRequestUrl.java | 2 - .../mapboxsdk/location/LocationComponent.java | 16 +- .../LocationComponentActivationOptions.java | 4 +- .../engine/AndroidLocationEngineImpl.java | 174 +++++++++++++ .../engine/GoogleLocationEngineImpl.java | 145 +++++++++++ .../location/engine/LocationEngine.java | 81 ++++++ .../engine/LocationEngineCallback.java | 25 ++ .../location/engine/LocationEngineImpl.java | 28 ++ .../engine/LocationEngineProvider.java | 60 +++++ .../location/engine/LocationEngineProxy.java | 79 ++++++ .../engine/LocationEngineRequest.java | 242 ++++++++++++++++++ .../location/engine/LocationEngineResult.java | 119 +++++++++ .../engine/MapboxFusedLocationEngineImpl.java | 136 ++++++++++ .../mapboxsdk/location/engine/Utils.java | 105 ++++++++ .../permissions/PermissionsListener.java | 14 + .../permissions/PermissionsManager.java | 152 +++++++++++ .../maps/AttributionDialogManager.java | 44 +--- .../com/mapbox/mapboxsdk/maps/MapView.java | 7 +- .../mapboxsdk/maps/TelemetryDefinition.java | 66 ----- .../module/telemetry/MapBaseEvent.java | 39 --- .../module/telemetry/MapEventFactory.java | 57 ----- .../module/telemetry/MapLoadEvent.java | 179 ------------- .../telemetry/OfflineDownloadEndEvent.java | 140 ---------- .../telemetry/OfflineDownloadStartEvent.java | 98 ------- .../module/telemetry/PerformanceEvent.java | 179 ------------- .../module/telemetry/PhoneState.java | 171 ------------- .../module/telemetry/TelemetryImpl.java | 136 ---------- .../module/telemetry/package-info.java | 4 - .../mapboxsdk/offline/OfflineManager.java | 7 - .../offline/OfflineRegionDefinition.java | 2 +- .../mapboxsdk/snapshotter/MapSnapshotter.java | 6 +- .../src/main/res-public/values/public.xml | 6 - .../src/main/res/values-bg/strings.xml | 5 - .../src/main/res/values-ca/strings.xml | 5 - .../src/main/res/values-cs/strings.xml | 7 - .../src/main/res/values-es/strings.xml | 7 - .../src/main/res/values-fr/strings.xml | 7 - .../src/main/res/values-gl/strings.xml | 7 - .../src/main/res/values-he/strings.xml | 6 - .../src/main/res/values-hu/strings.xml | 7 - .../src/main/res/values-iw/strings.xml | 6 - .../src/main/res/values-ko/strings.xml | 6 - .../src/main/res/values-lt/strings.xml | 5 - .../src/main/res/values-nl/strings.xml | 5 - .../src/main/res/values-pl/strings.xml | 7 - .../src/main/res/values-pt-rPT/strings.xml | 6 - .../src/main/res/values-ru/strings.xml | 6 - .../src/main/res/values-sv/strings.xml | 6 - .../src/main/res/values-uk/strings.xml | 6 - .../src/main/res/values-vi/strings.xml | 7 - .../src/main/res/values-zh-rCN/strings.xml | 7 - .../src/main/res/values-zh-rHK/strings.xml | 7 - .../src/main/res/values-zh-rTW/strings.xml | 7 - .../src/main/res/values/strings.xml | 8 - .../mapbox/mapboxsdk/AccountsManagerTest.java | 28 -- .../com/mapbox/mapboxsdk/MapboxInjector.java | 3 +- .../location/LocationComponentTest.kt | 4 +- .../engine/AndroidLocationEngineImplTest.java | 187 ++++++++++++++ ...oogleLocationEngineImplAdditionalTest.java | 128 +++++++++ .../engine/GoogleLocationEngineImplTest.java | 66 +++++ .../engine/LocationEngineProviderTest.java | 14 + .../engine/LocationEngineProxyTest.java | 104 ++++++++ .../engine/LocationEngineRequestTest.java | 72 ++++++ .../engine/LocationEngineResultTest.java | 132 ++++++++++ .../location/engine/LocationEngineTest.java | 142 ++++++++++ ...usedLocationEngineImplAdditionalTest2.java | 152 +++++++++++ .../MapboxFusedLocationEngineImplTest.java | 176 +++++++++++++ .../module/telemetry/MapEventFactoryTest.java | 3 - .../module/telemetry/SchemaTest.java | 2 - .../telemetry/HttpTransportTest.java | 20 -- .../MapboxGLAndroidSDKTestApp/build.gradle | 3 + .../lint-baseline-local.xml | 11 - .../lint/lint-baseline-ci.xml | 11 - .../com/mapbox/mapboxsdk/maps/MapboxTest.java | 6 - .../testapp/maps/widgets/AttributionTest.java | 20 +- .../src/main/AndroidManifest.xml | 12 - .../mapboxsdk/testapp/MapboxApplication.java | 6 - .../BasicLocationPulsingCircleActivity.java | 6 +- ...stomizedLocationPulsingCircleActivity.java | 6 +- .../LocationComponentActivationActivity.java | 4 +- .../location/LocationFragmentActivity.kt | 8 +- .../location/LocationMapChangeActivity.java | 4 +- .../location/LocationModesActivity.java | 7 +- .../ManualLocationUpdatesActivity.java | 10 +- .../PerformanceMeasurementActivity.java | 4 - .../utils/TileLoadingMeasurementUtils.java | 2 - .../src/main/res/values/categories.xml | 1 - .../android/gradle/android-nitpick.gradle | 4 - platform/android/gradle/dependencies.gradle | 10 +- .../ios.xcworkspace/contents.xcworkspacedata | 3 + .../macos/macos.xcodeproj/project.pbxproj | 18 +- 102 files changed, 2598 insertions(+), 1681 deletions(-) delete mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/TelemetryConstants.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/AndroidLocationEngineImpl.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/GoogleLocationEngineImpl.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngine.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineCallback.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineImpl.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineProvider.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineProxy.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineRequest.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineResult.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/MapboxFusedLocationEngineImpl.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/Utils.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/permissions/PermissionsListener.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/permissions/PermissionsManager.java delete mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TelemetryDefinition.java delete mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapBaseEvent.java delete mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapEventFactory.java delete mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapLoadEvent.java delete mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/OfflineDownloadEndEvent.java delete mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/OfflineDownloadStartEvent.java delete mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/PerformanceEvent.java delete mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/PhoneState.java delete mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/TelemetryImpl.java delete mode 100644 platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/package-info.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/engine/AndroidLocationEngineImplTest.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/engine/GoogleLocationEngineImplAdditionalTest.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/engine/GoogleLocationEngineImplTest.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/engine/LocationEngineProviderTest.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/engine/LocationEngineProxyTest.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/engine/LocationEngineRequestTest.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/engine/LocationEngineResultTest.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/engine/LocationEngineTest.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/engine/MapboxFusedLocationEngineImplAdditionalTest2.java create mode 100644 platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/engine/MapboxFusedLocationEngineImplTest.java delete mode 100644 platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/telemetry/HttpTransportTest.java diff --git a/platform/android/LICENSE.md b/platform/android/LICENSE.md index af6e18d36cd..f0394e48e72 100644 --- a/platform/android/LICENSE.md +++ b/platform/android/LICENSE.md @@ -190,12 +190,6 @@ License: [BSD](https://opensource.org/licenses/BSD-2-Clause) =========================================================================== -Mapbox GL uses portions of Mapbox Android Telemetry Library. -URL: [https://github.com/mapbox/mapbox-events-android](https://github.com/mapbox/mapbox-events-android) -License: [The MIT License](https://opensource.org/licenses/MIT) - -=========================================================================== - Mapbox GL uses portions of Mapbox Java SDK. URL: [https://github.com/mapbox/mapbox-java](https://github.com/mapbox/mapbox-java) License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) diff --git a/platform/android/MapboxGLAndroidSDK/build.gradle b/platform/android/MapboxGLAndroidSDK/build.gradle index 6b0c153bf8a..4cd2c6d72f5 100644 --- a/platform/android/MapboxGLAndroidSDK/build.gradle +++ b/platform/android/MapboxGLAndroidSDK/build.gradle @@ -6,20 +6,23 @@ apply plugin: 'com.mapbox.android.sdk.versions' dependencies { lintChecks project(":MapboxGLAndroidSDKLint") - api dependenciesList.mapboxAndroidTelemetry api dependenciesList.mapboxJavaGeoJSON api dependenciesList.mapboxAndroidGestures api dependenciesList.mapboxAndroidAccounts + implementation dependenciesList.mapboxJavaTurf implementation dependenciesList.supportAnnotations implementation dependenciesList.supportFragmentV4 implementation dependenciesList.okhttp3 + implementation dependenciesList.gmsLocation + testImplementation dependenciesList.junit testImplementation dependenciesList.mockito testImplementation dependenciesList.mockk testImplementation dependenciesList.robolectric testImplementation dependenciesList.kotlinLib testImplementation dependenciesList.commonsIO + testImplementation dependenciesList.assertjcore } android { diff --git a/platform/android/MapboxGLAndroidSDK/proguard-rules.pro b/platform/android/MapboxGLAndroidSDK/proguard-rules.pro index 39ee13d857f..926abbcb6e2 100644 --- a/platform/android/MapboxGLAndroidSDK/proguard-rules.pro +++ b/platform/android/MapboxGLAndroidSDK/proguard-rules.pro @@ -16,7 +16,7 @@ -dontnote com.mapbox.mapboxsdk.maps.MapboxMap -dontnote com.mapbox.mapboxsdk.maps.MapboxMapOptions -dontnote com.mapbox.mapboxsdk.log.LoggerDefinition --dontnote com.mapbox.android.core.location.LocationEnginePriority +-dontnote com.mapbox.mapboxsdk.location.engine.LocationEnginePriority # config for okhttp 3.11.0, https://github.com/square/okhttp/pull/3354 -dontwarn javax.annotation.** @@ -27,9 +27,6 @@ -keep class com.mapbox.geojson.** { *; } -dontwarn com.google.auto.value.** -# config for telemetry events --keep class com.mapbox.mapboxsdk.module.telemetry.** { *; } - # config for additional notes -dontnote org.robolectric.Robolectric -dontnote libcore.io.Memory diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/AccountsManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/AccountsManager.java index 3bcb2a1e159..3f8872af257 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/AccountsManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/AccountsManager.java @@ -13,8 +13,6 @@ import com.mapbox.mapboxsdk.constants.MapboxConstants; import com.mapbox.mapboxsdk.log.Logger; -import static com.mapbox.mapboxsdk.constants.MapboxConstants.KEY_PREFERENCE_SKU_TOKEN; - /** * REMOVAL OR MODIFICATION OF THE FOLLOWING CODE VIOLATES THE MAPBOX TERMS * OF SERVICE @@ -39,45 +37,19 @@ class AccountsManager { private SharedPreferences sharedPreferences; private String userId; - private String skuToken; private long timestamp; - private boolean isManaged; AccountsManager() { - isManaged = isSkuTokenManaged(); initialize(); } @VisibleForTesting - AccountsManager(SharedPreferences sharedPreferences, boolean isManaged) { + AccountsManager(SharedPreferences sharedPreferences) { this.sharedPreferences = sharedPreferences; - this.isManaged = isManaged; initialize(); } private void initialize() { - retrieveSkuTokenAndTimestamp(); - if (isManaged) { - validateRotation(); - } - } - - private boolean isSkuTokenManaged() { - boolean value = MapboxConstants.DEFAULT_MANAGE_SKU_TOKEN; - try { - // Try getting a custom value from the app Manifest - ApplicationInfo appInfo = retrieveApplicationInfo(); - if (appInfo.metaData != null) { - value = appInfo.metaData.getBoolean( - MapboxConstants.KEY_META_DATA_MANAGE_SKU_TOKEN, - MapboxConstants.DEFAULT_MANAGE_SKU_TOKEN - ); - } - } catch (Exception exception) { - Logger.e(TAG, "Failed to read the package metadata: ", exception); - } - - return value; } private ApplicationInfo retrieveApplicationInfo() throws PackageManager.NameNotFoundException { @@ -86,33 +58,6 @@ private ApplicationInfo retrieveApplicationInfo() throws PackageManager.NameNotF PackageManager.GET_META_DATA); } - private void retrieveSkuTokenAndTimestamp() { - SharedPreferences sharedPreferences = getSharedPreferences(); - skuToken = sharedPreferences.getString(KEY_PREFERENCE_SKU_TOKEN, ""); - timestamp = sharedPreferences.getLong(PREFERENCE_TIMESTAMP, 0L); - } - - private void validateRotation() { - if (TextUtils.isEmpty(skuToken) || timestamp == 0L) { - skuToken = generateSkuToken(getUserId()); - timestamp = persistRotation(skuToken); - } - } - - String getSkuToken() { - if (isManaged) { - if (isExpired()) { - skuToken = generateSkuToken(getUserId()); - timestamp = persistRotation(skuToken); - } - } else { - SharedPreferences sharedPreferences = getSharedPreferences(); - String notManagedSkuToken = sharedPreferences.getString(KEY_PREFERENCE_SKU_TOKEN, ""); - skuToken = notManagedSkuToken; - } - return skuToken; - } - private boolean isExpired() { return isExpired(getNow(), timestamp); } @@ -121,15 +66,6 @@ static boolean isExpired(long now, long then) { return ((now - then) > DateUtils.HOUR_IN_MILLIS); } - private long persistRotation(String skuToken) { - long now = getNow(); - SharedPreferences.Editor editor = getSharedPreferences().edit(); - editor.putLong(PREFERENCE_TIMESTAMP, now); - editor.putString(KEY_PREFERENCE_SKU_TOKEN, skuToken); - editor.apply(); - return now; - } - @NonNull private SharedPreferences getSharedPreferences() { if (sharedPreferences == null) { @@ -167,9 +103,4 @@ private synchronized String getUserId() { private String generateUserId() { return MapboxAccounts.obtainEndUserId(); } - - @NonNull - private String generateSkuToken(String userId) { - return MapboxAccounts.obtainMapsSkuUserToken(userId); - } } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java index c8b6701bba0..85651a5187f 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java @@ -11,7 +11,6 @@ import com.mapbox.mapboxsdk.constants.MapboxConstants; import com.mapbox.mapboxsdk.exceptions.MapboxConfigurationException; import com.mapbox.mapboxsdk.log.Logger; -import com.mapbox.mapboxsdk.maps.TelemetryDefinition; import com.mapbox.mapboxsdk.net.ConnectivityReceiver; import com.mapbox.mapboxsdk.storage.FileSource; import com.mapbox.mapboxsdk.utils.ThreadUtils; @@ -37,8 +36,6 @@ public final class Mapbox { @Nullable private String accessToken; @Nullable - private TelemetryDefinition telemetry; - @Nullable private AccountsManager accounts; /** @@ -61,7 +58,6 @@ public static synchronized Mapbox getInstance(@NonNull Context context, @Nullabl FileSource.initializeFileDirsPaths(appContext); INSTANCE = new Mapbox(appContext, accessToken); if (isAccessTokenValid(accessToken)) { - initializeTelemetry(); INSTANCE.accounts = new AccountsManager(); } ConnectivityReceiver.instance(appContext); @@ -92,15 +88,8 @@ public static void setAccessToken(String accessToken) { validateMapbox(); INSTANCE.accessToken = accessToken; - // cleanup telemetry which is dependent on an access token - if (INSTANCE.telemetry != null) { - INSTANCE.telemetry.disableTelemetrySession(); - INSTANCE.telemetry = null; - } - // initialize components dependent on a token if (isAccessTokenValid(accessToken)) { - initializeTelemetry(); INSTANCE.accounts = new AccountsManager(); } else { INSTANCE.accounts = null; @@ -108,23 +97,6 @@ public static void setAccessToken(String accessToken) { FileSource.getInstance(getApplicationContext()).setAccessToken(accessToken); } - /** - * Returns a SKU token, refreshed if necessary. This method is meant for internal SDK - * usage only. - * - * @return the SKU token - */ - public static String getSkuToken() { - if (!hasInstance() || INSTANCE.accounts == null) { - throw new MapboxConfigurationException( - "A valid access token parameter is required when using a Mapbox service." - + "\nPlease see https://www.mapbox.com/help/create-api-access-token/ to learn how to create one." - + "\nMore information in this guide https://www.mapbox.com/help/first-steps-android-sdk/#access-tokens." - + "Currently provided token is: " + INSTANCE.accessToken); - } - return INSTANCE.accounts.getSkuToken(); - } - /** * Application context * @@ -159,29 +131,6 @@ public static synchronized Boolean isConnected() { return ConnectivityReceiver.instance(INSTANCE.context).isConnected(); } - /** - * Initializes telemetry - */ - private static void initializeTelemetry() { - try { - INSTANCE.telemetry = getModuleProvider().obtainTelemetry(); - } catch (Exception exception) { - String message = "Error occurred while initializing telemetry"; - Logger.e(TAG, message, exception); - MapStrictMode.strictModeViolation(message, exception); - } - } - - /** - * Get an instance of Telemetry if initialised - * - * @return instance of telemetry - */ - @Nullable - public static TelemetryDefinition getTelemetry() { - return hasInstance() ? INSTANCE.telemetry : null; - } - /** * Get the module provider * diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/ModuleProvider.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/ModuleProvider.java index 63e325404ed..5d8711c4db4 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/ModuleProvider.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/ModuleProvider.java @@ -3,7 +3,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.mapbox.mapboxsdk.http.HttpRequest; -import com.mapbox.mapboxsdk.maps.TelemetryDefinition; /** * Injects concrete instances of configurable abstractions @@ -18,15 +17,6 @@ public interface ModuleProvider { @NonNull HttpRequest createHttpRequest(); - /** - * Get the concrete implementation of TelemetryDefinition - * - * @return a single instance of Telemetry - */ - @Nullable - TelemetryDefinition obtainTelemetry(); - - /** * Get the concrete implementation of LibraryLoaderProvider * diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/ModuleProviderImpl.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/ModuleProviderImpl.java index 68497811a25..c5c97bdb072 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/ModuleProviderImpl.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/ModuleProviderImpl.java @@ -3,10 +3,8 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.mapbox.mapboxsdk.http.HttpRequest; -import com.mapbox.mapboxsdk.maps.TelemetryDefinition; import com.mapbox.mapboxsdk.module.http.HttpRequestImpl; import com.mapbox.mapboxsdk.module.loader.LibraryLoaderProviderImpl; -import com.mapbox.mapboxsdk.module.telemetry.TelemetryImpl; public class ModuleProviderImpl implements ModuleProvider { @@ -16,12 +14,6 @@ public HttpRequest createHttpRequest() { return new HttpRequestImpl(); } - @Override - @Nullable - public TelemetryDefinition obtainTelemetry() { - return new TelemetryImpl(); - } - @NonNull @Override public LibraryLoaderProvider createLibraryLoaderProvider() { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/attribution/Attribution.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/attribution/Attribution.java index 159282b7f61..eaa2953f408 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/attribution/Attribution.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/attribution/Attribution.java @@ -9,9 +9,7 @@ public class Attribution { private static final String OPENSTREETMAP = "OpenStreetMap"; private static final String OPENSTREETMAP_ABBR = "OSM"; - static final String TELEMETRY = "Telemetry Settings"; static final String MAPBOX_URL = "https://www.mapbox.com/about/maps/"; - static final String TELEMETRY_URL = "https://www.mapbox.com/telemetry/"; static final List IMPROVE_MAP_URLS = new ArrayList<>(); static { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/attribution/AttributionParser.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/attribution/AttributionParser.java index 6d26c104acd..a1eb4f21f8d 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/attribution/AttributionParser.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/attribution/AttributionParser.java @@ -27,16 +27,14 @@ public class AttributionParser { private final String attributionData; private final boolean withImproveMap; private final boolean withCopyrightSign; - private final boolean withTelemetryAttribution; private final boolean withMapboxAttribution; AttributionParser(WeakReference context, String attributionData, boolean withImproveMap, - boolean withCopyrightSign, boolean withTelemetryAttribution, boolean withMapboxAttribution) { + boolean withCopyrightSign, boolean withMapboxAttribution) { this.context = context; this.attributionData = attributionData; this.withImproveMap = withImproveMap; this.withCopyrightSign = withCopyrightSign; - this.withTelemetryAttribution = withTelemetryAttribution; this.withMapboxAttribution = withMapboxAttribution; } @@ -85,7 +83,6 @@ public String createAttributionString(boolean shortenedOutput) { */ protected void parse() { parseAttributions(); - addAdditionalAttributions(); } /** @@ -109,9 +106,6 @@ private void parseUrlSpan(@NonNull SpannableStringBuilder htmlBuilder, @NonNull String url = urlSpan.getURL(); if (isUrlValid(url)) { String anchor = parseAnchorValue(htmlBuilder, urlSpan); - if (isImproveThisMapAnchor(anchor)) { - anchor = translateImproveThisMapAnchor(anchor); - } attributions.add(new Attribution(anchor, url)); } } @@ -136,20 +130,6 @@ private boolean isImproveThisMapAnchor(String anchor) { return anchor.equals(IMPROVE_THIS_MAP); } - /** - * Invoked to replace the english Improve this map with localized variant. - * - * @param anchor the anchor to be translated - * @return the translated anchor - */ - private String translateImproveThisMapAnchor(String anchor) { - Context context = this.context.get(); - if (context != null) { - anchor = context.getString(R.string.mapbox_telemetryImproveMap); - } - return anchor; - } - /** * Invoked to validate if an url is valid for the improve map configuration. * @@ -201,21 +181,6 @@ private String stripCopyright(@NonNull String anchor) { return anchor; } - /** - * Invoked to manually add attributions - */ - private void addAdditionalAttributions() { - if (withTelemetryAttribution) { - Context context = this.context.get(); - attributions.add( - new Attribution( - context != null ? context.getString(R.string.mapbox_telemetrySettings) : Attribution.TELEMETRY, - Attribution.TELEMETRY_URL - ) - ); - } - } - /** * Convert a string to a spanned html representation. * @@ -236,15 +201,14 @@ private static Spanned fromHtml(String html) { * Builder to configure using an AttributionParser. *

* AttributionData, set with {@link #withAttributionData(String...)}, is the only required property to build - * the underlying AttributionParser. Other properties include trimming the copyright sign, adding telemetry - * attribution or hiding attribution as improve this map and Mapbox. + * the underlying AttributionParser. Other properties include trimming the copyright sign, hiding + * attribution as improve this map and Mapbox. *

*/ public static class Options { private final WeakReference context; private boolean withImproveMap = true; private boolean withCopyrightSign = true; - private boolean withTelemetryAttribution = false; private boolean withMapboxAttribution = true; private String[] attributionDataStringArray; @@ -270,12 +234,6 @@ public Options withCopyrightSign(boolean withCopyrightSign) { return this; } - @NonNull - public Options withTelemetryAttribution(boolean withTelemetryAttribution) { - this.withTelemetryAttribution = withTelemetryAttribution; - return this; - } - @NonNull public Options withMapboxAttribution(boolean withMapboxAttribution) { this.withMapboxAttribution = withMapboxAttribution; @@ -294,7 +252,6 @@ public AttributionParser build() { fullAttributionString, withImproveMap, withCopyrightSign, - withTelemetryAttribution, withMapboxAttribution ); attributionParser.parse(); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MapboxConstants.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MapboxConstants.java index ce7a919f338..96bb4e8d8cc 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MapboxConstants.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MapboxConstants.java @@ -37,12 +37,6 @@ public class MapboxConstants { */ public static final boolean DEFAULT_MEASURE_TILE_DOWNLOAD_ON = false; - public static final String KEY_PREFERENCE_SKU_TOKEN = "com.mapbox.mapboxsdk.accounts.skutoken"; - - public static final String KEY_META_DATA_MANAGE_SKU_TOKEN = "com.mapbox.ManageSkuToken"; - - public static final boolean DEFAULT_MANAGE_SKU_TOKEN = true; - /** * Default value for font fallback for local ideograph fonts */ diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/TelemetryConstants.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/TelemetryConstants.java deleted file mode 100644 index 3dbae9de430..00000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/TelemetryConstants.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.mapbox.mapboxsdk.constants; - -@Deprecated -public class TelemetryConstants { - - public static final String TWO_FINGER_TAP = "TwoFingerTap"; - public static final String DOUBLE_TAP = "DoubleTap"; - public static final String SINGLE_TAP = "SingleTap"; - public static final String PAN = "Pan"; - public static final String PINCH = "Pinch"; - public static final String ROTATION = "Rotation"; - public static final String PITCH = "Pitch"; - -} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HttpRequestUrl.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HttpRequestUrl.java index 2a85bdee8e7..10453b476ae 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HttpRequestUrl.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HttpRequestUrl.java @@ -31,8 +31,6 @@ public static String buildResourceUrl(@NonNull String host, String resourceUrl, // Only add SKU token to requests not tagged as "offline" usage. if (offline) { resourceUrl = resourceUrl + "offline=true"; - } else { - resourceUrl = resourceUrl + "sku=" + Mapbox.getSkuToken(); } } return resourceUrl; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java index c7792e692f4..1805d02e3ea 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java @@ -14,12 +14,12 @@ import androidx.annotation.StyleRes; import androidx.annotation.VisibleForTesting; -import com.mapbox.android.core.location.LocationEngine; -import com.mapbox.android.core.location.LocationEngineCallback; -import com.mapbox.android.core.location.LocationEngineProvider; -import com.mapbox.android.core.location.LocationEngineRequest; -import com.mapbox.android.core.location.LocationEngineResult; -import com.mapbox.android.core.permissions.PermissionsManager; +import com.mapbox.mapboxsdk.location.engine.LocationEngine; +import com.mapbox.mapboxsdk.location.engine.LocationEngineCallback; +import com.mapbox.mapboxsdk.location.engine.LocationEngineProvider; +import com.mapbox.mapboxsdk.location.engine.LocationEngineRequest; +import com.mapbox.mapboxsdk.location.engine.LocationEngineResult; +import com.mapbox.mapboxsdk.location.permissions.PermissionsManager; import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdate; @@ -77,10 +77,10 @@ *

* This component offers a default, built-in {@link LocationEngine} with some of the activation methods. * This engine will be obtained by {@link LocationEngineProvider#getBestLocationEngine(Context, boolean)} which defaults - * to the {@link com.mapbox.android.core.location.MapboxFusedLocationEngineImpl}. If you'd like to utilize Google + * to the {@link com.mapbox.mapboxsdk.location.engine.MapboxFusedLocationEngineImpl}. If you'd like to utilize Google * Play Services * for more precise location updates, simply add the Google Play Location Services dependency in your build script. - * This will make the default engine the {@link com.mapbox.android.core.location.GoogleLocationEngineImpl} instead. + * This will make the default engine the {@link com.mapbox.mapboxsdk.location.engine.GoogleLocationEngineImpl} instead. * After a custom engine is passed to the component, or the built-in is initialized, * the location updates are going to be requested with the {@link LocationEngineRequest}, either a default one, * or the one passed during the activation. diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentActivationOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentActivationOptions.java index 07b37c17a15..a77f1928c8a 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentActivationOptions.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentActivationOptions.java @@ -5,8 +5,8 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.mapbox.android.core.location.LocationEngine; -import com.mapbox.android.core.location.LocationEngineRequest; +import com.mapbox.mapboxsdk.location.engine.LocationEngine; +import com.mapbox.mapboxsdk.location.engine.LocationEngineRequest; import com.mapbox.mapboxsdk.maps.Style; /** diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/AndroidLocationEngineImpl.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/AndroidLocationEngineImpl.java new file mode 100644 index 00000000000..014328b836c --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/AndroidLocationEngineImpl.java @@ -0,0 +1,174 @@ +package com.mapbox.mapboxsdk.location.engine; + +import android.annotation.SuppressLint; +import android.app.PendingIntent; +import android.content.Context; +import android.location.Criteria; +import android.location.Location; +import android.location.LocationListener; +import android.location.LocationManager; +import android.os.Bundle; +import android.os.Looper; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.VisibleForTesting; +import android.util.Log; + +/** + * A location engine that uses core android.location and has no external dependencies + * https://developer.android.com/guide/topics/location/strategies.html + */ +class AndroidLocationEngineImpl implements LocationEngineImpl { + private static final String TAG = "AndroidLocationEngine"; + final LocationManager locationManager; + + String currentProvider = LocationManager.PASSIVE_PROVIDER; + + AndroidLocationEngineImpl(@NonNull Context context) { + locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); + } + + @NonNull + @Override + public LocationListener createListener(LocationEngineCallback callback) { + return new AndroidLocationEngineCallbackTransport(callback); + } + + @Override + public void getLastLocation(@NonNull LocationEngineCallback callback) + throws SecurityException { + Location lastLocation = getLastLocationFor(currentProvider); + if (lastLocation != null) { + callback.onSuccess(LocationEngineResult.create(lastLocation)); + return; + } + + for (String provider : locationManager.getAllProviders()) { + lastLocation = getLastLocationFor(provider); + if (lastLocation != null) { + callback.onSuccess(LocationEngineResult.create(lastLocation)); + return; + } + } + callback.onFailure(new Exception("Last location unavailable")); + } + + @SuppressLint("MissingPermission") + Location getLastLocationFor(String provider) throws SecurityException { + Location location = null; + try { + location = locationManager.getLastKnownLocation(provider); + } catch (IllegalArgumentException iae) { + Log.e(TAG, iae.toString()); + } + return location; + } + + @SuppressLint("MissingPermission") + @Override + public void requestLocationUpdates(@NonNull LocationEngineRequest request, + @NonNull LocationListener listener, + @Nullable Looper looper) throws SecurityException { + // Pick best provider only if user has not explicitly chosen passive mode + currentProvider = getBestProvider(request.getPriority()); + locationManager.requestLocationUpdates(currentProvider, request.getInterval(), request.getDisplacement(), + listener, looper); + } + + @SuppressLint("MissingPermission") + @Override + public void requestLocationUpdates(@NonNull LocationEngineRequest request, + @NonNull PendingIntent pendingIntent) throws SecurityException { + // Pick best provider only if user has not explicitly chosen passive mode + currentProvider = getBestProvider(request.getPriority()); + locationManager.requestLocationUpdates(currentProvider, request.getInterval(), + request.getDisplacement(), pendingIntent); + } + + @SuppressLint("MissingPermission") + @Override + public void removeLocationUpdates(@NonNull LocationListener listener) { + if (listener != null) { + locationManager.removeUpdates(listener); + } + } + + @Override + public void removeLocationUpdates(PendingIntent pendingIntent) { + if (pendingIntent != null) { + locationManager.removeUpdates(pendingIntent); + } + } + + private String getBestProvider(int priority) { + String provider = null; + // Pick best provider only if user has not explicitly chosen passive mode + if (priority != LocationEngineRequest.PRIORITY_NO_POWER) { + provider = locationManager.getBestProvider(getCriteria(priority), true); + } + return provider != null ? provider : LocationManager.PASSIVE_PROVIDER; + } + + @VisibleForTesting + static Criteria getCriteria(int priority) { + Criteria criteria = new Criteria(); + criteria.setAccuracy(priorityToAccuracy(priority)); + criteria.setCostAllowed(true); + criteria.setPowerRequirement(priorityToPowerRequirement(priority)); + return criteria; + } + + private static int priorityToAccuracy(int priority) { + switch (priority) { + case LocationEngineRequest.PRIORITY_HIGH_ACCURACY: + case LocationEngineRequest.PRIORITY_BALANCED_POWER_ACCURACY: + return Criteria.ACCURACY_FINE; + case LocationEngineRequest.PRIORITY_LOW_POWER: + case LocationEngineRequest.PRIORITY_NO_POWER: + default: + return Criteria.ACCURACY_COARSE; + } + } + + private static int priorityToPowerRequirement(int priority) { + switch (priority) { + case LocationEngineRequest.PRIORITY_HIGH_ACCURACY: + return Criteria.POWER_HIGH; + case LocationEngineRequest.PRIORITY_BALANCED_POWER_ACCURACY: + return Criteria.POWER_MEDIUM; + case LocationEngineRequest.PRIORITY_LOW_POWER: + case LocationEngineRequest.PRIORITY_NO_POWER: + default: + return Criteria.POWER_LOW; + } + } + + @VisibleForTesting + static final class AndroidLocationEngineCallbackTransport implements LocationListener { + private final LocationEngineCallback callback; + + AndroidLocationEngineCallbackTransport(LocationEngineCallback callback) { + this.callback = callback; + } + + @Override + public void onLocationChanged(Location location) { + callback.onSuccess(LocationEngineResult.create(location)); + } + + @Override + public void onStatusChanged(String s, int i, Bundle bundle) { + // noop + } + + @Override + public void onProviderEnabled(String s) { + // noop + } + + @Override + public void onProviderDisabled(String s) { + callback.onFailure(new Exception("Current provider disabled")); + } + } +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/GoogleLocationEngineImpl.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/GoogleLocationEngineImpl.java new file mode 100644 index 00000000000..e650fe79320 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/GoogleLocationEngineImpl.java @@ -0,0 +1,145 @@ +package com.mapbox.mapboxsdk.location.engine; + +import android.annotation.SuppressLint; +import android.app.PendingIntent; +import android.content.Context; +import android.location.Location; +import android.os.Looper; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.VisibleForTesting; + +import com.google.android.gms.location.FusedLocationProviderClient; +import com.google.android.gms.location.LocationCallback; +import com.google.android.gms.location.LocationRequest; +import com.google.android.gms.location.LocationResult; +import com.google.android.gms.location.LocationServices; +import com.google.android.gms.tasks.OnFailureListener; +import com.google.android.gms.tasks.OnSuccessListener; + +import java.util.Collections; +import java.util.List; + +/** + * Wraps implementation of Fused Location Provider + */ +class GoogleLocationEngineImpl implements LocationEngineImpl { + private final FusedLocationProviderClient fusedLocationProviderClient; + + @VisibleForTesting + GoogleLocationEngineImpl(FusedLocationProviderClient fusedLocationProviderClient) { + this.fusedLocationProviderClient = fusedLocationProviderClient; + } + + GoogleLocationEngineImpl(@NonNull Context context) { + this.fusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(context); + } + + @NonNull + @Override + public LocationCallback createListener(LocationEngineCallback callback) { + return new GoogleLocationEngineCallbackTransport(callback); + } + + @SuppressLint("MissingPermission") + @Override + public void getLastLocation(@NonNull LocationEngineCallback callback) + throws SecurityException { + GoogleLastLocationEngineCallbackTransport transport = + new GoogleLastLocationEngineCallbackTransport(callback); + fusedLocationProviderClient.getLastLocation().addOnSuccessListener(transport).addOnFailureListener(transport); + } + + @SuppressLint("MissingPermission") + @Override + public void requestLocationUpdates(@NonNull LocationEngineRequest request, + @NonNull LocationCallback listener, + @Nullable Looper looper) throws SecurityException { + fusedLocationProviderClient.requestLocationUpdates(toGMSLocationRequest(request), listener, looper); + } + + @SuppressLint("MissingPermission") + @Override + public void requestLocationUpdates(@NonNull LocationEngineRequest request, + @NonNull PendingIntent pendingIntent) throws SecurityException { + fusedLocationProviderClient.requestLocationUpdates(toGMSLocationRequest(request), pendingIntent); + } + + @Override + public void removeLocationUpdates(@NonNull LocationCallback listener) { + if (listener != null) { + fusedLocationProviderClient.removeLocationUpdates(listener); + } + } + + @Override + public void removeLocationUpdates(PendingIntent pendingIntent) { + if (pendingIntent != null) { + fusedLocationProviderClient.removeLocationUpdates(pendingIntent); + } + } + + private static LocationRequest toGMSLocationRequest(LocationEngineRequest request) { + LocationRequest locationRequest = new LocationRequest(); + locationRequest.setInterval(request.getInterval()); + locationRequest.setFastestInterval(request.getFastestInterval()); + locationRequest.setSmallestDisplacement(request.getDisplacement()); + locationRequest.setMaxWaitTime(request.getMaxWaitTime()); + locationRequest.setPriority(toGMSLocationPriority(request.getPriority())); + return locationRequest; + } + + private static int toGMSLocationPriority(int enginePriority) { + switch (enginePriority) { + case LocationEngineRequest.PRIORITY_HIGH_ACCURACY: + return LocationRequest.PRIORITY_HIGH_ACCURACY; + case LocationEngineRequest.PRIORITY_BALANCED_POWER_ACCURACY: + return LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY; + case LocationEngineRequest.PRIORITY_LOW_POWER: + return LocationRequest.PRIORITY_LOW_POWER; + case LocationEngineRequest.PRIORITY_NO_POWER: + default: + return LocationRequest.PRIORITY_NO_POWER; + } + } + + private static final class GoogleLocationEngineCallbackTransport extends LocationCallback { + private final LocationEngineCallback callback; + + GoogleLocationEngineCallbackTransport(LocationEngineCallback callback) { + this.callback = callback; + } + + @Override + public void onLocationResult(LocationResult locationResult) { + super.onLocationResult(locationResult); + List locations = locationResult.getLocations(); + if (!locations.isEmpty()) { + callback.onSuccess(LocationEngineResult.create(locations)); + } else { + callback.onFailure(new Exception("Unavailable location")); + } + } + } + + @VisibleForTesting + static final class GoogleLastLocationEngineCallbackTransport + implements OnSuccessListener, OnFailureListener { + private final LocationEngineCallback callback; + + GoogleLastLocationEngineCallbackTransport(LocationEngineCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(Location location) { + callback.onSuccess(location != null ? LocationEngineResult.create(location) : + LocationEngineResult.create(Collections.emptyList())); + } + + @Override + public void onFailure(@NonNull Exception e) { + callback.onFailure(e); + } + } +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngine.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngine.java new file mode 100644 index 00000000000..95964fd46ce --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngine.java @@ -0,0 +1,81 @@ +package com.mapbox.mapboxsdk.location.engine; + +import android.app.PendingIntent; +import android.os.Looper; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.RequiresPermission; + +import static android.Manifest.permission.ACCESS_COARSE_LOCATION; +import static android.Manifest.permission.ACCESS_FINE_LOCATION; + +/** + * Generic location engine interface wrapper for the location providers. + * Default providers bundled with Mapbox location library: + * Android location provider and Google Play Services fused location provider + * + * @since 1.0.0 + */ +public interface LocationEngine { + + /** + * Returns the most recent location currently available. + *

+ * If a location is not available, which should happen very rarely, null will be returned. + * + * @param callback {@link LocationEngineCallback} for the location result {@link LocationEngineResult}. + * @throws SecurityException if permission is not granted to access location services. + * @since 1.0.0 + */ + @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION}) + void getLastLocation(@NonNull LocationEngineCallback callback) throws SecurityException; + + /** + * Requests location updates with a callback on the specified Looper thread. + * + * @param request {@link LocationEngineRequest} for the updates. + * @param callback {@link LocationEngineCallback} for the location result {@link LocationEngineResult}. + * @param looper The Looper object whose message queue will be used to implement the callback mechanism, + * or null to invoke callbacks on the main thread. + * @throws SecurityException if permission is not granted to access location services. + * @since 1.0.0 + */ + @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION}) + void requestLocationUpdates(@NonNull LocationEngineRequest request, + @NonNull LocationEngineCallback callback, + @Nullable Looper looper) throws SecurityException; + + /** + * Requests location updates with callback on the specified PendingIntent. + * + * @param request {@link LocationEngineRequest} for the updates. + * @param pendingIntent {@link PendingIntent} for the location result {@link LocationEngineResult}. + * @throws SecurityException if permission is not granted to access location services. + * @since 1.1.0 + */ + @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION}) + void requestLocationUpdates(@NonNull LocationEngineRequest request, + PendingIntent pendingIntent) throws SecurityException; + + /** + * Removes location updates for the given location engine callback. + *

+ * It is recommended to remove location requests when the activity is in a paused or + * stopped state, doing so helps battery performance. + * + * @param callback {@link LocationEngineCallback} to remove. + * @since 1.0.0 + */ + void removeLocationUpdates(@NonNull LocationEngineCallback callback); + + /** + * Removes location updates for the given pending intent. + *

+ * It is recommended to remove location requests when the activity is in a paused or + * stopped state, doing so helps battery performance. + * + * @param pendingIntent {@link PendingIntent} to remove. + * @since 1.1.0 + */ + void removeLocationUpdates(PendingIntent pendingIntent); +} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineCallback.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineCallback.java new file mode 100644 index 00000000000..b2562bae390 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineCallback.java @@ -0,0 +1,25 @@ +package com.mapbox.mapboxsdk.location.engine; + +import androidx.annotation.NonNull; + +/** + * Invoked for asynchronous notifications when new data + * from engine becomes available. + * + * @param Successful updated data type + */ +public interface LocationEngineCallback { + /** + * Invoked when new data available. + * + * @param result updated data. + */ + void onSuccess(T result); + + /** + * Invoked when engine exception occurs. + * + * @param exception {@link Exception} + */ + void onFailure(@NonNull Exception exception); +} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineImpl.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineImpl.java new file mode 100644 index 00000000000..5d40cd535cb --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineImpl.java @@ -0,0 +1,28 @@ +package com.mapbox.mapboxsdk.location.engine; + +import android.app.PendingIntent; +import android.os.Looper; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +/** + * Internal location engine implementation interface. + * + * @param location listener object type + */ +interface LocationEngineImpl { + @NonNull + T createListener(LocationEngineCallback callback); + + void getLastLocation(@NonNull LocationEngineCallback callback) throws SecurityException; + + void requestLocationUpdates(@NonNull LocationEngineRequest request, + @NonNull T listener, @Nullable Looper looper) throws SecurityException; + + void requestLocationUpdates(@NonNull LocationEngineRequest request, + @NonNull PendingIntent pendingIntent) throws SecurityException; + + void removeLocationUpdates(T listener); + + void removeLocationUpdates(PendingIntent pendingIntent); +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineProvider.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineProvider.java new file mode 100644 index 00000000000..1506e1f1437 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineProvider.java @@ -0,0 +1,60 @@ +package com.mapbox.mapboxsdk.location.engine; + +import android.content.Context; +import androidx.annotation.NonNull; +import com.google.android.gms.common.ConnectionResult; +import com.google.android.gms.common.GoogleApiAvailability; + +import static com.mapbox.mapboxsdk.location.engine.Utils.checkNotNull; +import static com.mapbox.mapboxsdk.location.engine.Utils.isOnClasspath; + +/** + * The main entry point for location engine integration. + */ +public final class LocationEngineProvider { + private static final String GOOGLE_LOCATION_SERVICES = "com.google.android.gms.location.LocationServices"; + private static final String GOOGLE_API_AVAILABILITY = "com.google.android.gms.common.GoogleApiAvailability"; + + private LocationEngineProvider() { + // prevent instantiation + } + + /** + * Returns instance to the best location engine, given the included libraries. + * + * @param context {@link Context}. + * @param background true if background optimized engine is desired (note: parameter deprecated) + * @return a unique instance of {@link LocationEngine} every time method is called. + * @since 1.0.0 + */ + @NonNull + @Deprecated + public static LocationEngine getBestLocationEngine(@NonNull Context context, boolean background) { + return getBestLocationEngine(context); + } + + /** + * Returns instance to the best location engine, given the included libraries. + * + * @param context {@link Context}. + * @return a unique instance of {@link LocationEngine} every time method is called. + * @since 1.1.0 + */ + @NonNull + public static LocationEngine getBestLocationEngine(@NonNull Context context) { + checkNotNull(context, "context == null"); + + boolean hasGoogleLocationServices = isOnClasspath(GOOGLE_LOCATION_SERVICES); + if (isOnClasspath(GOOGLE_API_AVAILABILITY)) { + // Check Google Play services APK is available and up-to-date on this device + hasGoogleLocationServices &= GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context) + == ConnectionResult.SUCCESS; + } + return getLocationEngine(context, hasGoogleLocationServices); + } + + private static LocationEngine getLocationEngine(Context context, boolean isGoogle) { + return isGoogle ? new LocationEngineProxy<>(new GoogleLocationEngineImpl(context.getApplicationContext())) : + new LocationEngineProxy<>(new MapboxFusedLocationEngineImpl(context.getApplicationContext())); + } +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineProxy.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineProxy.java new file mode 100644 index 00000000000..99df2322bff --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineProxy.java @@ -0,0 +1,79 @@ +package com.mapbox.mapboxsdk.location.engine; + +import android.app.PendingIntent; +import android.os.Looper; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.VisibleForTesting; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import static com.mapbox.mapboxsdk.location.engine.Utils.checkNotNull; + +class LocationEngineProxy implements LocationEngine { + private final LocationEngineImpl locationEngineImpl; + private Map, T> listeners; + + LocationEngineProxy(LocationEngineImpl locationEngineImpl) { + this.locationEngineImpl = locationEngineImpl; + } + + @Override + public void getLastLocation(@NonNull LocationEngineCallback callback) throws SecurityException { + checkNotNull(callback, "callback == null"); + locationEngineImpl.getLastLocation(callback); + } + + @Override + public void requestLocationUpdates(@NonNull LocationEngineRequest request, + @NonNull LocationEngineCallback callback, + @Nullable Looper looper) throws SecurityException { + checkNotNull(request, "request == null"); + checkNotNull(callback, "callback == null"); + locationEngineImpl.requestLocationUpdates(request, getListener(callback), + looper == null ? Looper.getMainLooper() : looper); + } + + @Override + public void requestLocationUpdates(@NonNull LocationEngineRequest request, + PendingIntent pendingIntent) throws SecurityException { + checkNotNull(request, "request == null"); + locationEngineImpl.requestLocationUpdates(request, pendingIntent); + } + + @Override + public void removeLocationUpdates(@NonNull LocationEngineCallback callback) { + checkNotNull(callback, "callback == null"); + locationEngineImpl.removeLocationUpdates(removeListener(callback)); + } + + @Override + public void removeLocationUpdates(PendingIntent pendingIntent) { + locationEngineImpl.removeLocationUpdates(pendingIntent); + } + + @VisibleForTesting + int getListenersCount() { + return listeners != null ? listeners.size() : 0; + } + + @VisibleForTesting + T getListener(@NonNull LocationEngineCallback callback) { + if (listeners == null) { + listeners = new ConcurrentHashMap<>(); + } + + T listener = listeners.get(callback); + if (listener == null) { + listener = locationEngineImpl.createListener(callback); + } + listeners.put(callback, listener); + return listener; + } + + @VisibleForTesting + T removeListener(@NonNull LocationEngineCallback callback) { + return listeners != null ? listeners.remove(callback) : null; + } +} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineRequest.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineRequest.java new file mode 100644 index 00000000000..09631fa03a2 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineRequest.java @@ -0,0 +1,242 @@ +package com.mapbox.mapboxsdk.location.engine; + +/** + * Data model that contains parameters for location + * engine requests. + * + * @since 1.0.0 + */ +public class LocationEngineRequest { + /** + * Used with {@link Builder#setPriority(int)} to request + * the most accurate location. + * + * @since 1.0.0 + */ + public static final int PRIORITY_HIGH_ACCURACY = 0; + + /** + * Used with {@link Builder#setPriority(int)} to request + * coarse location that is battery optimized. + * + * @since 1.0.0 + */ + public static final int PRIORITY_BALANCED_POWER_ACCURACY = 1; + + /** + * Used with {@link Builder#setPriority(int)} to request + * coarse ~ 10 km accuracy location. + * + * @since 1.0.0 + */ + public static final int PRIORITY_LOW_POWER = 2; + + /** + * Used with {@link Builder#setPriority(int)} to request + * passive location: no locations will be returned unless a different client + * has requested location updates. + * + * @since 1.0.0 + */ + public static final int PRIORITY_NO_POWER = 3; + + private final long interval; + private final int priority; + private final float displacement; + private final long maxWaitTime; + private final long fastestInterval; + + private LocationEngineRequest(Builder builder) { + this.interval = builder.interval; + this.priority = builder.priority; + this.displacement = builder.displacement; + this.maxWaitTime = builder.maxWaitTime; + this.fastestInterval = builder.fastestInterval; + } + + /** + * Returns desired interval between location updates + * in milliseconds. + * + * @return desired interval in milliseconds. + * @since 1.0.0 + */ + public long getInterval() { + return interval; + } + + /** + * Returns desired quality of the request. + * + * @return accuracy constant. + * @since 1.0.0 + */ + public int getPriority() { + return priority; + } + + /** + * Returns distance between location updates. + * + * @return distance between location updates in meters. + * @since 1.0.0 + */ + public float getDisplacement() { + return displacement; + } + + /** + * Returns maximum wait time in milliseconds for location updates. + * + * @return maximum wait time in milliseconds. + * @since 1.0.0 + */ + public long getMaxWaitTime() { + return maxWaitTime; + } + + /** + * Returns fastest interval in milliseconds for location updates. + * + * @return fastest interval in milliseconds. + * @since 1.0.0 + */ + public long getFastestInterval() { + return fastestInterval; + } + + /** + * Compares this LocationEngineRequest to the specified object. + * + * @param o locationEngineRequest to compare to. + * @return true when the type and values are equal, false otherwise. + * @since 3.1.1 + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + LocationEngineRequest that = (LocationEngineRequest) o; + + if (interval != that.interval) { + return false; + } + if (priority != that.priority) { + return false; + } + if (Float.compare(that.displacement, displacement) != 0) { + return false; + } + if (maxWaitTime != that.maxWaitTime) { + return false; + } + return fastestInterval == that.fastestInterval; + } + + /** + * Returns a hash code for this object. + * + * @return integer hash of the values. + * @since 3.1.1 + */ + @Override + public int hashCode() { + int result = (int) (interval ^ (interval >>> 32)); + result = 31 * result + priority; + result = 31 * result + (displacement != +0.0f ? Float.floatToIntBits(displacement) : 0); + result = 31 * result + (int) (maxWaitTime ^ (maxWaitTime >>> 32)); + result = 31 * result + (int) (fastestInterval ^ (fastestInterval >>> 32)); + return result; + } + + public static final class Builder { + private final long interval; + + private int priority; + private float displacement; + private long maxWaitTime; + private long fastestInterval; + + /** + * Default builder constructor. + * + * @param interval default interval between location updates + * @since 1.0.0 + */ + public Builder(long interval) { + this.interval = interval; + this.priority = PRIORITY_HIGH_ACCURACY; + this.displacement = 0.0f; + this.maxWaitTime = 0L; + this.fastestInterval = 0L; + } + + /** + * Set priority for request. + * Use priority constant: {@link #PRIORITY_HIGH_ACCURACY} + * + * @param priority constant + * @return reference to builder + * @since 1.0.0 + */ + public Builder setPriority(int priority) { + this.priority = priority; + return this; + } + + /** + * Set distance between location updates. + * + * @param displacement distance between locations in meters. + * @return reference to builder + * @since 1.0.0 + */ + public Builder setDisplacement(float displacement) { + this.displacement = displacement; + return this; + } + + /** + * Sets the maximum wait time in milliseconds for location updates. + *

+ * Locations determined at intervals but delivered in batch based on + * wait time. Batching is not supported by all engines. + * + * @param maxWaitTime wait time in milliseconds. + * @return reference to builder + * @since 1.0.0 + */ + public Builder setMaxWaitTime(long maxWaitTime) { + this.maxWaitTime = maxWaitTime; + return this; + } + + /** + * Sets the fastest interval in milliseconds for location updates. + * + * @param interval fastest interval in milliseconds. + * @return reference to builder + * @since 1.0.0 + */ + public Builder setFastestInterval(long interval) { + this.fastestInterval = interval; + return this; + } + + /** + * Builds request object. + * + * @return instance of location request. + * @since 1.0.0 + */ + public LocationEngineRequest build() { + return new LocationEngineRequest(this); + } + } +} + diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineResult.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineResult.java new file mode 100644 index 00000000000..c7dd05a9056 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/LocationEngineResult.java @@ -0,0 +1,119 @@ +package com.mapbox.mapboxsdk.location.engine; + +import android.content.Intent; +import android.location.Location; +import android.location.LocationManager; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import com.google.android.gms.location.LocationResult; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import static com.mapbox.mapboxsdk.location.engine.Utils.isOnClasspath; + +/** + * A wrapper class representing location result from the location engine. + *

+ * TODO: Override default equals(), hashCode() and toString() + * + * @since 1.0.0 + */ +public final class LocationEngineResult { + private static final String GOOGLE_PLAY_LOCATION_RESULT = "com.google.android.gms.location.LocationResult"; + + private final List locations; + + private LocationEngineResult(List locations) { + this.locations = Collections.unmodifiableList(locations); + } + + /** + * Creates {@link LocationEngineResult} instance for location. + * + * @param location default location added to the result. + * @return instance of the new location result. + * @since 1.0.0 + */ + @NonNull + public static LocationEngineResult create(@Nullable Location location) { + List locations = new ArrayList<>(); + if (location != null) { + locations.add(location); + } + return new LocationEngineResult(locations); + } + + /** + * Creates {@link LocationEngineResult} instance for given list of locations. + * + * @param locations list of locations. + * @return instance of the new location result. + * @since 1.0.0 + */ + @NonNull + public static LocationEngineResult create(@Nullable List locations) { + if (locations != null) { + List locationsList = new ArrayList<>(locations); + locationsList.removeAll(Collections.singleton(null)); + return new LocationEngineResult(locationsList); + } + + return new LocationEngineResult(Collections.emptyList()); + } + + /** + * Returns most recent location available in this result. + * + * @return the most recent location {@link Location} or null. + * @since 1.0.0 + */ + @Nullable + public Location getLastLocation() { + return locations.isEmpty() ? null : locations.get(0); + } + + /** + * Returns locations computed, ordered from oldest to newest. + * + * @return ordered list of locations. + * @since 1.0.0 + */ + public List getLocations() { + return Collections.unmodifiableList(locations); + } + + /** + * Extracts location result from intent object + * + * @param intent valid intent object + * @return location result. + * @since 1.1.0 + */ + @Nullable + public static LocationEngineResult extractResult(Intent intent) { + LocationEngineResult result = null; + if (isOnClasspath(GOOGLE_PLAY_LOCATION_RESULT)) { + result = extractGooglePlayResult(intent); + } + return result == null ? extractAndroidResult(intent) : result; + } + + private static LocationEngineResult extractGooglePlayResult(Intent intent) { + LocationResult result = LocationResult.extractResult(intent); + return result != null ? LocationEngineResult.create(result.getLocations()) : null; + } + + private static LocationEngineResult extractAndroidResult(Intent intent) { + return !hasResult(intent) ? null : + LocationEngineResult.create((Location) intent.getExtras() + .getParcelable(LocationManager.KEY_LOCATION_CHANGED)); + } + + private static boolean hasResult(Intent intent) { + return intent != null && intent.hasExtra(LocationManager.KEY_LOCATION_CHANGED); + } +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/MapboxFusedLocationEngineImpl.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/MapboxFusedLocationEngineImpl.java new file mode 100644 index 00000000000..ef6c936dd9d --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/MapboxFusedLocationEngineImpl.java @@ -0,0 +1,136 @@ +package com.mapbox.mapboxsdk.location.engine; + +import android.annotation.SuppressLint; +import android.app.PendingIntent; +import android.content.Context; +import android.location.Location; +import android.location.LocationListener; +import android.location.LocationManager; +import android.os.Bundle; +import android.os.Looper; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import android.util.Log; + +import static com.mapbox.mapboxsdk.location.engine.Utils.isBetterLocation; + +/** + * Mapbox replacement for Google Play Services Fused Location Client + *

+ * Note: fusion will not work in background mode. + */ +class MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { + private static final String TAG = "MapboxLocationEngine"; + + MapboxFusedLocationEngineImpl(@NonNull Context context) { + super(context); + } + + @NonNull + @Override + public LocationListener createListener(LocationEngineCallback callback) { + return new MapboxLocationEngineCallbackTransport(callback); + } + + @Override + public void getLastLocation(@NonNull LocationEngineCallback callback) throws SecurityException { + Location bestLastLocation = getBestLastLocation(); + if (bestLastLocation != null) { + callback.onSuccess(LocationEngineResult.create(bestLastLocation)); + } else { + callback.onFailure(new Exception("Last location unavailable")); + } + } + + @SuppressLint("MissingPermission") + @Override + public void requestLocationUpdates(@NonNull LocationEngineRequest request, + @NonNull LocationListener listener, + @Nullable Looper looper) throws SecurityException { + super.requestLocationUpdates(request, listener, looper); + + // Start network provider along with gps + if (shouldStartNetworkProvider(request.getPriority())) { + try { + locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, + request.getInterval(), request.getDisplacement(), + listener, looper); + } catch (IllegalArgumentException iae) { + iae.printStackTrace(); + } + } + } + + @SuppressLint("MissingPermission") + @Override + public void requestLocationUpdates(@NonNull LocationEngineRequest request, + @NonNull PendingIntent pendingIntent) throws SecurityException { + super.requestLocationUpdates(request, pendingIntent); + + // Start network provider along with gps + if (shouldStartNetworkProvider(request.getPriority())) { + try { + locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, request.getInterval(), + request.getDisplacement(), pendingIntent); + } catch (IllegalArgumentException iae) { + iae.printStackTrace(); + } + } + } + + private Location getBestLastLocation() { + Location bestLastLocation = null; + for (String provider : locationManager.getAllProviders()) { + Location location = getLastLocationFor(provider); + if (location == null) { + continue; + } + + if (isBetterLocation(location, bestLastLocation)) { + bestLastLocation = location; + } + } + return bestLastLocation; + } + + private boolean shouldStartNetworkProvider(int priority) { + return (priority == LocationEngineRequest.PRIORITY_HIGH_ACCURACY + || priority == LocationEngineRequest.PRIORITY_BALANCED_POWER_ACCURACY) + && currentProvider.equals(LocationManager.GPS_PROVIDER); + } + + private static final class MapboxLocationEngineCallbackTransport implements LocationListener { + private final LocationEngineCallback callback; + private Location currentBestLocation; + + MapboxLocationEngineCallbackTransport(LocationEngineCallback callback) { + this.callback = callback; + } + + @Override + public void onLocationChanged(Location location) { + if (isBetterLocation(location, currentBestLocation)) { + currentBestLocation = location; + } + + if (callback != null) { + callback.onSuccess(LocationEngineResult.create(currentBestLocation)); + } + } + + @Override + public void onStatusChanged(String provider, int status, Bundle extras) { + Log.d(TAG, "onStatusChanged: " + provider); + } + + @Override + public void onProviderEnabled(String provider) { + Log.d(TAG, "onProviderEnabled: " + provider); + } + + @Override + public void onProviderDisabled(String provider) { + Log.d(TAG, "onProviderDisabled: " + provider); + } + } +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/Utils.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/Utils.java new file mode 100644 index 00000000000..a0528205557 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/engine/Utils.java @@ -0,0 +1,105 @@ +package com.mapbox.mapboxsdk.location.engine; + +import android.location.Location; +import androidx.annotation.Nullable; + +final class Utils { + private static final int TWO_MINUTES = 1000 * 60 * 2; + private static final int ACCURACY_THRESHOLD_METERS = 200; + + private Utils() { + // Prevent instantiation + } + + /** + * Ensures that an object reference passed as a parameter to the calling method is not null. + * + * @param reference object reference. + * @param message exception message to use if check fails. + * @param object type. + * @return validated non-null reference. + */ + static T checkNotNull(@Nullable T reference, String message) { + if (reference == null) { + throw new NullPointerException(message); + } + return reference; + } + + /** + * Checks if class is on class path + * @param className of the class to check. + * @return true if class in on class path, false otherwise. + */ + static boolean isOnClasspath(String className) { + boolean isOnClassPath = true; + try { + Class.forName(className); + } catch (ClassNotFoundException exception) { + isOnClassPath = false; + } + return isOnClassPath; + } + + /** + * Determines whether one Location reading is better than the current Location fix + *

+ * (c) https://developer.android.com/guide/topics/location/strategies + * + * @param location The new Location that you want to evaluate + * @param currentBestLocation The current Location fix, to which you want to compare the new one + */ + static boolean isBetterLocation(Location location, Location currentBestLocation) { + if (currentBestLocation == null) { + // A new location is always better than no location + return true; + } + + // Check whether the new location fix is newer or older + long timeDelta = location.getTime() - currentBestLocation.getTime(); + boolean isSignificantlyNewer = timeDelta > TWO_MINUTES; + boolean isSignificantlyOlder = timeDelta < -TWO_MINUTES; + boolean isNewer = timeDelta > 0; + + // If it's been more than two minutes since the current location, use the new location + // because the user has likely moved + if (isSignificantlyNewer) { + return true; + // If the new location is more than two minutes older, it must be worse + } else if (isSignificantlyOlder) { + return false; + } + + // Check whether the new location fix is more or less accurate + int accuracyDelta = (int) (location.getAccuracy() - currentBestLocation.getAccuracy()); + boolean isLessAccurate = accuracyDelta > 0; + boolean isMoreAccurate = accuracyDelta < 0; + boolean isSignificantlyLessAccurate = accuracyDelta > ACCURACY_THRESHOLD_METERS; + + // Check if the old and new location are from the same provider + boolean isFromSameProvider = isSameProvider(location.getProvider(), + currentBestLocation.getProvider()); + + // Determine location quality using a combination of timeliness and accuracy + if (isMoreAccurate) { + return true; + } else if (isNewer && !isLessAccurate) { + return true; + } else if (isNewer && !isSignificantlyLessAccurate && isFromSameProvider) { + return true; + } + return false; + } + + /** + * Checks whether two providers are the same + *

+ * (c) https://developer.android.com/guide/topics/location/strategies + */ + private static boolean isSameProvider(String provider1, String provider2) { + if (provider1 == null) { + return provider2 == null; + } + return provider1.equals(provider2); + } +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/permissions/PermissionsListener.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/permissions/PermissionsListener.java new file mode 100644 index 00000000000..c525bd7daf6 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/permissions/PermissionsListener.java @@ -0,0 +1,14 @@ +package com.mapbox.mapboxsdk.location.permissions; + +import java.util.List; + +/** + * Callback used in PermissionsManager + */ + +public interface PermissionsListener { + + void onExplanationNeeded(List permissionsToExplain); + + void onPermissionResult(boolean granted); +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/permissions/PermissionsManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/permissions/PermissionsManager.java new file mode 100644 index 00000000000..32f3840f35b --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/permissions/PermissionsManager.java @@ -0,0 +1,152 @@ +package com.mapbox.mapboxsdk.location.permissions; + +import android.Manifest; +import android.app.Activity; +import android.content.Context; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; +import android.os.Build; +import android.util.Log; + +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * Helps request permissions at runtime. + */ +public class PermissionsManager { + + private static final String LOG_TAG = "PermissionsManager"; + private static final String COARSE_LOCATION_PERMISSION = Manifest.permission.ACCESS_COARSE_LOCATION; + private static final String FINE_LOCATION_PERMISSION = Manifest.permission.ACCESS_FINE_LOCATION; + private static final String BACKGROUND_LOCATION_PERMISSION = "android.permission.ACCESS_BACKGROUND_LOCATION"; + + private final int REQUEST_PERMISSIONS_CODE = 0; + + private PermissionsListener listener; + + public PermissionsManager(PermissionsListener listener) { + this.listener = listener; + } + + public PermissionsListener getListener() { + return listener; + } + + public void setListener(PermissionsListener listener) { + this.listener = listener; + } + + private static boolean isPermissionGranted(Context context, String permission) { + return ContextCompat.checkSelfPermission(context, permission) + == PackageManager.PERMISSION_GRANTED; + } + + private static boolean isCoarseLocationPermissionGranted(Context context) { + return isPermissionGranted(context, COARSE_LOCATION_PERMISSION); + } + + private static boolean isFineLocationPermissionGranted(Context context) { + return isPermissionGranted(context, FINE_LOCATION_PERMISSION); + } + + public static boolean isBackgroundLocationPermissionGranted(Context context) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + return isPermissionGranted(context, BACKGROUND_LOCATION_PERMISSION); + } + + return areLocationPermissionsGranted(context); + } + + public static boolean areLocationPermissionsGranted(Context context) { + return isCoarseLocationPermissionGranted(context) + || isFineLocationPermissionGranted(context); + } + + public static boolean areRuntimePermissionsRequired() { + return Build.VERSION.SDK_INT >= Build.VERSION_CODES.M; + } + + public void requestLocationPermissions(Activity activity) { + try { + PackageInfo packageInfo = activity.getPackageManager().getPackageInfo( + activity.getPackageName(), PackageManager.GET_PERMISSIONS); + + String[] requestedPermissions = packageInfo.requestedPermissions; + if (requestedPermissions != null) { + List permissionList = Arrays.asList(requestedPermissions); + boolean fineLocPermission = permissionList.contains(FINE_LOCATION_PERMISSION); + boolean coarseLocPermission = permissionList.contains(COARSE_LOCATION_PERMISSION); + boolean backgroundLocPermission = permissionList.contains(BACKGROUND_LOCATION_PERMISSION); + + // Request location permissions + if (fineLocPermission) { + requestLocationPermissions(activity, true, backgroundLocPermission); + } else if (coarseLocPermission) { + requestLocationPermissions(activity, false, backgroundLocPermission); + } else { + Log.w(LOG_TAG, "Location permissions are missing"); + } + } + } catch (Exception exception) { + Log.w(LOG_TAG, exception.getMessage()); + } + } + + private void requestLocationPermissions(Activity activity, boolean requestFineLocation, + boolean requestBackgroundLocation) { + List permissions = new ArrayList<>(); + if (requestFineLocation) { + permissions.add(FINE_LOCATION_PERMISSION); + } else { + permissions.add(COARSE_LOCATION_PERMISSION); + } + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && requestBackgroundLocation) { + permissions.add(BACKGROUND_LOCATION_PERMISSION); + } + + requestPermissions(activity, permissions.toArray(new String[permissions.size()])); + } + + private void requestPermissions(Activity activity, String[] permissions) { + ArrayList permissionsToExplain = new ArrayList<>(); + for (String permission : permissions) { + if (ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)) { + permissionsToExplain.add(permission); + } + } + + if (listener != null && permissionsToExplain.size() > 0) { + // The developer should show an explanation to the user asynchronously + listener.onExplanationNeeded(permissionsToExplain); + } + + ActivityCompat.requestPermissions(activity, permissions, REQUEST_PERMISSIONS_CODE); + } + + /** + * You should call this method from your activity onRequestPermissionsResult. + * + * @param requestCode The request code passed in requestPermissions(android.app.Activity, String[], int) + * @param permissions The requested permissions. Never null. + * @param grantResults The grant results for the corresponding permissions which is either + * PERMISSION_GRANTED or PERMISSION_DENIED. Never null. + */ + public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { + switch (requestCode) { + case REQUEST_PERMISSIONS_CODE: + if (listener != null) { + boolean granted = grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED; + listener.onPermissionResult(granted); + } + break; + default: + // Ignored + } + } +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java index bd54d33d99a..74e4e095769 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AttributionDialogManager.java @@ -34,7 +34,6 @@ *

* When the user clicks the attribution icon, {@link AttributionDialogManager#onClick(View)} will be invoked. * An attribution dialog will be shown to the user with contents based on the attributions found in the map style. - * Additionally an telemetry option item is shown to configure telemetry settings. *

*/ public class AttributionDialogManager implements View.OnClickListener, DialogInterface.OnClickListener { @@ -87,14 +86,10 @@ private String[] getAttributionTitles() { return titles.toArray(new String[titles.size()]); } - // Called when someone selects an attribution or telemetry settings from the dialog + // Called when someone selects an attribution from the dialog @Override public void onClick(DialogInterface dialog, int which) { - if (isLatestEntry(which)) { - showTelemetryDialog(); - } else { - showMapAttributionWebPage(which); - } + showMapAttributionWebPage(which); } public void onStop() { @@ -107,40 +102,6 @@ private boolean isLatestEntry(int attributionKeyIndex) { return attributionKeyIndex == getAttributionTitles().length - 1; } - private void showTelemetryDialog() { - AlertDialog.Builder builder = new AlertDialog.Builder(context); - builder.setTitle(R.string.mapbox_attributionTelemetryTitle); - builder.setMessage(R.string.mapbox_attributionTelemetryMessage); - builder.setPositiveButton(R.string.mapbox_attributionTelemetryPositive, new DialogInterface.OnClickListener() { - @Override - public void onClick(@NonNull DialogInterface dialog, int which) { - TelemetryDefinition telemetry = Mapbox.getTelemetry(); - if (telemetry != null) { - telemetry.setUserTelemetryRequestState(true); - } - dialog.cancel(); - } - }); - builder.setNeutralButton(R.string.mapbox_attributionTelemetryNeutral, new DialogInterface.OnClickListener() { - @Override - public void onClick(@NonNull DialogInterface dialog, int which) { - showWebPage(context.getResources().getString(R.string.mapbox_telemetryLink)); - dialog.cancel(); - } - }); - builder.setNegativeButton(R.string.mapbox_attributionTelemetryNegative, new DialogInterface.OnClickListener() { - @Override - public void onClick(@NonNull DialogInterface dialog, int which) { - TelemetryDefinition telemetry = Mapbox.getTelemetry(); - if (telemetry != null) { - telemetry.setUserTelemetryRequestState(false); - } - dialog.cancel(); - } - }); - builder.show(); - } - private void showMapAttributionWebPage(int which) { Attribution[] attributions = attributionSet.toArray(new Attribution[attributionSet.size()]); String url = attributions[which].getUrl(); @@ -236,7 +197,6 @@ private Set build() { return new AttributionParser.Options(context) .withCopyrightSign(true) .withImproveMap(true) - .withTelemetryAttribution(true) .withAttributionData(attributions.toArray(new String[attributions.size()])) .build().getAttributions(); } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java index a57f56164f0..42203640a67 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java @@ -297,12 +297,7 @@ public void onClick(View v) { */ @UiThread public void onCreate(@Nullable Bundle savedInstanceState) { - if (savedInstanceState == null) { - TelemetryDefinition telemetry = Mapbox.getTelemetry(); - if (telemetry != null) { - telemetry.onAppUserTurnstileEvent(); - } - } else if (savedInstanceState.getBoolean(MapboxConstants.STATE_HAS_SAVED_STATE)) { + if (savedInstanceState.getBoolean(MapboxConstants.STATE_HAS_SAVED_STATE)) { this.savedInstanceState = savedInstanceState; } } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TelemetryDefinition.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TelemetryDefinition.java deleted file mode 100644 index 863d821a12f..00000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TelemetryDefinition.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.mapbox.mapboxsdk.maps; - -import android.os.Bundle; - -import com.mapbox.mapboxsdk.offline.OfflineRegionDefinition; - -/** - * Definition of TelemetryImpl collection. - * Use{@link TelemetryDefinition} for posting the event. - */ -public interface TelemetryDefinition { - - /** - * Register the app user turnstile event - */ - void onAppUserTurnstileEvent(); - - /** - * Register an end-user gesture interaction event. - * - * @param eventType type of gesture event occurred - * @param latitude the latitude value of the gesture focal point - * @param longitude the longitude value of the gesture focal point - * @param zoom current zoom of the map - * @deprecated since 7.5.0, this event is no longer supported - */ - @Deprecated - void onGestureInteraction(String eventType, double latitude, double longitude, double zoom); - - /** - * Set the end-user selected state to participate or opt-out in telemetry collection. - */ - void setUserTelemetryRequestState(boolean enabled); - - /** - * Disables a started telemetry service for this session only. - */ - void disableTelemetrySession(); - - /** - * Set the end-user selected state to participate or opt-out in telemetry collection. - */ - void setDebugLoggingEnabled(boolean debugLoggingEnabled); - - /** - * Set the telemetry rotation session id interval - * - * @param interval the selected session interval - * @return true if rotation session id was updated - */ - boolean setSessionIdRotationInterval(int interval); - - /** - * Register an end-user offline download event. - * - * @param offlineDefinition the offline region definition - */ - void onCreateOfflineRegion(OfflineRegionDefinition offlineDefinition); - - /** - * Register a performance event. - * - * @param data performance event data - */ - void onPerformanceEvent(Bundle data); -} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapBaseEvent.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapBaseEvent.java deleted file mode 100644 index 130217fea79..00000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapBaseEvent.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.mapbox.mapboxsdk.module.telemetry; - -import android.annotation.SuppressLint; -import android.os.Parcel; - -import com.mapbox.android.telemetry.Event; - -/** - * Base event class for telemetry events. - */ -@SuppressLint("ParcelCreator") -abstract class MapBaseEvent extends Event { - private final String event; - private final String created; - - MapBaseEvent(PhoneState phoneState) { - this.event = getEventName(); - this.created = phoneState.getCreated(); - } - - abstract String getEventName(); - - String getEvent() { - return event; - } - - String getCreated() { - return created; - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - } -} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapEventFactory.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapEventFactory.java deleted file mode 100644 index 1a4419a20d3..00000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapEventFactory.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.mapbox.mapboxsdk.module.telemetry; - -import android.os.Bundle; -import androidx.annotation.FloatRange; -import androidx.annotation.NonNull; - -import com.mapbox.android.telemetry.TelemetryUtils; -import com.mapbox.mapboxsdk.constants.MapboxConstants; -import com.mapbox.mapboxsdk.offline.OfflineRegion; - -class MapEventFactory { - - static MapLoadEvent buildMapLoadEvent(@NonNull PhoneState phoneState) { - String userId = TelemetryUtils.retrieveVendorId(); - return new MapLoadEvent(userId, phoneState); - } - - static OfflineDownloadStartEvent buildOfflineDownloadStartEvent(PhoneState phoneState, - String shapeForOfflineRegion, - @FloatRange(from = MapboxConstants.MINIMUM_ZOOM, - to = MapboxConstants.MAXIMUM_ZOOM) Double minZoom, - @FloatRange(from = MapboxConstants.MINIMUM_ZOOM, - to = MapboxConstants.MAXIMUM_ZOOM) Double maxZoom, - String styleURL) { - - OfflineDownloadStartEvent offlineEvent = - new OfflineDownloadStartEvent(phoneState, shapeForOfflineRegion, minZoom, maxZoom); - offlineEvent.setStyleURL(styleURL); - return offlineEvent; - } - - static OfflineDownloadEndEvent buildOfflineDownloadCompleteEvent(PhoneState phoneState, - String shapeForOfflineRegion, - @FloatRange(from = MapboxConstants.MINIMUM_ZOOM, - to = MapboxConstants.MAXIMUM_ZOOM) Double minZoom, - @FloatRange(from = MapboxConstants.MINIMUM_ZOOM, - to = MapboxConstants.MAXIMUM_ZOOM) Double maxZoom, - String styleURL, - long sizeOfResourcesCompleted, - long numberOfTilesCompleted, - @OfflineRegion.DownloadState int state) { - - OfflineDownloadEndEvent offlineEvent = - new OfflineDownloadEndEvent(phoneState, shapeForOfflineRegion, minZoom, maxZoom); - offlineEvent.setStyleURL(styleURL); - offlineEvent.setSizeOfResourcesCompleted(sizeOfResourcesCompleted); - offlineEvent.setNumberOfTilesCompleted(numberOfTilesCompleted); - offlineEvent.setState(state); - return offlineEvent; - } - - static PerformanceEvent buildPerformanceEvent(@NonNull PhoneState phoneState, @NonNull String sessionId, - @NonNull Bundle data) { - return new PerformanceEvent(phoneState, sessionId, data); - } - -} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapLoadEvent.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapLoadEvent.java deleted file mode 100644 index b12a10b8c46..00000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/MapLoadEvent.java +++ /dev/null @@ -1,179 +0,0 @@ -package com.mapbox.mapboxsdk.module.telemetry; - -import android.annotation.SuppressLint; -import android.os.Build; - -import com.mapbox.mapboxsdk.BuildConfig; - -/** - * Event will be sent while map is loaded. - */ -@SuppressLint("ParcelCreator") -class MapLoadEvent extends MapBaseEvent { - private static final String EVENT_NAME = "map.load"; - private final String operatingSystem = "Android - " + Build.VERSION.RELEASE; - private final String sdkIdentifier = BuildConfig.MAPBOX_SDK_IDENTIFIER; - private final String sdkVersion = BuildConfig.MAPBOX_SDK_VERSION; - private final String model = Build.MODEL; - private final String userId; - private final String carrier; - private final String cellularNetworkType; - private final String orientation; - private final float resolution; - private final float accessibilityFontScale; - private final int batteryLevel; - private final boolean pluggedIn; - private final boolean wifi; - - MapLoadEvent(String userId, PhoneState phoneState) { - super(phoneState); - this.userId = userId; - this.batteryLevel = phoneState.getBatteryLevel(); - this.pluggedIn = phoneState.isPluggedIn(); - this.cellularNetworkType = phoneState.getCellularNetworkType(); - this.carrier = phoneState.getCarrier(); - this.resolution = phoneState.getResolution(); - this.accessibilityFontScale = phoneState.getAccessibilityFontScale(); - this.wifi = phoneState.isWifi(); - this.orientation = phoneState.getOrientation(); - } - - @Override - String getEventName() { - return EVENT_NAME; - } - - String getOperatingSystem() { - return operatingSystem; - } - - String getSdkIdentifier() { - return sdkIdentifier; - } - - String getSdkVersion() { - return sdkVersion; - } - - String getModel() { - return model; - } - - String getUserId() { - return userId; - } - - String getCarrier() { - return carrier; - } - - String getCellularNetworkType() { - return cellularNetworkType; - } - - String getOrientation() { - return orientation; - } - - float getResolution() { - return resolution; - } - - float getAccessibilityFontScale() { - return accessibilityFontScale; - } - - int getBatteryLevel() { - return batteryLevel; - } - - boolean isPluggedIn() { - return pluggedIn; - } - - boolean isWifi() { - return wifi; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - MapLoadEvent that = (MapLoadEvent) o; - - if (Float.compare(that.resolution, resolution) != 0) { - return false; - } - if (Float.compare(that.accessibilityFontScale, accessibilityFontScale) != 0) { - return false; - } - if (batteryLevel != that.batteryLevel) { - return false; - } - if (pluggedIn != that.pluggedIn) { - return false; - } - if (wifi != that.wifi) { - return false; - } - if (!operatingSystem.equals(that.operatingSystem)) { - return false; - } - if (model != null ? !model.equals(that.model) : that.model != null) { - return false; - } - if (userId != null ? !userId.equals(that.userId) : that.userId != null) { - return false; - } - if (carrier != null ? !carrier.equals(that.carrier) : that.carrier != null) { - return false; - } - if (cellularNetworkType != null ? !cellularNetworkType.equals(that.cellularNetworkType) : - that.cellularNetworkType != null) { - return false; - } - return orientation != null ? orientation.equals(that.orientation) : that.orientation == null; - } - - @Override - public int hashCode() { - int result = operatingSystem != null ? operatingSystem.hashCode() : 0; - result = 31 * result + sdkIdentifier.hashCode(); - result = 31 * result + sdkVersion.hashCode(); - result = 31 * result + (model != null ? model.hashCode() : 0); - result = 31 * result + (userId != null ? userId.hashCode() : 0); - result = 31 * result + (carrier != null ? carrier.hashCode() : 0); - result = 31 * result + (cellularNetworkType != null ? cellularNetworkType.hashCode() : 0); - result = 31 * result + (orientation != null ? orientation.hashCode() : 0); - result = 31 * result + (resolution != +0.0f ? Float.floatToIntBits(resolution) : 0); - result = 31 * result + (accessibilityFontScale != +0.0f ? Float.floatToIntBits(accessibilityFontScale) : 0); - result = 31 * result + batteryLevel; - result = 31 * result + (pluggedIn ? 1 : 0); - result = 31 * result + (wifi ? 1 : 0); - return result; - } - - @Override - public String toString() { - return "MapLoadEvent{" - + ", operatingSystem='" + operatingSystem + '\'' - + ", sdkIdentifier='" + sdkIdentifier + '\'' - + ", sdkVersion='" + sdkVersion + '\'' - + ", model='" + model + '\'' - + ", userId='" + userId + '\'' - + ", carrier='" + carrier + '\'' - + ", cellularNetworkType='" + cellularNetworkType + '\'' - + ", orientation='" + orientation + '\'' - + ", resolution=" + resolution - + ", accessibilityFontScale=" + accessibilityFontScale - + ", batteryLevel=" + batteryLevel - + ", pluggedIn=" + pluggedIn - + ", wifi=" + wifi - + '}'; - } -} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/OfflineDownloadEndEvent.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/OfflineDownloadEndEvent.java deleted file mode 100644 index 0a85b143a2f..00000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/OfflineDownloadEndEvent.java +++ /dev/null @@ -1,140 +0,0 @@ -package com.mapbox.mapboxsdk.module.telemetry; - -import android.annotation.SuppressLint; -import androidx.annotation.FloatRange; - -import com.mapbox.mapboxsdk.constants.MapboxConstants; -import com.mapbox.mapboxsdk.offline.OfflineRegion; - -/** - * Event will be sent while offline download end. - */ -@SuppressLint("ParcelCreator") -public class OfflineDownloadEndEvent extends MapBaseEvent { - private static final String EVENT_NAME = "map.offlineDownload.end"; - private final Double minZoom; - private final Double maxZoom; - private final String shapeForOfflineRegion; - private String styleURL; - private String state; - private long sizeOfResourcesCompleted; - private long numberOfTilesCompleted; - - OfflineDownloadEndEvent(PhoneState phoneState, String shapeForOfflineRegion, - @FloatRange(from = MapboxConstants.MINIMUM_ZOOM, - to = MapboxConstants.MAXIMUM_ZOOM) Double minZoom, - @FloatRange(from = MapboxConstants.MINIMUM_ZOOM, - to = MapboxConstants.MAXIMUM_ZOOM) Double maxZoom) { - super(phoneState); - this.shapeForOfflineRegion = shapeForOfflineRegion; - this.minZoom = minZoom; - this.maxZoom = maxZoom; - } - - @Override - String getEventName() { - return EVENT_NAME; - } - - Double getMinZoom() { - return minZoom; - } - - Double getMaxZoom() { - return maxZoom; - } - - String getShapeForOfflineRegion() { - return shapeForOfflineRegion; - } - - String getStyleURL() { - return styleURL; - } - - void setStyleURL(String styleURL) { - this.styleURL = styleURL; - } - - long getSizeOfResourcesCompleted() { - return sizeOfResourcesCompleted; - } - - void setSizeOfResourcesCompleted(long sizeOfResourcesCompleted) { - this.sizeOfResourcesCompleted = sizeOfResourcesCompleted; - } - - long getNumberOfTilesCompleted() { - return numberOfTilesCompleted; - } - - void setNumberOfTilesCompleted(long numberOfTilesCompleted) { - this.numberOfTilesCompleted = numberOfTilesCompleted; - } - - String getState() { - return state; - } - - void setState(@OfflineRegion.DownloadState int state) { - this.state = String.valueOf(state); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - OfflineDownloadEndEvent that = (OfflineDownloadEndEvent) o; - - if (sizeOfResourcesCompleted != that.sizeOfResourcesCompleted) { - return false; - } - if (numberOfTilesCompleted != that.numberOfTilesCompleted) { - return false; - } - if (minZoom != null ? !minZoom.equals(that.minZoom) : that.minZoom != null) { - return false; - } - if (maxZoom != null ? !maxZoom.equals(that.maxZoom) : that.maxZoom != null) { - return false; - } - if (shapeForOfflineRegion != null ? !shapeForOfflineRegion.equals(that.shapeForOfflineRegion) - : that.shapeForOfflineRegion != null) { - return false; - } - if (styleURL != null ? !styleURL.equals(that.styleURL) : that.styleURL != null) { - return false; - } - return state != null ? state.equals(that.state) : that.state == null; - } - - @Override - public int hashCode() { - int result = minZoom != null ? minZoom.hashCode() : 0; - result = 31 * result + (maxZoom != null ? maxZoom.hashCode() : 0); - result = 31 * result + (shapeForOfflineRegion != null ? shapeForOfflineRegion.hashCode() : 0); - result = 31 * result + (styleURL != null ? styleURL.hashCode() : 0); - result = 31 * result + (state != null ? state.hashCode() : 0); - result = 31 * result + (int) (sizeOfResourcesCompleted ^ (sizeOfResourcesCompleted >>> 32)); - result = 31 * result + (int) (numberOfTilesCompleted ^ (numberOfTilesCompleted >>> 32)); - return result; - } - - @Override - public String toString() { - return "OfflineDownloadEndEvent{" - + ", minZoom=" + minZoom - + ", maxZoom=" + maxZoom - + ", shapeForOfflineRegion='" + shapeForOfflineRegion + '\'' - + ", styleURL='" + styleURL + '\'' - + ", sizeOfResourcesCompleted=" + sizeOfResourcesCompleted - + ", numberOfTilesCompleted=" + numberOfTilesCompleted - + ", state=" + state - + '}'; - } -} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/OfflineDownloadStartEvent.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/OfflineDownloadStartEvent.java deleted file mode 100644 index 31f41ffc772..00000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/OfflineDownloadStartEvent.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.mapbox.mapboxsdk.module.telemetry; - -import android.annotation.SuppressLint; -import androidx.annotation.FloatRange; - -import com.mapbox.mapboxsdk.constants.MapboxConstants; - -/** - * Event will be sent while offline download start. - */ -@SuppressLint("ParcelCreator") -public class OfflineDownloadStartEvent extends MapBaseEvent { - private static final String EVENT_NAME = "map.offlineDownload.start"; - private final Double minZoom; - private final Double maxZoom; - private final String shapeForOfflineRegion; - private String styleURL; - - OfflineDownloadStartEvent(PhoneState phoneState, String shapeForOfflineRegion, - @FloatRange(from = MapboxConstants.MINIMUM_ZOOM, - to = MapboxConstants.MAXIMUM_ZOOM) Double minZoom, - @FloatRange(from = MapboxConstants.MINIMUM_ZOOM, - to = MapboxConstants.MAXIMUM_ZOOM) Double maxZoom) { - super(phoneState); - this.shapeForOfflineRegion = shapeForOfflineRegion; - this.minZoom = minZoom; - this.maxZoom = maxZoom; - } - - @Override - String getEventName() { - return EVENT_NAME; - } - - Double getMinZoom() { - return minZoom; - } - - Double getMaxZoom() { - return maxZoom; - } - - String getShapeForOfflineRegion() { - return shapeForOfflineRegion; - } - - String getStyleURL() { - return styleURL; - } - - void setStyleURL(String styleURL) { - this.styleURL = styleURL; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - OfflineDownloadStartEvent that = (OfflineDownloadStartEvent) o; - - if (minZoom != null ? !minZoom.equals(that.minZoom) : that.minZoom != null) { - return false; - } - if (maxZoom != null ? !maxZoom.equals(that.maxZoom) : that.maxZoom != null) { - return false; - } - if (shapeForOfflineRegion != null ? !shapeForOfflineRegion.equals(that.shapeForOfflineRegion) : - that.shapeForOfflineRegion != null) { - return false; - } - return styleURL != null ? styleURL.equals(that.styleURL) : that.styleURL == null; - } - - @Override - public int hashCode() { - int result = minZoom != null ? minZoom.hashCode() : 0; - result = 31 * result + (maxZoom != null ? maxZoom.hashCode() : 0); - result = 31 * result + (shapeForOfflineRegion != null ? shapeForOfflineRegion.hashCode() : 0); - result = 31 * result + (styleURL != null ? styleURL.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "OfflineDownloadStartEvent{" - + ", minZoom=" + minZoom - + ", maxZoom=" + maxZoom - + ", shapeForOfflineRegion='" + shapeForOfflineRegion + '\'' - + ", styleURL='" + styleURL + '\'' - + '}'; - } - -} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/PerformanceEvent.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/PerformanceEvent.java deleted file mode 100644 index 81079c2d97a..00000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/PerformanceEvent.java +++ /dev/null @@ -1,179 +0,0 @@ -package com.mapbox.mapboxsdk.module.telemetry; - -import android.annotation.SuppressLint; -import android.os.Bundle; - -import com.google.gson.Gson; -import com.google.gson.JsonObject; -import com.google.gson.reflect.TypeToken; - -import java.util.ArrayList; -import java.util.List; - -/** - * Generic Performance Event that can be used for performance measurements. - * Customer measurements can be added to the bundle. - *

- * Bundle is expected to have following properties: - * "attributes", "counters", and "metadata" with String values. - *

- *

- * Attributes: a string representing an array of name/string value pair objects. - * Counters: a string representing an array of name/number value pair objects. - * Metadata is a string representation of a JsonObject with string values. - *

- *

- * Here is an example of a Performance event bundle data: - *

- *

- * "attributes": [{ "name": "style_id", "value": "mapbox://styles/mapbox/streets-v10"}] - *

- *

- * "counters": [{"name": "fps_average", "value": 90.7655486547093}, - * {"name": "fps_deviation", "value": 29.301809631465574}] - * “metadata”: { - * “version”: “9”, - * “screenSize”: “1080x1794”, - * “country”: “US”, - * “device”: “Pixel 2”, - * “abi”: “arm64-v8a”, - * “brand”: “google”, - * “ram”: “3834167296”, - * “os”: “android”, - * “gpu”: “Qualcomm, Adreno (TM) 540, OpenGL ES 3.2 V@313.0 (GIT@7bf2852, Ie32bfa6f6f)“, - * “manufacturer”: “Google” - * } - *

- */ -@SuppressLint("ParcelCreator") -class PerformanceEvent extends MapBaseEvent { - private static final String PERFORMANCE_TRACE = "mobile.performance_trace"; - private final String sessionId; - private final List> attributes; - private final List> counters; - private final JsonObject metadata; - - PerformanceEvent(PhoneState phoneState, String sessionId, Bundle bundle) { - super(phoneState); - this.sessionId = sessionId; - this.attributes = initList(bundle.getString("attributes"), - new TypeToken>>() { - }); - this.counters = initList(bundle.getString("counters"), - new TypeToken>>() { - }); - this.metadata = initMetaData(bundle.getString("metadata")); - } - - private ArrayList> initList(String fromString, TypeToken typeToken) { - if (fromString == null || fromString.isEmpty()) { - return new ArrayList<>(); - } - return new Gson().fromJson(fromString, typeToken.getType()); - } - - private JsonObject initMetaData(String fromString) { - if (fromString == null) { - return new JsonObject(); - } else { - return new Gson().fromJson(fromString, JsonObject.class); - } - } - - @Override - String getEventName() { - return PERFORMANCE_TRACE; - } - - String getSessionId() { - return sessionId; - } - - List> getAttributes() { - return attributes; - } - - List> getCounters() { - return counters; - } - - JsonObject getMetadata() { - return metadata; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - PerformanceEvent that = (PerformanceEvent) o; - - if (sessionId != null ? !sessionId.equals(that.sessionId) : that.sessionId != null) { - return false; - } - if (attributes != null ? !attributes.equals(that.attributes) : that.attributes != null) { - return false; - } - if (counters != null ? !counters.equals(that.counters) : that.counters != null) { - return false; - } - return metadata != null ? metadata.equals(that.metadata) : that.metadata == null; - } - - @Override - public int hashCode() { - int result = sessionId != null ? sessionId.hashCode() : 0; - result = 31 * result + (attributes != null ? attributes.hashCode() : 0); - result = 31 * result + (counters != null ? counters.hashCode() : 0); - result = 31 * result + (metadata != null ? metadata.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "PerformanceEvent{" - + "sessionId='" + sessionId + '\'' - + ", attributes=" + attributes - + ", counters=" + counters - + ", metadata=" + metadata - + '}'; - } - - static class PerformanceAttribute { - private final String name; - private final T value; - - PerformanceAttribute(String name, T value) { - this.name = name; - this.value = value; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - PerformanceAttribute that = (PerformanceAttribute) o; - - if (name != null ? !name.equals(that.name) : that.name != null) { - return false; - } - return value != null ? value.equals(that.value) : that.value == null; - } - - @Override - public int hashCode() { - int result = name != null ? name.hashCode() : 0; - result = 31 * result + (value != null ? value.hashCode() : 0); - return result; - } - } -} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/PhoneState.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/PhoneState.java deleted file mode 100644 index ec0e1e17ab0..00000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/PhoneState.java +++ /dev/null @@ -1,171 +0,0 @@ -package com.mapbox.mapboxsdk.module.telemetry; - -import android.content.Context; -import android.content.res.Configuration; -import android.net.wifi.WifiInfo; -import android.net.wifi.WifiManager; -import androidx.annotation.NonNull; -import android.telephony.TelephonyManager; -import android.text.TextUtils; -import android.util.DisplayMetrics; -import android.view.WindowManager; - -import com.mapbox.android.telemetry.TelemetryUtils; - -/** - * Class that holds kinds of states of the current phone. - */ -class PhoneState { - private static final String NO_CARRIER = "EMPTY_CARRIER"; - private static final int NO_NETWORK = -1; - private String created; - private String cellularNetworkType; - private Orientation orientation; - private String carrier; - private int batteryLevel; - private boolean pluggedIn; - private boolean wifi; - private float accessibilityFontScale; - private float resolution; - - PhoneState() { - - } - - PhoneState(@NonNull Context context) { - this.created = TelemetryUtils.obtainCurrentDate(); - this.batteryLevel = TelemetryUtils.obtainBatteryLevel(context); - this.pluggedIn = TelemetryUtils.isPluggedIn(context); - this.cellularNetworkType = TelemetryUtils.obtainCellularNetworkType(context); - this.orientation = Orientation.getOrientation(context.getResources().getConfiguration().orientation); - this.accessibilityFontScale = context.getResources().getConfiguration().fontScale; - this.carrier = obtainCellularCarrier(context); - this.resolution = obtainDisplayDensity(context); - this.wifi = isConnectedToWifi(context); - } - - private String obtainCellularCarrier(@NonNull Context context) { - TelephonyManager manager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); - if (manager == null) { - return NO_CARRIER; - } - String carrierName = manager.getNetworkOperatorName(); - if (TextUtils.isEmpty(carrierName)) { - return NO_CARRIER; - } - return carrierName; - } - - private float obtainDisplayDensity(@NonNull Context context) { - DisplayMetrics displayMetrics = new DisplayMetrics(); - ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(displayMetrics); - return displayMetrics.density; - } - - private boolean isConnectedToWifi(@NonNull Context context) { - try { - WifiManager wifiMgr = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE); - if (wifiMgr == null) { - return false; - } - //noinspection MissingPermission - WifiInfo wifiInfo = wifiMgr.getConnectionInfo(); - return wifiMgr.isWifiEnabled() && wifiInfo.getNetworkId() != NO_NETWORK; - } catch (Exception exception) { - return false; - } - } - - String getCreated() { - return created; - } - - void setCreated(String created) { - this.created = created; - } - - int getBatteryLevel() { - return batteryLevel; - } - - void setBatteryLevel(int batteryLevel) { - this.batteryLevel = batteryLevel; - } - - boolean isPluggedIn() { - return pluggedIn; - } - - void setPluggedIn(boolean pluggedIn) { - this.pluggedIn = pluggedIn; - } - - String getCellularNetworkType() { - return cellularNetworkType; - } - - void setCellularNetworkType(String cellularNetworkType) { - this.cellularNetworkType = cellularNetworkType; - } - - String getOrientation() { - return orientation.getOrientation(); - } - - void setOrientation(Orientation orientation) { - this.orientation = orientation; - } - - String getCarrier() { - return carrier; - } - - void setCarrier(String carrier) { - this.carrier = carrier; - } - - boolean isWifi() { - return wifi; - } - - void setWifi(boolean wifi) { - this.wifi = wifi; - } - - float getAccessibilityFontScale() { - return accessibilityFontScale; - } - - void setAccessibilityFontScale(float accessibilityFontScale) { - this.accessibilityFontScale = accessibilityFontScale; - } - - float getResolution() { - return resolution; - } - - void setResolution(float resolution) { - this.resolution = resolution; - } - - enum Orientation { - ORIENTATION_PORTRAIT("Portrait"), - ORIENTATION_LANDSCAPE("Landscape"); - private String orientation; - - Orientation(String orientation) { - this.orientation = orientation; - } - - public static Orientation getOrientation(int index) { - if (Configuration.ORIENTATION_PORTRAIT == index) { - return ORIENTATION_PORTRAIT; - } - return ORIENTATION_LANDSCAPE; - } - - public String getOrientation() { - return orientation; - } - } -} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/TelemetryImpl.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/TelemetryImpl.java deleted file mode 100644 index 0b0a262541f..00000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/TelemetryImpl.java +++ /dev/null @@ -1,136 +0,0 @@ -package com.mapbox.mapboxsdk.module.telemetry; - -import android.content.Context; -import android.os.Bundle; -import androidx.annotation.FloatRange; -import androidx.annotation.NonNull; - -import com.mapbox.android.accounts.v1.MapboxAccounts; -import com.mapbox.android.telemetry.AppUserTurnstile; -import com.mapbox.android.telemetry.MapboxTelemetry; -import com.mapbox.android.telemetry.SessionInterval; -import com.mapbox.android.telemetry.TelemetryEnabler; -import com.mapbox.mapboxsdk.BuildConfig; -import com.mapbox.mapboxsdk.Mapbox; -import com.mapbox.mapboxsdk.constants.MapboxConstants; -import com.mapbox.mapboxsdk.maps.TelemetryDefinition; -import com.mapbox.mapboxsdk.offline.OfflineRegionDefinition; -import com.mapbox.mapboxsdk.offline.OfflineTilePyramidRegionDefinition; - -import java.util.UUID; - -public class TelemetryImpl implements TelemetryDefinition { - - private final MapboxTelemetry telemetry; - private final Context appContext; - - public TelemetryImpl() { - appContext = Mapbox.getApplicationContext(); - String accessToken = Mapbox.getAccessToken(); - telemetry = new MapboxTelemetry(appContext, accessToken, BuildConfig.MAPBOX_EVENTS_USER_AGENT); - TelemetryEnabler.State telemetryState = TelemetryEnabler.retrieveTelemetryStateFromPreferences(); - if (TelemetryEnabler.State.ENABLED.equals(telemetryState)) { - telemetry.enable(); - } - } - - /** - * Register the app user turnstile event - */ - @Override - public void onAppUserTurnstileEvent() { - AppUserTurnstile turnstileEvent = new AppUserTurnstile(BuildConfig.MAPBOX_SDK_IDENTIFIER, - BuildConfig.MAPBOX_SDK_VERSION); - turnstileEvent.setSkuId(MapboxAccounts.SKU_ID_MAPS_MAUS); - telemetry.push(turnstileEvent); - telemetry.push(MapEventFactory.buildMapLoadEvent(new PhoneState(appContext))); - } - - /** - * Register an end-user gesture interaction event. - * - * @param eventType type of gesture event occurred - * @param latitude the latitude value of the gesture focal point - * @param longitude the longitude value of the gesture focal point - * @param zoom current zoom of the map - * @deprecated since 7.5.0, this event is no longer supported - */ - @Deprecated - @Override - public void onGestureInteraction(String eventType, double latitude, double longitude, - @FloatRange(from = MapboxConstants.MINIMUM_ZOOM, - to = MapboxConstants.MAXIMUM_ZOOM) double zoom) { - //no-op - } - - /** - * Set the end-user selected state to participate or opt-out in telemetry collection. - * - * @param enabledTelemetry true if enabled, false otherwise - */ - @Override - public void setUserTelemetryRequestState(boolean enabledTelemetry) { - if (enabledTelemetry) { - TelemetryEnabler.updateTelemetryState(TelemetryEnabler.State.ENABLED); - telemetry.enable(); - } else { - telemetry.disable(); - TelemetryEnabler.updateTelemetryState(TelemetryEnabler.State.DISABLED); - } - } - - @Override - public void disableTelemetrySession() { - telemetry.disable(); - } - - /** - * Set the debug logging state of telemetry. - * - * @param debugLoggingEnabled true to enable logging - */ - @Override - public void setDebugLoggingEnabled(boolean debugLoggingEnabled) { - telemetry.updateDebugLoggingEnabled(debugLoggingEnabled); - } - - /** - * Set the telemetry rotation session id interval - * - * @param interval the selected session interval - * @return true if rotation session id was updated - */ - @Override - public boolean setSessionIdRotationInterval(int interval) { - return telemetry.updateSessionIdRotationInterval(new SessionInterval(interval)); - } - - /** - * Register an offline region creation event. - * - * @param offlineDefinition the offline region definition - */ - @Override - public void onCreateOfflineRegion(@NonNull OfflineRegionDefinition offlineDefinition) { - telemetry.push(MapEventFactory.buildOfflineDownloadStartEvent(new PhoneState(appContext), - offlineDefinition instanceof OfflineTilePyramidRegionDefinition ? "tileregion" : "shaperegion", - offlineDefinition.getMinZoom(), - offlineDefinition.getMaxZoom(), - offlineDefinition.getStyleURL()) - ); - } - - /** - * Register a performance event - * - * @param data performance event data - */ - @Override - public void onPerformanceEvent(Bundle data) { - if (data == null) { - data = new Bundle(); - } - telemetry.push(MapEventFactory.buildPerformanceEvent(new PhoneState(appContext), - UUID.randomUUID().toString(), data)); - } -} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/package-info.java deleted file mode 100644 index c77612bed46..00000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/module/telemetry/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Contains the Mapbox Maps Android Modular Telemetry API classes. - */ -package com.mapbox.mapboxsdk.module.telemetry; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java index 5d0d33da3b3..fb0446a94a9 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java @@ -13,7 +13,6 @@ import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.geometry.LatLngBounds; -import com.mapbox.mapboxsdk.maps.TelemetryDefinition; import com.mapbox.mapboxsdk.net.ConnectivityReceiver; import com.mapbox.mapboxsdk.storage.FileSource; import com.mapbox.mapboxsdk.utils.FileUtils; @@ -642,12 +641,6 @@ public void run() { }); } }); - - TelemetryDefinition telemetry = Mapbox.getTelemetry(); - if (telemetry != null) { - LatLngBounds bounds = definition.getBounds(); - telemetry.onCreateOfflineRegion(definition); - } } /** diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegionDefinition.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegionDefinition.java index 1b29800c3dd..54a06c3e967 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegionDefinition.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegionDefinition.java @@ -63,7 +63,7 @@ public interface OfflineRegionDefinition extends Parcelable { boolean getIncludeIdeographs(); /** - * Gets the type of the OfflineRegionDefinition for telemetry ("tileregion", "shaperegion"). + * Gets the type of the OfflineRegionDefinition ("tileregion", "shaperegion"). * * @return The type of the OfflineRegionDefinition. */ diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotter.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotter.java index 40a8532e9e2..60482cd6cc6 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotter.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/snapshotter/MapSnapshotter.java @@ -25,7 +25,6 @@ import com.mapbox.mapboxsdk.log.Logger; import com.mapbox.mapboxsdk.maps.Image; import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.mapboxsdk.maps.TelemetryDefinition; import com.mapbox.mapboxsdk.storage.FileSource; import com.mapbox.mapboxsdk.style.layers.Layer; import com.mapbox.mapboxsdk.style.sources.Source; @@ -391,10 +390,7 @@ public MapSnapshotter(@NonNull Context context, @NonNull Options options) { checkThread(); this.context = context.getApplicationContext(); this.options = options; - TelemetryDefinition telemetry = Mapbox.getTelemetry(); - if (telemetry != null) { - telemetry.onAppUserTurnstileEvent(); - } + FileSource fileSource = FileSource.getInstance(context); String apiBaseUrl = options.getApiBaseUrl(); if (!TextUtils.isEmpty(apiBaseUrl)) { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml b/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml index a5e759f6c13..95dbebdd8a8 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml @@ -95,12 +95,6 @@ - - - - - - diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values-bg/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values-bg/strings.xml index 262e94f368f..0b0b1ebe3f5 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values-bg/strings.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values-bg/strings.xml @@ -5,11 +5,6 @@ Изглед локация. Това показва местоположението ти на картата. Показва карта създадена с Mapbox. Скролни с два пръста. Мащабирай с два пръста. Mapbox Android SDK - Направи Mapbox картите по-добри. - Помагаш OpenStreetMap и Mapbox картите да станат по-добри, като предоставяш анонимни данни за потребление. - Съгласявам се - Не се съгласявам - Повече инфо Предоставените OfflineRegionDefinition не пасват в границите на света: %s diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values-ca/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values-ca/strings.xml index 6ed788d1dcd..b76b16692e0 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values-ca/strings.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values-ca/strings.xml @@ -5,11 +5,6 @@ Vista de posició. Mostra la teva posició al mapa. Mostrant un mapa creat amb Mapbox. Desplaça’t arrossegant amb dos dits. Fes zoom pessigant amb dos dits. Mapbox Android SDK - Millora els mapes de Mapbox - Estàs ajudant a millorar els mapes d’OpenStreetMap i de Mapbox aportant dades d’ús anònimes. - D’acord - Disconforme - Més informació La OfflineRegionDefinition proporcionada no encaixa amb els límits del món: %s diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values-cs/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values-cs/strings.xml index 7b7554419d5..1e4193301ec 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values-cs/strings.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values-cs/strings.xml @@ -5,13 +5,6 @@ Zobrazení polohy. Zobrazit umístění na mapě. Zobrazení mapy vytvořené s Mapbox. Posunout tažením dvěma prsty. Změnit velikost roztažením dvou prstů. Mapbox Maps SDK pro Android - Udělejte mapy Mapbox lepšími - Pomozte udělat OpenStreetMap a Mapbox mapy lepšími poskytnutím anonymních dat o využití. - Souhlasit - Odmítnout - Více informací Na zařízení není nainstalován webový prohlížeč, webovou stránku nelze zobrazit. Pokud OfflineRegionDefinition neodpovídá hranicím: %s - Vylepšit tuto mapu - Nastavení telemetrie \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values-es/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values-es/strings.xml index 8797383233c..36e41c0516b 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values-es/strings.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values-es/strings.xml @@ -5,13 +5,6 @@ Vista de ubicación. Muestra tu ubicación en el mapa. Se está mostrando un mapa creado con Mapbox. Arrastra dos dedos para desplazarte o pellizca para acercar. Mapbox Maps SDK para Android - Ayúdanos a mejorar los mapas de Mapbox - Gracias a tu contribución de datos anónimos de uso, ayudas a mejorar OpenStreetMap y Mapbox. - Aceptar - Rechazar - Más información No puede abrir la página Web porque no hay un navegador Web en el dispositivo. El parámetro OfflineRegionDefinition que se ingresó no coincide con los límites mundiales: %s - Mejorar este mapa - Ajustes de telemetría diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values-fr/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values-fr/strings.xml index 67b5b21072f..1373ad338c3 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values-fr/strings.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values-fr/strings.xml @@ -5,13 +5,6 @@ Vue de géolocalisation. Ceci affiche votre localisation sur la carte. Affichage d’une carte créée avec Mapbox. Faites la glisser en traînant deux doigts. Zoomez ou dézoomez en écartant ou rapprochant deux doigts. SDK Mapbox Maps pour Android - Faire de meilleures cartes Mapbox - Vous aidez à améliorer les cartes OpenStreetMap et Mapbox en contribuant des données d\'utilisation anonymes. - D’accord - Pas d’accord - Plus d’informations Aucun navigateur web installé sur l’appareil, impossible d’ouvrir une page web. Le cadre OfflineRegionDefinition pour définir la région de navigation ne tient pas dans les limites du monde : %s - Améliorer cette carte - Paramètres de télémétrie \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values-gl/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values-gl/strings.xml index 1f8f660d111..09d0297ad3a 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values-gl/strings.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values-gl/strings.xml @@ -5,13 +5,6 @@ Vista de ubicación. Amosa a túa ubicación no mapa. Estase a amosar un mapa feito co Mapbox. Belisca dous dedos para desprazarte ou belisca para achegar. Mapbox Maps SDK para o Android - Axúdanos a mellorar os mapas do Mapbox - Grazas á túa contribución de datos anónimos de emprego, axudas a mellorar o OpenStreetMap e o Mapbox. - Dacordo - Rexeitar - Máis información Non podes abrir a páxina web porque non hai un navegador web no dispositivo. O parámetro OfflineRegionDefinition que se ingresou non coincide cos límites mundiais: %s - Mellorar este mapa - Axustes da telemetría \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values-he/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values-he/strings.xml index 11b20f5dc5d..1b127ea5eb9 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values-he/strings.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values-he/strings.xml @@ -5,12 +5,6 @@ סמן מיקום. מציג את המיקום הנוכחי שלך על המפה. מציג מפה שנוצרה עם Mapbox. גלול באמצעות גרירה עם שתי אצבעות, זום באמצעות צביטה עם שתי אצבעות. Mapbox Maps SDK for Android - שפר את המפות של Mapbox  - אתם מסייעים לשפר את המפות של OpenStreetMap ו Mapbox באמצעות שיתוף אנונימי של נתוני השימוש. - מסכים/מה - לא מסכים/מה - מידע נוסף לא מותקן דפדפן אינטרנט במכשיר, לא ניתן לפתוח את דף האינטרנט. בתנאי ש- OfflineRegionDefinition אינו מתאים לגבולות העולם: %s - הגדרות טלמטריות diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values-hu/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values-hu/strings.xml index 24ade1ba848..8156b444ab1 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values-hu/strings.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values-hu/strings.xml @@ -3,13 +3,6 @@ Hely nézet. Megmutatja, hol vagy a térképen. Egy Mapbox-szal készült térkép megjelenítése. Húzd két ujjadat a görgetéshez. Csippentsd össze a nagyításhoz. Mapbox Maps SDK Androidhoz - Tedd jobbá a Mapbox térképeket - Segítesz az OpenStreetMap és Mapbox térképek jobbá tételében névtelen felhasználási adatok elküldésével. - Egyetértek - Nem értek egyet - Több infó Nincs webböngésző telepítve a készüléken, nem lehet megnyitni weboldalt. A megadott OfflineRegionDefinition nem fér bele a világ kereteibe: %s - Tedd jobbá ezt a térképet - Telemetria beállítások \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values-iw/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values-iw/strings.xml index 11b20f5dc5d..1b127ea5eb9 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values-iw/strings.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values-iw/strings.xml @@ -5,12 +5,6 @@ סמן מיקום. מציג את המיקום הנוכחי שלך על המפה. מציג מפה שנוצרה עם Mapbox. גלול באמצעות גרירה עם שתי אצבעות, זום באמצעות צביטה עם שתי אצבעות. Mapbox Maps SDK for Android - שפר את המפות של Mapbox  - אתם מסייעים לשפר את המפות של OpenStreetMap ו Mapbox באמצעות שיתוף אנונימי של נתוני השימוש. - מסכים/מה - לא מסכים/מה - מידע נוסף לא מותקן דפדפן אינטרנט במכשיר, לא ניתן לפתוח את דף האינטרנט. בתנאי ש- OfflineRegionDefinition אינו מתאים לגבולות העולם: %s - הגדרות טלמטריות diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values-ko/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values-ko/strings.xml index a292e52517b..1f503d5b50c 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values-ko/strings.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values-ko/strings.xml @@ -5,12 +5,6 @@ 로케이션 뷰. 지도에서 현재 위치를 보여줍니다. 맵박스로 생성된 지도 표시. 두 손가락으로 드래그하여 화면을 위 아래로 움직이세요. 두 손가락을 이용해 화면을 확대 축소 하세요. 안드로이드를 위한 맵박스 맵 SDK - 더 나은 맵박스 지도 만들기 - 당신은 익명의 사용 데이터를 제공함으로써, 오픈스트리트맵과 맵박스 향상에 기여하고 있습니다. - 동의 - 비동의 - 추가정보 웹 브라우저가 설치 되어 있지 않아, 웹 페이지를 열 수 없습니다. 제공된 오프라인지역정의가 월드바운즈에 적합하지 않습니다: %s - 원격 측정 설정 diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values-lt/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values-lt/strings.xml index e01be03352d..08e218a7c4a 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values-lt/strings.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values-lt/strings.xml @@ -5,11 +5,6 @@ Vartotojo vietos vaizdas. Nurodo tavo poziciją žemėlapyje Rodomas Mapbox kurtas žemėlapis. Naviguok tempdamas du pirštus. Valdyk žemėlapio pritraukimą suimdamas/atitolindamas du pirštus. Mapbox Android SDK - Prisidėk prie Mapbox žemėlapių tobulinimo - Jūs padedate padaryti OpenStreetMap ir Mapbox žemėlapius geresniais dalindamiesi anoniminiais naudojimosi duomenimis. - Sutikti - Nesutikti - Daugiau informacijos Pasirinktas OfflineRegionDefinition netalpa į rėžius: %s diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values-nl/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values-nl/strings.xml index f1fcf837eac..7bd8d98b0d3 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values-nl/strings.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values-nl/strings.xml @@ -5,11 +5,6 @@ Locatie Element. Dit toont jouw locatie op de map. Toont een map gemaakt met Mapbox. Scroll door het slepen met twee vingers. Zoom door vingers te nijpen. Mapbox Android SDK - Maak Mapbox Maps beter - U helpt OpenStreetMap en Mapbox maps te verbeteren door het bijdragen van anonieme gebruikersgegevens. - Toestemmen - Intrekken - Meer informatie Aangeleverde OfflineRegionDefinition past niet in de wereld omtrek: %s diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values-pl/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values-pl/strings.xml index 401fae8b347..77b0817c147 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values-pl/strings.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values-pl/strings.xml @@ -5,13 +5,6 @@ Widok lokalizacji. Pokazuje twoją pozycję na mapie. Pokazuje mapę stworzoną za pomocą biblioteki Mapbox. Przesuń mapę za pomocą przeciągnięcia dwoma palcami. Przybliż za pomocą uszczypnięcia dwoma palcami. Mapbox Maps SDK dla Androida - Pomoż ulepszyć mapy Mapbox - Pomagasz ulepszyć mapy OpenStreetMap oraz Mapbox poprzez udostępnianie anonimowych danych użytkowania. - Zgadzam się - Nie zgadzam się - Więcej informacji Nie potrafię otworzyć strony, brak przeglądarki internetowej zainstalowanej na urządzeniu. Wymagany region nie mieści się w granicach świata: %s - Ulepsz tą mapę - Ustawienia telemetrii \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values-pt-rPT/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values-pt-rPT/strings.xml index 02941aab5a8..18b9ecc5718 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values-pt-rPT/strings.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values-pt-rPT/strings.xml @@ -5,12 +5,6 @@ Vista de localização. Isto mostra a sua localização no mapa. A mostrar um Mapa criado com Mapbox. Desloque arrastanto com 2 dedos. Zoom afastando ou aproximando os 2 dedos. Mapas Mapbox SDK para Android - Torne os Mapas Mapbox Melhores - Está a ajudar a tornar os mapas OpenStreetMap e Mapbox melhores contribuindo com dados de utilização tornados anónimos. - Concordo - Não concordo - Mais informações Não está nenhum navegador de Internet instalado no dispositivo. Não é possível abrir a página web. O OfflineRegionDefinition não cabe nos limites do mundo: %s - Definições de Telemetria diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values-ru/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values-ru/strings.xml index a274125257a..8bca5dcc3e9 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values-ru/strings.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values-ru/strings.xml @@ -5,12 +5,6 @@ Местоположение. Отображает вашу позицию на карте. Отображает карту, созданную при помощи Mapbox. Пролистывайте двумя пальцами. Меняйте масштаб сведением пальцев. Mapbox Maps SDK для Android - Сделать карты Mapbox лучше - Вы помогаете улучшать карты OpenStreetMap и Mapbox, предоставляя обезличенные данные об использовании. - Согласен - Не согласен - Дополнительная информация На устройстве нет веб-браузера, нельзя показать веб-страницу. Запрошенный OfflineRegionDefinition не входит в допустимые границы: %s - Настройки телеметрии diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values-sv/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values-sv/strings.xml index 9537299a729..6c546305c07 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values-sv/strings.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values-sv/strings.xml @@ -5,12 +5,6 @@ Positionsvy. Denna visar din position på kartan. Visar en karta skapad med Mapbox. Scrolla genom att dra med två fingrar. Zooma genom att nypa med två fingrar. Mapbox Maps SDK for Android - Gör Mapbox kartor bättre - Du hjälper till att göra OpenStreetMap och Mapbox karttjänster bättre genom att bidra med anonymiserad användningsdata. - Godkänn - Avböj - Visa mer information Ingen webbläsare installerad på enheten. Kan inte visa sidan. Försedd OfflineRegionDefinition passar inte världens gränser: %s - Telemetri-inställningar diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values-uk/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values-uk/strings.xml index 17e13a1fe65..83feddd6264 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values-uk/strings.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values-uk/strings.xml @@ -5,12 +5,6 @@ Визначення положення. Показує ваше місцеположення на мапі. Показує мапи створені за допомоги Mapbox. Пересувайте мапу двома пальцями. Змінюйте масштаб стуляючи/розводячи два пальці. Mapbox Maps SDK для Android - Допоможіть зробити мапи Mapbox краще - Ви допомагаєте робити мапи OpenStreetMap та Mapbox краще пощирюючи анонімні дані про користування мапами. - Погоджуюсь - Не погоджуюсь - Додаткова інформація Веб-оглядач відсутній на цьому пристрої, неможливо відкрити веб-сторінку Межі ділянки для оффлайнового користування даними за межами світу: %s - Налаштування телеметрії diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values-vi/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values-vi/strings.xml index 7b6f72fe7fc..1a894402518 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values-vi/strings.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values-vi/strings.xml @@ -5,13 +5,6 @@ Cái chỉ vị trí. Cái này chỉ vị trí của bạn trên bản đồ. Đang xem bản đồ được xây dựng dùng Mapbox. Kéo hai ngón tay để cuộn. Chụm các ngón tay lại để phóng to. Tách các ngón tay ra để thu nhỏ. Mapbox Maps SDK cho Android - Cải tiến các Bản đồ Mapbox - Bạn đang giúp cải tiến các bản đồ OpenStreetMap và Mapbox bằng cách đóng góp dữ liệu vô danh hóa về cách sử dụng. - Đồng ý - Phản đối - Thông tin thêm Không thể mở trang Web vì thiết bị thiếu trình duyệt. OfflineRegionDefinition được cung cấp không vừa thế giới: %s - Cải thiện Bản đồ này - Thiết lập Trình viễn trắc diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values-zh-rCN/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values-zh-rCN/strings.xml index 0f489f50119..e25d4c1fc45 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values-zh-rCN/strings.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values-zh-rCN/strings.xml @@ -5,13 +5,6 @@ 定位视图,在地图上显示当前位置。 显示由Mapbox创建的地图,通过拖动两个手指来滚动,捏两个手指来放大。 Mapbox Maps SDK for Android - 让Mapbox地图变得更好 - 您的匿名数据帮助OpenStreetMap和Mapbox的地图变得更好。 - 继续参与 - 不再参与 - 更多信息 设备中未安装任何浏览器,不能打开该网页 提供的OfflineRegionDefinition不符合标准地理范围:%s - 完善地图 - Telemetry设置 diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values-zh-rHK/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values-zh-rHK/strings.xml index 082f137ed00..34ad345494e 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values-zh-rHK/strings.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values-zh-rHK/strings.xml @@ -5,13 +5,6 @@ 定位視圖,在地圖上顯示當前位置。 顯示由Mapbox創建的地圖,通過拖動兩個手指來滾動,捏兩個手指來放大。 Mapbox Maps SDK for Android - 讓Mapbox地圖變得更好 - 您的匿名數據幫助OpenStreetMap和Mapbox的地圖變得更好。 - 繼續參與 - 不再參與 - 更多信息 設備中未安裝任何瀏覽器,不能打開該網頁 提供的OfflineRegionDefinition不符合標準地理範圍:%s - 完善地圖 - Telemetry設置 diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values-zh-rTW/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values-zh-rTW/strings.xml index 082f137ed00..34ad345494e 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values-zh-rTW/strings.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values-zh-rTW/strings.xml @@ -5,13 +5,6 @@ 定位視圖,在地圖上顯示當前位置。 顯示由Mapbox創建的地圖,通過拖動兩個手指來滾動,捏兩個手指來放大。 Mapbox Maps SDK for Android - 讓Mapbox地圖變得更好 - 您的匿名數據幫助OpenStreetMap和Mapbox的地圖變得更好。 - 繼續參與 - 不再參與 - 更多信息 設備中未安裝任何瀏覽器,不能打開該網頁 提供的OfflineRegionDefinition不符合標準地理範圍:%s - 完善地圖 - Telemetry設置 diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values/strings.xml index e818cf88fd0..82e01f1b507 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values/strings.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values/strings.xml @@ -5,16 +5,8 @@ Location View. This shows your location on the map. Showing a Map created with Mapbox. Scroll by dragging two fingers. Zoom by pinching two fingers. Mapbox Maps SDK for Android - Make Mapbox Maps Better - You are helping to make OpenStreetMap and Mapbox maps better by contributing anonymous usage data. - Agree - Disagree - More info No web browser installed on device, can\'t open web page. Provided OfflineRegionDefinition doesn\'t fit the world bounds: %s - Improve This Map - Telemetry Settings - https://www.mapbox.com/telemetry/