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
954e3150
Commit
954e3150
authored
Aug 08, 2019
by
乔金柱
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch 'jql/newPhobos' into 'master'"
This reverts merge request
!39
parent
e58799c9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
23 additions
and
59 deletions
+23
-59
GMViewController.m
Example/GMPhobos/GMViewController.m
+1
-1
GMPhobosUtilTest.m
Example/Tests/GMPhobosUtilTest.m
+3
-4
GMPhotoTest.m
Example/Tests/GMPhotoTest.m
+0
-0
Phobos.h
GMPhobos/Classes/Phobos.h
+11
-49
Phobos.m
GMPhobos/Classes/Phobos.m
+0
-0
PhobosConfig.h
GMPhobos/Classes/PhobosConfig.h
+2
-2
PhobosUtil.h
GMPhobos/Classes/PhobosUtil.h
+1
-1
PhobosUtil.m
GMPhobos/Classes/PhobosUtil.m
+5
-2
No files found.
Example/GMPhobos/GMViewController.m
View file @
954e3150
...
@@ -41,7 +41,7 @@ NSString *const MockCityId = @"beijing";
...
@@ -41,7 +41,7 @@ NSString *const MockCityId = @"beijing";
[
phobos
setLogEnabled
:
NO
];
// 调试打Log模式,看情况开启
[
phobos
setLogEnabled
:
NO
];
// 调试打Log模式,看情况开启
phobos
.
signingType
=
PhobosSigningTypeDebug
;
phobos
.
signingType
=
PhobosSigningTypeDebug
;
phobos
.
userId
=
@""
;
phobos
.
userId
=
@""
;
//
[Phobos setSharedClient:phobos];
[
Phobos
setSharedClient
:
phobos
];
NSString
*
inDate
=
[
PhobosUtil
currentTime
];
NSString
*
inDate
=
[
PhobosUtil
currentTime
];
NSMutableDictionary
*
dict
=
[[
NSMutableDictionary
alloc
]
init
];
NSMutableDictionary
*
dict
=
[[
NSMutableDictionary
alloc
]
init
];
...
...
Example/Tests/GMPhobosUtilTest.m
View file @
954e3150
...
@@ -19,8 +19,7 @@
...
@@ -19,8 +19,7 @@
-
(
void
)
setUp
{
-
(
void
)
setUp
{
[
super
setUp
];
[
super
setUp
];
NSString
*
url
=
@"http://log.test.gengmei.cc/log/collect"
;
NSString
*
url
=
@"http://log.test.gengmei.cc/log/collect"
;
[
Phobos
clientWithAppName
:
@"gengmei_test"
channelId
:
@"AppStore"
];
[
Phobos
setSharedClient
:[
Phobos
clientWithAppName
:
@"gengmei_test"
channelId
:
@"AppStore"
]];
// [Phobos setSharedClient:[Phobos clientWithAppName:@"gengmei_test" channelId:@"AppStore"]];
[
Phobos
sharedClient
].
serverAPI
=
url
;
[
Phobos
sharedClient
].
serverAPI
=
url
;
_mockArray
=
[[
NSMutableArray
alloc
]
init
];
_mockArray
=
[[
NSMutableArray
alloc
]
init
];
for
(
int
i
=
0
;
i
<
50
;
i
++
)
{
for
(
int
i
=
0
;
i
<
50
;
i
++
)
{
...
@@ -64,9 +63,9 @@
...
@@ -64,9 +63,9 @@
XCTestExpectation
*
expectation
=
[
self
expectationWithDescription
:
@"Testing Async Method Works!"
];
XCTestExpectation
*
expectation
=
[
self
expectationWithDescription
:
@"Testing Async Method Works!"
];
NSData
*
mockData
=
[
self
encodeAndCompressArray
:
_mockArray
];
NSData
*
mockData
=
[
self
encodeAndCompressArray
:
_mockArray
];
[
PhobosUtil
sendData
:
mockData
success
:
^
(
BOOL
success
)
{
[
PhobosUtil
sendData
:
mockData
success
:
^
(
NSInteger
code
)
{
[
expectation
fulfill
];
[
expectation
fulfill
];
XCTAssertEqual
(
success
,
YES
);
XCTAssertEqual
(
code
,
200
);
}];
}];
//如果超时,则认为发送失败
//如果超时,则认为发送失败
...
...
Example/Tests/GMPhotoTest.m
View file @
954e3150
This diff is collapsed.
Click to expand it.
GMPhobos/Classes/Phobos.h
View file @
954e3150
...
@@ -31,13 +31,12 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
...
@@ -31,13 +31,12 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
*/
*/
+
(
Phobos
*
)
clientWithAppName
:(
NSString
*
)
appName
channelId
:(
NSString
*
)
channelId
;
+
(
Phobos
*
)
clientWithAppName
:(
NSString
*
)
appName
channelId
:(
NSString
*
)
channelId
;
+
(
instancetype
)
alloc
__attribute__
((
deprecated
))
;
+
(
instancetype
)
sharedClient
;
-
(
instancetype
)
init
__attribute__
((
deprecated
));
+
(
instancetype
)
new
__attribute__
((
deprecated
))
;
+
(
void
)
setSharedClient
:(
Phobos
*
)
client
;
#pragma mark - SDK配置
@property
(
class
,
readonly
,
strong
)
Phobos
*
sharedClient
;
#pragma mark - SDK配置
// Phobos在处理业务端传递来的参数时会检查是否某个value为空,如果为空会调用这个block以通知业务层,业务层可以上报这个异常,以助解决问题
// Phobos在处理业务端传递来的参数时会检查是否某个value为空,如果为空会调用这个block以通知业务层,业务层可以上报这个异常,以助解决问题
@property
(
nonatomic
,
copy
)
void
(
^
captureNullExpection
)
(
NSString
*
eventId
,
NSDictionary
*
info
);
@property
(
nonatomic
,
copy
)
void
(
^
captureNullExpection
)
(
NSString
*
eventId
,
NSDictionary
*
info
);
...
@@ -132,12 +131,12 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
...
@@ -132,12 +131,12 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
*
*
* @since 0.0.1
* @since 0.0.1
*/
*/
+
(
void
)
track
:(
NSString
*
)
event
Name
attributes
:(
NSDictionary
*
)
attributes
;
+
(
void
)
track
:(
NSString
*
)
event
Id
attributes
:(
NSDictionary
*
)
attributes
;
+
(
void
)
track
:(
NSString
*
)
event
Name
attributes
:(
NSDictionary
*
)
attributes
sendNow
:(
BOOL
)
sendNow
;
+
(
void
)
track
:(
NSString
*
)
event
Id
attributes
:(
NSDictionary
*
)
attributes
sendNow
:(
BOOL
)
sendNow
;
+
(
void
)
track
:(
NSString
*
)
event
Name
;
+
(
void
)
track
:(
NSString
*
)
event
Id
;
/**
/**
* @brief 自定义事件,数量统计 7730 精准曝光
/数据链路
.
* @brief 自定义事件,数量统计 7730 精准曝光.
*
*
* @param eventId 事件Id
* @param eventId 事件Id
* @attributes 参数
* @attributes 参数
...
@@ -145,9 +144,9 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
...
@@ -145,9 +144,9 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
* @currentAPI 当前传过来的API
* @currentAPI 当前传过来的API
* @
* @
*/
*/
+
(
void
)
track
:(
NSString
*
)
event
Name
attributes
:(
NSDictionary
*
)
attributes
currentAPI
:(
NSString
*
)
currentAPI
;
+
(
void
)
track
:(
NSString
*
)
event
Id
attributes
:(
NSDictionary
*
)
attributes
currentAPI
:(
NSString
*
)
currentAPI
;
+
(
void
)
track
:(
NSString
*
)
event
Name
attributes
:(
NSDictionary
*
)
attributes
sendNow
:(
BOOL
)
sendNow
currentAPI
:(
NSString
*
)
currentAPI
;
+
(
void
)
track
:(
NSString
*
)
event
Id
attributes
:(
NSDictionary
*
)
attributes
sendNow
:(
BOOL
)
sendNow
currentAPI
:(
NSString
*
)
currentAPI
;
+
(
void
)
track
:(
NSString
*
)
event
Name
currentAPI
:(
NSString
*
)
currentAPI
;
+
(
void
)
track
:(
NSString
*
)
event
Id
currentAPI
:(
NSString
*
)
currentAPI
;
/**
/**
* @author 翟国钧, 16-02-03 16:02:30
* @author 翟国钧, 16-02-03 16:02:30
...
@@ -182,41 +181,4 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
...
@@ -182,41 +181,4 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
*/
*/
-
(
void
)
simulativePV
:(
NSString
*
)
pageName
businessId
:(
NSString
*
)
bid
referer
:(
NSString
*
)
referer
;
-
(
void
)
simulativePV
:(
NSString
*
)
pageName
businessId
:(
NSString
*
)
bid
referer
:(
NSString
*
)
referer
;
@end
@interface
Phobos
(
UtilTest
)
/** 获取所有非立即发送埋点数量 */
+
(
NSInteger
)
normalPhobosCount
;
/** 获取所有非立即发送埋点数据 */
+
(
NSDictionary
*
)
normalPhobosData
;
/** 获取url的非立即发送埋点数量 */
+
(
NSInteger
)
normalPhobosCountForURL
:(
NSString
*
)
url
;
/** 获取url的非立即发送埋点数据 */
+
(
NSArray
*
)
normalPhobosDataForURL
:(
NSString
*
)
url
;
/** 获取所有立即发送埋点数据 */
+
(
NSDictionary
*
)
immediatelyPhobosData
;
/** 获取url的立即发送埋点数据 */
+
(
NSArray
*
)
immediatelyPhobosDataForURL
:(
NSString
*
)
url
;
/** 获取url的立即发送埋点数量 */
+
(
NSUInteger
)
immediatelyPhobosCountForURL
:(
NSString
*
)
url
;
/** 清除非立即发送埋点数据缓存 */
+
(
void
)
removeAllNormalPhobosData
;
/** 清除立即发送埋点数据缓存 */
+
(
void
)
removeAllImmediatelyPhobosData
;
/** 获取将要发送的数据 */
@property
(
nonatomic
,
copy
)
void
(
^
phobosSendDataBlock
)(
NSArray
*
datas
);
@end
@end
GMPhobos/Classes/Phobos.m
View file @
954e3150
This diff is collapsed.
Click to expand it.
GMPhobos/Classes/PhobosConfig.h
View file @
954e3150
...
@@ -18,8 +18,8 @@
...
@@ -18,8 +18,8 @@
#define PhobosHaveOpenApp @"PhobosHaveOpenApp" //是否打开过APP
#define PhobosHaveOpenApp @"PhobosHaveOpenApp" //是否打开过APP
#define PhobosBeginTime @"PhobosBeginTime" //记录APP打开|从后台启动时的时间戳
#define PhobosBeginTime @"PhobosBeginTime" //记录APP打开|从后台启动时的时间戳
#define PhobosEndTime @"PhobosEndTime" //记录APP退出|退到后台时的时间戳
#define PhobosEndTime @"PhobosEndTime" //记录APP退出|退到后台时的时间戳
#define Phobos
NormalCacheKey @"PhobosNormalCacheKey"
//存放持久化埋点数据的key
#define Phobos
CacheKey @"PhobosCacheKey"
//存放持久化埋点数据的key
#define Phobos
ImmediatelyCacheKey @"PhobosImmediatelyCacheKey" //存放持久化实时
埋点数据的key
#define Phobos
TempCacheKey @"PhobosTempCacheKey" //临时存放待发送
埋点数据的key
#define PhobosShardCount 50 //收集数据分段发送的个数
#define PhobosShardCount 50 //收集数据分段发送的个数
...
...
GMPhobos/Classes/PhobosUtil.h
View file @
954e3150
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
#import <Foundation/Foundation.h>
#import <Foundation/Foundation.h>
typedef
void
(
^
SendDataSuccessBlock
)(
BOOL
success
);
typedef
void
(
^
SendDataSuccessBlock
)(
NSInteger
code
);
@interface
PhobosUtil
:
NSObject
@interface
PhobosUtil
:
NSObject
...
...
GMPhobos/Classes/PhobosUtil.m
View file @
954e3150
...
@@ -123,8 +123,11 @@
...
@@ -123,8 +123,11 @@
// sendAsynchronousRequest 在iOS9以后y被废除了
// sendAsynchronousRequest 在iOS9以后y被废除了
NSURLSession
*
session
=
[
NSURLSession
sharedSession
];
NSURLSession
*
session
=
[
NSURLSession
sharedSession
];
NSURLSessionDataTask
*
dataTask
=
[
session
dataTaskWithRequest
:
request
completionHandler
:
^
(
NSData
*
_Nullable
data
,
NSURLResponse
*
_Nullable
response
,
NSError
*
_Nullable
error
)
{
NSURLSessionDataTask
*
dataTask
=
[
session
dataTaskWithRequest
:
request
completionHandler
:
^
(
NSData
*
_Nullable
data
,
NSURLResponse
*
_Nullable
response
,
NSError
*
_Nullable
error
)
{
if
(
success
)
{
if
(
!
error
)
{
success
(
!
error
?
YES
:
NO
);
//没有错误,返回正确;
if
(
success
)
{
success
(
200
);
}
}
}
}];
}];
[
dataTask
resume
];
[
dataTask
resume
];
...
...
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