소스 검색

1.取消分享

huangxiaodong 1 년 전
부모
커밋
9194a16e04

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

@@ -265,7 +265,19 @@
 
 - (void)didClickButtonFun:(UIButton*)but
 {
+    NSInteger tag = but.tag;
     
+    if(tag == 1){
+        NSString *serUrl = @"http://192.168.12.253:8080/#/pages/fileSharing/index?token=";
+        NSString *shareUrl = [[NSString alloc] initWithFormat:@"%@%@",serUrl,_dataModel.token];
+        
+        NSURL *URL = [NSURL URLWithString:shareUrl];
+        [[UIApplication sharedApplication] openURL:URL];
+
+    }
+    else{
+        [self showCancelAlearViewFun];
+      }
 }
 
 - (void)viewWillAppear:(BOOL)animated
@@ -346,4 +358,54 @@
     }
 }
 
+#pragma mark 取消分享
+- (void)showCancelAlearViewFun
+{
+    NSString *tipStr = NSLocalizedString(@"cancel_share_Tip_msg",nil);
+
+    KWeakSelf
+    ComontAlretViewController *curAlretVC= [[ComontAlretViewController alloc] initWithTiTle:nil
+                                                                                      msg:tipStr
+                                                                                 imageStr:nil
+                                                                              cancelTitle:NSLocalizedString(@"other_cancel",nil)
+                                                                                  okTitle:NSLocalizedString(@"other_confirm",nil) isOkBtnHighlight:YES
+                                                                               didClickOk:^{
+        
+        [weakSelf cancelShareLinkFun];
+     } didClickCancel:^{
+         
+     }];
+    
+    curAlretVC.modalPresentationStyle = UIModalPresentationCustom;
+     
+     [self presentViewController:curAlretVC animated:YES completion:^{
+         curAlretVC.view.superview.backgroundColor = [UIColor clearColor];
+     }];
+}
+
+- (void)cancelShareLinkFun
+{
+    NSMutableDictionary *paraDict = [NSMutableDictionary new];
+    if(_dataModel.addShareId){
+        [paraDict setValue:_dataModel.addShareId forKey:@"id"];
+    }
+    [paraDict setValue:@1 forKey:@"expirationStatus"];
+    
+    KWeakSelf
+    [self showNewIndicatorWithCanBack:NO canTouch:NO];
+    [[netWorkManager shareInstance] CommonPostCallBackCode:updateShareInfoFun Parameters:paraDict success:^(id  _Nonnull responseObject) {
+        [weakSelf removeNewIndicator];
+        SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
+        if(model && model.code == 0){
+            [[iToast makeText:NSLocalizedString(@"cancel_share_suc_msg",nil)] show];
+        }
+        else{
+            [[iToast makeText:NSLocalizedString(@"cancel_share_fail_msg",nil)] show];
+        }
+        
+    } failure:^(NSError * _Nonnull error) {
+        [weakSelf removeNewIndicator];
+        [[iToast makeText:NSLocalizedString(@"cancel_share_fail_msg",nil)] show];
+    }];
+}
 @end

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

@@ -495,3 +495,6 @@
 "share_expiration_date_unit_day_tip"   = "天后";
 "share_expiration_date_unit_hour_tip"   = "小时后";
 "share_expiration_date_unit_min_tip"   = "分钟后";
+"cancel_share_Tip_msg"   = "确定取消分享链接吗?";
+"cancel_share_fail_msg"   = "链接取消分享失败";
+"cancel_share_suc_msg"   = "链接已取消分享";