Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
GMPhobos
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
GMPhobos
Commits
0d5257e4
Commit
0d5257e4
authored
Dec 19, 2019
by
乔金柱
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'jz/master' into 'master'
还原 phobos 1.3.0 代码 See merge request
!46
parents
2a751ef1
3746b2e9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
71 additions
and
61 deletions
+71
-61
Phobos.h
GMPhobos/Classes/Phobos.h
+11
-55
Phobos.m
GMPhobos/Classes/Phobos.m
+0
-0
PhobosConfig.h
GMPhobos/Classes/PhobosConfig.h
+2
-2
PhobosPVProtocol.h
GMPhobos/Classes/PhobosPVProtocol.h
+6
-0
PhobosUtil.m
GMPhobos/Classes/PhobosUtil.m
+0
-4
UIResponder+PhobosPV.h
GMPhobos/Classes/UIResponder+PhobosPV.h
+6
-0
UIResponder+PhobosPV.m
GMPhobos/Classes/UIResponder+PhobosPV.m
+46
-0
No files found.
GMPhobos/Classes/Phobos.h
View file @
0d5257e4
...
@@ -33,13 +33,12 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
...
@@ -33,13 +33,12 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
*/
*/
+
(
Phobos
*
)
clientWithAppName
:(
NSString
*
)
appName
channelId
:(
NSString
*
)
channelId
;
+
(
Phobos
*
)
clientWithAppName
:(
NSString
*
)
appName
channelId
:(
NSString
*
)
channelId
;
+
(
instancetype
)
alloc
__attribute__
((
deprecated
))
;
+
(
instancetype
)
sharedClient
;
-
(
instancetype
)
init
__attribute__
((
deprecated
));
+
(
instancetype
)
new
__attribute__
((
deprecated
))
;
+
(
void
)
setSharedClient
:(
Phobos
*
)
client
;
#pragma mark - SDK配置
@property
(
class
,
readonly
,
strong
)
Phobos
*
sharedClient
;
#pragma mark - SDK配置
// Phobos在处理业务端传递来的参数时会检查是否某个value为空,如果为空会调用这个block以通知业务层,业务层可以上报这个异常,以助解决问题
// Phobos在处理业务端传递来的参数时会检查是否某个value为空,如果为空会调用这个block以通知业务层,业务层可以上报这个异常,以助解决问题
@property
(
nonatomic
,
copy
)
void
(
^
captureNullExpection
)
(
NSString
*
eventId
,
NSDictionary
*
info
);
@property
(
nonatomic
,
copy
)
void
(
^
captureNullExpection
)
(
NSString
*
eventId
,
NSDictionary
*
info
);
...
@@ -134,12 +133,12 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
...
@@ -134,12 +133,12 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
*
*
* @since 0.0.1
* @since 0.0.1
*/
*/
+
(
void
)
track
:(
NSString
*
)
event
Name
attributes
:(
NSDictionary
*
)
attributes
;
+
(
void
)
track
:(
NSString
*
)
event
Id
attributes
:(
NSDictionary
*
)
attributes
;
+
(
void
)
track
:(
NSString
*
)
event
Name
attributes
:(
NSDictionary
*
)
attributes
sendNow
:(
BOOL
)
sendNow
;
+
(
void
)
track
:(
NSString
*
)
event
Id
attributes
:(
NSDictionary
*
)
attributes
sendNow
:(
BOOL
)
sendNow
;
+
(
void
)
track
:(
NSString
*
)
event
Name
;
+
(
void
)
track
:(
NSString
*
)
event
Id
;
/**
/**
* @brief 自定义事件,数量统计 7730 精准曝光
/数据链路
.
* @brief 自定义事件,数量统计 7730 精准曝光.
*
*
* @param eventId 事件Id
* @param eventId 事件Id
* @attributes 参数
* @attributes 参数
...
@@ -147,9 +146,9 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
...
@@ -147,9 +146,9 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
* @currentAPI 当前传过来的API
* @currentAPI 当前传过来的API
* @
* @
*/
*/
+
(
void
)
track
:(
NSString
*
)
event
Name
attributes
:(
NSDictionary
*
)
attributes
currentAPI
:(
NSString
*
)
currentAPI
;
+
(
void
)
track
:(
NSString
*
)
event
Id
attributes
:(
NSDictionary
*
)
attributes
currentAPI
:(
NSString
*
)
currentAPI
;
+
(
void
)
track
:(
NSString
*
)
event
Name
attributes
:(
NSDictionary
*
)
attributes
sendNow
:(
BOOL
)
sendNow
currentAPI
:(
NSString
*
)
currentAPI
;
+
(
void
)
track
:(
NSString
*
)
event
Id
attributes
:(
NSDictionary
*
)
attributes
sendNow
:(
BOOL
)
sendNow
currentAPI
:(
NSString
*
)
currentAPI
;
+
(
void
)
track
:(
NSString
*
)
event
Name
currentAPI
:(
NSString
*
)
currentAPI
;
+
(
void
)
track
:(
NSString
*
)
event
Id
currentAPI
:(
NSString
*
)
currentAPI
;
/**
/**
* @author 翟国钧, 16-02-03 16:02:30
* @author 翟国钧, 16-02-03 16:02:30
...
@@ -184,48 +183,5 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
...
@@ -184,48 +183,5 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
*/
*/
-
(
void
)
simulativePV
:(
NSString
*
)
pageName
businessId
:(
NSString
*
)
bid
referer
:(
NSString
*
)
referer
;
-
(
void
)
simulativePV
:(
NSString
*
)
pageName
businessId
:(
NSString
*
)
bid
referer
:(
NSString
*
)
referer
;
@end
@interface
Phobos
(
UtilTest
)
/** 获取所有非立即发送埋点数量 */
+
(
NSInteger
)
normalPhobosCount
;
/** 获取所有非立即发送埋点数据 */
+
(
NSDictionary
*
)
normalPhobosData
;
/** 获取url的非立即发送埋点数量 */
+
(
NSInteger
)
normalPhobosCountForURL
:(
NSString
*
)
url
;
/** 获取serverAPI的非立即发送埋点数据 */
+
(
NSArray
*
)
normalPhobosDataForServerAPI
;
/** 获取url的非立即发送埋点数据 */
+
(
NSArray
*
)
normalPhobosDataForURL
:(
NSString
*
)
url
;
/** 获取所有立即发送埋点数据 */
+
(
NSDictionary
*
)
immediatelyPhobosData
;
/** 获取serverAPI的立即发送埋点数据 */
+
(
NSArray
*
)
immediatelyPhobosForServerAPI
;
/** 获取url的立即发送埋点数据 */
+
(
NSArray
*
)
immediatelyPhobosDataForURL
:(
NSString
*
)
url
;
/** 获取url的立即发送埋点数量 */
+
(
NSUInteger
)
immediatelyPhobosCountForURL
:(
NSString
*
)
url
;
/** 清除非立即发送埋点数据缓存 */
+
(
void
)
removeAllNormalPhobosData
;
/** 清除立即发送埋点数据缓存 */
+
(
void
)
removeAllImmediatelyPhobosData
;
/** 获取将要发送的数据 */
@property
(
nonatomic
,
copy
)
void
(
^
phobosSendDataBlock
)(
NSArray
*
datas
);
@end
@end
NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
GMPhobos/Classes/Phobos.m
View file @
0d5257e4
This diff is collapsed.
Click to expand it.
GMPhobos/Classes/PhobosConfig.h
View file @
0d5257e4
...
@@ -18,8 +18,8 @@
...
@@ -18,8 +18,8 @@
#define PhobosHaveOpenApp @"PhobosHaveOpenApp" //是否打开过APP
#define PhobosHaveOpenApp @"PhobosHaveOpenApp" //是否打开过APP
#define PhobosBeginTime @"PhobosBeginTime" //记录APP打开|从后台启动时的时间戳
#define PhobosBeginTime @"PhobosBeginTime" //记录APP打开|从后台启动时的时间戳
#define PhobosEndTime @"PhobosEndTime" //记录APP退出|退到后台时的时间戳
#define PhobosEndTime @"PhobosEndTime" //记录APP退出|退到后台时的时间戳
#define Phobos
NormalCacheKey @"PhobosNormalCacheKey"
//存放持久化埋点数据的key
#define Phobos
CacheKey @"PhobosCacheKey"
//存放持久化埋点数据的key
#define Phobos
ImmediatelyCacheKey @"PhobosImmediatelyCacheKey" //存放持久化实时
埋点数据的key
#define Phobos
TempCacheKey @"PhobosTempCacheKey" //临时存放待发送
埋点数据的key
#define PhobosShardCount 50 //收集数据分段发送的个数
#define PhobosShardCount 50 //收集数据分段发送的个数
...
...
GMPhobos/Classes/PhobosPVProtocol.h
View file @
0d5257e4
...
@@ -75,5 +75,11 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -75,5 +75,11 @@ NS_ASSUME_NONNULL_BEGIN
*/
*/
@property
(
nonatomic
,
copy
)
NSString
*
isPush
;
@property
(
nonatomic
,
copy
)
NSString
*
isPush
;
/**
获取上一个页面链路的page_name link by 7.20.0 如果有此页面有page_name则添加 , 没有添加""
*/
@property
(
nonatomic
,
copy
)
NSArray
*
referrerLink
;
@end
@end
NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
GMPhobos/Classes/PhobosUtil.m
View file @
0d5257e4
...
@@ -127,8 +127,6 @@
...
@@ -127,8 +127,6 @@
//没有错误,返回正确;
//没有错误,返回正确;
if
(
success
)
{
if
(
success
)
{
success
(
200
);
success
(
200
);
}
else
{
success
(
error
.
code
);
}
}
}
}
}];
}];
...
@@ -152,8 +150,6 @@
...
@@ -152,8 +150,6 @@
//没有错误,返回正确;
//没有错误,返回正确;
if
(
success
)
{
if
(
success
)
{
success
(
200
);
success
(
200
);
}
else
{
success
(
error
.
code
);
}
}
}
}
}];
}];
...
...
GMPhobos/Classes/UIResponder+PhobosPV.h
View file @
0d5257e4
...
@@ -15,6 +15,11 @@
...
@@ -15,6 +15,11 @@
*/
*/
-
(
void
)
initReferer
;
-
(
void
)
initReferer
;
/**
// // 适用于链路中页面浏览事件的统计 添加 refererLink 参数
*/
-
(
void
)
initRefererLink
;
/**
/**
此方法在onPvStart时调用,如果发现已经有值了,不会给referrerId再次赋值
此方法在onPvStart时调用,如果发现已经有值了,不会给referrerId再次赋值
*/
*/
...
@@ -25,4 +30,5 @@
...
@@ -25,4 +30,5 @@
*/
*/
-
(
void
)
initReferrerTabName
;
-
(
void
)
initReferrerTabName
;
@end
@end
GMPhobos/Classes/UIResponder+PhobosPV.m
View file @
0d5257e4
...
@@ -45,6 +45,52 @@
...
@@ -45,6 +45,52 @@
}
}
}
}
// 适用于链路中页面浏览事件的统计 添加 refererLink 参数
-
(
void
)
initRefererLink
{
if
([
self
isKindOfClass
:[
UIViewController
class
]])
{
// 分present与navigation两种情况
UIViewController
*
me
=
(
UIViewController
*
)
self
;
if
(
me
.
isPush
.
intValue
)
{
// 如果是推送进来的,结果页面的referrerLink 为空数组, 此处添加过滤。
objc_setAssociatedObject
(
self
,
@selector
(
referrerLink
),
@[],
OBJC_ASSOCIATION_RETAIN_NONATOMIC
);
return
;
}
if
(
me
.
presentingViewController
!=
nil
)
{
// app全局只有一个navigation,发现此时用navigation.topViewController presentViewController时,最终使用的是navigation弹出的
// 所以此处要判断,如果是navigation弹出,最后还是要定位到topViewController
if
([
me
.
presentingViewController
isKindOfClass
:[
UINavigationController
class
]])
{
UIViewController
*
top
=
((
UINavigationController
*
)
me
.
presentingViewController
).
topViewController
;
NSMutableArray
*
tempLink
=
[
NSMutableArray
arrayWithArray
:
top
.
referrerLink
];
[
tempLink
addObject
:
top
.
pageName
];
objc_setAssociatedObject
(
self
,
@selector
(
referrerLink
),
tempLink
,
OBJC_ASSOCIATION_RETAIN_NONATOMIC
);
}
else
{
NSMutableArray
*
tempLink
=
[
NSMutableArray
arrayWithArray
:
me
.
presentingViewController
.
referrerLink
];
[
tempLink
addObject
:
me
.
presentingViewController
.
pageName
];
objc_setAssociatedObject
(
self
,
@selector
(
referrerLink
),
tempLink
,
OBJC_ASSOCIATION_RETAIN_NONATOMIC
);
}
}
else
{
NSArray
*
navigationPool
=
((
UIViewController
*
)
self
).
navigationController
.
viewControllers
;
NSInteger
refererIndex
=
navigationPool
.
count
-
2
;
if
(
refererIndex
<
0
)
{
return
;
}
UIViewController
*
controller
=
navigationPool
[
refererIndex
];
NSMutableArray
*
tempLink
=
[
NSMutableArray
arrayWithArray
:
controller
.
referrerLink
];
[
tempLink
addObject
:
controller
.
pageName
];
objc_setAssociatedObject
(
self
,
@selector
(
referrerLink
),
tempLink
,
OBJC_ASSOCIATION_RETAIN_NONATOMIC
);
}
}
}
-
(
void
)
setReferrerLink
:
(
NSArray
*
)
referrerLink
{
objc_setAssociatedObject
(
self
,
@selector
(
referrerLink
),
referrerLink
,
OBJC_ASSOCIATION_RETAIN_NONATOMIC
);
}
-
(
NSArray
*
)
referrerLink
{
NSArray
*
referrerLink
=
objc_getAssociatedObject
(
self
,
@selector
(
referrerLink
));
return
referrerLink
;
}
/**
/**
此方法在onPvStart时调用,给referrerTabName赋值
此方法在onPvStart时调用,给referrerTabName赋值
*/
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment