forked from orta/ARAnalytics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathARAnalyticalProvider.m
More file actions
85 lines (65 loc) · 3.18 KB
/
ARAnalyticalProvider.m
File metadata and controls
85 lines (65 loc) · 3.18 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//
// ARAnalyticalProvider.h
// Art.sy
//
// Created by orta therox on 18/12/2012.
// Copyright (c) 2012 Art.sy. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "ARAnalyticalProvider.h"
static NSString *const ARTimingEventLengthKey = @"length";
@implementation ARAnalyticalProvider
- (id)initWithIdentifier:(NSString *)identifier {
return [super init];
}
- (void)identifyUserWithID:(NSString *)userID andEmailAddress:(NSString *)email {}
- (void)setUserProperty:(NSString *)property toValue:(NSString *)value {}
- (void)addSuperProperties:(NSDictionary *)properties {}
- (void)removeSuperProperty:(NSString *)propertyName {}
- (void)clearSuperProperties {}
- (void)event:(NSString *)event withProperties:(NSDictionary *)properties {}
- (void)incrementUserProperty:(NSString *)counterName byInt:(NSNumber *)amount {}
- (void)error:(NSError *)error withMessage:(NSString *)message {
NSAssert(error, @"NSError instance has to be supplied");
if(!message){
message = (error.localizedFailureReason) ? error.localizedFailureReason : @"Error";
}
NSString *empty = @"(empty)";
[self event:message withProperties:@{
@"failureReason" : (error.localizedFailureReason) ? error.localizedFailureReason : empty,
@"description" : (error.localizedDescription) ? error.localizedDescription : empty,
@"recoverySuggestion" : (error.localizedRecoverySuggestion) ? error.localizedRecoverySuggestion : empty,
@"recoveryOptions" : ([error.localizedRecoveryOptions isKindOfClass:NSArray.class]) ? [error.localizedRecoveryOptions componentsJoinedByString:@", "] : empty
}];
}
- (void)monitorNavigationViewController:(UINavigationController *)controller {}
- (void)logTimingEvent:(NSString *)event withInterval:(NSNumber *)interval {
[self logTimingEvent:event withInterval:interval properties:nil];
}
- (void)logTimingEvent:(NSString *)event withInterval:(NSNumber *)interval properties:(NSDictionary *)properties {
if (properties[ARTimingEventLengthKey]) {
NSString *warning = [NSString stringWithFormat:@"Properties for timing event '%@' contains a key that clashes with the key used for reporting the length: %@", event, ARTimingEventLengthKey];
NSLog(@"%@", warning);
NSAssert(properties[ARTimingEventLengthKey], @"%@", warning);
}
NSMutableDictionary *mutableProperties = [NSMutableDictionary dictionaryWithDictionary:properties];
mutableProperties[ARTimingEventLengthKey] = interval;
[self event:event withProperties:mutableProperties];
}
- (void)didShowNewPageView:(NSString *)pageTitle {
[self didShowNewPageView:pageTitle withProperties:nil];
}
- (void)didShowNewPageView:(NSString *)pageTitle withProperties:(NSDictionary *)properties {
NSDictionary *propertiesToSend;
if (properties != nil) {
NSMutableDictionary *combined = [NSMutableDictionary dictionaryWithCapacity:properties.count];
[combined setObject:pageTitle forKey:@"screen"];
[combined addEntriesFromDictionary:properties];
propertiesToSend = combined;
} else {
propertiesToSend = @{@"screen": pageTitle};
}
[self event:@"Screen view" withProperties:propertiesToSend];
}
- (void)remoteLog:(NSString *)parsedString {}
@end