Преглед изворни кода

1.获取备份路径
2.页面交互

huangxiaodong пре 1 година
родитељ
комит
b771ea8ffa

+ 8 - 0
创维盒子/双子星云手机.xcodeproj/project.pbxproj

@@ -210,6 +210,8 @@
 		6B5B607B2B3E71B6009A2AE2 /* filePathCreatTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B5B60792B3E71B6009A2AE2 /* filePathCreatTableViewCell.m */; };
 		6B5D40152B47F27A000965CF /* couldPhoneCommonModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B5D40132B47F27A000965CF /* couldPhoneCommonModel.h */; };
 		6B5D40162B47F27A000965CF /* couldPhoneCommonModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B5D40142B47F27A000965CF /* couldPhoneCommonModel.m */; };
+		6B5D401A2B4A9850000965CF /* couldPhoneFolderListModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B5D40182B4A9850000965CF /* couldPhoneFolderListModel.h */; };
+		6B5D401B2B4A9850000965CF /* couldPhoneFolderListModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B5D40192B4A9850000965CF /* couldPhoneFolderListModel.m */; };
 		6B72724B2B0AF59200C03F87 /* uploadFileRecordTableViewHeadView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B7272492B0AF59200C03F87 /* uploadFileRecordTableViewHeadView.h */; };
 		6B72724C2B0AF59200C03F87 /* uploadFileRecordTableViewHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B72724A2B0AF59200C03F87 /* uploadFileRecordTableViewHeadView.m */; };
 		6B72724F2B0B58E500C03F87 /* uploadFileRecordEditBottomView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B72724D2B0B58E500C03F87 /* uploadFileRecordEditBottomView.h */; };
@@ -621,6 +623,8 @@
 		6B5B60792B3E71B6009A2AE2 /* filePathCreatTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = filePathCreatTableViewCell.m; sourceTree = "<group>"; };
 		6B5D40132B47F27A000965CF /* couldPhoneCommonModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = couldPhoneCommonModel.h; sourceTree = "<group>"; };
 		6B5D40142B47F27A000965CF /* couldPhoneCommonModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = couldPhoneCommonModel.m; sourceTree = "<group>"; };
+		6B5D40182B4A9850000965CF /* couldPhoneFolderListModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = couldPhoneFolderListModel.h; sourceTree = "<group>"; };
+		6B5D40192B4A9850000965CF /* couldPhoneFolderListModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = couldPhoneFolderListModel.m; sourceTree = "<group>"; };
 		6B7272492B0AF59200C03F87 /* uploadFileRecordTableViewHeadView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = uploadFileRecordTableViewHeadView.h; sourceTree = "<group>"; };
 		6B72724A2B0AF59200C03F87 /* uploadFileRecordTableViewHeadView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = uploadFileRecordTableViewHeadView.m; sourceTree = "<group>"; };
 		6B72724D2B0B58E500C03F87 /* uploadFileRecordEditBottomView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = uploadFileRecordEditBottomView.h; sourceTree = "<group>"; };
@@ -898,6 +902,8 @@
 				6BA533372B16E65500D1CB5C /* TvStatusModel.m */,
 				6B5D40132B47F27A000965CF /* couldPhoneCommonModel.h */,
 				6B5D40142B47F27A000965CF /* couldPhoneCommonModel.m */,
+				6B5D40182B4A9850000965CF /* couldPhoneFolderListModel.h */,
+				6B5D40192B4A9850000965CF /* couldPhoneFolderListModel.m */,
 			);
 			path = Model;
 			sourceTree = "<group>";
@@ -1890,6 +1896,7 @@
 				6B8FF6C12B05B24D00800981 /* uploadFileRecordCell.h in Headers */,
 				183AE6D42A8CAFAE00B11CB0 /* UIView+View.h in Headers */,
 				6B0581AF2AFCF57300D37290 /* AJPhotoGroupCell.h in Headers */,
+				6B5D401A2B4A9850000965CF /* couldPhoneFolderListModel.h in Headers */,
 				184C8ACC2A94557200F26650 /* HidenMaskSetViewController.h in Headers */,
 				18EC79DC2ABC109F0084836A /* SetPWDSecondViewController.h in Headers */,
 				6B0582852B0457C400D37290 /* uploadFileManager.h in Headers */,
