UIChatRoomCell: remove file transfer in case of error

This commit is contained in:
Gautier Pelloux-Prayer 2015-07-15 14:21:57 +02:00
parent 246ae7af18
commit 535f9aa9fa
3 changed files with 24 additions and 17 deletions

View file

@ -389,8 +389,9 @@ static UIFont *CELL_FONT = nil;
}
- (IBAction)onCancelDownloadClick:(id)sender {
[ftd cancel];
FileTransferDelegate *tmp = ftd;
[self disconnectFromFileDelegate];
[tmp cancel];
[self update];
}
@ -454,20 +455,26 @@ static UIFont *CELL_FONT = nil;
static void message_status(LinphoneChatMessage *msg, LinphoneChatMessageState state) {
UIChatRoomCell *thiz = (__bridge UIChatRoomCell *)linphone_chat_message_get_user_data(msg);
LOGI(@"State for message [%p] changed to %s", msg, linphone_chat_message_state_to_string(state));
if (linphone_chat_message_get_file_transfer_information(msg) != NULL &&
(state == LinphoneChatMessageStateDelivered || state == LinphoneChatMessageStateNotDelivered)) {
// we need to refresh the tableview because the filetransfer delegate unreffed
// the chat message before state was LinphoneChatMessageStateFileTransferDone -
// if we are coming back from another view between unreffing and change of state,
// the transient message will not be found and it will not appear in the list of
// message, so we must refresh the table when we change to this state to ensure that
// all transient messages apppear
// ChatRoomViewController *controller = DYNAMIC_CAST(
// [[PhoneMainView instance] changeCurrentView:[ChatRoomViewController compositeViewDescription]
// push:TRUE],
// ChatRoomViewController);
// [controller.tableController setChatRoom:linphone_chat_message_get_chat_room(msg)];
// This is breaking interface too much, it must be fixed in file transfer cb.. meanwhile, disabling it.
if (linphone_chat_message_get_file_transfer_information(msg) != NULL) {
if (state == LinphoneChatMessageStateDelivered || state == LinphoneChatMessageStateNotDelivered) {
// we need to refresh the tableview because the filetransfer delegate unreffed
// the chat message before state was LinphoneChatMessageStateFileTransferDone -
// if we are coming back from another view between unreffing and change of state,
// the transient message will not be found and it will not appear in the list of
// message, so we must refresh the table when we change to this state to ensure that
// all transient messages apppear
// ChatRoomViewController *controller = DYNAMIC_CAST(
// [[PhoneMainView instance] changeCurrentView:[ChatRoomViewController compositeViewDescription]
// push:TRUE],
// ChatRoomViewController);
// [controller.tableController setChatRoom:linphone_chat_message_get_chat_room(msg)];
// This is breaking interface too much, it must be fixed in file transfer cb.. meanwhile, disabling it.
if (thiz->ftd) {
[thiz->ftd stopAndDestroy];
thiz->ftd = nil;
}
}
}
[thiz update];
}

View file

@ -187,7 +187,7 @@ static LinphoneBuffer *linphone_iphone_file_transfer_send(LinphoneChatMessage *m
- (void)stopAndDestroy {
[[[LinphoneManager instance] fileTransferDelegates] removeObject:self];
if (_message != NULL) {
LOGI(@"%p Cancelling transferm from %p", self, _message);
LOGI(@"%p Cancelling transfer from %p", self, _message);
linphone_chat_message_cbs_set_file_transfer_send(linphone_chat_message_get_callbacks(_message), NULL);
linphone_chat_message_cbs_set_file_transfer_recv(linphone_chat_message_get_callbacks(_message), NULL);
linphone_chat_message_cancel_file_transfer(_message);

@ -1 +1 @@
Subproject commit e48f88ff27133a6a4d127d5400a1fdf68f0c5c3b
Subproject commit 3312e8be0bc8336aecf6feffc4cdae9b1cc6904a