From 87ad16e6e060ab6831d084319c203a80673c7ef3 Mon Sep 17 00:00:00 2001 From: kkostiuk <kateryna.kostiuk@savoirfairelinux.com> Date: Thu, 30 Sep 2021 09:46:19 -0400 Subject: [PATCH] conversation: fixes - hide message panel when conversation in synchronization - display full path for file transfer in smart list last interaction field Change-Id: Ie6ce59af989dc8f63acc6f5f74e1aeb662ee4f97 --- src/ConversationVC.mm | 4 ++-- src/MessagesVC.mm | 11 ++++++----- src/SmartViewVC.mm | 5 +---- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/ConversationVC.mm b/src/ConversationVC.mm index 1538e33c..a3838a4f 100644 --- a/src/ConversationVC.mm +++ b/src/ConversationVC.mm @@ -285,7 +285,7 @@ NSInteger const SEND_PANEL_MAX_HEIGHT = 120; } - (void)updateInvitationView:(const lrc::api::conversation::Info*) conversation { - self.isRequest = conversation->isRequest; + self.isRequest = conversation->isRequest || conversation->needsSyncing; NSString* bestName = bestNameForConversation(*conversation, *convModel_); bool showInvitationView = conversation->isRequest || (convModel_->owner.profileInfo.type == lrc::api::profile::Type::JAMI && conversation->interactions.size() == 0); invitationView.hidden = !showInvitationView; @@ -438,7 +438,7 @@ NSInteger const SEND_PANEL_MAX_HEIGHT = 120; } - (IBAction) refuseInvitation:(id)sender { - convModel_->removeConversation(convUid_); + convModel_->declineConversationRequest(convUid_); } - (IBAction) blockInvitation:(id)sender { diff --git a/src/MessagesVC.mm b/src/MessagesVC.mm index 469d29fa..97023709 100644 --- a/src/MessagesVC.mm +++ b/src/MessagesVC.mm @@ -202,7 +202,7 @@ typedef NS_ENUM(NSInteger, MessageSequencing) { NSUInteger lastvisibleRow = [visibleIndexes lastIndex]; NSInteger numberOfRows = [conversationView numberOfRows]; if ((numberOfRows > 0) && - lastvisibleRow > (numberOfRows - visibleIndexes.count * 2)) { + lastvisibleRow > (numberOfRows - visibleIndexes.count * 0.5)) { [conversationView scrollToEndOfDocument: nil]; } } @@ -247,7 +247,6 @@ typedef NS_ENUM(NSInteger, MessageSequencing) { } [conversationView reloadDataForRowIndexes: indexSet columnIndexes:[NSIndexSet indexSetWithIndex:0]]; - [self scrollToBottom]; } -(void)setConversationUid:(const QString&)convUid model:(lrc::api::ConversationModel *)model @@ -363,7 +362,10 @@ typedef NS_ENUM(NSInteger, MessageSequencing) { } cachedConv_ = nil; messages.at(index).second = interaction; - [self reloadConversationForMessage:interactionId updateSize: interaction.type == lrc::api::interaction::Type::DATA_TRANSFER]; + [self reloadConversationForMessage:interactionId updateSize: (interaction.type == lrc::api::interaction::Type::DATA_TRANSFER && interaction.status == lrc::api::interaction::Status::TRANSFER_FINISHED)]; + if (interaction.type != lrc::api::interaction::Type::DATA_TRANSFER || interaction.status != lrc::api::interaction::Status::TRANSFER_FINISHED) { + return; + } [self scrollToBottom]; }); interactionRemovedSignal_ = QObject::connect(convModel_, &lrc::api::ConversationModel::interactionRemoved, @@ -559,7 +561,7 @@ typedef NS_ENUM(NSInteger, MessageSequencing) { [result.msgBackground setHidden:NO]; NSString* name = interaction.body.toNSString(); if (name.length > 0) { - fileName = [name lastPathComponent]; + fileName = name; } NSFont *nameFont = [NSFont systemFontOfSize: 12 weight: NSFontWeightLight]; NSColor *nameColor = [NSColor textColor]; @@ -960,7 +962,6 @@ typedef NS_ENUM(NSInteger, MessageSequencing) { -(NSString *) getDataTransferPath:(const QString&)interactionId { lrc::api::datatransfer::Info info = {}; convModel_->getTransferInfo(convUid_, interactionId, info); - double convertData = static_cast<double>(info.totalSize); return info.path.toNSString(); } diff --git a/src/SmartViewVC.mm b/src/SmartViewVC.mm index 4f5ad37b..9ae51499 100755 --- a/src/SmartViewVC.mm +++ b/src/SmartViewVC.mm @@ -567,7 +567,7 @@ NSInteger const REQUEST_SEG = 1; callInfo = (call.status == lrc::api::call::Status::IN_PROGRESS) ? @"Talking" : to_string(call.status).toNSString(); } } - + if (callInfo.length > 0) { [lastInteractionDate setStringValue: callInfo]; [interactionSnippet setHidden:true]; @@ -579,9 +579,6 @@ NSInteger const REQUEST_SEG = 1; NSString* lastInteractionSnippetFixedString = [lastInteractionSnippet.toNSString() stringByReplacingOccurrencesOfString:@"🕽" withString:@""]; lastInteractionSnippetFixedString = [lastInteractionSnippetFixedString stringByReplacingOccurrencesOfString:@"📞" withString:@""]; - if (conversation.interactions[lastUid].type == lrc::api::interaction::Type::DATA_TRANSFER) { - lastInteractionSnippetFixedString = [lastInteractionSnippetFixedString lastPathComponent]; - } [interactionSnippet setStringValue:lastInteractionSnippetFixedString]; // last interaction date/time -- GitLab