Procházet zdrojové kódy

1.复制分享链接完成

huangxiaodong před 1 rokem
rodič
revize
377c67832a

+ 2 - 0
创维盒子/双子星云手机/Class/Set/previewFile/shareRecordDetailsHWViewController.h

@@ -11,6 +11,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface shareRecordDetailsHWViewController : BaseViewController
 @property(nonatomic,strong) ShareRecordListModel *dataModel;
+
+@property (nonatomic,copy) void (^didCancelShareLinkFun)(void);
 @end
 
 NS_ASSUME_NONNULL_END

+ 92 - 5
创维盒子/双子星云手机/Class/Set/previewFile/shareRecordDetailsHWViewController.m

@@ -275,9 +275,12 @@
         [[UIApplication sharedApplication] openURL:URL];
 
     }
-    else{
+    else if(tag == 10){
         [self showCancelAlearViewFun];
-      }
+    }
+    else if(tag == 11){
+        [self copyShareLinkFun];
+    }
 }
 
 - (void)viewWillAppear:(BOOL)animated
@@ -294,15 +297,21 @@
     if(!_dataModel.expirationStatus){
        _cancelShareLinkButton.hidden = NO;
        _shareLinkCopyButton.hidden = NO;
+        
+        //失效时间
+        NSString *tipStr = NSLocalizedString(@"copy_share_link_Invalid_tip3",nil);
+        _shareEndDateLabel.text = [[NSString alloc] initWithFormat:@"%@: %@",tipStr,_dataModel.expirationTime];
     }
     else{
         _cancelShareLinkButton.hidden = YES;
         _shareLinkCopyButton.hidden = YES;
+        
+        //失效时间
+        NSString *tipStr = NSLocalizedString(@"copy_share_link_Invalid_tip3",nil);
+        NSString *tipStr2 = NSLocalizedString(@"copy_share_link_Invalid_tip",nil);
+        _shareEndDateLabel.text = [[NSString alloc] initWithFormat:@"%@: %@",tipStr,tipStr2];
     }
     
-    //失效时间
-    NSString *tipStr = NSLocalizedString(@"copy_share_link_Invalid_tip3",nil);
-    _shareEndDateLabel.text = [[NSString alloc] initWithFormat:@"%@: %@",tipStr,_dataModel.expirationTime];
     
     ShareFileDataModel *fileModel = _dataModel.fileListVOS.firstObject;
     NSString *titleStr = [[NSString alloc] initWithFormat:@"%@%@%ld%@",fileModel.fileName,NSLocalizedString(@"share_file_more_tip",nil), _dataModel.fileListVOS.count,NSLocalizedString(@"share_file_Numbers_tip",nil)];
@@ -398,6 +407,7 @@
         SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
         if(model && model.code == 0){
             [[iToast makeText:NSLocalizedString(@"cancel_share_suc_msg",nil)] show];
+            [weakSelf getShareOneFileListFun];
         }
         else{
             [[iToast makeText:NSLocalizedString(@"cancel_share_fail_msg",nil)] show];
@@ -408,4 +418,81 @@
         [[iToast makeText:NSLocalizedString(@"cancel_share_fail_msg",nil)] show];
     }];
 }
