backupsFileRecordCell.m 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. //
  2. // backupsFileRecordCell.m
  3. // 隐私保护
  4. //
  5. // Created by xd h on 2024/1/4.
  6. //
  7. #import "backupsFileRecordCell.h"
  8. #import "cachesFileManager.h"
  9. #import <SDWebImage/SDWebImage.h>
  10. @interface backupsFileRecordCell ()
  11. @property(nonatomic,strong) UIImageView *fileImageView;
  12. @property(nonatomic,strong) UIButton *upLoadStateButton;
  13. @property (nonatomic, strong) UIButton *selectButton;
  14. @property(nonatomic,strong) UIView *progressBgView;
  15. @property(nonatomic,strong) UIView *progressSelectView;
  16. @property(nonatomic,strong) CAGradientLayer *glayer;
  17. @property(nonatomic,strong) UILabel *fileNamelabel;
  18. @property(nonatomic,strong) UILabel *fileTimelabel;
  19. @property(nonatomic,strong) UILabel *fileProgresslabel;
  20. @property(nonatomic,strong) UILabel *fileSpeedlabel;
  21. @property(nonatomic,strong) UILabel *rightTiplabel;
  22. @end
  23. @implementation backupsFileRecordCell
  24. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  25. {
  26. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  27. if (self)
  28. {
  29. [self drawView];
  30. }
  31. return self;
  32. }
  33. - (void)drawView
  34. {
  35. _fileImageView = [[UIImageView alloc] init];
  36. //_fileImageView.backgroundColor = [UIColor greenColor];
  37. [self.contentView addSubview:_fileImageView];
  38. [_fileImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  39. make.left.mas_equalTo(15);
  40. make.width.mas_equalTo(34);
  41. make.height.mas_equalTo(34);
  42. make.bottom.mas_equalTo(-18);
  43. }];
  44. _upLoadStateButton = [[UIButton alloc] init];
  45. //_upLoadStateButton.backgroundColor = [UIColor redColor];
  46. [self.contentView addSubview:_upLoadStateButton];
  47. [_upLoadStateButton addTarget:self action:@selector(tapClick:) forControlEvents:UIControlEventTouchUpInside];
  48. [_upLoadStateButton mas_makeConstraints:^(MASConstraintMaker *make) {
  49. make.right.mas_equalTo(-5);
  50. make.width.mas_equalTo(50);
  51. make.height.mas_equalTo(50);
  52. make.bottom.mas_equalTo(-18);
  53. }];
  54. if (self.selectButton == nil) {
  55. UIButton *but = [[UIButton alloc] init];
  56. [but setImage:[UIImage imageNamed:@"upload_file_uncheck"] forState:UIControlStateNormal];
  57. [but setImage:[UIImage imageNamed:@"upload_file_check"] forState:UIControlStateSelected];
  58. [self.contentView addSubview:but];
  59. [but addTarget:self action:@selector(didClickSelectButFun:) forControlEvents:UIControlEventTouchUpInside];
  60. but.hidden = YES;
  61. //but.backgroundColor = [UIColor greenColor];
  62. //but.frame = CGRectMake([UIScreen mainScreen].bounds.size.width -10 - 25, 0, 25, 25);
  63. [but mas_makeConstraints:^(MASConstraintMaker *make) {
  64. make.width.mas_equalTo(30);
  65. make.height.mas_equalTo(30);
  66. make.centerX.mas_equalTo(_upLoadStateButton.mas_centerX);
  67. make.centerY.mas_equalTo(_upLoadStateButton.mas_centerY);
  68. }];
  69. self.selectButton = but;
  70. }
  71. _progressBgView = [[UIView alloc] init];
  72. _progressBgView.backgroundColor = [UIColor hwColor:@"#F9F9F9" alpha:1.0];
  73. _progressBgView.layer.cornerRadius = 1.5;
  74. _progressBgView.layer.masksToBounds = YES;
  75. [self.contentView addSubview:_progressBgView];
  76. [_progressBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  77. make.left.mas_equalTo(_fileImageView.mas_right).offset(10);
  78. make.right.mas_equalTo(_upLoadStateButton.mas_left).offset(-10);
  79. make.height.mas_equalTo(2);
  80. make.centerY.mas_equalTo(0);
  81. }];
  82. _progressSelectView = [[UIView alloc] init];
  83. //_progressSelectView.backgroundColor = [UIColor hwColor:@"#F9F9F9" alpha:1.0];
  84. _progressSelectView.layer.cornerRadius = 1.5;
  85. _progressSelectView.layer.masksToBounds = YES;
  86. [_progressBgView addSubview:_progressSelectView];
  87. // [_progressSelectView mas_makeConstraints:^(MASConstraintMaker *make) {
  88. // make.left.mas_equalTo(0);
  89. // make.right.mas_equalTo(-100);
  90. // make.height.mas_equalTo(3);
  91. // make.centerY.mas_equalTo(0);
  92. // }];
  93. // gradient
  94. _glayer = [CAGradientLayer layer];
  95. _glayer.startPoint = CGPointMake(0, 0.5);
  96. _glayer.endPoint = CGPointMake(1, 0.5);
  97. _glayer.colors = @[(__bridge id)[UIColor hwColor:@"#0BDDFD" alpha:1.0].CGColor, (__bridge id)[UIColor hwColor:@"#048CFB" alpha:1.0].CGColor];
  98. _glayer.locations = @[@(0), @(1.0f)];
  99. [_progressSelectView.layer addSublayer:_glayer];
  100. CGRect frame = CGRectMake(0, 0, SCREEN_W, 2);
  101. //_progressSelectView.frame = frame;
  102. _glayer.frame = frame;
  103. _fileNamelabel = [[UILabel alloc] init];
  104. _fileNamelabel.font = [UIFont boldSystemFontOfSize:16.0];
  105. _fileNamelabel.textColor = [UIColor blackColor];
  106. //_fileNamelabel.backgroundColor = [UIColor orangeColor];
  107. [self.contentView addSubview:_fileNamelabel];
  108. [_fileNamelabel mas_makeConstraints:^(MASConstraintMaker *make) {
  109. make.left.mas_equalTo(_fileImageView.mas_right).offset(10);
  110. make.right.mas_equalTo(self.mas_centerX).offset(-20);
  111. make.height.mas_equalTo(19);
  112. make.bottom.mas_equalTo(_progressBgView.mas_top).offset(-3);
  113. }];
  114. _fileTimelabel = [[UILabel alloc] init];
  115. //_fileTimelabel.font = [UIFont systemFontOfSize:13.0];
  116. _fileTimelabel.adjustsFontSizeToFitWidth = YES;
  117. _fileTimelabel.textColor = [UIColor blackColor];
  118. _fileTimelabel.textAlignment = NSTextAlignmentRight;
  119. //_fileTimelabel.backgroundColor = [UIColor greenColor];
  120. [self.contentView addSubview:_fileTimelabel];
  121. //_fileTimelabel.text = @"当前文件预计需20分";
  122. [_fileTimelabel mas_makeConstraints:^(MASConstraintMaker *make) {
  123. make.left.mas_equalTo(self.mas_centerX).offset(-20);
  124. make.right.mas_equalTo(_upLoadStateButton.mas_left).offset(-10);
  125. make.height.mas_equalTo(15);
  126. make.bottom.mas_equalTo(_progressBgView.mas_top).offset(-3);
  127. }];
  128. _fileProgresslabel = [[UILabel alloc] init];
  129. _fileProgresslabel.font = [UIFont systemFontOfSize:12.0];
  130. _fileProgresslabel.textColor = [UIColor hwColor:@"#959799" alpha:1.0];
  131. //_fileProgresslabel.backgroundColor = [UIColor greenColor];
  132. [self.contentView addSubview:_fileProgresslabel];
  133. [_fileProgresslabel mas_makeConstraints:^(MASConstraintMaker *make) {
  134. make.left.mas_equalTo(_fileImageView.mas_right).offset(10);
  135. make.right.mas_equalTo(_progressBgView.mas_centerX).offset(100);
  136. make.height.mas_equalTo(15);
  137. make.top.mas_equalTo(_progressBgView.mas_bottom).offset(3);
  138. }];
  139. _fileSpeedlabel = [[UILabel alloc] init];
  140. _fileSpeedlabel.font = [UIFont systemFontOfSize:12.0];
  141. _fileSpeedlabel.textColor = [UIColor hwColor:@"#959799" alpha:1.0];
  142. _fileSpeedlabel.textAlignment = NSTextAlignmentRight;
  143. //_fileSpeedlabel.backgroundColor = [UIColor blackColor];
  144. [self.contentView addSubview:_fileSpeedlabel];
  145. [_fileSpeedlabel mas_makeConstraints:^(MASConstraintMaker *make) {
  146. make.right.mas_equalTo(_upLoadStateButton.mas_left).offset(-10);
  147. make.left.mas_equalTo(_progressBgView.mas_centerX);
  148. make.height.mas_equalTo(15);
  149. make.top.mas_equalTo(_progressBgView.mas_bottom).offset(3);
  150. }];
  151. _rightTiplabel = [[UILabel alloc] init];
  152. _rightTiplabel.font = [UIFont systemFontOfSize:12.0];
  153. _rightTiplabel.textColor = [UIColor hwColor:@"#959799" alpha:1.0];
  154. _rightTiplabel.textAlignment = NSTextAlignmentRight;
  155. _rightTiplabel.numberOfLines = 0;
  156. //_fileSpeedlabel.backgroundColor = [UIColor blackColor];
  157. [self.contentView addSubview:_rightTiplabel];
  158. [_rightTiplabel mas_makeConstraints:^(MASConstraintMaker *make) {
  159. make.right.mas_equalTo(-15.0);
  160. make.left.mas_equalTo(_progressBgView.mas_centerX).offset(-40);
  161. make.height.mas_equalTo(30);
  162. make.centerY.mas_equalTo(0);
  163. }];
  164. //长按手势
  165. UILongPressGestureRecognizer *longPressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressClick:)];
  166. //用几个手指触屏,默认1
  167. longPressGesture.numberOfTouchesRequired = 1;
  168. //设置最短长按时间,单位为秒(默认0.5)
  169. longPressGesture.minimumPressDuration = 1;
  170. //设置手势识别期间所允许的手势可移动范围
  171. longPressGesture.allowableMovement = 10;
  172. [self.contentView addGestureRecognizer:longPressGesture];
  173. }
  174. - (void)setIsEditType:(BOOL)isEditType
  175. {
  176. _isEditType = isEditType;
  177. if(isEditType){
  178. self.selectButton.hidden = NO;
  179. // if(_curUploadFileDataModel.curUploadStateType == uploadStateWait
  180. // ||_curUploadFileDataModel.curUploadStateType == uploadStateUploading
  181. // ||_curUploadFileDataModel.curUploadStateType == uploadStateSuspend){
  182. _upLoadStateButton.hidden = YES;
  183. //}
  184. }
  185. else{
  186. self.selectButton.hidden = YES;
  187. // if(_curUploadFileDataModel.curUploadStateType == uploadStateWait
  188. // ||_curUploadFileDataModel.curUploadStateType == uploadStateUploading
  189. // ||_curUploadFileDataModel.curUploadStateType == uploadStateSuspend){
  190. _upLoadStateButton.hidden = NO;
  191. //}
  192. }
  193. }
  194. - (void)setIsSelectType:(BOOL)isSelectType
  195. {
  196. _isSelectType = isSelectType;
  197. if(isSelectType){
  198. self.selectButton.selected = YES;
  199. }
  200. else{
  201. self.selectButton.selected = NO;
  202. }
  203. }
  204. - (void)setCurPhotosBackupsTaskModel:(photosBackupsTaskModel *)curPhotosBackupsTaskModel
  205. {
  206. _curPhotosBackupsTaskModel = curPhotosBackupsTaskModel;
  207. //test code
  208. //_curPhotosBackupsTaskModel.curBackupsState = backupsStateUploading;
  209. _fileImageView.image = [UIImage imageNamed:@"uploadFile_image"];
  210. _fileSpeedlabel.hidden = YES;
  211. _rightTiplabel.hidden = YES;
  212. _progressBgView.hidden = NO;
  213. if(_curPhotosBackupsTaskModel.curBackupsState == backupsStateUploading){
  214. _upLoadStateButton.hidden = NO;
  215. [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_suspend"] forState:UIControlStateNormal];
  216. _fileSpeedlabel.hidden = NO;
  217. //
  218. //_fileSpeedlabel.text = @"";
  219. if(_curPhotosBackupsTaskModel.preTimeInterval <= 0 ||_curPhotosBackupsTaskModel.preDidUploadBytes <=0){
  220. _fileSpeedlabel.text = @"--";
  221. [self handlFileTimelabelFunBy:0];
  222. HLog(@"111: %f",_curPhotosBackupsTaskModel.preTimeInterval);
  223. }
  224. else{
  225. NSTimeInterval timers = _curPhotosBackupsTaskModel.curTimeInterval - _curPhotosBackupsTaskModel.preTimeInterval;
  226. long curUploadSize = _curPhotosBackupsTaskModel.didUploadBytes - _curPhotosBackupsTaskModel.preDidUploadBytes;
  227. if(timers > 0 && curUploadSize > 0){
  228. //long speed= EachPieceSzie / timers;
  229. // if(curUploadSize <0 || curUploadSize> EachPieceSzie){
  230. // curUploadSize = EachPieceSzie;
  231. // }
  232. if(curUploadSize < 0 || curUploadSize> MaxNasUploadPieceSzie){
  233. curUploadSize = MaxNasUploadPieceSzie;
  234. }
  235. long speed = curUploadSize/timers;
  236. NSString * speedStr = nil;
  237. NSInteger speed_k = speed / (1024);
  238. if(speed == 0){
  239. speedStr = @"--";
  240. }
  241. else if(speed_k < 1024){
  242. speedStr = [[NSString alloc] initWithFormat:@"%ldKB/s",speed_k];
  243. }
  244. else {
  245. speedStr = [[NSString alloc] initWithFormat:@"%.2fMB/s",speed_k/1024.0];
  246. }
  247. _fileSpeedlabel.text = speedStr;
  248. [self handlFileTimelabelFunBy:speed];
  249. }
  250. }
  251. }
  252. else if(_curPhotosBackupsTaskModel.curBackupsState == backupsStateSuspend){
  253. [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_start"] forState:UIControlStateNormal];
  254. _fileSpeedlabel.text = _curPhotosBackupsTaskModel.backupsTipMsg;
  255. _fileSpeedlabel.hidden = NO;
  256. _upLoadStateButton.hidden = NO;
  257. [self handlFileTimelabelFunBy:-1];
  258. }
  259. else if(_curPhotosBackupsTaskModel.curBackupsState == backupsStateFail){
  260. _upLoadStateButton.hidden = YES;
  261. _progressBgView.hidden = YES;
  262. [self handlFileTimelabelFunBy:-1];
  263. }
  264. else{
  265. _upLoadStateButton.hidden = YES;
  266. _progressBgView.hidden = YES;
  267. [self handlFileTimelabelFunBy:-1];
  268. }
  269. _fileNamelabel.text = NSLocalizedString(@"set_Privacy_title_image",nil);
  270. _curPhotosBackupsTaskModel.preTimeInterval = _curPhotosBackupsTaskModel.curTimeInterval;
  271. _curPhotosBackupsTaskModel.preDidUploadBytes = _curPhotosBackupsTaskModel.didUploadBytes;
  272. if(_curPhotosBackupsTaskModel.curBackupsState == backupsStateDone){
  273. NSString * curTimerStr = _curPhotosBackupsTaskModel.bg_updateTime;
  274. if(!curTimerStr){
  275. curTimerStr = _curPhotosBackupsTaskModel.bg_createTime;
  276. }
  277. if(curTimerStr){
  278. curTimerStr = [curTimerStr substringToIndex:(curTimerStr.length -4)];
  279. }
  280. _fileProgresslabel.text = curTimerStr;
  281. _rightTiplabel.hidden = NO;
  282. _rightTiplabel.text = [[NSString alloc] initWithFormat:@"%@:%ld",NSLocalizedString(@"backups_cur_task_done_numbers",nil),_curPhotosBackupsTaskModel.didBackupsCount];
  283. }
  284. else if(_curPhotosBackupsTaskModel.curBackupsState == backupsStateFail){
  285. _fileProgresslabel.text = [[NSString alloc] initWithFormat:@"%ld/%ld",_curPhotosBackupsTaskModel.didBackupsCount,_curPhotosBackupsTaskModel.count];
  286. //_curPhotosBackupsTaskModel.backupsTipMsg = @"备份失败,备份路径不存在";
  287. _rightTiplabel.hidden = NO;
  288. _rightTiplabel.textColor = [UIColor hwColor:@"#DD4E4E" alpha:1.0];
  289. _rightTiplabel.text = _curPhotosBackupsTaskModel.backupsTipMsg;
  290. }
  291. else{
  292. //_fileProgresslabel.text = [[NSString alloc] initWithFormat:@"%ld/%ld",_curPhotosBackupsTaskModel.didBackupsCount,_curPhotosBackupsTaskModel.count - _curPhotosBackupsTaskModel.failCount];
  293. [self handlFileProgresslabelFun];
  294. //进度设置
  295. CGRect frame = CGRectMake(0, 0, SCREEN_W - 15*2 - 34*2, 2);
  296. CGFloat curProgress = _curPhotosBackupsTaskModel.didBackupsCount/((_curPhotosBackupsTaskModel.count - _curPhotosBackupsTaskModel.failCount)*1.0);
  297. //只有一个任务的时候
  298. if(_curPhotosBackupsTaskModel.LocalIdentifierArr.count == 1
  299. && _curPhotosBackupsTaskModel.didBackupsCount == 0){
  300. curProgress = _curPhotosBackupsTaskModel.didUploadBytes / (_curPhotosBackupsTaskModel.totalBytes*1.0);
  301. }
  302. //curProgress = _curPhotosBackupsTaskModel.didUploadBytes / (_curPhotosBackupsTaskModel.totalBytes*1.0);
  303. if(curProgress > 1){
  304. curProgress = 1;
  305. }
  306. frame.size.width = frame.size.width * curProgress;
  307. if (isnan(frame.size.width))
  308. {
  309. return;
  310. }
  311. _progressSelectView.frame = frame;
  312. //_glayer.frame = frame;
  313. }
  314. HLog(@"111: end");
  315. }
  316. - (void)handlFileTimelabelFunBy:(NSInteger)speed
  317. {
  318. NSString * timeStr = @"--";
  319. CGFloat estimateTime = 0.0;
  320. if(speed < 0){
  321. _fileTimelabel.text = @"";
  322. return;
  323. }
  324. else if (speed == 0){
  325. //不处理
  326. //estimateTime = 0.0;
  327. }
  328. else{
  329. if(_curPhotosBackupsTaskModel.totalBytes >0
  330. && _curPhotosBackupsTaskModel.didUploadBytes>0
  331. && _curPhotosBackupsTaskModel.totalBytes > _curPhotosBackupsTaskModel.didUploadBytes){
  332. estimateTime = (_curPhotosBackupsTaskModel.totalBytes - _curPhotosBackupsTaskModel.didUploadBytes)/speed;
  333. }
  334. }
  335. //HLog(@"1111111111 %ld %ld %ld %ld %f",_curPhotosBackupsTaskModel.totalBytes,_curPhotosBackupsTaskModel.didUploadBytes,_curPhotosBackupsTaskModel.totalBytes-_curPhotosBackupsTaskModel.didUploadBytes,speed,estimateTime)
  336. if(estimateTime>0){
  337. NSInteger seconds = (NSInteger)estimateTime;
  338. if(seconds >= 60){
  339. timeStr = [[NSString alloc] initWithFormat:@"%ld%@",seconds/60,NSLocalizedString(@"common_minute",nil)];
  340. }
  341. else{
  342. timeStr = [[NSString alloc] initWithFormat:@"%ld%@",seconds,NSLocalizedString(@"common_second",nil)];
  343. }
  344. }
  345. _fileTimelabel.text = [[NSString alloc] initWithFormat:@"%@%@",NSLocalizedString(@"Estimated_time",nil),timeStr];
  346. HLog(@"%@ 111: %@ 222: %@ 333: %ld 444:%f total:%ld didUpload:%ld error:%d",_curPhotosBackupsTaskModel.filename,_fileTimelabel.text,timeStr,speed,estimateTime,_curPhotosBackupsTaskModel.totalBytes,_curPhotosBackupsTaskModel.didUploadBytes,_curPhotosBackupsTaskModel.totalBytes>=_curPhotosBackupsTaskModel.didUploadBytes?0:1);
  347. }
  348. - (void)handlFileProgresslabelFun
  349. {
  350. if(_curPhotosBackupsTaskModel.totalBytes == 0){
  351. _fileProgresslabel.text = @"";
  352. return;
  353. }
  354. NSString * totalSizeStr = nil;
  355. NSInteger totalSize_k = _curPhotosBackupsTaskModel.totalBytes / 1024;
  356. if(totalSize_k < 1024){
  357. totalSizeStr = [[NSString alloc] initWithFormat:@"%ldKB",totalSize_k];
  358. }
  359. else if( totalSize_k >= 1024 && totalSize_k < 1024*1024){
  360. totalSizeStr = [[NSString alloc] initWithFormat:@"%.2fMB",totalSize_k/1024.0];
  361. }
  362. else{
  363. totalSizeStr = [[NSString alloc] initWithFormat:@"%.2fG",totalSize_k/1024.0/1024.0];
  364. }
  365. NSString * didUploadStr = nil;
  366. NSInteger didUploadSize_k = _curPhotosBackupsTaskModel.didUploadBytes / 1024;
  367. if(didUploadSize_k < 1024){
  368. didUploadStr = [[NSString alloc] initWithFormat:@"%ldKB",didUploadSize_k];
  369. }
  370. else if( didUploadSize_k >= 1024 && didUploadSize_k < 1024*1024){
  371. didUploadStr = [[NSString alloc] initWithFormat:@"%.2fMB",didUploadSize_k/1024.0];
  372. }
  373. else{
  374. didUploadStr = [[NSString alloc] initWithFormat:@"%.2fG",didUploadSize_k/1024.0/1024.0];
  375. }
  376. _fileProgresslabel.text = [[NSString alloc] initWithFormat:@"%@/%@",didUploadStr,totalSizeStr];
  377. }
  378. -(void)longPressClick:(UILongPressGestureRecognizer *)press{
  379. //state属性是所有手势父类提供的方法,用于记录手势的状态
  380. if(press.state == UIGestureRecognizerStateBegan){
  381. //NSLog(@"长按手势开始响应!");
  382. if(_didLongPressClick){
  383. _didLongPressClick();
  384. }
  385. }else if (press.state == UIGestureRecognizerStateChanged){
  386. //NSLog(@"长按手势状态发生改变!");
  387. }else{
  388. //NSLog(@"长按手势结束!");
  389. }
  390. }
  391. - (void)didClickSelectButFun:(UIButton*)but
  392. {
  393. but.selected = !but.selected;
  394. if(_didClckSelectBut){
  395. _didClckSelectBut(but.selected);
  396. }
  397. }
  398. - (void)tapClick:(UIButton*)but{
  399. if(_didTapPressClick){
  400. _didTapPressClick();
  401. }
  402. if(_curPhotosBackupsTaskModel.curBackupsState == backupsStateUploading){
  403. [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_start"] forState:UIControlStateNormal];
  404. }
  405. else if(_curPhotosBackupsTaskModel.curBackupsState == backupsStateSuspend){
  406. [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_suspend"] forState:UIControlStateNormal];
  407. }
  408. but.userInteractionEnabled = NO;
  409. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  410. but.userInteractionEnabled = YES;
  411. });
  412. }
  413. @end