summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLEventsManager.m
blob: 3790f55c2646a922f75159c96aef99a657679416 (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
#import "MGLEventsManager_Private.h"
#if TARGET_OS_IOS
#import "MGLMapboxEvents.h"
#endif

@implementation MGLEventsManager

+ (instancetype)sharedManager
{
    static dispatch_once_t once;
    static id sharedConfiguration;
    dispatch_once(&once, ^{
        sharedConfiguration = [[self alloc] init];
    });
    return sharedConfiguration;
}

- (void)handleEvent:(NSString *)eventName withAttributes:(NSDictionary *)attributes {
#if TARGET_OS_IOS
    [MGLMapboxEvents pushEvent:eventName withAttributes:attributes];
#endif
    if (self.shouldHandleEvents && self.handler) {
        self.handler(eventName, attributes);
    }
}

@end