From c998d302e59e402a50f5ab35e4561196f470d7d3 Mon Sep 17 00:00:00 2001 From: Ryan ZHAO Date: Tue, 30 Mar 2021 10:35:14 +1100 Subject: [PATCH 1/6] fix faulty scrolling caused by keyboard for new conversations --- Session/Conversations/ConversationVC.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Session/Conversations/ConversationVC.swift b/Session/Conversations/ConversationVC.swift index 56dd409cb..a350ebdca 100644 --- a/Session/Conversations/ConversationVC.swift +++ b/Session/Conversations/ConversationVC.swift @@ -298,8 +298,8 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat scrollButton.pin(.bottom, to: .bottom, of: view, withInset: -(newHeight + 16)) // + 16 to match the bottom inset of the table view didConstrainScrollButton = true } - let newContentOffsetY = self.messagesTableView.contentOffset.y + newHeight - self.messagesTableView.keyboardHeight - self.messagesTableView.contentOffset.y = newContentOffsetY + let newContentOffsetY = self.messagesTableView.contentOffset.y + min(lastPageTop, 0) + newHeight - self.messagesTableView.keyboardHeight + self.messagesTableView.contentOffset.y = max(self.messagesTableView.contentOffset.y, newContentOffsetY) self.messagesTableView.keyboardHeight = newHeight self.scrollButton.alpha = 0 } From 60ee602b04f2fce1132009e2faed888da9a2e8c7 Mon Sep 17 00:00:00 2001 From: Ryan ZHAO Date: Tue, 30 Mar 2021 10:38:47 +1100 Subject: [PATCH 2/6] fix scroll button being hidden when coming back from conversation setting vc --- Session/Conversations/ConversationVC.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Session/Conversations/ConversationVC.swift b/Session/Conversations/ConversationVC.swift index a350ebdca..d3545d27f 100644 --- a/Session/Conversations/ConversationVC.swift +++ b/Session/Conversations/ConversationVC.swift @@ -301,7 +301,9 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat let newContentOffsetY = self.messagesTableView.contentOffset.y + min(lastPageTop, 0) + newHeight - self.messagesTableView.keyboardHeight self.messagesTableView.contentOffset.y = max(self.messagesTableView.contentOffset.y, newContentOffsetY) self.messagesTableView.keyboardHeight = newHeight - self.scrollButton.alpha = 0 + if (newHeight > 200) { + self.scrollButton.alpha = 0 + } } @objc func handleKeyboardWillHideNotification(_ notification: Notification) { From e6975e5984072048db6bb194d32f89eccffc8ed6 Mon Sep 17 00:00:00 2001 From: Ryan ZHAO Date: Tue, 30 Mar 2021 13:21:05 +1100 Subject: [PATCH 3/6] fix scroll button hiding issue --- Session/Conversations/ConversationVC.swift | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Session/Conversations/ConversationVC.swift b/Session/Conversations/ConversationVC.swift index d3545d27f..f36cda9ed 100644 --- a/Session/Conversations/ConversationVC.swift +++ b/Session/Conversations/ConversationVC.swift @@ -213,11 +213,11 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat DispatchQueue.main.async { if unreadCount > 0, let viewItem = self.viewItems[ifValid: self.viewItems.count - Int(unreadCount)], let interactionID = viewItem.interaction.uniqueId { self.scrollToInteraction(with: interactionID, position: .top, isAnimated: false) - self.scrollButton.alpha = self.getScrollButtonOpacity() self.unreadCountView.alpha = self.scrollButton.alpha } else { self.scrollToBottom(isAnimated: false) } + self.scrollButton.alpha = self.getScrollButtonOpacity() } } } @@ -301,9 +301,7 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat let newContentOffsetY = self.messagesTableView.contentOffset.y + min(lastPageTop, 0) + newHeight - self.messagesTableView.keyboardHeight self.messagesTableView.contentOffset.y = max(self.messagesTableView.contentOffset.y, newContentOffsetY) self.messagesTableView.keyboardHeight = newHeight - if (newHeight > 200) { - self.scrollButton.alpha = 0 - } + self.scrollButton.alpha = self.getScrollButtonOpacity() } @objc func handleKeyboardWillHideNotification(_ notification: Notification) { From 3030723bb325391092650bb458177acc5e7c567c Mon Sep 17 00:00:00 2001 From: Ryan ZHAO Date: Tue, 30 Mar 2021 13:55:18 +1100 Subject: [PATCH 4/6] fix link preview scrolling issue --- Session/Conversations/ConversationVC+Interaction.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Session/Conversations/ConversationVC+Interaction.swift b/Session/Conversations/ConversationVC+Interaction.swift index 26f58b9c7..a18f369f3 100644 --- a/Session/Conversations/ConversationVC+Interaction.swift +++ b/Session/Conversations/ConversationVC+Interaction.swift @@ -208,9 +208,13 @@ extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuAc message.linkPreview = VisibleMessage.LinkPreview.from(linkPreviewDraft, using: transaction) }, completion: { [weak self] in tsMessage.linkPreview = OWSLinkPreview.from(message.linkPreview) - Storage.shared.write { transaction in + Storage.shared.write(with: { transaction in tsMessage.save(with: transaction as! YapDatabaseReadWriteTransaction) - } + }, completion: { [weak self] in + // At this point the TSOutgoingMessage should have its link preview set, so we can scroll to the bottom knowing + // the height of the new message cell + self?.scrollToBottom(isAnimated: false) + }) Storage.shared.write { transaction in MessageSender.send(message, with: [], in: thread, using: transaction as! YapDatabaseReadWriteTransaction) } From 887088b4bc97f5164a4c57d226ac90ed01a02cef Mon Sep 17 00:00:00 2001 From: Ryan ZHAO Date: Tue, 30 Mar 2021 15:18:28 +1100 Subject: [PATCH 5/6] fix the keyboard won't dismiss while swiping the vc back --- Session/Conversations/ConversationVC.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Session/Conversations/ConversationVC.swift b/Session/Conversations/ConversationVC.swift index f36cda9ed..be4246af5 100644 --- a/Session/Conversations/ConversationVC.swift +++ b/Session/Conversations/ConversationVC.swift @@ -236,6 +236,7 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat self.thread.setDraft(text, transaction: transaction) } } + inputAccessoryView?.resignFirstResponder() } override func viewDidDisappear(_ animated: Bool) { From 6fbd9a44b3eec76ae27aa623d26e7d1e88c826c1 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Thu, 1 Apr 2021 13:21:54 +1100 Subject: [PATCH 6/6] Update build number --- Session.xcodeproj/project.pbxproj | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Session.xcodeproj/project.pbxproj b/Session.xcodeproj/project.pbxproj index 37bd8085a..aa2458b6c 100644 --- a/Session.xcodeproj/project.pbxproj +++ b/Session.xcodeproj/project.pbxproj @@ -5201,7 +5201,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 208; + CURRENT_PROJECT_VERSION = 209; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -5270,7 +5270,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 208; + CURRENT_PROJECT_VERSION = 209; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = SUQ8J2PCT7; ENABLE_NS_ASSERTIONS = NO; @@ -5331,7 +5331,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 208; + CURRENT_PROJECT_VERSION = 209; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -5401,7 +5401,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 208; + CURRENT_PROJECT_VERSION = 209; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = SUQ8J2PCT7; ENABLE_NS_ASSERTIONS = NO; @@ -6286,7 +6286,7 @@ CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 208; + CURRENT_PROJECT_VERSION = 209; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -6354,7 +6354,7 @@ CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 208; + CURRENT_PROJECT_VERSION = 209; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)",