|
|
|
//
|
|
|
|
// baseViewController.m
|
|
|
|
// tianyin
|
|
|
|
//
|
|
|
|
// Created by xTT on 15/5/28.
|
|
|
|
// Copyright (c) 2015年 xTT. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#import "baseViewController.h"
|
|
|
|
|
|
|
|
#import "AppDelegate.h"
|
|
|
|
#import "MessageViewController.h"
|
|
|
|
#import "CallViewController.h"
|
|
|
|
//三个 消息页面
|
|
|
|
#import "AttentionMessageViewController.h"
|
|
|
|
#import "SystermMessageViewController.h"
|
|
|
|
#import "RemindMessageViewController.h"
|
|
|
|
#import "RemoteCameraViewController.h"
|
|
|
|
#import "WiFiListViewController.h"
|
|
|
|
|
|
|
|
#import "MyMQTT.h"
|
|
|
|
|
|
|
|
// 菊风视频
|
|
|
|
#import "JCManager.h"
|
|
|
|
#import "BRManager.h"
|
|
|
|
#import "TihuManager.h"
|
|
|
|
|
|
|
|
/// 判断字符串是否有值
|
|
|
|
#define STRINGHASVALUE(str) (str && [str isKindOfClass:[NSString class]] && [str stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]].length > 0)
|
|
|
|
|
|
|
|
@interface baseViewController ()<DZNEmptyDataSetSource,DZNEmptyDataSetDelegate>
|
|
|
|
{
|
|
|
|
id popGestureRecognizerDelegate;
|
|
|
|
|
|
|
|
UIImage *navBarImage;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation baseViewController
|
|
|
|
|
|
|
|
@synthesize myDataSource = _myDataSource;
|
|
|
|
|
|
|
|
- (NSMutableArray *)myDataSource{
|
|
|
|
if (!_myDataSource) {
|
|
|
|
_myDataSource = [[NSMutableArray alloc] init];
|
|
|
|
}
|
|
|
|
return _myDataSource;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void)viewWillAppear:(BOOL)animated{
|
|
|
|
[super viewWillAppear:animated];
|
|
|
|
// self.zx_enableAdjustNavContainerAll = YES;
|
|
|
|
self.additionalSafeAreaInsets = UIEdgeInsetsMake(44, 0, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)viewDidLoad {
|
|
|
|
// self.zx_enableAdjustNavContainerAll = YES;
|
|
|
|
[super viewDidLoad];
|
|
|
|
// Do any additional setup after loading the view.
|
|
|
|
self.zx_navLineView.hidden = YES;
|
|
|
|
self.zx_navTitleFont = FontBold_(18);
|
|
|
|
self.zx_disableAutoSetStatusBarStyle = YES;
|
|
|
|
self.view.backgroundColor = KKBackgroundGrey;
|
|
|
|
self.zx_navTintColor = KKTextBlackColor;
|
|
|
|
self.zx_navBarBackgroundColor = KKWhiteColorColor;
|
|
|
|
self.zx_backBtnImageName = @"icon_balck_return";
|
|
|
|
self.zx_disableNavAutoSafeLayout = YES;
|
|
|
|
self.zx_navLeftBtn.zx_fixImageSize = ImageName_(@"icon_balck_return").size;
|
|
|
|
self.zx_navItemSize = 40;
|
|
|
|
self.zx_navRightBtn.zx_fixImageSize = CGSizeMake(44, 44);
|
|
|
|
self.zx_navSubRightBtn.zx_fixImageSize = CGSizeMake(44, 44);
|
|
|
|
[self.zx_navRightBtn setTitleColor:KKTextBlackColor forState:0];
|
|
|
|
//self.edgesForExtendedLayout = UIRectEdgeBottom;
|
|
|
|
// self.zx_hideBaseNavBar = NO;
|
|
|
|
// self.zx_navFixHeight = iPhoneX_NavHeight;
|
|
|
|
|
|
|
|
|
|
|
|
WEAKSELF
|
|
|
|
static BOOL isShow = NO;
|
|
|
|
|
|
|
|
// [[NSNotificationCenter defaultCenter] addObserverForName:@"VideoCall" object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * _Nonnull note) {
|
|
|
|
//
|
|
|
|
// }];
|
|
|
|
|
|
|
|
|
|
|
|
[[NSNotificationCenter defaultCenter] addObserverForName:AccountMessageNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * _Nonnull note) {
|
|
|
|
|
|
|
|
static SystemSoundID alarmSoundSysID = 0;
|
|
|
|
//注册声音到系统声音
|
|
|
|
NSString *path = [[NSBundle mainBundle] pathForResource:@"alarm_sound" ofType:@"caf"];
|
|
|
|
if (path) {
|
|
|
|
//注册声音到系统
|
|
|
|
AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath:path],&alarmSoundSysID);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
//lowBattery rail sms sos photograph abnormalBodyTemperature abnormalHeartRate 提醒消息
|
|
|
|
//applicationRrecord checkedResults 关注消息
|
|
|
|
//identityTransfer identityTransfered systemUpdate 系统消息
|
|
|
|
//Recall 指令超时或者失败回调消息
|
|
|
|
//unbind 被管理员提出群组
|
|
|
|
//video 视频通话
|
|
|
|
//rejcet 视频通话被拒绝
|
|
|
|
//upHeartRate 心率
|
|
|
|
//upBodyTemperature 体温
|
|
|
|
//abnormalBodyTemperature 体温异常消息
|
|
|
|
//abnormalHeartRate 心率异常消息
|
|
|
|
*/
|
|
|
|
if(isShow){
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
AppDelegate * appDelegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
|
|
|
|
UITabBarController *tabBarVC = (UITabBarController*)appDelegate.window.rootViewController;
|
|
|
|
UINavigationController *navVC = (UINavigationController*)tabBarVC.selectedViewController;
|
|
|
|
//获取当前的 VC
|
|
|
|
UIViewController *viewController = navVC.viewControllers.lastObject;
|
|
|
|
if(!viewController){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//排查其他页面的收到通知时的回调
|
|
|
|
if(![weakSelf isEqual: viewController]){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if([viewController isKindOfClass:[RemoteCameraViewController class]]){
|
|
|
|
//在远程拍照页面
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NSDictionary *dic = note.object;
|
|
|
|
NSDictionary *msgDic = dic[@"message"];
|
|
|
|
NSString * msgType = msgDic[@"type"];
|
|
|
|
NSString *content = @"有新消息,是否前往查看";
|
|
|
|
NSString *cancelStr = @"取消";
|
|
|
|
__block NSInteger selectIndex = 0;
|
|
|
|
|
|
|
|
if(!msgType){
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if([msgType isEqualToString:@"wifi"] || [msgType isEqualToString:@"battery"]) {
|
|
|
|
// 在Wi-Fi列表获取界面
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if([msgType isEqualToString:@"upHeartRate"] || [msgType isEqualToString:@"upBodyTemperature"]){
|
|
|
|
//清除定时的
|
|
|
|
if([msgType isEqualToString:@"upBodyTemperature"]){
|
|
|
|
[UserDefaults removeObjectForKey:[NSString stringWithFormat:@"%@&%@",TempMeasurementTimeKey,msgDic[@"imei"]]];
|
|
|
|
}else{
|
|
|
|
[UserDefaults removeObjectForKey:[NSString stringWithFormat:@"%@&%@",HeartMeasurementTimeKey,msgDic[@"imei"]]];
|
|
|
|
}
|
|
|
|
|
|
|
|
if([NSStringFromClass([viewController class]) isEqualToString:@"WatchHomeViewController"] ||
|
|
|
|
[NSStringFromClass([viewController class]) isEqualToString:@"HAndTViewController"] ){
|
|
|
|
//在首页或者是 心率/体温页面 刷新数据
|
|
|
|
[self viewWillAppear:YES];
|
|
|
|
return;
|
|
|
|
}else{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//是否是申请的消息
|
|
|
|
if([msgType isEqualToString:@"identityTransfer"]){
|
|
|
|
if([msgDic[@"openid"] isEqualToString:cUser.openid]){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int video_type = [msgDic[@"video_type"] intValue];
|
|
|
|
if([msgType isEqualToString:@"video"]){
|
|
|
|
//收到设备回拨 APP 视频通话 的视频推送
|
|
|
|
AppDelegate *app = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
|
|
|
if([UIApplication sharedApplication].applicationState == UIApplicationStateActive){
|
|
|
|
[app cleanVideoNotification];
|
|
|
|
}else{
|
|
|
|
if(video_type == 1){
|
|
|
|
NSString * alertStr = [msgDic objectForKey:@"msgTitle"];
|
|
|
|
[app generateLocalNotificationsWithAlertStr:alertStr AndDataInfo:dic];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(video_type == 1){
|
|
|
|
//声网
|
|
|
|
//获取当前的 VC
|
|
|
|
UIViewController *viewController = self.navigationController.viewControllers.lastObject;
|
|
|
|
if(![viewController isKindOfClass:[CallViewController class]]){
|
|
|
|
[weakSelf showCallViewWithDic:msgDic];
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//MARK: 注意收到视频通话时需要 拨打过来的 imei 的Device 对象
|
|
|
|
if (video_type == 4){
|
|
|
|
//MARK:收到设备拨过来的消息 登录菊风SDK 等待连接
|
|
|
|
[self showJuphoonCallViewWithDic:msgDic WithPushDic:dic];
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//MARK: 收到佰锐视频来电消息
|
|
|
|
if (video_type == 5) {
|
|
|
|
[self showBairuiCallViewWithDic:msgDic WithPushDic:dic];
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//MARK: 收到鹈鹕视频来电
|
|
|
|
if (video_type == 6) {
|
|
|
|
[self showTihuCallViewWithDic:msgDic WithPushDic:dic];
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if([msgType isEqualToString:@"reject"]){
|
|
|
|
// AppDelegate *app = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
|
|
|
// if(app.backgroudMsg){
|
|
|
|
// //MARK: 取消本地推送
|
|
|
|
// [app cleanVideoNotification];
|
|
|
|
// [app setNormallyAlertStr:[NSString stringWithFormat:@"设备 %@ 邀请您通话未接通",msgDic[@"imei"]] UserInfo:nil];
|
|
|
|
// [[JX_GCDTimerManager sharedInstance] cancelTimerWithName:VideoTimerIdentify];
|
|
|
|
// [[JX_GCDTimerManager sharedInstance] cancelTimerWithName:PlayVibrationIdentify];
|
|
|
|
// app.stopVibration = YES;
|
|
|
|
// }
|
|
|
|
[UICommon MessageSuccessText:dic[@"msgTitle"] isImg:NO];
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if([viewController isKindOfClass:[MessageViewController class]]){
|
|
|
|
//在消息中心
|
|
|
|
MessageViewController *tempVC = (MessageViewController*)viewController;
|
|
|
|
if([msgType isEqualToString:@"applicationRrecord"]
|
|
|
|
|| [msgType isEqualToString:@"checkedResults"]){
|
|
|
|
selectIndex = 1;
|
|
|
|
}else if ([msgType isEqualToString:@"identityTransfer"]
|
|
|
|
|| [msgType isEqualToString:@"identityTransfered"]
|
|
|
|
|| [msgType isEqualToString:@"systemUpdate"]){
|
|
|
|
selectIndex = 2;
|
|
|
|
}
|
|
|
|
tempVC.selectedIndex = selectIndex;
|
|
|
|
UIViewController *needRefresh = viewController.childViewControllers.lastObject;
|
|
|
|
[needRefresh viewWillAppear:YES];
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if([msgType isEqualToString:@"systemUpdate"]){
|
|
|
|
content = [NSString stringWithFormat:@"有新的系统消息,是否前往查看"];
|
|
|
|
selectIndex = 2;
|
|
|
|
}else if([msgType isEqualToString:@"applicationRrecord"]){
|
|
|
|
//成员 申请 关注设备的 消息 (管理员才能收到)
|
|
|
|
content = [NSString stringWithFormat:@"收到关注 %@(%@)的请求,是否前往消息中心审核", msgDic[@"name"],msgDic[@"imei"]];
|
|
|
|
selectIndex = 1;
|
|
|
|
}else if([msgType isEqualToString:@"checkedResults"]){ //被审核结果消息
|
|
|
|
NSString *res = msgDic[@"action"];
|
|
|
|
NSString *temp = @"";
|
|
|
|
if([res isEqualToString:@"agree"]){
|
|
|
|
temp = @"同意";
|
|
|
|
}else if([res isEqualToString:@"reject"]){
|
|
|
|
temp = @"拒绝";
|
|
|
|
}
|
|
|
|
content = [NSString stringWithFormat:@"管理员%@你关注设备(%@)", temp,msgDic[@"imei"]];
|
|
|
|
selectIndex = 1;
|
|
|
|
|
|
|
|
// MARK 设置同意的设备为默认设备 add by lsz 2021-06-21
|
|
|
|
if ([res isEqualToString:@"agree"]) {
|
|
|
|
[User saveAgreeImei:msgDic[@"imei"]];
|
|
|
|
}
|
|
|
|
|
|
|
|
isShow = YES;
|
|
|
|
[self.view endEditing:YES]; //防止 LGAlertView 错乱
|
|
|
|
LGAlertView *alertView = [[LGAlertView alloc] initWithTitle:@"提示" message:content style:LGAlertViewStyleAlert buttonTitles:@[@"确定"] cancelButtonTitle:@"" destructiveButtonTitle:nil actionHandler:^(LGAlertView *alertView, NSString *title, NSUInteger index) {
|
|
|
|
//刷新页面
|
|
|
|
[viewController viewWillAppear:YES];
|
|
|
|
isShow = NO;
|
|
|
|
} cancelHandler:^(LGAlertView *alertView) {
|
|
|
|
isShow = NO;
|
|
|
|
|
|
|
|
} destructiveHandler:nil];
|
|
|
|
[alertView showAnimated:YES completionHandler:nil];
|
|
|
|
return;
|
|
|
|
|
|
|
|
}else if([msgType isEqualToString:@"LoginOffLine"]){
|
|
|
|
|
|
|
|
// 异地下线
|
|
|
|
//清除 记住的密码
|
|
|
|
[UserDefaults setBool:NO forKey:kifRememberPWDKey];
|
|
|
|
[UserDefaults removeObjectForKey:@"lastpwd"];
|
|
|
|
|
|
|
|
content = msgDic[@"content"];
|
|
|
|
isShow = YES;
|
|
|
|
[self.view endEditing:YES]; //防止 LGAlertView 错乱
|
|
|
|
LGAlertView *alertView = [[LGAlertView alloc] initWithTitle:@"提示" message:content style:LGAlertViewStyleAlert buttonTitles:@[@"确定"] cancelButtonTitle:@"" destructiveButtonTitle:nil actionHandler:^(LGAlertView *alertView, NSString *title, NSUInteger index) {
|
|
|
|
[[NSNotificationCenter defaultCenter] postNotificationName:@"outLogin"
|
|
|
|
object:nil];
|
|
|
|
isShow = NO;
|
|
|
|
} cancelHandler:^(LGAlertView *alertView) {
|
|
|
|
isShow = NO;
|
|
|
|
[[NSNotificationCenter defaultCenter] postNotificationName:@"outLogin"
|
|
|
|
object:nil];
|
|
|
|
} destructiveHandler:^(LGAlertView *alertView) {
|
|
|
|
|
|
|
|
}];
|
|
|
|
[alertView showAnimated:YES completionHandler:nil];
|
|
|
|
return;
|
|
|
|
}else if ([msgType isEqualToString:@"identityTransfer"]){//身份变更消息
|
|
|
|
// 您已把[name][imei]的管理员身份转移给(phone)
|
|
|
|
return;
|
|
|
|
// selectIndex = 2;
|
|
|
|
|
|
|
|
}else if ([msgType isEqualToString:@"photograph"]) {
|
|
|
|
//是上传远程拍照的信息
|
|
|
|
content = [NSString stringWithFormat:@"【%@】上传照片,是否前往查看",msgDic[@"name"]];
|
|
|
|
isShow = YES;
|
|
|
|
[self.view endEditing:YES]; //防止 LGAlertView 错乱
|
|
|
|
LGAlertView *alertView = [[LGAlertView alloc] initWithTitle:@"提示" message:content style:LGAlertViewStyleAlert buttonTitles:@[@"前往查看"] cancelButtonTitle:@"取消" destructiveButtonTitle:nil actionHandler:^(LGAlertView *alertView, NSString *title, NSUInteger index) {
|
|
|
|
//前往远程拍照页面查看
|
|
|
|
//先判断 当前的 imei 是否是 推送的 imei,如果不是就切换一下 主设备
|
|
|
|
if(![cUser.cDevice.imei isEqualToString:msgDic[@"imei"]]){
|
|
|
|
for (Device* item in cUser.myDevices) {
|
|
|
|
if([item.imei isEqualToString: msgDic[@"imei"]]){
|
|
|
|
cUser.cDevice = item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RemoteCameraViewController *vc = [[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"RemoteCameraViewController"];
|
|
|
|
vc.hidesBottomBarWhenPushed = YES;
|
|
|
|
AppDelegate * appDelegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
|
|
|
|
UITabBarController *tabBarVC = (UITabBarController*)appDelegate.window.rootViewController;
|
|
|
|
UINavigationController *navVC = (UINavigationController*)tabBarVC.selectedViewController;
|
|
|
|
[navVC pushViewController:vc animated:YES];
|
|
|
|
isShow = NO;
|
|
|
|
} cancelHandler:^(LGAlertView *alertView) {
|
|
|
|
isShow = NO;
|
|
|
|
[viewController viewWillAppear:YES];
|
|
|
|
} destructiveHandler:^(LGAlertView *alertView) {
|
|
|
|
|
|
|
|
}];
|
|
|
|
[alertView showAnimated:YES completionHandler:nil];
|
|
|
|
return;
|
|
|
|
}else if ([msgType isEqualToString:@"CostFlow"]) {
|
|
|
|
//是查询话费流量的信息 推送
|
|
|
|
|
|
|
|
//在查询话费流量页面
|
|
|
|
if([NSStringFromClass([viewController class]) isEqualToString:@"QueryCallRatesRoFlowVC"]){
|
|
|
|
[viewController viewWillAppear:YES];
|
|
|
|
return;
|
|
|
|
}else{
|
|
|
|
|
|
|
|
content = [NSString stringWithFormat:@"【%@】有新的话费流量查询消息,是否前往查看",msgDic[@"name"]];
|
|
|
|
isShow = YES;
|
|
|
|
[self.view endEditing:YES]; //防止 LGAlertView 错乱
|
|
|
|
LGAlertView *alertView = [[LGAlertView alloc] initWithTitle:@"提示" message:content style:LGAlertViewStyleAlert buttonTitles:@[@"前往查看"] cancelButtonTitle:@"取消" destructiveButtonTitle:nil actionHandler:^(LGAlertView *alertView, NSString *title, NSUInteger index) {
|
|
|
|
//前往远程拍照页面查看
|
|
|
|
//先判断 当前的 imei 是否是 推送的 imei,如果不是就切换一下 主设备
|
|
|
|
if(![cUser.cDevice.imei isEqualToString:msgDic[@"imei"]]){
|
|
|
|
for (Device* item in cUser.myDevices) {
|
|
|
|
if([item.imei isEqualToString: msgDic[@"imei"]]){
|
|
|
|
cUser.cDevice = item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
UIViewController *vc = [[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"QueryCallRatesRoFlowVC"];
|
|
|
|
vc.hidesBottomBarWhenPushed = YES;
|
|
|
|
AppDelegate * appDelegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
|
|
|
|
UITabBarController *tabBarVC = (UITabBarController*)appDelegate.window.rootViewController;
|
|
|
|
UINavigationController *navVC = (UINavigationController*)tabBarVC.selectedViewController;
|
|
|
|
[navVC pushViewController:vc animated:YES];
|
|
|
|
isShow = NO;
|
|
|
|
} cancelHandler:^(LGAlertView *alertView) {
|
|
|
|
isShow = NO;
|
|
|
|
[viewController viewWillAppear:YES];
|
|
|
|
} destructiveHandler:^(LGAlertView *alertView) {
|
|
|
|
|
|
|
|
}];
|
|
|
|
[alertView showAnimated:YES completionHandler:nil];
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}else if ([msgType isEqualToString:@"sos"]) {
|
|
|
|
|
|
|
|
//是 SOS 的求救信息
|
|
|
|
// content = [NSString stringWithFormat:@"【%@】触发SOS,地址:%@",msgDic[@"name"], msgDic[@"address"]];
|
|
|
|
content = [NSString stringWithFormat:@"【%@】触发SOS",msgDic[@"name"]];
|
|
|
|
AudioServicesPlaySystemSound(alarmSoundSysID);
|
|
|
|
|
|
|
|
if([msgDic valueForKey:@"msgContent"]){
|
|
|
|
content = msgDic[@"msgContent"];
|
|
|
|
}
|
|
|
|
isShow = YES;
|
|
|
|
[self.view endEditing:YES]; //防止 LGAlertView 错乱
|
|
|
|
LGAlertView *alertView = [[LGAlertView alloc] initWithTitle:@"提示" message:content style:LGAlertViewStyleAlert buttonTitles:@[@"确定"] cancelButtonTitle:@"" destructiveButtonTitle:nil actionHandler:^(LGAlertView *alertView, NSString *title, NSUInteger index) {
|
|
|
|
//前往消息中心页面查看
|
|
|
|
//先判断 当前的 imei 是否是 推送的 imei,如果不是就切换一下 主设备
|
|
|
|
if(![cUser.cDevice.imei isEqualToString:msgDic[@"imei"]]){
|
|
|
|
for (Device* item in cUser.myDevices) {
|
|
|
|
if([item.imei isEqualToString: msgDic[@"imei"]]){
|
|
|
|
cUser.cDevice = item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//销毁声音
|
|
|
|
AudioServicesDisposeSystemSoundID(alarmSoundSysID);
|
|
|
|
|
|
|
|
isShow = NO;
|
|
|
|
} cancelHandler:^(LGAlertView *alertView) {
|
|
|
|
isShow = NO;
|
|
|
|
[viewController viewWillAppear:YES];
|
|
|
|
} destructiveHandler:^(LGAlertView *alertView) {
|
|
|
|
|
|
|
|
}];
|
|
|
|
[alertView showAnimated:YES completionHandler:nil];
|
|
|
|
return;
|
|
|
|
}else if ([msgType isEqualToString:@"rail"]
|
|
|
|
|| [msgType isEqualToString:@"lowBattery"]
|
|
|
|
|| [msgType isEqualToString:@"identityTransfered"] //身份被变更消息
|
|
|
|
|| [msgType isEqualToString:@"Recall"] //指令超时
|
|
|
|
|| [msgType isEqualToString:@"applicationOvertime"] //记录失效时间
|
|
|
|
|| [msgType isEqualToString:@"unbind"] //被管理员提出群组
|
|
|
|
|| [msgType isEqualToString:@"abnormalBodyTemperature"] //体温异常
|
|
|
|
|| [msgType isEqualToString:@"abnormalHeartRate"] //心率异常
|
|
|
|
) {
|
|
|
|
|
|
|
|
|
|
|
|
if([msgType isEqualToString:@"rail"]){
|
|
|
|
//是进出安全围栏的信息
|
|
|
|
//【宝贝昵称】进入/离开安全区域【家】
|
|
|
|
NSString *res = msgDic[@"action"];
|
|
|
|
NSString *temp = @"";
|
|
|
|
if([res isEqualToString:@"enter"]){
|
|
|
|
temp = @"进入";
|
|
|
|
}else if([res isEqualToString:@"leave"]){
|
|
|
|
temp = @"离开";
|
|
|
|
}
|
|
|
|
content = [NSString stringWithFormat:@"【%@】%@安全区域【%@】",msgDic[@"name"],temp,msgDic[@"railName"]];
|
|
|
|
AudioServicesPlaySystemSound(alarmSoundSysID);
|
|
|
|
|
|
|
|
}else if([msgType isEqualToString:@"identityTransfered"]){
|
|
|
|
//身份被变更消息
|
|
|
|
//(name)设备[imei]的管理员把 管理员身份转移给您
|
|
|
|
//【宝贝昵称】的管理员将管理员身份转让给你
|
|
|
|
content = [NSString stringWithFormat:@"【%@】的管理员将管理员身份转让给你",msgDic[@"name"]];
|
|
|
|
|
|
|
|
}else if([msgType isEqualToString:@"lowBattery"]){
|
|
|
|
//低电量的信息
|
|
|
|
//【宝贝昵称】设备低电量,当前电量8%
|
|
|
|
content = [NSString stringWithFormat:@"【%@】设备低电量,当前电量%@%%",msgDic[@"name"],msgDic[@"battery"]];
|
|
|
|
AudioServicesPlaySystemSound(alarmSoundSysID);
|
|
|
|
}else if([msgType isEqualToString:@"Recall"]){
|
|
|
|
//指令超时回调
|
|
|
|
content = msgDic[@"content"];
|
|
|
|
}else if([msgType isEqualToString:@"applicationOvertime"]){
|
|
|
|
//记录失效消息
|
|
|
|
if([msgDic[@"own"] integerValue] == 1){
|
|
|
|
content = [NSString stringWithFormat:@"你申请关注【%@】设备,管理员未及时处理,申请已失效,请重新申请并联系管理员处理",msgDic[@"name"]];
|
|
|
|
}else{
|
|
|
|
content = [NSString stringWithFormat:@"用户(%@)申请关注【%@】设备,记录未及时处理,已失效",msgDic[@"phone"],msgDic[@"name"]];
|
|
|
|
|
|
|
|
}
|
|
|
|
}else if([msgType isEqualToString:@"unbind"]){
|
|
|
|
//被管理员踢出群组
|
|
|
|
content = [NSString stringWithFormat:@"【%@】设备【%@】的管理员取消您关注设备",msgDic[@"name"],msgDic[@"imei"]];
|
|
|
|
// 回到首页
|
|
|
|
[tabBarVC setSelectedIndex:0];
|
|
|
|
[navVC popToRootViewControllerAnimated:YES];
|
|
|
|
|
|
|
|
}else if([msgType isEqualToString:@"abnormalBodyTemperature"] //体温异常
|
|
|
|
|| [msgType isEqualToString:@"abnormalHeartRate"] //心率异常
|
|
|
|
){
|
|
|
|
AudioServicesPlaySystemSound(alarmSoundSysID);
|
|
|
|
}
|
|
|
|
if([msgDic valueForKey:@"msgTitle"]){
|
|
|
|
content = msgDic[@"msgTitle"];
|
|
|
|
}
|
|
|
|
|
|
|
|
isShow = YES;
|
|
|
|
[self.view endEditing:YES]; //防止 LGAlertView 错乱
|
|
|
|
LGAlertView *alertView = [[LGAlertView alloc] initWithTitle:@"提示" message:content style:LGAlertViewStyleAlert buttonTitles:@[@"确定"] cancelButtonTitle:@"" destructiveButtonTitle:nil actionHandler:^(LGAlertView *alertView, NSString *title, NSUInteger index) {
|
|
|
|
AudioServicesDisposeSystemSoundID(alarmSoundSysID);
|
|
|
|
//刷新页面
|
|
|
|
[viewController viewWillAppear:YES];
|
|
|
|
isShow = NO;
|
|
|
|
} cancelHandler:^(LGAlertView *alertView) {
|
|
|
|
isShow = NO;
|
|
|
|
[viewController viewWillAppear:YES];
|
|
|
|
} destructiveHandler:nil];
|
|
|
|
[alertView showAnimated:YES completionHandler:nil];
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
isShow = YES;
|
|
|
|
[self.view endEditing:YES]; //防止 LGAlertView 错乱
|
|
|
|
LGAlertView *alertView = [[LGAlertView alloc] initWithTitle:@"提示" message:content style:LGAlertViewStyleAlert buttonTitles:@[@"前往查看"] cancelButtonTitle:cancelStr destructiveButtonTitle:nil actionHandler:^(LGAlertView *alertView, NSString *title, NSUInteger index) {
|
|
|
|
//前往查看
|
|
|
|
MessageViewController *vc = [MessageViewController new];
|
|
|
|
vc.title = @"消息中心";
|
|
|
|
vc.hidesBottomBarWhenPushed = YES;
|
|
|
|
vc.selectedIndex = selectIndex;
|
|
|
|
AppDelegate * appDelegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
|
|
|
|
UITabBarController *tabBarVC = (UITabBarController*)appDelegate.window.rootViewController;
|
|
|
|
UINavigationController *navVC = (UINavigationController*)tabBarVC.selectedViewController;
|
|
|
|
[navVC pushViewController:vc animated:YES];
|
|
|
|
isShow = NO;
|
|
|
|
} cancelHandler:^(LGAlertView *alertView) {
|
|
|
|
isShow = NO;
|
|
|
|
[viewController viewWillAppear:YES];
|
|
|
|
} destructiveHandler:^(LGAlertView *alertView) {
|
|
|
|
|
|
|
|
}];
|
|
|
|
[alertView showAnimated:YES completionHandler:nil];
|
|
|
|
|
|
|
|
}];
|
|
|
|
/*
|
|
|
|
//chatGroupDisband 聊天群被解散 (管理员对设备恢复出厂设置)
|
|
|
|
//chatGroupRemove 用户离开聊天群 (XX 取消对设备的 关注)
|
|
|
|
//chatGroupEnter 用户进入聊天群
|
|
|
|
*/
|
|
|
|
[[NSNotificationCenter defaultCenter] addObserverForName:PUSH_type_chatGroupDisband object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * _Nonnull note) {
|
|
|
|
NSDictionary *msgDic = note.object;
|
|
|
|
if(isShow){
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
AppDelegate * appDelegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
|
|
|
|
UITabBarController *tabBarVC = (UITabBarController*)appDelegate.window.rootViewController;
|
|
|
|
UINavigationController *navVC = (UINavigationController*)tabBarVC.selectedViewController;
|
|
|
|
//获取当前的 VC
|
|
|
|
UIViewController *viewController = navVC.viewControllers.lastObject;
|
|
|
|
if(!viewController){
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
//恢复出厂设置
|
|
|
|
NSString *content = [NSString stringWithFormat:@"【%@】的管理员将设备恢复出厂设置",msgDic[@"name"]];
|
|
|
|
isShow = YES;
|
|
|
|
[self.view endEditing:YES]; //防止 LGAlertView 错乱
|
|
|
|
LGAlertView *alertView = [[LGAlertView alloc] initWithTitle:@"提示" message:content style:LGAlertViewStyleAlert buttonTitles:@[@"确定"] cancelButtonTitle:nil destructiveButtonTitle:nil actionHandler:^(LGAlertView *alertView, NSString *title, NSUInteger index) {
|
|
|
|
//刷新页面
|
|
|
|
[viewController viewWillAppear:YES];
|
|
|
|
isShow = NO;
|
|
|
|
} cancelHandler:^(LGAlertView *alertView) {
|
|
|
|
isShow = NO;
|
|
|
|
[viewController viewWillAppear:YES];
|
|
|
|
} destructiveHandler:nil];
|
|
|
|
[alertView showAnimated:YES completionHandler:nil];
|
|
|
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
[[NSNotificationCenter defaultCenter] addObserverForName:PUSH_type_chatGroupRemove object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * _Nonnull note) {
|
|
|
|
NSDictionary *msgDic = note.object;
|
|
|
|
if(isShow){
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
AppDelegate * appDelegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
|
|
|
|
UITabBarController *tabBarVC = (UITabBarController*)appDelegate.window.rootViewController;
|
|
|
|
UINavigationController *navVC = (UINavigationController*)tabBarVC.selectedViewController;
|
|
|
|
//获取当前的 VC
|
|
|
|
UIViewController *viewController = navVC.viewControllers.lastObject;
|
|
|
|
if(!viewController){
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// 取消关注
|
|
|
|
NSString *content = [NSString stringWithFormat:@"【%@】的 %@ 取消关注设备",msgDic[@"device_name"],msgDic[@"account_name"]];
|
|
|
|
isShow = YES;
|
|
|
|
[self.view endEditing:YES]; //防止 LGAlertView 错乱
|
|
|
|
LGAlertView *alertView = [[LGAlertView alloc] initWithTitle:@"提示" message:content style:LGAlertViewStyleAlert buttonTitles:@[@"确定"] cancelButtonTitle:nil destructiveButtonTitle:nil actionHandler:^(LGAlertView *alertView, NSString *title, NSUInteger index) {
|
|
|
|
//刷新页面
|
|
|
|
[viewController viewWillAppear:YES];
|
|
|
|
isShow = NO;
|
|
|
|
} cancelHandler:^(LGAlertView *alertView) {
|
|
|
|
isShow = NO;
|
|
|
|
[viewController viewWillAppear:YES];
|
|
|
|
} destructiveHandler:nil];
|
|
|
|
[alertView showAnimated:YES completionHandler:nil];
|
|
|
|
}];
|
|
|
|
|
|
|
|
[[NSNotificationCenter defaultCenter] addObserverForName:PUSH_type_chatGroupEnter object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * _Nonnull note) {
|
|
|
|
NSDictionary *dic = note.object;
|
|
|
|
xLog(@"某个用户关注的 设备 data:%@", dic)
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UIStatusBarStyle)preferredStatusBarStyle
|
|
|
|
{
|
|
|
|
return UIStatusBarStyleLightContent; //返回白色
|
|
|
|
//return UIStatusBarStyleDefault; //返回黑色
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)viewDidDisappear:(BOOL)animated{
|
|
|
|
[super viewDidDisappear:animated];
|
|
|
|
[[NSNotificationCenter defaultCenter] removeObserver:self name:AccountMessageNotification object:nil];
|
|
|
|
[[NSNotificationCenter defaultCenter] removeObserver:self name:PUSH_type_chatGroupDisband object:nil];
|
|
|
|
[[NSNotificationCenter defaultCenter] removeObserver:self name:PUSH_type_chatGroupRemove object:nil];
|
|
|
|
[[NSNotificationCenter defaultCenter] removeObserver:self name:PUSH_type_chatGroupEnter object:nil];
|
|
|
|
//PUSH_type_chatGroupDisband
|
|
|
|
//PUSH_type_chatGroupRemove
|
|
|
|
//PUSH_type_chatGroupEnter
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (BOOL)prefersStatusBarHidden {
|
|
|
|
// return YES; //设置状态栏隐藏
|
|
|
|
return NO; //设置状态栏显示
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (IBAction)rightBarItemClick:(UIBarButtonItem *)sender{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void)viewWillDisappear:(BOOL)animated{
|
|
|
|
[super viewWillDisappear:animated];
|
|
|
|
[UICommon HidenLoading];
|
|
|
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)goBack:(id)sender{
|
|
|
|
if (self.navigationController.viewControllers.count > 1) {
|
|
|
|
[self.navigationController popViewControllerAnimated:YES];
|
|
|
|
}else{
|
|
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView
|
|
|
|
{
|
|
|
|
NSString *vcName = NSStringFromClass([self class]);
|
|
|
|
NSString *imageName = @"空白历史记录";
|
|
|
|
if ([vcName isEqualToString:@"DisturbBanViewController"])
|
|
|
|
{
|
|
|
|
//imageName = @"空白上课禁用";
|
|
|
|
imageName = @"空白历史记录";
|
|
|
|
self.emptyText = @"未添加上课禁用时段";
|
|
|
|
}
|
|
|
|
else if ([vcName isEqualToString:@"ContactsViewController"])
|
|
|
|
{
|
|
|
|
// imageName = @"空白电话本";
|
|
|
|
imageName = @"空白历史记录";
|
|
|
|
self.emptyText = @"未添加设备联系人";
|
|
|
|
}
|
|
|
|
else if ([vcName isEqualToString:@"AttentionMessageViewController"])
|
|
|
|
{
|
|
|
|
imageName = @"空白消息";
|
|
|
|
self.emptyText = @"没有关注记录";
|
|
|
|
}
|
|
|
|
else if ([vcName isEqualToString:@"RemindMessageViewController"])
|
|
|
|
{
|
|
|
|
imageName = @"空白消息";
|
|
|
|
self.emptyTitle = @"还没有提醒";
|
|
|
|
}
|
|
|
|
else if ([vcName isEqualToString:@"SystermMessageViewController"])
|
|
|
|
{
|
|
|
|
imageName = @"空白消息";
|
|
|
|
self.emptyTitle = @"没有通知消息";
|
|
|
|
}
|
|
|
|
else if ([vcName isEqualToString:@"RailListViewController"])
|
|
|
|
{
|
|
|
|
imageName = @"空白电子围栏";
|
|
|
|
self.emptyText = @"进出电子围栏,会报警!";
|
|
|
|
}
|
|
|
|
else if ([vcName isEqualToString:@"TrackViewController"])
|
|
|
|
{
|
|
|
|
imageName = @"空白历史记录";
|
|
|
|
self.emptyTitle = @"没有历史数据";
|
|
|
|
}
|
|
|
|
else if ([vcName isEqualToString:@"VoiceAlarmViewController"])
|
|
|
|
{
|
|
|
|
//imageName = @"空白闹钟";
|
|
|
|
imageName = @"空白历史记录";
|
|
|
|
self.emptyText = @"未添加闹钟";
|
|
|
|
}
|
|
|
|
else if ([vcName isEqualToString:@"RemoteCameraViewController"])
|
|
|
|
{
|
|
|
|
// imageName = @"空白照片";
|
|
|
|
imageName = @"空白历史记录";
|
|
|
|
self.emptyText = @"没有照片";
|
|
|
|
}
|
|
|
|
else if ([vcName isEqualToString:@"QueryCallRatesRoFlowVC"])
|
|
|
|
{
|
|
|
|
//imageName = @"icon_no_news";
|
|
|
|
imageName = @"空白历史记录";
|
|
|
|
self.emptyText = @"没有消息";
|
|
|
|
}
|
|
|
|
else if ([vcName isEqualToString:@"AddVideoMomberVC"])
|
|
|
|
{
|
|
|
|
imageName = @"video_list_none";
|
|
|
|
self.emptyText = @"没有视频通话成员";
|
|
|
|
}
|
|
|
|
else if ([vcName isEqualToString:@"CallMessageViewController"])
|
|
|
|
{
|
|
|
|
//imageName = @"icon_no_news";
|
|
|
|
imageName = @"空白历史记录";
|
|
|
|
self.emptyText = @"没有通话记录";
|
|
|
|
}
|
|
|
|
else if ([vcName isEqualToString:@"ShortMessageListViewController"])
|
|
|
|
{
|
|
|
|
imageName = @"空白历史记录";
|
|
|
|
self.emptyText = @"未收到手表短信";
|
|
|
|
}
|
|
|
|
return ImageName_(imageName);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// 空白页添加按钮,设置按钮文字
|
|
|
|
- (NSAttributedString *)buttonTitleForEmptyDataSet:(UIScrollView *)scrollView forState:(UIControlState)state
|
|
|
|
{
|
|
|
|
NSMutableAttributedString *attributedString;
|
|
|
|
if (STRINGHASVALUE(self.buttonTitle))
|
|
|
|
{
|
|
|
|
attributedString = [[NSMutableAttributedString alloc] initWithString:self.buttonTitle];
|
|
|
|
|
|
|
|
[attributedString addAttribute:NSFontAttributeName
|
|
|
|
value:Font_(15)
|
|
|
|
range:NSMakeRange(0, self.buttonTitle.length)];
|
|
|
|
[attributedString addAttribute:NSForegroundColorAttributeName
|
|
|
|
value:[self.buttonTitleColor isKindOfClass:UIColor.class] ? self.buttonTitleColor : KKWhiteColorColor
|
|
|
|
range:NSMakeRange(0, self.buttonTitle.length)];
|
|
|
|
}
|
|
|
|
return attributedString;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 空状态描述
|
|
|
|
- ( NSAttributedString *)descriptionForEmptyDataSet:(UIScrollView *)scrollView
|
|
|
|
{
|
|
|
|
NSMutableAttributedString *attributedString;
|
|
|
|
if (STRINGHASVALUE(self.emptyText))
|
|
|
|
{
|
|
|
|
attributedString = [[NSMutableAttributedString alloc] initWithString:self.emptyText];
|
|
|
|
|
|
|
|
[attributedString addAttribute:NSFontAttributeName
|
|
|
|
value:Font_(14)
|
|
|
|
range:NSMakeRange(0, self.emptyText.length)];
|
|
|
|
[attributedString addAttribute:NSForegroundColorAttributeName
|
|
|
|
value:KKGrey163
|
|
|
|
range:NSMakeRange(0, self.emptyText.length)];
|
|
|
|
}
|
|
|
|
return attributedString;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 空状态标题
|
|
|
|
- ( NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView
|
|
|
|
{
|
|
|
|
NSMutableAttributedString *attributedString;
|
|
|
|
if (STRINGHASVALUE(self.emptyTitle))
|
|
|
|
{
|
|
|
|
attributedString = [[NSMutableAttributedString alloc] initWithString:self.emptyTitle];
|
|
|
|
|
|
|
|
[attributedString addAttribute:NSFontAttributeName
|
|
|
|
value:FontBold_(18)
|
|
|
|
range:NSMakeRange(0, self.emptyTitle.length)];
|
|
|
|
[attributedString addAttribute:NSForegroundColorAttributeName
|
|
|
|
value:KKBlack20
|
|
|
|
range:NSMakeRange(0, self.emptyTitle.length)];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return attributedString;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 按钮背景图片
|
|
|
|
- (UIImage *)buttonBackgroundImageForEmptyDataSet:(UIScrollView *)scrollView forState:(UIControlState)state
|
|
|
|
{
|
|
|
|
return self.buttonImg;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView
|
|
|
|
{
|
|
|
|
return -70.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 空白页背景颜色
|
|
|
|
- (nullable UIColor *)backgroundColorForEmptyDataSet:(UIScrollView *)scrollView
|
|
|
|
{
|
|
|
|
return KKClearColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)emptyDataSetWillAppear:(UIScrollView *)scrollView
|
|
|
|
{
|
|
|
|
scrollView.contentOffset = CGPointZero;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void)tapNoReachableImageAction{
|
|
|
|
[self viewWillDisappear:NO];
|
|
|
|
[self viewDidDisappear:NO];
|
|
|
|
[self viewWillAppear:NO];
|
|
|
|
[[NSNotificationCenter defaultCenter] postNotificationName:NoReachableRefreshNotification object:nil];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)didReceiveMemoryWarning {
|
|
|
|
[super didReceiveMemoryWarning];
|
|
|
|
// Dispose of any resources that can be recreated.
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
MARK: 显示声网的视频通话的页面
|
|
|
|
*/
|
|
|
|
- (void)showCallViewWithDic:(NSDictionary*)dic{
|
|
|
|
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
|
|
|
|
CallViewController *callVC = [sb instantiateViewControllerWithIdentifier:@"CallViewController"];
|
|
|
|
callVC.modalPresentationStyle = UIModalPresentationFullScreen;
|
|
|
|
callVC.device = [cUser getDeviceWithImei:dic[@"imei"]];
|
|
|
|
callVC.appid = dic[@"appid"];
|
|
|
|
callVC.token = dic[@"token"];
|
|
|
|
@try {
|
|
|
|
callVC.video_id = dic[@"video_id"];
|
|
|
|
callVC.channelID = dic[@"channelID"];
|
|
|
|
callVC.uid = [dic[@"app_uid"] integerValue];
|
|
|
|
callVC.device_uid = [dic[@"uid"] integerValue];
|
|
|
|
callVC.videoSize = CGSizeMake([dic[@"distinguishability_width"] floatValue], [dic[@"distinguishability_heiger"] floatValue]) ; //AgoraVideoDimension640x360
|
|
|
|
callVC.limit_time = [dic[@"limit_time"] intValue];
|
|
|
|
callVC.wait_time = [dic[@"wait_time"] intValue];
|
|
|
|
} @catch (NSException *exception) {
|
|
|
|
xLog(@"exception.reason %@",exception.reason);
|
|
|
|
} @finally {
|
|
|
|
callVC.isReceiveCall = YES;
|
|
|
|
[self presentViewController:callVC animated:NO completion:nil];
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//MARK: 调起菊风视频的页面
|
|
|
|
-(void)showJuphoonCallViewWithDic:(NSDictionary*)dic WithPushDic:(NSDictionary*)pushDic{
|
|
|
|
//需要去注册
|
|
|
|
// AppDelegate *app = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
|
|
|
// [app initJHWithPushDate:dic];
|
|
|
|
JuphoonModel * jhModel = [JuphoonModel mj_objectWithKeyValues:dic];
|
|
|
|
[[JCManager shared] initializeWithAPPKey:jhModel.appkey];
|
|
|
|
|
|
|
|
//MARK: 存在 call VC 的时候忽略通知
|
|
|
|
if([JCManager shared].callViewController == nil)
|
|
|
|
{
|
|
|
|
[[JCManager shared] initializeWithAPPKey:cUser.juphoonKey];
|
|
|
|
JCClientLoginParam* loginParam = [[JCClientLoginParam alloc] init];
|
|
|
|
loginParam.directConnectEnable = YES;
|
|
|
|
[[JCManager shared].client setServerAddress:@"http:cn.router.justalkcloud.com:8080"];
|
|
|
|
[[JCManager shared].client login:cUser.openid password:@"test" loginParam:loginParam];
|
|
|
|
[[JCManager shared].mediaDevice enableSpeaker:YES];
|
|
|
|
[JCManager shared].model = jhModel;
|
|
|
|
[JCManager shared].device = [cUser getDeviceWithImei:jhModel.imei];
|
|
|
|
[JCManager shared].gMianVC = self;
|
|
|
|
[JCManager shared].pushData = pushDic;
|
|
|
|
}
|
|
|
|
//登陆成功后等待设备拨打重复拨打到APP
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//MARK: 调起佰锐视频的页面
|
|
|
|
/**
|
|
|
|
appkey = "A3BEE84E-9C7A-D848-85D3-90F233D9A022";
|
|
|
|
deviceName = "\U5b9d\U8d1d";
|
|
|
|
deviceVideoType = BR;
|
|
|
|
"device_username" = 11529;
|
|
|
|
"distinguishability_heiger" = 160;
|
|
|
|
"distinguishability_width" = 120;
|
|
|
|
imei = 801001234567913;
|
|
|
|
"limit_time" = 300;
|
|
|
|
openid = f4a0123c576d894883ddd187;
|
|
|
|
password = 123456;
|
|
|
|
timestamp = "1606375222.449991";
|
|
|
|
type = video;
|
|
|
|
username = 11344;
|
|
|
|
"video_id" = "801001234567913-201126152022";
|
|
|
|
"video_type" = 5;
|
|
|
|
"wait_time" = 60;
|
|
|
|
*/
|
|
|
|
-(void)showBairuiCallViewWithDic:(NSDictionary*)dic WithPushDic:(NSDictionary*)pushDic{
|
|
|
|
//需要去注册
|
|
|
|
// AppDelegate *app = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
|
|
|
// [app initJHWithPushDate:dic];
|
|
|
|
BairuiModel * brModel = [BairuiModel mj_objectWithKeyValues:dic];
|
|
|
|
|
|
|
|
if ([BRManager shared].callViewController == nil) {
|
|
|
|
BRManager * manager = [BRManager shared];
|
|
|
|
if (![manager isUserLogin]) {
|
|
|
|
[manager login:@([brModel.username intValue]) nick: cUser.name];
|
|
|
|
NSLog(@"====佰锐视频推送用户->登录====");
|
|
|
|
} else {
|
|
|
|
NSLog(@"====佰锐视频推送用户->已经登录=");
|
|
|
|
}
|
|
|
|
|
|
|
|
[BRManager shared].brModel = brModel;
|
|
|
|
}
|
|
|
|
|
|
|
|
//登陆成功后等待设备拨打重复拨打到APP
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)showTihuCallViewWithDic:(NSDictionary*)dic WithPushDic:(NSDictionary*)pushDic{
|
|
|
|
|
|
|
|
TihuModel *thModel = [TihuModel mj_objectWithKeyValues:dic];
|
|
|
|
|
|
|
|
if ([TihuManager shared].callViewController == nil) {
|
|
|
|
if (![[TihuManager shared] isUserLogin]) {
|
|
|
|
[[TihuManager shared] initialize];
|
|
|
|
[TihuManager shared].gMianVC = self;
|
|
|
|
[[TihuManager shared] login:cUser.openid pwd:@"123456"];
|
|
|
|
|
|
|
|
xLog(@"鹈鹕账号是:%@", cUser.openid);
|
|
|
|
} else {
|
|
|
|
xLog(@"====>鹈鹕视频账号已经登录");
|
|
|
|
}
|
|
|
|
[TihuManager shared].thModel = thModel;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark - Navigation
|
|
|
|
|
|
|
|
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
|
|
|
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
|
|
|
// Get the new view controller using [segue destinationViewController].
|
|
|
|
// Pass the selected object to the new view controller.
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@end
|