Skip to content

Commit

Permalink
Release 1.6.15
Browse files Browse the repository at this point in the history
  • Loading branch information
wangzhzh committed Sep 29, 2016
1 parent 7b672dc commit 700d716
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion SensorsAnalyticsSDK/SensorsAnalyticsSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "SensorsAnalyticsSDK"
s.version = "1.6.14"
s.version = "1.6.15"
s.summary = "The offical iOS SDK of Sensors Analytics."
s.homepage = "http://www.sensorsdata.cn"
s.source = { :git => 'https://github.com/sensorsdata/sa-sdk-ios.git', :tag => "v#{s.version}" }
Expand Down
80 changes: 40 additions & 40 deletions SensorsAnalyticsSDK/SensorsAnalyticsSDK/SensorsAnalyticsSDK.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#import <WebKit/WebKit.h>
#endif

#define VERSION @"1.6.14"
#define VERSION @"1.6.15"

#define PROPERTY_LENGTH_LIMITATION 8191

Expand Down Expand Up @@ -1395,7 +1395,7 @@ - (void)setUpListeners {
[self track:APP_VIEW_SCREEN_EVENT withProperties:properties];
}
};

// 监听所有 UIViewController 显示事件
if (_autoTrack) {
[SASwizzler swizzleBoolSelector:@selector(viewWillAppear:)
Expand Down Expand Up @@ -1440,23 +1440,23 @@ - (void)applicationDidBecomeActive:(NSNotification *)notification {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"HasLaunchedOnce"];
[[NSUserDefaults standardUserDefaults] synchronize];
}

if (_autoTrack) {
// 遍历trackTimer,修改eventBegin为当前timeStamp
dispatch_async(self.serialQueue, ^{
NSNumber *timeStamp = @([[self class] getCurrentTime]);
NSArray *keys = [self.trackTimer allKeys];
NSString *key = nil;
NSMutableDictionary *eventTimer = nil;
for (key in keys) {
eventTimer = [[NSMutableDictionary alloc] initWithDictionary:self.trackTimer[key]];
if (eventTimer) {
[eventTimer setValue:timeStamp forKey:@"eventBegin"];
self.trackTimer[key] = eventTimer;
}

// 遍历trackTimer,修改eventBegin为当前timeStamp
dispatch_async(self.serialQueue, ^{
NSNumber *timeStamp = @([[self class] getCurrentTime]);
NSArray *keys = [self.trackTimer allKeys];
NSString *key = nil;
NSMutableDictionary *eventTimer = nil;
for (key in keys) {
eventTimer = [[NSMutableDictionary alloc] initWithDictionary:self.trackTimer[key]];
if (eventTimer) {
[eventTimer setValue:timeStamp forKey:@"eventBegin"];
self.trackTimer[key] = eventTimer;
}
});
}
});

if (_autoTrack) {
// 追踪 AppStart 事件
[self track:APP_START_EVENT withProperties:@{
RESUME_FROM_BACKGROUND_PROPERTY : @(_appRelaunched),
Expand Down Expand Up @@ -1484,33 +1484,33 @@ - (void)applicationWillResignActive:(NSNotification *)notification {
- (void)applicationDidEnterBackground:(NSNotification *)notification {
SADebug(@"%@ application did enter background", self);

if (_autoTrack) {
// 遍历trackTimer
// eventAccumulatedDuration = eventAccumulatedDuration + timeStamp - eventBegin
dispatch_async(self.serialQueue, ^{
NSNumber *timeStamp = @([[self class] getCurrentTime]);
NSArray *keys = [self.trackTimer allKeys];
NSString *key = nil;
NSMutableDictionary *eventTimer = nil;
for (key in keys) {
eventTimer = [[NSMutableDictionary alloc] initWithDictionary:self.trackTimer[key]];
if (eventTimer) {
NSNumber *eventBegin = [eventTimer valueForKey:@"eventBegin"];
NSNumber *eventAccumulatedDuration = [eventTimer objectForKey:@"eventAccumulatedDuration"];
long eventDuration;
if (eventAccumulatedDuration) {
eventDuration = [timeStamp longValue] - [eventBegin longValue] + [eventAccumulatedDuration longValue];
} else {
eventDuration = [timeStamp longValue] - [eventBegin longValue];
}

[eventTimer setObject:[NSNumber numberWithLong:eventDuration] forKey:@"eventAccumulatedDuration"];
self.trackTimer[key] = eventTimer;
// 遍历trackTimer
// eventAccumulatedDuration = eventAccumulatedDuration + timeStamp - eventBegin
dispatch_async(self.serialQueue, ^{
NSNumber *timeStamp = @([[self class] getCurrentTime]);
NSArray *keys = [self.trackTimer allKeys];
NSString *key = nil;
NSMutableDictionary *eventTimer = nil;
for (key in keys) {
eventTimer = [[NSMutableDictionary alloc] initWithDictionary:self.trackTimer[key]];
if (eventTimer) {
NSNumber *eventBegin = [eventTimer valueForKey:@"eventBegin"];
NSNumber *eventAccumulatedDuration = [eventTimer objectForKey:@"eventAccumulatedDuration"];
long eventDuration;
if (eventAccumulatedDuration) {
eventDuration = [timeStamp longValue] - [eventBegin longValue] + [eventAccumulatedDuration longValue];
} else {
eventDuration = [timeStamp longValue] - [eventBegin longValue];
}

[eventTimer setObject:[NSNumber numberWithLong:eventDuration] forKey:@"eventAccumulatedDuration"];
self.trackTimer[key] = eventTimer;
}
}

});
});

if (_autoTrack) {
// 追踪 AppEnd 事件
[self track:APP_END_EVENT];
}
Expand Down

0 comments on commit 700d716

Please sign in to comment.