@@ -30,21 +30,28 @@ import TreasureData_tvOS_SDK
30
30
31
31
enum Tracker {
32
32
33
- private static let name = " icook_tvos "
33
+ static let defaultDatabase = " icook_tvos "
34
+ static let sessionsTable = " sessions "
34
35
35
36
static func track( pageView: PageView ) {
36
37
dispatch_async ( dispatch_get_global_queue ( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0 ) ) {
37
38
Debug . print ( pageView)
38
39
Answers . logCustomEventWithName ( pageView. name, customAttributes: pageView. details)
39
- TreasureData . sharedInstance ( ) . addEvent ( pageView. attributes, database: name, table: " screens " )
40
+ TreasureData . sharedInstance ( ) . addEvent ( pageView. attributes, database: defaultDatabase, table: " screens " )
41
+ #if DEBUG
42
+ TreasureData . sharedInstance ( ) . uploadEvents ( )
43
+ #endif
40
44
}
41
45
}
42
46
43
47
static func track( event: Event ) {
44
48
dispatch_async ( dispatch_get_global_queue ( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0 ) ) {
45
49
Debug . print ( event)
46
50
Answers . logCustomEventWithName ( event. name, customAttributes: event. details)
47
- TreasureData . sharedInstance ( ) . addEvent ( event. attributes, database: name, table: " events " )
51
+ TreasureData . sharedInstance ( ) . addEvent ( event. attributes, database: defaultDatabase, table: " events " )
52
+ #if DEBUG
53
+ TreasureData . sharedInstance ( ) . uploadEvents ( )
54
+ #endif
48
55
}
49
56
}
50
57
@@ -60,7 +67,10 @@ enum Tracker {
60
67
" description " : description,
61
68
" function " : " \( file. typeName) . \( function) " ,
62
69
" line " : line
63
- ] , database: name, table: " errors " )
70
+ ] , database: defaultDatabase, table: " errors " )
71
+ #if DEBUG
72
+ TreasureData . sharedInstance ( ) . uploadEvents ( )
73
+ #endif
64
74
}
65
75
}
66
76
0 commit comments