From 1354f012e18fb181232a3b763c611d7c7fa2ed91 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 23:23:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E9=94=99=E8=AF=AF=E6=97=B6?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E9=A1=B5=E9=9D=A2=E7=9A=84=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ifish.xcodeproj/project.pbxproj | 4 +- .../ConfigWifiViewController.m | 37 ++++++++++++++++--- .../ConfigWifiViewController.xib | 2 +- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/Ifish.xcodeproj/project.pbxproj b/Ifish.xcodeproj/project.pbxproj index 47e9054..25ff259 100644 --- a/Ifish.xcodeproj/project.pbxproj +++ b/Ifish.xcodeproj/project.pbxproj @@ -16101,7 +16101,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = WFX8GD5HFX; ENABLE_BITCODE = NO; ENABLE_TESTABILITY = YES; @@ -16221,7 +16221,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = WFX8GD5HFX; ENABLE_BITCODE = NO; ENABLE_TESTABILITY = YES; diff --git a/Ifish/controllers/leftcontrollers/ConfigWifiViewController.m b/Ifish/controllers/leftcontrollers/ConfigWifiViewController.m index c9b8a1e..0ec20fa 100644 --- a/Ifish/controllers/leftcontrollers/ConfigWifiViewController.m +++ b/Ifish/controllers/leftcontrollers/ConfigWifiViewController.m @@ -121,7 +121,7 @@ extern BOOL isfromCameraView; // self.wifiTextFiled.textColor = RGB_51; self.wifiTextFiled.leftViewMode=UITextFieldViewModeAlways; - [self addTitleViewWithTitle:self.vcTitle]; + // [self addTitleViewWithTitle:self.vcTitle]; self.rightButton = [UIButton buttonWithType:UIButtonTypeCustom]; @@ -170,6 +170,11 @@ extern BOOL isfromCameraView; -(void)connectTypeClick:(UIButton *)btn { + if(self.indicator.isAnimating) + { + [self.view makeToast:@"绑定中..."]; + return; + } WEAK_SELF; NSString*airkisTitle = @"一键联网"; NSString*smartTitle = @"快捷联网"; @@ -179,6 +184,7 @@ extern BOOL isfromCameraView; NSString*apTips = @"1、插座仅支持2.4G的WiFi网络,不支持5G 及 双频合一的网络(需在路由器设置中分开)\n2、先长按插座复位键13秒左右,松手后红灯绿灯同时熄灭,只有绿灯偶尔闪烁,再点下一步。"; SPAlertController*alert =[SPAlertController alertControllerWithTitle:nil message:nil preferredStyle:SPAlertControllerStyleActionSheet animationType:SPAlertAnimationTypeDefault]; SPAlertAction*airkiss =[SPAlertAction actionWithTitle:airkisTitle style:SPAlertActionStyleDefault handler:^(SPAlertAction * _Nonnull action) { + [weakSelf connectNormalView]; weakSelf.connectType = ConnectTypeAirKiss; weakSelf.connectTypeTitle.text = airkisTitle; weakSelf.connectTipLbl.text = airkisTips; @@ -187,6 +193,7 @@ extern BOOL isfromCameraView; SPAlertAction*smart =[SPAlertAction actionWithTitle:smartTitle style:SPAlertActionStyleDefault handler:^(SPAlertAction * _Nonnull action) { + [weakSelf connectNormalView]; weakSelf.connectType = ConnectTypeSmartESPTouch; weakSelf.connectTypeTitle.text = smartTitle; weakSelf.connectTipLbl.text = smartTips; @@ -194,6 +201,7 @@ extern BOOL isfromCameraView; }]; SPAlertAction*ap =[SPAlertAction actionWithTitle:apTitle style:SPAlertActionStyleDefault handler:^(SPAlertAction * _Nonnull action) { + [weakSelf connectNormalView]; weakSelf.connectType = ConnectTypeAP; weakSelf.connectTypeTitle.text = apTitle; weakSelf.connectTipLbl.text = apTips; @@ -257,6 +265,10 @@ extern BOOL isfromCameraView; { self.connectingView.hidden=YES; self.connectBtn.hidden = NO; + self.reasonBtn.hidden = YES; + self.resultLabel.hidden = YES; + self.line.hidden = YES; + [self.indicator stopAnimating]; } @@ -265,9 +277,22 @@ extern BOOL isfromCameraView; { self.connectingView.hidden=NO; [self.indicator startAnimating]; + self.reasonBtn.hidden = YES; + self.resultLabel.hidden = YES; + self.line.hidden = YES; self.connectBtn.hidden = YES; } +-(void)showFailResultViewWithMsg:(NSString*)msg +{ + self.connectingView.hidden=NO; + [self.indicator stopAnimating]; + self.connectBtn.hidden = YES; + self.reasonBtn.hidden = NO; + self.resultLabel.hidden = NO; + self.line.hidden = NO; + self.resultLabel.text = msg?:@"连接失败"; +} -(void)initMacIdString:(NSString *)ssid{ @@ -280,6 +305,7 @@ extern BOOL isfromCameraView; }else{ _maclabel.text = @"无设备mac"; } + [self showFailResultViewWithMsg:_maclabel.text]; NSMutableAttributedString * attributedString = [[NSMutableAttributedString alloc] initWithString:_maclabel.text]; NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init]; [paragraphStyle setLineSpacing:8]; @@ -299,9 +325,9 @@ extern BOOL isfromCameraView; // [self.view bringSubviewToFront:_maclabel]; self.bakbutton.userInteractionEnabled=YES; - [self connectNormalView]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [self.view makeToast:@"设备类型不匹配,请重新选择入口绑定"]; + [self.view makeToast:_maclabel.text]; }); } @@ -607,7 +633,7 @@ extern BOOL isfromCameraView; { [self.view makeToast:msg]; } - + [self showFailResultViewWithMsg:msg]; }; ConnectType type = self.connectType; dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); @@ -1009,7 +1035,7 @@ extern BOOL isfromCameraView; [self.view makeToast:msg]; self.bakbutton.userInteractionEnabled=YES; - NSString *str =[NSString stringWithFormat:@"mac%@错误吗101",bssid]; + NSString *str =[NSString stringWithFormat:@"mac%@错误码101",bssid]; [self initMacIdString:str]; }else if ([resultDic[@"result"] isEqualToString:@"301"]){ @@ -1043,6 +1069,7 @@ extern BOOL isfromCameraView; self.isBindingDevice = NO; self.HUD.labelText = err.localizedDescription; [self.HUD hide:YES afterDelay:2]; + [self initMacIdString:err.description]; [self appendTrakContent:[NSString stringWithFormat:@"绑定网络请求错误:%@", err.localizedDescription]]; self.bakbutton.userInteractionEnabled=YES; } diff --git a/Ifish/controllers/leftcontrollers/ConfigWifiViewController.xib b/Ifish/controllers/leftcontrollers/ConfigWifiViewController.xib index e8a67b1..cbfaf36 100644 --- a/Ifish/controllers/leftcontrollers/ConfigWifiViewController.xib +++ b/Ifish/controllers/leftcontrollers/ConfigWifiViewController.xib @@ -32,7 +32,7 @@ -