@@ -2287,6 +2294,7 @@
 				183AE6532A8A2CF000B11CB0 /* AFImageDownloader.m in Sources */,
 				A003F6B327D841EE00715CBF /* UIColor+HZXColor.m in Sources */,
 				18E557222A3C5D75005CC84B /* CalculatorViewController.m in Sources */,
+				6B5D401B2B4A9850000965CF /* couldPhoneFolderListModel.m in Sources */,
 				6B1FBD2B2B452B3800926382 /* backupsFileManager.m in Sources */,
 				6BFF269A2AFA16DA00FCB4F7 /* forgetSecretKeyViewController.m in Sources */,
 				18E5572F2A3C6141005CC84B /* UITextfield+NLLimit.m in Sources */,

+ 5 - 0
创维盒子/双子星云手机/AppDelegate/Config/Notification.h

@@ -81,6 +81,11 @@
 /* 创建文件夹通知*/
 #define createFolderDoneNotification                 @"createFolderDoneNot"
 
+/* 获取文件夹通知*/
+#define getFolderListBeginNotification                 @"getFolderListBeginNot"
+/* 获取文件夹完成通知*/
+#define getFolderListDoneNotification                 @"getFolderListDoneNot"
+
 /*获取云机基本信息通知*/
 #define getCouldPhoneBaseInfoNotification                 @"getCouldPhoneBaseInfoNot"
 

+ 1 - 1
创维盒子/双子星云手机/Class/Set/uploadFile/fileTransfeSet/backupsSetViewController.m

@@ -144,7 +144,7 @@
     NSString * backupsDefaultPath = [HWDataManager getStringWithKey:Const_photo_backups_default_path];
     
     if(!backupsDefaultPath || backupsDefaultPath.length == 0){
-        backupsDefaultPath = @"/sdcard/Download/";
+        backupsDefaultPath = @"sdcard/Download";
         [HWDataManager setStringWithKey:Const_photo_backups_default_path value:backupsDefaultPath];
     }
     

+ 88 - 9
创维盒子/双子星云手机/Class/Set/uploadFile/fileTransfeSet/fileTransferPathCheckViewController.m

@@ -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

+ 4 - 3
创维盒子/双子星云手机/Class/Set/uploadFile/fileTransfeSet/view/fileTransferPathCheckTableViewCell.m

@@ -75,6 +75,7 @@
     [checkButton setImage:[UIImage imageNamed:@"upload_file_uncheck"] forState:UIControlStateNormal];
     [checkButton setImage:[UIImage imageNamed:@"upload_file_check"] forState:UIControlStateSelected];
     [cellBgView addSubview:checkButton];
+   
     [checkButton mas_makeConstraints:^(MASConstraintMaker *make) {
         make.right.mas_equalTo(-18.f);
         make.centerY.equalTo(cellBgView.mas_centerY);
@@ -82,7 +83,7 @@
         make.height.mas_equalTo(36.f);
     }];
     
-    [checkButton addTarget:self action:@selector(maskSwitchPressed:) forControlEvents:(UIControlEventValueChanged)];
+    [checkButton addTarget:self action:@selector(maskSwitchPressed:) forControlEvents:(UIControlEventTouchUpInside)];
 
 
     /**标题*/
@@ -125,9 +126,9 @@
     titleLabel2.text = @"2023/10/22";
 }
 
