|
|
@@ -0,0 +1,252 @@
|
|
|
+//
|
|
|
+// fileTransfeSetViewController.m
|
|
|
+// 隐私保护
|
|
|
+//
|
|
|
+// Created by xd h on 2023/12/28.
|
|
|
+//
|
|
|
+
|
|
|
+#import "fileTransfeSetViewController.h"
|
|
|
+#import "fileSetTableViewCell.h"
|
|
|
+
|
|
|
+@interface fileTransfeSetViewController ()<UITableViewDelegate,UITableViewDataSource>
|
|
|
+@property (nonatomic, strong) UITableView *tableView;
|
|
|
+@property (nonatomic, strong) UIView *tailView;
|
|
|
+@property (nonatomic, strong) UILabel *uploadFilePathLabel;
|
|
|
+@end
|
|
|
+
|
|
|
+@implementation fileTransfeSetViewController
|
|
|
+
|
|
|
+- (void)viewDidLoad {
|
|
|
+ [super viewDidLoad];
|
|
|
+ // Do any additional setup after loading the view.
|
|
|
+
|
|
|
+ [self.toolBar setHidden:YES];
|
|
|
+ [self.navigationBar setHidden:YES];
|
|
|
+ [self.navBarBGView setHidden:NO];
|
|
|
+ [self.titleLabel setText:NSLocalizedString(@"set_upload_download_tip",nil)];
|
|
|
+ [self.view setBackgroundColor:HWF5F7FAColor];
|
|
|
+
|
|
|
+ [self drawAnyView];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)drawAnyView{
|
|
|
+
|
|
|
+ [self.view addSubview:self.tableView];
|
|
|
+ [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(0);
|
|
|
+ make.right.mas_equalTo(0);
|
|
|
+ make.bottom.mas_equalTo(0);
|
|
|
+ make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
|
|
|
+ }];
|
|
|
+
|
|
|
+ self.tableView.tableFooterView = [self tailView];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - 懒加载
|
|
|
+- (UITableView *)tableView{
|
|
|
+ if (!_tableView) {
|
|
|
+ _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H - TABBARHEIGHT) style:UITableViewStylePlain];
|
|
|
+ _tableView.delegate = self;
|
|
|
+ _tableView.dataSource = self;
|
|
|
+ _tableView.showsVerticalScrollIndicator = NO;
|
|
|
+ _tableView.showsHorizontalScrollIndicator = NO;
|
|
|
+// _tableView.contentInset = UIEdgeInsetsMake(-H_STATE_BAR, 0, 0, 0);
|
|
|
+ [_tableView setSeparatorStyle:(UITableViewCellSeparatorStyleNone)];
|
|
|
+ [_tableView setSeparatorColor:[UIColor clearColor]];
|
|
|
+ [_tableView setBackgroundColor:[UIColor clearColor]];
|
|
|
+ [_tableView setTableFooterView:[UIView new]];
|
|
|
+ [_tableView setBounces:YES];
|
|
|
+
|
|
|
+ _tableView.scrollEnabled = NO;
|
|
|
+
|
|
|
+ if (@available(iOS 15.0, *)) {
|
|
|
+ _tableView.sectionHeaderTopPadding = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return _tableView;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+#pragma mark - 懒加载
|
|
|
+- (UIView *)tailView{
|
|
|
+ if (!_tailView) {
|
|
|
+ _tailView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, 110 +15)];
|
|
|
+
|
|
|
+ UIView *tailBgView = [[UIView alloc] init];
|
|
|
+ tailBgView.backgroundColor = [UIColor whiteColor];
|
|
|
+ tailBgView.layer.cornerRadius = 8;
|
|
|
+ [_tailView addSubview:tailBgView];
|
|
|
+
|
|
|
+ UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didClickTailViewFun)];
|
|
|
+ [tailBgView addGestureRecognizer:tap];
|
|
|
+
|
|
|
+ [tailBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(15);
|
|
|
+ make.right.mas_equalTo(-15);
|
|
|
+ make.bottom.mas_equalTo(0);
|
|
|
+ make.top.mas_equalTo(15);
|
|
|
+ }];
|
|
|
+
|
|
|
+ UILabel *titleLab = [[UILabel alloc] init];
|
|
|
+ titleLab.text = NSLocalizedString(@"File_upload_path_set",nil);
|
|
|
+ titleLab.font = [UIFont boldSystemFontOfSize:14.0];
|
|
|
+ titleLab.textColor = [UIColor hwColor:@"#0A132B" alpha:1.0];
|
|
|
+ [tailBgView addSubview:titleLab];
|
|
|
+
|
|
|
+ [titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(10);
|
|
|
+ make.right.mas_equalTo(-50);
|
|
|
+ make.height.mas_equalTo(20);
|
|
|
+ make.top.mas_equalTo(20);
|
|
|
+ }];
|
|
|
+
|
|
|
+ /*右侧箭头*/
|
|
|
+ UIImageView *rightImage = [[UIImageView alloc] init];
|
|
|
+ [rightImage setBackgroundColor:[UIColor clearColor]];
|
|
|
+ [rightImage setImage:[UIImage imageNamed:@"cell_right_access"]];
|
|
|
+ [tailBgView addSubview:rightImage];
|
|
|
+ [rightImage mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.width.mas_equalTo(28);
|
|
|
+ make.right.mas_equalTo(-15.f);
|
|
|
+ make.height.mas_equalTo(28);
|
|
|
+ make.centerY.equalTo(titleLab.mas_centerY);
|
|
|
+ }];
|
|
|
+
|
|
|
+ _uploadFilePathLabel=[[UILabel alloc] init];
|
|
|
+ //titleLab.text = NSLocalizedString(@"File_upload_path_set",nil);
|
|
|
+ _uploadFilePathLabel.font = [UIFont systemFontOfSize:12.0];
|
|
|
+ _uploadFilePathLabel.textColor = [UIColor hwColor:@"#6A6A6A" alpha:1.0];
|
|
|
+ _uploadFilePathLabel.numberOfLines = 0;
|
|
|
+ [tailBgView addSubview:_uploadFilePathLabel];
|
|
|
+
|
|
|
+ [_uploadFilePathLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(10);
|
|
|
+ make.right.mas_equalTo(-15);
|
|
|
+ make.bottom.mas_equalTo(-20);
|
|
|
+ make.top.mas_equalTo(titleLab.mas_bottom).offset(10.0);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [self setUploadFilePathLabelTitleFun];
|
|
|
+ }
|
|
|
+
|
|
|
+ return _tailView;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)setUploadFilePathLabelTitleFun
|
|
|
+{
|
|
|
+ NSString * leftStr = NSLocalizedString(@"File_upload_path_way",nil);
|
|
|
+ NSString * rightStr = @"我的空间/来自【手机设备名称】的相册备份";
|
|
|
+
|
|
|
+ NSString *totalStr = [[NSString alloc] initWithFormat:@"%@%@",leftStr,rightStr];
|
|
|
+
|
|
|
+ NSMutableAttributedString *noteStr = [[NSMutableAttributedString alloc] initWithString:totalStr];
|
|
|
+
|
|
|
+ NSRange redRange = NSMakeRange([totalStr rangeOfString:rightStr].location, [totalStr rangeOfString:rightStr].length);
|
|
|
+ [noteStr addAttribute:NSForegroundColorAttributeName value:[UIColor hwColor:@"#01B7EA" alpha:0.8] range:redRange];
|
|
|
+ [noteStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:12.0] range:redRange];
|
|
|
+ // 设置行间距
|
|
|
+ NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
|
|
|
+ [paragraphStyle setLineSpacing:5]; //设置行间距
|
|
|
+
|
|
|
+ [noteStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [totalStr length])];
|
|
|
+
|
|
|
+ _uploadFilePathLabel.attributedText = noteStr;
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 尾部事件
|
|
|
+- (void)didClickTailViewFun
|
|
|
+{
|
|
|
+ HLog(@"111");
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - 列表委托
|
|
|
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
|
|
+ return 1;
|
|
|
+}
|
|
|
+
|
|
|
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
|
|
+ return 2;
|
|
|
+}
|
|
|
+
|
|
|
+- (fileSetTableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
|
|
+
|
|
|
+ __block NSInteger row = indexPath.row;
|
|
|
+ static NSString *identifier = @"fileSetTableViewCell";
|
|
|
+
|
|
|
+ fileSetTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier];
|
|
|
+ cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
|
|
+ if (!cell){
|
|
|
+ cell = [[fileSetTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
|
|
|
+ [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
|
|
|
+ [cell setBackgroundColor:[UIColor clearColor]];
|
|
|
+ [cell setAccessoryType:(UITableViewCellAccessoryNone)];
|
|
|
+
|
|
|
+ [cell.bgViewLayer removeFromSuperlayer];
|
|
|
+ [cell.titleLabel2 setHidden:YES];
|
|
|
+ [cell.rightImage setHidden:YES];
|
|
|
+ [cell.lineView setHidden:NO];
|
|
|
+ [cell.maskSwitch setHidden:NO];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (row == 0){
|
|
|
+ [cell.titleLabel setText:NSLocalizedString(@"File_Transfer_set_Cellular",nil)];
|
|
|
+
|
|
|
+ BOOL haveOpenMask = [HWDataManager getBoolWithKey:Const_file_Transfe_canUse_Cellular];
|
|
|
+ [cell.maskSwitch setOn:haveOpenMask];
|
|
|
+
|
|
|
+ /*上圆角*/
|
|
|
+ //设置部分圆角 贝塞尔曲线
|
|
|
+ UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-30 , 60)
|
|
|
+ byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight
|
|
|
+ cornerRadii:CGSizeMake(8, 8)];
|
|
|
+ CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
|
|
|
+ maskLayer.frame = cell.cellBgView.bounds;
|
|
|
+ maskLayer.path = maskPath.CGPath;
|
|
|
+ cell.bgViewLayer = maskLayer;
|
|
|
+ cell.cellBgView.layer.mask = cell.bgViewLayer;
|
|
|
+ }else if (row == 1){
|
|
|
+ [cell.titleLabel setText:NSLocalizedString(@"File_Transfer_set_battery_level",nil)];
|
|
|
+
|
|
|
+ BOOL haveOpenMask = [HWDataManager getBoolWithKey:Const_file_Transfe_battery_level];
|
|
|
+ [cell.maskSwitch setOn:haveOpenMask];
|
|
|
+
|
|
|
+ /*下圆角*/
|
|
|
+ UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-30 , 60)
|
|
|
+ byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight
|
|
|
+ cornerRadii:CGSizeMake(8, 8)];
|
|
|
+ CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
|
|
|
+ maskLayer.frame = cell.cellBgView.bounds;
|
|
|
+ maskLayer.path = maskPath.CGPath;
|
|
|
+ cell.bgViewLayer = maskLayer;
|
|
|
+ cell.cellBgView.layer.mask = cell.bgViewLayer;
|
|
|
+
|
|
|
+ [cell.lineView setHidden:YES];
|
|
|
+ }
|
|
|
+
|
|
|
+ KWeakSelf
|
|
|
+ cell.didClickSwitch = ^(BOOL SwitchOn) {
|
|
|
+ [weakSelf didClickSwitchBy:SwitchOn withRow:row];
|
|
|
+ };
|
|
|
+
|
|
|
+ return cell;
|
|
|
+}
|
|
|
+
|
|
|
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
|
|
|
+ return 60;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)didClickSwitchBy:(BOOL)SwitchOn withRow:(NSInteger)row
|
|
|
+{
|
|
|
+ if(row == 0){
|
|
|
+ [HWDataManager setBoolWithKey:Const_file_Transfe_canUse_Cellular value:SwitchOn];
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ [HWDataManager setBoolWithKey:Const_file_Transfe_battery_level value:SwitchOn];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+@end
|