Merge remote-tracking branch 'origin/master'

This commit is contained in:
roy
2018-09-22 21:41:24 +08:00
113 changed files with 5077 additions and 240 deletions
@@ -60,11 +60,8 @@ extern BOOL launchedByNotification;
// Do any additional setup after loading the view.
//[self creatViewControllers];
//[self setUpSubNav];
UIView *backView = [[UIView alloc] initWithFrame:CGRectMake(0, 0,self.view.frame.size.width, self.tabBar.frame.size.height)];
// backView.backgroundColor = TABLE_BAR_COLOR;
backView.backgroundColor = [UIColor whiteColor];
[self.tabBar insertSubview:backView atIndex:0];
self.tabBar.opaque = YES;
self.tabBar.translucent = NO;
[[NIMSDK sharedSDK].systemNotificationManager addDelegate:self];
[[NIMSDK sharedSDK].conversationManager addDelegate:self];
@@ -13,6 +13,8 @@
#import "ChangeSecretCodeController.h"
#define TUICHUAlertTAg 4100
#import "IfishUserDefaultHelper.h"
#import "SettingResetViewController.h"
@interface IfishSetViewController ()<UITableViewDelegate,UITableViewDataSource,UIAlertViewDelegate>
@property(nonatomic,strong)UITableView *tableView;
@@ -32,8 +34,8 @@ extern BOOL firstLogIn;
}
-(void)loadData{
self.titles=@[@[@"更换手机",@"修改密码"],@[@"切换账号"]];
self.imgs = @[@[@"personal_iocn_replace",@"replace_iocn_code"],@[@"personal_iocn_switch"]];
self.titles=@[@[@"更换手机",@"修改密码",@"恢复出厂模式"],@[@"切换账号"]];
self.imgs = @[@[@"personal_iocn_replace",@"replace_iocn_code",@"setting-reset"],@[@"personal_iocn_switch"]];
}
-(void)creatTab{
@@ -61,16 +63,12 @@ extern BOOL firstLogIn;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if (section==1) {
return 1;
}
return 2;
return [self.titles[section] count];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 2;
return self.titles.count;
}
@@ -120,7 +118,12 @@ extern BOOL firstLogIn;
ChangeSecretCodeController *secretVC=[[ChangeSecretCodeController alloc]init];
[self.navigationController pushViewController:secretVC animated:YES];
}else if (indexPath.section==1&&indexPath.row==0){
} else if (indexPath.section == 0 && indexPath.row == 2) {
self.hidesBottomBarWhenPushed = YES;
SettingResetViewController *vc = [[SettingResetViewController alloc] initWithNibName:@"SettingResetViewController" bundle:nil];
vc.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:vc animated:YES];
} else if (indexPath.section==1&&indexPath.row==0){
UIAlertView*alert=[[UIAlertView alloc]initWithTitle:@"提醒" message:@"确认切换账号并重新登录?" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
alert.tag=TUICHUAlertTAg;
@@ -0,0 +1,13 @@
//
// SettingResetViewController.h
// Ifish
//
// Created by Minghao Xue on 2018/7/24.
// Copyright © 2018年 lianlian. All rights reserved.
//
#import "BaseVIewContorller.h"
@interface SettingResetViewController : BaseVIewContorller
@end
@@ -0,0 +1,78 @@
//
// SettingResetViewController.m
// Ifish
//
// Created by Minghao Xue on 2018/7/24.
// Copyright © 2018年 lianlian. All rights reserved.
//
#import "SettingResetViewController.h"
#import "IFishHotpotUDPHelper.h"
#import "ConnectHotspotTipViewController.h"
#import "DeviceCameraModel.h"
#import "DeviceModel.h"
#import "MBProgressHUD.h"
#import<SystemConfiguration/CaptiveNetwork.h>
@interface SettingResetViewController ()<IFishHotpotUDPHelperDelegate>
@property (nonatomic, strong) DeviceModel *currentDevice;
@property (nonatomic, strong) MBProgressHUD *HUD;
@end
@implementation SettingResetViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"恢复出厂设置";
}
- (IBAction)reset:(id)sender {
if (![[self currentWifiSSID].lowercaseString hasPrefix:@"ifish"]) {
[self.view makeToast:@"请先将手机连接到wifi:ifish-xxxx"];
return;
}
self.HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
self.HUD.mode = MBProgressHUDModeIndeterminate;
self.HUD.labelText = @"重置指令已发出";
[IFishHotpotUDPHelper sharedInstance].delegate = self;
[[IFishHotpotUDPHelper sharedInstance] broadCastRestCommand];
}
- (IBAction)tipBtnClicked:(id)sender {
ConnectHotspotTipViewController *vc = [[ConnectHotspotTipViewController alloc] initWithNibName:nil bundle:nil];
[self.navigationController pushViewController:vc animated:YES];
}
#pragma mark - IFishHotpotUDPHelperDelegate
- (void)udpHelperCommandExecutedSuccess:(IFishUDPHelperBackMsgModel *)backModel {
self.HUD.mode = MBProgressHUDModeText;
self.HUD.labelText = @"设备已重置";
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[MBProgressHUD hideHUDForView:self.view animated:YES];
});
}
- (void)udpHelperMessage:(NSString *)msg {
// [self.view makeToast:msg];
}
#pragma mark - 删除设备
- (NSString *)currentWifiSSID {
NSString *ssid = @"Not Found";
CFArrayRef myArray = CNCopySupportedInterfaces();
if (myArray != nil) {
CFDictionaryRef myDict = CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0));
if (myDict != nil) {
NSDictionary *dict = (NSDictionary *)CFBridgingRelease(myDict);
ssid = [dict valueForKey:@"SSID"];
}
}
return ssid;
}
@end
@@ -0,0 +1,151 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="SettingResetViewController">
<connections>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Nsq-Ll-ePn">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Hmh-Qz-g3c">
<rect key="frame" x="0.0" y="35" width="375" height="183"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="1000" image="hotspotconnect" translatesAutoresizingMaskIntoConstraints="NO" id="Y4O-50-CzP">
<rect key="frame" x="21" y="20" width="16" height="16"/>
<constraints>
<constraint firstAttribute="height" constant="16" id="5pg-9H-7gX"/>
<constraint firstAttribute="width" constant="16" id="PqR-kc-gxk"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="特别提醒" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iJA-np-ESy">
<rect key="frame" x="50" y="18.5" width="69.5" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="DBF-b1-8Di" customClass="UIImageView">
<rect key="frame" x="38" y="61" width="299" height="1"/>
<color key="backgroundColor" red="0.77127617390000003" green="0.77127617390000003" blue="0.77127617390000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="scZ-MA-HWy"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="1.请将手机连接至wifi:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="q2B-K0-R3L">
<rect key="frame" x="50" y="78" width="145.5" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ifish-xxxx" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GJv-hc-FLm">
<rect key="frame" x="203" y="78" width="62" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2.恢复出厂参数指令将清除内部保存参数,设备信息、路由器信息、服务器地址、故障记录信息全部被默认设置。" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PwC-sM-vwr">
<rect key="frame" x="50" y="109" width="273" height="54"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hmW-nS-fZt">
<rect key="frame" x="269" y="71.5" width="62" height="30"/>
<color key="backgroundColor" red="0.08235294118" green="0.66274509800000003" blue="0.92156862750000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<state key="normal" title="点击连接">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="8"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="tipBtnClicked:" destination="-1" eventType="touchUpInside" id="hFS-cK-6dp"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="Y4O-50-CzP" firstAttribute="top" secondItem="Hmh-Qz-g3c" secondAttribute="top" constant="20" id="3w0-TD-w7v"/>
<constraint firstItem="GJv-hc-FLm" firstAttribute="centerY" secondItem="q2B-K0-R3L" secondAttribute="centerY" id="6vx-5G-UE1"/>
<constraint firstAttribute="trailing" secondItem="PwC-sM-vwr" secondAttribute="trailing" constant="52" id="AwE-CM-ElH"/>
<constraint firstItem="Y4O-50-CzP" firstAttribute="leading" secondItem="Hmh-Qz-g3c" secondAttribute="leading" constant="21" id="EBe-Ri-fen"/>
<constraint firstItem="hmW-nS-fZt" firstAttribute="leading" secondItem="GJv-hc-FLm" secondAttribute="trailing" constant="4" id="GaC-aT-yv6"/>
<constraint firstItem="GJv-hc-FLm" firstAttribute="leading" secondItem="q2B-K0-R3L" secondAttribute="trailing" constant="8" id="IlM-PV-lN7"/>
<constraint firstItem="DBF-b1-8Di" firstAttribute="leading" secondItem="Hmh-Qz-g3c" secondAttribute="leading" constant="38" id="Jdz-qN-yCS"/>
<constraint firstItem="hmW-nS-fZt" firstAttribute="centerY" secondItem="GJv-hc-FLm" secondAttribute="centerY" id="Lf6-yl-bSc"/>
<constraint firstItem="iJA-np-ESy" firstAttribute="leading" secondItem="Y4O-50-CzP" secondAttribute="trailing" constant="13" id="TeA-Cm-Ly5"/>
<constraint firstItem="q2B-K0-R3L" firstAttribute="top" secondItem="DBF-b1-8Di" secondAttribute="bottom" constant="16" id="XPK-MM-gih"/>
<constraint firstItem="DBF-b1-8Di" firstAttribute="top" secondItem="iJA-np-ESy" secondAttribute="bottom" constant="22" id="YQf-rv-UDW"/>
<constraint firstItem="PwC-sM-vwr" firstAttribute="top" secondItem="q2B-K0-R3L" secondAttribute="bottom" constant="13" id="cRa-RL-IR2"/>
<constraint firstItem="iJA-np-ESy" firstAttribute="centerY" secondItem="Y4O-50-CzP" secondAttribute="centerY" id="dPW-tR-lj7"/>
<constraint firstAttribute="trailing" secondItem="DBF-b1-8Di" secondAttribute="trailing" constant="38" id="dfB-or-nzx"/>
<constraint firstItem="PwC-sM-vwr" firstAttribute="leading" secondItem="q2B-K0-R3L" secondAttribute="leading" id="hhd-Bh-bNq"/>
<constraint firstItem="q2B-K0-R3L" firstAttribute="leading" secondItem="iJA-np-ESy" secondAttribute="leading" id="mqw-CL-bpe"/>
<constraint firstAttribute="bottom" secondItem="PwC-sM-vwr" secondAttribute="bottom" constant="20" id="rOm-yC-cCx"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="aPp-g0-kA2">
<rect key="frame" x="36" y="236" width="303" height="30"/>
<color key="backgroundColor" red="0.08235294118" green="0.66274509800000003" blue="0.92156862750000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="0Fg-MZ-PZd"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<state key="normal" title="确定恢复出厂值"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="4"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="reset:" destination="-1" eventType="touchUpInside" id="XwX-J9-wjl"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="aPp-g0-kA2" secondAttribute="bottom" constant="20" id="8jk-Mm-8jR"/>
<constraint firstItem="aPp-g0-kA2" firstAttribute="leading" secondItem="Nsq-Ll-ePn" secondAttribute="leading" constant="36" id="8mq-HT-uEu"/>
<constraint firstItem="aPp-g0-kA2" firstAttribute="centerX" secondItem="Nsq-Ll-ePn" secondAttribute="centerX" id="CDl-Ks-DXe"/>
<constraint firstItem="aPp-g0-kA2" firstAttribute="top" secondItem="Hmh-Qz-g3c" secondAttribute="bottom" constant="18" id="O21-ss-uRr"/>
<constraint firstItem="aPp-g0-kA2" firstAttribute="leading" secondItem="Nsq-Ll-ePn" secondAttribute="leading" constant="36" id="Qti-A3-6Ze"/>
<constraint firstItem="aPp-g0-kA2" firstAttribute="top" secondItem="Hmh-Qz-g3c" secondAttribute="bottom" constant="18" id="agu-8W-TSh"/>
<constraint firstAttribute="trailing" secondItem="aPp-g0-kA2" secondAttribute="trailing" constant="36" id="cU3-0e-6Zt"/>
<constraint firstAttribute="bottom" secondItem="aPp-g0-kA2" secondAttribute="bottom" constant="20" id="ezh-1n-e2s"/>
<constraint firstAttribute="trailing" secondItem="Hmh-Qz-g3c" secondAttribute="trailing" id="oTL-7I-zey"/>
<constraint firstAttribute="trailing" secondItem="aPp-g0-kA2" secondAttribute="trailing" constant="36" id="s0h-5I-UEp"/>
<constraint firstItem="Hmh-Qz-g3c" firstAttribute="top" secondItem="Nsq-Ll-ePn" secondAttribute="top" constant="35" id="svA-gP-NZU"/>
<constraint firstItem="Hmh-Qz-g3c" firstAttribute="leading" secondItem="Nsq-Ll-ePn" secondAttribute="leading" id="utL-HY-TdK"/>
</constraints>
</scrollView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="Nsq-Ll-ePn" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="IVk-jR-n3v"/>
<constraint firstAttribute="bottom" secondItem="Nsq-Ll-ePn" secondAttribute="bottom" id="JCo-ME-iHx"/>
<constraint firstItem="Nsq-Ll-ePn" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="eqr-XM-Yop"/>
<constraint firstAttribute="trailing" secondItem="Nsq-Ll-ePn" secondAttribute="trailing" id="sea-0V-d5J"/>
</constraints>
</view>
</objects>
<resources>
<image name="hotspotconnect" width="19" height="17"/>
</resources>
</document>
@@ -25,7 +25,12 @@
// CFShow((__bridge CFTypeRef)(infoDic));
NSString *app_Version=[infoDic objectForKey:@"CFBundleShortVersionString"];
NSLog(@"app_Version%@",app_Version);
self.versionLabel.text=[NSString stringWithFormat:@"v%@",app_Version];
NSString *versionStr = [NSString stringWithFormat:@"v%@",app_Version];
NSString *buildVersion = [infoDic objectForKey:@"CFBundleVersion"];
if (buildVersion.length > 0) {
versionStr = [versionStr stringByAppendingString:[NSString stringWithFormat:@"(%@)", buildVersion]];
}
self.versionLabel.text=versionStr;
//build 版本
// NSString *app_build=[infoDic objectForKey:@"CFBundleVersion"];
@@ -28,7 +28,7 @@
-(void)broadCaseUDP{
self.loopTimer = [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(sendLoopSoketdata) userInfo:nil repeats:YES];
self.loopTimer = [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(sendConnectHotspotSoketdata) userInfo:nil repeats:YES];
}
@@ -80,8 +80,9 @@
pageController.selectIndex = 0;
//pageController.menuViewBottomSpace = 10;
[self addChildViewController: pageController];
CGFloat height = [UIApplication sharedApplication].statusBarFrame.size.height + 44;
//看看在tab中时
pageController.viewFrame = CGRectMake(0,64,self.view.frame.size.width, self.view.frame.size.height - 64) ;
pageController.viewFrame = CGRectMake(0,height,self.view.frame.size.width, self.view.frame.size.height - height) ;
self.pageController = pageController;
[self.view addSubview: pageController.view];
@@ -143,7 +143,7 @@ NIMContactSelectDelegate
//
UIButton *bakbutton = [UIButton buttonWithType:UIButtonTypeCustom];
bakbutton.frame = CGRectMake(0,0,48,44);
[bakbutton setImage:[UIImage imageNamed:@"arrow_l"] forState:UIControlStateNormal];
[bakbutton setImage:[UIImage imageNamed:@"back_btn"] forState:UIControlStateNormal];
[bakbutton addTarget: self action: @selector(goBackAction) forControlEvents: UIControlEventTouchUpInside];
@@ -91,7 +91,7 @@
//tab栏中时设置返回按钮
UIButton *bakbutton = [UIButton buttonWithType:UIButtonTypeCustom];
bakbutton.frame = CGRectMake(0,0,48,44);
[bakbutton setImage:[UIImage imageNamed:@"arrow_l"] forState:UIControlStateNormal];
[bakbutton setImage:[UIImage imageNamed:@"back_btn"] forState:UIControlStateNormal];
[bakbutton addTarget: self action: @selector(backAction) forControlEvents: UIControlEventTouchUpInside];
@@ -688,6 +688,9 @@
[self.tableView addGestureRecognizer:longpress];
_scrollHeight = 64;
if (@available(iOS 11.0, *)) {
self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
}
-(void)addLongPressGesture:(UILongPressGestureRecognizer *)guesture