-- (void)maskSwitchPressed:(UISwitch *)maskSwitch{
+- (void)maskSwitchPressed:(UIButton *)maskSwitch{
     if(_didClickSwitch){
-        _didClickSwitch(maskSwitch.on);
+        _didClickSwitch(maskSwitch.selected);
     }
 }
 

+ 18 - 0
创维盒子/双子星云手机/CloudPlayer/Model/couldPhoneFolderListModel.h

@@ -0,0 +1,18 @@
+//
+//  couldPhoneFolderListModel.h
+//  隐私保护
+//
+//  Created by xd h on 2024/1/7.
+//
+
+#import "SuperModel.h"
+
+NS_ASSUME_NONNULL_BEGIN
+//{"data":["sdcard/Download"],"msg":"success","status":0,"type":"getBackupPath"}
+
+@interface couldPhoneFolderListModel : SuperModel
+@property (nonatomic, strong) NSArray* data;
+@property (nonatomic, copy) NSString * type;
+@end
+
+NS_ASSUME_NONNULL_END

+ 12 - 0
创维盒子/双子星云手机/CloudPlayer/Model/couldPhoneFolderListModel.m

@@ -0,0 +1,12 @@
+//
+//  couldPhoneFolderListModel.m
+//  隐私保护
+//
+//  Created by xd h on 2024/1/7.
+//
+
+#import "couldPhoneFolderListModel.h"
+
+@implementation couldPhoneFolderListModel
+
+@end

+ 1 - 1
创维盒子/双子星云手机/CloudPlayer/PlayerViewController+backupsFile.m

@@ -45,7 +45,7 @@
     NSString * backupsDefaultPath = [HWDataManager getStringWithKey:Const_photo_backups_default_path];
     
     if(!backupsDefaultPath || backupsDefaultPath.length == 0){
-        backupsDefaultPath = @"/sdcard/Download/";
+        backupsDefaultPath = @"sdcard/Download";
         [HWDataManager setStringWithKey:Const_photo_backups_default_path value:backupsDefaultPath];
     }
     

+ 3 - 0
创维盒子/双子星云手机/CloudPlayer/PlayerViewController+otherDelegate.h

@@ -27,6 +27,9 @@ NS_ASSUME_NONNULL_BEGIN
 
 - (void)createFolderBeginNotFun:(NSNotification *)notification;
 - (void)createFolderResponseFun:(NSDictionary *)dataDict;
+
+- (void)getFolderListBeginNotFun:(NSNotification *)notification;
+- (void)getFolderListResponseFun:(NSDictionary *)dataDict;
 @end
 
 NS_ASSUME_NONNULL_END

+ 11 - 0
创维盒子/双子星云手机/CloudPlayer/PlayerViewController+otherDelegate.mm

@@ -222,4 +222,15 @@
     }
 }
 
+- (void)getFolderListBeginNotFun:(NSNotification *)notification
+{
+    NSString * commandStr = [RCCommandHelp getCreateFolderList];
+    [self.commandChannelManager rc_sendData:commandStr];
+}
+
+- (void)getFolderListResponseFun:(NSDictionary *)dataDict
+{
+    [[NSNotificationCenter defaultCenter] postNotificationName:getFolderListDoneNotification object:dataDict];/*发送通知*/
+}
+
 @end

+ 6 - 1
创维盒子/双子星云手机/CloudPlayer/PlayerViewController.mm

@@ -738,7 +738,10 @@ ComontAlretViewControllerDelegate>
                 [weakSelf stopForceStartTimerFun];
             }
             else if ([messageType isEqualToString:@"mkdir"]){/*创建文件夹*/
-                [weakSelf stopForceStartTimerFun];
+                [weakSelf createFolderResponseFun:dataDict];
+            }
+            else if ([messageType isEqualToString:@"getBackupPath"]){/*创建文件夹*/
+                [weakSelf getFolderListResponseFun:dataDict];
             }
         } failure:^(NSError *error) {
             [self showNetErrorAlertFun:2];
@@ -2304,6 +2307,8 @@ BOOL inReconnect = NO;
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(beginGotoBackupsFileFun:) name:backupsFileBeginNotification object:nil];
     
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(createFolderBeginNotFun:) name:createFolderBeginNotification object:nil];
+    
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getFolderListBeginNotFun:) name:getFolderListBeginNotification object:nil];
 }
 
 - (void)removeNSNotification

+ 7 - 0
创维盒子/双子星云手机/CloudPlayer/RCCommandHelp.h

@@ -211,6 +211,13 @@ NS_ASSUME_NONNULL_BEGIN
  */
 + (NSString *)applyForCreateFolderwithFolderName:(NSString *)folderName;
 
+/**
+ * @brief 获取创建的文件夹(备份)
+ *
+ * @param
+ */
++ (NSString *)getCreateFolderList;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 16 - 0
创维盒子/双子星云手机/CloudPlayer/RCCommandHelp.m

@@ -1029,4 +1029,20 @@
     return dataStr;
 }
 
++ (NSString *)getCreateFolderList
+{
+    
+    NSString *dataStr = @"{\"data\":{},\"type\":\"getBackupPath\"}";
+    
+    if (USENEWCONTROLLCOMMONDNO500)
+    {
+//        dataStr = [self commondAppendingHeadAndEndStrWithSourStr:dataStr];
+    }
+    else
+    {
+        dataStr = [self commandAppending00StringWithSourStr:dataStr];
+    }
+    
+    return dataStr;
+}
 @end