+
+#pragma mark 分享信息重新获取
+- (void)getShareOneFileListFun
+{
+    _dataModel.expirationStatus = 1;
+    [self handleDataFun];
+    
+    if(_didCancelShareLinkFun){
+        _didCancelShareLinkFun();
+    }
+    
+//    NSMutableDictionary*paraDict = [NSMutableDictionary new];
+//    
+//    if(_dataModel.token){
+//        [paraDict setValue:_dataModel.token forKey:@"token"];
+//    }
+//    
+//    if(_dataModel.addShareId){
+//        [paraDict setValue:_dataModel.addShareId forKey:@"id"];
+//    }
+//    
+//    if(_dataModel.extractionCode){
+//        [paraDict setValue:_dataModel.extractionCode forKey:@"extractionCode"];
+//    }
+//    
+//    KWeakSelf
+//    [[netWorkManager shareInstance] CommonPostCallBackCode:queryOneShareInfoFun Parameters:paraDict success:^(id  _Nonnull responseObject) {
+//        
+//        ShareRecordListModel*model = [[ShareRecordListModel alloc] initWithDictionary:responseObject error:nil];
+//        if(model && model.status == 0){
+//            weakSelf.dataModel = model;
+//            [weakSelf handleDataFun];
+//        }
+//        else{
+//            
+//        }
+//    } failure:^(NSError * _Nonnull error) {
+//        
+//    }];
+}
+
+- (void)copyShareLinkFun
+{
+    if(_dataModel.fileListVOS.count <=0 ){
+        return;
+    }
+    
+    ShareFileDataModel *dataModel = _dataModel.fileListVOS.firstObject;
+    
+    NSString *copyStr1 = [[NSString alloc] initWithFormat:@"%@%@%@%ld%@",NSLocalizedString(@"share_secret_titile_1_1",nil),dataModel.fileName,NSLocalizedString(@"share_file_more_tip",nil), _dataModel.fileListVOS.count,NSLocalizedString(@"share_file_Numbers_tip",nil)];
+    
+    if(_dataModel.fileListVOS.count == 1){
+        copyStr1 = [[NSString alloc] initWithFormat:@"%@%@",NSLocalizedString(@"share_secret_titile_1",nil),dataModel.fileName];
+    }
+    
+    if(_dataModel.platformType == 4) {
+        copyStr1 = [[NSString alloc] initWithFormat:@"%@%@",NSLocalizedString(@"share_secret_titile_1",nil),copyStr1];
+    }
+    
+    NSString *serUrl = @"http://192.168.12.253:8080/#/pages/fileSharing/index?token=";
+    NSString *shareUrl = [[NSString alloc] initWithFormat:@"%@%@",serUrl,_dataModel.token];
+    NSString *copyStr2 = [[NSString alloc] initWithFormat:@"%@%@",NSLocalizedString(@"share_secret_titile_2",nil),shareUrl];
+    
+    NSString *copyStr3 = [[NSString alloc] initWithFormat:@"%@%@",NSLocalizedString(@"share_secret_titile_3",nil),_dataModel.extractionCode];
+    NSString *copyStr4 = NSLocalizedString(@"share_secret_titile_4",nil);
+
+    
+    NSString *copyTotalStr = [[NSString alloc] initWithFormat:@"%@\n%@\n%@\n%@",copyStr1,copyStr2,copyStr3,copyStr4];
+    if(_dataModel.platformType != 4) {
+        copyTotalStr = [[NSString alloc] initWithFormat:@"%@\n%@\n%@",copyStr1,copyStr2,copyStr4];
+    }
+    
+    UIPasteboard* pasteboard = [UIPasteboard generalPasteboard];
+    pasteboard.string = copyTotalStr;
+    
+    [[iToast makeText:NSLocalizedString(@"copy_share_link_suc_tip",nil)] show];
+}
 @end

+ 5 - 0
创维盒子/双子星云手机/Class/Set/previewFile/shareRecordViewController.m

@@ -270,6 +270,11 @@
         ShareRecordListModel* model = _ShareRecordMod.data[row];
         vc.dataModel = model;
     }
+    
+    KWeakSelf
+    vc.didCancelShareLinkFun = ^{
+        [weakSelf getShareFileListFun];
+    };
 }
 
 

+ 1 - 1
创维盒子/双子星云手机/Class/Set/previewFile/view/shareBySecretView.m

@@ -340,7 +340,7 @@
     
     NASFilePicDataArrModel *dataModel = _didSelectListArr.firstObject;
     
-    NSString *copyStr1 = [[NSString alloc] initWithFormat:@"%@%@%@%ld%@",NSLocalizedString(@"share_secret_titile_1",nil),dataModel.name,NSLocalizedString(@"share_file_more_tip",nil), _didSelectListArr.count,NSLocalizedString(@"share_file_Numbers_tip",nil)];
+    NSString *copyStr1 = [[NSString alloc] initWithFormat:@"%@%@%@%@%ld%@",NSLocalizedString(@"share_secret_titile_1",nil),NSLocalizedString(@"share_secret_titile_1_1",nil),dataModel.name,NSLocalizedString(@"share_file_more_tip",nil), _didSelectListArr.count,NSLocalizedString(@"share_file_Numbers_tip",nil)];
     
     if(_didSelectListArr.count == 1){
         copyStr1 = [[NSString alloc] initWithFormat:@"%@%@",NSLocalizedString(@"share_secret_titile_1",nil),dataModel.name];

+ 7 - 0
创维盒子/双子星云手机/netWork/newWorkInterface.h

@@ -95,4 +95,11 @@
  返回数据模型 */
 #define queryShareRecordFun  @"/box/share/info/queryByCondition"
 
+/*14 查询单个分享信息接口 POST请求
+输入参数 id 主键id
+ 输入参数 token 状态 token
+ 输入参数 extractionCode 提取码
+ 返回数据模型 */
+#define queryOneShareInfoFun  @"/box/share/info/queryOne"
+
 #endif /* newWorkInterface_h */

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

@@ -484,7 +484,8 @@
 "share_expiration_date_unit_tip"   = "天";
 "share_Extract_code_tip"   = "提取码";
 "share_copy_link_tip"   = "复制链接";
-"share_secret_titile_1"   = "【私密分享】通过Private-X分享到文件:";
+"share_secret_titile_1"   = "【私密分享】";
+"share_secret_titile_1_1"   = "通过Private-X分享到文件:";
 "share_secret_titile_2"   = "链接:";
 "share_secret_titile_3"   = "密码:";
 "share_secret_titile_4"   = "点击链接即可打开查看好友分享的文件";