Revert "fix again"

This reverts commit c613c76fd1.
This commit is contained in:
Danmei Chen 2021-06-29 18:25:57 +02:00
parent b3e0b0a60a
commit d73a5ff333
3 changed files with 19 additions and 26 deletions

View file

@ -124,14 +124,8 @@
LOGW(@"event entry doesn't exist"); LOGW(@"event entry doesn't exist");
return; return;
} }
if (index == (eventList.count-1)) { [self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:index inSection:0]]
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0]
atScrollPosition:UITableViewScrollPositionBottom
animated:YES];
} else {
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:index inSection:0]]
withRowAnimation:FALSE]; // just reload withRowAnimation:FALSE]; // just reload
}
return; return;
} }

View file

@ -171,32 +171,28 @@ static const CGFloat CELL_IMAGE_X_MARGIN = 100;
BOOL is_outgoing = linphone_chat_message_is_outgoing(self.message); BOOL is_outgoing = linphone_chat_message_is_outgoing(self.message);
if (!is_outgoing) { if (!is_outgoing) {
if (linphone_chat_message_get_state(self.message) == LinphoneChatMessageStateFileTransferInProgress) { LinphoneChatMessageState state = linphone_chat_message_get_state(self.message);
_cancelButton.hidden = _fileTransferProgress.hidden = NO; if (state != LinphoneChatMessageStateFileTransferDone && state != LinphoneChatMessageStateDisplayed) {
_downloadButton.hidden = YES; if (state == LinphoneChatMessageStateFileTransferInProgress) {
_playButton.hidden = YES; _cancelButton.hidden = _fileTransferProgress.hidden = NO;
_fileName.hidden = _fileView.hidden = _fileButton.hidden =YES; _downloadButton.hidden = YES;
return; _playButton.hidden = YES;
} _fileName.hidden = _fileView.hidden = _fileButton.hidden =YES;
if (linphone_content_is_file_transfer(fileContent)) { } else {
_downloadButton.hidden = NO; _downloadButton.hidden = NO;
_cancelButton.hidden = _fileTransferProgress.hidden = YES; _cancelButton.hidden = _fileTransferProgress.hidden = YES;
_playButton.hidden = YES; _playButton.hidden = YES;
_fileName.hidden = _fileView.hidden = _fileButton.hidden = YES; _fileName.hidden = _fileView.hidden = _fileButton.hidden = YES;
}
return; return;
} }
} }
NSString *fileType = [NSString stringWithUTF8String:linphone_content_get_type(fileContent)]; NSString *fileType = [NSString stringWithUTF8String:linphone_content_get_type(fileContent)];
NSString *fileName = [NSString stringWithUTF8String:linphone_content_get_name(fileContent)]; NSString *fileName = [NSString stringWithUTF8String:linphone_content_get_name(fileContent)];
NSString *filePath = [[LinphoneManager cacheDirectory] stringByAppendingPathComponent:fileName]; NSString *filePath = [[LinphoneManager cacheDirectory] stringByAppendingPathComponent:fileName];
if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) { if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
NSString *tempName = (localImage?:(localVideo?:localFile)); filePath = [[LinphoneManager cacheDirectory] stringByAppendingPathComponent:(localImage?:(localVideo?:localFile))];
if ([tempName isEqualToString:fileName]) {
filePath = [[VIEW(ChatConversationView) getICloudFileUrl:fileName] path];
} else {
filePath = [[LinphoneManager cacheDirectory] stringByAppendingPathComponent:tempName];
}
} }
if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) { if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
@ -536,6 +532,7 @@ static const CGFloat CELL_IMAGE_X_MARGIN = 100;
} else { } else {
ChatConversationView *view = VIEW(ChatConversationView); ChatConversationView *view = VIEW(ChatConversationView);
[view.tableController updateEventEntry:self.event]; [view.tableController updateEventEntry:self.event];
[view.tableController scrollToBottom:true];
} }
} }
- (void)onFileTransferRecvUpdate:(NSNotification *)notif { - (void)onFileTransferRecvUpdate:(NSNotification *)notif {
@ -547,6 +544,7 @@ static const CGFloat CELL_IMAGE_X_MARGIN = 100;
} else { } else {
ChatConversationView *view = VIEW(ChatConversationView); ChatConversationView *view = VIEW(ChatConversationView);
[view.tableController updateEventEntry:self.event]; [view.tableController updateEventEntry:self.event];
[view.tableController scrollToBottom:true];
} }
} }

View file

@ -312,6 +312,7 @@ static void message_status(LinphoneChatMessage *msg, LinphoneChatMessageState st
LinphoneEventLog *event = (LinphoneEventLog *)linphone_chat_message_cbs_get_user_data(linphone_chat_message_get_callbacks(msg)); LinphoneEventLog *event = (LinphoneEventLog *)linphone_chat_message_cbs_get_user_data(linphone_chat_message_get_callbacks(msg));
ChatConversationView *view = VIEW(ChatConversationView); ChatConversationView *view = VIEW(ChatConversationView);
[view.tableController updateEventEntry:event]; [view.tableController updateEventEntry:event];
[view.tableController scrollToBottom:true];
} }
static void participant_imdn_status(LinphoneChatMessage* msg, const LinphoneParticipantImdnState *state) { static void participant_imdn_status(LinphoneChatMessage* msg, const LinphoneParticipantImdnState *state) {