Authored by 刘金林

thread safty & image metrics report control

@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
16 @property (copy, nonatomic) NSString *os; // 操作系统 16 @property (copy, nonatomic) NSString *os; // 操作系统
17 @property (copy, nonatomic) NSString *osv; // 操作系统版本 17 @property (copy, nonatomic) NSString *osv; // 操作系统版本
18 @property (copy, nonatomic) NSString *dm; // 设备型号 18 @property (copy, nonatomic) NSString *dm; // 设备型号
19 -@property (copy, nonatomic) NSString *ps; // 手机系统推送开关状态 19 +@property (copy, atomic) NSString *ps; // 手机系统推送开关状态
20 @property (copy, nonatomic) NSString *av; // app版本号 20 @property (copy, nonatomic) NSString *av; // app版本号
21 @property (copy, nonatomic) NSString *ab; // app build号 21 @property (copy, nonatomic) NSString *ab; // app build号
22 @property (copy, nonatomic) NSString *net; // 当前网络状态 0-未知,1-Wifi,2-2G,3-3F,4-4G 22 @property (copy, nonatomic) NSString *net; // 当前网络状态 0-未知,1-Wifi,2-2G,3-3F,4-4G
@@ -79,6 +79,9 @@ @@ -79,6 +79,9 @@
79 static dispatch_once_t onceToken; 79 static dispatch_once_t onceToken;
80 dispatch_once(&onceToken, ^{ 80 dispatch_once(&onceToken, ^{
81 [[NSNotificationCenter defaultCenter] addObserverForName:@"yoho_image_download_network_metrics" object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * _Nonnull note) { 81 [[NSNotificationCenter defaultCenter] addObserverForName:@"yoho_image_download_network_metrics" object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * _Nonnull note) {
  82 + if (![YHEventReport sharedInstance].isAppReportEnable || ![YHEventReport sharedInstance].isImagePerformanceTrackEnable) {
  83 + return ;
  84 + }
82 dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 85 dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
83 [self reportImageViewPerformanceForNotification:note]; 86 [self reportImageViewPerformanceForNotification:note];
84 }); 87 });