宠物店修改

This commit is contained in:
kai60
2020-05-02 14:56:49 +08:00
parent 8fca79324a
commit 53f06fcf43
100 changed files with 2672 additions and 198 deletions
@@ -124,7 +124,7 @@ Assign BOOL isGoChangeWiFi;//更换为设备的WiFi
[self.view makeToast:@"请先连接设备热点"];
return;
}
if ([wifiName rangeOfString:@"ifish"].location!=NSNotFound||[wifiName rangeOfString:@"GW"].location!=NSNotFound) {
if ([wifiName rangeOfString:@"ifish"].location!=NSNotFound||[wifiName rangeOfString:@"GW"].location!=NSNotFound||[wifiName isEqualToString:@"WLAN"]) {
//wifi正确,则尝试连接设备
if(self.deviceType==DEVICECAMERA)
{
@@ -141,6 +141,7 @@ Assign BOOL isGoChangeWiFi;//更换为设备的WiFi
connecting.bssid = self.bssid;
connecting.wifiName = self.wifiName;
connecting.wifiPassword = self.wifiPwd;
connecting.deviceType=self.deviceType;
[self.navigationController pushViewController:connecting animated:YES];
}
@@ -79,7 +79,7 @@ Strong UILabel *subTitleLabel;
-(void)buttonClick:(UIButton *)sender{
self.hidesBottomBarWhenPushed = YES;
if (sender.tag==0) {
//智能连接
if (self.deviceType==DEVICECAMERA)
{
YooseeNextConnectViewController *nextvc=[[YooseeNextConnectViewController alloc] init];
@@ -95,7 +95,7 @@ Strong UILabel *subTitleLabel;
[self.navigationController pushViewController:wifivc animated:YES];
}
//热点链接
}else{
ConAquarNowWiFiPwdVC *vc = InitObject(ConAquarNowWiFiPwdVC);
vc.deviceType=self.deviceType;
@@ -7,6 +7,8 @@
//
#import "BaseViewController.h"
#import "StoreNameView.h"
#import "DXPopover.h"
NS_ASSUME_NONNULL_BEGIN
@@ -20,6 +22,9 @@ Copy NSString *ssid;
Copy NSString *bssid;
//界面复用 设备类型
@property (assign, nonatomic) SmartDeviceType deviceType;
@property (nonatomic, strong) UIView *mask;
@property (nonatomic, strong) StoreNameView *storeNameView;
@property (nonatomic, strong) NSString *storeName;
@end
NS_ASSUME_NONNULL_END
@@ -14,6 +14,7 @@
#import "ESPTouchResult.h"
#import "ESPTouchTask.h"
#import "IfishDataUnity.h"
#import "MyMD5.h"
#import <GWP2P/GWP2P.h>
@interface ConnectingAquarVC ()<IFishHotpotUDPHelperDelegate>
Strong HKPieChartView *progressView;
@@ -67,6 +68,7 @@ Copy NSString *deviceId;
// // Do any additional setup after loading the view.
self.timer = [NSTimer timerWithTimeInterval:1 target:self selector:@selector(timerAction) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes];
[self showStoreNameView];
}
//AP模式配网
@@ -263,7 +265,7 @@ Copy NSString *deviceId;
BOOL networkOk = NO;
AFNetworkReachabilityStatus status = [AFNetworkReachabilityManager sharedManager].networkReachabilityStatus;
if (status == AFNetworkReachabilityStatusReachableViaWiFi) {
if (status == AFNetworkReachabilityStatusReachableViaWiFi||status == AFNetworkReachabilityStatusUnknown) {
if (![[self currentWifiSSID].lowercaseString hasPrefix:@"ifish"]) {
networkOk = YES;
}
@@ -285,9 +287,20 @@ Copy NSString *deviceId;
self.bindTimer = nil;
}
self.retryTimes = 0;
[self bindDeviceWithSsid:self.macAddress];
if (self.deviceType==DEVICEPETS)
{
[self showStoreNameView];
}
else
{
[self bindDeviceWithSsid:self.macAddress];
}
}
- (void)udpHelperMessage:(NSString *)msg {
self.HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
self.HUD.mode = MBProgressHUDModeIndeterminate;
@@ -298,6 +311,55 @@ Copy NSString *deviceId;
[self.timer invalidate];
self.timer = nil;
}
-(UIView *)mask
{
if (!_mask)
{
UIView*mask=[[UIView alloc]initWithFrame:self.view.bounds];
mask.backgroundColor=[UIColor lightGrayColor];
mask.alpha=0.5;
_mask=mask;
UITapGestureRecognizer*tap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(dismissStore)];
[mask addGestureRecognizer:tap];
}
return _mask;
}
-(void)dismissStore
{
[self.storeNameView removeFromSuperview];
[self.mask removeFromSuperview];
[self.progressView endProgressWithString:@"绑定已经取消..."];
}
-(void)showStoreNameView
{
[self.HUD hide:YES];
[self.storeNameView removeFromSuperview];
StoreNameView*store=[[[NSBundle mainBundle] loadNibNamed:@"StoreNameView" owner:self options:nil] lastObject];
store.frame=CGRectMake((SCREEN_WIDTH-280)/2.0, 100, 280, 280);
self.storeNameView=store;
WEAK_SELF;
store.cancelBlock=^(){
[weakSelf.mask removeFromSuperview];
[weakSelf.storeNameView removeFromSuperview];
[weakSelf.HUD show:YES];
[weakSelf.progressView endProgressWithString:@"绑定已经取消..."];
};
store.sureBlock=^(NSString*name)
{
[weakSelf.mask removeFromSuperview];
[weakSelf.storeNameView removeFromSuperview];
weakSelf.storeName=name;
[self bindDeviceWithSsid:self.macAddress];
[weakSelf.HUD show:YES];
};
[self.view addSubview:self.mask];
[self.view addSubview:self.storeNameView];
}
#pragma mark - bind
-(void)bindDeviceWithSsid:(NSString*)bssid{
NSLog(@"设备bssid_%@",bssid);
@@ -306,7 +368,21 @@ Copy NSString *deviceId;
self.HUD.labelText = @"正在绑定设备";
[self appendTrakContent:[NSString stringWithFormat:@"绑定参数 userID:%@", userId]];
[self appendTrakContent:[NSString stringWithFormat:@"绑定参数 macaddress:%@", bssid]];
[AFHttpTool bindDeviceWithUserId:userId macAddress:bssid success:^(id response) {
NSString*url=[NSString stringWithFormat:@"%@%@",kBindDevice,userId];
NSMutableDictionary*bind=[[NSMutableDictionary alloc]initWithDictionary:@{@"macAddress":bssid}];
NSString* timestamp=[NSString stringWithFormat:@"%lld",[[NSDate date] timeIntervalSince1970]*1000];
NSString*token=[MyMD5 md5:[NSString stringWithFormat:@"%@%@ifish8",userId,timestamp]];
if (self.deviceType==DEVICEPETS)
{
url=[NSString stringWithFormat:@"%@",[NSString stringWithFormat:@"%@/api/user/bindPetDevice.do",JIEKOUPORT]];
bind[@"token"]=token;
bind[@"timestamp"]=timestamp;
bind[@"storeName"]=self.storeName.length?self.storeName:@"宠物店";
bind[@"userId"]=userId;
}
[AFHttpTool requestWihtMethod:RequestMethodTypePost url:url params:bind success:^(id response) {
[self endProgress];
self.isBindingDevice = NO;
self.macAddress = nil;