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
784217a7
Commit
784217a7
authored
Apr 04, 2019
by
朱璇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加埋点的默认参数
parent
9596309b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
91 additions
and
7 deletions
+91
-7
GMViewController.m
Example/GMPhobos/GMViewController.m
+4
-1
Podfile.lock
Example/Podfile.lock
+3
-3
Phobos.m
GMPhobos/Classes/Phobos.m
+6
-2
PhobosUtil.h
GMPhobos/Classes/PhobosUtil.h
+4
-1
PhobosUtil.m
GMPhobos/Classes/PhobosUtil.m
+74
-0
No files found.
Example/GMPhobos/GMViewController.m
View file @
784217a7
...
...
@@ -24,8 +24,11 @@
#else
NSString
*
url
=
@"http://log.test.gengmei.cc/log/collect"
;
#endif
Phobos
*
client
=
[
Phobos
clientWithAppName
:
@"gengmei_user"
channelId
:
@"123456"
];
[
Phobos
setSharedClient
:
client
];
[
Phobos
sharedClient
].
serverAPI
=
url
;
[
Phobos
track
:
@"trace_monitor"
attributes
:@{}
sendNow
:
YES
];
}
-
(
void
)
didReceiveMemoryWarning
...
...
Example/Podfile.lock
View file @
784217a7
...
...
@@ -35,7 +35,7 @@ PODS:
- GMKit/Protocol (0.8.4):
- Masonry (= 1.1.0)
- SDWebImage (= 3.7.6)
- GMPhobos (1.
0.7
):
- GMPhobos (1.
1.2
):
- GMCache (= 0.2.3)
- GMKit
- Masonry (1.1.0)
...
...
@@ -63,11 +63,11 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
GMCache: 09a3029c96fe130e3a21faef70b3d9d2ce92d639
GMKit: a30da06b84e5c4a357d427c70d1b5ec672a1f6a1
GMPhobos:
dd0026c837b0909013a9002b7f3e04f28786e24b
GMPhobos:
5d9b29fb16fb7b8f3b2983aaab8b42cefc510baa
Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
SDWebImage: c325cf02c30337336b95beff20a13df489ec0ec9
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
PODFILE CHECKSUM: ea0fac2144ac80baf8f21576cde49526c19991ad
COCOAPODS: 1.6.
0.beta.2
COCOAPODS: 1.6.
1
GMPhobos/Classes/Phobos.m
View file @
784217a7
...
...
@@ -293,7 +293,7 @@ static NSString *sdkVersion = @"110";
+
(
void
)
track
:
(
NSString
*
)
eventId
attributes
:
(
NSDictionary
*
)
attributes
sendNow
:
(
BOOL
)
sendNow
currentAPI
:
(
NSString
*
)
currentAPI
{
[
sharedClient
addNewApi
:
currentAPI
];
// 记录新的API
NSDictionary
*
dict
=
[
sharedClient
prepareDictionaryForEvent
:
eventId
attributes
:
attributes
];
if
(
sendNow
)
{
if
(
sendNow
&&
dict
!=
nil
)
{
NSArray
*
array
=
@[
dict
];
// 实时发送的埋点,不能立即清楚缓存
[
sharedClient
sendArray
:
array
currentAPI
:
currentAPI
cleanCacheRightNow
:
NO
];
...
...
@@ -405,7 +405,11 @@ static NSString *sdkVersion = @"110";
@
(
self
.
gps
.
coordinate
.
latitude
),
@"lat"
,
@
(
self
.
gps
.
coordinate
.
longitude
),
@"lng"
,
_netStatus
,
@"is_WiFi"
,
[
PhobosUtil
getIPAddress
:
YES
],
@"ip"
,
nil
];
[
PhobosUtil
getIPAddress
:
YES
],
@"ip"
,
[[
UIDevice
currentDevice
]
systemVersion
],
@"sys_version"
,
[
PhobosUtil
networkType
],
@"net_type"
,
[
UIDevice
deviceVersion
],
@"model"
,
nil
];
NSMutableDictionary
*
appParams
=
[
NSMutableDictionary
dictionaryWithObjectsAndKeys
:
_greyType
,
@"grey_type"
,
self
.
appName
,
@"name"
,
...
...
GMPhobos/Classes/PhobosUtil.h
View file @
784217a7
...
...
@@ -85,5 +85,8 @@ typedef void (^SendDataSuccessBlock)(NSInteger code);
*/
+
(
NSString
*
)
MD5String
:(
NSString
*
)
str
;
/**
* 获取联网方式
*/
+
(
NSString
*
)
networkType
;
@end
GMPhobos/Classes/PhobosUtil.m
View file @
784217a7
...
...
@@ -446,4 +446,78 @@
return
outputString
;
}
//获取联网方式
+
(
NSString
*
)
networkType
{
// NSArray *subviews = [[[[UIApplication sharedApplication] valueForKey:@"statusBar"] valueForKey:@"foregroundView"] subviews];
// NSNumber *dataNetworkItemView = nil;
//
// for (id subview in subviews) {
// if([subview isKindOfClass:[NSClassFromString(@"UIStatusBarDataNetworkItemView") class]]) {
// dataNetworkItemView = subview;
// break;
// }
// }
// NSString *networkType = nil;
// switch ([[dataNetworkItemView valueForKey:@"dataNetworkType"] integerValue]) {
// case 0:
// networkType = @"无服务";
// break;
//
// case 1:
// networkType = @"2G";
// break;
//
// case 2:
// networkType = @"3G";
// break;
//
// case 3:
// networkType = @"4G";
// break;
//
// case 4:
// networkType = @"LTE";
// break;
//
// case 5:
// networkType = @"Wifi";
// break;
//
// default:
// break;
// }
// return networkType;
CTTelephonyNetworkInfo
*
info
=
[[
CTTelephonyNetworkInfo
alloc
]
init
];
NSString
*
currentStatus
=
info
.
currentRadioAccessTechnology
;
NSString
*
netconnType
=
@""
;
if
([
currentStatus
isEqualToString
:
@"CTRadioAccessTechnologyGPRS"
])
{
netconnType
=
@"GPRS"
;
}
else
if
([
currentStatus
isEqualToString
:
@"CTRadioAccessTechnologyEdge"
])
{
netconnType
=
@"2.75G EDGE"
;
}
else
if
([
currentStatus
isEqualToString
:
@"CTRadioAccessTechnologyWCDMA"
]){
netconnType
=
@"3G"
;
}
else
if
([
currentStatus
isEqualToString
:
@"CTRadioAccessTechnologyHSDPA"
]){
netconnType
=
@"3.5G HSDPA"
;
}
else
if
([
currentStatus
isEqualToString
:
@"CTRadioAccessTechnologyHSUPA"
]){
netconnType
=
@"3.5G HSUPA"
;
}
else
if
([
currentStatus
isEqualToString
:
@"CTRadioAccessTechnologyCDMA1x"
]){
netconnType
=
@"2G"
;
}
else
if
([
currentStatus
isEqualToString
:
@"CTRadioAccessTechnologyCDMAEVDORev0"
]){
netconnType
=
@"3G"
;
}
else
if
([
currentStatus
isEqualToString
:
@"CTRadioAccessTechnologyCDMAEVDORevA"
]){
netconnType
=
@"3G"
;
}
else
if
([
currentStatus
isEqualToString
:
@"CTRadioAccessTechnologyCDMAEVDORevB"
]){
netconnType
=
@"3G"
;
}
else
if
([
currentStatus
isEqualToString
:
@"CTRadioAccessTechnologyeHRPD"
]){
netconnType
=
@"HRPD"
;
}
else
if
([
currentStatus
isEqualToString
:
@"CTRadioAccessTechnologyLTE"
]){
netconnType
=
@"4G"
;
}
else
{
netconnType
=
@"WiFi"
;
}
return
netconnType
;
}
@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