Skip to content

Commit 5cbbe53

Browse files
author
Yuhan ZOU
committed
Release 1.4.4
1. 为 可视化埋点 增加配置参数,可选 UIWindow 对象在 UIApplication windows 对象中的序号
1 parent ab772ed commit 5cbbe53

File tree

4 files changed

+34
-4
lines changed

4 files changed

+34
-4
lines changed

SensorsAnalyticsSDK/SensorsAnalyticsSDK.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "SensorsAnalyticsSDK"
3-
s.version = "1.4.3"
3+
s.version = "1.4.4"
44
s.summary = "The offical iOS SDK of Sensors Analytics."
55
s.homepage = "http://www.sensorsdata.cn"
66
s.source = { :git => 'https://github.com/sensorsdata/sa-sdk-ios.git', :tag => "v#{s.version}" }

SensorsAnalyticsSDK/SensorsAnalyticsSDK/SADesignerSnapshotMessage.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#import "SAObjectIdentityProvider.h"
1717
#import "SAObjectSerializerConfig.h"
1818
#import "SADesignerConnection.h"
19+
#import "SensorsAnalyticsSDK.h"
1920

2021
#pragma mark -- Snapshot Request
2122

@@ -66,7 +67,8 @@ - (NSOperation *)responseCommandWithConnection:(SADesignerConnection *)connectio
6667
__block NSDictionary *serializedObjects = nil;
6768

6869
dispatch_sync(dispatch_get_main_queue(), ^{
69-
screenshot = [serializer screenshotImageForWindowAtIndex:0];
70+
UInt32 vtrackWindowIndex = [[SensorsAnalyticsSDK sharedInstance] vtrackWindowIndex];
71+
screenshot = [serializer screenshotImageForWindowAtIndex:vtrackWindowIndex];
7072
});
7173
snapshotMessage.screenshot = screenshot;
7274

@@ -76,7 +78,8 @@ - (NSOperation *)responseCommandWithConnection:(SADesignerConnection *)connectio
7678
}
7779

7880
dispatch_sync(dispatch_get_main_queue(), ^{
79-
serializedObjects = [serializer objectHierarchyForWindowAtIndex:0];
81+
UInt32 vtrackWindowIndex = [[SensorsAnalyticsSDK sharedInstance] vtrackWindowIndex];
82+
serializedObjects = [serializer objectHierarchyForWindowAtIndex:vtrackWindowIndex];
8083
});
8184
[connection setSessionObject:serializedObjects forKey:@"snapshot_hierarchy"];
8285
snapshotMessage.serializedObjects = serializedObjects;

SensorsAnalyticsSDK/SensorsAnalyticsSDK/SensorsAnalyticsSDK.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,19 @@ typedef NS_ENUM(NSInteger, SensorsAnalyticsDebugMode) {
122122
*/
123123
@property (atomic) UInt64 flushBulkSize;
124124

125+
/**
126+
* @property
127+
*
128+
* @abstract
129+
* 可视化埋点中,UIWindow 对象的序号
130+
*
131+
* @discussion
132+
* 默认值为 0。一般情况下,App 的 UIWindow 对象是 UIApplication 的 windows 列表中的 firstObject,若用户调用 UIWindow 的 makeKeyAndVisible 等方法,
133+
* 改变了 windows 列表中各个对象的 windowLevel,会导致可视化埋点无法正常获取需要埋点的 UIWindow 对象。用户调用该借口,设置 UIWindow 对象在
134+
* windows 列表中的 index。
135+
*/
136+
@property (atomic) UInt32 vtrackWindowIndex;
137+
125138
/**
126139
* @abstract
127140
* 根据传入的配置,初始化并返回一个<code>SensorsAnalyticsSDK</code>的单例

SensorsAnalyticsSDK/SensorsAnalyticsSDK/SensorsAnalyticsSDK.m

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#import "SASwizzler.h"
2727
#import "SensorsAnalyticsSDK.h"
2828

29-
#define VERSION @"1.4.2"
29+
#define VERSION @"1.4.4"
3030

3131
#define PROPERTY_LENGTH_LIMITATION 255
3232

@@ -74,6 +74,7 @@ @implementation SensorsAnalyticsSDK {
7474
UInt64 _flushBulkSize;
7575
UInt64 _flushInterval;
7676
UInt64 _lastFlushTime;
77+
UInt32 _vtrackWindowIndex;
7778
NSDateFormatter *_dateFormatter;
7879
}
7980

@@ -201,6 +202,7 @@ - (instancetype)initWithServerURL:(NSString *)serverURL
201202

202203
_flushInterval = 60 * 1000;
203204
_flushBulkSize = 100;
205+
_vtrackWindowIndex = 0;
204206

205207
_dateFormatter = [[NSDateFormatter alloc] init];
206208
[_dateFormatter setDateFormat:@"yyyy-MM-dd hh:mm:ss.SSS"];
@@ -1030,6 +1032,18 @@ - (void)setFlushBulkSize:(UInt64)bulkSize {
10301032
}
10311033
}
10321034

1035+
- (UInt32)vtrackWindowIndex {
1036+
@synchronized(self) {
1037+
return _vtrackWindowIndex;
1038+
}
1039+
}
1040+
1041+
- (void)setVtrackWindowIndex:(UInt32)vtrackWindowIndex {
1042+
@synchronized(self) {
1043+
_vtrackWindowIndex = vtrackWindowIndex;
1044+
}
1045+
}
1046+
10331047
/**
10341048
* @abstract
10351049
* 内部触发的flush,需要根据上次发送时间和网络情况来判断是否发送

0 commit comments

Comments
 (0)