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
7b79a83e
Commit
7b79a83e
authored
Sep 23, 2019
by
乔金柱
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'jql/phobos' into 'master'
重构埋点库 See merge request
!42
parents
3d867177
9adf3bfc
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
126 additions
and
27 deletions
+126
-27
D343427D-396A-4DA4-A74B-7C92AD89F7A7.plist
...39A.xcbaseline/D343427D-396A-4DA4-A74B-7C92AD89F7A7.plist
+22
-0
Info.plist
...cbaselines/6003F5AD195388D20070C39A.xcbaseline/Info.plist
+31
-0
GMViewController.m
Example/GMPhobos/GMViewController.m
+5
-6
Podfile.lock
Example/Podfile.lock
+4
-4
GMPhobosUtilTest.m
Example/Tests/GMPhobosUtilTest.m
+2
-2
GMPhotoTest.m
Example/Tests/GMPhotoTest.m
+0
-0
GMPhobos.podspec
GMPhobos.podspec
+1
-1
Phobos.h
GMPhobos/Classes/Phobos.h
+55
-11
Phobos.m
GMPhobos/Classes/Phobos.m
+0
-0
PhobosConfig.h
GMPhobos/Classes/PhobosConfig.h
+2
-2
PhobosUtil.m
GMPhobos/Classes/PhobosUtil.m
+4
-0
UIResponder+PhobosPV.h
GMPhobos/Classes/UIResponder+PhobosPV.h
+0
-1
No files found.
Example/GMPhobos.xcodeproj/xcshareddata/xcbaselines/6003F5AD195388D20070C39A.xcbaseline/D343427D-396A-4DA4-A74B-7C92AD89F7A7.plist
0 → 100644
View file @
7b79a83e
<
?xml
v
e
rsion="
1
.
0
"
e
n
c
o
d
ing="UT
F
-
8
"?
>
<
!
D
O
C
TYP
E
plist
PU
B
LI
C
"-//
A
ppl
e
//
D
T
D
PLIST
1
.
0
//
E
N"
"http://www.
a
ppl
e
.
c
om/
D
T
D
s/Prop
e
rtyList-
1
.
0
.
d
t
d
"
>
<
plist
v
e
rsion="
1
.
0
"
>
<
d
i
c
t
>
<
k
e
y
>
classNames
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
GMPhobosUtilTest
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
testDataCompressPerformance
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
com.apple.XCTPerformanceMetric_WallClockTime
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
baselineAverage
<
/k
e
y
>
<
r
ea
l
>
0.000579
<
/r
ea
l
>
<
k
e
y
>
baselineIntegrationDisplayName
<
/k
e
y
>
<
string
>
Local
Baseline
<
/string
>
<
/
d
i
c
t
>
<
/
d
i
c
t
>
<
/
d
i
c
t
>
<
/
d
i
c
t
>
<
/
d
i
c
t
>
<
/plist
>
Example/GMPhobos.xcodeproj/xcshareddata/xcbaselines/6003F5AD195388D20070C39A.xcbaseline/Info.plist
View file @
7b79a83e
...
@@ -35,6 +35,37 @@
...
@@ -35,6 +35,37 @@
<
string
>
com.apple.platform.iphonesimulator
<
/string
>
<
string
>
com.apple.platform.iphonesimulator
<
/string
>
<
/
d
i
c
t
>
<
/
d
i
c
t
>
<
/
d
i
c
t
>
<
/
d
i
c
t
>
<
k
e
y
>
D343427D-396A-4DA4-A74B-7C92AD89F7A7
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
localComputer
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
busSpeedInMHz
<
/k
e
y
>
<
int
e
g
e
r
>
100
<
/int
e
g
e
r
>
<
k
e
y
>
cpuCount
<
/k
e
y
>
<
int
e
g
e
r
>
1
<
/int
e
g
e
r
>
<
k
e
y
>
cpuKind
<
/k
e
y
>
<
string
>
Intel
Core
i7
<
/string
>
<
k
e
y
>
cpuSpeedInMHz
<
/k
e
y
>
<
int
e
g
e
r
>
2300
<
/int
e
g
e
r
>
<
k
e
y
>
logicalCPUCoresPerPackage
<
/k
e
y
>
<
int
e
g
e
r
>
8
<
/int
e
g
e
r
>
<
k
e
y
>
modelCode
<
/k
e
y
>
<
string
>
MacBookPro11
,
2
<
/string
>
<
k
e
y
>
physicalCPUCoresPerPackage
<
/k
e
y
>
<
int
e
g
e
r
>
4
<
/int
e
g
e
r
>
<
k
e
y
>
platformIdentifier
<
/k
e
y
>
<
string
>
com.apple.platform.macosx
<
/string
>
<
/
d
i
c
t
>
<
k
e
y
>
targetArchitecture
<
/k
e
y
>
<
string
>
x86_64
<
/string
>
<
k
e
y
>
targetDevice
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
modelCode
<
/k
e
y
>
<
string
>
iPhone10
,
5
<
/string
>
<
k
e
y
>
platformIdentifier
<
/k
e
y
>
<
string
>
com.apple.platform.iphonesimulator
<
/string
>
<
/
d
i
c
t
>
<
/
d
i
c
t
>
<
/
d
i
c
t
>
<
/
d
i
c
t
>
<
/
d
i
c
t
>
<
/
d
i
c
t
>
<
/plist
>
<
/plist
>
Example/GMPhobos/GMViewController.m
View file @
7b79a83e
...
@@ -36,12 +36,11 @@ NSString *const MockCityId = @"beijing";
...
@@ -36,12 +36,11 @@ NSString *const MockCityId = @"beijing";
NSString
*
url
=
@"http://log.test.gengmei.cc/log/collect"
;
NSString
*
url
=
@"http://log.test.gengmei.cc/log/collect"
;
#endif
#endif
[
GMCache
removeObjectAtDocumentPathWithkey
:
PhobosCacheKey
];
[
GMCache
removeObjectAtDocumentPathWithkey
:
PhobosCacheKey
];
Phobos
*
phobos
=
[
Phobos
clientWithAppName
:
MockAppName
channelId
:
MockChannelId
];
[
Phobos
clientWithAppName
:
MockAppName
channelId
:
MockChannelId
];
phobos
.
serverAPI
=
url
;
Phobos
.
sharedClient
.
serverAPI
=
url
;
[
phobos
setLogEnabled
:
NO
];
// 调试打Log模式,看情况开启
[
Phobos
.
sharedClient
setLogEnabled
:
NO
];
// 调试打Log模式,看情况开启
phobos
.
signingType
=
PhobosSigningTypeDebug
;
Phobos
.
sharedClient
.
signingType
=
PhobosSigningTypeDebug
;
phobos
.
userId
=
@""
;
Phobos
.
sharedClient
.
userId
=
@""
;
[
Phobos
setSharedClient
:
phobos
];
NSString
*
inDate
=
[
PhobosUtil
currentTime
];
NSString
*
inDate
=
[
PhobosUtil
currentTime
];
NSMutableDictionary
*
dict
=
[[
NSMutableDictionary
alloc
]
init
];
NSMutableDictionary
*
dict
=
[[
NSMutableDictionary
alloc
]
init
];
...
...
Example/Podfile.lock
View file @
7b79a83e
...
@@ -35,9 +35,9 @@ PODS:
...
@@ -35,9 +35,9 @@ PODS:
- GMKit/Protocol (1.1.3):
- GMKit/Protocol (1.1.3):
- Masonry (= 1.1.0)
- Masonry (= 1.1.0)
- SDWebImage (= 3.7.6)
- SDWebImage (= 3.7.6)
- GMPhobos (1.
2.9
):
- GMPhobos (1.
3.0
):
- GMCache
(= 0.2.3)
- GMCache
- GMKit
(= 1.1.3)
- GMKit
- Masonry (1.1.0)
- Masonry (1.1.0)
- SDWebImage (3.7.6):
- SDWebImage (3.7.6):
- SDWebImage/Core (= 3.7.6)
- SDWebImage/Core (= 3.7.6)
...
@@ -63,7 +63,7 @@ EXTERNAL SOURCES:
...
@@ -63,7 +63,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
SPEC CHECKSUMS:
GMCache: 09a3029c96fe130e3a21faef70b3d9d2ce92d639
GMCache: 09a3029c96fe130e3a21faef70b3d9d2ce92d639
GMKit: 35f788243cceeddf3e13c5226b3ea0b5e08e2117
GMKit: 35f788243cceeddf3e13c5226b3ea0b5e08e2117
GMPhobos:
89d9654a951819abc9285b392e055278d10877f
2
GMPhobos:
c1dd33760f8d4243e6bf562a115899e66c6ec7d
2
Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
SDWebImage: c325cf02c30337336b95beff20a13df489ec0ec9
SDWebImage: c325cf02c30337336b95beff20a13df489ec0ec9
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
...
...
Example/Tests/GMPhobosUtilTest.m
View file @
7b79a83e
...
@@ -7,8 +7,8 @@
...
@@ -7,8 +7,8 @@
//
//
#import <XCTest/XCTest.h>
#import <XCTest/XCTest.h>
#import <GMPhobos/Phobos.h>
#import "PhobosUtil.h"
#import "PhobosUtil.h"
@import
GMPhobos
;
@interface
GMPhobosUtilTest
:
XCTestCase
@interface
GMPhobosUtilTest
:
XCTestCase
@property
(
nonatomic
,
retain
)
NSMutableArray
*
mockArray
;
@property
(
nonatomic
,
retain
)
NSMutableArray
*
mockArray
;
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +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
setSharedClient
:[
Phobos
clientWithAppName
:
@"gengmei_test"
channelId
:
@"AppStore"
]
];
[
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
++
)
{
...
...
Example/Tests/GMPhotoTest.m
View file @
7b79a83e
This diff is collapsed.
Click to expand it.
GMPhobos.podspec
View file @
7b79a83e
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
Pod
::
Spec
.
new
do
|
s
|
Pod
::
Spec
.
new
do
|
s
|
s
.
name
=
"
GMPhobos
"
s
.
name
=
"
GMPhobos
"
s
.
version
=
"1.3.
0
"
s
.
version
=
"1.3.
1
"
s
.
summary
=
"GM statistic data sdk"
s
.
summary
=
"GM statistic data sdk"
s
.
description
=
<<-
DESC
s
.
description
=
<<-
DESC
...
...
GMPhobos/Classes/Phobos.h
View file @
7b79a83e
...
@@ -33,13 +33,14 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
...
@@ -33,13 +33,14 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
*/
*/
+
(
Phobos
*
)
clientWithAppName
:(
NSString
*
)
appName
channelId
:(
NSString
*
)
channelId
;
+
(
Phobos
*
)
clientWithAppName
:(
NSString
*
)
appName
channelId
:(
NSString
*
)
channelId
;
+
(
instancetype
)
sharedClient
;
+
(
instancetype
)
alloc
__attribute__
((
deprecated
));
-
(
instancetype
)
init
__attribute__
((
deprecated
));
+
(
void
)
setSharedClient
:(
Phobos
*
)
client
;
+
(
instancetype
)
new
__attribute__
((
deprecated
));
#pragma mark - SDK配置
#pragma mark - SDK配置
@property
(
class
,
readonly
,
strong
)
Phobos
*
sharedClient
;
// Phobos在处理业务端传递来的参数时会检查是否某个value为空,如果为空会调用这个block以通知业务层,业务层可以上报这个异常,以助解决问题
// Phobos在处理业务端传递来的参数时会检查是否某个value为空,如果为空会调用这个block以通知业务层,业务层可以上报这个异常,以助解决问题
@property
(
nonatomic
,
copy
)
void
(
^
captureNullExpection
)
(
NSString
*
eventId
,
NSDictionary
*
info
);
@property
(
nonatomic
,
copy
)
void
(
^
captureNullExpection
)
(
NSString
*
eventId
,
NSDictionary
*
info
);
...
@@ -133,12 +134,12 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
...
@@ -133,12 +134,12 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
*
*
* @since 0.0.1
* @since 0.0.1
*/
*/
+
(
void
)
track
:(
NSString
*
)
event
Id
attributes
:(
NSDictionary
*
)
attributes
;
+
(
void
)
track
:(
NSString
*
)
event
Name
attributes
:(
NSDictionary
*
)
attributes
;
+
(
void
)
track
:(
NSString
*
)
event
Id
attributes
:(
NSDictionary
*
)
attributes
sendNow
:(
BOOL
)
sendNow
;
+
(
void
)
track
:(
NSString
*
)
event
Name
attributes
:(
NSDictionary
*
)
attributes
sendNow
:(
BOOL
)
sendNow
;
+
(
void
)
track
:(
NSString
*
)
event
Id
;
+
(
void
)
track
:(
NSString
*
)
event
Name
;
/**
/**
* @brief 自定义事件,数量统计 7730 精准曝光.
* @brief 自定义事件,数量统计 7730 精准曝光
/数据链路
.
*
*
* @param eventId 事件Id
* @param eventId 事件Id
* @attributes 参数
* @attributes 参数
...
@@ -146,9 +147,9 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
...
@@ -146,9 +147,9 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
* @currentAPI 当前传过来的API
* @currentAPI 当前传过来的API
* @
* @
*/
*/
+
(
void
)
track
:(
NSString
*
)
event
Id
attributes
:(
NSDictionary
*
)
attributes
currentAPI
:(
NSString
*
)
currentAPI
;
+
(
void
)
track
:(
NSString
*
)
event
Name
attributes
:(
NSDictionary
*
)
attributes
currentAPI
:(
NSString
*
)
currentAPI
;
+
(
void
)
track
:(
NSString
*
)
event
Id
attributes
:(
NSDictionary
*
)
attributes
sendNow
:(
BOOL
)
sendNow
currentAPI
:(
NSString
*
)
currentAPI
;
+
(
void
)
track
:(
NSString
*
)
event
Name
attributes
:(
NSDictionary
*
)
attributes
sendNow
:(
BOOL
)
sendNow
currentAPI
:(
NSString
*
)
currentAPI
;
+
(
void
)
track
:(
NSString
*
)
event
Id
currentAPI
:(
NSString
*
)
currentAPI
;
+
(
void
)
track
:(
NSString
*
)
event
Name
currentAPI
:(
NSString
*
)
currentAPI
;
/**
/**
* @author 翟国钧, 16-02-03 16:02:30
* @author 翟国钧, 16-02-03 16:02:30
...
@@ -183,5 +184,48 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
...
@@ -183,5 +184,48 @@ 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
;
/** 获取serverAPI的非立即发送埋点数据 */
+
(
NSArray
*
)
normalPhobosDataForServerAPI
;
/** 获取url的非立即发送埋点数据 */
+
(
NSArray
*
)
normalPhobosDataForURL
:(
NSString
*
)
url
;
/** 获取所有立即发送埋点数据 */
+
(
NSDictionary
*
)
immediatelyPhobosData
;
/** 获取serverAPI的立即发送埋点数据 */
+
(
NSArray
*
)
immediatelyPhobosForServerAPI
;
/** 获取url的立即发送埋点数据 */
+
(
NSArray
*
)
immediatelyPhobosDataForURL
:(
NSString
*
)
url
;
/** 获取url的立即发送埋点数量 */
+
(
NSUInteger
)
immediatelyPhobosCountForURL
:(
NSString
*
)
url
;
/** 清除非立即发送埋点数据缓存 */
+
(
void
)
removeAllNormalPhobosData
;
/** 清除立即发送埋点数据缓存 */
+
(
void
)
removeAllImmediatelyPhobosData
;
/** 获取将要发送的数据 */
@property
(
nonatomic
,
copy
)
void
(
^
phobosSendDataBlock
)(
NSArray
*
datas
);
@end
@end
NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
GMPhobos/Classes/Phobos.m
View file @
7b79a83e
This diff is collapsed.
Click to expand it.
GMPhobos/Classes/PhobosConfig.h
View file @
7b79a83e
...
@@ -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
CacheKey @"PhobosCacheKey"
//存放持久化埋点数据的key
#define Phobos
NormalCacheKey @"PhobosNormalCacheKey"
//存放持久化埋点数据的key
#define Phobos
TempCacheKey @"PhobosTempCacheKey" //临时存放待发送
埋点数据的key
#define Phobos
ImmediatelyCacheKey @"PhobosImmediatelyCacheKey" //存放持久化实时
埋点数据的key
#define PhobosShardCount 50 //收集数据分段发送的个数
#define PhobosShardCount 50 //收集数据分段发送的个数
...
...
GMPhobos/Classes/PhobosUtil.m
View file @
7b79a83e
...
@@ -127,6 +127,8 @@
...
@@ -127,6 +127,8 @@
//没有错误,返回正确;
//没有错误,返回正确;
if
(
success
)
{
if
(
success
)
{
success
(
200
);
success
(
200
);
}
else
{
success
(
error
.
code
);
}
}
}
}
}];
}];
...
@@ -150,6 +152,8 @@
...
@@ -150,6 +152,8 @@
//没有错误,返回正确;
//没有错误,返回正确;
if
(
success
)
{
if
(
success
)
{
success
(
200
);
success
(
200
);
}
else
{
success
(
error
.
code
);
}
}
}
}
}];
}];
...
...
GMPhobos/Classes/UIResponder+PhobosPV.h
View file @
7b79a83e
...
@@ -25,5 +25,4 @@
...
@@ -25,5 +25,4 @@
*/
*/
-
(
void
)
initReferrerTabName
;
-
(
void
)
initReferrerTabName
;
@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