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
bc847ab2
Commit
bc847ab2
authored
Sep 25, 2017
by
汪洋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch 'wy/present' into 'master'
This reverts merge request
!12
parent
7938974f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
39 deletions
+39
-39
Phobos.h
Pod/Classes/Phobos.h
+7
-3
Phobos.m
Pod/Classes/Phobos.m
+1
-2
PhobosPVProtocol.h
Pod/Classes/PhobosPVProtocol.h
+2
-1
PhobosUtil.h
Pod/Classes/PhobosUtil.h
+1
-0
PhobosUtil.m
Pod/Classes/PhobosUtil.m
+9
-0
UIResponder+PhobosPV.m
Pod/Classes/UIResponder+PhobosPV.m
+19
-33
No files found.
Pod/Classes/Phobos.h
View file @
bc847ab2
...
@@ -15,10 +15,10 @@
...
@@ -15,10 +15,10 @@
/**
/**
* @brief 开启Phobos统计,默认以BATCH方式发送log.
* @brief 开启Phobos统计,默认以BATCH方式发送log.
*
*
* @param appName
通常由数据端与客户端一起确认的区分不同app的名字
* @param appName
* @param channelId
发布渠道
* @param channelId
*
*
* @return
Phobos实例
* @return
*
*
* @since 0.0.1
* @since 0.0.1
*/
*/
...
@@ -43,6 +43,8 @@
...
@@ -43,6 +43,8 @@
/**
/**
* @brief 设置是否打印sdk的log信息,默认不开启
* @brief 设置是否打印sdk的log信息,默认不开启
*
*
* @param value 设置为YES,phobos SDK 会输出log信息,记得release产品时要设置回NO.
*
* @since 0.0.1
* @since 0.0.1
*/
*/
@property
(
assign
,
nonatomic
)
BOOL
logEnabled
;
@property
(
assign
,
nonatomic
)
BOOL
logEnabled
;
...
@@ -50,6 +52,7 @@
...
@@ -50,6 +52,7 @@
/**
/**
* @brief 设置当前登录用户的ID,如果没有默认为@""
* @brief 设置当前登录用户的ID,如果没有默认为@""
*
*
* @param userId
*
*
* @since 0.0.2
* @since 0.0.2
*/
*/
...
@@ -60,6 +63,7 @@
...
@@ -60,6 +63,7 @@
*
*
* @brief 用户当前的城市id
* @brief 用户当前的城市id
*
*
* @param currentCityId
*
*
* @since 0.2.7
* @since 0.2.7
*/
*/
...
...
Pod/Classes/Phobos.m
View file @
bc847ab2
...
@@ -183,7 +183,6 @@ static NSString *sdkVersion = @"110";
...
@@ -183,7 +183,6 @@ static NSString *sdkVersion = @"110";
/**
/**
* @brief 应用进入后台的处理
* @brief 应用进入后台的处理
*
* @since 0.0.1
* @since 0.0.1
*/
*/
-
(
void
)
handleAppInBackgound
:
(
id
)
sender
{
-
(
void
)
handleAppInBackgound
:
(
id
)
sender
{
...
@@ -297,7 +296,7 @@ static NSString *sdkVersion = @"110";
...
@@ -297,7 +296,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
initReferrerIdIfNil
];
page
.
inTime
=
[
PhobosUtil
currentTime
];
page
.
inTime
=
[
PhobosUtil
currentTime
];
}
}
...
...
Pod/Classes/PhobosPVProtocol.h
View file @
bc847ab2
...
@@ -31,10 +31,11 @@
...
@@ -31,10 +31,11 @@
* @author 翟国钧 in 16-02-25 19:02:32
* @author 翟国钧 in 16-02-25 19:02:32
*
*
* @brief 获取前一个页面的pageName。
* @brief 获取前一个页面的pageName。
* 只读,以后如果业务涉及到referer的set方法,那么再升级Phobos,此时先不做过多考虑 by wangyang at 2017-2-7
*
*
* @since 5.9.1
* @since 5.9.1
*/
*/
@property
(
nonatomic
,
cop
y
,
nonnull
)
NSString
*
referer
;
@property
(
nonatomic
,
readonl
y
,
nonnull
)
NSString
*
referer
;
/**
/**
当前VC.view 显示的时候的时间戳
当前VC.view 显示的时候的时间戳
...
...
Pod/Classes/PhobosUtil.h
View file @
bc847ab2
...
@@ -26,6 +26,7 @@ typedef void (^SendDataSuccessBlock)(NSInteger code);
...
@@ -26,6 +26,7 @@ typedef void (^SendDataSuccessBlock)(NSInteger code);
/**
/**
* @brief 上传数据
* @brief 上传数据
*
*
* @param data,success
*
*
* @since 0.0.1
* @since 0.0.1
*/
*/
...
...
Pod/Classes/PhobosUtil.m
View file @
bc847ab2
...
@@ -137,6 +137,10 @@
...
@@ -137,6 +137,10 @@
/**
/**
* @brief 将对象转成JSON格式数据
* @brief 将对象转成JSON格式数据
*
*
* @param obj
*
* @return
*
* @since 0.0.1
* @since 0.0.1
*/
*/
+
(
NSData
*
)
encodeJSON
:(
id
)
obj
{
+
(
NSData
*
)
encodeJSON
:(
id
)
obj
{
...
@@ -147,6 +151,9 @@
...
@@ -147,6 +151,9 @@
/**
/**
* @brief 获取当前时间的毫秒数
* @brief 获取当前时间的毫秒数
*
* @return
*
* @since 0.0.1
* @since 0.0.1
*/
*/
+
(
NSString
*
)
currentTime
{
+
(
NSString
*
)
currentTime
{
...
@@ -159,6 +166,8 @@
...
@@ -159,6 +166,8 @@
/**
/**
* @brief 获取当前APP的版本号
* @brief 获取当前APP的版本号
*
*
* @return
*
* @since 0.0.1
* @since 0.0.1
*/
*/
+
(
NSString
*
)
getAppVersion
{
+
(
NSString
*
)
getAppVersion
{
...
...
Pod/Classes/UIResponder+PhobosPV.m
View file @
bc847ab2
...
@@ -17,31 +17,24 @@
...
@@ -17,31 +17,24 @@
*
*
* @brief 取当前导航栈中当前VC的上级VC,如果该VC存在,就获取他的pageName
* @brief 取当前导航栈中当前VC的上级VC,如果该VC存在,就获取他的pageName
*
*
* @return 前一页的pageName
*
* @since 5.9.1
* @since 5.9.1
*/
*/
-
(
void
)
initReferer
{
-
(
void
)
initReferer
{
// 只有不为空,且是controller的情况下才自动获取
if
([
self
isKindOfClass
:[
UIViewController
class
]])
{
if
(
self
.
referer
==
nil
&&
[
self
isKindOfClass
:[
UIViewController
class
]])
{
NSArray
*
navigationPool
=
((
UIViewController
*
)
self
).
navigationController
.
viewControllers
;
// 分present与navigation两种情况
NSInteger
refererIndex
=
navigationPool
.
count
-
2
;
UIViewController
*
me
=
(
UIViewController
*
)
self
;
if
(
refererIndex
<
0
)
{
if
(
me
.
presentingViewController
!=
nil
)
{
return
;
objc_setAssociatedObject
(
self
,
@selector
(
referer
),
me
.
presentingViewController
.
pageName
,
OBJC_ASSOCIATION_COPY
);
}
else
{
NSArray
*
navigationPool
=
((
UIViewController
*
)
self
).
navigationController
.
viewControllers
;
NSInteger
refererIndex
=
navigationPool
.
count
-
2
;
if
(
refererIndex
<
0
)
{
return
;
}
UIViewController
*
controller
=
navigationPool
[
refererIndex
];
objc_setAssociatedObject
(
self
,
@selector
(
referer
),
controller
.
pageName
,
OBJC_ASSOCIATION_COPY
);
}
}
UIViewController
*
controller
=
navigationPool
[
refererIndex
];
objc_setAssociatedObject
(
self
,
@selector
(
referer
),
controller
.
pageName
,
OBJC_ASSOCIATION_COPY
);
}
else
{
objc_setAssociatedObject
(
self
,
@selector
(
referer
),
@""
,
OBJC_ASSOCIATION_COPY
);
}
}
}
}
-
(
void
)
setReferer
:
(
NSString
*
)
referer
{
objc_setAssociatedObject
(
self
,
@selector
(
referer
),
referer
,
OBJC_ASSOCIATION_COPY
);
}
-
(
NSString
*
)
referer
-
(
NSString
*
)
referer
{
{
NSString
*
referer
=
objc_getAssociatedObject
(
self
,
@selector
(
referer
));
NSString
*
referer
=
objc_getAssociatedObject
(
self
,
@selector
(
referer
));
...
@@ -80,22 +73,15 @@
...
@@ -80,22 +73,15 @@
}
}
-
(
void
)
initReferrerIdIfNil
{
-
(
void
)
initReferrerIdIfNil
{
// 只有不为空,且是controller的情况下才自动获取
if
(
self
.
referrerId
==
nil
&&
[
self
isKindOfClass
:[
UIViewController
class
]])
{
if
(
self
.
referrerId
==
nil
&&
[
self
isKindOfClass
:[
UIViewController
class
]])
{
// 分present与navigation两种情况
NSArray
*
navigationPool
=
((
UIViewController
*
)
self
).
navigationController
.
viewControllers
;
UIViewController
*
me
=
(
UIViewController
*
)
self
;
NSInteger
refererIdIndex
=
navigationPool
.
count
-
2
;
if
(
me
.
presentingViewController
!=
nil
)
{
if
(
refererIdIndex
<
0
)
{
objc_setAssociatedObject
(
self
,
@selector
(
referrerId
),
me
.
presentingViewController
.
businessId
,
OBJC_ASSOCIATION_COPY
);
objc_setAssociatedObject
(
self
,
@selector
(
referrerId
),
@""
,
OBJC_ASSOCIATION_COPY
);
}
else
{
}
else
{
NSArray
*
navigationPool
=
((
UIViewController
*
)
self
).
navigationController
.
viewControllers
;
UIViewController
*
controller
=
navigationPool
[
refererIdIndex
];
NSInteger
refererIdIndex
=
navigationPool
.
count
-
2
;
NSString
*
preBusinessId
=
controller
.
businessId
;
if
(
refererIdIndex
<
0
)
{
objc_setAssociatedObject
(
self
,
@selector
(
referrerId
),
preBusinessId
,
OBJC_ASSOCIATION_COPY
);
objc_setAssociatedObject
(
self
,
@selector
(
referrerId
),
@""
,
OBJC_ASSOCIATION_COPY
);
}
else
{
UIViewController
*
controller
=
navigationPool
[
refererIdIndex
];
NSString
*
preBusinessId
=
controller
.
businessId
;
objc_setAssociatedObject
(
self
,
@selector
(
referrerId
),
preBusinessId
,
OBJC_ASSOCIATION_COPY
);
}
}
}
}
}
}
}
...
@@ -106,7 +92,7 @@
...
@@ -106,7 +92,7 @@
-
(
NSString
*
)
referrerId
{
-
(
NSString
*
)
referrerId
{
NSString
*
referrerId
=
objc_getAssociatedObject
(
self
,
@selector
(
referrerId
));
NSString
*
referrerId
=
objc_getAssociatedObject
(
self
,
@selector
(
referrerId
));
return
referrerId
==
nil
?
@""
:
referrerId
;
return
referrerId
;
}
}
-
(
BOOL
)
needLogPV
{
-
(
BOOL
)
needLogPV
{
...
...
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