From 8ca0b1939154a32c73a51eb681b5763d8f4774f8 Mon Sep 17 00:00:00 2001 From: Ryan ZHAO <> Date: Tue, 21 Jan 2025 16:41:34 +1100 Subject: [PATCH 1/4] potentially fix a accessibility id issue. --- SessionUIKit/Components/ConfirmationModal.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SessionUIKit/Components/ConfirmationModal.swift b/SessionUIKit/Components/ConfirmationModal.swift index 8007f55b6..f7d2d8eaf 100644 --- a/SessionUIKit/Components/ConfirmationModal.swift +++ b/SessionUIKit/Components/ConfirmationModal.swift @@ -309,11 +309,13 @@ public class ConfirmationModal: Modal, UITextFieldDelegate, UITextViewDelegate { textField.placeholder = inputInfo.placeholder textField.text = (inputInfo.initialValue ?? "") textField.clearButtonMode = (inputInfo.clearButton ? .always : .never) + textField.isAccessibilityElement = true textField.accessibilityIdentifier = inputInfo.accessibility?.identifier - textField.accessibilityLabel = inputInfo.accessibility?.label + textField.accessibilityLabel = inputInfo.accessibility?.label ?? textField.text textFieldContainer.isHidden = false internalOnTextChanged = { [weak confirmButton, weak cancelButton] text, _ in onTextChanged(text) + self.textField.accessibilityLabel = text confirmButton?.isEnabled = info.confirmEnabled.isValid(with: info) cancelButton?.isEnabled = info.cancelEnabled.isValid(with: info) } From d076892424b1abf5c8b360d74a120fbd4d6ba75a Mon Sep 17 00:00:00 2001 From: Ryan ZHAO <> Date: Tue, 21 Jan 2025 16:52:20 +1100 Subject: [PATCH 2/4] fix an issue if a global deletion fails, the UI should toast and stay on the deletion modal. --- .../ConversationVC+Interaction.swift | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/Session/Conversations/ConversationVC+Interaction.swift b/Session/Conversations/ConversationVC+Interaction.swift index 585f18583..e3857d8c2 100644 --- a/Session/Conversations/ConversationVC+Interaction.swift +++ b/Session/Conversations/ConversationVC+Interaction.swift @@ -2036,6 +2036,7 @@ extension ConversationVC: confirmStyle: .danger, cancelTitle: "cancel".localized(), cancelStyle: .alert_text, + dismissOnConfirm: false, onConfirm: { [weak self, dependencies = viewModel.dependencies] modal in /// Determine the selected action index let selectedIndex: Int = { @@ -2061,24 +2062,29 @@ extension ConversationVC: .publisherForAction(at: selectedIndex, using: dependencies) .sinkUntilComplete( receiveCompletion: { result in - DispatchQueue.main.async { - self?.viewModel.showToast( - text: { - switch result { - case .finished: - return "deleteMessageDeleted" - .putNumber(messagesToDelete.count) - .localized() - - case .failure: - return "deleteMessageFailed" - .putNumber(messagesToDelete.count) - .localized() - } - }(), - backgroundColor: .backgroundSecondary, - inset: (self?.inputAccessoryView?.frame.height ?? Values.mediumSpacing) + Values.smallSpacing - ) + switch result { + case .finished: + DispatchQueue.main.async { + self?.viewModel.showToast( + text: "deleteMessageDeleted" + .putNumber(messagesToDelete.count) + .localized(), + backgroundColor: .backgroundSecondary, + inset: (self?.inputAccessoryView?.frame.height ?? Values.mediumSpacing) + Values.smallSpacing + ) + + modal.dismiss(animated: true) + } + case .failure: + DispatchQueue.main.async { + self?.viewModel.showToast( + text: "deleteMessageFailed" + .putNumber(messagesToDelete.count) + .localized(), + backgroundColor: .backgroundSecondary, + inset: (self?.inputAccessoryView?.frame.height ?? Values.mediumSpacing) + Values.smallSpacing + ) + } } } ) From 379ab2629f32611f4ff859032907a436f076107c Mon Sep 17 00:00:00 2001 From: Ryan ZHAO <> Date: Wed, 22 Jan 2025 15:53:05 +1100 Subject: [PATCH 3/4] fix a keyboard issue --- Session/Conversations/ConversationVC+Interaction.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Session/Conversations/ConversationVC+Interaction.swift b/Session/Conversations/ConversationVC+Interaction.swift index e3857d8c2..10e80dcee 100644 --- a/Session/Conversations/ConversationVC+Interaction.swift +++ b/Session/Conversations/ConversationVC+Interaction.swift @@ -2073,7 +2073,7 @@ extension ConversationVC: inset: (self?.inputAccessoryView?.frame.height ?? Values.mediumSpacing) + Values.smallSpacing ) - modal.dismiss(animated: true) + modal.close() } case .failure: DispatchQueue.main.async { From 7ed4d393e3f194cda9feea68a2ebed0bea0b3ad5 Mon Sep 17 00:00:00 2001 From: Ryan ZHAO <> Date: Thu, 23 Jan 2025 15:51:25 +1100 Subject: [PATCH 4/4] fix an issue where deleting outgoing messages in a 1-1 globally does not leave artifacts behind for the person deleting --- .../Database/Models/Interaction.swift | 13 +++++++++++++ .../MessageReceiver+UnsendRequests.swift | 14 +++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/SessionMessagingKit/Database/Models/Interaction.swift b/SessionMessagingKit/Database/Models/Interaction.swift index 8a13afb04..11eed2dff 100644 --- a/SessionMessagingKit/Database/Models/Interaction.swift +++ b/SessionMessagingKit/Database/Models/Interaction.swift @@ -812,6 +812,19 @@ public extension Interaction { } } + struct ThreadInfo: FetchableRecord, Codable { + public let id: Int64 + public let threadId: String + + public init( + id: Int64, + threadId: String + ) { + self.id = id + self.threadId = threadId + } + } + static func idsForTermWithin(threadId: String, pattern: FTS5Pattern) -> SQLRequest { let interaction: TypedTableAlias = TypedTableAlias() let interactionFullTextSearch: TypedTableAlias = TypedTableAlias(name: Interaction.fullTextSearchTableName) diff --git a/SessionMessagingKit/Sending & Receiving/Message Handling/MessageReceiver+UnsendRequests.swift b/SessionMessagingKit/Sending & Receiving/Message Handling/MessageReceiver+UnsendRequests.swift index e1f954627..44cfb7908 100644 --- a/SessionMessagingKit/Sending & Receiving/Message Handling/MessageReceiver+UnsendRequests.swift +++ b/SessionMessagingKit/Sending & Receiving/Message Handling/MessageReceiver+UnsendRequests.swift @@ -35,11 +35,11 @@ extension MessageReceiver { guard let author: String = message.author, let timestampMs: UInt64 = message.timestamp, - let interactionId: Int64 = try Interaction - .select(.id) + let interactionInfo: Interaction.ThreadInfo = try Interaction + .select(.id, .threadId) .filter(Interaction.Columns.timestampMs == Int64(timestampMs)) .filter(Interaction.Columns.authorId == author) - .asRequest(of: Int64.self) + .asRequest(of: Interaction.ThreadInfo.self) .fetchOne(db) else { return } @@ -48,20 +48,20 @@ extension MessageReceiver { /// message content let hashes: Set = try Interaction.serverHashesForDeletion( db, - interactionIds: [interactionId] + interactionIds: [interactionInfo.id] ) try Interaction.markAsDeleted( db, threadId: threadId, threadVariant: threadVariant, - interactionIds: [interactionId], + interactionIds: [interactionInfo.id], localOnly: false, using: dependencies ) /// If it's the `Note to Self` conversation then we want to just delete the interaction - if userSessionId.hexString == threadId { - try Interaction.deleteOne(db, id: interactionId) + if userSessionId.hexString == interactionInfo.threadId { + try Interaction.deleteOne(db, id: interactionInfo.id) } /// Can't delete from the legacy group swarm so only bother for contact conversations