Skip to content

Commit

Permalink
Merge pull request #78 from InjoyDeng/master
Browse files Browse the repository at this point in the history
「fix」没有客服的情况下不显示评价
  • Loading branch information
InjoyDeng committed Feb 2, 2016
2 parents f3c78d2 + 24aa129 commit cd8259e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,15 +250,17 @@ - (void)setNavBar {
#else
UIButton *rightNavButton = [UIButton buttonWithType:UIButtonTypeCustom];
NSString *btnText = [MQBundleUtil localizedStringForKey:@"meiqia_evaluation_sheet"];
UIFont *btnTextFont = [UIFont systemFontOfSize:14.0];
UIFont *btnTextFont = [UIFont systemFontOfSize:[UIFont buttonFontSize]];
CGFloat btnTextHeight = [MQStringSizeUtil getHeightForText:btnText withFont:btnTextFont andWidth:200];
CGFloat btnTextWidth = [MQStringSizeUtil getWidthForText:btnText withFont:btnTextFont andHeight:btnTextHeight];
rightNavButton.frame = CGRectMake(0, 0, btnTextWidth, btnTextHeight);
rightNavButton.titleLabel.font = btnTextFont;
[rightNavButton setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
[rightNavButton setTitleColor:[UIColor colorWithRed:0.0 green:122.0/255.0 blue:1.0 alpha:1.0] forState:UIControlStateNormal];
[rightNavButton setTitleColor:[UIColor darkGrayColor] forState:UIControlStateDisabled];
[rightNavButton setTitle:btnText forState:UIControlStateNormal];
[rightNavButton addTarget:self action:@selector(tapNavigationRightBtn:) forControlEvents:UIControlEventTouchUpInside];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightNavButton];
self.navigationItem.rightBarButtonItem.customView.hidden = YES;
#endif
}

Expand Down Expand Up @@ -286,6 +288,11 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
}

#pragma UIScrollViewDelegate
- (void)hideRightBarButtonItem:(BOOL)enabled
{
self.navigationItem.rightBarButtonItem.customView.hidden = enabled;
}

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
[self.chatTableView scrollViewDidEndDragging:scrollView willDecelerate:decelerate];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@

@protocol MQChatViewServiceDelegate <NSObject>

/**
* 是否隐藏RightBarButtonItem
*
* @param enabled 是否隐藏
*/
- (void)hideRightBarButtonItem:(BOOL)isHide;

/**
* 获取到了更多历史消息
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,9 @@ - (void)setClientOnline {
if (!completion) {
//没有分配到客服
agentName = [MQBundleUtil localizedStringForKey: agentName && agentName.length>0 ? agentName : @"no_agent_title"];
[weakSelf.delegate hideRightBarButtonItem:YES];
}else{
[weakSelf.delegate hideRightBarButtonItem:NO];
}
//获取顾客信息
[weakSelf getClientInfo];
Expand Down Expand Up @@ -734,8 +737,12 @@ - (void)didSendMessageWithNewMessageId:(NSString *)newMessageId
isThereNoAgent = true;
}
if (isThereNoAgent) {
[self.delegate hideRightBarButtonItem:YES];
[self addSystemTips];
[self updateChatTitleWithAgentName:[MQBundleUtil localizedStringForKey:@"no_agent_title"]];
}else{
//显示评价按钮
[self.delegate hideRightBarButtonItem:NO];
}
NSInteger index = [self getIndexOfCellWithMessageId:oldMessageId];
if (index < 0) {
Expand Down
Binary file modified Meiqia-SDK-files/MeiQiaSDK.framework/MeiQiaSDK
Binary file not shown.

0 comments on commit cd8259e

Please sign in to comment.