Authored by 孟顺

为大数据库新增delegate

review by 枪兵
... ... @@ -19,6 +19,9 @@ typedef NS_ENUM(NSInteger, YHLogStrategy) {
@class YHEvent;
@class YHError;
@protocol YH_AnalyticsDelegate;
@interface YH_Analytics : NSObject
/**
* 获取统计对象的实例
... ... @@ -170,4 +173,21 @@ typedef NS_ENUM(NSInteger, YHLogStrategy) {
*/
@property (copy, nonatomic) void(^errorBlock)(NSDictionary *dict);
@property (weak, nonatomic) id <YH_AnalyticsDelegate>delegate;
@end
@protocol YH_AnalyticsDelegate<NSObject>
@optional
/**
大数据发生上报事件时, 即将上报代理
@param eventId Event Name
@since 6.6.3
*/
- (void)willSendLogWithEventID:(NSString *)eventId;
@end
... ...
... ... @@ -262,6 +262,12 @@
- (void)logEvent:(NSString *)eventId parameters:(NSDictionary *)param
{
YALog(@"logEvent %@, %@", eventId, param);
if (_delegate
&& [_delegate respondsToSelector:@selector(willSendLogWithEventID:)]) {
[_delegate willSendLogWithEventID:eventId];
}
YHEvent *event = [[YHEvent alloc] init];
event.op = eventId;
event.uid = self.uid ? self.uid : @"";
... ...