更换阿里推送,消息页面,以及部分bug修复

This commit is contained in:
wbzhan
2019-06-15 17:44:25 +08:00
parent 1ff1ff84b1
commit 5a10dfa182
13 changed files with 97 additions and 98 deletions
@@ -445,7 +445,7 @@
}else {
self.tipLabel.text = @"当月电量";
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"]]];
if (!_switchTimer) {
_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{
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.
}
-(void)creatViewControllers{
// 旧
// NSArray*VCArr=@[@"IfishDeviceViewController",
// @"IfishMessageViewController",
// @"IfishDiscoverViewController",
// @"IfishMeViewController"];
// 新v4.3前 消息在tab栏上
//NSArray*VCArr=@[@"IfishDeviceViewController",
// @"IfishDiscoverViewController",
@@ -197,7 +183,6 @@ extern BOOL launchedByNotification;
if (launchedByNotification) {
//点击通知栏启动应用 原消息在tab1 现改为0 如以后要点击通知栏在tab展示消息 或跳转相应tab 在此处理
//self.selectedIndex = 1;
self.selectedIndex = 0;
launchedByNotification = NO;
@@ -297,35 +297,33 @@ extern BOOL launchedByNotification;
[self.dataSource addObject:oldMessageArray];
}
[self.tableView reloadData];
[self postReadMessageRequest];
}
} failure:^(NSError *err) {
[SVProgressHUD dismiss];
}];
}
//发送已读记录
-(void)postReadMessageRequestWithIndexPath:(NSIndexPath *)indexPath{
//进入消息列表,则设置所有消息为已读
-(void)postReadMessageRequest{
UserModel*userModel=[dataContorl getUserInfo];
PushmessageModel *model = [[self.dataSource objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
if([model.isRead integerValue]==1)//未读消息
{
NSDictionary *params = @{@"userId":userModel.userId,
@"pushId":model.pushId,
NSDictionary *params = @{@"userId":userModel.userId,
};
[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) {
id resault=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
NSString *result = [resault objectForKey:RESPONSE_CODE];
if ([result integerValue]==kReqSuccess) {
//已读
}else{
}
}
} failure:^(NSError *err) {
}];
}
}];
}
//单独删除某一条消息
-(void)deleteSingleMessageWithIndex:(NSIndexPath *)indexPath{
@@ -517,8 +515,8 @@ extern BOOL launchedByNotification;
dispatch_async(dispatch_get_main_queue(), ^{
[self postReadMessageRequestWithIndexPath:indexPath];
//默认消息已读
// [self postReadMessageRequestWithIndexPath:indexPath];
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:@"确认删除该消息么" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
NSLog(@"cancel Action");
@@ -98,6 +98,7 @@ Assign NSInteger messageCount;//消息个数
[self initUI];
[self showProgress];
[self addDataRequestQueue];
[self checkNotification];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deleteCurDevice) name:@"DeleteCurDevice" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateDevice) name:@"updateDevice" object:nil];
}
@@ -134,7 +135,17 @@ Assign NSInteger messageCount;//消息个数
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{
@@ -1591,6 +1602,8 @@ Assign NSInteger messageCount;//消息个数
#pragma mark - 导航栏消息,跳转进入消息列表
-(void)navMeaasageBtnAction{
self.messageCount = 0;
[self setRedViewData];//刷新消息显示
// UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:sessionList];
// [nav.navigationBar resetBackgroundImage];
// nav.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
@@ -1599,6 +1612,7 @@ Assign NSInteger messageCount;//消息个数
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:message animated:YES];
self.hidesBottomBarWhenPushed = NO;
}
@end
@@ -709,7 +709,7 @@
return;
}
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.textColor = RGB(253, 188, 63);
[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];
//devicetoken是否上送成功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],
@"userId":model.userId,
@"phoneType":@"iOS"