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
2c86f2d8
Commit
2c86f2d8
authored
Dec 06, 2018
by
叶凤鸣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加tab_name
parent
2c98ab14
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
29 deletions
+23
-29
Phobos.m
GMPhobos/Classes/Phobos.m
+2
-2
PhobosPVProtocol.h
GMPhobos/Classes/PhobosPVProtocol.h
+2
-2
UIResponder+PhobosPV.h
GMPhobos/Classes/UIResponder+PhobosPV.h
+2
-2
UIResponder+PhobosPV.m
GMPhobos/Classes/UIResponder+PhobosPV.m
+17
-23
No files found.
GMPhobos/Classes/Phobos.m
View file @
2c86f2d8
...
@@ -326,7 +326,7 @@ static NSString *sdkVersion = @"110";
...
@@ -326,7 +326,7 @@ static NSString *sdkVersion = @"110";
// 必须在此处调用一下referer,因为onControllerStart
// 必须在此处调用一下referer,因为onControllerStart
[
page
initReferer
];
[
page
initReferer
];
[
page
initReferrerIdIfNil
];
[
page
initReferrerIdIfNil
];
[
page
init
Home
TabName
];
[
page
init
Referrer
TabName
];
page
.
inTime
=
[
PhobosUtil
currentTime
];
page
.
inTime
=
[
PhobosUtil
currentTime
];
}
}
...
@@ -346,7 +346,7 @@ static NSString *sdkVersion = @"110";
...
@@ -346,7 +346,7 @@ static NSString *sdkVersion = @"110";
[
dict
setObject
:
page
.
referrerId
?
:
@""
forKey
:
@"referrer_id"
];
[
dict
setObject
:
page
.
referrerId
?
:
@""
forKey
:
@"referrer_id"
];
[
dict
setObject
:
page
.
extraParam
?
:
@""
forKey
:
@"extra_param"
];
[
dict
setObject
:
page
.
extraParam
?
:
@""
forKey
:
@"extra_param"
];
[
dict
setObject
:
page
.
homeTabName
?
:
@""
forKey
:
@"tab_name"
];
[
dict
setObject
:
page
.
homeTabName
?
:
@""
forKey
:
@"tab_name"
];
[
dict
setObject
:
page
.
current
TabName
?
:
@""
forKey
:
@"referrer_tab_name"
];
[
dict
setObject
:
page
.
referrer
TabName
?
:
@""
forKey
:
@"referrer_tab_name"
];
NSAssert
(
page
.
inTime
.
length
>
0
,
@"页面显示时间不能为空!"
);
NSAssert
(
page
.
inTime
.
length
>
0
,
@"页面显示时间不能为空!"
);
[
Phobos
track
:
@"page_view"
attributes
:
dict
];
[
Phobos
track
:
@"page_view"
attributes
:
dict
];
if
(
page
.
inTime
.
length
>
0
)
{
if
(
page
.
inTime
.
length
>
0
)
{
...
...
GMPhobos/Classes/PhobosPVProtocol.h
View file @
2c86f2d8
...
@@ -61,11 +61,11 @@
...
@@ -61,11 +61,11 @@
/**
/**
首页tab名称
首页tab名称
*/
*/
@property
(
nonatomic
,
copy
)
NSString
*
homeT
abName
;
@property
(
nonatomic
,
copy
)
NSString
*
t
abName
;
/**
/**
获取上一个页面的tab名称
获取上一个页面的tab名称
*/
*/
@property
(
nonatomic
,
copy
)
NSString
*
current
TabName
;
@property
(
nonatomic
,
copy
)
NSString
*
referrer
TabName
;
@end
@end
GMPhobos/Classes/UIResponder+PhobosPV.h
View file @
2c86f2d8
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
-
(
void
)
initReferrerIdIfNil
;
-
(
void
)
initReferrerIdIfNil
;
/**
/**
此方法在onPvStart时调用,给
current
TabName赋值
此方法在onPvStart时调用,给
referrer
TabName赋值
*/
*/
-
(
void
)
init
Home
TabName
;
-
(
void
)
init
Referrer
TabName
;
@end
@end
GMPhobos/Classes/UIResponder+PhobosPV.m
View file @
2c86f2d8
...
@@ -46,11 +46,11 @@
...
@@ -46,11 +46,11 @@
}
}
/**
/**
此方法在onPvStart时调用,给
currentTabName赋值,来源为首页时,才给currentTabName赋值,因为首页的pageName为home或者zone_v3,聚合页的pageName也是zone_v3,所以根据referer判断来源可能为首页或者聚合页,但是只有首页有tab名称,所以currentTabName为首页tab名称
此方法在onPvStart时调用,给
referrerTabName赋值
*/
*/
-
(
void
)
init
Home
TabName
{
-
(
void
)
init
Referrer
TabName
{
// 只有
不为空,且
是controller的情况下才自动获取
// 只有是controller的情况下才自动获取
if
(
([
self
.
referer
isEqualToString
:
@"home"
]
||
[
self
.
referer
isEqualToString
:
@"zone_v3"
])
&&
[
self
isKindOfClass
:[
UIViewController
class
]])
{
if
([
self
isKindOfClass
:[
UIViewController
class
]])
{
// 分present与navigation两种情况
// 分present与navigation两种情况
UIViewController
*
me
=
(
UIViewController
*
)
self
;
UIViewController
*
me
=
(
UIViewController
*
)
self
;
if
(
me
.
presentingViewController
!=
nil
)
{
if
(
me
.
presentingViewController
!=
nil
)
{
...
@@ -58,13 +58,9 @@
...
@@ -58,13 +58,9 @@
// 所以此处要判断,如果是navigation弹出,最后还是要定位到topViewController
// 所以此处要判断,如果是navigation弹出,最后还是要定位到topViewController
if
([
me
.
presentingViewController
isKindOfClass
:[
UINavigationController
class
]])
{
if
([
me
.
presentingViewController
isKindOfClass
:[
UINavigationController
class
]])
{
UIViewController
*
top
=
((
UINavigationController
*
)
me
.
presentingViewController
).
topViewController
;
UIViewController
*
top
=
((
UINavigationController
*
)
me
.
presentingViewController
).
topViewController
;
if
(
!
[
top
.
homeTabName
isEqualToString
:
@""
])
{
objc_setAssociatedObject
(
self
,
@selector
(
referrerTabName
),
top
.
tabName
,
OBJC_ASSOCIATION_COPY
);
objc_setAssociatedObject
(
self
,
@selector
(
currentTabName
),
top
.
homeTabName
,
OBJC_ASSOCIATION_COPY
);
}
}
else
{
}
else
{
if
(
!
[
me
.
presentingViewController
.
homeTabName
isEqualToString
:
@""
])
{
objc_setAssociatedObject
(
self
,
@selector
(
referrerTabName
),
me
.
presentingViewController
.
tabName
,
OBJC_ASSOCIATION_COPY
);
objc_setAssociatedObject
(
self
,
@selector
(
currentTabName
),
me
.
presentingViewController
.
homeTabName
,
OBJC_ASSOCIATION_COPY
);
}
}
}
}
else
{
}
else
{
NSArray
*
navigationPool
=
((
UIViewController
*
)
self
).
navigationController
.
viewControllers
;
NSArray
*
navigationPool
=
((
UIViewController
*
)
self
).
navigationController
.
viewControllers
;
...
@@ -73,9 +69,7 @@
...
@@ -73,9 +69,7 @@
return
;
return
;
}
}
UIViewController
*
controller
=
navigationPool
[
refererIndex
];
UIViewController
*
controller
=
navigationPool
[
refererIndex
];
if
(
!
[
controller
.
homeTabName
isEqualToString
:
@""
])
{
objc_setAssociatedObject
(
self
,
@selector
(
referrerTabName
),
controller
.
tabName
,
OBJC_ASSOCIATION_COPY
);
objc_setAssociatedObject
(
self
,
@selector
(
currentTabName
),
controller
.
homeTabName
,
OBJC_ASSOCIATION_COPY
);
}
}
}
}
}
}
}
...
@@ -169,22 +163,22 @@
...
@@ -169,22 +163,22 @@
return
extraParam
==
nil
?
@""
:
extraParam
;
return
extraParam
==
nil
?
@""
:
extraParam
;
}
}
-
(
void
)
set
HomeTabName
:
(
NSString
*
)
homeT
abName
{
-
(
void
)
set
TabName
:
(
NSString
*
)
t
abName
{
objc_setAssociatedObject
(
self
,
@selector
(
homeTabName
),
homeT
abName
,
OBJC_ASSOCIATION_COPY
);
objc_setAssociatedObject
(
self
,
@selector
(
tabName
),
t
abName
,
OBJC_ASSOCIATION_COPY
);
}
}
-
(
NSString
*
)
homeT
abName
{
-
(
NSString
*
)
t
abName
{
NSString
*
homeTabName
=
objc_getAssociatedObject
(
self
,
@selector
(
homeT
abName
));
NSString
*
tabName
=
objc_getAssociatedObject
(
self
,
@selector
(
t
abName
));
return
homeTabName
==
nil
?
@""
:
homeT
abName
;
return
tabName
==
nil
?
@""
:
t
abName
;
}
}
-
(
void
)
set
CurrentTabName
:
(
NSString
*
)
current
TabName
{
-
(
void
)
set
ReferrerTabName
:
(
NSString
*
)
referrer
TabName
{
objc_setAssociatedObject
(
self
,
@selector
(
currentTabName
),
current
TabName
,
OBJC_ASSOCIATION_COPY
);
objc_setAssociatedObject
(
self
,
@selector
(
referrerTabName
),
referrer
TabName
,
OBJC_ASSOCIATION_COPY
);
}
}
-
(
NSString
*
)
current
TabName
{
-
(
NSString
*
)
referrer
TabName
{
NSString
*
currentTabName
=
objc_getAssociatedObject
(
self
,
@selector
(
current
TabName
));
NSString
*
referrerTabName
=
objc_getAssociatedObject
(
self
,
@selector
(
referrer
TabName
));
return
currentTabName
==
nil
?
@""
:
current
TabName
;
return
referrerTabName
==
nil
?
@""
:
referrer
TabName
;
}
}
@end
@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