diff --git a/Signal/ConversationView/Components/CVComponentAudioAttachment.swift b/Signal/ConversationView/Components/CVComponentAudioAttachment.swift index ef7ad12ded..193318d687 100644 --- a/Signal/ConversationView/Components/CVComponentAudioAttachment.swift +++ b/Signal/ConversationView/Components/CVComponentAudioAttachment.swift @@ -248,7 +248,7 @@ public class CVComponentAudioAttachment: CVComponentBase, CVComponent { return nil } let itemViewModel = CVItemViewModelImpl(renderItem: renderItem) - guard componentDelegate.shouldAllowReplyForItem(itemViewModel) else { + guard componentDelegate.shouldAllowMessageSendActionsForItem(itemViewModel) else { return nil } guard nil != attachmentStream else { diff --git a/Signal/ConversationView/Components/CVComponentDelegate.swift b/Signal/ConversationView/Components/CVComponentDelegate.swift index 872c16efed..69d2b793a9 100644 --- a/Signal/ConversationView/Components/CVComponentDelegate.swift +++ b/Signal/ConversationView/Components/CVComponentDelegate.swift @@ -47,19 +47,19 @@ public protocol CVComponentDelegate: AnyObject, AudioMessageViewDelegate, CVPoll func didLongPressTextViewItem( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) func didLongPressMediaViewItem( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) func didLongPressQuote( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) func didLongPressSystemMessage( @@ -70,19 +70,19 @@ public protocol CVComponentDelegate: AnyObject, AudioMessageViewDelegate, CVPoll func didLongPressSticker( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) func didLongPressPaymentMessage( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) func didLongPressPoll( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) func didChangeLongPress(_ itemViewModel: CVItemViewModelImpl) @@ -105,7 +105,7 @@ public protocol CVComponentDelegate: AnyObject, AudioMessageViewDelegate, CVPoll func didTapSenderAvatar(_ interaction: TSInteraction) - func shouldAllowReplyForItem(_ itemViewModel: CVItemViewModelImpl) -> Bool + func shouldAllowMessageSendActionsForItem(_ itemViewModel: CVItemViewModelImpl) -> Bool func didTapReactions( reactionState: InteractionReactionState, diff --git a/Signal/ConversationView/Components/CVComponentMessage.swift b/Signal/ConversationView/Components/CVComponentMessage.swift index 3385d6a5ec..5e39720b62 100644 --- a/Signal/ConversationView/Components/CVComponentMessage.swift +++ b/Signal/ConversationView/Components/CVComponentMessage.swift @@ -2774,7 +2774,7 @@ public class CVComponentMessage: CVComponentBase, CVRootComponent { // only become active if this message allows // swipe-to-reply. let itemViewModel = CVItemViewModelImpl(renderItem: renderItem) - if componentDelegate.shouldAllowReplyForItem(itemViewModel) { + if componentDelegate.shouldAllowMessageSendActionsForItem(itemViewModel) { activeDirection = .right } else { activeDirection = .none diff --git a/Signal/ConversationView/ConversationViewController+CVC.swift b/Signal/ConversationView/ConversationViewController+CVC.swift index 98a46bb602..dc655a703e 100644 --- a/Signal/ConversationView/ConversationViewController+CVC.swift +++ b/Signal/ConversationView/ConversationViewController+CVC.swift @@ -112,7 +112,7 @@ extension ConversationViewController: CVLoadCoordinatorDelegate { } let itemViewModel = CVItemViewModelImpl(renderItem: renderItem) - let shouldAllowReply = shouldAllowReplyForItem(itemViewModel) + let shouldAllowMessageSendActions = shouldAllowMessageSendActionsForItem(itemViewModel) let messageActions: [MessageAction] if itemViewModel.messageCellType == .systemMessage { messageActions = MessageActions.infoMessageActions( @@ -122,13 +122,13 @@ extension ConversationViewController: CVLoadCoordinatorDelegate { } else if itemViewModel.messageCellType == .stickerMessage || itemViewModel.messageCellType == .genericAttachment { messageActions = MessageActions.mediaActions( itemViewModel: itemViewModel, - shouldAllowReply: shouldAllowReply, + shouldAllowMessageSendActions: shouldAllowMessageSendActions, delegate: self, ) } else { messageActions = MessageActions.textActions( itemViewModel: itemViewModel, - shouldAllowReply: shouldAllowReply, + shouldAllowMessageSendActions: shouldAllowMessageSendActions, delegate: self, ) } diff --git a/Signal/ConversationView/ConversationViewController+CVComponentDelegate.swift b/Signal/ConversationView/ConversationViewController+CVComponentDelegate.swift index ea0e1c3557..866314cb23 100644 --- a/Signal/ConversationView/ConversationViewController+CVComponentDelegate.swift +++ b/Signal/ConversationView/ConversationViewController+CVComponentDelegate.swift @@ -52,13 +52,13 @@ extension ConversationViewController: CVComponentDelegate { public func didLongPressTextViewItem( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) { AssertIsOnMainThread() let messageActions = MessageActions.textActions( itemViewModel: itemViewModel, - shouldAllowReply: shouldAllowReply, + shouldAllowMessageSendActions: shouldAllowMessageSendActions, delegate: self, ) self.presentContextMenu(with: messageActions, focusedOn: cell, andModel: itemViewModel) @@ -67,13 +67,13 @@ extension ConversationViewController: CVComponentDelegate { public func didLongPressMediaViewItem( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) { AssertIsOnMainThread() let messageActions = MessageActions.mediaActions( itemViewModel: itemViewModel, - shouldAllowReply: shouldAllowReply, + shouldAllowMessageSendActions: shouldAllowMessageSendActions, delegate: self, ) self.presentContextMenu(with: messageActions, focusedOn: cell, andModel: itemViewModel) @@ -82,13 +82,13 @@ extension ConversationViewController: CVComponentDelegate { public func didLongPressQuote( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) { AssertIsOnMainThread() let messageActions = MessageActions.quotedMessageActions( itemViewModel: itemViewModel, - shouldAllowReply: shouldAllowReply, + shouldAllowMessageSendActions: shouldAllowMessageSendActions, delegate: self, ) self.presentContextMenu(with: messageActions, focusedOn: cell, andModel: itemViewModel) @@ -110,13 +110,13 @@ extension ConversationViewController: CVComponentDelegate { public func didLongPressSticker( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) { AssertIsOnMainThread() let messageActions = MessageActions.mediaActions( itemViewModel: itemViewModel, - shouldAllowReply: shouldAllowReply, + shouldAllowMessageSendActions: shouldAllowMessageSendActions, delegate: self, ) self.presentContextMenu(with: messageActions, focusedOn: cell, andModel: itemViewModel) @@ -125,11 +125,11 @@ extension ConversationViewController: CVComponentDelegate { public func didLongPressPaymentMessage( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) { let messageActions = MessageActions.paymentActions( itemViewModel: itemViewModel, - shouldAllowReply: shouldAllowReply, + shouldAllowMessageSendActions: shouldAllowMessageSendActions, delegate: self, ) self.presentContextMenu(with: messageActions, focusedOn: cell, andModel: itemViewModel) @@ -138,11 +138,11 @@ extension ConversationViewController: CVComponentDelegate { public func didLongPressPoll( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) { let messageActions = MessageActions.pollActions( itemViewModel: itemViewModel, - shouldAllowReply: shouldAllowReply, + shouldAllowMessageSendActions: shouldAllowMessageSendActions, delegate: self, ) self.presentContextMenu(with: messageActions, focusedOn: cell, andModel: itemViewModel) @@ -280,7 +280,7 @@ extension ConversationViewController: CVComponentDelegate { showMemberActionSheet(forAddress: incomingMessage.authorAddress, withHapticFeedback: false) } - public func shouldAllowReplyForItem(_ itemViewModel: CVItemViewModelImpl) -> Bool { + public func shouldAllowMessageSendActionsForItem(_ itemViewModel: CVItemViewModelImpl) -> Bool { AssertIsOnMainThread() if thread.isGroupThread, !thread.isLocalUserFullMemberOfThread { @@ -292,6 +292,11 @@ extension ConversationViewController: CVComponentDelegate { if self.threadViewModel.hasPendingMessageRequest { return false } + if let groupModelV2 = currentGroupModel as? TSGroupModelV2 { + if groupModelV2.isAnnouncementsOnly, !groupModelV2.groupMembership.isLocalUserFullMemberAndAdministrator { + return false + } + } if itemViewModel.wasRemotelyDeleted { return false } diff --git a/Signal/ConversationView/ConversationViewController+GestureRecognizers.swift b/Signal/ConversationView/ConversationViewController+GestureRecognizers.swift index c300357be6..d8b5166f72 100644 --- a/Signal/ConversationView/ConversationViewController+GestureRecognizers.swift +++ b/Signal/ConversationView/ConversationViewController+GestureRecognizers.swift @@ -349,53 +349,53 @@ public struct CVLongPressHandler { return } - let shouldAllowReply = delegate.shouldAllowReplyForItem(itemViewModel) + let shouldAllowMessageSendActions = delegate.shouldAllowMessageSendActionsForItem(itemViewModel) switch gestureLocation { case .`default`: delegate.didLongPressTextViewItem( cell, itemViewModel: itemViewModel, - shouldAllowReply: shouldAllowReply, + shouldAllowMessageSendActions: shouldAllowMessageSendActions, ) case .media: delegate.didLongPressMediaViewItem( cell, itemViewModel: itemViewModel, - shouldAllowReply: shouldAllowReply, + shouldAllowMessageSendActions: shouldAllowMessageSendActions, ) case .sticker: delegate.didLongPressSticker( cell, itemViewModel: itemViewModel, - shouldAllowReply: shouldAllowReply, + shouldAllowMessageSendActions: shouldAllowMessageSendActions, ) case .quotedReply: delegate.didLongPressQuote( cell, itemViewModel: itemViewModel, - shouldAllowReply: shouldAllowReply, + shouldAllowMessageSendActions: shouldAllowMessageSendActions, ) case .systemMessage: delegate.didLongPressSystemMessage(cell, itemViewModel: itemViewModel) case .paymentMessage: - delegate.didLongPressPaymentMessage(cell, itemViewModel: itemViewModel, shouldAllowReply: shouldAllowReply) + delegate.didLongPressPaymentMessage(cell, itemViewModel: itemViewModel, shouldAllowMessageSendActions: shouldAllowMessageSendActions) case .poll: - delegate.didLongPressPoll(cell, itemViewModel: itemViewModel, shouldAllowReply: shouldAllowReply) + delegate.didLongPressPoll(cell, itemViewModel: itemViewModel, shouldAllowMessageSendActions: shouldAllowMessageSendActions) case .bodyText: break case .associatedSubcomponent: // Bottom buttons, labels, and footers are considered separate subcomponents, // but may be associated with another subcomponent type. if let message = itemViewModel.interaction as? TSMessage, message.isPoll { - delegate.didLongPressPoll(cell, itemViewModel: itemViewModel, shouldAllowReply: shouldAllowReply) + delegate.didLongPressPoll(cell, itemViewModel: itemViewModel, shouldAllowMessageSendActions: shouldAllowMessageSendActions) return } // Default delegate.didLongPressTextViewItem( cell, itemViewModel: itemViewModel, - shouldAllowReply: shouldAllowReply, + shouldAllowMessageSendActions: shouldAllowMessageSendActions, ) } } diff --git a/Signal/ConversationView/MessageActions.swift b/Signal/ConversationView/MessageActions.swift index f954177fb4..5cb78a605d 100644 --- a/Signal/ConversationView/MessageActions.swift +++ b/Signal/ConversationView/MessageActions.swift @@ -201,31 +201,9 @@ enum MessageActionBuilder { static func changePinStatus( itemViewModel: CVItemViewModelImpl, + footerState: CVComponentFooter.State, delegate: MessageActionsDelegate, - ) -> MessageAction? { - let db = DependenciesBridge.shared.db - - guard - let localAci = DependenciesBridge.shared.tsAccountManager.localIdentifiersWithMaybeSneakyTransaction?.aci, - db.read(block: { tx in itemViewModel.thread.canUserEditPinnedMessages(aci: localAci, tx: tx) }) - else { - return nil - } - - guard - !itemViewModel.wasRemotelyDeleted, - itemViewModel.componentState.giftBadge == nil - else { - return nil - } - - if itemViewModel.thread.isTerminatedGroup { - return nil - } - - guard let footerState = itemViewModel.renderItem.itemViewState.footerState else { - return nil - } + ) -> MessageAction { if footerState.isPinnedMessage { return MessageAction( @@ -253,8 +231,19 @@ enum MessageActionBuilder { } class MessageActions: NSObject { + private class func canLocalUserEditGroupAttributes(itemViewModel: CVItemViewModelImpl) -> Bool { + guard let groupModel = itemViewModel.thread.groupModelIfGroupThread as? TSGroupModelV2 else { + return true + } - class func textActions(itemViewModel: CVItemViewModelImpl, shouldAllowReply: Bool, delegate: MessageActionsDelegate) -> [MessageAction] { + if groupModel.groupMembership.isLocalUserFullMemberAndAdministrator { + return true + } + + return groupModel.access.attributes != .administrator && !groupModel.isAnnouncementsOnly + } + + class func textActions(itemViewModel: CVItemViewModelImpl, shouldAllowMessageSendActions: Bool, delegate: MessageActionsDelegate) -> [MessageAction] { var actions: [MessageAction] = [] let showDetailsAction = MessageActionBuilder.showDetails(itemViewModel: itemViewModel, delegate: delegate) @@ -268,7 +257,7 @@ class MessageActions: NSObject { actions.append(copyTextAction) } - if shouldAllowReply { + if shouldAllowMessageSendActions { let replyAction = MessageActionBuilder.reply(itemViewModel: itemViewModel, delegate: delegate) actions.append(replyAction) } @@ -280,7 +269,7 @@ class MessageActions: NSObject { let selectAction = MessageActionBuilder.selectMessage(itemViewModel: itemViewModel, delegate: delegate) actions.append(selectAction) - if itemViewModel.canEditMessage { + if itemViewModel.canEditMessage, shouldAllowMessageSendActions { let editAction = MessageActionBuilder.editMessage(itemViewModel: itemViewModel, delegate: delegate) actions.append(editAction) } @@ -297,14 +286,25 @@ class MessageActions: NSObject { } } - if let pinAction = MessageActionBuilder.changePinStatus(itemViewModel: itemViewModel, delegate: delegate) { + if + shouldAllowMessageSendActions, + itemViewModel.componentState.giftBadge == nil, + let footerState = itemViewModel.renderItem.itemViewState.footerState, + canLocalUserEditGroupAttributes(itemViewModel: itemViewModel) + { + // Check can change pin + let pinAction = MessageActionBuilder.changePinStatus( + itemViewModel: itemViewModel, + footerState: footerState, + delegate: delegate, + ) actions.append(pinAction) } return actions } - class func mediaActions(itemViewModel: CVItemViewModelImpl, shouldAllowReply: Bool, delegate: MessageActionsDelegate) -> [MessageAction] { + class func mediaActions(itemViewModel: CVItemViewModelImpl, shouldAllowMessageSendActions: Bool, delegate: MessageActionsDelegate) -> [MessageAction] { var actions: [MessageAction] = [] let showDetailsAction = MessageActionBuilder.showDetails(itemViewModel: itemViewModel, delegate: delegate) @@ -323,7 +323,7 @@ class MessageActions: NSObject { actions.append(saveMediaAction) } - if shouldAllowReply { + if shouldAllowMessageSendActions { let replyAction = MessageActionBuilder.reply(itemViewModel: itemViewModel, delegate: delegate) actions.append(replyAction) } @@ -332,7 +332,7 @@ class MessageActions: NSObject { actions.append(MessageActionBuilder.forwardMessage(itemViewModel: itemViewModel, delegate: delegate)) } - if itemViewModel.canEditMessage { + if itemViewModel.canEditMessage, shouldAllowMessageSendActions { let editAction = MessageActionBuilder.editMessage(itemViewModel: itemViewModel, delegate: delegate) actions.append(editAction) } @@ -340,14 +340,24 @@ class MessageActions: NSObject { let selectAction = MessageActionBuilder.selectMessage(itemViewModel: itemViewModel, delegate: delegate) actions.append(selectAction) - if let pinAction = MessageActionBuilder.changePinStatus(itemViewModel: itemViewModel, delegate: delegate) { + if + shouldAllowMessageSendActions, + itemViewModel.componentState.giftBadge == nil, + let footerState = itemViewModel.renderItem.itemViewState.footerState, + canLocalUserEditGroupAttributes(itemViewModel: itemViewModel) + { + let pinAction = MessageActionBuilder.changePinStatus( + itemViewModel: itemViewModel, + footerState: footerState, + delegate: delegate, + ) actions.append(pinAction) } return actions } - class func quotedMessageActions(itemViewModel: CVItemViewModelImpl, shouldAllowReply: Bool, delegate: MessageActionsDelegate) -> [MessageAction] { + class func quotedMessageActions(itemViewModel: CVItemViewModelImpl, shouldAllowMessageSendActions: Bool, delegate: MessageActionsDelegate) -> [MessageAction] { var actions: [MessageAction] = [] let showDetailsAction = MessageActionBuilder.showDetails(itemViewModel: itemViewModel, delegate: delegate) @@ -356,7 +366,7 @@ class MessageActions: NSObject { let deleteAction = MessageActionBuilder.deleteMessage(itemViewModel: itemViewModel, delegate: delegate) actions.append(deleteAction) - if shouldAllowReply { + if shouldAllowMessageSendActions { let replyAction = MessageActionBuilder.reply(itemViewModel: itemViewModel, delegate: delegate) actions.append(replyAction) } @@ -365,7 +375,7 @@ class MessageActions: NSObject { actions.append(MessageActionBuilder.forwardMessage(itemViewModel: itemViewModel, delegate: delegate)) } - if itemViewModel.canEditMessage { + if itemViewModel.canEditMessage, shouldAllowMessageSendActions { let editAction = MessageActionBuilder.editMessage(itemViewModel: itemViewModel, delegate: delegate) actions.append(editAction) } @@ -373,7 +383,17 @@ class MessageActions: NSObject { let selectAction = MessageActionBuilder.selectMessage(itemViewModel: itemViewModel, delegate: delegate) actions.append(selectAction) - if let pinAction = MessageActionBuilder.changePinStatus(itemViewModel: itemViewModel, delegate: delegate) { + if + shouldAllowMessageSendActions, + itemViewModel.componentState.giftBadge == nil, + let footerState = itemViewModel.renderItem.itemViewState.footerState, + canLocalUserEditGroupAttributes(itemViewModel: itemViewModel) + { + let pinAction = MessageActionBuilder.changePinStatus( + itemViewModel: itemViewModel, + footerState: footerState, + delegate: delegate, + ) actions.append(pinAction) } @@ -382,7 +402,7 @@ class MessageActions: NSObject { class func paymentActions( itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, delegate: MessageActionsDelegate, ) -> [MessageAction] { var actions: [MessageAction] = [] @@ -405,7 +425,7 @@ class MessageActions: NSObject { ) actions.append(showPaymentDetailsAction) - if shouldAllowReply { + if shouldAllowMessageSendActions { let replyAction = MessageActionBuilder.reply( itemViewModel: itemViewModel, delegate: delegate, @@ -419,16 +439,25 @@ class MessageActions: NSObject { ) actions.append(selectAction) - if let pinAction = MessageActionBuilder.changePinStatus(itemViewModel: itemViewModel, delegate: delegate) { + if + shouldAllowMessageSendActions, + itemViewModel.componentState.giftBadge == nil, + let footerState = itemViewModel.renderItem.itemViewState.footerState, + canLocalUserEditGroupAttributes(itemViewModel: itemViewModel) + { + let pinAction = MessageActionBuilder.changePinStatus( + itemViewModel: itemViewModel, + footerState: footerState, + delegate: delegate, + ) actions.append(pinAction) } - return actions } class func pollActions( itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, delegate: MessageActionsDelegate, ) -> [MessageAction] { var actions: [MessageAction] = [] @@ -445,7 +474,7 @@ class MessageActions: NSObject { ) actions.append(deleteAction) - if shouldAllowReply { + if shouldAllowMessageSendActions { let replyAction = MessageActionBuilder.reply(itemViewModel: itemViewModel, delegate: delegate) actions.append(replyAction) } @@ -460,7 +489,7 @@ class MessageActions: NSObject { let poll = itemViewModel.componentState.poll?.state.poll, poll.ownerIsLocalUser, !poll.isEnded, - !itemViewModel.thread.isTerminatedGroup + shouldAllowMessageSendActions { let endPollAction = MessageActionBuilder.endPoll( itemViewModel: itemViewModel, @@ -469,7 +498,17 @@ class MessageActions: NSObject { actions.append(endPollAction) } - if let pinAction = MessageActionBuilder.changePinStatus(itemViewModel: itemViewModel, delegate: delegate) { + if + shouldAllowMessageSendActions, + itemViewModel.componentState.giftBadge == nil, + let footerState = itemViewModel.renderItem.itemViewState.footerState, + canLocalUserEditGroupAttributes(itemViewModel: itemViewModel) + { + let pinAction = MessageActionBuilder.changePinStatus( + itemViewModel: itemViewModel, + footerState: footerState, + delegate: delegate, + ) actions.append(pinAction) } diff --git a/Signal/src/ViewControllers/EditHistoryTableSheetViewController.swift b/Signal/src/ViewControllers/EditHistoryTableSheetViewController.swift index 0f7e6a27d0..b4f7a3cbd9 100644 --- a/Signal/src/ViewControllers/EditHistoryTableSheetViewController.swift +++ b/Signal/src/ViewControllers/EditHistoryTableSheetViewController.swift @@ -317,19 +317,19 @@ extension EditHistoryTableSheetViewController: CVComponentDelegate { func didLongPressTextViewItem( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didLongPressMediaViewItem( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didLongPressQuote( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didLongPressSystemMessage( @@ -340,19 +340,19 @@ extension EditHistoryTableSheetViewController: CVComponentDelegate { func didLongPressSticker( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didLongPressPaymentMessage( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didLongPressPoll( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didTapPayment(_ payment: PaymentsHistoryItem) {} @@ -377,7 +377,7 @@ extension EditHistoryTableSheetViewController: CVComponentDelegate { func didTapSenderAvatar(_ interaction: TSInteraction) {} - func shouldAllowReplyForItem(_ itemViewModel: CVItemViewModelImpl) -> Bool { false } + func shouldAllowMessageSendActionsForItem(_ itemViewModel: CVItemViewModelImpl) -> Bool { false } func didTapReactions( reactionState: InteractionReactionState, diff --git a/Signal/src/ViewControllers/MediaGallery/Cells/MediaGalleryFileCell.swift b/Signal/src/ViewControllers/MediaGallery/Cells/MediaGalleryFileCell.swift index fcaea14f1c..b90b80b9d3 100644 --- a/Signal/src/ViewControllers/MediaGallery/Cells/MediaGalleryFileCell.swift +++ b/Signal/src/ViewControllers/MediaGallery/Cells/MediaGalleryFileCell.swift @@ -330,19 +330,19 @@ extension MediaGalleryFileCell: CVComponentDelegate { func didLongPressTextViewItem( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didLongPressMediaViewItem( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didLongPressQuote( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didLongPressSystemMessage( @@ -353,19 +353,19 @@ extension MediaGalleryFileCell: CVComponentDelegate { func didLongPressSticker( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didLongPressPaymentMessage( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didLongPressPoll( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didTapPayment(_ payment: PaymentsHistoryItem) {} @@ -390,7 +390,7 @@ extension MediaGalleryFileCell: CVComponentDelegate { func didTapSenderAvatar(_ interaction: TSInteraction) {} - func shouldAllowReplyForItem(_ itemViewModel: CVItemViewModelImpl) -> Bool { false } + func shouldAllowMessageSendActionsForItem(_ itemViewModel: CVItemViewModelImpl) -> Bool { false } func didTapReactions( reactionState: InteractionReactionState, diff --git a/Signal/src/ViewControllers/MemberLabels/MemberLabelViewController.swift b/Signal/src/ViewControllers/MemberLabels/MemberLabelViewController.swift index c846cb6db2..9fe5f2bbd3 100644 --- a/Signal/src/ViewControllers/MemberLabels/MemberLabelViewController.swift +++ b/Signal/src/ViewControllers/MemberLabels/MemberLabelViewController.swift @@ -598,19 +598,19 @@ extension MemberLabelViewController: CVComponentDelegate { func didLongPressTextViewItem( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didLongPressMediaViewItem( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didLongPressQuote( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didLongPressSystemMessage( @@ -621,19 +621,19 @@ extension MemberLabelViewController: CVComponentDelegate { func didLongPressSticker( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didLongPressPaymentMessage( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didLongPressPoll( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didTapPayment(_ payment: PaymentsHistoryItem) {} @@ -658,7 +658,7 @@ extension MemberLabelViewController: CVComponentDelegate { func didTapSenderAvatar(_ interaction: TSInteraction) {} - func shouldAllowReplyForItem(_ itemViewModel: CVItemViewModelImpl) -> Bool { false } + func shouldAllowMessageSendActionsForItem(_ itemViewModel: CVItemViewModelImpl) -> Bool { false } func didTapReactions( reactionState: InteractionReactionState, diff --git a/Signal/src/ViewControllers/MessageDetailViewController.swift b/Signal/src/ViewControllers/MessageDetailViewController.swift index e0816d04fc..840ea3ce47 100644 --- a/Signal/src/ViewControllers/MessageDetailViewController.swift +++ b/Signal/src/ViewControllers/MessageDetailViewController.swift @@ -1063,21 +1063,21 @@ extension MessageDetailViewController: CVComponentDelegate { func didLongPressTextViewItem( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} // TODO: func didLongPressMediaViewItem( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} // TODO: func didLongPressQuote( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} // TODO: @@ -1090,19 +1090,19 @@ extension MessageDetailViewController: CVComponentDelegate { func didLongPressSticker( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didLongPressPaymentMessage( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) { } func didLongPressPoll( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} // TODO: @@ -1131,7 +1131,7 @@ extension MessageDetailViewController: CVComponentDelegate { func didTapSenderAvatar(_ interaction: TSInteraction) {} // TODO: - func shouldAllowReplyForItem(_ itemViewModel: CVItemViewModelImpl) -> Bool { false } + func shouldAllowMessageSendActionsForItem(_ itemViewModel: CVItemViewModelImpl) -> Bool { false } // TODO: func didTapReactions( diff --git a/Signal/src/ViewControllers/PinnedMessages/PinnedMessagesDetailsViewController.swift b/Signal/src/ViewControllers/PinnedMessages/PinnedMessagesDetailsViewController.swift index afa9a05fb3..614f03c69a 100644 --- a/Signal/src/ViewControllers/PinnedMessages/PinnedMessagesDetailsViewController.swift +++ b/Signal/src/ViewControllers/PinnedMessages/PinnedMessagesDetailsViewController.swift @@ -443,19 +443,19 @@ extension PinnedMessagesDetailsViewController: CVComponentDelegate { func didLongPressTextViewItem( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didLongPressMediaViewItem( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didLongPressQuote( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didLongPressSystemMessage( @@ -466,19 +466,19 @@ extension PinnedMessagesDetailsViewController: CVComponentDelegate { func didLongPressSticker( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didLongPressPaymentMessage( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didLongPressPoll( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didTapPayment(_ payment: PaymentsHistoryItem) {} @@ -503,7 +503,7 @@ extension PinnedMessagesDetailsViewController: CVComponentDelegate { func didTapSenderAvatar(_ interaction: TSInteraction) {} - func shouldAllowReplyForItem(_ itemViewModel: CVItemViewModelImpl) -> Bool { false } + func shouldAllowMessageSendActionsForItem(_ itemViewModel: CVItemViewModelImpl) -> Bool { false } func didTapReactions( reactionState: InteractionReactionState, diff --git a/Signal/src/views/MockConversationView.swift b/Signal/src/views/MockConversationView.swift index 381f99f652..c799811c2b 100644 --- a/Signal/src/views/MockConversationView.swift +++ b/Signal/src/views/MockConversationView.swift @@ -341,19 +341,19 @@ extension MockConversationView: CVComponentDelegate { func didLongPressTextViewItem( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didLongPressMediaViewItem( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didLongPressQuote( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didLongPressSystemMessage( @@ -364,13 +364,13 @@ extension MockConversationView: CVComponentDelegate { func didLongPressSticker( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didLongPressPoll( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) {} func didChangeLongPress(_ itemViewModel: CVItemViewModelImpl) {} @@ -393,7 +393,7 @@ extension MockConversationView: CVComponentDelegate { func didTapSenderAvatar(_ interaction: TSInteraction) {} - func shouldAllowReplyForItem(_ itemViewModel: CVItemViewModelImpl) -> Bool { false } + func shouldAllowMessageSendActionsForItem(_ itemViewModel: CVItemViewModelImpl) -> Bool { false } func didTapReactions( reactionState: InteractionReactionState, @@ -533,7 +533,7 @@ extension MockConversationView: CVComponentDelegate { func didLongPressPaymentMessage( _ cell: CVCell, itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool, + shouldAllowMessageSendActions: Bool, ) { } func didTapPayment(_ payment: PaymentsHistoryItem) {} diff --git a/SignalServiceKit/Messages/Edit/EditManagerImpl.swift b/SignalServiceKit/Messages/Edit/EditManagerImpl.swift index c072e47367..5ce8cdef0b 100644 --- a/SignalServiceKit/Messages/Edit/EditManagerImpl.swift +++ b/SignalServiceKit/Messages/Edit/EditManagerImpl.swift @@ -160,10 +160,6 @@ public class EditManagerImpl: EditManager { return .messageTypeNotSupported } - if thread.isTerminatedGroup { - return .editWindowClosed - } - if !thread.isNoteToSelf { let (result, isOverflow) = interaction.timestamp.addingReportingOverflow(Constants.editSendWindowMilliseconds) guard !isOverflow, Date.ows_millisecondTimestamp() <= result else {