From 296e93272ba3fb2ceac3a57c95b0db3bbb414de1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9D=E5=8F=91=E5=86=AC?= Date: Tue, 8 Nov 2022 09:59:58 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=92=8C=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ifish.xcodeproj/project.pbxproj | 4 +- .../XuTo/Xuanduo2fController.m | 58 ++++++++++--------- 2 files changed, 34 insertions(+), 28 deletions(-) diff --git a/Ifish.xcodeproj/project.pbxproj b/Ifish.xcodeproj/project.pbxproj index 5fcf466..1459470 100644 --- a/Ifish.xcodeproj/project.pbxproj +++ b/Ifish.xcodeproj/project.pbxproj @@ -16025,7 +16025,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 12; + CURRENT_PROJECT_VERSION = 13; DEVELOPMENT_TEAM = WFX8GD5HFX; ENABLE_BITCODE = NO; ENABLE_TESTABILITY = YES; @@ -16145,7 +16145,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 12; + CURRENT_PROJECT_VERSION = 13; DEVELOPMENT_TEAM = WFX8GD5HFX; ENABLE_BITCODE = NO; ENABLE_TESTABILITY = YES; diff --git a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.m b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.m index 36c25e5..d44d299 100644 --- a/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.m +++ b/Ifish/controllers/FishTinkController/maincontroller/CenterontrolControllers/XuTo/Xuanduo2fController.m @@ -198,6 +198,7 @@ self.heartCount=0; } + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refresh) name:UIApplicationDidBecomeActiveNotification object:nil]; } - (void)connect { @@ -211,34 +212,39 @@ self.scrollview.delegate = self; __weak typeof (self)weakSelf=self; [weakSelf.scrollview addRefreshHeaderViewWithAniViewClass:[JHRefreshAmazingAniView class] beginRefresh:^{ - if (weakSelf.isRefeshing) { - return ; - } - weakSelf.isRefeshing=YES; - if (weakSelf.isconnect) { - searchDeviceModel*xinxiModel=[[searchDeviceModel alloc]init]; - xinxiModel.resavemacId = self.currentDevice.macAddress; - xinxiModel.sendmacId = self.currentDevice.macAddress; - - NSString*requestStr=xinxiModel.description; - NSLog(@"REQUEST = %@",requestStr); - NSData*data1=[dataContorl stringToHexData:requestStr]; - [[Socketsingleton sharedInstance].clientSocket writeData:data1 withTimeout:-1 tag:0]; - [[Socketsingleton sharedInstance].clientSocket readDataWithTimeout:-1 tag:0]; - - }else{// socket中断 - [[Socketsingleton sharedInstance] cutOffSocket]; - [weakSelf InitSocket]; - - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [weakSelf endRefreshing]; - }); - - } + [weakSelf refresh]; }]; } - +-(void)refresh +{ + + if (self.isRefeshing) { + return ; + } + + self.isRefeshing=YES; + if (self.isconnect) { + searchDeviceModel*xinxiModel=[[searchDeviceModel alloc]init]; + xinxiModel.resavemacId = self.currentDevice.macAddress; + xinxiModel.sendmacId = self.currentDevice.macAddress; + + NSString*requestStr=xinxiModel.description; + NSLog(@"REQUEST = %@",requestStr); + NSData*data1=[dataContorl stringToHexData:requestStr]; + [[Socketsingleton sharedInstance].clientSocket writeData:data1 withTimeout:-1 tag:0]; + [[Socketsingleton sharedInstance].clientSocket readDataWithTimeout:-1 tag:0]; + + }else{// socket中断 + [[Socketsingleton sharedInstance] cutOffSocket]; + [self InitSocket]; + + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [self endRefreshing]; + }); + + } +} -(void)endRefreshing{ if (self.isRefeshing) { self.isRefeshing=NO; @@ -1261,7 +1267,7 @@ } - (void)dealloc { - + [[NSNotificationCenter defaultCenter] removeObserver:self]; }