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
8fe921d3
Commit
8fe921d3
authored
May 14, 2020
by
乔金柱
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'jql/push' into 'master'
push See merge request
!55
parents
a99eb119
6a63492b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
30 deletions
+52
-30
NewPhobos.m
GMPhobos/Classes/NewPhobos.m
+2
-1
OldPhobos.m
GMPhobos/Classes/OldPhobos.m
+2
-1
PhobosPVProtocol.h
GMPhobos/Classes/PhobosPVProtocol.h
+6
-1
UIResponder+PhobosPV.h
GMPhobos/Classes/UIResponder+PhobosPV.h
+2
-0
UIResponder+PhobosPV.m
GMPhobos/Classes/UIResponder+PhobosPV.m
+40
-27
No files found.
GMPhobos/Classes/NewPhobos.m
View file @
8fe921d3
...
...
@@ -280,7 +280,8 @@ static dispatch_semaphore_t _phobos_semaphore;
[
dict
setObject
:
PhobosSafeString
(
page
.
referrerId
)
forKey
:
@"referrer_id"
];
[
dict
setObject
:
PhobosSafeString
(
page
.
extraParam
)
forKey
:
@"extra_param"
];
[
dict
setObject
:
PhobosSafeString
(
page
.
referrerTabName
)
forKey
:
@"referrer_tab_name"
];
[
dict
setObject
:
page
.
isPush
.
intValue
?
@
(
page
.
isPush
.
intValue
)
:
@
(
0
)
forKey
:
@"is_push"
];
[
dict
setObject
:
@
(
page
.
isPush
?
1
:
0
)
forKey
:
@"is_push"
];
[
dict
setObject
:
PhobosSafeString
(
page
.
messageId
)
forKey
:
@"message_id"
];
[
dict
setObject
:
PhobosSafeString
(
page
.
inTimeMillis
)
forKey
:
@"in_time_millis"
];
[
dict
setObject
:
PhobosSafeString
([
PhobosUtil
currentMMTime
])
forKey
:
@"out_time_millis"
];
...
...
GMPhobos/Classes/OldPhobos.m
View file @
8fe921d3
...
...
@@ -358,7 +358,8 @@ static OldPhobos *sharedClient = nil;
[
dict
setObject
:
PhobosSafeString
(
page
.
referrerId
)
forKey
:
@"referrer_id"
];
[
dict
setObject
:
PhobosSafeString
(
page
.
extraParam
)
forKey
:
@"extra_param"
];
[
dict
setObject
:
PhobosSafeString
(
page
.
referrerTabName
)
forKey
:
@"referrer_tab_name"
];
[
dict
setObject
:
page
.
isPush
.
intValue
?
@
(
page
.
isPush
.
intValue
)
:
@
(
0
)
forKey
:
@"is_push"
];
[
dict
setObject
:
@
(
page
.
isPush
?
1
:
0
)
forKey
:
@"is_push"
];
[
dict
setObject
:
PhobosSafeString
(
page
.
messageId
)
forKey
:
@"message_id"
];
[
dict
setObject
:
PhobosSafeString
(
page
.
inTimeMillis
)
forKey
:
@"in_time_millis"
];
[
dict
setObject
:
PhobosSafeString
([
PhobosUtil
currentMMTime
])
forKey
:
@"out_time_millis"
];
...
...
GMPhobos/Classes/PhobosPVProtocol.h
View file @
8fe921d3
...
...
@@ -78,7 +78,12 @@ typedef void(^PhobosUpdatePVBlock)(void);
1: 是推送页面跳转
0: 普通页面跳转
*/
@property
(
nonatomic
,
copy
)
NSString
*
isPush
;
@property
(
nonatomic
,
assign
)
BOOL
isPush
;
/**
* 推送id, 如果isPush = 1,该值会取push信息中的message_id
*/
@property
(
nonatomic
,
copy
)
NSString
*
messageId
;
/**
获取上一个页面链路的page_name link by 7.20.0 如果有此页面有page_name则添加 , 没有添加""
...
...
GMPhobos/Classes/UIResponder+PhobosPV.h
View file @
8fe921d3
...
...
@@ -30,4 +30,6 @@
*/
-
(
void
)
initReferrerTabName
;
-
(
void
)
setSourceFromPushWithMessageId
:(
NSString
*
)
messageId
;
@end
GMPhobos/Classes/UIResponder+PhobosPV.m
View file @
8fe921d3
...
...
@@ -29,9 +29,9 @@
// 所以此处要判断,如果是navigation弹出,最后还是要定位到topViewController
if
([
me
.
presentingViewController
isKindOfClass
:[
UINavigationController
class
]])
{
UIViewController
*
top
=
((
UINavigationController
*
)
me
.
presentingViewController
).
topViewController
;
objc_setAssociatedObject
(
self
,
@selector
(
referer
),
top
.
pageName
,
OBJC_ASSOCIATION_COPY
)
;
self
.
referer
=
top
.
pageName
;
}
else
{
objc_setAssociatedObject
(
self
,
@selector
(
referer
),
me
.
presentingViewController
.
pageName
,
OBJC_ASSOCIATION_COPY
)
;
self
.
referer
=
me
.
presentingViewController
.
pageName
;
}
}
else
{
NSArray
*
navigationPool
=
((
UIViewController
*
)
self
).
navigationController
.
viewControllers
;
...
...
@@ -40,7 +40,7 @@
return
;
}
UIViewController
*
controller
=
navigationPool
[
refererIndex
];
objc_setAssociatedObject
(
self
,
@selector
(
referer
),
controller
.
pageName
,
OBJC_ASSOCIATION_COPY
)
;
self
.
referer
=
controller
.
pageName
;
}
}
}
...
...
@@ -51,8 +51,8 @@
if
(
self
.
referrerLink
.
count
==
0
&&
[
self
isKindOfClass
:[
UIViewController
class
]])
{
// 分present与navigation两种情况
UIViewController
*
me
=
(
UIViewController
*
)
self
;
if
(
me
.
isPush
.
intValue
)
{
// 如果是推送进来的,结果页面的referrerLink 为空数组,
此处添加过滤。
self
.
referrerLink
=
@[];
if
(
me
.
isPush
)
{
// 如果是推送进来的,结果页面的referrerLink 为”push“
此处添加过滤。
self
.
referrerLink
=
@[
@"push"
];
}
else
if
(
me
.
presentingViewController
!=
nil
)
{
// app全局只有一个navigation,发现此时用navigation.topViewController presentViewController时,最终使用的是navigation弹出的
// 所以此处要判断,如果是navigation弹出,最后还是要定位到topViewController
...
...
@@ -102,9 +102,9 @@
// 所以此处要判断,如果是navigation弹出,最后还是要定位到topViewController
if
([
me
.
presentingViewController
isKindOfClass
:[
UINavigationController
class
]])
{
UIViewController
*
top
=
((
UINavigationController
*
)
me
.
presentingViewController
).
topViewController
;
objc_setAssociatedObject
(
self
,
@selector
(
referrerTabName
),
top
.
tabName
,
OBJC_ASSOCIATION_COPY
)
;
self
.
referrerTabName
=
top
.
tabName
;
}
else
{
objc_setAssociatedObject
(
self
,
@selector
(
referrerTabName
),
me
.
presentingViewController
.
tabName
,
OBJC_ASSOCIATION_COPY
)
;
self
.
referrerTabName
=
me
.
presentingViewController
.
tabName
;
}
}
else
{
NSArray
*
navigationPool
=
((
UIViewController
*
)
self
).
navigationController
.
viewControllers
;
...
...
@@ -113,13 +113,13 @@
return
;
}
UIViewController
*
controller
=
navigationPool
[
refererIndex
];
objc_setAssociatedObject
(
self
,
@selector
(
referrerTabName
),
controller
.
tabName
,
OBJC_ASSOCIATION_COPY
)
;
self
.
referrerTabName
=
controller
.
tabName
;
}
}
}
-
(
void
)
setReferer
:
(
NSString
*
)
referer
{
objc_setAssociatedObject
(
self
,
@selector
(
referer
),
referer
,
OBJC_ASSOCIATION_COPY
);
objc_setAssociatedObject
(
self
,
@selector
(
referer
),
referer
,
OBJC_ASSOCIATION_COPY
_NONATOMIC
);
}
-
(
NSString
*
)
referer
...
...
@@ -134,7 +134,7 @@
}
-
(
void
)
setPageName
:
(
NSString
*
)
pageName
{
objc_setAssociatedObject
(
self
,
@selector
(
pageName
),
pageName
,
OBJC_ASSOCIATION_COPY
);
objc_setAssociatedObject
(
self
,
@selector
(
pageName
),
pageName
,
OBJC_ASSOCIATION_COPY
_NONATOMIC
);
}
-
(
NSString
*
)
businessId
{
...
...
@@ -143,11 +143,11 @@
}
-
(
void
)
setBusinessId
:
(
NSString
*
)
businessId
{
objc_setAssociatedObject
(
self
,
@selector
(
businessId
),
businessId
,
OBJC_ASSOCIATION_COPY
);
objc_setAssociatedObject
(
self
,
@selector
(
businessId
),
businessId
,
OBJC_ASSOCIATION_COPY
_NONATOMIC
);
}
-
(
void
)
setInTime
:
(
NSString
*
)
inTime
{
objc_setAssociatedObject
(
self
,
@selector
(
inTime
),
inTime
,
OBJC_ASSOCIATION_COPY
);
objc_setAssociatedObject
(
self
,
@selector
(
inTime
),
inTime
,
OBJC_ASSOCIATION_COPY
_NONATOMIC
);
}
/**
...
...
@@ -159,7 +159,7 @@
}
-
(
void
)
setInTimeMillis
:
(
NSString
*
)
inTimeMillis
{
objc_setAssociatedObject
(
self
,
@selector
(
inTimeMillis
),
inTimeMillis
,
OBJC_ASSOCIATION_COPY
);
objc_setAssociatedObject
(
self
,
@selector
(
inTimeMillis
),
inTimeMillis
,
OBJC_ASSOCIATION_COPY
_NONATOMIC
);
}
-
(
NSString
*
)
inTimeMillis
{
...
...
@@ -178,18 +178,17 @@
NSArray
*
navigationPool
=
((
UIViewController
*
)
self
).
navigationController
.
viewControllers
;
NSInteger
refererIdIndex
=
navigationPool
.
count
-
2
;
if
(
refererIdIndex
<
0
)
{
objc_setAssociatedObject
(
self
,
@selector
(
referrerId
),
@""
,
OBJC_ASSOCIATION_COPY
)
;
self
.
referrerId
=
@""
;
}
else
{
UIViewController
*
controller
=
navigationPool
[
refererIdIndex
];
NSString
*
preBusinessId
=
controller
.
businessId
;
objc_setAssociatedObject
(
self
,
@selector
(
referrerId
),
preBusinessId
,
OBJC_ASSOCIATION_COPY
);
self
.
referrerId
=
controller
.
businessId
;
}
}
}
}
-
(
void
)
setReferrerId
:
(
NSString
*
)
referrerId
{
objc_setAssociatedObject
(
self
,
@selector
(
referrerId
),
referrerId
,
OBJC_ASSOCIATION_COPY
);
objc_setAssociatedObject
(
self
,
@selector
(
referrerId
),
referrerId
,
OBJC_ASSOCIATION_COPY
_NONATOMIC
);
}
-
(
NSString
*
)
referrerId
{
...
...
@@ -207,7 +206,7 @@
}
-
(
void
)
setExtraParam
:
(
NSString
*
)
extraParam
{
objc_setAssociatedObject
(
self
,
@selector
(
extraParam
),
extraParam
,
OBJC_ASSOCIATION_COPY
);
objc_setAssociatedObject
(
self
,
@selector
(
extraParam
),
extraParam
,
OBJC_ASSOCIATION_COPY
_NONATOMIC
);
}
-
(
NSString
*
)
extraParam
{
...
...
@@ -216,7 +215,7 @@
}
-
(
void
)
setTabName
:
(
NSString
*
)
tabName
{
objc_setAssociatedObject
(
self
,
@selector
(
tabName
),
tabName
,
OBJC_ASSOCIATION_COPY
);
objc_setAssociatedObject
(
self
,
@selector
(
tabName
),
tabName
,
OBJC_ASSOCIATION_COPY
_NONATOMIC
);
}
-
(
NSString
*
)
tabName
{
...
...
@@ -225,7 +224,7 @@
}
-
(
void
)
setReferrerTabName
:
(
NSString
*
)
referrerTabName
{
objc_setAssociatedObject
(
self
,
@selector
(
referrerTabName
),
referrerTabName
,
OBJC_ASSOCIATION_COPY
);
objc_setAssociatedObject
(
self
,
@selector
(
referrerTabName
),
referrerTabName
,
OBJC_ASSOCIATION_COPY
_NONATOMIC
);
}
-
(
NSString
*
)
referrerTabName
{
...
...
@@ -233,17 +232,26 @@
return
referrerTabName
==
nil
?
@""
:
referrerTabName
;
}
-
(
void
)
setIsPush
:
(
NSString
*
)
isPush
{
objc_setAssociatedObject
(
self
,
@selector
(
isPush
),
isPush
,
OBJC_ASSOCIATION_COPY
);
-
(
void
)
setIsPush
:
(
BOOL
)
isPush
{
objc_setAssociatedObject
(
self
,
@selector
(
isPush
),
@
(
isPush
),
OBJC_ASSOCIATION_RETAIN_NONATOMIC
);
}
-
(
NSString
*
)
isPush
{
NSString
*
isPush
=
objc_getAssociatedObject
(
self
,
@selector
(
isPush
));
return
isPush
==
nil
?
@""
:
isPush
;
-
(
BOOL
)
isPush
{
NSNumber
*
isPush
=
objc_getAssociatedObject
(
self
,
@selector
(
isPush
));
return
isPush
==
nil
?
NO
:
isPush
.
boolValue
;
}
-
(
void
)
setMessageId
:
(
NSString
*
)
messageId
{
objc_setAssociatedObject
(
self
,
@selector
(
messageId
),
messageId
,
OBJC_ASSOCIATION_COPY_NONATOMIC
);
}
-
(
NSString
*
)
messageId
{
NSString
*
messageId
=
objc_getAssociatedObject
(
self
,
@selector
(
messageId
));
return
messageId
==
nil
?
@""
:
messageId
;
}
-
(
void
)
setUpdatePVStartBlock
:
(
PhobosUpdatePVBlock
)
updatePVStartBlock
{
objc_setAssociatedObject
(
self
,
@selector
(
updatePVStartBlock
),
updatePVStartBlock
,
OBJC_ASSOCIATION_COPY
);
objc_setAssociatedObject
(
self
,
@selector
(
updatePVStartBlock
),
updatePVStartBlock
,
OBJC_ASSOCIATION_COPY
_NONATOMIC
);
}
-
(
PhobosUpdatePVBlock
)
updatePVStartBlock
{
...
...
@@ -252,11 +260,16 @@
}
-
(
void
)
setUpdatePVEndBlock
:
(
PhobosUpdatePVBlock
)
updatePVEndBlock
{
objc_setAssociatedObject
(
self
,
@selector
(
updatePVEndBlock
),
updatePVEndBlock
,
OBJC_ASSOCIATION_COPY
);
objc_setAssociatedObject
(
self
,
@selector
(
updatePVEndBlock
),
updatePVEndBlock
,
OBJC_ASSOCIATION_COPY
_NONATOMIC
);
}
-
(
PhobosUpdatePVBlock
)
updatePVEndBlock
{
PhobosUpdatePVBlock
updatePVBlock
=
objc_getAssociatedObject
(
self
,
@selector
(
updatePVEndBlock
));
return
updatePVBlock
;
}
-
(
void
)
setSourceFromPushWithMessageId
:
(
NSString
*
)
messageId
{
self
.
isPush
=
YES
;
self
.
messageId
=
messageId
;
}
@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