Commit eea2869b authored by 井庆林's avatar 井庆林

phobos重构

parent 2e1dbac1
...@@ -131,12 +131,12 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) { ...@@ -131,12 +131,12 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
* *
* @since 0.0.1 * @since 0.0.1
*/ */
+ (void)track:(NSString *)eventId attributes:(NSDictionary *)attributes; + (void)track:(NSString *)eventName attributes:(NSDictionary *)attributes;
+ (void)track:(NSString *)eventId attributes:(NSDictionary *)attributes sendNow:(BOOL)sendNow; + (void)track:(NSString *)eventName attributes:(NSDictionary *)attributes sendNow:(BOOL)sendNow;
+ (void)track:(NSString *)eventId; + (void)track:(NSString *)eventName;
/** /**
* @brief 自定义事件,数量统计 7730 精准曝光. * @brief 自定义事件,数量统计 7730 精准曝光/数据链路.
* *
* @param eventId 事件Id * @param eventId 事件Id
* @attributes 参数 * @attributes 参数
...@@ -144,9 +144,9 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) { ...@@ -144,9 +144,9 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
* @currentAPI 当前传过来的API * @currentAPI 当前传过来的API
* @ * @
*/ */
+ (void)track:(NSString *)eventId attributes:(NSDictionary *)attributes currentAPI:(NSString *)currentAPI; + (void)track:(NSString *)eventName attributes:(NSDictionary *)attributes currentAPI:(NSString *)currentAPI;
+ (void)track:(NSString *)eventId attributes:(NSDictionary *)attributes sendNow:(BOOL)sendNow currentAPI:(NSString *)currentAPI; + (void)track:(NSString *)eventName attributes:(NSDictionary *)attributes sendNow:(BOOL)sendNow currentAPI:(NSString *)currentAPI;
+ (void)track:(NSString *)eventId currentAPI:(NSString *)currentAPI; + (void)track:(NSString *)eventName currentAPI:(NSString *)currentAPI;
/** /**
* @author 翟国钧, 16-02-03 16:02:30 * @author 翟国钧, 16-02-03 16:02:30
......
This diff is collapsed.
...@@ -18,7 +18,8 @@ ...@@ -18,7 +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 PhobosCacheKey @"PhobosCacheKey" //存放持久化埋点数据的key #define PhobosNormalCacheKey @"PhobosNormalCacheKey" //存放持久化埋点数据的key
#define PhobosRealTimeCacheKeys @"PhobosRealTimeCacheKey" //存放持久化实时埋点数据的key
#define PhobosTempCacheKey @"PhobosTempCacheKey" //临时存放待发送埋点数据的key #define PhobosTempCacheKey @"PhobosTempCacheKey" //临时存放待发送埋点数据的key
#define PhobosShardCount 50 //收集数据分段发送的个数 #define PhobosShardCount 50 //收集数据分段发送的个数
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
typedef void (^SendDataSuccessBlock)(NSInteger code); typedef void (^SendDataSuccessBlock)(BOOL success);
@interface PhobosUtil : NSObject @interface PhobosUtil : NSObject
......
...@@ -123,11 +123,8 @@ ...@@ -123,11 +123,8 @@
// 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 (!error) {
//没有错误,返回正确;
if (success) { if (success) {
success(200); success(!error ? YES : NO);
}
} }
}]; }];
[dataTask resume]; [dataTask resume];
......
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