mySetHeadView.m 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807
  1. //
  2. // mySetHeadView.m
  3. // 隐私保护
  4. //
  5. // Created by xd h on 2023/11/9.
  6. //
  7. #import "mySetHeadView.h"
  8. #import "TZImageManager.h"
  9. #import "backupsFileManager.h"
  10. #import "AFNetworkReachabilityManager.h"
  11. @interface mySetHeadView ()
  12. {
  13. UIView *imageBackupsBgView;
  14. UILabel *imageBackupsLabel;
  15. }
  16. @end
  17. @implementation mySetHeadView
  18. - (id)initWithFrame:(CGRect)frame{
  19. self = [super initWithFrame:frame];
  20. [self drawAnyView];
  21. [self setBackupsStateFun];
  22. return self;
  23. }
  24. - (void)drawAnyView{
  25. [self setBackgroundColor:[UIColor hwColor:@"#F5F7FA" alpha:1.0]];
  26. //self.backgroundColor = [UIColor redColor];
  27. //文件上传
  28. UIView *fileUploadBgView = [[UIView alloc] init];
  29. fileUploadBgView.backgroundColor = [UIColor whiteColor];
  30. fileUploadBgView.layer.cornerRadius = 8;
  31. [self addSubview:fileUploadBgView];
  32. [fileUploadBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  33. make.left.mas_equalTo(10);
  34. make.top.mas_equalTo(10);
  35. make.right.mas_equalTo(-10);
  36. make.height.mas_equalTo(220);
  37. }];
  38. UILabel *titleLabel = [[UILabel alloc] init];
  39. titleLabel.text = NSLocalizedString(@"my_set_no_File_upload_title",nil) ;
  40. titleLabel.font = [UIFont boldSystemFontOfSize:16.0];
  41. titleLabel.textColor = [UIColor blackColor];
  42. [fileUploadBgView addSubview:titleLabel];
  43. [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  44. make.left.mas_equalTo(10);
  45. make.top.mas_equalTo(10);
  46. make.width.mas_equalTo(140);
  47. make.height.mas_equalTo(20);
  48. }];
  49. NSArray *fileTitleArr = @[NSLocalizedString(@"my_set_no_image_upload",nil),
  50. NSLocalizedString(@"my_set_no_video_upload",nil),
  51. NSLocalizedString(@"my_set_no_music",nil),
  52. NSLocalizedString(@"my_set_no_file",nil),
  53. NSLocalizedString(@"my_set_no_share",nil),
  54. NSLocalizedString(@"my_set_no_File_backups",nil),
  55. NSLocalizedString(@"more_set",nil)];
  56. NSArray *fileImageArr = @[@"icon_file_image",
  57. @"icon_file_video",
  58. @"icon_file_music",
  59. @"icon_file_file",
  60. @"icon_file_share",
  61. @"icon_file_backups",
  62. @"icon_file_setting"];
  63. CGFloat butWidth = (SCREEN_W -20)/5;
  64. CGFloat butHeight = 88.0;
  65. for (int i=0; i<fileTitleArr.count; i++) {
  66. UIButton *curButton = [UIButton buttonWithType:UIButtonTypeCustom];
  67. curButton.tag = 100 + i;
  68. // [curButton setImage:[UIImage imageNamed:fileImageArr[i]] forState:UIControlStateNormal];
  69. // [curButton setTitle:fileTitleArr[i] forState:UIControlStateNormal];
  70. // [curButton setTitleColor:[UIColor hwColor:@"#0A132B" alpha:1.0] forState:UIControlStateNormal];
  71. // curButton.titleLabel.font = [UIFont systemFontOfSize:12.0];
  72. [curButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
  73. [fileUploadBgView addSubview:curButton];
  74. // if(i==0)
  75. // {
  76. // curButton.backgroundColor = [UIColor greenColor];
  77. // curButton.titleLabel.backgroundColor = [UIColor redColor];
  78. // }
  79. [curButton mas_makeConstraints:^(MASConstraintMaker *make) {
  80. make.left.mas_equalTo(butWidth*(i%5));
  81. make.top.mas_equalTo(titleLabel.mas_bottom).offset((i/5) * (butHeight));
  82. make.width.mas_equalTo(butWidth);
  83. make.height.mas_equalTo(butHeight);
  84. }];
  85. UIButton *curImageV = [[UIButton alloc] init];
  86. curImageV.userInteractionEnabled = NO;
  87. [curImageV setImage:[UIImage imageNamed:fileImageArr[i]] forState:UIControlStateNormal];;
  88. [curButton addSubview:curImageV];
  89. [curImageV mas_makeConstraints:^(MASConstraintMaker *make) {
  90. make.centerX.equalTo(curButton.mas_centerX).offset(0);
  91. make.top.mas_equalTo(15);
  92. make.width.mas_equalTo(30);
  93. make.height.mas_equalTo(30);
  94. }];
  95. UILabel *curlab = [[UILabel alloc] init];
  96. curlab.text = fileTitleArr[i];
  97. curlab.font = [UIFont systemFontOfSize:12.0];
  98. curlab.textColor = [UIColor hwColor:@"#0A132B" alpha:1.0];
  99. curlab.numberOfLines = 0;
  100. curlab.textAlignment = NSTextAlignmentCenter;
  101. [curButton addSubview:curlab];
  102. [curlab mas_makeConstraints:^(MASConstraintMaker *make) {
  103. make.left.mas_equalTo(5);//* (i%5)
  104. make.right.mas_equalTo(-5);
  105. make.height.mas_equalTo(20);
  106. make.top.mas_equalTo(curImageV.mas_bottom).offset(5);
  107. }];
  108. }
  109. //其他功能
  110. UIView *otherBgView = [[UIView alloc] init];
  111. otherBgView.backgroundColor = [UIColor whiteColor];
  112. otherBgView.layer.cornerRadius = 8;
  113. [self addSubview:otherBgView];
  114. [otherBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  115. make.left.mas_equalTo(10);
  116. make.top.mas_equalTo(fileUploadBgView.mas_bottom).offset(25);
  117. make.right.mas_equalTo(-10);
  118. make.height.mas_equalTo(135 + 88);
  119. }];
  120. UILabel *otherTitleLabel = [[UILabel alloc] init];
  121. otherTitleLabel.text = NSLocalizedString(@"set_other_title",nil) ;
  122. otherTitleLabel.font = [UIFont boldSystemFontOfSize:16.0];
  123. otherTitleLabel.textColor = [UIColor blackColor];
  124. [otherBgView addSubview:otherTitleLabel];
  125. [otherTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  126. make.left.mas_equalTo(10);
  127. make.top.mas_equalTo(10);
  128. make.width.mas_equalTo(150);
  129. make.height.mas_equalTo(20);
  130. }];
  131. NSArray *titleArr = @[NSLocalizedString(@"my_set_Privacy_Model",nil),
  132. NSLocalizedString(@"my_set_no_change_phone",nil),
  133. NSLocalizedString(@"my_set_no_restart_phone",nil),
  134. NSLocalizedString(@"my_set_no_Restore_Factory",nil),
  135. NSLocalizedString(@"my_set_no_common_problem",nil),
  136. NSLocalizedString(@"my_set_no_check_update",nil),
  137. NSLocalizedString(@"my_set_no_clear_cache",nil)];
  138. NSArray *imageArr = @[@"Privacy_model_icon",@"icon_change_ohone",@"icon-gengxin",
  139. @"icon_Restore_Factory",@"icon_common_problem",
  140. @"app_update",@"app_clear_cache"];
  141. //CGFloat butWidth = (SCREEN_W -20)/titleArr.count;
  142. // CGFloat butWidth = (SCREEN_W -20)/5;
  143. // CGFloat butHeight = 88.0;
  144. for (int i=0; i<titleArr.count; i++) {
  145. UIButton *curButton = [UIButton buttonWithType:UIButtonTypeCustom];
  146. curButton.tag = 10 + i;
  147. [curButton setImage:[UIImage imageNamed:imageArr[i]] forState:UIControlStateNormal];
  148. [curButton setTitle:titleArr[i] forState:UIControlStateNormal];
  149. [curButton setTitleColor:[UIColor hwColor:@"#0A132B" alpha:1.0] forState:UIControlStateNormal];
  150. curButton.titleLabel.font = [UIFont systemFontOfSize:12.0];
  151. [curButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
  152. [otherBgView addSubview:curButton];
  153. //curButton.backgroundColor = [UIColor redColor];
  154. [curButton mas_makeConstraints:^(MASConstraintMaker *make) {
  155. make.left.mas_equalTo(butWidth*(i%5));
  156. make.top.mas_equalTo(otherTitleLabel.mas_bottom).offset((i/5) * (butHeight));
  157. make.width.mas_equalTo(butWidth);
  158. make.height.mas_equalTo(butHeight);
  159. }];
  160. CGFloat titleOffset = 0.0;
  161. [curButton setTitleEdgeInsets:UIEdgeInsetsMake(curButton.imageView.frame.size.height+5,-curButton.imageView.frame.size.width, 0.0,0.0)];
  162. [curButton setImageEdgeInsets:UIEdgeInsetsMake(-curButton.bounds.size.width/4+5, curButton.bounds.size.width/4-titleOffset, curButton.titleLabel.bounds.size.height, -curButton.bounds.size.width/4)];
  163. }
  164. }
  165. //- (void)drawAnyView{
  166. // [self setBackgroundColor:[UIColor hwColor:@"#F5F7FA" alpha:1.0]];
  167. // //self.backgroundColor = [UIColor redColor];
  168. //
  169. // //setting_Privacy_bg
  170. // UIImageView *PrivacyBg = [[UIImageView alloc] init];
  171. // PrivacyBg.image = [UIImage imageNamed:@"setting_Privacy_bg"];
  172. // //PrivacyBg.contentMode = UIViewContentModeScaleAspectFit;
  173. // PrivacyBg.userInteractionEnabled = YES;
  174. // [self addSubview:PrivacyBg];
  175. // //PrivacyBg.backgroundColor = [UIColor greenColor];
  176. //
  177. // CGFloat PrivacyBgW = SCREEN_W - 20;
  178. // CGFloat PrivacyBgH = 116.0 * PrivacyBgW / (345.0);
  179. //
  180. // [PrivacyBg mas_makeConstraints:^(MASConstraintMaker *make) {
  181. // make.left.mas_equalTo(10);
  182. // make.top.mas_equalTo(10);
  183. // make.width.mas_equalTo(PrivacyBgW);
  184. // make.height.mas_equalTo(PrivacyBgH);
  185. // }];
  186. //
  187. // UILabel *PrivacyTitleLabel = [[UILabel alloc] init];
  188. // PrivacyTitleLabel.text = NSLocalizedString(@"my_set_Privacy_Model",nil) ;
  189. // PrivacyTitleLabel.font = [UIFont boldSystemFontOfSize:16.0];
  190. // PrivacyTitleLabel.textColor = [UIColor hwColor:@"0A132B" alpha:1.0];
  191. // [PrivacyBg addSubview:PrivacyTitleLabel];
  192. //
  193. // [PrivacyTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  194. // make.left.mas_equalTo(10);
  195. // make.top.mas_equalTo(15);
  196. // make.width.mas_equalTo(150);
  197. // make.height.mas_equalTo(20);
  198. // }];
  199. //
  200. // UIButton *setPrivacyBut = [[UIButton alloc] init];
  201. //
  202. // // gradient
  203. // CAGradientLayer *gl = [CAGradientLayer layer];
  204. // gl.frame = CGRectMake(0,0,80.f,32.f);
  205. // gl.startPoint = CGPointMake(0, 0.5);
  206. // gl.endPoint = CGPointMake(1, 0.5);
  207. // gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor];
  208. // gl.locations = @[@(0), @(1.0f)];
  209. //
  210. // [setPrivacyBut.layer addSublayer:gl];
  211. //
  212. // setPrivacyBut.tag = 4;
  213. // [setPrivacyBut addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
  214. // setPrivacyBut.layer.cornerRadius = 16.0;
  215. // setPrivacyBut.layer.masksToBounds = YES;
  216. // [setPrivacyBut setTitle:NSLocalizedString(@"set_Privacy_button_title",nil) forState:UIControlStateNormal];
  217. // setPrivacyBut.titleLabel.font = [UIFont systemFontOfSize:12.0];
  218. // [PrivacyBg addSubview:setPrivacyBut];
  219. //
  220. // [setPrivacyBut mas_makeConstraints:^(MASConstraintMaker *make) {
  221. // make.right.mas_equalTo(-10);
  222. // make.top.mas_equalTo(10);
  223. // make.width.mas_equalTo(80);
  224. // make.height.mas_equalTo(32);
  225. // }];
  226. //
  227. // UILabel *PrivacyTipLabel = [[UILabel alloc] init];
  228. // PrivacyTipLabel.text = NSLocalizedString(@"set_Privacy_Tip",nil) ;
  229. // PrivacyTipLabel.font = [UIFont systemFontOfSize:14.0];
  230. // PrivacyTipLabel.textColor = [UIColor hwColor:@"#01B7EA" alpha:1.0];
  231. // [PrivacyBg addSubview:PrivacyTipLabel];
  232. //
  233. // [PrivacyTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  234. // make.left.mas_equalTo(10);
  235. // make.top.mas_equalTo(PrivacyTitleLabel.mas_bottom).offset(10);
  236. // make.right.mas_equalTo(0);
  237. // make.height.mas_equalTo(20);
  238. // }];
  239. //
  240. // UILabel *PrivacyTipLabel2 = [[UILabel alloc] init];
  241. // PrivacyTipLabel2.text = NSLocalizedString(@"my_set_Privacy_Mode_tip1",nil) ;
  242. // //PrivacyTipLabel2.font = [UIFont systemFontOfSize:12.0];
  243. // PrivacyTipLabel2.textColor = [UIColor hwColor:@"#6A6A6A" alpha:1.0];
  244. // PrivacyTipLabel2.numberOfLines = 0;
  245. // [PrivacyBg addSubview:PrivacyTipLabel2];
  246. // PrivacyTipLabel2.adjustsFontSizeToFitWidth = YES;
  247. //
  248. // //PrivacyTipLabel2.backgroundColor = [UIColor redColor];
  249. // //CGFloat PrivacyTipLabel2height = PrivacyBgH *(0.5);
  250. //
  251. // [PrivacyTipLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
  252. // make.left.mas_equalTo(10);
  253. // //make.top.mas_equalTo(PrivacyTipLabel.mas_bottom).offset(15);
  254. // make.right.mas_equalTo(-10);
  255. // make.height.mas_equalTo(30);
  256. // make.bottom.mas_equalTo(-10);
  257. // }];
  258. //
  259. //
  260. // //文件上传
  261. // UIView *fileUploadBgView = [[UIView alloc] init];
  262. // fileUploadBgView.backgroundColor = [UIColor whiteColor];
  263. // fileUploadBgView.layer.cornerRadius = 8;
  264. // [self addSubview:fileUploadBgView];
  265. //
  266. // [fileUploadBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  267. // make.left.mas_equalTo(10);
  268. // make.top.mas_equalTo(PrivacyBg.mas_bottom).offset(15);
  269. // make.right.mas_equalTo(-10);
  270. // make.height.mas_equalTo(110);
  271. // }];
  272. //
  273. // UILabel *titleLabel = [[UILabel alloc] init];
  274. // titleLabel.text = NSLocalizedString(@"my_set_no_File_upload_title",nil) ;
  275. // titleLabel.font = [UIFont boldSystemFontOfSize:16.0];
  276. // titleLabel.textColor = [UIColor blackColor];
  277. // [fileUploadBgView addSubview:titleLabel];
  278. //
  279. // [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  280. // make.left.mas_equalTo(10);
  281. // make.top.mas_equalTo(10);
  282. // make.width.mas_equalTo(140);
  283. // make.height.mas_equalTo(20);
  284. // }];
  285. //
  286. // //上传记录
  287. // UIImageView *arrowImageView = [[UIImageView alloc] init];
  288. // arrowImageView.image = [UIImage imageNamed:@"cell_right_access"];
  289. // [fileUploadBgView addSubview:arrowImageView];
  290. //
  291. // [arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  292. // make.right.mas_equalTo(-10);
  293. // make.top.mas_equalTo(10);
  294. // make.width.mas_equalTo(20);
  295. // make.height.mas_equalTo(20);
  296. // }];
  297. //
  298. // UILabel *rightLabel = [[UILabel alloc] init];
  299. // rightLabel.text = NSLocalizedString(@"set_upload_download_tip",nil) ;
  300. // rightLabel.font = [UIFont systemFontOfSize:14.0];
  301. // rightLabel.textColor = [UIColor hwColor:@"#959799" alpha:1.0];
  302. // rightLabel.textAlignment = NSTextAlignmentRight;
  303. // [fileUploadBgView addSubview:rightLabel];
  304. //
  305. // [rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  306. // make.right.mas_equalTo(arrowImageView.mas_left).offset(-2);
  307. // make.top.mas_equalTo(10);
  308. // make.width.mas_equalTo(200);
  309. // make.height.mas_equalTo(20);
  310. // }];
  311. //
  312. // UIButton *recordBut = [[UIButton alloc] init];
  313. // //recordBut.backgroundColor = [UIColor greenColor];
  314. // recordBut.tag = 1;
  315. // [recordBut addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
  316. // [fileUploadBgView addSubview:recordBut];
  317. //
  318. // [recordBut mas_makeConstraints:^(MASConstraintMaker *make) {
  319. // make.right.mas_equalTo(0);
  320. // make.top.mas_equalTo(0);
  321. // make.width.mas_equalTo(150);
  322. // make.height.mas_equalTo(40);
  323. // }];
  324. //
  325. //// arrowImageView.hidden = YES;
  326. //// rightLabel.hidden = YES;
  327. //// recordBut.hidden = YES;
  328. //
  329. // //图片上传
  330. // NSString* curImgUploadStr = [[NSString alloc] initWithFormat:@"%@ %@",@" ",NSLocalizedString(@"my_set_no_image_upload",nil)];
  331. // UIButton *imageUploadBut = [[UIButton alloc] init];
  332. // [imageUploadBut setImage:[UIImage imageNamed:@"icon_image_upload"] forState:UIControlStateNormal];
  333. // [imageUploadBut setTitle:curImgUploadStr forState:UIControlStateNormal];
  334. // imageUploadBut.backgroundColor = [UIColor hwColor:@"#00D1C1" alpha:0.1];
  335. // imageUploadBut.layer.cornerRadius = 4;
  336. // [imageUploadBut setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  337. // imageUploadBut.titleLabel.font = [UIFont systemFontOfSize:13.0];
  338. // imageUploadBut.tag = 2;
  339. // [imageUploadBut addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
  340. // [fileUploadBgView addSubview:imageUploadBut];
  341. //
  342. // [imageUploadBut mas_makeConstraints:^(MASConstraintMaker *make) {
  343. // make.left.mas_equalTo(10);
  344. // make.right.mas_equalTo(self.mas_centerX).offset(-10);
  345. // make.bottom.mas_equalTo(-10);
  346. // make.height.mas_equalTo(48);
  347. // }];
  348. //
  349. // //视频上传
  350. // NSString* curVidelUploadStr = [[NSString alloc] initWithFormat:@"%@ %@",@" ",NSLocalizedString(@"my_set_no_video_upload",nil)];
  351. // UIButton *videoUploadBut = [[UIButton alloc] init];
  352. // [videoUploadBut setImage:[UIImage imageNamed:@"icon_video_upload"] forState:UIControlStateNormal];
  353. // [videoUploadBut setTitle:curVidelUploadStr forState:UIControlStateNormal];
  354. // videoUploadBut.backgroundColor = [UIColor hwColor:@"#00D8FF" alpha:0.1];
  355. // videoUploadBut.layer.cornerRadius = 4;
  356. // [videoUploadBut setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  357. // videoUploadBut.titleLabel.font = [UIFont systemFontOfSize:13.0];
  358. // videoUploadBut.tag = 3;
  359. // [videoUploadBut addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
  360. // [fileUploadBgView addSubview:videoUploadBut];
  361. //
  362. // [videoUploadBut mas_makeConstraints:^(MASConstraintMaker *make) {
  363. // make.right.mas_equalTo(-10);
  364. // make.left.mas_equalTo(self.mas_centerX).offset(10);
  365. // make.bottom.mas_equalTo(-10);
  366. // make.height.mas_equalTo(48);
  367. // }];
  368. //
  369. //
  370. // //文件备份
  371. // UIView *fileBackupsBgView = [[UIView alloc] init];
  372. // fileBackupsBgView.backgroundColor = [UIColor whiteColor];
  373. // fileBackupsBgView.layer.cornerRadius = 8;
  374. // [self addSubview:fileBackupsBgView];
  375. //
  376. // [fileBackupsBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  377. // make.left.mas_equalTo(10);
  378. // make.top.mas_equalTo(fileUploadBgView.mas_bottom).offset(15);
  379. // make.right.mas_equalTo(-10);
  380. // make.height.mas_equalTo(110);
  381. // }];
  382. //
  383. // UILabel *BackupsTitleLabel = [[UILabel alloc] init];
  384. // BackupsTitleLabel.text = NSLocalizedString(@"set_Privacy_title",nil) ;
  385. // BackupsTitleLabel.font = [UIFont boldSystemFontOfSize:16.0];
  386. // BackupsTitleLabel.textColor = [UIColor blackColor];
  387. // [fileBackupsBgView addSubview:BackupsTitleLabel];
  388. //
  389. // [BackupsTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  390. // make.left.mas_equalTo(10);
  391. // make.top.mas_equalTo(10);
  392. // make.width.mas_equalTo(180);
  393. // make.height.mas_equalTo(20);
  394. // }];
  395. //
  396. // //
  397. // UIImageView *arrowImageView2 = [[UIImageView alloc] init];
  398. // arrowImageView2.image = [UIImage imageNamed:@"cell_right_access"];
  399. // [fileBackupsBgView addSubview:arrowImageView2];
  400. //
  401. // [arrowImageView2 mas_makeConstraints:^(MASConstraintMaker *make) {
  402. // make.right.mas_equalTo(-10);
  403. // make.top.mas_equalTo(10);
  404. // make.width.mas_equalTo(20);
  405. // make.height.mas_equalTo(20);
  406. // }];
  407. //
  408. // NSString *BackupsRightTitle = NSLocalizedString(@"set_Privacy_right_tip",nil);
  409. // CGFloat BackupsRightW = [BackupsRightTitle boundingRectWithSize:CGSizeMake(200, 20) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14.0]} context:nil].size.width;
  410. // BackupsRightW += 5;
  411. //
  412. // UILabel *BackupsRightLabel = [[UILabel alloc] init];
  413. // BackupsRightLabel.text = BackupsRightTitle;
  414. // BackupsRightLabel.font = [UIFont systemFontOfSize:14.0];
  415. // BackupsRightLabel.textColor = [UIColor hwColor:@"#959799" alpha:1.0];
  416. // BackupsRightLabel.textAlignment = NSTextAlignmentRight;
  417. // [fileBackupsBgView addSubview:BackupsRightLabel];
  418. //
  419. // [BackupsRightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  420. // make.right.mas_equalTo(arrowImageView.mas_left).offset(-2);
  421. // make.top.mas_equalTo(10);
  422. // make.width.mas_equalTo(BackupsRightW);
  423. // make.height.mas_equalTo(20);
  424. // }];
  425. //
  426. // UIButton *BackupsSetBut = [[UIButton alloc] init];
  427. // //BackupsSetBut.backgroundColor = [UIColor greenColor];
  428. // BackupsSetBut.tag = 5;
  429. // [BackupsSetBut addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
  430. // [fileBackupsBgView addSubview:BackupsSetBut];
  431. //
  432. // [BackupsSetBut mas_makeConstraints:^(MASConstraintMaker *make) {
  433. // make.right.mas_equalTo(0);
  434. // make.top.mas_equalTo(0);
  435. // make.left.mas_equalTo(BackupsRightLabel.mas_left);
  436. // make.height.mas_equalTo(40);
  437. // }];
  438. //
  439. //// arrowImageView2.hidden = YES;
  440. //// BackupsRightLabel.hidden = YES;
  441. //// BackupsSetBut.hidden = YES;
  442. //
  443. // UIButton *BackupsEyeBut = [[UIButton alloc] init];
  444. // //BackupsEyeBut.backgroundColor = [UIColor greenColor];
  445. // [BackupsEyeBut setImage:[UIImage imageNamed:@"common_eye_open"] forState:UIControlStateNormal];
  446. // [BackupsEyeBut setImage:[UIImage imageNamed:@"common_eye_close"] forState:UIControlStateSelected];
  447. // BackupsEyeBut.tag = 6;
  448. // [BackupsEyeBut addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
  449. // [fileBackupsBgView addSubview:BackupsEyeBut];
  450. //
  451. // [BackupsEyeBut mas_makeConstraints:^(MASConstraintMaker *make) {
  452. // make.right.mas_equalTo(BackupsSetBut.mas_left).offset(0);
  453. // make.centerY.mas_equalTo(BackupsRightLabel.mas_centerY);
  454. // make.width.mas_equalTo(40);
  455. // make.height.mas_equalTo(40);
  456. // }];
  457. //
  458. // BackupsEyeBut.hidden = YES;
  459. //
  460. // imageBackupsBgView = [[UIView alloc] init];
  461. // imageBackupsBgView.backgroundColor = [UIColor hwColor:@"#F9F9F9" alpha:1.0];
  462. // imageBackupsBgView.layer.cornerRadius = 8;
  463. // [fileBackupsBgView addSubview:imageBackupsBgView];
  464. //
  465. // [imageBackupsBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  466. // make.right.mas_equalTo(-10);
  467. // make.left.mas_equalTo(10);
  468. // make.bottom.mas_equalTo(-10);
  469. // make.height.mas_equalTo(56);
  470. // }];
  471. //
  472. // UIImageView *backupsImageV = [[UIImageView alloc] init];
  473. // backupsImageV.image = [UIImage imageNamed:@"image_backups_icon"];
  474. // [imageBackupsBgView addSubview:backupsImageV];
  475. //
  476. // [backupsImageV mas_makeConstraints:^(MASConstraintMaker *make) {
  477. // make.centerY.mas_equalTo(0);
  478. // make.left.mas_equalTo(10);
  479. // make.width.mas_equalTo(28);
  480. // make.height.mas_equalTo(28);
  481. // }];
  482. //
  483. // UILabel *imageBackupsTitleLabel = [[UILabel alloc] init];
  484. // imageBackupsTitleLabel.text = NSLocalizedString(@"set_Privacy_title_image",nil) ;
  485. // imageBackupsTitleLabel.font = [UIFont systemFontOfSize:14.0];
  486. // imageBackupsTitleLabel.textColor = [UIColor blackColor];
  487. // [imageBackupsBgView addSubview:imageBackupsTitleLabel];
  488. //
  489. // [imageBackupsTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  490. // make.centerY.mas_equalTo(-10);
  491. // make.left.mas_equalTo(backupsImageV.mas_right).offset(10);
  492. // make.right.mas_equalTo(-(10+60+10));
  493. // make.height.mas_equalTo(20);
  494. // }];
  495. //
  496. // _imageBackupsLabel = [[UILabel alloc] init];
  497. // //_imageBackupsLabel.text = NSLocalizedString(@"set_Privacy_title_image_open",nil) ;
  498. // _imageBackupsLabel.font = [UIFont systemFontOfSize:12.0];
  499. // _imageBackupsLabel.textColor = [UIColor hwColor:@"#6A6A6A" alpha:1.0];
  500. // [imageBackupsBgView addSubview:_imageBackupsLabel];
  501. //
  502. // [_imageBackupsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  503. // make.centerY.mas_equalTo(10);
  504. // make.left.mas_equalTo(backupsImageV.mas_right).offset(10);
  505. // make.right.mas_equalTo(-(10+60+10));
  506. // make.height.mas_equalTo(20);
  507. // }];
  508. //
  509. // _imageBackupsButton = [[UIButton alloc] init];
  510. // _imageBackupsButton.backgroundColor = [UIColor hwColor:@"#DCF4FB" alpha:1.0];
  511. // _imageBackupsButton.tag = 7;
  512. // [_imageBackupsButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
  513. // _imageBackupsButton.layer.cornerRadius = 12.0;
  514. // _imageBackupsButton.layer.masksToBounds = YES;
  515. // [_imageBackupsButton setTitle:NSLocalizedString(@"common_open",nil) forState:UIControlStateNormal];
  516. // [_imageBackupsButton setTitle:NSLocalizedString(@"common_close",nil) forState:UIControlStateSelected];
  517. // [_imageBackupsButton setTitleColor:[UIColor hwColor:@"#01B7EA" alpha:1.0] forState:UIControlStateNormal];
  518. // _imageBackupsButton.titleLabel.font = [UIFont systemFontOfSize:12.0];
  519. // [imageBackupsBgView addSubview:_imageBackupsButton];
  520. //
  521. // [_imageBackupsButton mas_makeConstraints:^(MASConstraintMaker *make) {
  522. // make.right.mas_equalTo(-10);
  523. // make.centerY.mas_equalTo(0);
  524. // make.width.mas_equalTo(60);
  525. // make.height.mas_equalTo(24);
  526. // }];
  527. //
  528. //
  529. // //其他功能
  530. // UIView *otherBgView = [[UIView alloc] init];
  531. // otherBgView.backgroundColor = [UIColor whiteColor];
  532. // otherBgView.layer.cornerRadius = 8;
  533. // [self addSubview:otherBgView];
  534. //
  535. // [otherBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  536. // make.left.mas_equalTo(10);
  537. // make.top.mas_equalTo(fileBackupsBgView.mas_bottom).offset(15);
  538. // make.right.mas_equalTo(-10);
  539. // make.height.mas_equalTo(135 + 88);
  540. // }];
  541. //
  542. // UILabel *otherTitleLabel = [[UILabel alloc] init];
  543. // otherTitleLabel.text = NSLocalizedString(@"set_other_title",nil) ;
  544. // otherTitleLabel.font = [UIFont boldSystemFontOfSize:16.0];
  545. // otherTitleLabel.textColor = [UIColor blackColor];
  546. // [otherBgView addSubview:otherTitleLabel];
  547. //
  548. // [otherTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  549. // make.left.mas_equalTo(10);
  550. // make.top.mas_equalTo(10);
  551. // make.width.mas_equalTo(150);
  552. // make.height.mas_equalTo(20);
  553. // }];
  554. //
  555. //
  556. // NSArray *titleArr = @[NSLocalizedString(@"my_set_no_change_phone",nil),
  557. // NSLocalizedString(@"my_set_no_restart_phone",nil),
  558. // NSLocalizedString(@"my_set_no_Restore_Factory",nil),
  559. // NSLocalizedString(@"my_set_no_common_problem",nil),
  560. // NSLocalizedString(@"my_set_no_check_update",nil),
  561. // NSLocalizedString(@"my_set_no_clear_cache",nil)];
  562. //
  563. // NSArray *imageArr = @[@"icon_change_ohone",@"icon-gengxin",
  564. // @"icon_Restore_Factory",@"icon_common_problem",
  565. // @"app_update",@"app_clear_cache"];
  566. //
  567. // //CGFloat butWidth = (SCREEN_W -20)/titleArr.count;
  568. // CGFloat butWidth = (SCREEN_W -20)/5;
  569. // CGFloat butHeight = 88.0;
  570. //
  571. // for (int i=0; i<titleArr.count; i++) {
  572. //
  573. // UIButton *curButton = [UIButton buttonWithType:UIButtonTypeCustom];
  574. // curButton.tag = 10 + i;
  575. //
  576. // [curButton setImage:[UIImage imageNamed:imageArr[i]] forState:UIControlStateNormal];
  577. // [curButton setTitle:titleArr[i] forState:UIControlStateNormal];
  578. // [curButton setTitleColor:[UIColor hwColor:@"#0A132B" alpha:1.0] forState:UIControlStateNormal];
  579. // curButton.titleLabel.font = [UIFont systemFontOfSize:12.0];
  580. //
  581. // [curButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
  582. // [otherBgView addSubview:curButton];
  583. // //curButton.backgroundColor = [UIColor redColor];
  584. //
  585. // [curButton mas_makeConstraints:^(MASConstraintMaker *make) {
  586. // make.left.mas_equalTo(butWidth*(i%5));
  587. // make.top.mas_equalTo(otherTitleLabel.mas_bottom).offset((i/5) * (butHeight));
  588. // make.width.mas_equalTo(butWidth);
  589. // make.height.mas_equalTo(butHeight);
  590. // }];
  591. //
  592. // CGFloat titleOffset = 0.0;
  593. //
  594. // [curButton setTitleEdgeInsets:UIEdgeInsetsMake(curButton.imageView.frame.size.height+5,-curButton.imageView.frame.size.width, 0.0,0.0)];
  595. // [curButton setImageEdgeInsets:UIEdgeInsetsMake(-curButton.bounds.size.width/4+5, curButton.bounds.size.width/4-titleOffset, curButton.titleLabel.bounds.size.height, -curButton.bounds.size.width/4)];
  596. //
  597. //
  598. //// UILabel *curlab = [[UILabel alloc] init];
  599. //// curlab.text = titleArr[i];
  600. //// curlab.font = [UIFont systemFontOfSize:12.0];
  601. //// curlab.textColor = [UIColor hwColor:@"#0A132B" alpha:1.0];
  602. //// curlab.numberOfLines = 0;
  603. //// curlab.textAlignment = NSTextAlignmentCenter;
  604. //// [otherBgView addSubview:curlab];
  605. ////
  606. //// [curlab mas_makeConstraints:^(MASConstraintMaker *make) {
  607. //// make.left.mas_equalTo(butWidth);//* (i%5)
  608. //// make.bottom.mas_equalTo(-10);
  609. //// make.width.mas_equalTo(butWidth);
  610. //// make.height.mas_equalTo(30); //+ (i/5) * (butHeight + 12.0)
  611. //// }];
  612. //// curButton.backgroundColor = [UIColor greenColor];
  613. //
  614. //// UIButton *curImageV = [[UIButton alloc] init];
  615. //// curImageV.userInteractionEnabled = NO;
  616. //// [curImageV setImage:[UIImage imageNamed:imageArr[i]] forState:UIControlStateNormal];;
  617. //// [otherBgView addSubview:curImageV];
  618. ////
  619. //// [curImageV mas_makeConstraints:^(MASConstraintMaker *make) {
  620. //// make.left.mas_equalTo(butWidth*i);
  621. //// make.bottom.mas_equalTo(curlab.mas_top);
  622. //// make.width.mas_equalTo(butWidth);
  623. //// make.height.mas_equalTo(40);
  624. //// }];
  625. ////
  626. //// curImageV.backgroundColor = [UIColor orangeColor];
  627. //
  628. //
  629. // }
  630. //}
  631. - (void)closeImageBackupsFun
  632. {
  633. [HWDataManager setBoolWithKey:stringKeyAddSn(Const_photo_backups_state) value:NO];
  634. [self setBackupsStateFun];
  635. //处理相册备份
  636. [[backupsFileManager shareInstance] suspendBackupsFileFun];
  637. }
  638. - (void)openImageBackupsFun
  639. {
  640. BOOL isCanUseCellular = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_canUse_Cellular_all)];
  641. if(!isCanUseCellular){//不允许流量上传
  642. //
  643. if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWWAN){
  644. mainBlock(^{
  645. [[iToast makeText:NSLocalizedString(@"File_Transfer_By_Cellular_tip",nil)] show];
  646. });
  647. return;
  648. }
  649. }
  650. [self showBackupsReadTipFun];
  651. [HWDataManager setBoolWithKey:stringKeyAddSn(Const_photo_backups_state) value:YES];
  652. [self setBackupsStateFun];
  653. [[iToast makeText:NSLocalizedString(@"set_Privacy_title_image_open",nil)] show];
  654. //处理相册备份
  655. [[backupsFileManager shareInstance] handlePhotosBackupsFun];
  656. }
  657. - (void)showBackupsReadTipFun
  658. {
  659. BOOL didReadbackupsTipType = [HWDataManager getBoolWithKey:Const_file_backups_need_read];
  660. if(didReadbackupsTipType){//阅读过
  661. return;
  662. }
  663. //KWeakSelf
  664. /*弹窗提示恢复出厂*/
  665. ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:nil
  666. msg:NSLocalizedString(@"backups_need_read_msg",nil)
  667. imageStr:nil
  668. cancelTitle:NSLocalizedString(@"guide_set_pwd_guide_know",nil)
  669. okTitle:nil
  670. isOkBtnHighlight:NO
  671. didClickOk:^{
  672. } didClickCancel:^{
  673. [HWDataManager setBoolWithKey:Const_file_backups_need_read value:YES];
  674. }];
  675. nextVC.modalPresentationStyle = UIModalPresentationCustom;
  676. [[iTools appRootViewController] presentViewController:nextVC animated:YES completion:^{
  677. nextVC.view.superview.backgroundColor = [UIColor clearColor];
  678. }];
  679. }
  680. - (void)setBackupsStateFun
  681. {
  682. BOOL haveOpenBackups = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_photo_backups_state)];
  683. _imageBackupsButton.selected = haveOpenBackups;
  684. if(haveOpenBackups){
  685. _imageBackupsLabel.text = NSLocalizedString(@"set_Privacy_title_image_open",nil) ;
  686. }
  687. else
  688. {
  689. _imageBackupsLabel.text = NSLocalizedString(@"set_Privacy_title_image_close",nil) ;
  690. }
  691. }
  692. #pragma mark 按钮点击事件
  693. - (void)didClickButFun:(UIButton*)but
  694. {
  695. NSInteger tag = but.tag;
  696. //HLog(@"xxxx:%ld",tag)
  697. if(tag == 7){
  698. BOOL haveOpenBackups = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_photo_backups_state)];
  699. if(!haveOpenBackups){
  700. if(ksharedAppDelegate.DisabledFileTransferType){
  701. if(ksharedAppDelegate.isImageNewFor130){
  702. [[iToast makeText:NSLocalizedString(@"File_Transfer_Disable_tip",nil)] show];
  703. }
  704. else{
  705. [[iToast makeText:NSLocalizedString(@"File_Transfer_Disable_tip2",nil)] show];
  706. }
  707. return;
  708. }
  709. if(!ksharedAppDelegate.isWebSockLinkOKAginType){
  710. [[iToast makeText:NSLocalizedString(@"check_could_phone_state",nil)] show];
  711. return;
  712. }
  713. //相册权限
  714. if (![[TZImageManager manager] authorizationStatusAuthorized]){
  715. [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
  716. if(status == PHAuthorizationStatusAuthorized){
  717. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  718. [self openImageBackupsFun];
  719. });
  720. }
  721. }];
  722. }
  723. else{
  724. [self openImageBackupsFun];
  725. }
  726. return;
  727. }
  728. }
  729. if(_didClickBut){
  730. _didClickBut(tag);
  731. }
  732. }
  733. @end