mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Merge remote-tracking branch 'refs/remotes/origin/release/4.7'
This commit is contained in:
commit
ac49ee5d56
6 changed files with 66 additions and 61 deletions
|
|
@ -32,7 +32,7 @@
|
|||
NSString *messageText;
|
||||
}
|
||||
|
||||
@property(nonatomic) LinphoneChatMessage *msg;
|
||||
@property(nonatomic) LinphoneEventLog *event;
|
||||
@property(nonatomic) bctbx_list_t *displayedList;
|
||||
@property(nonatomic) bctbx_list_t *receivedList;
|
||||
@property(nonatomic) bctbx_list_t *notReceivedList;
|
||||
|
|
|
|||
|
|
@ -48,17 +48,12 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
_msg = NULL;
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
int index = [VIEW(ChatConversationView).tableController indexOfMesssage:_msg];
|
||||
if (index < 0)
|
||||
[PhoneMainView.instance popToView:ChatConversationView.compositeViewDescription];
|
||||
|
||||
_cell = (UIChatBubbleTextCell *)[VIEW(ChatConversationView).tableController tableView:VIEW(ChatConversationView).tableController.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0]];
|
||||
_cell = [VIEW(ChatConversationView).tableController buildMessageCell:_event];
|
||||
_cell.frame = CGRectMake(-10,0,_msgView.frame.size.width,_msgView.frame.size.height);
|
||||
_cell.isFirst = true;
|
||||
_cell.isLast = true;
|
||||
|
|
@ -90,7 +85,8 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
|
||||
- (void)updateImdnList {
|
||||
if (_msg && linphone_chat_message_get_chat_room(_msg)) {
|
||||
if (_event) {
|
||||
LinphoneChatMessage *_msg = linphone_event_log_get_chat_message(_event);
|
||||
_displayedList = linphone_chat_message_get_participants_by_imdn_state(_msg, LinphoneChatMessageStateDisplayed);
|
||||
_receivedList = linphone_chat_message_get_participants_by_imdn_state(_msg, LinphoneChatMessageStateDeliveredToUser);
|
||||
_notReceivedList = linphone_chat_message_get_participants_by_imdn_state(_msg, LinphoneChatMessageStateDelivered);
|
||||
|
|
@ -101,7 +97,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
|
||||
- (void)fitContent {
|
||||
|
||||
LinphoneChatMessage *_msg = linphone_event_log_get_chat_message(_event);
|
||||
CGSize messageSize = [UIChatBubbleTextCell ViewHeightForMessage:_msg withWidth:self.view.frame.size.width];
|
||||
[_msgView setFrame:CGRectMake(_msgView.frame.origin.x,
|
||||
_msgView.frame.origin.y,
|
||||
|
|
@ -299,7 +295,8 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
f.unitsStyle = NSDateComponentsFormatterUnitsStylePositional;
|
||||
f.zeroFormattingBehavior = NSDateComponentsFormatterZeroFormattingBehaviorPad;
|
||||
|
||||
if (linphone_chat_message_is_ephemeral(_msg)) {
|
||||
LinphoneChatMessage *_msg = _event ? linphone_event_log_get_chat_message(_event) : nil;
|
||||
if (_msg && linphone_chat_message_is_ephemeral(_msg)) {
|
||||
long duration = linphone_chat_message_get_ephemeral_expire_time(_msg) == 0 ?
|
||||
linphone_chat_room_get_ephemeral_lifetime(linphone_chat_message_get_chat_room(_msg)) :
|
||||
linphone_chat_message_get_ephemeral_expire_time(_msg)-[NSDate date].timeIntervalSince1970;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#import "UICheckBoxTableView.h"
|
||||
|
||||
|
||||
@interface FileContext : NSObject
|
||||
@property NSMutableArray <NSString *> *typesArray;
|
||||
@property NSMutableArray <NSData *> *datasArray;
|
||||
|
|
@ -70,5 +71,6 @@
|
|||
- (void) dismissMessagesPopups;
|
||||
- (void) scrollToMessage:(LinphoneChatMessage *)message;
|
||||
- (int) indexOfMesssage:(LinphoneChatMessage *)message;
|
||||
- (void *)buildMessageCell:(LinphoneEventLog *) event;
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
#import "LinphoneManager.h"
|
||||
#import "ChatConversationTableView.h"
|
||||
#import "ChatConversationImdnView.h"
|
||||
#import "UIChatBubbleTextCell.h"
|
||||
#import "UIChatBubblePhotoCell.h"
|
||||
#import "UIChatNotifiedEventCell.h"
|
||||
#import "PhoneMainView.h"
|
||||
|
|
@ -330,28 +329,32 @@ static const int BASIC_EVENT_LIST=15;
|
|||
}
|
||||
}
|
||||
|
||||
-(UIChatBubbleTextCell *)buildMessageCell:(LinphoneEventLog *) event {
|
||||
NSString *kCellId = nil;
|
||||
LinphoneChatMessage *chat = linphone_event_log_get_chat_message(event);
|
||||
BOOL isConferenceIcs = [ICSBubbleView isConferenceInvitationMessageWithCmessage:chat];
|
||||
if (!isConferenceIcs && (linphone_chat_message_get_file_transfer_information(chat) || linphone_chat_message_get_external_body_url(chat)))
|
||||
kCellId = NSStringFromClass(UIChatBubblePhotoCell.class);
|
||||
else
|
||||
kCellId = NSStringFromClass(UIChatBubbleTextCell.class);
|
||||
// To use less memory and to avoid overlapping. To be improved.
|
||||
UIChatBubbleTextCell *cell = [self.tableView dequeueReusableCellWithIdentifier:kCellId];
|
||||
cell = [[NSClassFromString(kCellId) alloc] initWithIdentifier:kCellId];
|
||||
[cell setEvent:event];
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
NSString *kCellId = nil;
|
||||
LinphoneEventLog *event = [[eventList objectAtIndex:indexPath.row] pointerValue];
|
||||
if (linphone_event_log_get_type(event) == LinphoneEventLogTypeConferenceChatMessage) {
|
||||
UIChatBubbleTextCell *cell = [self buildMessageCell:event];
|
||||
LinphoneChatMessage *chat = linphone_event_log_get_chat_message(event);
|
||||
BOOL isConferenceIcs = [ICSBubbleView isConferenceInvitationMessageWithCmessage:chat];
|
||||
if (!isConferenceIcs && (linphone_chat_message_get_file_transfer_information(chat) || linphone_chat_message_get_external_body_url(chat)))
|
||||
kCellId = NSStringFromClass(UIChatBubblePhotoCell.class);
|
||||
else
|
||||
kCellId = NSStringFromClass(UIChatBubbleTextCell.class);
|
||||
|
||||
// To use less memory and to avoid overlapping. To be improved.
|
||||
UIChatBubbleTextCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId];
|
||||
cell = [[NSClassFromString(kCellId) alloc] initWithIdentifier:kCellId];
|
||||
|
||||
[cell setEvent:event];
|
||||
if (chat) {
|
||||
cell.isFirst = [self isFirstIndexInTableView:indexPath chat:chat];
|
||||
cell.isLast = [self isLastIndexInTableView:indexPath chat:chat];
|
||||
[cell update];
|
||||
}
|
||||
|
||||
if (chat) {
|
||||
cell.isFirst = [self isFirstIndexInTableView:indexPath chat:chat];
|
||||
cell.isLast = [self isLastIndexInTableView:indexPath chat:chat];
|
||||
[cell update];
|
||||
}
|
||||
[cell setChatRoomDelegate:_chatRoomDelegate];
|
||||
[super accessoryForCell:cell atPath:indexPath];
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
|
|
@ -442,12 +445,11 @@ static const CGFloat MESSAGE_SPACING_PERCENTAGE = 1.f;
|
|||
|
||||
LinphoneEventLog *event = [[eventList objectAtIndex:indexPath.row] pointerValue];
|
||||
UIContextualAction *imdnAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal
|
||||
title:NSLocalizedString(@"Info", nil)
|
||||
handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
|
||||
LinphoneChatMessage *msg = linphone_event_log_get_chat_message(event);
|
||||
ChatConversationImdnView *view = VIEW(ChatConversationImdnView);
|
||||
view.msg = msg;
|
||||
[PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
|
||||
title:NSLocalizedString(@"Info", nil)
|
||||
handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
|
||||
ChatConversationImdnView *view = VIEW(ChatConversationImdnView);
|
||||
view.event = event;
|
||||
[PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
|
||||
}];
|
||||
|
||||
UISwipeActionsConfiguration *swipeActionConfig;
|
||||
|
|
|
|||
|
|
@ -335,19 +335,19 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
LinphoneAddress *peerAddr = linphone_core_create_address([LinphoneManager getLc], _peerAddress);
|
||||
if (peerAddr) {
|
||||
_chatRoom = linphone_core_get_chat_room([LinphoneManager getLc], peerAddr);
|
||||
isOneToOne = linphone_chat_room_get_capabilities(_chatRoom) & LinphoneChatRoomCapabilitiesOneToOne;
|
||||
isEncrypted = linphone_chat_room_get_capabilities(_chatRoom) & LinphoneChatRoomCapabilitiesEncrypted;
|
||||
if (_chatRoom)
|
||||
if (_chatRoom) {
|
||||
isOneToOne = linphone_chat_room_get_capabilities(_chatRoom) & LinphoneChatRoomCapabilitiesOneToOne;
|
||||
isEncrypted = linphone_chat_room_get_capabilities(_chatRoom) & LinphoneChatRoomCapabilitiesEncrypted;
|
||||
[self setComposingVisible:!composingVisible withDelay:0];
|
||||
[self configureForRoom:true];
|
||||
[_tableController scrollToBottom:true];
|
||||
}
|
||||
}
|
||||
|
||||
[self configureForRoom:true];
|
||||
_backButton.hidden = _tableController.isEditing;
|
||||
[_tableController scrollToBottom:true];
|
||||
[self refreshImageDrawer];
|
||||
[self refreshImageDrawer];
|
||||
[self stopAllPlays];
|
||||
[self keyboardWillHide:nil];
|
||||
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
|
@ -501,25 +501,25 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
|
||||
// reload the chatroom after the core starts
|
||||
- (void)onLinphoneCoreReady:(NSNotification *)notif {
|
||||
// if ((LinphoneGlobalState)[[[notif userInfo] valueForKey:@"state"] integerValue] == LinphoneGlobalOn) {
|
||||
if (linphone_core_get_global_state(LC) == LinphoneGlobalOn) {
|
||||
LinphoneAddress *peerAddr = linphone_core_create_address([LinphoneManager getLc], _peerAddress);
|
||||
if (peerAddr) {
|
||||
_chatRoom = linphone_core_get_chat_room([LinphoneManager getLc], peerAddr);
|
||||
isOneToOne = linphone_chat_room_get_capabilities(_chatRoom) & LinphoneChatRoomCapabilitiesOneToOne;
|
||||
isEncrypted = linphone_chat_room_get_capabilities(_chatRoom) & LinphoneChatRoomCapabilitiesEncrypted;
|
||||
}
|
||||
[self configureForRoom:self.editing];
|
||||
if (_chatRoom && _markAsRead) {
|
||||
if (IPAD) {
|
||||
[VIEW(ChatsListView).tableController loadData];
|
||||
LinphoneAddress *peerAddr = linphone_core_create_address([LinphoneManager getLc], _peerAddress);
|
||||
if (peerAddr) {
|
||||
_chatRoom = linphone_core_get_chat_room([LinphoneManager getLc], peerAddr);
|
||||
if (_chatRoom) {
|
||||
isOneToOne = linphone_chat_room_get_capabilities(_chatRoom) & LinphoneChatRoomCapabilitiesOneToOne;
|
||||
isEncrypted = linphone_chat_room_get_capabilities(_chatRoom) & LinphoneChatRoomCapabilitiesEncrypted;
|
||||
[self configureForRoom:self.editing];
|
||||
if (_chatRoom && _markAsRead) {
|
||||
if (IPAD) {
|
||||
[VIEW(ChatsListView).tableController loadData];
|
||||
}
|
||||
[ChatConversationView markAsRead:_chatRoom];
|
||||
}
|
||||
_markAsRead = TRUE;
|
||||
}
|
||||
|
||||
[ChatConversationView markAsRead:_chatRoom];
|
||||
}
|
||||
_markAsRead = TRUE;
|
||||
}
|
||||
[SVProgressHUD dismiss];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)callUpdateEvent:(NSNotification *)notif {
|
||||
|
|
@ -677,9 +677,11 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
completion:^(BOOL finished) {
|
||||
_composeIndicatorView.hidden = !visible;
|
||||
}];
|
||||
if (_tableController.tableView.contentOffset.y + newComposingFrame.size.height >= (_tableController.tableView.contentSize.height - _tableController.tableView.frame.size.height)) {
|
||||
[_tableController scrollToBottom:TRUE];
|
||||
}
|
||||
if (visible) {
|
||||
if (_tableController.tableView.contentOffset.y + newComposingFrame.size.height >= (_tableController.tableView.contentSize.height - _tableController.tableView.frame.size.height)) {
|
||||
[_tableController scrollToBottom:TRUE];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL) groupCallAvailable {
|
||||
|
|
|
|||
|
|
@ -848,6 +848,8 @@ static const CGFloat REPLY_OR_FORWARD_TAG_HEIGHT = 18;
|
|||
|
||||
-(void) buildActions {
|
||||
LinphoneChatMessage *message = self.message;
|
||||
LinphoneEventLog *event = self.event;
|
||||
|
||||
_messageActionsTitles = [[NSMutableArray alloc] init];
|
||||
_messageActionsBlocks = [[NSMutableArray alloc] init];
|
||||
_messageActionsIcons = [[NSMutableArray alloc] init];
|
||||
|
|
@ -905,7 +907,7 @@ static const CGFloat REPLY_OR_FORWARD_TAG_HEIGHT = 18;
|
|||
[_messageActionsBlocks addObject:^{
|
||||
[thiz dismissPopup];
|
||||
ChatConversationImdnView *view = VIEW(ChatConversationImdnView);
|
||||
view.msg = message;
|
||||
view.event = event;
|
||||
[PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
|
||||
}];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue