更换阿里推送,消息页面,以及部分bug修复
This commit is contained in:
parent
1ff1ff84b1
commit
5a10dfa182
|
|
@ -40,6 +40,8 @@
|
||||||
+(NSString*)getAppVersion;
|
+(NSString*)getAppVersion;
|
||||||
|
|
||||||
@property (strong, nonatomic) NSString *token;
|
@property (strong, nonatomic) NSString *token;
|
||||||
|
|
||||||
|
@property (strong, nonatomic) NSDictionary* remoteNotification;//如果是点击通知打开的app,则json有数据
|
||||||
//摄像头处于后台
|
//摄像头处于后台
|
||||||
@property (nonatomic) BOOL isGoBack;
|
@property (nonatomic) BOOL isGoBack;
|
||||||
//设备处于后台
|
//设备处于后台
|
||||||
|
|
|
||||||
|
|
@ -186,9 +186,10 @@
|
||||||
NSLog(@"\n ====== launchOptions: %@",launchOptions);
|
NSLog(@"\n ====== launchOptions: %@",launchOptions);
|
||||||
NSDictionary *pushNotificationKey = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
|
NSDictionary *pushNotificationKey = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
|
||||||
if (pushNotificationKey) {
|
if (pushNotificationKey) {
|
||||||
|
self.remoteNotification = pushNotificationKey;
|
||||||
// 这里定义自己的处理方式
|
// 这里定义自己的处理方式
|
||||||
// 如需要代码控制 BadgeNum (icon右上角的数字等操作)
|
// 如需要代码控制 BadgeNum (icon右上角的数字等操作)
|
||||||
// [UIApplication sharedApplication].applicationIconBadgeNumber = 10;
|
//[UIApplication sharedApplication].applicationIconBadgeNumber = 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
@ -206,16 +207,6 @@
|
||||||
*/
|
*/
|
||||||
// 获取推送消息 islaunchedByNotification 标识用户是否通过点击通知消息进入本应用 即userInfo
|
// 获取推送消息 islaunchedByNotification 标识用户是否通过点击通知消息进入本应用 即userInfo
|
||||||
|
|
||||||
NSDictionary* remoteNotification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
|
|
||||||
NSLog(@"%@",remoteNotification);
|
|
||||||
|
|
||||||
if (remoteNotification) {
|
|
||||||
_islaunchedByNotification=YES;
|
|
||||||
launchedByNotification = YES;
|
|
||||||
}else{
|
|
||||||
_islaunchedByNotification=NO;
|
|
||||||
launchedByNotification = NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TalkingData 统计工具
|
* TalkingData 统计工具
|
||||||
|
|
@ -270,7 +261,7 @@
|
||||||
// 如果是5,autoSizeScaleX=1,autoSizeScaleY=1;
|
// 如果是5,autoSizeScaleX=1,autoSizeScaleY=1;
|
||||||
// 如果是6,autoSizeScaleX=1.171875,autoSizeScaleY=1.17429577;
|
// 如果是6,autoSizeScaleX=1.171875,autoSizeScaleY=1.17429577;
|
||||||
// 如果是6Plus,autoSizeScaleX=1.29375,autoSizeScaleY=1.2957;
|
// 如果是6Plus,autoSizeScaleX=1.29375,autoSizeScaleY=1.2957;
|
||||||
AppDelegate*laoutDelegate=(AppDelegate*)[[UIApplication sharedApplication]delegate];
|
AppDelegate*laoutDelegate=(AppDelegate*)[[UIApplication sharedApplication]delegate];
|
||||||
if (kScreenSize.height>480) {
|
if (kScreenSize.height>480) {
|
||||||
laoutDelegate.autoSizeScaleX=kScreenSize.width/320;
|
laoutDelegate.autoSizeScaleX=kScreenSize.width/320;
|
||||||
laoutDelegate.autoSizeScaleY=kScreenSize.height/568;
|
laoutDelegate.autoSizeScaleY=kScreenSize.height/568;
|
||||||
|
|
@ -290,14 +281,7 @@ if (kScreenSize.height>480) {
|
||||||
firstLogIn=NO;
|
firstLogIn=NO;
|
||||||
|
|
||||||
[self loginAnimated:application];
|
[self loginAnimated:application];
|
||||||
//企业版打开
|
|
||||||
// dispatch_async(dispatch_get_main_queue(), ^{
|
|
||||||
// if (_islaunchedByNotification==NO) {
|
|
||||||
// [self testCurrenVersion];
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
if ([isExit isEqualToString:@"1"]) {
|
if ([isExit isEqualToString:@"1"]) {
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#import "AppDelegate+AliPushConfig.h"
|
#import "AppDelegate+AliPushConfig.h"
|
||||||
#import <objc/runtime.h>
|
#import <objc/runtime.h>
|
||||||
|
#import "IfishMessageViewController.h"
|
||||||
static const void *NotificationCenterKey = &NotificationCenterKey;
|
static const void *NotificationCenterKey = &NotificationCenterKey;
|
||||||
@implementation AppDelegate (AliPushConfig)
|
@implementation AppDelegate (AliPushConfig)
|
||||||
- (UNUserNotificationCenter *)notificationCenter {
|
- (UNUserNotificationCenter *)notificationCenter {
|
||||||
|
|
@ -255,8 +256,18 @@ static const void *NotificationCenterKey = &NotificationCenterKey;
|
||||||
NSString *body = [[NSString alloc] initWithData:message.body encoding:NSUTF8StringEncoding];
|
NSString *body = [[NSString alloc] initWithData:message.body encoding:NSUTF8StringEncoding];
|
||||||
NSLog(@"\n ====== Receive message title: %@, content: %@.", title, body);
|
NSLog(@"\n ====== Receive message title: %@, content: %@.", title, body);
|
||||||
NSLog(@"\n ====== 当前线程 %@",[NSThread currentThread]);
|
NSLog(@"\n ====== 当前线程 %@",[NSThread currentThread]);
|
||||||
[CommonUtils showAlerWithTitle:IsEmptyStr(title)?@"新消息":title withMsg:body];
|
// [CommonUtils showAlerWithTitle:IsEmptyStr(title)?@"新消息":title withMsg:body];
|
||||||
|
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:IsEmptyStr(title)?@"新消息":title message:body preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
UIAlertAction *alertAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
||||||
|
//进入消息列表页面
|
||||||
|
IfishMessageViewController *message = [[IfishMessageViewController alloc]init];
|
||||||
|
UIViewController *vc= (UINavigationController *)[CommonUtils appRootViewController];
|
||||||
|
vc.hidesBottomBarWhenPushed = YES;
|
||||||
|
[vc.navigationController pushViewController:message animated:YES];
|
||||||
|
vc.hidesBottomBarWhenPushed = NO;
|
||||||
|
}];
|
||||||
|
[alertController addAction:alertAction];
|
||||||
|
[[CommonUtils appRootViewController] presentViewController:alertController animated:YES completion:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark —页面跳转(暂时不做处理)
|
#pragma mark —页面跳转(暂时不做处理)
|
||||||
|
|
@ -284,28 +295,16 @@ static const void *NotificationCenterKey = &NotificationCenterKey;
|
||||||
|
|
||||||
NSString *userAction = response.actionIdentifier;
|
NSString *userAction = response.actionIdentifier;
|
||||||
|
|
||||||
// 点击通知打开app
|
// 点击通知打开app(app处于后台)
|
||||||
if ([userAction isEqualToString:UNNotificationDefaultActionIdentifier]) {
|
if ([userAction isEqualToString:UNNotificationDefaultActionIdentifier]) {
|
||||||
NSLog(@"\n ====== User opened the notification.");
|
NSLog(@"\n ====== User opened the notification.");
|
||||||
// 处理iOS 10通知,并上报通知打开回执
|
// 处理iOS 10通知,并上报通知打开回执
|
||||||
[self handleiOS10Notification:response.notification];
|
[self handleiOS10Notification:response.notification isActive:NO];
|
||||||
}
|
}
|
||||||
// 通知dismiss,category 创建时传入 UNNotificationCategoryOptionCustomDismissAction 才可以触发
|
// 通知dismiss,category 创建时传入 UNNotificationCategoryOptionCustomDismissAction 才可以触发
|
||||||
if ([userAction isEqualToString:UNNotificationDismissActionIdentifier]) {
|
if ([userAction isEqualToString:UNNotificationDismissActionIdentifier]) {
|
||||||
NSLog(@"\n ====== User dismissed the notification.");
|
NSLog(@"\n ====== User dismissed the notification.");
|
||||||
}
|
}
|
||||||
// NSString *customAction1 = @"action1";
|
|
||||||
// NSString *customAction2 = @"action2";
|
|
||||||
//
|
|
||||||
// // 点击用户自定义Action1
|
|
||||||
// if ([userAction isEqualToString:customAction1]) {
|
|
||||||
// NSLog(@"User custom action1.");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // 点击用户自定义Action2
|
|
||||||
// if ([userAction isEqualToString:customAction2]) {
|
|
||||||
// NSLog(@"User custom action2.");
|
|
||||||
// }
|
|
||||||
completionHandler();
|
completionHandler();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
@ -318,7 +317,7 @@ static const void *NotificationCenterKey = &NotificationCenterKey;
|
||||||
NSLog(@"\n ====== App 处于前台时收到通知 (iOS 10+ )");
|
NSLog(@"\n ====== App 处于前台时收到通知 (iOS 10+ )");
|
||||||
|
|
||||||
// 处理iOS 10通知,并上报通知打开回执
|
// 处理iOS 10通知,并上报通知打开回执
|
||||||
[self handleiOS10Notification:notification];
|
[self handleiOS10Notification:notification isActive:YES];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
处理完成后调用 completionHandler ,用于指示在前台显示通知的形式
|
处理完成后调用 completionHandler ,用于指示在前台显示通知的形式
|
||||||
|
|
@ -345,7 +344,7 @@ static const void *NotificationCenterKey = &NotificationCenterKey;
|
||||||
/**
|
/**
|
||||||
* 处理App 处于前台时收到通知 (iOS 10+ )
|
* 处理App 处于前台时收到通知 (iOS 10+ )
|
||||||
*/
|
*/
|
||||||
- (void)handleiOS10Notification:(UNNotification *)notification {
|
- (void)handleiOS10Notification:(UNNotification *)notification isActive:(BOOL)isActive{
|
||||||
|
|
||||||
UNNotificationRequest *request = notification.request;
|
UNNotificationRequest *request = notification.request;
|
||||||
UNNotificationContent *content = request.content;
|
UNNotificationContent *content = request.content;
|
||||||
|
|
@ -370,9 +369,29 @@ static const void *NotificationCenterKey = &NotificationCenterKey;
|
||||||
|
|
||||||
// 通知打开回执上报
|
// 通知打开回执上报
|
||||||
[CloudPushSDK sendNotificationAck:userInfo];
|
[CloudPushSDK sendNotificationAck:userInfo];
|
||||||
|
//App处于前台
|
||||||
NSLog(@"\n ====== App 处于前台时收到通知 (iOS 10+ ) Notification, == date: %@, == title: %@, == subtitle: %@, == body: %@, == badge: %d, == extras: %@.", noticeDate, title, subtitle, body, badge, extras);
|
if (isActive) {
|
||||||
[CommonUtils showAlerWithTitle:IsEmptyStr(title)?@"新通知":title withMsg:body];
|
NSLog(@"\n ====== App 处于前台时收到通知 (iOS 10+ ) Notification, == date: %@, == title: %@, == subtitle: %@, == body: %@, == badge: %d, == extras: %@.", noticeDate, title, subtitle, body, badge, extras);
|
||||||
|
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:IsEmptyStr(title)?@"新通知":title message:body preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
UIAlertAction *alertAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
||||||
|
//进入消息列表页面
|
||||||
|
IfishMessageViewController *message = [[IfishMessageViewController alloc]init];
|
||||||
|
UIViewController *vc= (UINavigationController *)[CommonUtils appRootViewController];
|
||||||
|
vc.hidesBottomBarWhenPushed = YES;
|
||||||
|
[vc.navigationController pushViewController:message animated:YES];
|
||||||
|
vc.hidesBottomBarWhenPushed = NO;
|
||||||
|
}];
|
||||||
|
[alertController addAction:alertAction];
|
||||||
|
[[CommonUtils appRootViewController] presentViewController:alertController animated:YES completion:nil];
|
||||||
|
}else{
|
||||||
|
NSLog(@"\n ====== App 处于后台时收到通知 (iOS 10+ ) Notification,点击通知打开应用, == date: %@, == title: %@, == subtitle: %@, == body: %@, == badge: %d, == extras: %@.", noticeDate, title, subtitle, body, badge, extras);
|
||||||
|
//进入消息列表页面
|
||||||
|
IfishMessageViewController *message = [[IfishMessageViewController alloc]init];
|
||||||
|
UIViewController *vc= (UINavigationController *)[CommonUtils appRootViewController];
|
||||||
|
vc.hidesBottomBarWhenPushed = YES;
|
||||||
|
[vc.navigationController pushViewController:message animated:YES];
|
||||||
|
vc.hidesBottomBarWhenPushed = NO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -417,14 +436,12 @@ static const void *NotificationCenterKey = &NotificationCenterKey;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
} else if (application.applicationState == UIApplicationStateInactive) {
|
} else if (application.applicationState == UIApplicationStateInactive) {
|
||||||
// // 程序处于后台 做相应的处理
|
// //点击通知打开app,则跳转到消息列表
|
||||||
// for (NSString *tfStr in userInfo) {
|
// IfishMessageViewController *message = [[IfishMessageViewController alloc]init];
|
||||||
// if ([tfStr isEqualToString:@"careline"]) {
|
// UIViewController *vc= (UINavigationController *)[CommonUtils appRootViewController];
|
||||||
// JumpViewController *_viewController = [[JumpViewController alloc]init];
|
// vc.hidesBottomBarWhenPushed = YES;
|
||||||
// UINavigationController *nav= (UINavigationController *)self.window.rootViewController;
|
// [vc.navigationController pushViewController:message animated:YES];
|
||||||
// [nav pushViewController:_viewController animated:YES];
|
// vc.hidesBottomBarWhenPushed = NO;
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -529,6 +529,12 @@ CGAffineTransform GetCGAffineTransformRotateAroundPoint(float centerX, float ce
|
||||||
while (topVC.presentedViewController) {
|
while (topVC.presentedViewController) {
|
||||||
topVC = topVC.presentedViewController;
|
topVC = topVC.presentedViewController;
|
||||||
}
|
}
|
||||||
|
if ([topVC isKindOfClass:[UITabBarController class]]) {
|
||||||
|
topVC = [(UITabBarController *)topVC selectedViewController];
|
||||||
|
}
|
||||||
|
if ([topVC isKindOfClass:[UINavigationController class]]) {
|
||||||
|
topVC = [(UINavigationController *)topVC topViewController];
|
||||||
|
}
|
||||||
return topVC;
|
return topVC;
|
||||||
}
|
}
|
||||||
+(void)showAlerWithTitle:(NSString*)title withMsg:(NSString*)msg{
|
+(void)showAlerWithTitle:(NSString*)title withMsg:(NSString*)msg{
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>9.8.5</string>
|
<string>9.8.8</string>
|
||||||
<key>ITSAppUsesNonExemptEncryption</key>
|
<key>ITSAppUsesNonExemptEncryption</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>LSApplicationCategoryType</key>
|
<key>LSApplicationCategoryType</key>
|
||||||
|
|
@ -379,11 +379,9 @@
|
||||||
<key>NSLocationWhenInUseUsageDescription</key>
|
<key>NSLocationWhenInUseUsageDescription</key>
|
||||||
<string>为获取爱鱼奇智能硬件产品及用户的地址区域分布,以提供更好的特色服务,爱鱼奇将获取您的地址</string>
|
<string>为获取爱鱼奇智能硬件产品及用户的地址区域分布,以提供更好的特色服务,爱鱼奇将获取您的地址</string>
|
||||||
<key>NSMicrophoneUsageDescription</key>
|
<key>NSMicrophoneUsageDescription</key>
|
||||||
<string>爱鱼奇需要您的同意,才能访问麦克风</string>
|
<string>爱鱼奇需要您的同意,才能访问麦克风,以便于使用语音对讲等功能</string>
|
||||||
<key>NSPhotoLibraryUsageDescription</key>
|
<key>NSPhotoLibraryUsageDescription</key>
|
||||||
<string>爱鱼奇需要您的同意,才能访问相册,以使用更换头像等图片上传功能</string>
|
<string>爱鱼奇需要您的同意,才能访问相册,以使用更换头像等图片上传功能</string>
|
||||||
<key>UIApplicationExitsOnSuspend</key>
|
|
||||||
<false/>
|
|
||||||
<key>UIBackgroundModes</key>
|
<key>UIBackgroundModes</key>
|
||||||
<array>
|
<array>
|
||||||
<string>remote-notification</string>
|
<string>remote-notification</string>
|
||||||
|
|
|
||||||
|
|
@ -133,16 +133,15 @@ alpha:1.0]
|
||||||
// 测试云 @"www.zhangxinyanv5.top"
|
// 测试云 @"www.zhangxinyanv5.top"
|
||||||
//#define SOCKETPORT @"www.zhangxinyanv5.top"
|
//#define SOCKETPORT @"www.zhangxinyanv5.top"
|
||||||
// 云 @"app.ifish7.com"
|
// 云 @"app.ifish7.com"
|
||||||
|
|
||||||
|
//正式环境
|
||||||
//#define SOCKETPORT @"app.ifish7.com"
|
//#define SOCKETPORT @"app.ifish7.com"
|
||||||
|
|
||||||
// 本地 @"192.168.61.128"
|
|
||||||
#define SOCKETPORT @"test.ifish7.com:9955"
|
|
||||||
|
|
||||||
//#define JIEKOUPORT @"https://app.ifish7.com"
|
//#define JIEKOUPORT @"https://app.ifish7.com"
|
||||||
//#define JIEKOUPORT @"http://test.ifish7.com:7080"
|
//#define JIEKOUPORTHTTP @"https://app.ifish7.com"
|
||||||
|
//测试环境
|
||||||
|
#define SOCKETPORT @"test.ifish7.com:9955"
|
||||||
#define JIEKOUPORT @"http://139.196.24.156:7080"
|
#define JIEKOUPORT @"http://139.196.24.156:7080"
|
||||||
#define JIEKOUPORTHTTP @"https://app.ifish7.com"
|
#define JIEKOUPORTHTTP @"https://app.ifish7.com"
|
||||||
|
|
||||||
//云 @"https://app.ifish7.com"
|
//云 @"https://app.ifish7.com"
|
||||||
//云图片头像等地址 @"http://app.ifish7.com"
|
//云图片头像等地址 @"http://app.ifish7.com"
|
||||||
//#define JIEKOUPORTHTTP @"https://app.ifish7.com"
|
//#define JIEKOUPORTHTTP @"https://app.ifish7.com"
|
||||||
|
|
@ -476,7 +475,7 @@ alpha:1.0]
|
||||||
|
|
||||||
//
|
//
|
||||||
#define getHotBarHistory [NSString stringWithFormat:@"%@/api/user/getDeviceHeaterPhsByDate.do",JIEKOUPORT]
|
#define getHotBarHistory [NSString stringWithFormat:@"%@/api/user/getDeviceHeaterPhsByDate.do",JIEKOUPORT]
|
||||||
/*=====================add V4.9.8=======================================*/
|
/*=====================add V4.9.8 by wbzhan=======================================*/
|
||||||
//获取推送消息列表
|
//获取推送消息列表
|
||||||
/**
|
/**
|
||||||
pushID 本地缓存的最大的pushId,第一次无的时候则不传
|
pushID 本地缓存的最大的pushId,第一次无的时候则不传
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,4 @@
|
||||||
#define IFISHTASK_ARR @"IfishTaskArray"
|
#define IFISHTASK_ARR @"IfishTaskArray"
|
||||||
#define IFISHTASK_HAVEDONEALL @"ifishTaskAllDone"
|
#define IFISHTASK_HAVEDONEALL @"ifishTaskAllDone"
|
||||||
|
|
||||||
//注册成功 登录云信
|
|
||||||
#define IFISHIMLOGINSUCSESS @"ifishIMuserLoginSucsses"
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* IfishAddGoldRuleType_h */
|
#endif /* IfishAddGoldRuleType_h */
|
||||||
|
|
|
||||||
|
|
@ -445,7 +445,7 @@
|
||||||
}else {
|
}else {
|
||||||
self.tipLabel.text = @"当月电量";
|
self.tipLabel.text = @"当月电量";
|
||||||
UInt64 mac = [dataContorl hexToTen:self.dataModel.electricity];
|
UInt64 mac = [dataContorl hexToTen:self.dataModel.electricity];
|
||||||
NSString *stringTemp = [NSString stringWithFormat:@"%llukwh",mac];
|
NSString *stringTemp = [NSString stringWithFormat:@"%llukwh",mac/10.0];
|
||||||
[self.tempLabel setAttributedText:[NSString ls_changeFontAndColor:[UIFont systemFontOfSize:15] Color:nil TotalString:stringTemp SubStringArray:@[@"kwh"]]];
|
[self.tempLabel setAttributedText:[NSString ls_changeFontAndColor:[UIFont systemFontOfSize:15] Color:nil TotalString:stringTemp SubStringArray:@[@"kwh"]]];
|
||||||
if (!_switchTimer) {
|
if (!_switchTimer) {
|
||||||
_switchTimer = [NSTimer timerWithTimeInterval:3.0 target:self selector:@selector(changeTemp) userInfo:nil repeats:YES];
|
_switchTimer = [NSTimer timerWithTimeInterval:3.0 target:self selector:@selector(changeTemp) userInfo:nil repeats:YES];
|
||||||
|
|
|
||||||
|
|
@ -66,16 +66,8 @@ extern BOOL launchedByNotification;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(imLogInnotifiy) name:IFISHIMLOGINSUCSESS object:nil];
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)imLogInnotifiy{
|
|
||||||
//原来消息在tab 登陆界面进来时 显示badge 消息栏 消息数 UI已改暂时不需要了 如以后改回来 登陆显示badge在此处理 打开下面
|
|
||||||
//NSInteger count = [[[NIMSDK sharedSDK] conversationManager] allUnreadCount];
|
|
||||||
//count ==0 ? (self.viewControllers[1].tabBarItem.badgeValue =nil):(self.viewControllers[1].tabBarItem.badgeValue = [NSString stringWithFormat:@"%ld",(long)count]);
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void)showAdview{
|
-(void)showAdview{
|
||||||
|
|
||||||
IfishStartAdView *adview=[[IfishStartAdView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
|
IfishStartAdView *adview=[[IfishStartAdView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
|
||||||
|
|
@ -106,13 +98,7 @@ extern BOOL launchedByNotification;
|
||||||
// Dispose of any resources that can be recreated.
|
// Dispose of any resources that can be recreated.
|
||||||
}
|
}
|
||||||
-(void)creatViewControllers{
|
-(void)creatViewControllers{
|
||||||
// 旧
|
|
||||||
// NSArray*VCArr=@[@"IfishDeviceViewController",
|
|
||||||
// @"IfishMessageViewController",
|
|
||||||
// @"IfishDiscoverViewController",
|
|
||||||
// @"IfishMeViewController"];
|
|
||||||
|
|
||||||
|
|
||||||
// 新v4.3前 消息在tab栏上
|
// 新v4.3前 消息在tab栏上
|
||||||
//NSArray*VCArr=@[@"IfishDeviceViewController",
|
//NSArray*VCArr=@[@"IfishDeviceViewController",
|
||||||
// @"IfishDiscoverViewController",
|
// @"IfishDiscoverViewController",
|
||||||
|
|
@ -197,7 +183,6 @@ extern BOOL launchedByNotification;
|
||||||
|
|
||||||
if (launchedByNotification) {
|
if (launchedByNotification) {
|
||||||
//点击通知栏启动应用 原消息在tab1 现改为0 如以后要点击通知栏在tab展示消息 或跳转相应tab 在此处理
|
//点击通知栏启动应用 原消息在tab1 现改为0 如以后要点击通知栏在tab展示消息 或跳转相应tab 在此处理
|
||||||
//self.selectedIndex = 1;
|
|
||||||
self.selectedIndex = 0;
|
self.selectedIndex = 0;
|
||||||
launchedByNotification = NO;
|
launchedByNotification = NO;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -297,35 +297,33 @@ extern BOOL launchedByNotification;
|
||||||
[self.dataSource addObject:oldMessageArray];
|
[self.dataSource addObject:oldMessageArray];
|
||||||
}
|
}
|
||||||
[self.tableView reloadData];
|
[self.tableView reloadData];
|
||||||
|
[self postReadMessageRequest];
|
||||||
}
|
}
|
||||||
} failure:^(NSError *err) {
|
} failure:^(NSError *err) {
|
||||||
[SVProgressHUD dismiss];
|
[SVProgressHUD dismiss];
|
||||||
}];
|
}];
|
||||||
|
|
||||||
}
|
}
|
||||||
//发送已读记录
|
//进入消息列表,则设置所有消息为已读
|
||||||
-(void)postReadMessageRequestWithIndexPath:(NSIndexPath *)indexPath{
|
-(void)postReadMessageRequest{
|
||||||
|
|
||||||
UserModel*userModel=[dataContorl getUserInfo];
|
UserModel*userModel=[dataContorl getUserInfo];
|
||||||
PushmessageModel *model = [[self.dataSource objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
|
|
||||||
if([model.isRead integerValue]==1)//未读消息
|
NSDictionary *params = @{@"userId":userModel.userId,
|
||||||
{
|
|
||||||
NSDictionary *params = @{@"userId":userModel.userId,
|
|
||||||
@"pushId":model.pushId,
|
|
||||||
};
|
};
|
||||||
[AFNOHeaderHttpTool requestWihtMethod:RequestTypePost url:Push_Message_Readed params:params success:^(id response) {
|
[AFNOHeaderHttpTool requestWihtMethod:RequestTypePost url:Push_Message_Readed params:params success:^(id response) {
|
||||||
if (response) {
|
if (response) {
|
||||||
id resault=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
|
id resault=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
|
||||||
NSString *result = [resault objectForKey:RESPONSE_CODE];
|
NSString *result = [resault objectForKey:RESPONSE_CODE];
|
||||||
if ([result integerValue]==kReqSuccess) {
|
if ([result integerValue]==kReqSuccess) {
|
||||||
//已读
|
//已读
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} failure:^(NSError *err) {
|
} failure:^(NSError *err) {
|
||||||
|
|
||||||
}];
|
}];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//单独删除某一条消息
|
//单独删除某一条消息
|
||||||
-(void)deleteSingleMessageWithIndex:(NSIndexPath *)indexPath{
|
-(void)deleteSingleMessageWithIndex:(NSIndexPath *)indexPath{
|
||||||
|
|
@ -517,8 +515,8 @@ extern BOOL launchedByNotification;
|
||||||
|
|
||||||
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
//默认消息已读
|
||||||
[self postReadMessageRequestWithIndexPath:indexPath];
|
// [self postReadMessageRequestWithIndexPath:indexPath];
|
||||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:@"确认删除该消息么" preferredStyle:UIAlertControllerStyleAlert];
|
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:@"确认删除该消息么" preferredStyle:UIAlertControllerStyleAlert];
|
||||||
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
|
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
|
||||||
NSLog(@"cancel Action");
|
NSLog(@"cancel Action");
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,7 @@ Assign NSInteger messageCount;//消息个数
|
||||||
[self initUI];
|
[self initUI];
|
||||||
[self showProgress];
|
[self showProgress];
|
||||||
[self addDataRequestQueue];
|
[self addDataRequestQueue];
|
||||||
|
[self checkNotification];
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deleteCurDevice) name:@"DeleteCurDevice" object:nil];
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deleteCurDevice) name:@"DeleteCurDevice" object:nil];
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateDevice) name:@"updateDevice" object:nil];
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateDevice) name:@"updateDevice" object:nil];
|
||||||
}
|
}
|
||||||
|
|
@ -134,7 +135,17 @@ Assign NSInteger messageCount;//消息个数
|
||||||
self.progressHud.labelText = @"加载中...";
|
self.progressHud.labelText = @"加载中...";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//app通过点击通知打开app,此处校验通知内容,做出相应的跳转
|
||||||
|
-(void)checkNotification{
|
||||||
|
//通过点击通知打开app,直接跳转到消息列表页面
|
||||||
|
if ([AppDelegate sharedDefault].remoteNotification) {
|
||||||
|
IfishMessageViewController *message = [[IfishMessageViewController alloc]init];
|
||||||
|
UIViewController *vc= (UINavigationController *)[CommonUtils appRootViewController];
|
||||||
|
vc.hidesBottomBarWhenPushed = YES;
|
||||||
|
[vc.navigationController pushViewController:message animated:YES];
|
||||||
|
vc.hidesBottomBarWhenPushed = NO;
|
||||||
|
}
|
||||||
|
}
|
||||||
//获取未读消息个数
|
//获取未读消息个数
|
||||||
-(void)getMessageCount{
|
-(void)getMessageCount{
|
||||||
|
|
||||||
|
|
@ -1591,6 +1602,8 @@ Assign NSInteger messageCount;//消息个数
|
||||||
#pragma mark - 导航栏消息,跳转进入消息列表
|
#pragma mark - 导航栏消息,跳转进入消息列表
|
||||||
-(void)navMeaasageBtnAction{
|
-(void)navMeaasageBtnAction{
|
||||||
|
|
||||||
|
self.messageCount = 0;
|
||||||
|
[self setRedViewData];//刷新消息显示
|
||||||
// UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:sessionList];
|
// UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:sessionList];
|
||||||
// [nav.navigationBar resetBackgroundImage];
|
// [nav.navigationBar resetBackgroundImage];
|
||||||
// nav.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
|
// nav.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
|
||||||
|
|
@ -1599,6 +1612,7 @@ Assign NSInteger messageCount;//消息个数
|
||||||
self.hidesBottomBarWhenPushed = YES;
|
self.hidesBottomBarWhenPushed = YES;
|
||||||
[self.navigationController pushViewController:message animated:YES];
|
[self.navigationController pushViewController:message animated:YES];
|
||||||
self.hidesBottomBarWhenPushed = NO;
|
self.hidesBottomBarWhenPushed = NO;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
||||||
|
|
@ -709,7 +709,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UInt64 mac = [dataContorl hexToTen:_xuanduoBack.electricity];
|
UInt64 mac = [dataContorl hexToTen:_xuanduoBack.electricity];
|
||||||
NSString *stringTemp = [NSString stringWithFormat:@"%llukwh",mac];
|
NSString *stringTemp = [NSString stringWithFormat:@"%llukwh",mac/10.0];
|
||||||
cell.templabel.font = [UIFont systemFontOfSize:37];
|
cell.templabel.font = [UIFont systemFontOfSize:37];
|
||||||
cell.templabel.textColor = RGB(253, 188, 63);
|
cell.templabel.textColor = RGB(253, 188, 63);
|
||||||
[cell.templabel setAttributedText:[NSString ls_changeFontAndColor:[UIFont systemFontOfSize:17] Color:nil TotalString:stringTemp SubStringArray:@[@"kwh"]]];
|
[cell.templabel setAttributedText:[NSString ls_changeFontAndColor:[UIFont systemFontOfSize:17] Color:nil TotalString:stringTemp SubStringArray:@[@"kwh"]]];
|
||||||
|
|
|
||||||
|
|
@ -294,7 +294,7 @@
|
||||||
[[IfishUserDataUnity shareDataInstance] userloginValidationSuccsess:DataDic phoneNumber:phoneNumber passward:password];
|
[[IfishUserDataUnity shareDataInstance] userloginValidationSuccsess:DataDic phoneNumber:phoneNumber passward:password];
|
||||||
//登陆成功之后,验证当前页面devicetoken是否上送成功,如果还未上送,则重新上送devicetoken
|
//登陆成功之后,验证当前页面devicetoken是否上送成功,如果还未上送,则重新上送devicetoken
|
||||||
if (![[NSUserDefaults standardUserDefaults] boolForKey:is_Bind_DeviceToken]) {
|
if (![[NSUserDefaults standardUserDefaults] boolForKey:is_Bind_DeviceToken]) {
|
||||||
UserModel *model=[[UserModel alloc] initWithDict:DataDic];
|
UserModel *model=[[UserModel alloc] initWithDict:[DataDic objectForKey:@"userInfo"]];
|
||||||
NSDictionary *params = @{@"deviceId":[FuncUserDefault strForKey:kDeviceToken],
|
NSDictionary *params = @{@"deviceId":[FuncUserDefault strForKey:kDeviceToken],
|
||||||
@"userId":model.userId,
|
@"userId":model.userId,
|
||||||
@"phoneType":@"iOS"
|
@"phoneType":@"iOS"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue