瀏覽代碼

1.最近文件删除操作

huangxiaodong 11 月之前
父節點
當前提交
998865afb6

+ 12 - 0
创维盒子/双子星云手机.xcodeproj/project.pbxproj

@@ -178,6 +178,10 @@
 		6B07E0AD2C3D1ED5004A3238 /* nasLastFileViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B07E0AA2C3D1ED5004A3238 /* nasLastFileViewController.h */; };
 		6B07E0AE2C3D1ED5004A3238 /* nasLastFileViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B07E0AA2C3D1ED5004A3238 /* nasLastFileViewController.h */; };
 		6B07E0AF2C3D1ED5004A3238 /* nasLastFileViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B07E0AB2C3D1ED5004A3238 /* nasLastFileViewController.m */; };
+		6B07E0B22C3D3986004A3238 /* ComontAlretDeleteTypeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B07E0B12C3D3986004A3238 /* ComontAlretDeleteTypeViewController.m */; };
+		6B07E0B32C3D3986004A3238 /* ComontAlretDeleteTypeViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B07E0B02C3D3986004A3238 /* ComontAlretDeleteTypeViewController.h */; };
+		6B07E0B42C3D3986004A3238 /* ComontAlretDeleteTypeViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B07E0B02C3D3986004A3238 /* ComontAlretDeleteTypeViewController.h */; };
+		6B07E0B52C3D3986004A3238 /* ComontAlretDeleteTypeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B07E0B12C3D3986004A3238 /* ComontAlretDeleteTypeViewController.m */; };
 		6B0D004B2BFE104B00F02719 /* queryOneShareModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0D004A2BFE104B00F02719 /* queryOneShareModel.m */; };
 		6B0D004C2BFE104B00F02719 /* queryOneShareModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B0D00492BFE104B00F02719 /* queryOneShareModel.h */; };
 		6B0D004D2BFE104B00F02719 /* queryOneShareModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B0D00492BFE104B00F02719 /* queryOneShareModel.h */; };
@@ -1448,6 +1452,8 @@
 		6B07E0A52C3CD4AF004A3238 /* lastFileTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = lastFileTableViewCell.m; sourceTree = "<group>"; };
 		6B07E0AA2C3D1ED5004A3238 /* nasLastFileViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = nasLastFileViewController.h; sourceTree = "<group>"; };
 		6B07E0AB2C3D1ED5004A3238 /* nasLastFileViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = nasLastFileViewController.m; sourceTree = "<group>"; };
+		6B07E0B02C3D3986004A3238 /* ComontAlretDeleteTypeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ComontAlretDeleteTypeViewController.h; sourceTree = "<group>"; };
+		6B07E0B12C3D3986004A3238 /* ComontAlretDeleteTypeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ComontAlretDeleteTypeViewController.m; sourceTree = "<group>"; };
 		6B0D00492BFE104B00F02719 /* queryOneShareModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = queryOneShareModel.h; sourceTree = "<group>"; };
 		6B0D004A2BFE104B00F02719 /* queryOneShareModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = queryOneShareModel.m; sourceTree = "<group>"; };
 		6B1CC2C42B677F3D00AD4217 /* extraMediaEventModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = extraMediaEventModel.h; sourceTree = "<group>"; };
@@ -3273,6 +3279,8 @@
 				18A909972ABC4A3300E6D2BE /* ComontAlretViewController.m */,
 				6B97143D2BCD00C900CE0096 /* ComontAlretType2ViewController.h */,
 				6B97143E2BCD00C900CE0096 /* ComontAlretType2ViewController.m */,
+				6B07E0B02C3D3986004A3238 /* ComontAlretDeleteTypeViewController.h */,
+				6B07E0B12C3D3986004A3238 /* ComontAlretDeleteTypeViewController.m */,
 				18C4754C2A8E0D9B006129C0 /* Set */,
 				18E5571A2A3C5D75005CC84B /* Calculator */,
 				1823A8232A85D66000CE2913 /* Guide */,
@@ -3726,6 +3734,7 @@
 				6B45C5042B5F9CEC007E6911 /* diskListTableView.h in Headers */,
 				6B5BE57B2BFC767100A1B9B3 /* previewFileAndFolderViewController.h in Headers */,
 				6B7EA79E2BF5E0ED002D5CC2 /* NASMsgModel.h in Headers */,
+				6B07E0B32C3D3986004A3238 /* ComontAlretDeleteTypeViewController.h in Headers */,
 				18664FF62AC2B3A4008F8A61 /* ShearDeviceUDPManager.h in Headers */,
 				6B2C1E6C2C070ADE00FDCF82 /* ZFLandscapeRotationManager.h in Headers */,
 				6B2C1E802C070ADE00FDCF82 /* ZFPersentInteractiveTransition.h in Headers */,
@@ -3966,6 +3975,7 @@
 				6BD507062B9576A4006E7CB0 /* diskListTableView.h in Headers */,
 				6B5BE57D2BFC767100A1B9B3 /* previewFileAndFolderViewController.h in Headers */,
 				6B7EA7A02BF5E0ED002D5CC2 /* NASMsgModel.h in Headers */,
+				6B07E0B42C3D3986004A3238 /* ComontAlretDeleteTypeViewController.h in Headers */,
 				6BD507072B9576A4006E7CB0 /* ShearDeviceUDPManager.h in Headers */,
 				6B2C1E6D2C070ADE00FDCF82 /* ZFLandscapeRotationManager.h in Headers */,
 				6B2C1E812C070ADE00FDCF82 /* ZFPersentInteractiveTransition.h in Headers */,
@@ -4623,6 +4633,7 @@
 				6BD507B92B9576A4006E7CB0 /* PlayerViewController+TouchPointXD.m in Sources */,
 				6B0D004E2BFE104B00F02719 /* queryOneShareModel.m in Sources */,
 				6BD507BA2B9576A4006E7CB0 /* uploadImageOrVideoViewController.m in Sources */,
+				6B07E0B52C3D3986004A3238 /* ComontAlretDeleteTypeViewController.m in Sources */,
 				6BD507BB2B9576A4006E7CB0 /* ForbidMenuTextField.m in Sources */,
 				6BD507BC2B9576A4006E7CB0 /* netWorkManager.m in Sources */,
 				6BD507BD2B9576A4006E7CB0 /* HWBookmarkHeader.m in Sources */,
@@ -4945,6 +4956,7 @@
 				18FCE5402AD136670020F623 /* PlayerViewController+TouchPointXD.m in Sources */,
 				6B0D004B2BFE104B00F02719 /* queryOneShareModel.m in Sources */,
 				6B0581612AFCD0DF00D37290 /* uploadImageOrVideoViewController.m in Sources */,
+				6B07E0B22C3D3986004A3238 /* ComontAlretDeleteTypeViewController.m in Sources */,
 				18E5572C2A3C6127005CC84B /* ForbidMenuTextField.m in Sources */,
 				6B3F96352AD2A15A008E349E /* netWorkManager.m in Sources */,
 				A031DD7127EC34E500909527 /* HWBookmarkHeader.m in Sources */,

+ 27 - 0
创维盒子/双子星云手机/Class/ComontAlretDeleteTypeViewController.h

@@ -0,0 +1,27 @@
+//
+//  ComontAlretDeleteTypeViewController.h
+//  双子星云手机
+//
+//  Created by xd h on 2024/7/9.
+//
+
+#import "BaseViewController.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ *  点击确定
+ */
+typedef void (^CommonAlertDelete_ClickOkBtn) (BOOL isDeleteAll);
+/**
+ *  点击取消
+ */
+typedef void (^CommonAlertDelete_ClickCancelBtn) (void);
+
+
+
+@interface ComontAlretDeleteTypeViewController : BaseViewController
+- (id)initWithTitle:(NSString *)title msg:(NSString *)msg imageStr:(NSString *)images cancelTitle:(NSString *)cancelTitle okTitle:(NSString *)okTitle otherTitle:(NSString *)otherTitle isOkBtnHighlight:(BOOL)okBtnHighlight didClickOk:(CommonAlertDelete_ClickOkBtn)ok didClickCancel:(CommonAlertDelete_ClickCancelBtn)Cancel;
+@end
+
+NS_ASSUME_NONNULL_END

+ 274 - 0
创维盒子/双子星云手机/Class/ComontAlretDeleteTypeViewController.m

@@ -0,0 +1,274 @@
+//
+//  ComontAlretDeleteTypeViewController.m
+//  双子星云手机
+//
+//  Created by xd h on 2024/7/9.
+//
+
+#import "ComontAlretDeleteTypeViewController.h"
+
+@interface ComontAlretDeleteTypeViewController (){
+    NSString *titleStr;
+    NSString *msgStr;
+    NSString *imageStr;
+    NSString *cancelTitleStr;
+    NSString *okTitleStr;
+    NSString *otherTitleStr;
+    BOOL isOkBtnHighlight;
+    
+    CommonAlertDelete_ClickOkBtn didClickOkBtn;
+    CommonAlertDelete_ClickCancelBtn didClickCanaelBtn;
+    
+    UIButton *otherBtn;
+}
+
+@end
+
+@implementation ComontAlretDeleteTypeViewController
+
+- (id)initWithTitle:(NSString *)title msg:(NSString *)msg imageStr:(NSString *)images cancelTitle:(NSString *)cancelTitle okTitle:(NSString *)okTitle otherTitle:(NSString *)otherTitle isOkBtnHighlight:(BOOL)okBtnHighlight didClickOk:(CommonAlertDelete_ClickOkBtn)ok didClickCancel:(CommonAlertDelete_ClickCancelBtn)Cancel{
+    self = [super init];
+    
+    titleStr = title;
+    msgStr = msg;
+    imageStr = images;
+    cancelTitleStr = cancelTitle;
+    okTitleStr = okTitle;
+    otherTitleStr = otherTitle;
+    isOkBtnHighlight = okBtnHighlight;
+    
+    didClickOkBtn = ok;
+    didClickCanaelBtn = Cancel;
+    return  self;
+}
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.
+    
+    [self drawAnyView];
+}
+
+- (void)drawAnyView{
+    [self.view setBackgroundColor:HW000000Color60];
+    
+    [self.toolBar setHidden:YES];
+    [self.navigationBar setHidden:YES];
+        
+    UIView *bgView = [[UIView alloc] init];
+    [bgView setBackgroundColor:[UIColor whiteColor]];
+    [bgView.layer setCornerRadius:8.f];
+    
+    [self.view addSubview:bgView];
+        
+    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.centerY.equalTo(self.view.mas_centerY).offset(10*HAUTOSCALE);
+        make.centerX.equalTo(self.view.mas_centerX);
+        make.width.mas_equalTo(300.f);
+    }];
+    
+    CGFloat curTop = 30.0;
+    
+    //图片
+    UIImageView *topImageView = [[UIImageView alloc] init];
+    //topImageView.backgroundColor = [UIColor redColor];
+    
+    if(imageStr && imageStr.length > 0){
+        topImageView.image = [UIImage imageNamed:imageStr];
+        [bgView addSubview:topImageView];
+        [topImageView mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.width.mas_equalTo(80.f);
+            make.height.mas_equalTo(80.f);
+            make.centerX.equalTo(bgView.mas_centerX);;
+            make.top.mas_equalTo(curTop);
+        }];
+        
+        curTop = 30 + 80 + 10.0;
+    }
+    
+    /*主标题*/
+    UILabel *titleLabel = [[UILabel alloc] init];
+    [titleLabel setTextColor:HW0A132BColor];
+    [titleLabel setFont:[UIFont boldSystemFontOfSize:16.f]];
+    [titleLabel setTextAlignment:(NSTextAlignmentCenter)];
+    [titleLabel setText:titleStr];
+    [titleLabel setNumberOfLines:0];
+    
+    if (titleStr.length > 0){
+        [bgView addSubview:titleLabel];
+        [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.left.mas_equalTo(20.f);
+            make.right.mas_equalTo(-20.f);
+            make.top.mas_equalTo(curTop);
+        }];
+    }
+    
+    /*副标题*/
+    UILabel *msgLabel = [[UILabel alloc] init];
+    [msgLabel setTextColor:HW333333Color];
+    [msgLabel setFont:[UIFont systemFontOfSize:15.f]];
+    [msgLabel setTextAlignment:(NSTextAlignmentCenter)];
+    msgLabel.tag = 11;
+    [msgLabel setText:msgStr];
+    [msgLabel setNumberOfLines:0];
+    
+    if (msgStr.length > 0){
+        [bgView addSubview:msgLabel];
+        [msgLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.left.mas_equalTo(20.f);
+            make.right.mas_equalTo(-20.f);
+            if (titleStr.length > 0){
+                make.top.equalTo(titleLabel.mas_bottom).offset(15.f);
+            }else{
+                make.top.mas_equalTo(curTop);
+            }
+        }];
+    }
+    
+    /* */
+    otherBtn = [[UIButton alloc] init];
+    [otherBtn addTarget:self action:@selector(otherBtnClick:) forControlEvents:(UIControlEventTouchUpInside)];
+    [otherBtn setTitle:otherTitleStr forState:(UIControlStateNormal)];
+    [otherBtn setImage:[UIImage imageNamed:@"upload_file_uncheck"] forState:UIControlStateNormal];
+    [otherBtn setImage:[UIImage imageNamed:@"upload_file_check"] forState:UIControlStateSelected];
+    [otherBtn setTitleColor:[UIColor hwColor:@"#151515"] forState:UIControlStateNormal];
+    [otherBtn.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
+    
+    [bgView addSubview:otherBtn];
+    [otherBtn mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(0);
+        make.right.mas_equalTo(0);
+        if (msgStr.length > 0){
+            make.top.equalTo(msgLabel.mas_bottom).offset(15.f);
+        }else{
+            make.top.equalTo(titleLabel.mas_bottom).offset(25.f);
+        }
+        
+        if(otherTitleStr.length > 0){
+            make.height.mas_equalTo(30);
+        }
+        else{
+            make.height.mas_equalTo(10);
+        }
+    }];
+    
+    /*双按钮*/
+    /*取消*/
+    
+    /*取消按钮*/
+    UIButton *cancelBtn = [[UIButton alloc] init];
+    cancelBtn.frame = CGRectMake(0, 0, 115, 48.f);
+    CGFloat w_btn = 200;
+    if (okTitleStr.length > 0){
+        w_btn = 115;
+    }
+    
+    // gradient
+    CAGradientLayer *gl = [CAGradientLayer layer];
+    gl.frame = CGRectMake(0,0,w_btn,48.f);
+    gl.startPoint = CGPointMake(0, 0.5);
+    gl.endPoint = CGPointMake(1, 0.5);
+    gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor];
+    gl.locations = @[@(0), @(1.0f)];
+    
+    
+    if(!isOkBtnHighlight){
+        [cancelBtn.layer addSublayer:gl];
+        [cancelBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
+    }
+    else{
+        [cancelBtn setTitleColor:HW0A132BColor forState:(UIControlStateNormal)];
+        [cancelBtn setBackgroundColor:HWE3E8F1Color];
+    }
+    
+    [cancelBtn addTarget:self action:@selector(cancelBtnClick) forControlEvents:(UIControlEventTouchUpInside)];
+    [cancelBtn setTitle:cancelTitleStr forState:(UIControlStateNormal)];
+    [cancelBtn.titleLabel setFont:[UIFont systemFontOfSize:16.f]];
+    [cancelBtn.layer setCornerRadius:8.f];
+    cancelBtn.clipsToBounds = YES;
+    cancelBtn.tag = 999;
+    [bgView addSubview:cancelBtn];
+    [cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
+        if (okTitleStr.length > 0){
+            make.left.mas_equalTo(24);
+        }else{
+            make.centerX.equalTo(bgView.mas_centerX);
+        }
+        
+//        if (msgStr.length > 0){
+//            make.top.equalTo(msgLabel.mas_bottom).offset(15.f);
+//        }else{
+//            make.top.equalTo(titleLabel.mas_bottom).offset(25.f);
+//        }
+        
+        make.top.equalTo(otherBtn.mas_bottom).offset(25.f);
+        
+        make.width.mas_equalTo(w_btn);
+        make.bottom.equalTo(bgView.mas_bottom).offset(-30.f);
+        make.height.mas_equalTo(48.f);
+    }];
+    
+    
+    if (okTitleStr.length > 0){
+        /*残忍拒绝*/
+        UIButton *okBtn = [[UIButton alloc] init];
+        
+        if(!isOkBtnHighlight){
+            [okBtn setTitleColor:HW0A132BColor forState:(UIControlStateNormal)];
+            [okBtn setBackgroundColor:HWE3E8F1Color];
+        }
+        else{
+            [okBtn.layer addSublayer:gl];
+            [okBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
+        }
+        
+        [okBtn addTarget:self action:@selector(okBtnClick) forControlEvents:(UIControlEventTouchUpInside)];
+        [okBtn setTitle:okTitleStr forState:(UIControlStateNormal)];
+        //[okBtn setTitleColor:HW0A132BColor forState:(UIControlStateNormal)];
+        [okBtn.titleLabel setFont:[UIFont systemFontOfSize:16.f]];
+        [okBtn.layer setCornerRadius:8.f];
+        //[okBtn setBackgroundColor:HWE3E8F1Color];
+        okBtn.clipsToBounds = YES;
+        
+        
+        
+        [bgView addSubview:okBtn];
+        [okBtn mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.right.mas_equalTo(-24.f);
+            make.width.mas_equalTo(w_btn);
+            make.top.equalTo(cancelBtn.mas_top);
+            make.height.mas_equalTo(48.f);
+        }];
+    }
+}
+
+
+- (void)cancelBtnClick{
+    [self dismissViewControllerAnimated:YES completion:^{
+        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+            
+            
+            if(self->didClickCanaelBtn){
+                self->didClickCanaelBtn();
+            }
+        });
+    }];
+}
+
+- (void)okBtnClick{
+    [self dismissViewControllerAnimated:YES completion:^{
+        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+
+            if(self->didClickOkBtn){
+                self->didClickOkBtn(self->otherBtn.selected);
+            }
+            
+        });
+    }];
+}
+
+- (void)otherBtnClick:(UIButton*)but{
+    but.selected = !but.selected;
+}
+@end
+

+ 32 - 12
创维盒子/双子星云手机/NAS/nasLastFileViewController.m

@@ -15,6 +15,7 @@
 #import "audioPlayerViewController.h"
 #import "videoPlayByAVPlayerViewController.h"
 #import "editShareView.h"
+#import "ComontAlretDeleteTypeViewController.h"
 
 @interface nasLastFileViewController ()<UITableViewDelegate,UITableViewDataSource,DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
 @property(nonatomic,strong) UITableView*tableView;
@@ -321,21 +322,23 @@
 - (void)showDeleteAlearViewFun
 {
     NSString *titleStr = NSLocalizedString(@"delete_file_title_msg",nil);
-    NSString *tipStr = NSLocalizedString(@"delete_file_tip_msg",nil);
+    NSString *tipStr = NSLocalizedString(@"NAS_last_file_del_tip",nil);
 
     KWeakSelf
-    ComontAlretViewController *curAlretVC= [[ComontAlretViewController alloc] initWithTiTle:titleStr
-                                                                                      msg:tipStr
-                                                                                 imageStr:nil
-                                                                              cancelTitle:NSLocalizedString(@"other_cancel",nil)
-                                                                                  okTitle:NSLocalizedString(@"other_confirm",nil) isOkBtnHighlight:YES
-                                                                               didClickOk:^{
+    ComontAlretDeleteTypeViewController *curAlretVC= [[ComontAlretDeleteTypeViewController alloc]
+                                                      initWithTitle:titleStr
+                                                      msg:tipStr
+                                                      imageStr:nil
+                                                      cancelTitle:NSLocalizedString(@"other_cancel",nil)
+                                                      okTitle:NSLocalizedString(@"other_confirm",nil) 
+                                                      otherTitle:NSLocalizedString(@"NAS_last_file_del_cloudFile_tip",nil)
+                                                      isOkBtnHighlight:YES
+                                                      didClickOk:^(BOOL isDeleteAll) {
+        [weakSelf didClickDeleteOkButBy:isDeleteAll];
+    } didClickCancel:^{
         
-        [weakSelf delFileListFun];
-     } didClickCancel:^{
-         
-     }];
-    
+    }];
+                                                      
     curAlretVC.modalPresentationStyle = UIModalPresentationCustom;
      
      [self presentViewController:curAlretVC animated:YES completion:^{
@@ -343,6 +346,23 @@
      }];
 }
 
