Commit 784217a7 authored by 朱璇's avatar 朱璇

增加埋点的默认参数

parent 9596309b
...@@ -24,8 +24,11 @@ ...@@ -24,8 +24,11 @@
#else #else
NSString *url = @"http://log.test.gengmei.cc/log/collect"; NSString *url = @"http://log.test.gengmei.cc/log/collect";
#endif #endif
Phobos *client = [Phobos clientWithAppName:@"gengmei_user" channelId:@"123456"];
[Phobos setSharedClient:client];
[Phobos sharedClient].serverAPI = url; [Phobos sharedClient].serverAPI = url;
[Phobos track:@"trace_monitor" attributes:@{} sendNow:YES];
} }
- (void)didReceiveMemoryWarning - (void)didReceiveMemoryWarning
......
...@@ -35,7 +35,7 @@ PODS: ...@@ -35,7 +35,7 @@ PODS:
- GMKit/Protocol (0.8.4): - GMKit/Protocol (0.8.4):
- Masonry (= 1.1.0) - Masonry (= 1.1.0)
- SDWebImage (= 3.7.6) - SDWebImage (= 3.7.6)
- GMPhobos (1.0.7): - GMPhobos (1.1.2):
- GMCache (= 0.2.3) - GMCache (= 0.2.3)
- GMKit - GMKit
- Masonry (1.1.0) - Masonry (1.1.0)
...@@ -63,11 +63,11 @@ EXTERNAL SOURCES: ...@@ -63,11 +63,11 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS: SPEC CHECKSUMS:
GMCache: 09a3029c96fe130e3a21faef70b3d9d2ce92d639 GMCache: 09a3029c96fe130e3a21faef70b3d9d2ce92d639
GMKit: a30da06b84e5c4a357d427c70d1b5ec672a1f6a1 GMKit: a30da06b84e5c4a357d427c70d1b5ec672a1f6a1
GMPhobos: dd0026c837b0909013a9002b7f3e04f28786e24b GMPhobos: 5d9b29fb16fb7b8f3b2983aaab8b42cefc510baa
Masonry: 678fab65091a9290e40e2832a55e7ab731aad201 Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
SDWebImage: c325cf02c30337336b95beff20a13df489ec0ec9 SDWebImage: c325cf02c30337336b95beff20a13df489ec0ec9
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
PODFILE CHECKSUM: ea0fac2144ac80baf8f21576cde49526c19991ad PODFILE CHECKSUM: ea0fac2144ac80baf8f21576cde49526c19991ad
COCOAPODS: 1.6.0.beta.2 COCOAPODS: 1.6.1
...@@ -293,7 +293,7 @@ static NSString *sdkVersion = @"110"; ...@@ -293,7 +293,7 @@ static NSString *sdkVersion = @"110";
+ (void)track:(NSString *)eventId attributes:(NSDictionary *)attributes sendNow:(BOOL)sendNow currentAPI:(NSString *)currentAPI { + (void)track:(NSString *)eventId attributes:(NSDictionary *)attributes sendNow:(BOOL)sendNow currentAPI:(NSString *)currentAPI {
[sharedClient addNewApi:currentAPI]; // 记录新的API [sharedClient addNewApi:currentAPI]; // 记录新的API
NSDictionary *dict = [sharedClient prepareDictionaryForEvent:eventId attributes:attributes]; NSDictionary *dict = [sharedClient prepareDictionaryForEvent:eventId attributes:attributes];
if (sendNow) { if (sendNow && dict != nil) {
NSArray *array = @[dict]; NSArray *array = @[dict];
// 实时发送的埋点,不能立即清楚缓存 // 实时发送的埋点,不能立即清楚缓存
[sharedClient sendArray:array currentAPI:currentAPI cleanCacheRightNow:NO]; [sharedClient sendArray:array currentAPI:currentAPI cleanCacheRightNow:NO];
...@@ -405,7 +405,11 @@ static NSString *sdkVersion = @"110"; ...@@ -405,7 +405,11 @@ static NSString *sdkVersion = @"110";
@(self.gps.coordinate.latitude),@"lat", @(self.gps.coordinate.latitude),@"lat",
@(self.gps.coordinate.longitude),@"lng", @(self.gps.coordinate.longitude),@"lng",
_netStatus,@"is_WiFi", _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: NSMutableDictionary *appParams = [NSMutableDictionary dictionaryWithObjectsAndKeys:
_greyType, @"grey_type", _greyType, @"grey_type",
self.appName, @"name", self.appName, @"name",
......
...@@ -85,5 +85,8 @@ typedef void (^SendDataSuccessBlock)(NSInteger code); ...@@ -85,5 +85,8 @@ typedef void (^SendDataSuccessBlock)(NSInteger code);
*/ */
+ (NSString *)MD5String:(NSString *)str; + (NSString *)MD5String:(NSString *)str;
/**
* 获取联网方式
*/
+(NSString *)networkType;
@end @end
...@@ -446,4 +446,78 @@ ...@@ -446,4 +446,78 @@
return outputString; 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 @end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment