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
3e8b90a6
Commit
3e8b90a6
authored
May 10, 2017
by
汪洋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refereredId自动获取
parent
3ef8a9dd
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
11 deletions
+17
-11
Phobos.m
Pod/Classes/Phobos.m
+1
-0
UIResponder+PhobosPV.h
Pod/Classes/UIResponder+PhobosPV.h
+5
-0
UIResponder+PhobosPV.m
Pod/Classes/UIResponder+PhobosPV.m
+11
-11
No files found.
Pod/Classes/Phobos.m
View file @
3e8b90a6
...
@@ -281,6 +281,7 @@ static NSString *sdkVersion = @"110";
...
@@ -281,6 +281,7 @@ static NSString *sdkVersion = @"110";
-
(
void
)
onPVStart
:
(
UIResponder
<
PhobosPVProtocol
>
*
)
page
{
-
(
void
)
onPVStart
:
(
UIResponder
<
PhobosPVProtocol
>
*
)
page
{
// 必须在此处调用一下referer,因为onControllerStart
// 必须在此处调用一下referer,因为onControllerStart
[
page
initReferer
];
[
page
initReferer
];
[
page
initReferrerIdIfNil
];
page
.
inTime
=
[
PhobosUtil
currentTime
];
page
.
inTime
=
[
PhobosUtil
currentTime
];
}
}
...
...
Pod/Classes/UIResponder+PhobosPV.h
View file @
3e8b90a6
...
@@ -14,4 +14,9 @@
...
@@ -14,4 +14,9 @@
只适用于controller自动初始化referer
只适用于controller自动初始化referer
*/
*/
-
(
void
)
initReferer
;
-
(
void
)
initReferer
;
/**
此方法在onPvStart时调用,如果发现已经有值了,不会给referrerId再次赋值
*/
-
(
void
)
initReferrerIdIfNil
;
@end
@end
Pod/Classes/UIResponder+PhobosPV.m
View file @
3e8b90a6
...
@@ -72,26 +72,26 @@
...
@@ -72,26 +72,26 @@
return
inTime
;
return
inTime
;
}
}
-
(
void
)
setReferrerId
:
(
NSString
*
)
referrerId
{
-
(
void
)
initReferrerIdIfNil
{
objc_setAssociatedObject
(
self
,
@selector
(
referrerId
),
referrerId
,
OBJC_ASSOCIATION_COPY
);
if
(
self
.
referrerId
==
nil
&&
[
self
isKindOfClass
:[
UIViewController
class
]])
{
}
-
(
NSString
*
)
referrerId
{
NSString
*
referrerId
=
objc_getAssociatedObject
(
self
,
@selector
(
referrerId
));
if
(
referrerId
==
nil
)
{
if
([
self
isKindOfClass
:[
UIViewController
class
]])
{
NSArray
*
navigationPool
=
((
UIViewController
*
)
self
).
navigationController
.
viewControllers
;
NSArray
*
navigationPool
=
((
UIViewController
*
)
self
).
navigationController
.
viewControllers
;
NSInteger
refererIdIndex
=
navigationPool
.
count
-
2
;
NSInteger
refererIdIndex
=
navigationPool
.
count
-
2
;
if
(
refererIdIndex
<
0
)
{
if
(
refererIdIndex
<
0
)
{
return
@""
;
objc_setAssociatedObject
(
self
,
@selector
(
referrerId
),
@""
,
OBJC_ASSOCIATION_COPY
)
;
}
else
{
}
else
{
UIViewController
*
controller
=
navigationPool
[
refererIdIndex
];
UIViewController
*
controller
=
navigationPool
[
refererIdIndex
];
NSString
*
preBusinessId
=
controller
.
businessId
;
NSString
*
preBusinessId
=
controller
.
businessId
;
objc_setAssociatedObject
(
self
,
@selector
(
referrerId
),
preBusinessId
,
OBJC_ASSOCIATION_COPY
);
objc_setAssociatedObject
(
self
,
@selector
(
referrerId
),
preBusinessId
,
OBJC_ASSOCIATION_COPY
);
return
preBusinessId
;
}
}
}
}
}
}
-
(
void
)
setReferrerId
:
(
NSString
*
)
referrerId
{
objc_setAssociatedObject
(
self
,
@selector
(
referrerId
),
referrerId
,
OBJC_ASSOCIATION_COPY
);
}
-
(
NSString
*
)
referrerId
{
NSString
*
referrerId
=
objc_getAssociatedObject
(
self
,
@selector
(
referrerId
));
return
referrerId
;
return
referrerId
;
}
}
...
...
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