Ver código fonte

1..4G 上传问题解决中....

huangxiaodong 1 ano atrás
pai
commit
6ce8335bc9

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

@@ -68,6 +68,8 @@
 #define uploadFileRefreshNotification                 @"uploadFileRefreshNot"
 /* 上传文件暂停通知*/
 #define uploadFileSuspendNotification                 @"uploadFileSuspendNot"
+/* 上传文件暂停全部通知*/
+#define uploadFileSuspendAllNotification                 @"uploadFileSuspendAllNot"
 /* 上传文件通知*/
 #define uploadFileAllTaskDoneNotification                 @"uploadFileAllTaskDoneNot"
 

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

@@ -171,6 +171,15 @@ static backupsFileManager * cur_backupsFileShareInstance = nil;
 
 - (void)beginBackupsFileFun
 {
+    BOOL isCanUseCellular = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_backups_canUse_Cellular)];
+    if(!isCanUseCellular){//不允许流量上传
+        //
+        if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWWAN){
+            return;
+        }
+        
+    }
+    
     self.taskRenewTime = [iTools getNowTimeStamp];
     
     NSInteger index = _curPhotosBackupsTaskMod.didBackupsCount + _curPhotosBackupsTaskMod.failCount;

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

@@ -9,6 +9,7 @@
 #import "cachesFileManager.h"
 #import <sys/mount.h>
 #include <sys/param.h>
+#import "AFNetworkReachabilityManager.h"
 
 @interface downloadManager ()
 /**检测任务10s后 无反馈重新开始 */
@@ -195,6 +196,18 @@ static downloadManager * cur_downloadManager = nil;
         return;
     }
     
+    BOOL isCanUseCellular = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_canUse_Cellular)];
+    if(!isCanUseCellular){//不允许流量上传
+        //
+        if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWWAN){
+            mainBlock(^{
+                [[iToast makeText:NSLocalizedString(@"File_Transfer_By_Cellular_tip",nil)] show];
+            });
+            return;
+        }
+        
+    }
+    
     self.taskRenewTime = [iTools getNowTimeStamp];
     
     _isSuspendType = NO;

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

@@ -8,6 +8,8 @@
 #import "uploadFileManager.h"
 #import <AssetsLibrary/AssetsLibrary.h>
 #import "photosBackupsTaskModel.h"
+#import "AFNetworkReachabilityManager.h"
+
 @interface uploadFileManager ()
 /**检测任务10s后 无反馈重新开始 */
 @property (nonatomic, assign) NSInteger  taskRenewTime; //
@@ -233,6 +235,19 @@ static uploadFileManager * cur_uploadFileShareInstance = nil;
 //        return;
 //    }
     
+    BOOL isCanUseCellular = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_canUse_Cellular)];
+    if(!isCanUseCellular){//不允许流量上传
+        //
+        if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWWAN){
+            mainBlock(^{
+                [[NSNotificationCenter defaultCenter] postNotificationName:uploadFileSuspendAllNotification object:nil];
+                [[iToast makeText:NSLocalizedString(@"File_Transfer_By_Cellular_tip",nil)] show];
+            });
+            return;
+        }
+        
+    }
+    
     if(_isSuspendType)
     {
         return;

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

@@ -59,6 +59,8 @@
     //[self.view setBackgroundColor:HWF5F7FAColor];
     
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(uploadFileRefreshFun:)  name:uploadFileRefreshNotification  object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(uploadFileSuspendAllFun:)  name:uploadFileSuspendAllNotification  object:nil];
+    
     
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(backupsFileRefreshFun:)  name:backupsFileRefreshNotification  object:nil];
     
@@ -587,6 +589,19 @@
     }
 }
 
+- (void)uploadFileSuspendAllFun:(NSNotification*)not
+{
+    NSMutableArray *uploadingArr = _leftTableView.uploadingArr;
+    
+    for (int i=0; i<uploadingArr.count; i++) {
+        uploadFileDataModel*preModel = uploadingArr[i];
+        if(preModel.curUploadStateType == uploadStateUploading){
+            preModel.curUploadStateType = uploadStateSuspend;
+            break;
+        }
+    }
+}
+
 #pragma mark 那上传那边的数据来更新页面
 - (void)RefreshUploadViewFun
 {

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

@@ -398,3 +398,4 @@
 "netWork_error_tip_title" = "No network";
 "netWork_error_tip_content" = "iphone network abnormality, please check the current network permissions, or drag to the bottom of the settings to find Private-x and enter to view wireless data permissions";
 "scan_sn_data_error_tip"   = "Device info not found. Scan to bind a new one.";
+"File_Transfer_By_Cellular_tip"   = "Data transmission will be paused in non-WIFI environments. Please enable data transmission in the settings page";

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

@@ -397,3 +397,4 @@
 "netWork_error_tip_title" = "ネットワークなし";
 "netWork_error_tip_content" = "携帯電話のネットワークに異常がある場合は、現在のネットワーク権限を確認するか、設定の下にPrivate-xを見つけてワイヤレスデータを表示する権限を確認してください";
 "scan_sn_data_error_tip"   = "デバイス情報未確認。新デバイスをスキャンして繋ぐる。";
+"File_Transfer_By_Cellular_tip"   = "非WIFI環境では伝輸を一時停止します。設定画面でデータ伝輸を有効にしてください";

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

@@ -397,3 +397,4 @@
 "netWork_error_tip_title" = "无网络";
 "netWork_error_tip_content" = "手机网络异常,请检查当前网络权限,或者在设置里拉到底部找到Private-x进入查看无线数据权限";
 "scan_sn_data_error_tip"   = "设备信息不存在,请扫码绑定新设备";
+"File_Transfer_By_Cellular_tip"   = "非WIFI环境将暂停传输,请在设置页面开启流量传输";

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

@@ -397,3 +397,4 @@
 "netWork_error_tip_title" = "無網絡";
 "netWork_error_tip_content" = "手機網絡异常,請檢查當前網絡許可權,或者在設定里拉到底部找到Private-x進入查看無線數據許可權";
 "scan_sn_data_error_tip"   = "設備資訊不存在,請掃碼綁定新設備";
+"File_Transfer_By_Cellular_tip"   = "非WIFI環境將暂停傳輸,請在设置頁面開啟流量傳輸";