新版本
This commit is contained in:
+46
-18
@@ -13,6 +13,8 @@
|
||||
#import "YooseeNextConnectViewController.h"
|
||||
#import "SecondConnectWifiController.h"
|
||||
#import "IfishHotBarVc.h"
|
||||
#import "HitbarWifeVc.h"
|
||||
#import "SVProgressHUD.h"
|
||||
|
||||
|
||||
@interface IfishBindDeviceSelectViewController ()<UITableViewDelegate,UITableViewDataSource>
|
||||
@@ -28,21 +30,22 @@ extern BOOL isfromCameraView;
|
||||
// Do any additional setup after loading the view.
|
||||
[self addTitleViewWithTitle:@"选择设备"];
|
||||
[self creatTab];
|
||||
[self loginGewell];
|
||||
}
|
||||
|
||||
-(void)viewDidAppear:(BOOL)animated{
|
||||
[super viewDidAppear:animated];
|
||||
[self loginGewell];
|
||||
if( _islogInGewell){
|
||||
|
||||
NSLog(@"p2pConnect success.成功,你可以操作设备了");
|
||||
|
||||
}else{//new added
|
||||
[self loginGewell];
|
||||
NSLog(@"p2pConnect failure.失败,你将不能操作设备");
|
||||
|
||||
return;
|
||||
}
|
||||
// [self loginGewell];
|
||||
// if( _islogInGewell){
|
||||
//
|
||||
// NSLog(@"p2pConnect success.成功,你可以操作设备了");
|
||||
//
|
||||
// }else{//new added
|
||||
// [self loginGewell];
|
||||
// NSLog(@"p2pConnect failure.失败,你将不能操作设备");
|
||||
//
|
||||
//// return;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -51,14 +54,14 @@ extern BOOL isfromCameraView;
|
||||
//CGPoint curentpoint= [self.cardScrollView contentOffsetWithIndex:[self.cardScrollView currentCard]];
|
||||
//[self.cardScrollView.scrollView setContentOffset:curentpoint animated:NO];
|
||||
|
||||
[self loginGewell];
|
||||
// [self loginGewell];
|
||||
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - loginGewell
|
||||
-(void)loginGewell{
|
||||
|
||||
[SVProgressHUD showWithMaskType:SVProgressHUDMaskTypeBlack];
|
||||
[[UDPManager sharedDefault] ScanLanDevice];
|
||||
|
||||
_islogInGewell = NO;
|
||||
@@ -88,7 +91,24 @@ extern BOOL isfromCameraView;
|
||||
return;
|
||||
}
|
||||
|
||||
_islogInGewell = [[P2PClient sharedClient] p2pConnectWithId:userIDName codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2];
|
||||
|
||||
dispatch_queue_t queue = dispatch_queue_create("net.bujige.testQueue", DISPATCH_QUEUE_CONCURRENT);
|
||||
|
||||
dispatch_async(queue, ^{
|
||||
// 追加任务1
|
||||
[[P2PClient sharedClient] p2pConnectWithId:userIDName codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2];
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
|
||||
[SVProgressHUD dismiss];
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -129,7 +149,9 @@ extern BOOL isfromCameraView;
|
||||
}
|
||||
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
|
||||
if(self.view.frame.size.width<=340.0){
|
||||
return self.view.frame.size.width*0.304;
|
||||
}
|
||||
return self.view.frame.size.width*0.504;
|
||||
|
||||
}
|
||||
@@ -207,6 +229,7 @@ extern BOOL isfromCameraView;
|
||||
self.hidesBottomBarWhenPushed = YES;
|
||||
|
||||
SecondConnectWifiController *wifivc=[[SecondConnectWifiController alloc]init];
|
||||
wifivc.vcTitle=@"连接水族箱";
|
||||
[self.navigationController pushViewController:wifivc animated:YES];
|
||||
|
||||
|
||||
@@ -214,10 +237,15 @@ extern BOOL isfromCameraView;
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
|
||||
self.hidesBottomBarWhenPushed = YES;
|
||||
|
||||
SecondConnectWifiController *wifivc=[[SecondConnectWifiController alloc]init];
|
||||
wifivc.vcTitle=@"连接加热器";
|
||||
[self.navigationController pushViewController:wifivc animated:YES];
|
||||
// [wifivc addTitleViewWithTitle:@"连接加热器"];
|
||||
//[self.view makeToast:@"敬请期待"]; 加热棒
|
||||
IfishHotBarVc*barVc=[[IfishHotBarVc alloc]init];
|
||||
barVc.hidesBottomBarWhenPushed=YES;
|
||||
[self.navigationController pushViewController:barVc animated:YES];
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -79,6 +79,7 @@
|
||||
@property (nonatomic,strong) NSMutableArray *goodsArr;
|
||||
@property (nonatomic,strong) MBProgressHUD *progressHud;
|
||||
@property (nonatomic,strong) UILabel *mesglabel;
|
||||
@property(nonatomic,assign)NSInteger curDeviceIdx;
|
||||
//@property (nonatomic,strong) UIView *redView;
|
||||
@end
|
||||
|
||||
@@ -100,6 +101,17 @@
|
||||
[self addDataRequestQueue];
|
||||
[[NIMSDK sharedSDK].systemNotificationManager addDelegate:self];
|
||||
[[NIMSDK sharedSDK].conversationManager addDelegate:self];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deleteCurDevice) name:@"DeleteCurDevice" object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateDevice) name:@"updateDevice" object:nil];
|
||||
}
|
||||
|
||||
-(void)updateDevice{
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
-(void)dealloc{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"DeleteCurDevice" object:nil];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"updateDevice" object:nil];
|
||||
}
|
||||
|
||||
-(void)addDataRequestQueue
|
||||
@@ -1135,7 +1147,7 @@
|
||||
|
||||
}
|
||||
FormatTankAddCamera *model =self.totalArr[indexPath.row];
|
||||
|
||||
self.curDeviceIdx=indexPath.row;
|
||||
if (!model) {
|
||||
|
||||
return;
|
||||
@@ -1420,6 +1432,55 @@
|
||||
[weakSelf.view makeToast:@"请求异常"];
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark---删除当前缓存设备
|
||||
-(void)deleteCurDevice{
|
||||
FormatTankAddCamera *deviceListModel =self.totalArr[self.curDeviceIdx];
|
||||
NSMutableArray *guanxiiArr= [[DataCenter defaultDtacenter] valueForKey:@"devicamerArr"];
|
||||
|
||||
for (DeviceCameraModel *model in guanxiiArr) {
|
||||
|
||||
if (deviceListModel.device.deviceId == model.deviceId ) {
|
||||
|
||||
[guanxiiArr removeObject:model];
|
||||
//保存新关系数组
|
||||
[[DataCenter defaultDtacenter] setValue:guanxiiArr forKey:@"devicamerArr"];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//重置数据
|
||||
NSArray*deviceArry=[[DataCenter defaultDtacenter]valueForKey:@"deviceInfo"];
|
||||
NSMutableArray *newArr = [NSMutableArray arrayWithArray:deviceArry];
|
||||
|
||||
for (DeviceModel *model in deviceArry) {
|
||||
|
||||
if ([model.deviceId isEqual:deviceListModel.device.deviceId]) {
|
||||
|
||||
[newArr removeObject:model];
|
||||
}
|
||||
}
|
||||
|
||||
[[DataCenter defaultDtacenter] setValue: newArr forKey:@"deviceInfo"];
|
||||
[self.totalArr removeObjectAtIndex:self.curDeviceIdx];
|
||||
NSIndexPath*indexPath=[NSIndexPath indexPathForRow:self.curDeviceIdx inSection:0];
|
||||
[self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationRight];
|
||||
//GCD中的dispatch_after 实现单次的延时调用 dispatch_time的单位是纳秒,为防止用户使用时候的出现换算上的错误,Xcode在开发者打dispatch_after的时候会自动补全下面一整段代码
|
||||
//dispatch_after是延迟提交,不是延迟运行
|
||||
//NSEC:纳秒。
|
||||
//USEC:微妙。
|
||||
//SEC:秒
|
||||
//PER:每
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[self.tableView reloadData];
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - 商品列表加载
|
||||
-(void)loadGoodsData{
|
||||
__weak typeof (self)weskSelf=self;
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user