开发版本-developer——01 first commit

This commit is contained in:
wbzhan
2019-07-08 18:24:03 +08:00
parent 5a10dfa182
commit 8693efe121
386 changed files with 7069 additions and 1951 deletions
@@ -10,6 +10,10 @@
#import "ShopKanHuP2PViewController.h"
#import "IfishKankanListModel.h"
#import "P2PShareViewBootomView.h"
/**
观看鱼友直播内容
*/
@interface IfishP2PLivePlayViewController : ShopKanHuP2PViewController
@property(nonatomic,strong) P2PShareViewBootomView * subHbottomView;
@@ -20,11 +20,6 @@
[super viewDidLoad];
// Do any additional setup after loading the view.
[self addTitleViewWithTitle:@"分享中"];
//自定义封装播放器 由于xib创建OPGLview 无法显示(暂未找到方法)暂时不用 纯代码建UI可以试试
//[self setupVideoPlayView];
//现采用继承ShopKanHuP2PViewController 替换底部 HbootmView
// self.HbootmView.hidden= YES;
self.view.backgroundColor = TABLE_BACKGROUD_COLOR;
[self resetBootomView];
@@ -11,7 +11,7 @@
#import "ProgressImageView.h"
#import "OpenGLView.h"
#import "TouchButton.h"
#import<GWP2P/GWP2P.h>
#import "CustomBorderButton.h"
#import "CustomView.h"
#define FocalLength_Elongation_btnTag 300
@@ -8,6 +8,9 @@
#import "BaseViewController.h"
/**
首页点击添加设备进入此添加设备页面
*/
@interface IfishBindDeviceSelectViewController : BaseViewController
@end
@@ -8,7 +8,7 @@
#import "IfishBindDeviceSelectViewController.h"
#import "FishSelectDeviceListViewCell.h"
#import "P2PClient.h"
#import <GWP2P/GWP2P.h>
#import "UDPManager.h"
#import "YooseeNextConnectViewController.h"
#import "SecondConnectWifiController.h"
@@ -19,7 +19,6 @@
@interface IfishBindDeviceSelectViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong) UITableView *tableView;
@property(nonatomic)BOOL islogInGewell;
@end
extern BOOL isfromCameraView;
@implementation IfishBindDeviceSelectViewController
@@ -30,49 +29,23 @@ extern BOOL isfromCameraView;
// Do any additional setup after loading the view.
[self addTitleViewWithTitle:@"选择设备"];
[self creatTab];
[self loginGewell];
[self loginGWP2P];
}
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
// [self loginGewell];
// if( _islogInGewell){
//
// NSLog(@"p2pConnect success.成功,你可以操作设备了");
//
// }else{//new added
// [self loginGewell];
// NSLog(@"p2pConnect failure.失败,你将不能操作设备");
//
//// return;
// }
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
//CGPoint curentpoint= [self.cardScrollView contentOffsetWithIndex:[self.cardScrollView currentCard]];
//[self.cardScrollView.scrollView setContentOffset:curentpoint animated:NO];
// [self loginGewell];
}
#pragma mark - loginGewell
-(void)loginGewell{
#pragma mark - loginGWP2P
-(void)loginGWP2P{
[SVProgressHUD showWithMaskType:SVProgressHUDMaskTypeBlack];
[[UDPManager sharedDefault] ScanLanDevice];
_islogInGewell = NO;
// LoginResult *loginResult = [UDManager getLoginInfo];
// NSString * P2PVerifyCode1 = @"1528438234";
// NSString * P2PVerifyCode2 = @"992805759";
// NSString *UserID = @"-2144354932";
UserModel *model=[dataContorl getUserInfo];
NSString *userIDName=[NSString stringWithFormat:@"%d",(int)[model.gwellUserID integerValue]&0x7fffffff];
NSLog(@"%@%@%@",userIDName,model.P2PVerifyCode1,model.P2PVerifyCode2);
@@ -95,8 +68,8 @@ extern BOOL isfromCameraView;
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];
// // 追加任务1
// self.islogInGewell = [[GWP2PClient sharedClient] connectWithAccount:userIDName codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2 sessionID1:model.sessionID sessionID2:model.sessionID2 customerIDs:nil];
dispatch_async(dispatch_get_main_queue(), ^{
@@ -165,35 +138,24 @@ extern BOOL isfromCameraView;
//wifi环境下转跳下一界面
switch (indexPath.row) {
case 0:
{
//摄像头
NSArray * cameraArr =[[DataCenter defaultDtacenter]valueForKey:@"cameraArr"];
if ([cameraArr count]>=5) {
[self.view makeToast:@"设备已达上线限"];
[self.view makeToast:@"设备已达上限"];
return;
}
if ( self.islogInGewell) {
if ( [GWP2PClient sharedClient].linkStatus==P2PLinkStatusOK) {
self.hidesBottomBarWhenPushed = YES;
YooseeNextConnectViewController *nextvc=[[YooseeNextConnectViewController alloc] init];
[self.navigationController pushViewController:nextvc animated:YES];
nextvc.conectType = 0;
}else{
UserModel *model=[dataContorl getUserInfo];
[self loginGewellWith:model];
}
}
break;
case 1:
@@ -204,7 +166,7 @@ extern BOOL isfromCameraView;
if ([deviceArr count]>=5) {
[self.view makeToast:@"设备已达上线"];
[self.view makeToast:@"设备已达上限"];
return;
}
@@ -245,13 +207,13 @@ extern BOOL isfromCameraView;
}
-(void)loginGewellWith:(UserModel *)model;
-(void)loginGewellWith:(UserModel *)model
{
NSString *userIDName=[NSString stringWithFormat:@"%d",(int)[model.gwellUserID integerValue]&0x7fffffff];
NSString *accountId =[NSString stringWithFormat:@"%d",(int)[model.gwellUserID integerValue]&0x7fffffff];
if ([userIDName isEqualToString:@"0"]) {
if ([accountId isEqualToString:@"0"]) {
[self.view makeToast:@"暂未检测到设备"];
@@ -266,10 +228,11 @@ extern BOOL isfromCameraView;
[self.view makeToast:@"暂未检测到设备"];
return;
}
self.islogInGewell = [[P2PClient sharedClient] p2pConnectWithId:userIDName codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2];
if ([GWP2PClient sharedClient]!=P2PLinkStatusOK) {
[[GWP2PClient sharedClient] connectWithAccount:accountId codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2 sessionID1:model.sessionID sessionID2:model.sessionID2 customerIDs:nil];
}
//loginResult.contactId 用户ID号
NSLog(@"%@%@%@",userIDName,model.P2PVerifyCode1,model.P2PVerifyCode2);
NSLog(@"%@%@%@",accountId,model.P2PVerifyCode1,model.P2PVerifyCode2,model.sessionID,model.sessionID2);
}
@@ -1158,6 +1158,7 @@ Assign NSInteger messageCount;//消息个数
//切换时主动 断开 soket
[[Socketsingleton sharedInstance] cutOffSocket];
//进入摄像头页面
IfishP2PMonitorController *p2pVC=[[IfishP2PMonitorController alloc] init];
p2pVC.contact = model.camera;
UINavigationController *nav=[[UINavigationController alloc] initWithRootViewController:p2pVC];
@@ -1,14 +0,0 @@
//
// IfishSelectCardViewController.h
// ShotViewAnimation
//
// Created by imac on 16/10/25.
// Copyright © 2016年 xiang. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "BaseViewController.h"
//v4.4 之前版本界面 滑动选项卡选择绑定设备类型
@interface IfishSelectCardViewController : BaseViewController
@end
@@ -1,375 +0,0 @@
//
// IfishSelectCardViewController.m
// ShotViewAnimation
//
// Created by imac on 16/10/25.
// Copyright © 2016年 xiang. All rights reserved.
//
#import "IfishSelectCardViewController.h"
#import "IfishCardScrollView.h"
#import "Reachability.h"
/**
* color config
*/
#define GCUIColorFromRGB(rgbValue) \
[UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16)) / 255.0 \
green:((float)((rgbValue & 0xFF00) >> 8)) / 255.0 \
blue:((float)(rgbValue & 0xFF)) / 255.0 \
alpha:1.0]
#define kGCCardRatio 0.8
#define kGCCardWidth CGRectGetWidth(self.view.frame)*kGCCardRatio
#define kGCCardHeight kGCCardWidth/kGCCardRatio
#import "SecondConnectWifiController.h"
#import "UDPManager.h"
#import "UDManager.h"
#import "LoginResult.h"
#import "P2PClient.h"
#import "AFNetworking.h"
#import "YooseeNextConnectViewController.h"
@interface IfishSelectCardViewController ()<CardScrollViewDelegate,CardScrollViewDataSource>
@property (nonatomic, strong) IfishCardScrollView *cardScrollView;
@property (nonatomic, strong) NSMutableArray *cards;
@property (nonatomic, strong) NSArray *cardsImg;
@property(nonatomic)BOOL islogInGewell;
@end
extern BOOL isfromCameraView;
@implementation IfishSelectCardViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
// 添加鱼缸设备不是来自摄像头界面
isfromCameraView = NO;
[self addTitleViewWithTitle:@"选择设备"];
self.view.backgroundColor = COLOR_MIAN;
self.cardScrollView = [[IfishCardScrollView alloc] initWithFrame:CGRectMake(0,0, self.view.frame.size.width, self.view.frame.size.height)];
self.cardScrollView.cardDelegate = self;
self.cardScrollView.cardDataSource = self;
[self.view addSubview:self.cardScrollView];
self.cards = [NSMutableArray array];
for (NSInteger i = 0; i < 2; i++) {
[self.cards addObject:@(i)];
}
self.cardsImg = @[@"equipment_background",@"equipment_background_camera"];
self.automaticallyAdjustsScrollViewInsets = NO;
}
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
[self loginGewell];
if( _islogInGewell){
NSLog(@"p2pConnect success.成功,你可以操作设备了");
}else{//new added
[self loginGewell];
NSLog(@"p2pConnect failure.失败,你将不能操作设备");
return;
}
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
//CGPoint curentpoint= [self.cardScrollView contentOffsetWithIndex:[self.cardScrollView currentCard]];
//[self.cardScrollView.scrollView setContentOffset:curentpoint animated:NO];
[self loginGewell];
}
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
[self.cardScrollView loadCard];
}
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
}
-(void)goBackAction{
//充血返回事件 防止在选择水族箱 时 返回卡顿
[self.cardScrollView.scrollView setContentOffset:CGPointMake(0, 0) animated:NO];
[self.navigationController popViewControllerAnimated:YES];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - CardScrollViewDelegate
- (void)updateCard:(UIView *)card withProgress:(CGFloat)progress direction:(CardMoveDirection)direction {
if (direction == CardMoveDirectionNone) {
if (card.tag != [self.cardScrollView currentCard]) {
CGFloat scale = 1 - 0.1 * progress;
card.layer.transform = CATransform3DMakeScale(scale, scale, 1.0);
card.layer.opacity = 1 - 0.2*progress;
} else {
card.layer.transform = CATransform3DIdentity;
card.layer.opacity = 1;
}
} else {
NSInteger transCardTag = direction == CardMoveDirectionLeft ? [self.cardScrollView currentCard] + 1 : [self.cardScrollView currentCard] - 1;
if (card.tag != [self.cardScrollView currentCard] && card.tag == transCardTag) {
card.layer.transform = CATransform3DMakeScale(0.9 + 0.1*progress, 0.9 + 0.1*progress, 1.0);
card.layer.opacity = 0.8 + 0.2*progress;
} else if (card.tag == [self.cardScrollView currentCard]) {
card.layer.transform = CATransform3DMakeScale(1 - 0.1 * progress, 1 - 0.1 * progress, 1.0);
card.layer.opacity = 1 - 0.2*progress;
}
}
}
#pragma mark - CardScrollViewDataSource
- (NSInteger)numberOfCards {
return self.cards.count;
}
- (UIView *)cardReuseView:(UIView *)reuseView atIndex:(NSInteger)index {
if (reuseView) {
// you can set new style
return reuseView;
}
// UIView *card = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kGCCardWidth * 0.9, kGCCardHeight)];
// card.layer.backgroundColor = [UIColor whiteColor].CGColor;
// card.layer.cornerRadius = 4;
// card.layer.masksToBounds = YES;
UIView *card = [[UIView alloc] initWithFrame:CGRectMake(0, 0,kGCCardWidth * 0.9, kGCCardWidth * 0.9 *1.55)];
card.layer.backgroundColor = [UIColor whiteColor].CGColor;
card.layer.cornerRadius = 4;
card.layer.masksToBounds = YES;
UIImageView *cardImgView = [[UIImageView alloc] initWithFrame:CGRectMake(0 , 0, kGCCardWidth * 0.9, kGCCardWidth * 0.9 *1.55)];
NSString *imagename=self.cardsImg[index];
cardImgView.image = [UIImage imageNamed:imagename];
cardImgView.userInteractionEnabled = YES;
[card addSubview:cardImgView];
//前往绑定按钮
CGFloat qianWangBtnW = kGCCardWidth * 0.9 - 20*2;
CGFloat qianWangBtnY = kGCCardWidth * 0.9 *1.55 - 20 -qianWangBtnW *0.18;
UIButton *qianWangBtn=[UIButton buttonWithType:UIButtonTypeCustom];
qianWangBtn.frame = CGRectMake(CGRectGetMaxX(cardImgView.frame)/2 - qianWangBtnW/2, qianWangBtnY, qianWangBtnW , qianWangBtnW *0.18);
[qianWangBtn setTitle:@"前往绑定" forState:UIControlStateNormal];
[qianWangBtn addTarget:self action:@selector(qianWangBtnAction:) forControlEvents:UIControlEventTouchUpInside];
qianWangBtn.tag = index *100;
// qianWangBtn.layer.masksToBounds = YES;
// qianWangBtn.layer.cornerRadius = 5;
[qianWangBtn setBackgroundImage:[UIImage imageNamed:@"equipment_button"] forState:UIControlStateNormal];
[cardImgView addSubview:qianWangBtn];
return card;
}
-(void)qianWangBtnAction:(UIButton *)btn{
[self testwifiWithBtn:btn];
}
/**
* 检测是否wifi环境
*/
-(void)testwifiWithBtn:(UIButton *)btn{
Reachability *currReach = [Reachability reachabilityForLocalWiFi];
NetworkStatus status = [currReach currentReachabilityStatus];
NSLog(@"NetworkStatus%ld", (long)status);
if (status==AFNetworkReachabilityStatusReachableViaWiFi) {
//wifi环境下转跳下一界面
switch (btn.tag) {
case 0:
{
//水族箱
NSArray * deviceArr =[[DataCenter defaultDtacenter]valueForKey:@"deviceInfo"];
if ([deviceArr count]>=5) {
[self.view makeToast:@"设备已达上线限"];
return;
}
self.hidesBottomBarWhenPushed = YES;
SecondConnectWifiController*wifivc=[[SecondConnectWifiController alloc]init];
[self.navigationController pushViewController:wifivc animated:YES];
}
break;
case 100:
{
//摄像头
NSArray * cameraArr =[[DataCenter defaultDtacenter]valueForKey:@"cameraArr"];
if ([cameraArr count]>=5) {
[self.view makeToast:@"设备已达上线限"];
return;
}
if ( self.islogInGewell) {
self.hidesBottomBarWhenPushed = YES;
YooseeNextConnectViewController *nextvc=[[YooseeNextConnectViewController alloc] init];
[self.navigationController pushViewController:nextvc animated:YES];
nextvc.conectType = 0;
}else{
UserModel *model=[dataContorl getUserInfo];
[self loginGewellWith:model];
}
}
break;
default:
break;
}
}else{
[self.view makeToast:@"请切换到WiFi环境下绑定"];
}
}
-(void)loginGewellWith:(UserModel *)model;
{
NSString *userIDName=[NSString stringWithFormat:@"%d",(int)[model.gwellUserID integerValue]&0x7fffffff];
if ([userIDName isEqualToString:@"0"]) {
[self.view makeToast:@"暂未检测到设备"];
//请求GewellCodes
//[self getGewellCodes];
return;
}
if ([model.P2PVerifyCode1 isEqualToString:@""]) {
[self.view makeToast:@"暂未检测到设备"];
return;
}
if ([model.P2PVerifyCode2 isEqualToString:@""]) {
[self.view makeToast:@"暂未检测到设备"];
return;
}
self.islogInGewell = [[P2PClient sharedClient] p2pConnectWithId:userIDName codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2];
//loginResult.contactId 用户ID号
NSLog(@"%@%@%@",userIDName,model.P2PVerifyCode1,model.P2PVerifyCode2);
}
#pragma mark - loginGewell
-(void)loginGewell{
[[UDPManager sharedDefault] ScanLanDevice];
_islogInGewell = NO;
// LoginResult *loginResult = [UDManager getLoginInfo];
// NSString * P2PVerifyCode1 = @"1528438234";
// NSString * P2PVerifyCode2 = @"992805759";
// NSString *UserID = @"-2144354932";
UserModel *model=[dataContorl getUserInfo];
NSString *userIDName=[NSString stringWithFormat:@"%d",(int)[model.gwellUserID integerValue]&0x7fffffff];
NSLog(@"%@%@%@",userIDName,model.P2PVerifyCode1,model.P2PVerifyCode2);
if ([userIDName isEqualToString:@"0"]) {
//
[self.view makeToast:@"摄像头用户名空错误码10001"];
return;
}
if ([model.P2PVerifyCode1 isEqualToString:@""]) {
[self.view makeToast:@"摄像头P2PVerifyCode1空错误码10002"];
return;
}
if ([model.P2PVerifyCode2 isEqualToString:@""]) {
[self.view makeToast:@"摄像头P2PVerifyCode2空错误码10003"];
return;
}
_islogInGewell = [[P2PClient sharedClient] p2pConnectWithId:userIDName codeStr1:model.P2PVerifyCode1 codeStr2:model.P2PVerifyCode2];
}
-(void)getGewellCodes{
[self.view makeToast:@"连接服务器中。。"];
UserModel *model= [dataContorl getUserInfo];
NSString *userid = [NSString stringWithFormat:@"%@",model.userId];
[AFHttpTool getGwellCodes:userid success:^(id response) {
NSDictionary *reDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
NSDictionary *data=reDic[@"data"];
if ([reDic[@"result"] isEqualToString:@"100"]) {
model.P2PVerifyCode1 =data[@"P2PVerifyCode1"];
model.P2PVerifyCode2 =data[@"P2PVerifyCode2"];
model.gwellUserID =data[@"gwellUserID"];
[dataContorl resetUser:model];
[self loginGewellWith:model];
[self.view makeToast:@"连接服务器成功请继续"];
}else{
}
} failure:^(NSError *err) {
NSLog(@"错误err%@",err);
}];
}
//- (void)deleteCardWithIndex:(NSInteger)index {
// [self.cards removeObjectAtIndex:index];
//}
@end