From 5cbbe535081dcd10f6d58f0582aa979550d71841 Mon Sep 17 00:00:00 2001 From: Yuhan ZOU Date: Mon, 9 May 2016 10:41:16 +0800 Subject: [PATCH] Release 1.4.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 为 可视化埋点 增加配置参数,可选 UIWindow 对象在 UIApplication windows 对象中的序号 --- SensorsAnalyticsSDK/SensorsAnalyticsSDK.podspec | 2 +- .../SADesignerSnapshotMessage.m | 7 +++++-- .../SensorsAnalyticsSDK/SensorsAnalyticsSDK.h | 13 +++++++++++++ .../SensorsAnalyticsSDK/SensorsAnalyticsSDK.m | 16 +++++++++++++++- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/SensorsAnalyticsSDK/SensorsAnalyticsSDK.podspec b/SensorsAnalyticsSDK/SensorsAnalyticsSDK.podspec index 77cb3821..09f39ed5 100644 --- a/SensorsAnalyticsSDK/SensorsAnalyticsSDK.podspec +++ b/SensorsAnalyticsSDK/SensorsAnalyticsSDK.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "SensorsAnalyticsSDK" - s.version = "1.4.3" + s.version = "1.4.4" 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}" } diff --git a/SensorsAnalyticsSDK/SensorsAnalyticsSDK/SADesignerSnapshotMessage.m b/SensorsAnalyticsSDK/SensorsAnalyticsSDK/SADesignerSnapshotMessage.m index 726ff5d7..73f6a701 100644 --- a/SensorsAnalyticsSDK/SensorsAnalyticsSDK/SADesignerSnapshotMessage.m +++ b/SensorsAnalyticsSDK/SensorsAnalyticsSDK/SADesignerSnapshotMessage.m @@ -16,6 +16,7 @@ #import "SAObjectIdentityProvider.h" #import "SAObjectSerializerConfig.h" #import "SADesignerConnection.h" +#import "SensorsAnalyticsSDK.h" #pragma mark -- Snapshot Request @@ -66,7 +67,8 @@ - (NSOperation *)responseCommandWithConnection:(SADesignerConnection *)connectio __block NSDictionary *serializedObjects = nil; dispatch_sync(dispatch_get_main_queue(), ^{ - screenshot = [serializer screenshotImageForWindowAtIndex:0]; + UInt32 vtrackWindowIndex = [[SensorsAnalyticsSDK sharedInstance] vtrackWindowIndex]; + screenshot = [serializer screenshotImageForWindowAtIndex:vtrackWindowIndex]; }); snapshotMessage.screenshot = screenshot; @@ -76,7 +78,8 @@ - (NSOperation *)responseCommandWithConnection:(SADesignerConnection *)connectio } dispatch_sync(dispatch_get_main_queue(), ^{ - serializedObjects = [serializer objectHierarchyForWindowAtIndex:0]; + UInt32 vtrackWindowIndex = [[SensorsAnalyticsSDK sharedInstance] vtrackWindowIndex]; + serializedObjects = [serializer objectHierarchyForWindowAtIndex:vtrackWindowIndex]; }); [connection setSessionObject:serializedObjects forKey:@"snapshot_hierarchy"]; snapshotMessage.serializedObjects = serializedObjects; diff --git a/SensorsAnalyticsSDK/SensorsAnalyticsSDK/SensorsAnalyticsSDK.h b/SensorsAnalyticsSDK/SensorsAnalyticsSDK/SensorsAnalyticsSDK.h index bed4e419..7aacce8c 100755 --- a/SensorsAnalyticsSDK/SensorsAnalyticsSDK/SensorsAnalyticsSDK.h +++ b/SensorsAnalyticsSDK/SensorsAnalyticsSDK/SensorsAnalyticsSDK.h @@ -122,6 +122,19 @@ typedef NS_ENUM(NSInteger, SensorsAnalyticsDebugMode) { */ @property (atomic) UInt64 flushBulkSize; +/** + * @property + * + * @abstract + * 可视化埋点中,UIWindow 对象的序号 + * + * @discussion + * 默认值为 0。一般情况下,App 的 UIWindow 对象是 UIApplication 的 windows 列表中的 firstObject,若用户调用 UIWindow 的 makeKeyAndVisible 等方法, + * 改变了 windows 列表中各个对象的 windowLevel,会导致可视化埋点无法正常获取需要埋点的 UIWindow 对象。用户调用该借口,设置 UIWindow 对象在 + * windows 列表中的 index。 + */ +@property (atomic) UInt32 vtrackWindowIndex; + /** * @abstract * 根据传入的配置,初始化并返回一个SensorsAnalyticsSDK的单例 diff --git a/SensorsAnalyticsSDK/SensorsAnalyticsSDK/SensorsAnalyticsSDK.m b/SensorsAnalyticsSDK/SensorsAnalyticsSDK/SensorsAnalyticsSDK.m index b90ad488..2d98842c 100755 --- a/SensorsAnalyticsSDK/SensorsAnalyticsSDK/SensorsAnalyticsSDK.m +++ b/SensorsAnalyticsSDK/SensorsAnalyticsSDK/SensorsAnalyticsSDK.m @@ -26,7 +26,7 @@ #import "SASwizzler.h" #import "SensorsAnalyticsSDK.h" -#define VERSION @"1.4.2" +#define VERSION @"1.4.4" #define PROPERTY_LENGTH_LIMITATION 255 @@ -74,6 +74,7 @@ @implementation SensorsAnalyticsSDK { UInt64 _flushBulkSize; UInt64 _flushInterval; UInt64 _lastFlushTime; + UInt32 _vtrackWindowIndex; NSDateFormatter *_dateFormatter; } @@ -201,6 +202,7 @@ - (instancetype)initWithServerURL:(NSString *)serverURL _flushInterval = 60 * 1000; _flushBulkSize = 100; + _vtrackWindowIndex = 0; _dateFormatter = [[NSDateFormatter alloc] init]; [_dateFormatter setDateFormat:@"yyyy-MM-dd hh:mm:ss.SSS"]; @@ -1030,6 +1032,18 @@ - (void)setFlushBulkSize:(UInt64)bulkSize { } } +- (UInt32)vtrackWindowIndex { + @synchronized(self) { + return _vtrackWindowIndex; + } +} + +- (void)setVtrackWindowIndex:(UInt32)vtrackWindowIndex { + @synchronized(self) { + _vtrackWindowIndex = vtrackWindowIndex; + } +} + /** * @abstract * 内部触发的flush,需要根据上次发送时间和网络情况来判断是否发送