From 189897a4f31b88408ce4aecd09020d201c958334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9D=E5=8F=91=E5=86=AC?= Date: Sun, 20 Aug 2023 20:14:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AD=97=E6=95=B0=E7=9A=84?= =?UTF-8?q?=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DataCenter/UserExtendataArchaver.m | 4 ++ .../XuTo/XuToControlNameViewController.m | 62 ++++++++++--------- .../XuTo/Xuanduo2SettingController.m | 10 ++- .../IfishDeviceControlNameBaseController.h | 1 + .../IfishDeviceControlNameBaseController.m | 3 +- .../IfishBindDeviceSelectViewController.m | 2 +- .../ConfigWifiViewController.h | 2 + .../ConfigWifiViewController.m | 30 ++++++--- .../ConfigWifiViewController.xib | 3 +- 9 files changed, 74 insertions(+), 43 deletions(-) diff --git a/Ifish/Utinitys/DataCenter/UserExtendataArchaver.m b/Ifish/Utinitys/DataCenter/UserExtendataArchaver.m index 787e2b1..7cc25bc 100644 --- a/Ifish/Utinitys/DataCenter/UserExtendataArchaver.m +++ b/Ifish/Utinitys/DataCenter/UserExtendataArchaver.m @@ -251,6 +251,10 @@ NSString *key = [NSString stringWithFormat:@"newXuTo%@",macaddress]; NSString *file = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject stringByAppendingPathComponent:key]; XuToControlName *controlName = [NSKeyedUnarchiver unarchiveObjectWithFile:file]; + if(!controlName.zaolangPump.length) + { + controlName.zaolangPump = @"换气"; + } if (!controlName||[controlName isKindOfClass:[NSNull class]]) { controlName = [[XuToControlName alloc] init]; controlName.shajunLight = @"杀菌灯"; diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuToControlNameViewController.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuToControlNameViewController.m index 6f08e15..76f023e 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuToControlNameViewController.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/XuToControlNameViewController.m @@ -20,6 +20,7 @@ @interface XuToControlNameViewController () @property (nonatomic,assign) BOOL isModify; + @end @implementation XuToControlNameViewController @@ -27,6 +28,7 @@ - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. + self.tableView.dataSource = self; } @@ -205,9 +207,9 @@ } if ([cell.chTitle.text isEqualToString:@"照明"]) { - if (cell.chName.text.length>3) + if (cell.chName.text.length>self.maxNameLength) { - [self.view makeToast:@"照明不能超过3个字"]; + [self.view makeToast:@"照明不能超过6个字"]; return; } else if (cell.chName.text.length==0) @@ -224,9 +226,9 @@ } else if ([cell.chTitle.text isEqualToString:@"换气"]) { - if (cell.chName.text.length>3) + if (cell.chName.text.length>self.maxNameLength) { - [self.view makeToast:@"换气不能超过3个字"]; + [self.view makeToast:@"换气不能超过6个字"]; return; } else if (cell.chName.text.length==0) @@ -243,9 +245,9 @@ } else if ([cell.chTitle.text isEqualToString:@"杀菌"]) { - if (cell.chName.text.length>3) + if (cell.chName.text.length>self.maxNameLength) { - [self.view makeToast:@"杀菌不能超过3个字"]; + [self.view makeToast:@"杀菌不能超过6个字"]; return; } else if (cell.chName.text.length==0) @@ -262,9 +264,9 @@ } else if ([cell.chTitle.text isEqualToString:@"恒温"]) { - if (cell.chName.text.length>3) + if (cell.chName.text.length>self.maxNameLength) { - [self.view makeToast:@"恒温不能超过3个字"]; + [self.view makeToast:@"恒温不能超过6个字"]; return; } else if (cell.chName.text.length==0) @@ -294,11 +296,11 @@ } [set removeAllObjects]; RuSunChangeNameTextViewCell*cell1 = [self.view viewWithTag:XUTOCHCELL_AIR]; - if (cell1.chName.text.length>3) { + if (cell1.chName.text.length>self.maxNameLength) { if (_isNewdevice) { - [self.view makeToast:@"杀菌灯不能超过3个字"]; + [self.view makeToast:@"杀菌灯不能超过6个字"]; }else { - [self.view makeToast:@"气泵不能超过3个字"]; + [self.view makeToast:@"气泵不能超过6个字"]; } return; } @@ -317,11 +319,11 @@ } [set addObject:cell1.chName.text]; RuSunChangeNameTextViewCell*cell2 = [self.view viewWithTag:XUTOCHCELL_LIANGHT1]; - if (cell2.chName.text.length>3) { + if (cell2.chName.text.length>self.maxNameLength) { if (_isNewdevice) { - [self.view makeToast:@"增氧泵不能超过3个字"]; + [self.view makeToast:@"增氧泵不能超过6个字"]; }else { - [self.view makeToast:@"灯1不能超过3个字"]; + [self.view makeToast:@"灯1不能超过6个字"]; } return; } @@ -340,11 +342,11 @@ } [set addObject:cell2.chName.text]; RuSunChangeNameTextViewCell*cell3 = [self.view viewWithTag:XUTOCHCELL_LIANGHT2]; - if (cell3.chName.text.length>3) { + if (cell3.chName.text.length>self.maxNameLength) { if (_isNewdevice) { - [self.view makeToast:@"灯光1不能超过3个字"]; + [self.view makeToast:@"灯光1不能超过6个字"]; }else { - [self.view makeToast:@"灯2不能超过3个字"]; + [self.view makeToast:@"灯2不能超过6个字"]; } return; } @@ -363,11 +365,11 @@ } [set addObject:cell3.chName.text]; RuSunChangeNameTextViewCell*cell4 = [self.view viewWithTag:XUTOCHCELL_HULI]; - if (cell4.chName.text.length>3) { + if (cell4.chName.text.length>self.maxNameLength) { if (_isNewdevice) { - [self.view makeToast:@"灯光2不能超过3个字"]; + [self.view makeToast:@"灯光2不能超过6个字"]; }else { - [self.view makeToast:@"护理灯不能超过3个字"]; + [self.view makeToast:@"护理灯不能超过6个字"]; } return; } @@ -386,11 +388,11 @@ } [set addObject:cell4.chName.text]; RuSunChangeNameTextViewCell*cell5 = [self.view viewWithTag:XUTOCHCELL_WATER]; - if (cell5.chName.text.length>3) { + if (cell5.chName.text.length>self.maxNameLength) { if (_isNewdevice) { - [self.view makeToast:@"造浪泵不能超过3个字"]; + [self.view makeToast:@"造浪泵不能超过6个字"]; }else { - [self.view makeToast:@"水泵不能超过3个字"]; + [self.view makeToast:@"水泵不能超过6个字"]; } return; } @@ -409,11 +411,11 @@ } [set addObject:cell5.chName.text]; RuSunChangeNameTextViewCell*cell6 = [self.view viewWithTag:XUTOCHCELL_JIARE]; - if (cell6.chName.text.length>3) { + if (cell6.chName.text.length>self.maxNameLength) { if (_isNewdevice) { - [self.view makeToast:@"护理灯不能超过3个字"]; + [self.view makeToast:@"护理灯不能超过6个字"]; }else { - [self.view makeToast:@"加热棒不能超过3个字"]; + [self.view makeToast:@"加热棒不能超过6个字"]; } return; } @@ -433,8 +435,8 @@ [set addObject:cell6.chName.text]; RuSunChangeNameTextViewCell*cell7 = [self.view viewWithTag:50006]; if (cell7) { - if (cell7.chName.text.length>3) { - [self.view makeToast:@"循环泵不能超过3个字"]; + if (cell7.chName.text.length>self.maxNameLength) { + [self.view makeToast:@"循环泵不能超过6个字"]; return; } if (cell7.chName.text.length==0) { @@ -448,8 +450,8 @@ RuSunChangeNameTextViewCell*cell8 = [self.view viewWithTag:50007]; if (cell8) { - if (cell8.chName.text.length>3) { - [self.view makeToast:@"加热棒不能超过3个字"]; + if (cell8.chName.text.length>self.maxNameLength) { + [self.view makeToast:@"加热棒不能超过6个字"]; return; } if (cell8.chName.text.length==0) { diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2SettingController.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2SettingController.m index 9caf283..ab4bb53 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2SettingController.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2SettingController.m @@ -133,9 +133,7 @@ static NSString *setTimerflag = @"SetTimerCell"; name.zengyangPump=@"蛋分器"; } // _titieArr = @[@"循环泵",@"增氧泵",@"灯光1",@"灯光2",@"造浪泵",@"杀菌灯"]; - _titieArr = @[name.xunhuanPump,name.zengyangPump,name.light1,name.light2,name.zaolangPump,name.shajunLight]; - - _imgArr = @[@"xunhuan_big",@"gas_big",@"light_big",@"light_big",@"wave_big",@"shajun_big"]; + @@ -144,6 +142,12 @@ static NSString *setTimerflag = @"SetTimerCell"; _titieArr = @[name.xunhuanPump,name.zaolangPump,name.light1]; _imgArr = @[@"照明开",@"换气开",@"杀菌开"]; } + else + { + _titieArr = @[name.xunhuanPump,name.zengyangPump,name.light1,name.light2,name.zaolangPump,name.shajunLight]; + + _imgArr = @[@"xunhuan_big",@"gas_big",@"light_big",@"light_big",@"wave_big",@"shajun_big"]; + } diff --git a/Ifish/controllers/FishTinkController/maincontroller/IfishDeviceControlNameBaseController.h b/Ifish/controllers/FishTinkController/maincontroller/IfishDeviceControlNameBaseController.h index 4110404..319ebc7 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/IfishDeviceControlNameBaseController.h +++ b/Ifish/controllers/FishTinkController/maincontroller/IfishDeviceControlNameBaseController.h @@ -17,6 +17,7 @@ typedef void (^deviceNameBlock)(NSString *); @property (nonatomic,copy) NSString *name; @property (nonatomic,copy) deviceNameBlock NameWithBlock ; @property(nonatomic,strong) DeviceModel* device; +@property (nonatomic, assign) NSInteger maxNameLength; -(UITableViewCell*)baseViewLoadDeviceNameCell:(NSIndexPath *)indexPath intable:(UITableView *)tableView; -(void)upLoadDeviceName; //-(void)showGressView; diff --git a/Ifish/controllers/FishTinkController/maincontroller/IfishDeviceControlNameBaseController.m b/Ifish/controllers/FishTinkController/maincontroller/IfishDeviceControlNameBaseController.m index 5ecdfd8..467f9ad 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/IfishDeviceControlNameBaseController.m +++ b/Ifish/controllers/FishTinkController/maincontroller/IfishDeviceControlNameBaseController.m @@ -20,6 +20,7 @@ [super viewDidLoad]; // Do any additional setup after loading the view. [self addTitleViewWithTitle:@"修改名称"]; + self.maxNameLength = 8; UIButton *tureButton = [UIButton buttonWithType:UIButtonTypeCustom]; tureButton.frame = CGRectMake(kScreenSize.width - 100, 10, 60, 60); @@ -159,7 +160,7 @@ [para setValue:userId forKey:@"priId.userId"]; [para setValue: cell.deviceName.text forKey:@"showName"]; - if (cell.deviceName.text.length <= 6) { + if (cell.deviceName.text.length <= self.maxNameLength) { NSString*url=kUpdateDeviceUser; if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO3F]) { diff --git a/Ifish/controllers/IfishTabControllers/设备/IfishDeviceSelectList/IfishBindDeviceSelectViewController.m b/Ifish/controllers/IfishTabControllers/设备/IfishDeviceSelectList/IfishBindDeviceSelectViewController.m index dde3824..dcb2f2f 100644 --- a/Ifish/controllers/IfishTabControllers/设备/IfishDeviceSelectList/IfishBindDeviceSelectViewController.m +++ b/Ifish/controllers/IfishTabControllers/设备/IfishDeviceSelectList/IfishBindDeviceSelectViewController.m @@ -197,7 +197,7 @@ extern BOOL isfromCameraView; { self.hidesBottomBarWhenPushed = YES; - ConAquarMethodVC *methodVC = InitObject(ConAquarMethodVC); + ConfigWifiViewController *methodVC = [[ConfigWifiViewController alloc]init]; methodVC.deviceType=DEVICEPETS; methodVC.titleString=@"连接宠物笼"; diff --git a/Ifish/controllers/leftcontrollers/ConfigWifiViewController.h b/Ifish/controllers/leftcontrollers/ConfigWifiViewController.h index 7fe35df..0705a52 100644 --- a/Ifish/controllers/leftcontrollers/ConfigWifiViewController.h +++ b/Ifish/controllers/leftcontrollers/ConfigWifiViewController.h @@ -24,6 +24,8 @@ @property (weak, nonatomic) IBOutlet UILabel *resultLabel; @property (weak, nonatomic) IBOutlet UIActivityIndicatorView *indicator; +@property (weak, nonatomic) IBOutlet UIView *line; + @property (nonatomic, strong) UIView *mask; diff --git a/Ifish/controllers/leftcontrollers/ConfigWifiViewController.m b/Ifish/controllers/leftcontrollers/ConfigWifiViewController.m index de132f6..c9b8a1e 100644 --- a/Ifish/controllers/leftcontrollers/ConfigWifiViewController.m +++ b/Ifish/controllers/leftcontrollers/ConfigWifiViewController.m @@ -101,7 +101,7 @@ extern BOOL isfromCameraView; - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. - + [self addTitleViewWithTitle:self.titleString]; self.view.backgroundColor=[UIColor whiteColor]; self.connectType = ConnectTypeAirKiss; _deviceArry =[[NSMutableArray alloc]init]; @@ -154,6 +154,17 @@ extern BOOL isfromCameraView; -(void)viewDidDisappear:(BOOL)animated{ [super viewDidDisappear:animated]; +} +-(void)goBackAction{ + if(self.connectingView.hidden==NO) + { + [self connectNormalView]; + } + else + { + [self.navigationController popViewControllerAnimated:YES]; + } + } #pragma mark -连接不上? @@ -183,7 +194,7 @@ extern BOOL isfromCameraView; }]; SPAlertAction*ap =[SPAlertAction actionWithTitle:apTitle style:SPAlertActionStyleDefault handler:^(SPAlertAction * _Nonnull action) { - weakSelf.connectType = ConnectTypeSmartESPTouch; + weakSelf.connectType = ConnectTypeAP; weakSelf.connectTypeTitle.text = apTitle; weakSelf.connectTipLbl.text = apTips; [weakSelf.connectBtn setTitle:@"下一步" forState:UIControlStateNormal]; @@ -429,6 +440,7 @@ extern BOOL isfromCameraView; { [self goSettingClick:nil]; } + else { [self configWifiForDevice]; @@ -713,6 +725,7 @@ extern BOOL isfromCameraView; } - (void)sendToDeviceWithSSIDName:(NSString *)name andSSIDPWD:(NSString *)pwd { + [self connectNotNormalView]; [IFishHotpotUDPHelper sharedInstance].delegate = self; [[IFishHotpotUDPHelper sharedInstance] broadCastHotspotConnectCommandWith:name pwd:pwd]; } @@ -726,7 +739,7 @@ extern BOOL isfromCameraView; [self appendTrakContent:@"=================收到设备答复==================="]; [self appendTrakContent:[NSString stringWithFormat:@"答复状态码:%@", backModel.result]]; [self appendTrakContent:[NSString stringWithFormat:@"答复Mac地址:%@", backModel.senderMacAddress]]; - self.macAddress = backModel.senderMacAddress; + self.deviceBssid = backModel.senderMacAddress; [IFishHotpotUDPHelper sharedInstance].delegate = nil; [[IFishHotpotUDPHelper sharedInstance] broadCastRestartCommand]; @@ -747,7 +760,7 @@ extern BOOL isfromCameraView; if (self.isBindingDevice||self.storeNameView) { return; } - if (self.macAddress.length == 0) { + if (self.deviceBssid.length == 0) { return; } @@ -758,7 +771,7 @@ extern BOOL isfromCameraView; } else { - [self bindDeviceWithSsid:self.macAddress]; + [self bindDeviceWithSsid:self.deviceBssid]; } } @@ -844,6 +857,7 @@ extern BOOL isfromCameraView; { [self.storeNameView removeFromSuperview]; [self.mask removeFromSuperview]; + [self connectNormalView]; } -(void)showStoreNameView @@ -859,6 +873,7 @@ extern BOOL isfromCameraView; store.cancelBlock=^(){ [weakSelf.mask removeFromSuperview]; [weakSelf.storeNameView removeFromSuperview]; + [weakSelf connectNormalView]; }; store.sureBlock=^(NSString*name) @@ -888,6 +903,7 @@ extern BOOL isfromCameraView; else { self.isBindingDevice = YES; + [self connectNotNormalView]; if (self.bindTimer) { [self.bindTimer invalidate]; self.bindTimer = nil; @@ -913,7 +929,7 @@ extern BOOL isfromCameraView; NSDictionary*resultDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil]; NSLog(@"data:%@",resultDic[@"data"]); self.isBindingDevice = NO; - self.macAddress = nil; + self.deviceBssid = nil; if ([resultDic[@"result"] isEqualToString:@"100"]) { // 保存设备信息 @@ -1016,7 +1032,7 @@ extern BOOL isfromCameraView; if (self.retryTimes < 10) { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ self.HUD.labelText = @"自动重连..."; - [self bindDeviceWithSsid:self.macAddress]; + [self bindDeviceWithSsid:self.deviceBssid]; self.retryTimes += 1; diff --git a/Ifish/controllers/leftcontrollers/ConfigWifiViewController.xib b/Ifish/controllers/leftcontrollers/ConfigWifiViewController.xib index e7d559c..e8a67b1 100644 --- a/Ifish/controllers/leftcontrollers/ConfigWifiViewController.xib +++ b/Ifish/controllers/leftcontrollers/ConfigWifiViewController.xib @@ -18,6 +18,7 @@ + @@ -137,7 +138,7 @@ - +