shareRecordDetailsHWViewController~.m 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. //
  2. // shareRecordDetailsHWViewController.m
  3. // 双子星云手机
  4. //
  5. // Created by xd h on 2024/5/15.
  6. //
  7. #import "shareRecordDetailsHWViewController.h"
  8. @interface shareRecordDetailsHWViewController ()
  9. @property (nonatomic,strong)UIScrollView *BgScrollView;
  10. @property (nonatomic,strong)UIView *whiteBgView;
  11. @property (nonatomic,strong)UILabel *shareTitleLabel;
  12. @property (nonatomic,strong)UILabel *shareBeginDateLabel;
  13. @property (nonatomic,strong)UIImageView *shareQRCodeImageView;
  14. @property (nonatomic,strong)UIButton*checkShareLinkButton;
  15. @property (nonatomic,strong)UIImageView*lineImageView;//分割线
  16. @property (nonatomic,strong)UILabel *shareEndDateLabel;//失效日期
  17. @property (nonatomic,strong)UILabel *remainingNumberLabel;//剩余次数
  18. @property (nonatomic,strong)UILabel *extractCodeTipLab;//提取码
  19. @property (nonatomic,strong)UILabel *extractCodeTip2Lab;//提取码
  20. @property (nonatomic,strong)UILabel *reportTipLabel;//被投诉封禁
  21. @property (nonatomic,strong)UILabel *reportLabel;//被投诉封禁
  22. @property (nonatomic,strong)UIButton*cancelShareLinkButton;
  23. @property (nonatomic,strong)UIButton*shareLinkCopyButton;
  24. @end
  25. @implementation shareRecordDetailsHWViewController
  26. - (void)viewDidLoad {
  27. [super viewDidLoad];
  28. // Do any additional setup after loading the view.
  29. [self.toolBar setHidden:YES];
  30. [self.navigationBar setHidden:YES];
  31. [self.navBarBGView setHidden:NO];
  32. self.navBarBGView.backgroundColor = [UIColor whiteColor];
  33. [self.view setBackgroundColor:[UIColor hwColor:@"#F5F7FA"]];
  34. self.titleLabel.text = NSLocalizedString(@"share_record_title",nil);
  35. [self drawAnyView];
  36. }
  37. - (void)drawAnyView{
  38. _BgScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, NAVIHEIGHT + AdaptNaviHeight, SCREEN_W, SCREEN_H - NAVIHEIGHT- AdaptNaviHeight)];
  39. //_BgScrollView.backgroundColor = [UIColor greenColor];
  40. //_BgScrollView.contentSize = CGSizeMake(SCREEN_W, 0);
  41. [self.view addSubview:_BgScrollView];
  42. // [_BgScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
  43. // make.left.mas_equalTo(0);
  44. // make.right.mas_equalTo(0);
  45. // make.top.equalTo(self.navBarBGView.mas_bottom).offset(0.f);
  46. // make.bottom.mas_equalTo(0);
  47. // }];
  48. //
  49. _whiteBgView = [[UIView alloc] init];
  50. _whiteBgView.backgroundColor = [UIColor whiteColor];
  51. [_BgScrollView addSubview:_whiteBgView];
  52. _whiteBgView.layer.cornerRadius = 8;
  53. _whiteBgView.layer.masksToBounds = YES;
  54. [_whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  55. make.left.mas_equalTo(15);
  56. //make.right.mas_equalTo(-15);
  57. make.width.mas_equalTo(SCREEN_W - 30);
  58. //make.top.equalTo(self.navBarBGView.mas_bottom).offset(40.f);
  59. make.top.mas_equalTo(40);
  60. make.height.mas_equalTo(558);
  61. }];
  62. //文件夹图标
  63. UIImageView *folderImageView = [[UIImageView alloc] init];
  64. folderImageView.image = [UIImage imageNamed:@"uploadFile_file_icon"];
  65. folderImageView.backgroundColor = [UIColor whiteColor];
  66. [_BgScrollView addSubview:folderImageView];
  67. folderImageView.layer.cornerRadius = 44;
  68. folderImageView.layer.masksToBounds = YES;
  69. [folderImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  70. //make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
  71. make.top.mas_equalTo(10.f);
  72. make.centerX.mas_equalTo(_BgScrollView.mas_centerX);
  73. make.width.mas_equalTo(88);
  74. make.height.mas_equalTo(88);
  75. }];
  76. _shareTitleLabel = [[UILabel alloc] init];
  77. //_shareTitleLabel.text = @"banner.png等多个文件";
  78. _shareTitleLabel.textAlignment = NSTextAlignmentCenter;
  79. _shareTitleLabel.textColor = HW0A132BColor;
  80. _shareTitleLabel.font = [UIFont systemFontOfSize:14.0];
  81. [_whiteBgView addSubview:_shareTitleLabel];
  82. [_shareTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  83. make.top.equalTo(folderImageView.mas_bottom).offset(5.f);
  84. make.left.mas_equalTo(15);
  85. make.right.mas_equalTo(-15);
  86. make.height.mas_equalTo(20);
  87. }];
  88. _shareBeginDateLabel = [[UILabel alloc] init];
  89. //_shareBeginDateLabel.text = @"2024/04/25 19:45";
  90. _shareBeginDateLabel.textAlignment = NSTextAlignmentCenter;
  91. _shareBeginDateLabel.textColor = HW666666Color;
  92. _shareBeginDateLabel.font = [UIFont systemFontOfSize:12.0];
  93. [_whiteBgView addSubview:_shareBeginDateLabel];
  94. [_shareBeginDateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  95. make.top.equalTo(_shareTitleLabel.mas_bottom).offset(25.f);
  96. make.left.mas_equalTo(15);
  97. make.right.mas_equalTo(-15);
  98. make.height.mas_equalTo(15);
  99. }];
  100. UIImageView *QRCodeEdgingImageView = [[UIImageView alloc] init];
  101. QRCodeEdgingImageView.image = [UIImage imageNamed:@"share_QRCode_edging"];
  102. [_whiteBgView addSubview:QRCodeEdgingImageView];
  103. [QRCodeEdgingImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  104. make.top.equalTo(_shareBeginDateLabel.mas_bottom).offset(10.f);
  105. //make.centerX.mas_equalTo(self.view.mas_centerX);
  106. make.centerX.mas_equalTo(_whiteBgView.mas_centerX);
  107. make.width.mas_equalTo(208);
  108. make.height.mas_equalTo(208);
  109. }];
  110. _shareQRCodeImageView = [[UIImageView alloc] init];
  111. //_shareQRCodeImageView.backgroundColor = [UIColor lightGrayColor];
  112. [QRCodeEdgingImageView addSubview:_shareQRCodeImageView];
  113. [_shareQRCodeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  114. make.top.mas_equalTo(20);
  115. make.bottom.mas_equalTo(-20);
  116. make.left.mas_equalTo(20);
  117. make.right.mas_equalTo(-20);
  118. }];
  119. //_shareQRCodeImageView.image = [self generateQRCodeWithInputMessage:@"http://baidu.com" Width:168 Height:168];
  120. _checkShareLinkButton = [[UIButton alloc] init];
  121. [_checkShareLinkButton setTitle:NSLocalizedString(@"check_share_link_title",nil) forState:UIControlStateNormal];
  122. [_checkShareLinkButton setTitleColor:[UIColor hwColor:@"#01B7EA"] forState:UIControlStateNormal];
  123. _checkShareLinkButton.titleLabel.font = [UIFont systemFontOfSize:14.0];
  124. [_checkShareLinkButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
  125. _checkShareLinkButton.tag = 1;
  126. [_whiteBgView addSubview:_checkShareLinkButton];
  127. [_checkShareLinkButton mas_makeConstraints:^(MASConstraintMaker *make) {
  128. make.left.mas_equalTo(15);
  129. make.right.mas_equalTo(-15);
  130. make.top.equalTo(QRCodeEdgingImageView.mas_bottom).offset(0.f);
  131. make.height.mas_equalTo(30);
  132. }];
  133. //分割线 347 /32
  134. CGFloat lineW = SCREEN_W - 30;
  135. CGFloat lineH = (lineW*32.0)/347.0;
  136. _lineImageView = [[UIImageView alloc] init];
  137. //_lineImageView.backgroundColor = [UIColor lightGrayColor];
  138. _lineImageView.image = [UIImage imageNamed:@"nas_share_Divider_img"];
  139. [_whiteBgView addSubview:_lineImageView];
  140. [_lineImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  141. make.top.equalTo(_checkShareLinkButton.mas_bottom).offset(8);
  142. make.height.mas_equalTo(lineH);
  143. make.left.mas_equalTo(0);
  144. make.right.mas_equalTo(0);
  145. }];
  146. //失效时间
  147. UILabel *shareEndDateTipLab = [[UILabel alloc] init];
  148. shareEndDateTipLab.font = [UIFont systemFontOfSize:14.f];
  149. [shareEndDateTipLab setTextColor:[UIColor hwColor:@"#999999"]];
  150. shareEndDateTipLab.text = NSLocalizedString(@"copy_share_link_Invalid_tip3",nil);
  151. [_whiteBgView addSubview:shareEndDateTipLab];
  152. [shareEndDateTipLab mas_makeConstraints:^(MASConstraintMaker *make) {
  153. make.left.mas_equalTo(32);
  154. make.width.mas_equalTo(80);
  155. make.top.equalTo(_lineImageView.mas_bottom).offset(8);
  156. make.height.mas_equalTo(20);
  157. }];
  158. _shareEndDateLabel = [[UILabel alloc] init];
  159. //_shareEndDateLabel.text = @"2024/04/25 19:45";
  160. //_shareEndDateLabel.textAlignment = NSTextAlignmentCenter;
  161. _shareEndDateLabel.textColor = HW0A132BColor;
  162. _shareEndDateLabel.font = [UIFont boldSystemFontOfSize:14.0];
  163. [_whiteBgView addSubview:_shareEndDateLabel];
  164. //_shareEndDateLabel.backgroundColor = [UIColor greenColor];
  165. [_shareEndDateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  166. make.left.mas_equalTo(shareEndDateTipLab.mas_right);
  167. make.right.mas_equalTo(0);
  168. make.top.mas_equalTo(shareEndDateTipLab.mas_top);
  169. make.height.mas_equalTo(20);
  170. }];
  171. //剩余次数
  172. UILabel *remainingNumberTipLabel = [[UILabel alloc] init];
  173. remainingNumberTipLabel.font = [UIFont systemFontOfSize:14.f];
  174. [remainingNumberTipLabel setTextColor:[UIColor hwColor:@"#999999"]];
  175. remainingNumberTipLabel.text = NSLocalizedString(@"share_number_remainingNumber_tip",nil);
  176. [_whiteBgView addSubview:remainingNumberTipLabel];
  177. [remainingNumberTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  178. make.left.mas_equalTo(32);
  179. make.width.mas_equalTo(80);
  180. make.top.equalTo(shareEndDateTipLab.mas_bottom).offset(10);
  181. make.height.mas_equalTo(20);
  182. }];
  183. _remainingNumberLabel = [[UILabel alloc] init];
  184. _remainingNumberLabel.font = [UIFont boldSystemFontOfSize:14.f];
  185. //_remainingNumberLabel.text = @"80";
  186. [_remainingNumberLabel setTextColor:HW0A132BColor];
  187. [_whiteBgView addSubview:_remainingNumberLabel];
  188. [_remainingNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  189. make.left.mas_equalTo(remainingNumberTipLabel.mas_right);
  190. make.right.mas_equalTo(-20);
  191. make.top.equalTo(remainingNumberTipLabel.mas_top);
  192. make.height.mas_equalTo(20);
  193. }];
  194. ///获取设备当前地区的代码和APP语言环境
  195. NSString *languageCode = [NSLocale preferredLanguages][0];
  196. CGFloat curlaberW = 80.0;
  197. //目前支持 中文(简体 繁体) 英文 日语
  198. if([languageCode rangeOfString:@"zh-Hans"].location != NSNotFound)
  199. {
  200. }
  201. else if([languageCode rangeOfString:@"zh-Hant"].location != NSNotFound)
  202. {
  203. }
  204. else{
  205. curlaberW = 110.0;
  206. }
  207. //提取码
  208. _extractCodeTipLab = [[UILabel alloc] init];
  209. _extractCodeTipLab.font = [UIFont systemFontOfSize:14.f];
  210. [_extractCodeTipLab setTextColor:[UIColor hwColor:@"#999999"]];
  211. _extractCodeTipLab.text = NSLocalizedString(@"share_Extract_code_tip",nil);
  212. [_whiteBgView addSubview:_extractCodeTipLab];
  213. [_extractCodeTipLab mas_makeConstraints:^(MASConstraintMaker *make) {
  214. make.left.mas_equalTo(32);
  215. make.width.mas_equalTo(curlaberW);
  216. make.top.equalTo(remainingNumberTipLabel.mas_bottom).offset(10);
  217. make.height.mas_equalTo(20);
  218. }];
  219. _extractCodeTip2Lab = [[UILabel alloc] init];
  220. _extractCodeTip2Lab.font = [UIFont boldSystemFontOfSize:14.f];
  221. [_extractCodeTip2Lab setTextColor:HW0A132BColor];
  222. [_whiteBgView addSubview:_extractCodeTip2Lab];
  223. [_extractCodeTip2Lab mas_makeConstraints:^(MASConstraintMaker *make) {
  224. make.left.mas_equalTo(_extractCodeTipLab.mas_right);
  225. make.right.mas_equalTo(-20);
  226. make.top.equalTo(_extractCodeTipLab.mas_top);
  227. make.height.mas_equalTo(20);
  228. }];
  229. //封禁原因
  230. _reportTipLabel = [[UILabel alloc] init];
  231. _reportTipLabel.font = [UIFont systemFontOfSize:14.f];
  232. [_reportTipLabel setTextColor:[UIColor hwColor:@"#999999"]];
  233. _reportTipLabel.text = NSLocalizedString(@"share_report_tip1",nil);
  234. [_whiteBgView addSubview:_reportTipLabel];
  235. [_reportTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  236. make.left.mas_equalTo(32);
  237. make.width.mas_equalTo(80);
  238. make.top.equalTo(_extractCodeTipLab.mas_bottom).offset(10);
  239. make.height.mas_equalTo(20);
  240. }];
  241. _reportLabel = [[UILabel alloc] init];
  242. _reportLabel.font = [UIFont boldSystemFontOfSize:14.f];
  243. _reportLabel.text = NSLocalizedString(@"share_report_tip2",nil);
  244. [_reportLabel setTextColor:HW0A132BColor];
  245. [_whiteBgView addSubview:_reportLabel];
  246. [_reportLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  247. make.left.mas_equalTo(_reportTipLabel.mas_right);
  248. make.right.mas_equalTo(-20);
  249. make.top.equalTo(_reportTipLabel.mas_top);
  250. make.height.mas_equalTo(20);
  251. }];
  252. CGFloat shareButW = (SCREEN_W - 20 -20 -15)/2.0;
  253. _cancelShareLinkButton = [[UIButton alloc] init];
  254. [_cancelShareLinkButton setTitle:NSLocalizedString(@"cancel_share_title",nil) forState:UIControlStateNormal];
  255. [_cancelShareLinkButton setTitleColor:HW0A132BColor forState:UIControlStateNormal];
  256. _cancelShareLinkButton.titleLabel.font = [UIFont systemFontOfSize:14.0];
  257. [_cancelShareLinkButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
  258. _cancelShareLinkButton.tag = 10;
  259. [_BgScrollView addSubview:_cancelShareLinkButton];
  260. _cancelShareLinkButton.layer.cornerRadius = 8;
  261. _cancelShareLinkButton.layer.masksToBounds = YES;
  262. _cancelShareLinkButton.backgroundColor = [UIColor hwColor:@"#E3E8F1"];
  263. [_cancelShareLinkButton mas_makeConstraints:^(MASConstraintMaker *make) {
  264. make.left.mas_equalTo(20);
  265. make.width.mas_equalTo(shareButW);
  266. make.top.equalTo(_whiteBgView.mas_bottom).offset(25);
  267. make.height.mas_equalTo(48);
  268. }];
  269. _shareLinkCopyButton = [[UIButton alloc] init];
  270. CGFloat w_btn = shareButW;//SCREEN_W-130 -15 -10 -15;
  271. // gradient
  272. CAGradientLayer *gl = [CAGradientLayer layer];
  273. gl.frame = CGRectMake(0,0,w_btn,48.f);
  274. gl.startPoint = CGPointMake(0, 0.5);
  275. gl.endPoint = CGPointMake(1, 0.5);
  276. gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor];
  277. gl.locations = @[@(0), @(1.0f)];
  278. [_shareLinkCopyButton.layer addSublayer:gl];
  279. [_shareLinkCopyButton setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
  280. [_shareLinkCopyButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:(UIControlEventTouchUpInside)];
  281. [_shareLinkCopyButton setTitle:NSLocalizedString(@"copy_share_link_title",nil) forState:(UIControlStateNormal)];
  282. [_shareLinkCopyButton.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
  283. [_shareLinkCopyButton.layer setCornerRadius:8.f];
  284. _shareLinkCopyButton.clipsToBounds = YES;
  285. _shareLinkCopyButton.tag = 11;
  286. [_BgScrollView addSubview:_shareLinkCopyButton];
  287. [_shareLinkCopyButton mas_makeConstraints:^(MASConstraintMaker *make) {
  288. //make.right.mas_equalTo(-20);
  289. make.left.equalTo(_cancelShareLinkButton.mas_right).offset(15);
  290. make.width.mas_equalTo(w_btn);
  291. make.top.equalTo(_cancelShareLinkButton.mas_top).offset(0);
  292. make.height.mas_equalTo(48);
  293. }];
  294. }
  295. // 生成二维码
  296. - (UIImage *)generateQRCodeWithInputMessage:(NSString *)inputMessage
  297. Width:(CGFloat)width
  298. Height:(CGFloat)height{
  299. NSData *inputData = [inputMessage dataUsingEncoding:NSUTF8StringEncoding];
  300. CIFilter *filter = [CIFilter filterWithName:@"CIQRCodeGenerator"];
  301. [filter setValue:inputData forKey:@"inputMessage"];
  302. // [filter setValue:@"H" forKey:@"inputCorrectionLevel"]; // 设置二维码不同级别的容错率
  303. CIImage *ciImage = filter.outputImage;
  304. // 消除模糊
  305. CGFloat scaleX = MIN(width, height)/ciImage.extent.size.width;
  306. CGFloat scaleY = MIN(width, height)/ciImage.extent.size.height;
  307. ciImage = [ciImage imageByApplyingTransform:CGAffineTransformScale(CGAffineTransformIdentity, scaleX, scaleY)];
  308. UIImage *returnImage = [UIImage imageWithCIImage:ciImage];
  309. return returnImage;
  310. }
  311. - (void)didClickButtonFun:(UIButton*)but
  312. {
  313. NSInteger tag = but.tag;
  314. if(tag == 1){
  315. NSString *serUrl = shareService;
  316. NSString *shareUrl = [[NSString alloc] initWithFormat:@"%@%@",serUrl,_dataModel.token];
  317. NSURL *URL = [NSURL URLWithString:shareUrl];
  318. [[UIApplication sharedApplication] openURL:URL];
  319. }
  320. else if(tag == 10){
  321. [self showCancelAlearViewFun];
  322. }
  323. else if(tag == 11){
  324. [self copyShareLinkFun];
  325. }
  326. }
  327. - (void)viewWillAppear:(BOOL)animated
  328. {
  329. [super viewWillAppear:animated];
  330. [self handleDataFun];
  331. }
  332. //- (void)setDataModel:(ShareRecordListModel *)dataModel
  333. - (void)handleDataFun
  334. {
  335. //_dataModel = dataModel;
  336. if(!_dataModel.expirationStatus && !_dataModel.reportStatus){
  337. _cancelShareLinkButton.hidden = NO;
  338. _shareLinkCopyButton.hidden = NO;
  339. if(_dataModel.expirationDay== 0)
  340. {
  341. NSString *expDateStr = NSLocalizedString(@"share_expiration_date_forever",nil);
  342. _shareEndDateLabel.text = expDateStr;
  343. }
  344. else{
  345. //失效时间
  346. _shareEndDateLabel.text = _dataModel.expirationTime;
  347. }
  348. }
  349. else{
  350. _cancelShareLinkButton.hidden = YES;
  351. _shareLinkCopyButton.hidden = YES;
  352. //失效时间
  353. //NSString *tipStr2 = NSLocalizedString(@"copy_share_link_Invalid_tip",nil);
  354. //_shareEndDateLabel.text = tipStr2;
  355. //_shareEndDateLabel.textColor = [UIColor hwColor:@"#DD4E4E"];
  356. if(_dataModel.reportStatus){
  357. _shareEndDateLabel.text = _dataModel.reportTime;
  358. _checkShareLinkButton.hidden = YES;
  359. }
  360. else{
  361. _shareEndDateLabel.text = _dataModel.expirationTime;
  362. }
  363. }
  364. ShareFileDataModel *fileModel = _dataModel.fileListVOS.firstObject;
  365. NSString *titleStr = [[NSString alloc] initWithFormat:@"%@%@%ld%@",fileModel.fileName,NSLocalizedString(@"share_file_more_tip",nil), _dataModel.fileListVOS.count,NSLocalizedString(@"share_file_Numbers_tip",nil)];
  366. if(_dataModel.fileListVOS.count == 1){
  367. titleStr = fileModel.fileName;
  368. }
  369. _shareTitleLabel.text = titleStr;
  370. _shareBeginDateLabel.text = _dataModel.createTime;
  371. NSString *serUrl = shareService;
  372. NSString *shareUrl = [[NSString alloc] initWithFormat:@"%@%@",serUrl,_dataModel.token];
  373. _shareQRCodeImageView.image = [self generateQRCodeWithInputMessage:shareUrl Width:168 Height:168];
  374. _extractCodeTip2Lab.text = _dataModel.extractionCode;
  375. _remainingNumberLabel.text = [[NSString alloc] initWithFormat:@"%ld",_dataModel.remainingNumber];
  376. CGFloat whiteBgViewH = 558;
  377. if(_dataModel.platformType == 4){
  378. if (_dataModel.reportStatus) {
  379. _reportTipLabel.hidden = NO;
  380. _reportLabel.hidden = NO;
  381. }
  382. else{
  383. _reportTipLabel.hidden = YES;
  384. _reportLabel.hidden = YES;
  385. whiteBgViewH -= 30;
  386. }
  387. [_whiteBgView mas_remakeConstraints:^(MASConstraintMaker *make) {
  388. make.left.mas_equalTo(15);
  389. //make.right.mas_equalTo(-15);
  390. make.width.mas_equalTo(SCREEN_W - 30);
  391. //make.top.equalTo(self.navBarBGView.mas_bottom).offset(40.f);
  392. make.top.mas_equalTo(40);
  393. make.height.mas_equalTo(whiteBgViewH);
  394. }];
  395. }
  396. else{
  397. _extractCodeTipLab.hidden = YES;
  398. _extractCodeTip2Lab.hidden = YES;
  399. whiteBgViewH -= 30;
  400. if (_dataModel.reportStatus) {
  401. _reportTipLabel.hidden = NO;
  402. _reportLabel.hidden = NO;
  403. [_reportTipLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
  404. make.left.mas_equalTo(32);
  405. make.width.mas_equalTo(80);
  406. make.top.equalTo(_remainingNumberLabel.mas_bottom).offset(10);
  407. make.height.mas_equalTo(20);
  408. }];
  409. [_reportLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
  410. make.left.mas_equalTo(_reportTipLabel.mas_right);
  411. make.right.mas_equalTo(-20);
  412. make.top.equalTo(_reportTipLabel.mas_top);
  413. make.height.mas_equalTo(20);
  414. }];
  415. }
  416. else{
  417. _reportTipLabel.hidden = YES;
  418. _reportLabel.hidden = YES;
  419. whiteBgViewH -= 30;
  420. }
  421. [_whiteBgView mas_remakeConstraints:^(MASConstraintMaker *make) {
  422. make.left.mas_equalTo(15);
  423. //make.right.mas_equalTo(-15);
  424. make.width.mas_equalTo(SCREEN_W - 30);
  425. //make.top.equalTo(self.navBarBGView.mas_bottom).offset(40.f);
  426. make.top.mas_equalTo(40);
  427. make.height.mas_equalTo(whiteBgViewH);
  428. }];
  429. }
  430. _BgScrollView.contentSize = CGSizeMake(SCREEN_W, 40 + whiteBgViewH + 75);
  431. }
  432. #pragma mark 取消分享
  433. - (void)showCancelAlearViewFun
  434. {
  435. NSString *tipStr = NSLocalizedString(@"cancel_share_Tip_msg",nil);
  436. KWeakSelf
  437. ComontAlretViewController *curAlretVC= [[ComontAlretViewController alloc] initWithTiTle:nil
  438. msg:tipStr
  439. imageStr:nil
  440. cancelTitle:NSLocalizedString(@"other_cancel",nil)
  441. okTitle:NSLocalizedString(@"other_confirm",nil) isOkBtnHighlight:YES
  442. didClickOk:^{
  443. [weakSelf cancelShareLinkFun];
  444. } didClickCancel:^{
  445. }];
  446. curAlretVC.modalPresentationStyle = UIModalPresentationCustom;
  447. [self presentViewController:curAlretVC animated:YES completion:^{
  448. curAlretVC.view.superview.backgroundColor = [UIColor clearColor];
  449. }];
  450. }
  451. - (void)cancelShareLinkFun
  452. {
  453. NSMutableDictionary *paraDict = [NSMutableDictionary new];
  454. if(_dataModel.addShareId){
  455. //[paraDict setValue:_dataModel.addShareId forKey:@"id"];
  456. [paraDict setValue:@[_dataModel.addShareId] forKey:@"idList"];
  457. }
  458. [paraDict setValue:@1 forKey:@"expirationStatus"];
  459. KWeakSelf
  460. [self showNewIndicatorWithCanBack:NO canTouch:NO];
  461. [[netWorkManager shareInstance] CommonPostCallBackCode:updateShareInfoFun Parameters:paraDict success:^(id _Nonnull responseObject) {
  462. [weakSelf removeNewIndicator];
  463. SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
  464. if(model && model.code == 0){
  465. [[iToast makeText:NSLocalizedString(@"cancel_share_suc_msg",nil)] show];
  466. [weakSelf getShareOneFileListFun];
  467. }
  468. else{
  469. [[iToast makeText:NSLocalizedString(@"cancel_share_fail_msg",nil)] show];
  470. }
  471. } failure:^(NSError * _Nonnull error) {
  472. [weakSelf removeNewIndicator];
  473. [[iToast makeText:NSLocalizedString(@"cancel_share_fail_msg",nil)] show];
  474. }];
  475. }
  476. #pragma mark 取消分享信息重新获取
  477. - (void)getShareOneFileListFun
  478. {
  479. _dataModel.expirationStatus = 1;
  480. [self handleDataFun];
  481. if(_didCancelShareLinkFun){
  482. _didCancelShareLinkFun();
  483. }
  484. }
  485. - (void)copyShareLinkFun
  486. {
  487. if(_dataModel.fileListVOS.count <=0 ){
  488. return;
  489. }
  490. ShareFileDataModel *dataModel = _dataModel.fileListVOS.firstObject;
  491. 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)];
  492. if(_dataModel.fileListVOS.count == 1){
  493. copyStr1 = [[NSString alloc] initWithFormat:@"%@%@",NSLocalizedString(@"share_secret_titile_1",nil),dataModel.fileName];
  494. }
  495. if(_dataModel.platformType == 4) {
  496. copyStr1 = [[NSString alloc] initWithFormat:@"%@%@",NSLocalizedString(@"share_secret_titile_1",nil),copyStr1];
  497. }
  498. NSString *serUrl = shareService;
  499. NSString *shareUrl = [[NSString alloc] initWithFormat:@"%@%@",serUrl,_dataModel.token];
  500. NSString *copyStr2 = [[NSString alloc] initWithFormat:@"%@%@",NSLocalizedString(@"share_secret_titile_2",nil),shareUrl];
  501. NSString *copyStr3 = [[NSString alloc] initWithFormat:@"%@%@",NSLocalizedString(@"share_secret_titile_3",nil),_dataModel.extractionCode];
  502. NSString *copyStr4 = NSLocalizedString(@"share_secret_titile_4",nil);
  503. NSString *copyTotalStr = [[NSString alloc] initWithFormat:@"%@\n%@\n%@\n%@",copyStr1,copyStr2,copyStr3,copyStr4];
  504. if(_dataModel.platformType != 4) {
  505. copyTotalStr = [[NSString alloc] initWithFormat:@"%@\n%@\n%@",copyStr1,copyStr2,copyStr4];
  506. }
  507. UIPasteboard* pasteboard = [UIPasteboard generalPasteboard];
  508. pasteboard.string = copyTotalStr;
  509. [[iToast makeText:NSLocalizedString(@"copy_share_link_suc_tip",nil)] show];
  510. }
  511. @end