fix crash and add multiple composing receveived management

This commit is contained in:
Benjamin Reis 2017-10-31 15:27:28 +01:00
parent b228041d09
commit 223f760f4b
2 changed files with 14 additions and 4 deletions

View file

@ -241,7 +241,6 @@ static UICompositeViewDescription *compositeDescription = nil;
}
[ContactDisplay setDisplayNameLabel:_addressLabel forAddress:addr];
_addressLabel.accessibilityValue = _addressLabel.text;
_composeLabel.text = [NSString stringWithFormat:NSLocalizedString(@"%@ is composing...", nil), _addressLabel.text];
}
- (BOOL)sendMessage:(NSString *)message withExterlBodyUrl:(NSURL *)externalUrl withInternalURL:(NSURL *)internalUrl {
@ -323,7 +322,6 @@ static UICompositeViewDescription *compositeDescription = nil;
}
- (void)setComposingVisible:(BOOL)visible withDelay:(CGFloat)delay {
if (composingVisible == visible)
return;
@ -335,6 +333,19 @@ static UICompositeViewDescription *compositeDescription = nil;
// pull up the composing frame and shrink the table view
newTableFrame.size.height -= newComposingFrame.size.height;
newComposingFrame.origin.y = keyboardFrame.origin.y - newComposingFrame.size.height;
bctbx_list_t *addresses = linphone_chat_room_get_composing_addresses(_chatRoom);
NSString *composingAddresses = @"";
if (bctbx_list_size(addresses) == 1) {
composingAddresses = [NSString stringWithUTF8String:linphone_address_get_username((LinphoneAddress *)addresses->data)];
_composeLabel.text = [NSString stringWithFormat:NSLocalizedString(@"%@ is composing...", nil), composingAddresses];
} else {
while (addresses) {
composingAddresses = [composingAddresses stringByAppendingString:@", "];
composingAddresses = [composingAddresses stringByAppendingString:[NSString stringWithUTF8String:linphone_address_get_username((LinphoneAddress *)addresses->data)]];
addresses = addresses->next;
}
_composeLabel.text = [NSString stringWithFormat:NSLocalizedString(@"%@ are composing...", nil), composingAddresses];
}
} else {
// pull down the composing frame and widen the tableview
newTableFrame.size.height += newComposingFrame.size.height;

View file

@ -271,8 +271,7 @@ static RootViewManager *rootViewManagerInstance = nil;
ChatConversationView *view = VIEW(ChatConversationView);
// if we already are in the conversation, we should not ring/vibrate
if (view.chatRoom && linphone_address_weak_equal(linphone_chat_room_get_peer_address(room),
linphone_chat_room_get_peer_address(view.chatRoom)))
if (view.chatRoom && _currentRoom == view.chatRoom)
return;
if ([UIApplication sharedApplication].applicationState != UIApplicationStateActive)