-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathAVOAppDelegate.m
48 lines (35 loc) · 1.52 KB
/
AVOAppDelegate.m
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
//
// AVOAppDelegate.m
// IosAnalyticsDebugger
//
// Copyright (c) 2019. All rights reserved.
//
#import "AVOAppDelegate.h"
#import "Avo.h"
#import "AVODatascopeDestination.h"
static AnalyticsDebugger *debugger = nil;
@implementation AVOAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
if (debugger == nil) {
debugger = [AnalyticsDebugger new];
}
[Avo initAvoWithEnv:AVOEnvDev customDestination:[AVODatascopeDestination new] debugger:debugger];
[Avo appOpened];
[self sendTestEventToDebugger];
return YES;
}
- (void)sendTestEventToDebugger
{
NSMutableArray * props = [NSMutableArray new];
[props addObject:[[DebuggerProp alloc] initWithId:@"id0" withName:@"Property with error" withValue:@"unknown"]];
[props addObject:[[DebuggerProp alloc] initWithId:@"id1" withName:@"Good property" withValue:@"true"]];
NSMutableArray * errors = [NSMutableArray new];
[errors addObject:[[DebuggerPropError alloc] initWithPropertyId:@"id0" withMessage:@"'Unknown' value is not supported in this property. 'Unknown' value is not supported in this property. 'Unknown' value is not supported in this property. 'Unknown' value is not supported in this property."]];
[debugger publishEvent:@"Event with Error" withTimestamp:[NSNumber numberWithDouble:[[NSDate date] timeIntervalSince1970]]
withProperties:props withErrors:errors];
}
+ (AnalyticsDebugger *) debugger {
return debugger;
}
@end