chat: fix badge count on iPad

This commit is contained in:
Gautier Pelloux-Prayer 2016-01-07 11:52:09 +01:00
parent e06564105f
commit d7a80a37e2
4 changed files with 11 additions and 3 deletions

View file

@ -152,6 +152,11 @@ static void chatTable_free_chatrooms(void *data) {
LinphoneChatRoom *chatRoom = (LinphoneChatRoom *)ms_list_nth_data(data, (int)[indexPath row]);
ChatConversationView *view = VIEW(ChatConversationView);
[view setChatRoom:chatRoom];
// on iPad, force unread bubble to disappear by reloading the cell
if (IPAD) {
UIChatCell *cell = [tableView cellForRowAtIndexPath:indexPath];
[cell updateUnreadBadge];
}
[PhoneMainView.instance changeCurrentView:view.compositeViewDescription push:TRUE];
}
}

View file

@ -50,7 +50,7 @@
</label>
<view hidden="YES" autoresizesSubviews="NO" userInteractionEnabled="NO" tag="7" contentMode="scaleToFill" id="7DE-KJ-9Q3" userLabel="unreadCountView" customClass="UIBouncingView">
<rect key="frame" x="350" y="7" width="21" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" tag="8" contentMode="scaleAspectFit" image="history_chat_indicator.png" id="NXj-A8-YLh" userLabel="unreadCountImage">
<rect key="frame" x="0.0" y="0.0" width="21" height="21"/>

View file

@ -39,6 +39,6 @@
- (id)initWithIdentifier:(NSString*)identifier;
- (IBAction)onDeleteClick:(id)event;
- (void)updateUnreadBadge;
- (void)setChatRoom:(LinphoneChatRoom *)achat;
@end

View file

@ -93,6 +93,10 @@
_chatLatestTimeLabel.text = NSLocalizedString(@"Now", nil);
}
[self updateUnreadBadge];
}
- (void)updateUnreadBadge {
int count = linphone_chat_room_get_unread_messages_count(chatRoom);
_unreadCountLabel.text = [NSString stringWithFormat:@"%i", count];
if (count > 0) {
@ -100,7 +104,6 @@
} else {
[_unreadCountView stopAnimating:YES];
}
UIFont *addressFont = (count <= 0) ? [UIFont systemFontOfSize:25] : [UIFont boldSystemFontOfSize:25];
_addressLabel.font = addressFont;
}