|
@@ -9,10 +9,14 @@
|
|
|
#import "fileTransferPathCheckTableViewCell.h"
|
|
|
#import "filePathCreatPopView.h"
|
|
|
#import "IQKeyboardManager.h"
|
|
|
+#import "couldPhoneFolderListModel.h"
|
|
|
|
|
|
@interface fileTransferPathCheckViewController ()<UITableViewDelegate,UITableViewDataSource>
|
|
|
@property (nonatomic, strong) UITableView *tableView;
|
|
|
+@property (nonatomic, strong) NSMutableArray * folderListArr;
|
|
|
+@property (nonatomic,assign) NSInteger selectIndex;
|
|
|
|
|
|
+@property(nonatomic,copy)NSString* createFolderNameStr;
|
|
|
@end
|
|
|
|
|
|
@implementation fileTransferPathCheckViewController
|
|
@@ -26,10 +30,22 @@
|
|
|
//[self.titleLabel setText:NSLocalizedString(@"File_upload_path_check",nil)];
|
|
|
[self.view setBackgroundColor:HWF5F7FAColor];
|
|
|
|
|
|
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(createFolderDoneNotFun:) name:createFolderBeginNotification object:nil];
|
|
|
+ _folderListArr = [NSMutableArray new];
|
|
|
+
|
|
|
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(createFolderDoneNotFun:) name:createFolderDoneNotification object:nil];
|
|
|
+
|
|
|
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getFolderListDoneNotFun:) name:getFolderListDoneNotification object:nil];
|
|
|
|
|
|
[self drawAnyView];
|
|
|
[self setupKeyboardManager];
|
|
|
+
|
|
|
+ [self getFolderListFun];
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+- (void)getFolderListFun
|
|
|
+{
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:getFolderListBeginNotification object:nil];
|
|
|
}
|
|
|
|
|
|
- (void)drawAnyView{
|
|
@@ -122,7 +138,7 @@
|
|
|
}
|
|
|
|
|
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
|
|
- return 2;
|
|
|
+ return _folderListArr.count;
|
|
|
}
|
|
|
|
|
|
- (fileTransferPathCheckTableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
|
@@ -146,12 +162,19 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
+ if(row < _folderListArr.count){
|
|
|
+ cell.titleLabel.text = _folderListArr[row];
|
|
|
+
|
|
|
+ if(row == _selectIndex){
|
|
|
+ cell.checkButton.selected = YES;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ cell.checkButton.selected = NO;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
if (row == 0){
|
|
|
- //[cell.titleLabel setText:NSLocalizedString(@"File_Transfer_set_Cellular",nil)];
|
|
|
- cell.titleLabel.text = @"云机名称/我的空间/来自[手机名称]的[XX]文件备份";
|
|
|
-
|
|
|
- cell.checkButton.selected = YES;
|
|
|
|
|
|
/*上圆角*/
|
|
|
//设置部分圆角 贝塞尔曲线
|
|
@@ -163,10 +186,12 @@
|
|
|
maskLayer.path = maskPath.CGPath;
|
|
|
cell.bgViewLayer = maskLayer;
|
|
|
cell.cellBgView.layer.mask = cell.bgViewLayer;
|
|
|
- }else if (row == 1){
|
|
|
+ }//else
|
|
|
+
|
|
|
+ if (row == _folderListArr.count -1){
|
|
|
//[cell.titleLabel setText:NSLocalizedString(@"File_Transfer_set_battery_level",nil)];
|
|
|
|
|
|
- cell.titleLabel.text = @"云机名称/我的空间/XYJ";
|
|
|
+ //cell.titleLabel.text = @"云机名称/我的空间/XYJ";
|
|
|
|
|
|
/*下圆角*/
|
|
|
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-30 , 90)
|
|
@@ -183,7 +208,7 @@
|
|
|
|
|
|
KWeakSelf
|
|
|
cell.didClickSwitch = ^(BOOL SwitchOn) {
|
|
|
-
|
|
|
+ [weakSelf userCheckFolderPathByRow:row];
|
|
|
};
|
|
|
|
|
|
return cell;
|
|
@@ -208,9 +233,26 @@
|
|
|
};
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+#pragma mark 用户选择默认上次文件夹
|
|
|
+- (void)userCheckFolderPathByRow:(NSInteger)row
|
|
|
+{
|
|
|
+ _selectIndex = row;
|
|
|
+ NSString *cutPath = _folderListArr[row];
|
|
|
+ [HWDataManager setStringWithKey:Const_photo_backups_default_path value:cutPath];
|
|
|
+ [self.tableView reloadData];
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
#pragma mark
|
|
|
- (void)didGetFolderName:(NSString*)folderName
|
|
|
{
|
|
|
+ _createFolderNameStr = folderName;
|
|
|
+
|
|
|
+ NSString *curbackupsDefaultPath = [[NSString alloc] initWithFormat:@"sdcard/%@",_createFolderNameStr];
|
|
|
+
|
|
|
+ [HWDataManager setStringWithKey:Const_photo_backups_default_path value:curbackupsDefaultPath];
|
|
|
+
|
|
|
[[NSNotificationCenter defaultCenter] postNotificationName:createFolderBeginNotification object:folderName];/*发送通知*/
|
|
|
}
|
|
|
|
|
@@ -226,5 +268,42 @@
|
|
|
|
|
|
[[iToast makeText:tipStr] show];
|
|
|
|
|
|
+ [self getFolderListFun];
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+- (void)getFolderListDoneNotFun:(NSNotification *)notification
|
|
|
+{
|
|
|
+ NSDictionary *dataDict = [notification object];
|
|
|
+
|
|
|
+ couldPhoneFolderListModel *model = [[couldPhoneFolderListModel alloc] initWithDictionary:dataDict error:nil];
|
|
|
+
|
|
|
+ if(model){
|
|
|
+ [_folderListArr removeAllObjects];
|
|
|
+
|
|
|
+ [_folderListArr addObjectsFromArray:model.data];
|
|
|
+
|
|
|
+ NSString * backupsDefaultPath = [HWDataManager getStringWithKey:Const_photo_backups_default_path];
|
|
|
+
|
|
|
+ BOOL needAddHadDefaultPath = YES;
|
|
|
+
|
|
|
+ for (int i=0; i<_folderListArr.count; i++) {
|
|
|
+ NSString * curPathStr = _folderListArr[i];
|
|
|
+ if([curPathStr isEqualToString:backupsDefaultPath]){
|
|
|
+ needAddHadDefaultPath = NO;
|
|
|
+ _selectIndex = i;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(needAddHadDefaultPath){
|
|
|
+ [_folderListArr insertObject:backupsDefaultPath atIndex:0];
|
|
|
+ _selectIndex = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ [self.tableView reloadData];
|
|
|
}
|
|
|
@end
|