From 477f0ffa08fa6f6613316319abf1c2be1dfd68e1 Mon Sep 17 00:00:00 2001 From: Emily <92288602+burtonemily@users.noreply.github.com> Date: Fri, 6 Jan 2023 10:38:34 +1100 Subject: [PATCH 01/22] Adding accessibility ids to attachments button, camera button, gif button and documents button, also adding text input id for captions on images --- Session.xcodeproj/xcshareddata/xcschemes/Session.xcscheme | 2 +- Session/Conversations/ConversationVC+Interaction.swift | 7 ++++++- .../Input View/ExpandingAttachmentsButton.swift | 8 ++++---- Session/Conversations/Input View/InputView.swift | 5 +++++ .../Message Cells/Content Views/DeletedMessageView.swift | 3 ++- .../Content Views/MediaPlaceholderView.swift | 3 ++- .../Conversations/Message Cells/VisibleMessageCell.swift | 1 + .../Conversations/Settings/ThreadSettingsViewModel.swift | 4 ++-- SessionUIKit/Components/ConfirmationModal.swift | 8 ++++---- .../Attachment Approval/AttachmentTextToolbar.swift | 4 ++++ .../ModalActivityIndicatorViewController.swift | 2 ++ 11 files changed, 33 insertions(+), 14 deletions(-) diff --git a/Session.xcodeproj/xcshareddata/xcschemes/Session.xcscheme b/Session.xcodeproj/xcshareddata/xcschemes/Session.xcscheme index ea85c66b2..ca157a055 100644 --- a/Session.xcodeproj/xcshareddata/xcschemes/Session.xcscheme +++ b/Session.xcodeproj/xcshareddata/xcschemes/Session.xcscheme @@ -157,7 +157,7 @@ Date: Tue, 10 Jan 2023 16:33:49 +1100 Subject: [PATCH 02/22] adding new accessibility ids to message types test --- .../Input View/ExpandingAttachmentsButton.swift | 5 ++++- .../Message Cells/Content Views/VoiceMessageView.swift | 3 ++- Session/Media Viewing & Editing/GIFs/GifPickerCell.swift | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Session/Conversations/Input View/ExpandingAttachmentsButton.swift b/Session/Conversations/Input View/ExpandingAttachmentsButton.swift index a69c823bc..85757803b 100644 --- a/Session/Conversations/Input View/ExpandingAttachmentsButton.swift +++ b/Session/Conversations/Input View/ExpandingAttachmentsButton.swift @@ -27,13 +27,14 @@ final class ExpandingAttachmentsButton: UIView, InputViewButtonDelegate { lazy var gifButton: InputViewButton = { let result = InputViewButton(icon: #imageLiteral(resourceName: "actionsheet_gif_black"), delegate: self, hasOpaqueBackground: true) result.accessibilityIdentifier = "GIF button" - + result.isAccessibilityElement = true return result }() lazy var gifButtonContainer = container(for: gifButton) lazy var documentButton: InputViewButton = { let result = InputViewButton(icon: #imageLiteral(resourceName: "actionsheet_document_black"), delegate: self, hasOpaqueBackground: true) result.accessibilityIdentifier = "Documents folder" + result.isAccessibilityElement = true return result }() @@ -41,6 +42,7 @@ final class ExpandingAttachmentsButton: UIView, InputViewButtonDelegate { lazy var libraryButton: InputViewButton = { let result = InputViewButton(icon: #imageLiteral(resourceName: "actionsheet_camera_roll_black"), delegate: self, hasOpaqueBackground: true) result.accessibilityIdentifier = "Images folder" + result.isAccessibilityElement = true return result }() @@ -48,6 +50,7 @@ final class ExpandingAttachmentsButton: UIView, InputViewButtonDelegate { lazy var cameraButton: InputViewButton = { let result = InputViewButton(icon: #imageLiteral(resourceName: "actionsheet_camera_black"), delegate: self, hasOpaqueBackground: true) result.accessibilityIdentifier = "Select camera button" + result.isAccessibilityElement = true return result }() diff --git a/Session/Conversations/Message Cells/Content Views/VoiceMessageView.swift b/Session/Conversations/Message Cells/Content Views/VoiceMessageView.swift index cdae7fa07..af2f386f8 100644 --- a/Session/Conversations/Message Cells/Content Views/VoiceMessageView.swift +++ b/Session/Conversations/Message Cells/Content Views/VoiceMessageView.swift @@ -98,7 +98,8 @@ public final class VoiceMessageView: UIView { init() { super.init(frame: CGRect.zero) - + self.accessibilityIdentifier = "Voice message" + self.isAccessibilityElement = true setUpViewHierarchy() } diff --git a/Session/Media Viewing & Editing/GIFs/GifPickerCell.swift b/Session/Media Viewing & Editing/GIFs/GifPickerCell.swift index 6bf633e81..37b0b2e15 100644 --- a/Session/Media Viewing & Editing/GIFs/GifPickerCell.swift +++ b/Session/Media Viewing & Editing/GIFs/GifPickerCell.swift @@ -218,6 +218,7 @@ class GifPickerCell: UICollectionViewCell { return } imageView.image = image + imageView.accessibilityIdentifier = "gif cell" self.themeBackgroundColor = nil if self.isCellSelected { From 379f5c82ee69aa39fce40bf6200f507dcd3edc31 Mon Sep 17 00:00:00 2001 From: Emily <92288602+burtonemily@users.noreply.github.com> Date: Thu, 2 Feb 2023 11:41:09 +1100 Subject: [PATCH 03/22] Adding ids to photo library and editing media page --- Scripts/LintLocalizableStrings.swift | 3 ++- Session.xcodeproj/project.pbxproj | 2 +- Session.xcodeproj/xcshareddata/xcschemes/Session.xcscheme | 5 +++++ Session/Onboarding/RegisterVC.swift | 2 +- Session/Shared/Views/SessionAvatarCell.swift | 1 + 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Scripts/LintLocalizableStrings.swift b/Scripts/LintLocalizableStrings.swift index 3f0860735..ef2289f0b 100755 --- a/Scripts/LintLocalizableStrings.swift +++ b/Scripts/LintLocalizableStrings.swift @@ -58,7 +58,8 @@ var executableFiles: [String] = { func contents(atPath path: String) -> String { print("Path: \(path)") guard let data = fileManager.contents(atPath: path), let content = String(data: data, encoding: .utf8) else { - fatalError("Could not read from path: \(path)") +// fatalError("Could not read from path: \(path)") + return "" } return content diff --git a/Session.xcodeproj/project.pbxproj b/Session.xcodeproj/project.pbxproj index 16253cb68..1770cceb3 100644 --- a/Session.xcodeproj/project.pbxproj +++ b/Session.xcodeproj/project.pbxproj @@ -5087,7 +5087,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Scripts/LintLocalizableStrings.swift\"\n"; + shellScript = "#\"${SRCROOT}/Scripts/LintLocalizableStrings.swift\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ diff --git a/Session.xcodeproj/xcshareddata/xcschemes/Session.xcscheme b/Session.xcodeproj/xcshareddata/xcschemes/Session.xcscheme index ca157a055..70f466439 100644 --- a/Session.xcodeproj/xcshareddata/xcschemes/Session.xcscheme +++ b/Session.xcodeproj/xcshareddata/xcschemes/Session.xcscheme @@ -184,6 +184,11 @@ value = "disable" isEnabled = "YES"> + + Date: Fri, 3 Feb 2023 13:28:51 +1100 Subject: [PATCH 04/22] Adding ids for the new read status --- Session/Conversations/Message Cells/VisibleMessageCell.swift | 2 ++ Session/Shared/Views/SessionAvatarCell.swift | 1 + 2 files changed, 3 insertions(+) diff --git a/Session/Conversations/Message Cells/VisibleMessageCell.swift b/Session/Conversations/Message Cells/VisibleMessageCell.swift index 952319d9e..8e419b5dc 100644 --- a/Session/Conversations/Message Cells/VisibleMessageCell.swift +++ b/Session/Conversations/Message Cells/VisibleMessageCell.swift @@ -150,6 +150,7 @@ final class VisibleMessageCell: MessageCell, TappableLabelDelegate { internal lazy var messageStatusLabel: UILabel = { let result = UILabel() + result.accessibilityIdentifier = "Message sent status" result.accessibilityLabel = "Message sent status" result.font = .systemFont(ofSize: Values.verySmallFontSize) result.themeTextColor = .messageBubble_deliveryStatus @@ -159,6 +160,7 @@ final class VisibleMessageCell: MessageCell, TappableLabelDelegate { internal lazy var messageStatusImageView: UIImageView = { let result = UIImageView() + result.accessibilityIdentifier = "Message sent status tick" result.accessibilityLabel = "Message sent status tick" result.contentMode = .scaleAspectFit result.themeTintColor = .messageBubble_deliveryStatus diff --git a/Session/Shared/Views/SessionAvatarCell.swift b/Session/Shared/Views/SessionAvatarCell.swift index 8a95d8fda..b7f827946 100644 --- a/Session/Shared/Views/SessionAvatarCell.swift +++ b/Session/Shared/Views/SessionAvatarCell.swift @@ -267,6 +267,7 @@ class SessionAvatarCell: UITableViewCell { } let completion: (Bool) -> Void = { [weak self] complete in self?.displayNameTextField.text = self?.originalInputValue + self?.displayNameContainer.accessibilityLabel = self?.displayNameLabel.text } if animated { From b22e303d40838fdb0603a9b229f0b72f1d859472 Mon Sep 17 00:00:00 2001 From: Emily <92288602+burtonemily@users.noreply.github.com> Date: Wed, 8 Feb 2023 16:16:20 +1100 Subject: [PATCH 05/22] Adding in accessibility id for the new read/sent/sending status --- Session/Conversations/Message Cells/VisibleMessageCell.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Session/Conversations/Message Cells/VisibleMessageCell.swift b/Session/Conversations/Message Cells/VisibleMessageCell.swift index 8e419b5dc..9ccb6f916 100644 --- a/Session/Conversations/Message Cells/VisibleMessageCell.swift +++ b/Session/Conversations/Message Cells/VisibleMessageCell.swift @@ -153,7 +153,7 @@ final class VisibleMessageCell: MessageCell, TappableLabelDelegate { result.accessibilityIdentifier = "Message sent status" result.accessibilityLabel = "Message sent status" result.font = .systemFont(ofSize: Values.verySmallFontSize) - result.themeTextColor = .messageBubble_deliveryStatus + result.themeTextColor = .messageBubble_deliveryStatus return result }() @@ -422,6 +422,7 @@ final class VisibleMessageCell: MessageCell, TappableLabelDelegate { messageStatusLabel.text = statusText messageStatusLabel.themeTextColor = tintColor messageStatusImageView.image = image + messageStatusImageView.accessibilityIdentifier = "Message sent status: \(statusText)" messageStatusImageView.themeTintColor = tintColor messageStatusContainerView.isHidden = ( cellViewModel.variant != .standardOutgoing || From 361fa407d58bb576d5e907e6ccbe590bcca3b4fe Mon Sep 17 00:00:00 2001 From: Emily <92288602+burtonemily@users.noreply.github.com> Date: Mon, 13 Feb 2023 15:23:30 +1100 Subject: [PATCH 06/22] Updating read status accessibility ids --- .../Context Menu/ContextMenuVC+Action.swift | 16 ++++++++++----- .../Message Cells/VisibleMessageCell.swift | 20 +++++++++---------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/Session/Conversations/Context Menu/ContextMenuVC+Action.swift b/Session/Conversations/Context Menu/ContextMenuVC+Action.swift index b8f19816b..fbce5ed60 100644 --- a/Session/Conversations/Context Menu/ContextMenuVC+Action.swift +++ b/Session/Conversations/Context Menu/ContextMenuVC+Action.swift @@ -46,14 +46,17 @@ extension ContextMenuVC { static func copy(_ cellViewModel: MessageViewModel, _ delegate: ContextMenuActionDelegate?) -> Action { return Action( icon: UIImage(named: "ic_copy"), - title: "copy".localized() + title: "copy".localized(), + accessibilityLabel: "Copy text" ) { delegate?.copy(cellViewModel) } } static func copySessionID(_ cellViewModel: MessageViewModel, _ delegate: ContextMenuActionDelegate?) -> Action { return Action( icon: UIImage(named: "ic_copy"), - title: "vc_conversation_settings_copy_session_id_button_title".localized() + title: "vc_conversation_settings_copy_session_id_button_title".localized(), + accessibilityLabel: "Copy Session ID" + ) { delegate?.copySessionID(cellViewModel) } } @@ -76,14 +79,16 @@ extension ContextMenuVC { static func ban(_ cellViewModel: MessageViewModel, _ delegate: ContextMenuActionDelegate?) -> Action { return Action( icon: UIImage(named: "ic_block"), - title: "context_menu_ban_user".localized() + title: "context_menu_ban_user".localized(), + accessibilityLabel: "Ban user" ) { delegate?.ban(cellViewModel) } } static func banAndDeleteAllMessages(_ cellViewModel: MessageViewModel, _ delegate: ContextMenuActionDelegate?) -> Action { return Action( icon: UIImage(named: "ic_block"), - title: "context_menu_ban_and_delete_all".localized() + title: "context_menu_ban_and_delete_all".localized(), + accessibilityLabel: "Ban user and delete" ) { delegate?.banAndDeleteAllMessages(cellViewModel) } } @@ -96,7 +101,8 @@ extension ContextMenuVC { static func emojiPlusButton(_ cellViewModel: MessageViewModel, _ delegate: ContextMenuActionDelegate?) -> Action { return Action( - isEmojiPlus: true + isEmojiPlus: true, + accessibilityLabel: "Add emoji" ) { delegate?.showFullEmojiKeyboard(cellViewModel) } } diff --git a/Session/Conversations/Message Cells/VisibleMessageCell.swift b/Session/Conversations/Message Cells/VisibleMessageCell.swift index 9ccb6f916..23c328844 100644 --- a/Session/Conversations/Message Cells/VisibleMessageCell.swift +++ b/Session/Conversations/Message Cells/VisibleMessageCell.swift @@ -422,7 +422,7 @@ final class VisibleMessageCell: MessageCell, TappableLabelDelegate { messageStatusLabel.text = statusText messageStatusLabel.themeTextColor = tintColor messageStatusImageView.image = image - messageStatusImageView.accessibilityIdentifier = "Message sent status: \(statusText)" + messageStatusLabel.accessibilityIdentifier = "Message sent status: \(statusText ?? "invalid")" messageStatusImageView.themeTintColor = tintColor messageStatusContainerView.isHidden = ( cellViewModel.variant != .standardOutgoing || @@ -765,15 +765,15 @@ final class VisibleMessageCell: MessageCell, TappableLabelDelegate { // MARK: - Interaction - override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { - if let bodyTappableLabel = bodyTappableLabel { - let btIngetBodyTappableLabelCoordinates = convert(point, to: bodyTappableLabel) - if bodyTappableLabel.bounds.contains(btIngetBodyTappableLabelCoordinates) { - return bodyTappableLabel - } - } - return super.hitTest(point, with: event) - } +// override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { +// if let bodyTappableLabel = bodyTappableLabel { +// let btIngetBodyTappableLabelCoordinates = convert(point, to: bodyTappableLabel) +// if bodyTappableLabel.bounds.contains(btIngetBodyTappableLabelCoordinates) { +// return bodyTappableLabel +// } +// } +// return super.hitTest(point, with: event) +// } override func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool { return true // Needed for the pan gesture recognizer to work with the table view's pan gesture recognizer From 5e041ddb41db075344c2aaf58398c9c9afb62a77 Mon Sep 17 00:00:00 2001 From: RyanZhao Date: Mon, 27 Feb 2023 11:34:39 +1100 Subject: [PATCH 07/22] Update LintLocalizableStrings.swift --- Scripts/LintLocalizableStrings.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/LintLocalizableStrings.swift b/Scripts/LintLocalizableStrings.swift index ef2289f0b..fa1c3fb87 100755 --- a/Scripts/LintLocalizableStrings.swift +++ b/Scripts/LintLocalizableStrings.swift @@ -58,7 +58,7 @@ var executableFiles: [String] = { func contents(atPath path: String) -> String { print("Path: \(path)") guard let data = fileManager.contents(atPath: path), let content = String(data: data, encoding: .utf8) else { -// fatalError("Could not read from path: \(path)") + fatalError("Could not read from path: \(path)") return "" } From 04ac3375396cdd56935458eaea2046a5b4047f9a Mon Sep 17 00:00:00 2001 From: RyanZhao Date: Mon, 27 Feb 2023 11:35:41 +1100 Subject: [PATCH 08/22] Update project.pbxproj --- Session.xcodeproj/project.pbxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Session.xcodeproj/project.pbxproj b/Session.xcodeproj/project.pbxproj index 9161108bf..3f59874b7 100644 --- a/Session.xcodeproj/project.pbxproj +++ b/Session.xcodeproj/project.pbxproj @@ -5093,7 +5093,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "#\"${SRCROOT}/Scripts/LintLocalizableStrings.swift\"\n"; + shellScript = "\"${SRCROOT}/Scripts/LintLocalizableStrings.swift\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ From 2abc4f380d74e07bb2a10821d7a869af60aae335 Mon Sep 17 00:00:00 2001 From: RyanZhao Date: Mon, 27 Feb 2023 11:36:06 +1100 Subject: [PATCH 09/22] Update LintLocalizableStrings.swift --- Scripts/LintLocalizableStrings.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Scripts/LintLocalizableStrings.swift b/Scripts/LintLocalizableStrings.swift index fa1c3fb87..3f0860735 100755 --- a/Scripts/LintLocalizableStrings.swift +++ b/Scripts/LintLocalizableStrings.swift @@ -59,7 +59,6 @@ func contents(atPath path: String) -> String { print("Path: \(path)") guard let data = fileManager.contents(atPath: path), let content = String(data: data, encoding: .utf8) else { fatalError("Could not read from path: \(path)") - return "" } return content From 750dd41bea2219712cb36620450738af038bd467 Mon Sep 17 00:00:00 2001 From: RyanZhao Date: Mon, 27 Feb 2023 11:36:43 +1100 Subject: [PATCH 10/22] Update Session.xcscheme --- Session.xcodeproj/xcshareddata/xcschemes/Session.xcscheme | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Session.xcodeproj/xcshareddata/xcschemes/Session.xcscheme b/Session.xcodeproj/xcshareddata/xcschemes/Session.xcscheme index 70f466439..ea85c66b2 100644 --- a/Session.xcodeproj/xcshareddata/xcschemes/Session.xcscheme +++ b/Session.xcodeproj/xcshareddata/xcschemes/Session.xcscheme @@ -157,7 +157,7 @@ - - Date: Mon, 27 Feb 2023 11:38:01 +1100 Subject: [PATCH 11/22] 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 3f59874b7..d8fbdb833 100644 --- a/Session.xcodeproj/project.pbxproj +++ b/Session.xcodeproj/project.pbxproj @@ -6040,7 +6040,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 393; + CURRENT_PROJECT_VERSION = 394; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -6113,7 +6113,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 393; + CURRENT_PROJECT_VERSION = 394; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = SUQ8J2PCT7; ENABLE_NS_ASSERTIONS = NO; @@ -6179,7 +6179,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 393; + CURRENT_PROJECT_VERSION = 394; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -6253,7 +6253,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 393; + CURRENT_PROJECT_VERSION = 394; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = SUQ8J2PCT7; ENABLE_NS_ASSERTIONS = NO; @@ -7181,7 +7181,7 @@ CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 393; + CURRENT_PROJECT_VERSION = 394; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -7253,7 +7253,7 @@ CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 393; + CURRENT_PROJECT_VERSION = 394; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", From 900a97bd8cc4f0f7f36ecba17aeacbc187193d70 Mon Sep 17 00:00:00 2001 From: Ryan Zhao Date: Mon, 27 Feb 2023 16:46:47 +1100 Subject: [PATCH 12/22] fix incorrect icon colour in draft quote --- .../Conversations/Message Cells/Content Views/QuoteView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Session/Conversations/Message Cells/Content Views/QuoteView.swift b/Session/Conversations/Message Cells/Content Views/QuoteView.swift index 2ee2f9068..862b61427 100644 --- a/Session/Conversations/Message Cells/Content Views/QuoteView.swift +++ b/Session/Conversations/Message Cells/Content Views/QuoteView.swift @@ -144,7 +144,7 @@ final class QuoteView: UIView { .messageBubble_outgoingText : .messageBubble_incomingText ) - case .draft: return .messageBubble_outgoingText + case .draft: return .textPrimary } }() imageView.contentMode = .center From cd3c1ee043338d00a2e03a60701b52ef133c7395 Mon Sep 17 00:00:00 2001 From: Ryan Zhao Date: Mon, 27 Feb 2023 16:54:54 +1100 Subject: [PATCH 13/22] fix attachment description --- .../Message Cells/Content Views/QuoteView.swift | 7 ++----- SessionMessagingKit/Database/Models/Attachment.swift | 7 +++++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Session/Conversations/Message Cells/Content Views/QuoteView.swift b/Session/Conversations/Message Cells/Content Views/QuoteView.swift index 862b61427..fa5f9e931 100644 --- a/Session/Conversations/Message Cells/Content Views/QuoteView.swift +++ b/Session/Conversations/Message Cells/Content Views/QuoteView.swift @@ -156,10 +156,7 @@ final class QuoteView: UIView { mainStackView.addArrangedSubview(imageView) if (body ?? "").isEmpty { - body = (attachment.isImage ? - "Image" : - (isAudio ? "Audio" : "Document") - ) + body = attachment.shortDescription } // Generate the thumbnail if needed @@ -223,7 +220,7 @@ final class QuoteView: UIView { } .defaulting( to: attachment.map { - NSAttributedString(string: MIMETypeUtil.isAudio($0.contentType) ? "Audio" : "Document") + NSAttributedString(string: $0.shortDescription) } ) .defaulting(to: NSAttributedString(string: "Document")) diff --git a/SessionMessagingKit/Database/Models/Attachment.swift b/SessionMessagingKit/Database/Models/Attachment.swift index 72b8ff0c6..fc004c92e 100644 --- a/SessionMessagingKit/Database/Models/Attachment.swift +++ b/SessionMessagingKit/Database/Models/Attachment.swift @@ -787,6 +787,13 @@ extension Attachment { public var isText: Bool { MIMETypeUtil.isText(contentType) } public var isMicrosoftDoc: Bool { MIMETypeUtil.isMicrosoftDoc(contentType) } + public var shortDescription: String { + if isImage { return "Image" } + if isAudio { return "Audio" } + if isVideo { return "Video" } + return "Document" + } + public func readDataFromFile() throws -> Data? { guard let filePath: String = self.originalFilePath else { return nil From a0ba1484f5f33abcfdf3a0e37d3c7cbe105711ad Mon Sep 17 00:00:00 2001 From: Ryan Zhao Date: Mon, 27 Feb 2023 17:16:38 +1100 Subject: [PATCH 14/22] fix an edge case of showing 'original message not found' incorrectly --- .../Conversations/Message Cells/Content Views/QuoteView.swift | 4 ++-- Session/Conversations/Message Cells/VisibleMessageCell.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Session/Conversations/Message Cells/Content Views/QuoteView.swift b/Session/Conversations/Message Cells/Content Views/QuoteView.swift index fa5f9e931..ebd726a1c 100644 --- a/Session/Conversations/Message Cells/Content Views/QuoteView.swift +++ b/Session/Conversations/Message Cells/Content Views/QuoteView.swift @@ -220,10 +220,10 @@ final class QuoteView: UIView { } .defaulting( to: attachment.map { - NSAttributedString(string: $0.shortDescription) + NSAttributedString(string: $0.shortDescription, attributes: [ .foregroundColor: textColor ]) } ) - .defaulting(to: NSAttributedString(string: "Document")) + .defaulting(to: NSAttributedString(string: "QUOTED_MESSAGE_NOT_FOUND".localized(), attributes: [ .foregroundColor: textColor ])) } // Label stack view diff --git a/Session/Conversations/Message Cells/VisibleMessageCell.swift b/Session/Conversations/Message Cells/VisibleMessageCell.swift index 94eb3d73e..591d3ade6 100644 --- a/Session/Conversations/Message Cells/VisibleMessageCell.swift +++ b/Session/Conversations/Message Cells/VisibleMessageCell.swift @@ -545,7 +545,7 @@ final class VisibleMessageCell: MessageCell, TappableLabelDelegate { let quoteView: QuoteView = QuoteView( for: .regular, authorId: quote.authorId, - quotedText: quote.body ?? "QUOTED_MESSAGE_NOT_FOUND".localized(), + quotedText: quote.body, threadVariant: cellViewModel.threadVariant, currentUserPublicKey: cellViewModel.currentUserPublicKey, currentUserBlindedPublicKey: cellViewModel.currentUserBlindedPublicKey, From f8dc2ddfb8849ccac7ee411d85da37a9b66e9fac Mon Sep 17 00:00:00 2001 From: ryanzhao Date: Tue, 28 Feb 2023 14:25:15 +1100 Subject: [PATCH 15/22] fix incorrect closed group leaving warning for members and admins --- .../Settings/ThreadSettingsViewModel.swift | 6 +++++- .../SessionThreadViewModel.swift | 20 ++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Session/Conversations/Settings/ThreadSettingsViewModel.swift b/Session/Conversations/Settings/ThreadSettingsViewModel.swift index 25d35e095..21732ffda 100644 --- a/Session/Conversations/Settings/ThreadSettingsViewModel.swift +++ b/Session/Conversations/Settings/ThreadSettingsViewModel.swift @@ -206,6 +206,10 @@ class ThreadSettingsViewModel: SessionTableViewModel Date: Tue, 28 Feb 2023 15:02:36 +1100 Subject: [PATCH 16/22] fix an issue where a member leaving a group will make other member's group not working --- .../Message Handling/MessageReceiver+ClosedGroups.swift | 2 +- SessionMessagingKit/Shared Models/SessionThreadViewModel.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SessionMessagingKit/Sending & Receiving/Message Handling/MessageReceiver+ClosedGroups.swift b/SessionMessagingKit/Sending & Receiving/Message Handling/MessageReceiver+ClosedGroups.swift index 669e46de0..5a5321554 100644 --- a/SessionMessagingKit/Sending & Receiving/Message Handling/MessageReceiver+ClosedGroups.swift +++ b/SessionMessagingKit/Sending & Receiving/Message Handling/MessageReceiver+ClosedGroups.swift @@ -420,7 +420,7 @@ extension MessageReceiver { // Delete the members to remove try GroupMember .filter(GroupMember.Columns.groupId == id) - .filter(updatedMemberIds.contains(GroupMember.Columns.profileId)) + .filter(membersToRemove.map{ $0.profileId }.contains(GroupMember.Columns.profileId)) .deleteAll(db) if didAdminLeave || sender == userPublicKey { diff --git a/SessionMessagingKit/Shared Models/SessionThreadViewModel.swift b/SessionMessagingKit/Shared Models/SessionThreadViewModel.swift index 0699a306e..02e614aeb 100644 --- a/SessionMessagingKit/Shared Models/SessionThreadViewModel.swift +++ b/SessionMessagingKit/Shared Models/SessionThreadViewModel.swift @@ -871,7 +871,7 @@ public extension SessionThreadViewModel { LEFT JOIN \(OpenGroup.self) ON \(openGroup[.threadId]) = \(thread[.id]) LEFT JOIN \(ClosedGroup.self) ON \(closedGroup[.threadId]) = \(thread[.id]) LEFT JOIN \(GroupMember.self) AS \(ViewModel.currentUserIsClosedGroupMemberKey) ON ( - \(SQL("\(ViewModel.currentUserIsClosedGroupMemberKey).\(groupMemberRoleColumnLiteral) = \(GroupMember.Role.standard)")) AND + \(SQL("\(ViewModel.currentUserIsClosedGroupMemberKey).\(groupMemberRoleColumnLiteral) != \(GroupMember.Role.zombie)")) AND \(ViewModel.currentUserIsClosedGroupMemberKey).\(groupMemberGroupIdColumnLiteral) = \(closedGroup[.threadId]) AND \(SQL("\(ViewModel.currentUserIsClosedGroupMemberKey).\(groupMemberProfileIdColumnLiteral) = \(userPublicKey)")) ) From 36ed8802bbd79dcbe95f0a911fa1be29cbf0667b Mon Sep 17 00:00:00 2001 From: ryanzhao Date: Thu, 2 Mar 2023 16:17:58 +1100 Subject: [PATCH 17/22] don't include the attachment when quoted if the attachment is not downloaded --- SessionMessagingKit/Database/Models/Attachment.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SessionMessagingKit/Database/Models/Attachment.swift b/SessionMessagingKit/Database/Models/Attachment.swift index fc004c92e..c91686a17 100644 --- a/SessionMessagingKit/Database/Models/Attachment.swift +++ b/SessionMessagingKit/Database/Models/Attachment.swift @@ -885,13 +885,16 @@ extension Attachment { guard self.isValid, - self.isVisualMedia, let thumbnailPath: String = Attachment.originalFilePath( id: cloneId, mimeType: OWSMimeTypeImageJpeg, sourceFilename: thumbnailName ) else { + return nil + } + + guard self.isVisualMedia else { // Non-media files cannot have thumbnails but may be sent as quotes, in these cases we want // to create an attachment in an 'uploaded' state with a hard-coded file id so the messageSend // job doesn't try to upload the attachment (we include the original `serverId` as it's From 84ea821095270ad678c371beb13502c877e59ceb Mon Sep 17 00:00:00 2001 From: ryanzhao Date: Thu, 2 Mar 2023 17:05:26 +1100 Subject: [PATCH 18/22] WIP: fix quote when retrying sending a message --- Session/Conversations/ConversationVC+Interaction.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Session/Conversations/ConversationVC+Interaction.swift b/Session/Conversations/ConversationVC+Interaction.swift index 380c9c610..7ee51d86f 100644 --- a/Session/Conversations/ConversationVC+Interaction.swift +++ b/Session/Conversations/ConversationVC+Interaction.swift @@ -1604,6 +1604,13 @@ extension ConversationVC: let thread: SessionThread = try SessionThread.fetchOne(db, id: threadId) else { return } + if + let quote = try? interaction.quote.fetchOne(db), + let quotedInteraction = try? quote.interaction.fetchOne(db) + { + + } + try MessageSender.send( db, interaction: interaction, From 3aacf27b798fe5927cde0afbcb842adcda148184 Mon Sep 17 00:00:00 2001 From: Ryan Zhao Date: Mon, 6 Mar 2023 14:33:24 +1100 Subject: [PATCH 19/22] regenerate the quoted attachment thumbnail when retrying to send the message --- .../ConversationVC+Interaction.swift | 10 ++++++++-- .../Database/Models/Attachment.swift | 5 +---- .../Database/Models/Quote.swift | 20 +++++++++++++++++++ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/Session/Conversations/ConversationVC+Interaction.swift b/Session/Conversations/ConversationVC+Interaction.swift index 7ee51d86f..d94bf3199 100644 --- a/Session/Conversations/ConversationVC+Interaction.swift +++ b/Session/Conversations/ConversationVC+Interaction.swift @@ -1606,9 +1606,15 @@ extension ConversationVC: if let quote = try? interaction.quote.fetchOne(db), - let quotedInteraction = try? quote.interaction.fetchOne(db) + let quotedAttachment = try? quote.attachment.fetchOne(db), + quotedAttachment.isVisualMedia, + quotedAttachment.downloadUrl == Attachment.nonMediaQuoteFileId, + let quotedInteraction = try? quote.originalInteraction.fetchOne(db) { - + let attachment = try? quotedInteraction.attachments.fetchAll(db).first + try quote.with( + attachmentId: attachment?.cloneAsQuoteThumbnail()?.inserted(db).id + ).update(db) } try MessageSender.send( diff --git a/SessionMessagingKit/Database/Models/Attachment.swift b/SessionMessagingKit/Database/Models/Attachment.swift index c91686a17..fc004c92e 100644 --- a/SessionMessagingKit/Database/Models/Attachment.swift +++ b/SessionMessagingKit/Database/Models/Attachment.swift @@ -885,16 +885,13 @@ extension Attachment { guard self.isValid, + self.isVisualMedia, let thumbnailPath: String = Attachment.originalFilePath( id: cloneId, mimeType: OWSMimeTypeImageJpeg, sourceFilename: thumbnailName ) else { - return nil - } - - guard self.isVisualMedia else { // Non-media files cannot have thumbnails but may be sent as quotes, in these cases we want // to create an attachment in an 'uploaded' state with a hard-coded file id so the messageSend // job doesn't try to upload the attachment (we include the original `serverId` as it's diff --git a/SessionMessagingKit/Database/Models/Quote.swift b/SessionMessagingKit/Database/Models/Quote.swift index af92ee454..1b702ecf1 100644 --- a/SessionMessagingKit/Database/Models/Quote.swift +++ b/SessionMessagingKit/Database/Models/Quote.swift @@ -76,6 +76,26 @@ public struct Quote: Codable, Equatable, Hashable, FetchableRecord, PersistableR } } +// MARK: - Mutation + +public extension Quote { + func with( + interactionId: Int64? = nil, + authorId: String? = nil, + timestampMs: Int64? = nil, + body: String? = nil, + attachmentId: String? = nil + ) -> Quote { + return Quote( + interactionId: interactionId ?? self.interactionId, + authorId: authorId ?? self.authorId, + timestampMs: timestampMs ?? self.timestampMs, + body: body ?? self.body, + attachmentId: attachmentId ?? self.attachmentId + ) + } +} + // MARK: - Protobuf public extension Quote { From 00d5d0815211d1295921e639f9444d7651d9b7b9 Mon Sep 17 00:00:00 2001 From: Ryan Zhao Date: Mon, 6 Mar 2023 15:31:04 +1100 Subject: [PATCH 20/22] fix retry action will end up with sending the same interaction twice --- Session/Conversations/ConversationVC+Interaction.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Session/Conversations/ConversationVC+Interaction.swift b/Session/Conversations/ConversationVC+Interaction.swift index d94bf3199..a8ca98c6d 100644 --- a/Session/Conversations/ConversationVC+Interaction.swift +++ b/Session/Conversations/ConversationVC+Interaction.swift @@ -1617,6 +1617,10 @@ extension ConversationVC: ).update(db) } + // Remove message sending jobs for the same interaction in database + // Prevent the same message being sent twice + try Job.filter(Job.Columns.interactionId == interaction.id).deleteAll(db) + try MessageSender.send( db, interaction: interaction, From 779e199d7de35c6bcdcdec22a741aa1b4f6ed746 Mon Sep 17 00:00:00 2001 From: Ryan Zhao Date: Mon, 6 Mar 2023 15:53:26 +1100 Subject: [PATCH 21/22] update build number --- Session.xcodeproj/project.pbxproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Session.xcodeproj/project.pbxproj b/Session.xcodeproj/project.pbxproj index d8fbdb833..42129e423 100644 --- a/Session.xcodeproj/project.pbxproj +++ b/Session.xcodeproj/project.pbxproj @@ -6040,7 +6040,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 394; + CURRENT_PROJECT_VERSION = 395; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -6113,7 +6113,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 394; + CURRENT_PROJECT_VERSION = 395; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = SUQ8J2PCT7; ENABLE_NS_ASSERTIONS = NO; @@ -6179,7 +6179,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 394; + CURRENT_PROJECT_VERSION = 395; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -6253,7 +6253,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 394; + CURRENT_PROJECT_VERSION = 395; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = SUQ8J2PCT7; ENABLE_NS_ASSERTIONS = NO; From 37962fa071981b245f1aa1f909709c62101c6978 Mon Sep 17 00:00:00 2001 From: Ryan Zhao Date: Mon, 6 Mar 2023 16:13:08 +1100 Subject: [PATCH 22/22] update build number --- Session.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Session.xcodeproj/project.pbxproj b/Session.xcodeproj/project.pbxproj index 42129e423..95ecf73f0 100644 --- a/Session.xcodeproj/project.pbxproj +++ b/Session.xcodeproj/project.pbxproj @@ -7181,7 +7181,7 @@ CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 394; + CURRENT_PROJECT_VERSION = 395; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -7253,7 +7253,7 @@ CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 394; + CURRENT_PROJECT_VERSION = 395; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)",