blob: 27d45c761572e44cbbb489e6fab9d2a77404ecea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#import "MBXAppDelegate.h"
#import "MBXViewController.h"
#import <Mapbox/Mapbox.h>
@interface MBXAppDelegate() <MGLMetricsManagerDelegate>
@end
@implementation MBXAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
#ifndef MGL_DISABLE_LOGGING
[MGLLoggingConfiguration sharedConfiguration].loggingLevel = MGLLoggingLevelFault;
#endif
[[MGLOfflineStorage sharedOfflineStorage] setMaximumAmbientCacheSize:30 withCallback:^(NSError * _Nullable error) {
if (!error) {
NSLog(@"Maximum ambient cache size: 30");
}
}];
[MGLMetricsManager sharedManager].delegate = self;
return YES;
}
#pragma mark - Quick actions
- (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL))completionHandler {
completionHandler([self handleShortcut:shortcutItem]);
}
- (BOOL)handleShortcut:(UIApplicationShortcutItem *)shortcut {
if ([[shortcut.type componentsSeparatedByString:@"."].lastObject isEqual:@"settings"]) {
dispatch_async(dispatch_get_main_queue(), ^{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
});
return YES;
}
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
|