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
2db45ae2
Commit
2db45ae2
authored
Mar 19, 2020
by
艾娇平
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加支持业务层更新PVStart 和 PvEnd信息
parent
4242879f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
2 deletions
+37
-2
Phobos.m
GMPhobos/Classes/Phobos.m
+12
-2
PhobosPVProtocol.h
GMPhobos/Classes/PhobosPVProtocol.h
+6
-0
UIResponder+PhobosPV.m
GMPhobos/Classes/UIResponder+PhobosPV.m
+19
-0
No files found.
GMPhobos/Classes/Phobos.m
View file @
2db45ae2
...
...
@@ -359,12 +359,20 @@ static NSString *sdkVersion = @"110";
[
page
initReferrerTabName
];
page
.
inTime
=
[
PhobosUtil
currentTime
];
page
.
inTimeMillis
=
[
PhobosUtil
currentMMTime
];
// 业务层更新
if
(
page
.
updatePVStartBlock
)
{
page
.
updatePVStartBlock
();
}
}
-
(
void
)
onPVEnd
:
(
UIResponder
<
PhobosPVProtocol
>
*
)
page
{
if
(
!
[
PhobosUtil
isNonEmpty
:
page
.
pageName
]
||
!
page
.
needLogPV
)
{
return
;
}
// 业务层更新
if
(
page
.
updatePVEndBlock
)
{
page
.
updatePVEndBlock
();
}
NSMutableDictionary
*
dict
=
[[
NSMutableDictionary
alloc
]
init
];
@try
{
[
dict
setObject
:[
PhobosUtil
currentTime
]
forKey
:
@"out"
];
...
...
@@ -421,9 +429,11 @@ static NSString *sdkVersion = @"110";
*
* @since 0.0.1
*/
-
(
NSDictionary
*
)
prepareDictionaryForEvent
:
(
NSString
*
)
eventId
attributes
:
(
NSDictionary
*
)
attributes
{
-
(
NSDictionary
*
)
prepareDictionaryForEvent
:
(
NSString
*
)
eventId
attributes
:
(
NSDictionary
*
)
attributes
{
NSArray
*
referrerLink
=
sharedClient
.
visibleController
.
referrerLink
;
if
(
!
[
eventId
isEqualToString
:
@"page_view"
])
{
// 对于埋点没有referrer_link的情况,在这里进行统一添加
if
(
!
[
attributes
.
allKeys
containsObject
:
@"referrer_link"
])
{
NSMutableDictionary
*
attributesParams
=
[
NSMutableDictionary
dictionaryWithDictionary
:
attributes
];
if
([
referrerLink
isKindOfClass
:[
NSArray
class
]]
&&
referrerLink
.
count
)
{
[
attributesParams
setValue
:
referrerLink
forKey
:
@"referrer_link"
];
...
...
GMPhobos/Classes/PhobosPVProtocol.h
View file @
2db45ae2
...
...
@@ -8,6 +8,8 @@
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
typedef
void
(
^
PhobosUpdatePVBlock
)(
void
);
@protocol
PhobosPVProtocol
<
NSObject
>
/**
...
...
@@ -83,6 +85,10 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property
(
nonatomic
,
copy
)
NSArray
*
referrerLink
;
/// 业务层更新PVStart信息
@property
(
nonatomic
,
copy
)
PhobosUpdatePVBlock
updatePVStartBlock
;
/// 业务层更新PVEnd信息
@property
(
nonatomic
,
copy
)
PhobosUpdatePVBlock
updatePVEndBlock
;
@end
NS_ASSUME_NONNULL_END
GMPhobos/Classes/UIResponder+PhobosPV.m
View file @
2db45ae2
...
...
@@ -244,4 +244,23 @@
return
isPush
==
nil
?
@""
:
isPush
;
}
-
(
void
)
setUpdatePVStartBlock
:
(
PhobosUpdatePVBlock
)
updatePVStartBlock
{
objc_setAssociatedObject
(
self
,
@selector
(
updatePVStartBlock
),
updatePVStartBlock
,
OBJC_ASSOCIATION_COPY
);
}
-
(
PhobosUpdatePVBlock
)
updatePVStartBlock
{
PhobosUpdatePVBlock
updatePVBlock
=
objc_getAssociatedObject
(
self
,
@selector
(
updatePVBlock
));
return
updatePVBlock
;
}
-
(
void
)
setUpdatePVEndBlock
:
(
PhobosUpdatePVBlock
)
updatePVEndBlock
{
objc_setAssociatedObject
(
self
,
@selector
(
updatePVEndBlock
),
updatePVEndBlock
,
OBJC_ASSOCIATION_COPY
);
}
-
(
PhobosUpdatePVBlock
)
updatePVEndBlock
{
PhobosUpdatePVBlock
updatePVBlock
=
objc_getAssociatedObject
(
self
,
@selector
(
updatePVEndBlock
));
return
updatePVBlock
;
}
@end
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