|
@@ -26,6 +26,9 @@
|
|
|
@interface AppDelegate ()<JJExceptionHandle,WXApiDelegate>
|
|
|
{
|
|
|
CMMotionManager *cmManager;
|
|
|
+
|
|
|
+ NSString * NASFileByBoxServiceByPingok;//内网地址
|
|
|
+ NSString * NASFileByBoxServiceByPingNot;//外网地址
|
|
|
}
|
|
|
|
|
|
@end
|
|
@@ -230,7 +233,28 @@
|
|
|
HLog(@"Reachability: %@", AFStringFromNetworkReachabilityStatus(status));
|
|
|
|
|
|
[[NSNotificationCenter defaultCenter] postNotificationName:NetWorkChangeNotification object:nil];
|
|
|
- [[pingManager shareManager] startPingDeviceIpFun];
|
|
|
+
|
|
|
+ //是否备份中
|
|
|
+ if([nasBackupsManager shareInstance].curPhotosBackupsTaskMod
|
|
|
+ && [nasBackupsManager shareInstance].curPhotosBackupsTaskMod.curBackupsState == backupsStateUploading){
|
|
|
+
|
|
|
+ //1.先暂停备份
|
|
|
+ [[nasBackupsManager shareInstance] suspendBackupsFileFun];
|
|
|
+
|
|
|
+ //2.重新开启备份
|
|
|
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
+ [[nasBackupsManager shareInstance] reBackupsFileFun];
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //网络切换
|
|
|
+ if(status == AFNetworkReachabilityStatusReachableViaWiFi){//检测到起切换wifi 重新ping一下
|
|
|
+ [[pingManager shareManager] startPingDeviceIpFun];
|
|
|
+ }
|
|
|
+ else {//非wifi链接
|
|
|
+ [pingManager shareManager].isPingOk = NO;
|
|
|
+ }
|
|
|
+
|
|
|
}];
|
|
|
|
|
|
[[AFNetworkReachabilityManager sharedManager] startMonitoring];
|
|
@@ -332,12 +356,12 @@
|
|
|
|
|
|
if(_NASMsgMod){
|
|
|
if([_NASMsgMod.data.domainName rangeOfString:@"http"].location != NSNotFound){
|
|
|
- return [[NSString alloc] initWithFormat:@"%@:%@/",_NASMsgMod.data.domainName,_NASMsgMod.data.port];
|
|
|
+ _NASShareFileService = [[NSString alloc] initWithFormat:@"%@:%@/",_NASMsgMod.data.domainName,_NASMsgMod.data.port];
|
|
|
//return [[NSString alloc] initWithFormat:@"%@:%@/",@"http://transfer.armclouding.com",@"10016"];
|
|
|
//return [[NSString alloc] initWithFormat:@"%@:%@/",@"http://transfer.armclouding.com",_NASMsgMod.data.port];
|
|
|
}
|
|
|
else{
|
|
|
- return [[NSString alloc] initWithFormat:@"http://%@:%@/",_NASMsgMod.data.domainName,_NASMsgMod.data.port];
|
|
|
+ _NASShareFileService = [[NSString alloc] initWithFormat:@"http://%@:%@/",_NASMsgMod.data.domainName,_NASMsgMod.data.port];
|
|
|
//return [[NSString alloc] initWithFormat:@"http://%@:%@/",@"transfer.armclouding.com",@"10016"];
|
|
|
//return [[NSString alloc] initWithFormat:@"http://%@:%@/",@"transfer.armclouding.com",_NASMsgMod.data.port];
|
|
|
}
|
|
@@ -345,26 +369,36 @@
|
|
|
//return [[NSString alloc] initWithFormat:@"%@getFile?path=",_NASMsgMod.data.baseUrl];
|
|
|
//return [[NSString alloc] initWithFormat:@"%@/",_NASMsgMod.data.baseUrl];
|
|
|
}
|
|
|
- return nil;
|
|
|
+ return _NASShareFileService;
|
|
|
}
|
|
|
- (NSString*)NASFileByBoxService
|
|
|
{
|
|
|
- if(_NASShareFileService && _NASShareFileService.length >0){
|
|
|
- return _NASShareFileService;
|
|
|
- }
|
|
|
-
|
|
|
+ //内网情况
|
|
|
if([pingManager shareManager].isPingOk){
|
|
|
- return [NSString stringWithFormat:@"http://%@:9888/",ksharedAppDelegate.DeviceThirdIdMod.data.ip];
|
|
|
+ if(NASFileByBoxServiceByPingok && NASFileByBoxServiceByPingok.length >0){
|
|
|
+ return NASFileByBoxServiceByPingok;
|
|
|
+ }
|
|
|
+
|
|
|
+ NASFileByBoxServiceByPingok = [NSString stringWithFormat:@"http://%@:9888/",ksharedAppDelegate.DeviceThirdIdMod.data.ip];
|
|
|
+
|
|
|
+ return NASFileByBoxServiceByPingok;
|
|
|
}
|
|
|
|
|
|
+ //外网情况
|
|
|
if(_NASMsgMod){
|
|
|
+ if(NASFileByBoxServiceByPingNot && NASFileByBoxServiceByPingNot.length >0){
|
|
|
+ return NASFileByBoxServiceByPingNot;
|
|
|
+ }
|
|
|
+
|
|
|
if([_NASMsgMod.data.domainName rangeOfString:@"http"].location != NSNotFound){
|
|
|
- return [[NSString alloc] initWithFormat:@"%@:%@/",_NASMsgMod.data.domainName,_NASMsgMod.data.port];
|
|
|
+ NASFileByBoxServiceByPingNot = [[NSString alloc] initWithFormat:@"%@:%@/",_NASMsgMod.data.domainName,_NASMsgMod.data.port];
|
|
|
|
|
|
}
|
|
|
else{
|
|
|
- return [[NSString alloc] initWithFormat:@"http://%@:%@/",_NASMsgMod.data.domainName,_NASMsgMod.data.port];
|
|
|
+ NASFileByBoxServiceByPingNot = [[NSString alloc] initWithFormat:@"http://%@:%@/",_NASMsgMod.data.domainName,_NASMsgMod.data.port];
|
|
|
}
|
|
|
+
|
|
|
+ return NASFileByBoxServiceByPingNot;
|
|
|
}
|
|
|
return @"";
|
|
|
}
|