@@ -415,16 +415,9 @@ - (void)swipeableTableViewCell:(SWTableViewCell *)cell didTriggerRightUtilityBut
415415 }else {
416416 __weak typeof (self) weakSelf = self;
417417
418- UIActionSheet *actionSheet = [UIActionSheet bk_actionSheetWithTitle: [NSString stringWithFormat: @" 确定要删除文件夹:%@ ?" ,folder.name]];
419- [actionSheet bk_setDestructiveButtonWithTitle: @" 确认删除" handler: nil ];
420- [actionSheet bk_setCancelButtonWithTitle: @" 取消" handler: nil ];
421- [actionSheet bk_setDidDismissBlock: ^(UIActionSheet *sheet, NSInteger index) {
422- switch (index) {
423- case 0 :
424- [weakSelf deleteFolder: folder];
425- break ;
426- default :
427- break ;
418+ UIActionSheet *actionSheet = [UIActionSheet bk_actionSheetCustomWithTitle: [NSString stringWithFormat: @" 确定要删除文件夹:%@ ?" ,folder.name] buttonTitles: nil destructiveTitle: @" 确认删除" cancelTitle: @" 取消" andDidDismissBlock: ^(UIActionSheet *sheet, NSInteger index) {
419+ if (index == 0 ) {
420+ [weakSelf deleteFolder: folder];
428421 }
429422 }];
430423 [actionSheet showInView: kKeyWindow ];
@@ -477,13 +470,10 @@ - (void)deleteFile:(ProjectFile *)file{
477470
478471 NSURL *fileUrl = [file hasBeenDownload ];
479472 Coding_DownloadTask *cDownloadTask = [file cDownloadTask ];
480-
473+ UIActionSheet *actionSheet;
474+
481475 if (fileUrl) {
482- UIActionSheet *actionSheet = [UIActionSheet bk_actionSheetWithTitle: @" 只是删除本地文件还是连同服务器文件一起删除?" ];
483- [actionSheet bk_addButtonWithTitle: @" 仅删除本地文件" handler: nil ];
484- [actionSheet bk_setDestructiveButtonWithTitle: @" 一起删除" handler: nil ];
485- [actionSheet bk_setCancelButtonWithTitle: @" 取消" handler: nil ];
486- [actionSheet bk_setDidDismissBlock: ^(UIActionSheet *sheet, NSInteger index) {
476+ actionSheet = [UIActionSheet bk_actionSheetCustomWithTitle: @" 只是删除本地文件还是连同服务器文件一起删除?" buttonTitles: @[@" 仅删除本地文件" ] destructiveTitle: @" 一起删除" cancelTitle: @" 取消" andDidDismissBlock: ^(UIActionSheet *sheet, NSInteger index) {
487477 switch (index) {
488478 case 0 :
489479 [weakSelf deleteFile: weakFile fromDisk: YES ];
@@ -495,13 +485,8 @@ - (void)deleteFile:(ProjectFile *)file{
495485 break ;
496486 }
497487 }];
498- [actionSheet showInView: kKeyWindow ];
499488 }else if (cDownloadTask){
500- UIActionSheet *actionSheet = [UIActionSheet bk_actionSheetWithTitle: @" 确定将服务器上的该文件删除?" ];
501- [actionSheet bk_addButtonWithTitle: @" 只是取消下载" handler: nil ];
502- [actionSheet bk_setDestructiveButtonWithTitle: @" 确认删除" handler: nil ];
503- [actionSheet bk_setCancelButtonWithTitle: @" 取消" handler: nil ];
504- [actionSheet bk_setDidDismissBlock: ^(UIActionSheet *sheet, NSInteger index) {
489+ actionSheet = [UIActionSheet bk_actionSheetCustomWithTitle: @" 确定将服务器上的该文件删除?" buttonTitles: @[@" 只是取消下载" ] destructiveTitle: @" 确认删除" cancelTitle: @" 取消" andDidDismissBlock: ^(UIActionSheet *sheet, NSInteger index) {
505490 switch (index) {
506491 case 0 :
507492 [weakSelf deleteFile: weakFile fromDisk: YES ];
@@ -513,22 +498,14 @@ - (void)deleteFile:(ProjectFile *)file{
513498 break ;
514499 }
515500 }];
516- [actionSheet showInView: kKeyWindow ];
517501 }else {
518- UIActionSheet *actionSheet = [UIActionSheet bk_actionSheetWithTitle: @" 确定将服务器上的该文件删除?" ];
519- [actionSheet bk_setDestructiveButtonWithTitle: @" 确认删除" handler: nil ];
520- [actionSheet bk_setCancelButtonWithTitle: @" 取消" handler: nil ];
521- [actionSheet bk_setDidDismissBlock: ^(UIActionSheet *sheet, NSInteger index) {
522- switch (index) {
523- case 0 :
524- [weakSelf deleteFile: weakFile fromDisk: NO ];
525- break ;
526- default :
527- break ;
502+ actionSheet = [UIActionSheet bk_actionSheetCustomWithTitle: @" 确定将服务器上的该文件删除?" buttonTitles: nil destructiveTitle: @" 确认删除" cancelTitle: @" 取消" andDidDismissBlock: ^(UIActionSheet *sheet, NSInteger index) {
503+ if (index == 0 ) {
504+ [weakSelf deleteFile: weakFile fromDisk: NO ];
528505 }
529506 }];
530- [actionSheet showInView: kKeyWindow ];
531507 }
508+ [actionSheet showInView: kKeyWindow ];
532509}
533510- (void )deleteFile : (ProjectFile *)file fromDisk : (BOOL )fromDisk {
534511
0 commit comments