瀏覽代碼

1. 4G 环境下 流量开关逻辑晚上

huangxiaodong 1 年之前
父節點
當前提交
6c0c47ccf5

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

@@ -88,6 +88,9 @@
 
 /* 下载文件通知*/
 #define downloadFileAllTaskDoneNotification                 @"downloadFileAllTaskDoneNot"
+/* 下载文件暂停全部通知*/
+#define downloadFileSuspendAllNotification                 @"downloadFileSuspendAllNot"
+
 
 /* 创建文件夹通知*/
 #define createFolderBeginNotification                 @"createFolderBeginNot"

+ 1 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileManager/downloadManager.m

@@ -201,6 +201,7 @@ static downloadManager * cur_downloadManager = nil;
         //
         if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWWAN){
             mainBlock(^{
+                [[NSNotificationCenter defaultCenter] postNotificationName:downloadFileSuspendAllNotification object:nil];
                 [[iToast makeText:NSLocalizedString(@"File_Transfer_By_Cellular_tip",nil)] show];
             });
             return;

+ 20 - 2
创维盒子/双子星云手机/Class/Set/uploadFile/uploadFileRecordViewController.m

@@ -65,6 +65,7 @@
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(backupsFileRefreshFun:)  name:backupsFileRefreshNotification  object:nil];
     
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadFileRefreshFun:)  name:downloadFileRefreshNotification  object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadFileSuspendAllFun:)  name:downloadFileSuspendAllNotification  object:nil];
     
     [self.view setBackgroundColor:[UIColor whiteColor]];
     
@@ -595,9 +596,10 @@
     
     for (int i=0; i<uploadingArr.count; i++) {
         uploadFileDataModel*preModel = uploadingArr[i];
-        if(preModel.curUploadStateType == uploadStateUploading){
+        if(preModel.curUploadStateType == uploadStateUploading
+           ||preModel.curUploadStateType == uploadStateWait){
             preModel.curUploadStateType = uploadStateSuspend;
-            break;
+            //break;
         }
     }
 }
@@ -906,6 +908,22 @@
     }
 }
 
+- (void)downloadFileSuspendAllFun:(NSNotification*)not
+{
+    NSMutableArray *downloadingArr = _midTableView.downloadingArr;
+    
+    for (int i=0; i<downloadingArr.count; i++) {
+        couldPhoneFileModel*preModel = downloadingArr[i];
+        if(preModel.curDownloadStateType == downloadStateUploading
+           ||preModel.curDownloadStateType == downloadStateWait){
+            preModel.curDownloadStateType = downloadStateSuspend;
+            //break;
+        }
+    }
+    
+    [_midTableView RefreshAllDataFun];
+}
+
 #pragma mark 1.3版本UI修改后 下载文件列表的头部点击事件
 - (void)didClikRightButInDownloadTableVieFunBy:(NSInteger)section
 {

+ 14 - 0
创维盒子/双子星云手机/Class/Set/view/mySetHeadView.m

@@ -8,6 +8,7 @@
 #import "mySetHeadView.h"
 #import "TZImageManager.h"
 #import "backupsFileManager.h"
+#import "AFNetworkReachabilityManager.h"
 
 @interface mySetHeadView ()
 {
@@ -485,6 +486,19 @@
 
 - (void)openImageBackupsFun
 {
+    BOOL isCanUseCellular = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_backups_canUse_Cellular)];
+    if(!isCanUseCellular){//不允许流量上传
+        //
+        if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWWAN){
+            mainBlock(^{
+                [[iToast makeText:NSLocalizedString(@"File_Transfer_By_Cellular_tip",nil)] show];
+            });
+
+            return;
+        }
+        
+    }
+
     [HWDataManager setBoolWithKey:stringKeyAddSn(Const_photo_backups_state) value:YES];
     [self setBackupsStateFun];
     [[iToast makeText:NSLocalizedString(@"set_Privacy_title_image_open",nil)] show];