Browse Source

1.备份相关

huangxiaodong 1 year ago
parent
commit
d30d06b3f4

+ 22 - 0
创维盒子/双子星云手机/AppDelegate/AppDelegate.m

@@ -92,6 +92,12 @@
     
     
     [Bugly startWithAppId:@"179559a521"];
     [Bugly startWithAppId:@"179559a521"];
     
     
+    
+    [[UIDevice currentDevice] setBatteryMonitoringEnabled:YES];
+    [[UIDevice currentDevice] batteryLevel];
+    
+    // 监听电池电量变化通知
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(batteryLevelChanged:) name:UIDeviceBatteryLevelDidChangeNotification object:nil];
     return YES;
     return YES;
 }
 }
 
 
@@ -185,4 +191,20 @@
            // 刷新rootVC等
            // 刷新rootVC等
     }];
     }];
 }
 }
+
+- (void)batteryLevelChanged:(NSNotification *)notification {
+    // 获取当前设备的电池电量
+    UIDevice *device = notification.object;
+    float batteryLevel = device.batteryLevel;
+      
+    // 根据电量级别执行相应的操作
+    if (batteryLevel < 0.2) {
+        NSLog(@"Low battery level. Please charge the device.");
+    } else if (batteryLevel < 0.5) {
+        NSLog(@"Medium battery level.");
+    } else {
+        NSLog(@"High battery level.");
+    }
+}
+
 @end
 @end

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

@@ -95,6 +95,9 @@ UIKIT_EXTERN NSString *const Const_file_Transfe_battery_level;
 /*相册备份是否开启*/
 /*相册备份是否开启*/
 UIKIT_EXTERN NSString *const Const_photo_backups_state;
 UIKIT_EXTERN NSString *const Const_photo_backups_state;
 
 
+/*相册备份默认路径*/
+UIKIT_EXTERN NSString *const Const_photo_backups_default_path;
+
 /*标记是否使用流量备份*/
 /*标记是否使用流量备份*/
 UIKIT_EXTERN NSString *const Const_file_backups_canUse_Cellular;
 UIKIT_EXTERN NSString *const Const_file_backups_canUse_Cellular;
 
 

+ 3 - 0
创维盒子/双子星云手机/AppDelegate/Config/Const.m

@@ -91,6 +91,9 @@ NSString *const Const_file_Transfe_battery_level  = @"file_Transfe_battery_level
 /*相册备份是否开启*/
 /*相册备份是否开启*/
 NSString *const Const_photo_backups_state = @"photo_backups_state";
 NSString *const Const_photo_backups_state = @"photo_backups_state";
 
 
+/*相册备份默认路径*/
+NSString *const Const_photo_backups_default_path = @"photo_backups_default_path";
+
 /*标记是否使用流量备份*/
 /*标记是否使用流量备份*/
 NSString *const Const_file_backups_canUse_Cellular = @"file_backups_canUse_Cellular";
 NSString *const Const_file_backups_canUse_Cellular = @"file_backups_canUse_Cellular";
 
 

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

@@ -9,6 +9,7 @@
 
 
 #import "fileSetTableViewCell.h"
 #import "fileSetTableViewCell.h"
 #import "fileTransferPathCheckViewController.h"
 #import "fileTransferPathCheckViewController.h"
+#import "backupsFileManager.h"
 
 
 @interface backupsSetViewController ()<UITableViewDelegate,UITableViewDataSource>
 @interface backupsSetViewController ()<UITableViewDelegate,UITableViewDataSource>
 @property (nonatomic, strong) UITableView *tableView;
 @property (nonatomic, strong) UITableView *tableView;
@@ -139,7 +140,15 @@
 - (void)setUploadFilePathLabelTitleFun
 - (void)setUploadFilePathLabelTitleFun
 {
 {
     NSString * leftStr = NSLocalizedString(@"File_backups_path_way_tip",nil);
     NSString * leftStr = NSLocalizedString(@"File_backups_path_way_tip",nil);
-    NSString * rightStr = @"我的空间/来自【手机设备名称】的相册备份";
+    
+    NSString * backupsDefaultPath = [HWDataManager getStringWithKey:Const_photo_backups_default_path];
+    
+    if(!backupsDefaultPath || backupsDefaultPath.length == 0){
+        backupsDefaultPath = @"/sdcard/Download/";
+        [HWDataManager setStringWithKey:Const_photo_backups_default_path value:backupsDefaultPath];
+    }
+    
+    NSString * rightStr = backupsDefaultPath;
     
     
     NSString *totalStr = [[NSString alloc] initWithFormat:@"%@%@",leftStr,rightStr];
     NSString *totalStr = [[NSString alloc] initWithFormat:@"%@%@",leftStr,rightStr];
     
     
@@ -160,6 +169,13 @@
 #pragma mark 尾部事件
 #pragma mark 尾部事件
 - (void)didClickTailViewFun
 - (void)didClickTailViewFun
 {
 {
+    photosBackupsTaskModel* model = [backupsFileManager shareInstance].curPhotosBackupsTaskMod;
+    
+    if(model && model.curBackupsState == backupsStateUploading){
+        [[iToast makeText:NSLocalizedString(@"File_backups_set_default_path_tip",nil)] show];
+        return;
+    }
+    
     fileTransferPathCheckViewController *vc = [fileTransferPathCheckViewController new];
     fileTransferPathCheckViewController *vc = [fileTransferPathCheckViewController new];
     vc.curType = 2;
     vc.curType = 2;
     [self.navigationController pushViewController:vc animated:YES];
     [self.navigationController pushViewController:vc animated:YES];

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

@@ -42,7 +42,14 @@
         
         
     //}
     //}
     
     
-    NSString * commandStr = [RCCommandHelp applyForBackupsFileBy:self.backupsTaskUid withFileName:self.backupsFileName withSavePath:@"/sdcard/DCIM/"];
+    NSString * backupsDefaultPath = [HWDataManager getStringWithKey:Const_photo_backups_default_path];
+    
+    if(!backupsDefaultPath || backupsDefaultPath.length == 0){
+        backupsDefaultPath = @"/sdcard/Download/";
+        [HWDataManager setStringWithKey:Const_photo_backups_default_path value:backupsDefaultPath];
+    }
+    
+    NSString * commandStr = [RCCommandHelp applyForBackupsFileBy:self.backupsTaskUid withFileName:self.backupsFileName withSavePath:backupsDefaultPath];
     
     
     //NSString * commandStr = [RCCommandHelp applyForUploadFileBy:self.taskUid  filePath:self.fileName];
     //NSString * commandStr = [RCCommandHelp applyForUploadFileBy:self.taskUid  filePath:self.fileName];
     
     

+ 1 - 0
创维盒子/双子星云手机/zh-Hans.lproj/Localizable.strings

@@ -355,3 +355,4 @@
 "File_Transfer_List_head_title_fail"   = "传输失败";
 "File_Transfer_List_head_title_fail"   = "传输失败";
 "File_Transfer_List_head_title_done"   = "已完成";
 "File_Transfer_List_head_title_done"   = "已完成";
 "File_backups_Record_tip_Suspend"   = "已暂停";
 "File_backups_Record_tip_Suspend"   = "已暂停";
+"File_backups_set_default_path_tip"   = "请停止备份操作后再更改路径";