+- (void)didClickDeleteOkButBy:(NSInteger)isDeleteCloudFile
+{
+    
+    //1.删除本地数据
+    for (NASFilePicDataArrModel *dataModel in _didSelectListArr) {
+        [[lastFileManager shareManager] deleteFileInfoWithUrl:dataModel.path];
+    }
+    
+    //2.删除云机文件
+    if(isDeleteCloudFile){
+        [self delFileListFun];
+    }
+    else{
+        [[iToast makeText:NSLocalizedString(@"delete_file_suc_msg",nil)] show];
+        [self didDeleteSucFun];
+    }
+}
 
 #pragma mark 删除文件数据
 - (void)delFileListFun

+ 2 - 0
创维盒子/双子星云手机/zh-Hans.lproj/Localizable.strings

@@ -542,6 +542,8 @@
 "NAS_last_file"   = "最近文件";
 "NAS_bottom_tip"   = "已经到底了";
 "NAS_last_file_not_data_tip"   = "暂无最近使用记录";
+"NAS_last_file_del_tip"   = "是否删除所选历史记录?";
+"NAS_last_file_del_cloudFile_tip"   = "同时删除源文件";
 "cloudPhone_enter_tip"   = "进入云机";
 "cloudPhone_upload_app"   = "应用上传";
 "cloudPhone_nav_show_tip"   = "导航栏";