editShareView.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. //
  2. // editShareView.m
  3. // 双子星云手机
  4. //
  5. // Created by xd h on 2024/5/14.
  6. //
  7. #import "editShareView.h"
  8. #import "addShareModel.h"
  9. #import "customShareManageTool.h"
  10. #import "shareBySecretView.h"
  11. //微信分享头文件
  12. #import "WXApi.h"
  13. #import "WXApiObject.h"
  14. //QQ分享头文件
  15. #import <TencentOpenAPI/TencentOAuth.h>
  16. #import <TencentOpenAPI/QQApiInterface.h>
  17. #import <TencentOpenAPI/QQApiInterfaceObject.h>
  18. @interface editShareView ()<UITextFieldDelegate>
  19. @property(nonatomic,strong) UIButton*day7Button;
  20. @property(nonatomic,strong) UIButton*dayForeverButton;
  21. @property(nonatomic,strong) UIButton*addButton;//+
  22. @property(nonatomic,strong) UITextField *shareNumberTF;
  23. @property(nonatomic,strong) UIButton*reduceButton;//-
  24. @property(nonatomic,strong) UIButton*PrivacyShareButton;
  25. @end
  26. @implementation editShareView
  27. - (id)initWithFrame:(CGRect)frame{
  28. self = [super initWithFrame:frame];
  29. self.backgroundColor = [UIColor hwColor:@"#000000" alpha:0.6];
  30. [self drawAnyView];
  31. return self;
  32. }
  33. - (void)drawAnyView{
  34. UIView *whiteBgView = [[UIView alloc] init];
  35. whiteBgView.backgroundColor = [UIColor whiteColor];
  36. [self addSubview:whiteBgView];
  37. whiteBgView.layer.cornerRadius = 32;
  38. whiteBgView.layer.masksToBounds = YES;
  39. [whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  40. make.left.mas_equalTo(0);
  41. make.right.mas_equalTo(0);
  42. make.bottom.mas_equalTo(0);
  43. make.height.mas_equalTo(345 + AdaptTabHeight);
  44. }];
  45. UILabel *titleLabel = [[UILabel alloc] init];
  46. titleLabel.font = [UIFont systemFontOfSize:18.0];
  47. titleLabel.textColor = [UIColor hwColor:@"#0A132B" alpha:1.0];
  48. [whiteBgView addSubview:titleLabel];
  49. NSString *leftText = NSLocalizedString(@"share_title_left",nil);
  50. NSString *rightText = NSLocalizedString(@"share_title_right",nil);
  51. NSString *totalStr = [[NSString alloc] initWithFormat:@"%@ %@",leftText,rightText];
  52. NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:totalStr];
  53. NSRange redRange = NSMakeRange([totalStr rangeOfString:rightText].location, [totalStr rangeOfString:rightText].length);
  54. UIColor *noteColor =[UIColor hwColor:@"#959799" alpha:1.0];
  55. [attrStr addAttribute:NSForegroundColorAttributeName value:noteColor range:redRange];
  56. [attrStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:12.0] range:redRange];
  57. titleLabel.attributedText = attrStr;
  58. [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  59. make.left.mas_equalTo(25);
  60. make.right.mas_equalTo(0);
  61. make.top.mas_equalTo(20);
  62. make.height.mas_equalTo(40);
  63. }];
  64. NSString *secondTitleStr = NSLocalizedString(@"share_expiration_date",nil);
  65. UILabel *secondTitleLabel = [[UILabel alloc] init];
  66. secondTitleLabel.font = [UIFont systemFontOfSize:14.0];
  67. secondTitleLabel.textColor = [UIColor hwColor:@"#666666" alpha:1.0];
  68. secondTitleLabel.text = secondTitleStr;
  69. [whiteBgView addSubview:secondTitleLabel];
  70. CGFloat secondWith = [secondTitleStr boundingRectWithSize:CGSizeMake(300, 20) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14.0]} context:nil].size.width;
  71. [secondTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  72. make.left.mas_equalTo(25);
  73. make.width.mas_equalTo(secondWith);
  74. make.top.equalTo(titleLabel.mas_bottom).offset(10);
  75. make.height.mas_equalTo(25);
  76. }];
  77. _day7Button = [[UIButton alloc] init];
  78. [_day7Button setImage:[UIImage imageNamed:@"common_did_check"] forState:UIControlStateSelected];
  79. [_day7Button setImage:[UIImage imageNamed:@"common_un_check"] forState:UIControlStateNormal];
  80. [_day7Button setTitle:NSLocalizedString(@"share_expiration_date_7",nil) forState:UIControlStateNormal];
  81. [_day7Button setTitleColor:[UIColor hwColor:@"#0A132B"] forState:UIControlStateNormal];
  82. [_day7Button addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
  83. _day7Button.titleLabel.font = [UIFont boldSystemFontOfSize:14];
  84. _day7Button.tag = 1;
  85. [whiteBgView addSubview:_day7Button];
  86. _day7Button.selected = YES;
  87. [_day7Button mas_makeConstraints:^(MASConstraintMaker *make) {
  88. make.left.equalTo(secondTitleLabel.mas_right).offset(5);
  89. make.width.mas_equalTo(100);
  90. make.top.equalTo(secondTitleLabel.mas_top).offset(0);
  91. make.height.mas_equalTo(25);
  92. }];
  93. _dayForeverButton = [[UIButton alloc] init];
  94. [_dayForeverButton setImage:[UIImage imageNamed:@"common_did_check"] forState:UIControlStateSelected];
  95. [_dayForeverButton setImage:[UIImage imageNamed:@"common_un_check"] forState:UIControlStateNormal];
  96. [_dayForeverButton setTitle:NSLocalizedString(@"share_expiration_date_forever",nil) forState:UIControlStateNormal];
  97. [_dayForeverButton setTitleColor:[UIColor hwColor:@"#0A132B"] forState:UIControlStateNormal];
  98. [_dayForeverButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
  99. _dayForeverButton.titleLabel.font = [UIFont boldSystemFontOfSize:14];
  100. _dayForeverButton.tag = 2;
  101. [whiteBgView addSubview:_dayForeverButton];
  102. [_dayForeverButton mas_makeConstraints:^(MASConstraintMaker *make) {
  103. make.left.equalTo(_day7Button.mas_right).offset(15);
  104. make.width.mas_equalTo(100);
  105. make.top.equalTo(secondTitleLabel.mas_top).offset(0);
  106. make.height.mas_equalTo(25);
  107. }];
  108. //1.4.1 添加分享次数限制
  109. NSString *thridTitleStr = NSLocalizedString(@"share_number_limit_title",nil);
  110. UILabel *thridTitleLabel = [[UILabel alloc] init];
  111. thridTitleLabel.font = [UIFont systemFontOfSize:14.0];
  112. thridTitleLabel.textColor = [UIColor hwColor:@"#666666" alpha:1.0];
  113. thridTitleLabel.text = thridTitleStr;
  114. [whiteBgView addSubview:thridTitleLabel];
  115. CGFloat thridWith = [thridTitleStr boundingRectWithSize:CGSizeMake(300, 20) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14.0]} context:nil].size.width + 10;
  116. [thridTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  117. make.left.mas_equalTo(25);
  118. make.width.mas_equalTo(thridWith);
  119. make.top.equalTo(secondTitleLabel.mas_bottom).offset(10);
  120. make.height.mas_equalTo(25);
  121. }];
  122. _addButton = [[UIButton alloc] init];
  123. [_addButton setImage:[UIImage imageNamed:@"common_add_d"] forState:UIControlStateDisabled];
  124. [_addButton setImage:[UIImage imageNamed:@"common_add_N"] forState:UIControlStateNormal];
  125. [_addButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
  126. _addButton.tag = 3;
  127. [whiteBgView addSubview:_addButton];
  128. _addButton.enabled = NO;
  129. [_addButton mas_makeConstraints:^(MASConstraintMaker *make) {
  130. make.right.mas_equalTo(-20);
  131. make.centerY.equalTo(thridTitleLabel.mas_centerY).offset(0);
  132. make.width.mas_equalTo(30);
  133. make.height.mas_equalTo(30);
  134. }];
  135. _shareNumberTF = [[UITextField alloc] init];
  136. _shareNumberTF.backgroundColor = [UIColor hwColor:@"#F1F2F3" alpha:1.0];
  137. _shareNumberTF.layer.cornerRadius = 8;
  138. _shareNumberTF.textColor = [UIColor blackColor];
  139. _shareNumberTF.textAlignment = NSTextAlignmentCenter;
  140. _shareNumberTF.font = [UIFont systemFontOfSize:14.0];
  141. _shareNumberTF.text = @"80";
  142. _shareNumberTF.delegate = self;
  143. _shareNumberTF.keyboardType = UIKeyboardTypeNumberPad;
  144. [whiteBgView addSubview:_shareNumberTF];
  145. [_shareNumberTF setTintColor:[UIColor hwColor:@"#01B7EA" alpha:1.0]];
  146. [_shareNumberTF mas_makeConstraints:^(MASConstraintMaker *make) {
  147. make.right.equalTo(_addButton.mas_left).offset(-5);
  148. make.centerY.equalTo(thridTitleLabel.mas_centerY).offset(0);
  149. make.width.mas_equalTo(50);
  150. make.height.mas_equalTo(25);
  151. }];
  152. _reduceButton = [[UIButton alloc] init];
  153. [_reduceButton setImage:[UIImage imageNamed:@"common_reduce_d"] forState:UIControlStateDisabled];
  154. [_reduceButton setImage:[UIImage imageNamed:@"common_reduce_N"] forState:UIControlStateNormal];
  155. [_reduceButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
  156. _reduceButton.tag = 4;
  157. [whiteBgView addSubview:_reduceButton];
  158. [_reduceButton mas_makeConstraints:^(MASConstraintMaker *make) {
  159. make.right.equalTo(_shareNumberTF.mas_left).offset(-5);
  160. make.centerY.equalTo(thridTitleLabel.mas_centerY).offset(0);
  161. make.width.mas_equalTo(30);
  162. make.height.mas_equalTo(30);
  163. }];
  164. NSArray *titleArr = @[NSLocalizedString(@"share_by_weixin",nil),
  165. NSLocalizedString(@"share_by_QQ",nil),
  166. NSLocalizedString(@"share_by_timeLine",nil),
  167. NSLocalizedString(@"share_by_secret",nil)];
  168. NSArray *imageStrArr = @[@"share_weixin_icon",
  169. @"share_qq_icon",
  170. @"share_weixin_Timeline_icon",
  171. @"share_secret_icon"];
  172. CGFloat curButFullWidth = SCREEN_W/4.0;
  173. for (int i = 0; i< titleArr.count; i++) {
  174. UIButton*curButton = [[UIButton alloc] init];
  175. [curButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
  176. curButton.tag = 10+i;
  177. [whiteBgView addSubview:curButton];
  178. [curButton mas_makeConstraints:^(MASConstraintMaker *make) {
  179. make.width.mas_equalTo(curButFullWidth);
  180. make.left.mas_equalTo(i*curButFullWidth);
  181. make.height.mas_equalTo(80);
  182. make.top.equalTo(thridTitleLabel.mas_bottom).offset(20);
  183. }];
  184. if(i== titleArr.count -1){
  185. _PrivacyShareButton = curButton;
  186. }
  187. UIView *imageBgView = [[UIView alloc] init];
  188. imageBgView.backgroundColor = [UIColor hwColor:@"#F5F7FA"];
  189. imageBgView.layer.cornerRadius = 8;
  190. imageBgView.layer.masksToBounds = YES;
  191. [curButton addSubview:imageBgView];
  192. imageBgView.userInteractionEnabled = NO;
  193. [imageBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  194. make.width.mas_equalTo(64);
  195. make.height.mas_equalTo(52);
  196. make.centerX.equalTo(curButton.mas_centerX);
  197. make.top.mas_equalTo(0);
  198. }];
  199. UIImageView *leftImageV = [[UIImageView alloc] init];
  200. leftImageV.image = [UIImage imageNamed:imageStrArr[i]];
  201. [imageBgView addSubview:leftImageV];
  202. [leftImageV mas_makeConstraints:^(MASConstraintMaker *make) {
  203. make.width.mas_equalTo(25);
  204. make.height.mas_equalTo(25);
  205. make.centerX.equalTo(imageBgView.mas_centerX);
  206. make.centerY.equalTo(imageBgView.mas_centerY).offset(0);
  207. }];
  208. UILabel *leftLabel = [[UILabel alloc] init];
  209. leftLabel.textColor = [UIColor hwColor:@"#0A132B"];
  210. leftLabel.textAlignment = NSTextAlignmentCenter;
  211. leftLabel.font = [UIFont systemFontOfSize:12.0];
  212. leftLabel.text = titleArr[i];
  213. [curButton addSubview:leftLabel];
  214. [leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  215. make.width.mas_equalTo(curButFullWidth);
  216. make.height.mas_equalTo(25);
  217. make.centerX.equalTo(curButton.mas_centerX);
  218. //make.top.equalTo(imageBgView.mas_bottom).offset(10);
  219. make.bottom.mas_equalTo(0);
  220. }];
  221. }
  222. UIButton*cancelButton = [[UIButton alloc] init];
  223. [cancelButton setTitle:NSLocalizedString(@"other_cancel",nil) forState:UIControlStateNormal];
  224. [cancelButton setTitleColor:[UIColor hwColor:@"#0A132B"] forState:UIControlStateNormal];
  225. [cancelButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
  226. cancelButton.titleLabel.font = [UIFont boldSystemFontOfSize:14];
  227. cancelButton.tag = 100;
  228. [whiteBgView addSubview:cancelButton];
  229. [cancelButton mas_makeConstraints:^(MASConstraintMaker *make) {
  230. make.left.mas_equalTo(0);
  231. make.right.mas_equalTo(0);
  232. make.bottom.mas_equalTo(-AdaptTabHeight);
  233. make.height.mas_equalTo(40);
  234. }];
  235. UIView *lineView = [[UIView alloc] init];
  236. lineView.backgroundColor = [UIColor hwColor:@"#EAEAEA"];
  237. [whiteBgView addSubview:lineView];
  238. [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
  239. make.left.mas_equalTo(25);
  240. make.right.mas_equalTo(-25);
  241. make.bottom.equalTo(cancelButton.mas_top).offset(-5);
  242. make.height.mas_equalTo(1);
  243. }];
  244. UILabel *tipLabel = [[UILabel alloc] init];
  245. tipLabel.font = [UIFont systemFontOfSize:12.0];
  246. tipLabel.textColor = [UIColor hwColor:@"#959799" alpha:1.0];
  247. [whiteBgView addSubview:tipLabel];
  248. NSString *TipText = NSLocalizedString(@"share_file_tip_msg",nil);
  249. tipLabel.text = TipText;
  250. [tipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  251. make.left.mas_equalTo(25);
  252. make.right.mas_equalTo(-25);
  253. make.bottom.equalTo(lineView.mas_bottom).offset(-30);
  254. make.height.mas_equalTo(15);
  255. }];
  256. }
  257. - (void)didClickButFun:(UIButton*)but
  258. {
  259. NSInteger tag = but.tag;
  260. if(tag != 3 && tag != 4 ){//防止重复点击
  261. but.userInteractionEnabled = NO;
  262. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  263. but.userInteractionEnabled = YES;
  264. });
  265. }
  266. if(tag==1 && !_day7Button.selected){
  267. _day7Button.selected = YES;
  268. _dayForeverButton.selected = NO;
  269. //私密分享
  270. _PrivacyShareButton.hidden = NO;
  271. }
  272. else if(tag==2 && !_dayForeverButton.selected){
  273. _day7Button.selected = NO;
  274. _dayForeverButton.selected = YES;
  275. //私密分享
  276. _PrivacyShareButton.hidden = YES;
  277. }
  278. else if(tag==3){
  279. NSInteger number = _shareNumberTF.text.integerValue;
  280. number ++;
  281. _shareNumberTF.text = [[NSString alloc] initWithFormat:@"%ld",number];
  282. if(number == 80){
  283. _addButton.enabled = NO;
  284. }
  285. _reduceButton.enabled = YES;
  286. }
  287. else if(tag==4){
  288. NSInteger number = _shareNumberTF.text.integerValue;
  289. number --;
  290. _shareNumberTF.text = [[NSString alloc] initWithFormat:@"%ld",number];
  291. if(number == 1){
  292. _reduceButton.enabled = NO;
  293. }
  294. _addButton.enabled = YES;
  295. }
  296. else if(tag == 100){
  297. [self removeFromSuperview];
  298. }
  299. else{
  300. if(tag == 11){
  301. if(![QQApiInterface isSupportShareToQQ])
  302. {
  303. //[[iToast makeText:@"未安装QQ,请先安装QQ"] show];
  304. [[iToast makeText:NSLocalizedString(@"share_no_qq",nil)] show];
  305. return;
  306. }
  307. }
  308. else if (tag == 10 || tag == 12){
  309. if(![WXApi isWXAppInstalled])
  310. {
  311. //[[iToast makeText:@"未安装微信,请先安装微信"] show];
  312. [[iToast makeText:NSLocalizedString(@"share_no_wx",nil)] show];
  313. return;
  314. }
  315. }
  316. //请求服务器处理分享数据
  317. [self addShareDataBy:tag];
  318. }
  319. }
  320. //添加分享
  321. - (void)addShareDataBy:(NSInteger)tag
  322. {
  323. NSString *curSn = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.changeSn;
  324. NSString *platformType = [[NSString alloc] initWithFormat:@"%ld", tag - 9];
  325. //_shareFileType
  326. NSInteger expirationDay = _day7Button.selected ? 7 : 0;
  327. NSMutableArray * boxShareFileDTOList = [NSMutableArray new];
  328. for (NASFilePicDataArrModel*dataModel in _didSelectListArr) {
  329. NSMutableDictionary *modelDict = [NSMutableDictionary new];
  330. if(dataModel.name){
  331. [modelDict setValue:dataModel.name forKey:@"fileName"];
  332. NSArray * nameArr = [dataModel.name componentsSeparatedByString:@"."];
  333. if(nameArr.count >= 2){
  334. NSString*fileSuffix = nameArr.lastObject;
  335. if(fileSuffix && fileSuffix.length > 0){
  336. [modelDict setValue:fileSuffix forKey:@"fileSuffix"];
  337. }
  338. }
  339. }
  340. if(dataModel.size >= 0){
  341. [modelDict setValue:[NSNumber numberWithLong:dataModel.size] forKey:@"fileSize"];
  342. }
  343. if(dataModel.time){
  344. [modelDict setValue:dataModel.time forKey:@"fileTime"];
  345. }
  346. if(dataModel.path){
  347. NSString *filePath = dataModel.path;
  348. NSString *urlStr = ksharedAppDelegate.NASShareFileService;
  349. NSString *headUrl = [[NSString alloc] initWithFormat:@"%@getThumbnail?path=%@",urlStr,filePath];
  350. NSString *fileUrl = [[NSString alloc] initWithFormat:@"%@getFile?path=%@",urlStr,filePath];
  351. if(headUrl){
  352. [modelDict setValue:headUrl forKey:@"headUrl"];
  353. }
  354. if(headUrl){
  355. [modelDict setValue:fileUrl forKey:@"fileUrl"];
  356. }
  357. }
  358. [boxShareFileDTOList addObject:modelDict];
  359. }
  360. NSMutableDictionary *paraDict = [NSMutableDictionary new];
  361. if(!curSn){
  362. return;
  363. }
  364. [paraDict setValue:curSn forKey:@"sn"];
  365. [paraDict setValue:platformType forKey:@"platformType"];
  366. if(_shareFileType){
  367. [paraDict setValue:_shareFileType forKey:@"fileType"];
  368. }
  369. [paraDict setValue:[NSNumber numberWithInteger:expirationDay] forKey:@"expirationDay"];
  370. [paraDict setValue:boxShareFileDTOList forKey:@"boxShareFileDTOList"];
  371. //1.4.1 新增的字段
  372. if(_shareNumberTF.text)
  373. {
  374. [paraDict setValue:_shareNumberTF.text forKey:@"shareNumber"];
  375. }
  376. KWeakSelf
  377. //[ showNewIndicatorWithCanBack:NO canTouch:NO];
  378. [[netWorkManager shareInstance] CommonPostCallBackCode:addShareInfoFun Parameters:paraDict success:^(id _Nonnull responseObject) {
  379. addShareModel *model = [[addShareModel alloc] initWithDictionary:responseObject error:nil];
  380. if(model && model.code == 0){
  381. [weakSelf gotoShareFunWith:tag with:model];
  382. }
  383. else{
  384. [[iToast makeText:NSLocalizedString(@"share_fail_msg",nil)] show];//
  385. }
  386. } failure:^(NSError * _Nonnull error) {
  387. [[iToast makeText:NSLocalizedString(@"share_fail_msg",nil)] show];
  388. }];
  389. }
  390. - (void)gotoShareFunWith:(NSInteger)tag with:(addShareModel*)model
  391. {
  392. [self removeFromSuperview];
  393. //type1 朋友圈 2 微信好友 3 QQ
  394. NSInteger shareType = 1;
  395. if(tag == 10){
  396. shareType =2;
  397. }
  398. else if(tag == 11){
  399. shareType = 3;
  400. }
  401. else if(tag == 12){
  402. shareType = 1;
  403. }
  404. else if(tag == 13){
  405. [self showSecretShareViewFunwith:model];
  406. return;;
  407. }
  408. NSString *serUrl = shareService;
  409. NSString *shareUrl = [[NSString alloc] initWithFormat:@"%@%@",serUrl,model.data.token];
  410. //NSString *shareTitle = [[NSString alloc] initWithFormat:@"Private-X%@",NSLocalizedString(@"common_edit_share",nil)];
  411. NSString *shareTitle = @"Private-X分享";
  412. NSString *firstname = nil;
  413. if (_didSelectListArr.count > 0) {
  414. NASFilePicDataArrModel*dataModel = _didSelectListArr[0];
  415. firstname = dataModel.name;
  416. }
  417. //我正在使用Private-X魔盒,给大家分享 文件名称文件名称.jpg 等 2 个文件 ,快来看看吧~
  418. NSString *shareContent = [[NSString alloc] initWithFormat:@"我正在使用Private-X魔盒,给大家分享%@等%ld个文件 ,快来看看吧~",firstname,_didSelectListArr.count];
  419. if(_didSelectListArr.count == 1){
  420. shareContent = [[NSString alloc] initWithFormat:@"我正在使用Private-X魔盒,给大家分享%@ ,快来看看吧~",firstname];
  421. }
  422. [[customShareManageTool sharedManager] shareType:shareType withShareUrl:shareUrl withShareTitle:shareTitle withShareContent:shareContent];
  423. }
  424. - (void)showSecretShareViewFunwith:(addShareModel*)model
  425. {
  426. shareBySecretView *secretView = [[shareBySecretView alloc] init];
  427. secretView.addShareMod = model;
  428. secretView.didSelectListArr = _didSelectListArr;
  429. [ksharedAppDelegate.window addSubview:secretView];
  430. [secretView mas_makeConstraints:^(MASConstraintMaker *make) {
  431. make.left.mas_equalTo(0);
  432. make.right.mas_equalTo(0);
  433. make.top.mas_equalTo(0);
  434. make.bottom.mas_equalTo(0);
  435. }];
  436. }
  437. #pragma mark 分享次数编辑完成
  438. - (void)textFieldDidEndEditing:(UITextField *)textField
  439. {
  440. NSInteger shareNum = textField.text.integerValue;
  441. if(shareNum > 80 || shareNum <= 0){
  442. textField.text = @"80";
  443. [[iToast makeText:NSLocalizedString(@"share_number_limit_error_tip",nil)] show];
  444. }
  445. [self setAddOrReduceButtonFun];
  446. }
  447. #pragma mark 设置加减按钮状态
  448. - (void)setAddOrReduceButtonFun
  449. {
  450. NSInteger number = _shareNumberTF.text.integerValue;
  451. if(number == 1){
  452. _reduceButton.enabled = NO;
  453. _addButton.enabled = YES;
  454. }
  455. else if (number == 80){
  456. _reduceButton.enabled = YES;
  457. _addButton.enabled = NO;
  458. }
  459. else{
  460. _reduceButton.enabled = YES;
  461. _addButton.enabled = YES;
  462. }
  463. }
  464. @end