diff --git a/Signal/src/ViewControllers/ConversationView/CV/CVComponentDelegate.swift b/Signal/src/ViewControllers/ConversationView/CV/CVComponentDelegate.swift index df91618204..cc0d2ffa73 100644 --- a/Signal/src/ViewControllers/ConversationView/CV/CVComponentDelegate.swift +++ b/Signal/src/ViewControllers/ConversationView/CV/CVComponentDelegate.swift @@ -3,109 +3,107 @@ // SPDX-License-Identifier: AGPL-3.0-only // -import Foundation +import SignalUI -@objc public enum CVAttachmentTapAction: Int { case handledByDelegate case `default` } -// TODO: can remove the cvc_ prefix, was necessary when this was @objc public protocol CVComponentDelegate: AnyObject { - func cvc_enqueueReload() + func enqueueReload() - func cvc_enqueueReloadWithoutCaches() + func enqueueReloadWithoutCaches() // MARK: - Body Text Items - func cvc_didTapBodyTextItem(_ item: CVTextLabel.Item) + func didTapBodyTextItem(_ item: CVTextLabel.Item) - func cvc_didLongPressBodyTextItem(_ item: CVTextLabel.Item) + func didLongPressBodyTextItem(_ item: CVTextLabel.Item) // MARK: - System Message Items - func cvc_didTapSystemMessageItem(_ item: CVTextLabel.Item) + func didTapSystemMessageItem(_ item: CVTextLabel.Item) // MARK: - Long Press - func cvc_didLongPressTextViewItem(_ cell: CVCell, - itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool) + func didLongPressTextViewItem(_ cell: CVCell, + itemViewModel: CVItemViewModelImpl, + shouldAllowReply: Bool) - func cvc_didLongPressMediaViewItem(_ cell: CVCell, - itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool) + func didLongPressMediaViewItem(_ cell: CVCell, + itemViewModel: CVItemViewModelImpl, + shouldAllowReply: Bool) - func cvc_didLongPressQuote(_ cell: CVCell, - itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool) + func didLongPressQuote(_ cell: CVCell, + itemViewModel: CVItemViewModelImpl, + shouldAllowReply: Bool) - func cvc_didLongPressSystemMessage(_ cell: CVCell, - itemViewModel: CVItemViewModelImpl) + func didLongPressSystemMessage(_ cell: CVCell, + itemViewModel: CVItemViewModelImpl) - func cvc_didLongPressSticker(_ cell: CVCell, - itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool) + func didLongPressSticker(_ cell: CVCell, + itemViewModel: CVItemViewModelImpl, + shouldAllowReply: Bool) - func cvc_didChangeLongpress(_ itemViewModel: CVItemViewModelImpl) + func didChangeLongPress(_ itemViewModel: CVItemViewModelImpl) - func cvc_didEndLongpress(_ itemViewModel: CVItemViewModelImpl) + func didEndLongPress(_ itemViewModel: CVItemViewModelImpl) - func cvc_didCancelLongpress(_ itemViewModel: CVItemViewModelImpl) + func didCancelLongPress(_ itemViewModel: CVItemViewModelImpl) // MARK: - - func cvc_didTapReplyToItem(_ itemViewModel: CVItemViewModelImpl) + func didTapReplyToItem(_ itemViewModel: CVItemViewModelImpl) - func cvc_didTapSenderAvatar(_ interaction: TSInteraction) + func didTapSenderAvatar(_ interaction: TSInteraction) - func cvc_shouldAllowReplyForItem(_ itemViewModel: CVItemViewModelImpl) -> Bool + func shouldAllowReplyForItem(_ itemViewModel: CVItemViewModelImpl) -> Bool - func cvc_didTapReactions(reactionState: InteractionReactionState, - message: TSMessage) + func didTapReactions(reactionState: InteractionReactionState, + message: TSMessage) - var cvc_hasPendingMessageRequest: Bool { get } + var hasPendingMessageRequest: Bool { get } - func cvc_didTapTruncatedTextMessage(_ itemViewModel: CVItemViewModelImpl) + func didTapTruncatedTextMessage(_ itemViewModel: CVItemViewModelImpl) - func cvc_didTapFailedOrPendingDownloads(_ message: TSMessage) + func didTapFailedOrPendingDownloads(_ message: TSMessage) - func cvc_didTapBrokenVideo() + func didTapBrokenVideo() // MARK: - Messages - func cvc_didTapBodyMedia(itemViewModel: CVItemViewModelImpl, - attachmentStream: TSAttachmentStream, - imageView: UIView) + func didTapBodyMedia(itemViewModel: CVItemViewModelImpl, + attachmentStream: TSAttachmentStream, + imageView: UIView) - func cvc_didTapGenericAttachment(_ attachment: CVComponentGenericAttachment) -> CVAttachmentTapAction + func didTapGenericAttachment(_ attachment: CVComponentGenericAttachment) -> CVAttachmentTapAction - func cvc_didTapQuotedReply(_ quotedReply: OWSQuotedReplyModel) + func didTapQuotedReply(_ quotedReply: OWSQuotedReplyModel) - func cvc_didTapLinkPreview(_ linkPreview: OWSLinkPreview) + func didTapLinkPreview(_ linkPreview: OWSLinkPreview) - func cvc_didTapContactShare(_ contactShare: ContactShareViewModel) + func didTapContactShare(_ contactShare: ContactShareViewModel) - func cvc_didTapSendMessage(toContactShare contactShare: ContactShareViewModel) + func didTapSendMessage(toContactShare contactShare: ContactShareViewModel) - func cvc_didTapSendInvite(toContactShare contactShare: ContactShareViewModel) + func didTapSendInvite(toContactShare contactShare: ContactShareViewModel) - func cvc_didTapAddToContacts(contactShare: ContactShareViewModel) + func didTapAddToContacts(contactShare: ContactShareViewModel) - func cvc_didTapStickerPack(_ stickerPackInfo: StickerPackInfo) + func didTapStickerPack(_ stickerPackInfo: StickerPackInfo) - func cvc_didTapGroupInviteLink(url: URL) + func didTapGroupInviteLink(url: URL) - func cvc_didTapProxyLink(url: URL) + func didTapProxyLink(url: URL) - func cvc_didTapShowMessageDetail(_ itemViewModel: CVItemViewModelImpl) + func didTapShowMessageDetail(_ itemViewModel: CVItemViewModelImpl) - func cvc_prepareMessageDetailForInteractivePresentation(_ itemViewModel: CVItemViewModelImpl) + func prepareMessageDetailForInteractivePresentation(_ itemViewModel: CVItemViewModelImpl) typealias EndCellAnimation = () -> Void - func cvc_beginCellAnimation(maximumDuration: TimeInterval) -> EndCellAnimation + func beginCellAnimation(maximumDuration: TimeInterval) -> EndCellAnimation var view: UIView! { get } @@ -125,7 +123,7 @@ public protocol CVComponentDelegate: AnyObject { /// /// - Parameter messageUniqueId: The gift's TSMessage's uniqueId. /// - Returns: Whether or not the gift should be wrapped. - func cvc_willWrapGift(_ messageUniqueId: String) -> Bool + func willWrapGift(_ messageUniqueId: String) -> Bool /// Invoked just before a gift is shaken. /// @@ -134,13 +132,13 @@ public protocol CVComponentDelegate: AnyObject { /// /// - Parameter messageUniqueId: The gift's TSMessage's uniqueId. /// - Returns: Whether or not the gift should be shaken. - func cvc_willShakeGift(_ messageUniqueId: String) -> Bool + func willShakeGift(_ messageUniqueId: String) -> Bool /// Invoked just before a gift is unwrapped. - func cvc_willUnwrapGift(_ itemViewModel: CVItemViewModelImpl) + func willUnwrapGift(_ itemViewModel: CVItemViewModelImpl) /// Invoked when the button on a gift is tapped. - func cvc_didTapGiftBadge(_ itemViewModel: CVItemViewModelImpl, profileBadge: ProfileBadge, isExpired: Bool, isRedeemed: Bool) + func didTapGiftBadge(_ itemViewModel: CVItemViewModelImpl, profileBadge: ProfileBadge, isExpired: Bool, isRedeemed: Bool) // MARK: - Selection @@ -148,62 +146,62 @@ public protocol CVComponentDelegate: AnyObject { // MARK: - System Cell - func cvc_didTapPreviouslyVerifiedIdentityChange(_ address: SignalServiceAddress) + func didTapPreviouslyVerifiedIdentityChange(_ address: SignalServiceAddress) - func cvc_didTapUnverifiedIdentityChange(_ address: SignalServiceAddress) + func didTapUnverifiedIdentityChange(_ address: SignalServiceAddress) - func cvc_didTapInvalidIdentityKeyErrorMessage(_ message: TSInvalidIdentityKeyErrorMessage) + func didTapInvalidIdentityKeyErrorMessage(_ message: TSInvalidIdentityKeyErrorMessage) - func cvc_didTapCorruptedMessage(_ message: TSErrorMessage) + func didTapCorruptedMessage(_ message: TSErrorMessage) - func cvc_didTapSessionRefreshMessage(_ message: TSErrorMessage) + func didTapSessionRefreshMessage(_ message: TSErrorMessage) // See: resendGroupUpdate - func cvc_didTapResendGroupUpdateForErrorMessage(_ errorMessage: TSErrorMessage) + func didTapResendGroupUpdateForErrorMessage(_ errorMessage: TSErrorMessage) - func cvc_didTapShowFingerprint(_ address: SignalServiceAddress) + func didTapShowFingerprint(_ address: SignalServiceAddress) - func cvc_didTapIndividualCall(_ call: TSCall) + func didTapIndividualCall(_ call: TSCall) - func cvc_didTapGroupCall() + func didTapGroupCall() - func cvc_didTapPendingOutgoingMessage(_ message: TSOutgoingMessage) + func didTapPendingOutgoingMessage(_ message: TSOutgoingMessage) - func cvc_didTapFailedOutgoingMessage(_ message: TSOutgoingMessage) + func didTapFailedOutgoingMessage(_ message: TSOutgoingMessage) - func cvc_didTapShowGroupMigrationLearnMoreActionSheet(infoMessage: TSInfoMessage, - oldGroupModel: TSGroupModel, - newGroupModel: TSGroupModel) + func didTapShowGroupMigrationLearnMoreActionSheet(infoMessage: TSInfoMessage, + oldGroupModel: TSGroupModel, + newGroupModel: TSGroupModel) - func cvc_didTapGroupInviteLinkPromotion(groupModel: TSGroupModel) + func didTapGroupInviteLinkPromotion(groupModel: TSGroupModel) - func cvc_didTapViewGroupDescription(groupModel: TSGroupModel?) + func didTapViewGroupDescription(groupModel: TSGroupModel?) - func cvc_didTapShowConversationSettings() + func didTapShowConversationSettings() - func cvc_didTapShowConversationSettingsAndShowMemberRequests() + func didTapShowConversationSettingsAndShowMemberRequests() - func cvc_didTapBlockRequest( + func didTapBlockRequest( groupModel: TSGroupModelV2, requesterName: String, requesterUuid: UUID ) - func cvc_didTapShowUpgradeAppUI() + func didTapShowUpgradeAppUI() - func cvc_didTapUpdateSystemContact(_ address: SignalServiceAddress, - newNameComponents: PersonNameComponents) - func cvc_didTapPhoneNumberChange(uuid: UUID, - phoneNumberOld: String, - phoneNumberNew: String) + func didTapUpdateSystemContact(_ address: SignalServiceAddress, + newNameComponents: PersonNameComponents) + func didTapPhoneNumberChange(uuid: UUID, + phoneNumberOld: String, + phoneNumberNew: String) - func cvc_didTapViewOnceAttachment(_ interaction: TSInteraction) + func didTapViewOnceAttachment(_ interaction: TSInteraction) - func cvc_didTapViewOnceExpired(_ interaction: TSInteraction) + func didTapViewOnceExpired(_ interaction: TSInteraction) - func cvc_didTapUnknownThreadWarningGroup() - func cvc_didTapUnknownThreadWarningContact() - func cvc_didTapDeliveryIssueWarning(_ message: TSErrorMessage) + func didTapUnknownThreadWarningGroup() + func didTapUnknownThreadWarningContact() + func didTapDeliveryIssueWarning(_ message: TSErrorMessage) } // MARK: - @@ -219,96 +217,85 @@ struct CVMessageAction: Equatable { enum Action: Equatable { case none - case cvc_didTapPreviouslyVerifiedIdentityChange(address: SignalServiceAddress) - case cvc_didTapUnverifiedIdentityChange(address: SignalServiceAddress) - case cvc_didTapInvalidIdentityKeyErrorMessage(errorMessage: TSInvalidIdentityKeyErrorMessage) - case cvc_didTapCorruptedMessage(errorMessage: TSErrorMessage) - case cvc_didTapSessionRefreshMessage(errorMessage: TSErrorMessage) - case cvc_didTapResendGroupUpdate(errorMessage: TSErrorMessage) - case cvc_didTapShowGroupMigrationLearnMoreActionSheet(infoMessage: TSInfoMessage, - oldGroupModel: TSGroupModel, - newGroupModel: TSGroupModel) - case cvc_didTapViewGroupDescription(groupModel: TSGroupModel?) - case cvc_didTapGroupInviteLinkPromotion(groupModel: TSGroupModel) - case cvc_didTapShowConversationSettingsAndShowMemberRequests - case cvc_didTapBlockRequest( - groupModel: TSGroupModelV2, - requesterName: String, - requesterUuid: UUID + case didTapPreviouslyVerifiedIdentityChange(address: SignalServiceAddress) + case didTapUnverifiedIdentityChange(address: SignalServiceAddress) + case didTapInvalidIdentityKeyErrorMessage(errorMessage: TSInvalidIdentityKeyErrorMessage) + case didTapCorruptedMessage(errorMessage: TSErrorMessage) + case didTapSessionRefreshMessage(errorMessage: TSErrorMessage) + case didTapResendGroupUpdate(errorMessage: TSErrorMessage) + case didTapShowGroupMigrationLearnMoreActionSheet( + infoMessage: TSInfoMessage, + oldGroupModel: TSGroupModel, + newGroupModel: TSGroupModel ) - case cvc_didTapShowUpgradeAppUI - case cvc_didTapUpdateSystemContact(address: SignalServiceAddress, - newNameComponents: PersonNameComponents) - case cvc_didTapPhoneNumberChange(uuid: UUID, - phoneNumberOld: String, - phoneNumberNew: String) - case cvc_didTapIndividualCall(call: TSCall) - case cvc_didTapGroupCall - case cvc_didTapSendMessage(contactShare: ContactShareViewModel) - case cvc_didTapSendInvite(contactShare: ContactShareViewModel) - case cvc_didTapAddToContacts(contactShare: ContactShareViewModel) - case cvc_didTapUnknownThreadWarningGroup - case cvc_didTapUnknownThreadWarningContact - case cvc_didTapDeliveryIssueWarning(errorMessage: TSErrorMessage) + case didTapViewGroupDescription(groupModel: TSGroupModel?) + case didTapGroupInviteLinkPromotion(groupModel: TSGroupModel) + case didTapShowConversationSettingsAndShowMemberRequests + case didTapBlockRequest(groupModel: TSGroupModelV2, requesterName: String, requesterUuid: UUID) + case didTapShowUpgradeAppUI + case didTapUpdateSystemContact(address: SignalServiceAddress, newNameComponents: PersonNameComponents) + case didTapPhoneNumberChange(uuid: UUID, phoneNumberOld: String, phoneNumberNew: String) + case didTapIndividualCall(call: TSCall) + case didTapGroupCall + case didTapSendMessage(contactShare: ContactShareViewModel) + case didTapSendInvite(contactShare: ContactShareViewModel) + case didTapAddToContacts(contactShare: ContactShareViewModel) + case didTapUnknownThreadWarningGroup + case didTapUnknownThreadWarningContact + case didTapDeliveryIssueWarning(errorMessage: TSErrorMessage) func perform(delegate: CVComponentDelegate) { switch self { case .none: break - case .cvc_didTapPreviouslyVerifiedIdentityChange(let address): - delegate.cvc_didTapPreviouslyVerifiedIdentityChange(address) - case .cvc_didTapUnverifiedIdentityChange(let address): - delegate.cvc_didTapUnverifiedIdentityChange(address) - case .cvc_didTapInvalidIdentityKeyErrorMessage(let errorMessage): - delegate.cvc_didTapInvalidIdentityKeyErrorMessage(errorMessage) - case .cvc_didTapCorruptedMessage(let errorMessage): - delegate.cvc_didTapCorruptedMessage(errorMessage) - case .cvc_didTapSessionRefreshMessage(let errorMessage): - delegate.cvc_didTapSessionRefreshMessage(errorMessage) - case .cvc_didTapResendGroupUpdate(let errorMessage): - delegate.cvc_didTapResendGroupUpdateForErrorMessage(errorMessage) - case .cvc_didTapShowGroupMigrationLearnMoreActionSheet(let infoMessage, - let oldGroupModel, - let newGroupModel): - delegate.cvc_didTapShowGroupMigrationLearnMoreActionSheet(infoMessage: infoMessage, - oldGroupModel: oldGroupModel, - newGroupModel: newGroupModel) - case .cvc_didTapViewGroupDescription(let groupModel): - delegate.cvc_didTapViewGroupDescription(groupModel: groupModel) - case .cvc_didTapGroupInviteLinkPromotion(let groupModel): - delegate.cvc_didTapGroupInviteLinkPromotion(groupModel: groupModel) - case .cvc_didTapShowConversationSettingsAndShowMemberRequests: - delegate.cvc_didTapShowConversationSettingsAndShowMemberRequests() - case .cvc_didTapBlockRequest(let groupModel, let requesterName, let requesterUuid): - delegate.cvc_didTapBlockRequest( - groupModel: groupModel, - requesterName: requesterName, - requesterUuid: requesterUuid + case .didTapPreviouslyVerifiedIdentityChange(let address): + delegate.didTapPreviouslyVerifiedIdentityChange(address) + case .didTapUnverifiedIdentityChange(let address): + delegate.didTapUnverifiedIdentityChange(address) + case .didTapInvalidIdentityKeyErrorMessage(let errorMessage): + delegate.didTapInvalidIdentityKeyErrorMessage(errorMessage) + case .didTapCorruptedMessage(let errorMessage): + delegate.didTapCorruptedMessage(errorMessage) + case .didTapSessionRefreshMessage(let errorMessage): + delegate.didTapSessionRefreshMessage(errorMessage) + case .didTapResendGroupUpdate(let errorMessage): + delegate.didTapResendGroupUpdateForErrorMessage(errorMessage) + case .didTapShowGroupMigrationLearnMoreActionSheet(let infoMessage, let oldGroupModel, let newGroupModel): + delegate.didTapShowGroupMigrationLearnMoreActionSheet( + infoMessage: infoMessage, + oldGroupModel: oldGroupModel, + newGroupModel: newGroupModel ) - case .cvc_didTapShowUpgradeAppUI: - delegate.cvc_didTapShowUpgradeAppUI() - case .cvc_didTapUpdateSystemContact(let address, let newNameComponents): - delegate.cvc_didTapUpdateSystemContact(address, newNameComponents: newNameComponents) - case .cvc_didTapPhoneNumberChange(let uuid, let phoneNumberOld, let phoneNumberNew): - delegate.cvc_didTapPhoneNumberChange(uuid: uuid, - phoneNumberOld: phoneNumberOld, - phoneNumberNew: phoneNumberNew) - case .cvc_didTapIndividualCall(let call): - delegate.cvc_didTapIndividualCall(call) - case .cvc_didTapGroupCall: - delegate.cvc_didTapGroupCall() - case .cvc_didTapSendMessage(let contactShare): - delegate.cvc_didTapSendMessage(toContactShare: contactShare) - case .cvc_didTapSendInvite(let contactShare): - delegate.cvc_didTapSendInvite(toContactShare: contactShare) - case .cvc_didTapAddToContacts(let contactShare): - delegate.cvc_didTapAddToContacts(contactShare: contactShare) - case .cvc_didTapUnknownThreadWarningGroup: - delegate.cvc_didTapUnknownThreadWarningGroup() - case .cvc_didTapUnknownThreadWarningContact: - delegate.cvc_didTapUnknownThreadWarningContact() - case .cvc_didTapDeliveryIssueWarning(let errorMessage): - delegate.cvc_didTapDeliveryIssueWarning(errorMessage) + case .didTapViewGroupDescription(let groupModel): + delegate.didTapViewGroupDescription(groupModel: groupModel) + case .didTapGroupInviteLinkPromotion(let groupModel): + delegate.didTapGroupInviteLinkPromotion(groupModel: groupModel) + case .didTapShowConversationSettingsAndShowMemberRequests: + delegate.didTapShowConversationSettingsAndShowMemberRequests() + case .didTapBlockRequest(let groupModel, let requesterName, let requesterUuid): + delegate.didTapBlockRequest(groupModel: groupModel, requesterName: requesterName, requesterUuid: requesterUuid) + case .didTapShowUpgradeAppUI: + delegate.didTapShowUpgradeAppUI() + case .didTapUpdateSystemContact(let address, let newNameComponents): + delegate.didTapUpdateSystemContact(address, newNameComponents: newNameComponents) + case .didTapPhoneNumberChange(let uuid, let phoneNumberOld, let phoneNumberNew): + delegate.didTapPhoneNumberChange(uuid: uuid, phoneNumberOld: phoneNumberOld, phoneNumberNew: phoneNumberNew) + case .didTapIndividualCall(let call): + delegate.didTapIndividualCall(call) + case .didTapGroupCall: + delegate.didTapGroupCall() + case .didTapSendMessage(let contactShare): + delegate.didTapSendMessage(toContactShare: contactShare) + case .didTapSendInvite(let contactShare): + delegate.didTapSendInvite(toContactShare: contactShare) + case .didTapAddToContacts(let contactShare): + delegate.didTapAddToContacts(contactShare: contactShare) + case .didTapUnknownThreadWarningGroup: + delegate.didTapUnknownThreadWarningGroup() + case .didTapUnknownThreadWarningContact: + delegate.didTapUnknownThreadWarningContact() + case .didTapDeliveryIssueWarning(let errorMessage): + delegate.didTapDeliveryIssueWarning(errorMessage) } } } diff --git a/Signal/src/ViewControllers/ConversationView/CV/CVComponentState.swift b/Signal/src/ViewControllers/ConversationView/CV/CVComponentState.swift index 53d09c5ee4..926696c05c 100644 --- a/Signal/src/ViewControllers/ConversationView/CV/CVComponentState.swift +++ b/Signal/src/ViewControllers/ConversationView/CV/CVComponentState.swift @@ -953,19 +953,19 @@ fileprivate extension CVComponentState.Builder { if hasSendTextButton { let action = CVMessageAction(title: CommonStrings.sendMessage, accessibilityIdentifier: "send_message_to_contact_share", - action: .cvc_didTapSendMessage(contactShare: contactShare)) + action: .didTapSendMessage(contactShare: contactShare)) bottomButtonsActions.append(action) } else if hasInviteButton { let action = CVMessageAction(title: NSLocalizedString("ACTION_INVITE", comment: "Label for 'invite' button in contact view."), accessibilityIdentifier: "invite_contact_share", - action: .cvc_didTapSendInvite(contactShare: contactShare)) + action: .didTapSendInvite(contactShare: contactShare)) bottomButtonsActions.append(action) } else if hasAddToContactsButton { let action = CVMessageAction(title: NSLocalizedString("CONVERSATION_VIEW_ADD_TO_CONTACTS_OFFER", comment: "Message shown in conversation view that offers to add an unknown user to your phone's contacts."), accessibilityIdentifier: "add_to_contacts", - action: .cvc_didTapAddToContacts(contactShare: contactShare)) + action: .didTapAddToContacts(contactShare: contactShare)) bottomButtonsActions.append(action) } diff --git a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentAudioAttachment.swift b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentAudioAttachment.swift index 7dc01878be..a86839be44 100644 --- a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentAudioAttachment.swift +++ b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentAudioAttachment.swift @@ -163,7 +163,7 @@ public class CVComponentAudioAttachment: CVComponentBase, CVComponent { } else if let message = interaction as? TSMessage { Logger.debug("Retrying download for message: \(message.uniqueId)") - componentDelegate.cvc_didTapFailedOrPendingDownloads(message) + componentDelegate.didTapFailedOrPendingDownloads(message) return true } else { @@ -186,7 +186,7 @@ public class CVComponentAudioAttachment: CVComponentBase, CVComponent { return nil } let itemViewModel = CVItemViewModelImpl(renderItem: renderItem) - guard componentDelegate.cvc_shouldAllowReplyForItem(itemViewModel) else { + guard componentDelegate.shouldAllowReplyForItem(itemViewModel) else { return nil } guard nil != attachmentStream else { diff --git a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentBodyMedia.swift b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentBodyMedia.swift index cf7f4a5760..a3120e5fb0 100644 --- a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentBodyMedia.swift +++ b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentBodyMedia.swift @@ -3,8 +3,8 @@ // SPDX-License-Identifier: AGPL-3.0-only // -import Foundation import SignalMessaging +import SignalUI public class CVComponentBodyMedia: CVComponentBase, CVComponent { @@ -317,7 +317,7 @@ public class CVComponentBodyMedia: CVComponentBase, CVComponent { return false } if hasDownloadButton { - componentDelegate.cvc_didTapFailedOrPendingDownloads(message) + componentDelegate.didTapFailedOrPendingDownloads(message) return true } let albumView = componentView.albumView @@ -330,7 +330,7 @@ public class CVComponentBodyMedia: CVComponentBase, CVComponent { if isMoreItemsWithMediaView, mediaAlbumHasFailedAttachment { - componentDelegate.cvc_didTapFailedOrPendingDownloads(message) + componentDelegate.didTapFailedOrPendingDownloads(message) return true } @@ -338,7 +338,7 @@ public class CVComponentBodyMedia: CVComponentBase, CVComponent { if let attachmentPointer = attachment as? TSAttachmentPointer { switch attachmentPointer.state { case .failed, .pendingMessageRequest, .pendingManualDownload: - componentDelegate.cvc_didTapFailedOrPendingDownloads(message) + componentDelegate.didTapFailedOrPendingDownloads(message) return true case .enqueued, .downloading: Logger.warn("Media attachment not yet downloaded.") @@ -354,12 +354,12 @@ public class CVComponentBodyMedia: CVComponentBase, CVComponent { let itemViewModel = CVItemViewModelImpl(renderItem: renderItem) if let item = items.first(where: { $0.attachment.uniqueId == attachment.uniqueId }), item.isBroken { - componentDelegate.cvc_didTapBrokenVideo() + componentDelegate.didTapBrokenVideo() return true } - componentDelegate.cvc_didTapBodyMedia(itemViewModel: itemViewModel, - attachmentStream: attachmentStream, - imageView: mediaView) + componentDelegate.didTapBodyMedia(itemViewModel: itemViewModel, + attachmentStream: attachmentStream, + imageView: mediaView) return true } diff --git a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentBodyText.swift b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentBodyText.swift index ba4343c42f..dd1871015e 100644 --- a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentBodyText.swift +++ b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentBodyText.swift @@ -804,13 +804,13 @@ public class CVComponentBodyText: CVComponentBase, CVComponent { let bodyTextLabel = componentView.bodyTextLabel if let item = bodyTextLabel.itemForGesture(sender: sender) { - componentDelegate.cvc_didTapBodyTextItem(item) + componentDelegate.didTapBodyTextItem(item) return true } if hasTapForMore { let itemViewModel = CVItemViewModelImpl(renderItem: renderItem) - componentDelegate.cvc_didTapTruncatedTextMessage(itemViewModel) + componentDelegate.didTapTruncatedTextMessage(itemViewModel) return true } diff --git a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentContactShare.swift b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentContactShare.swift index d3f532c5ee..49a4ae7eea 100644 --- a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentContactShare.swift +++ b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentContactShare.swift @@ -52,7 +52,7 @@ public class CVComponentContactShare: CVComponentBase, CVComponent { componentView: CVComponentView, renderItem: CVRenderItem) -> Bool { - componentDelegate.cvc_didTapContactShare(contactShare) + componentDelegate.didTapContactShare(contactShare) return true } diff --git a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentFooter.swift b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentFooter.swift index 104f7fb291..f96657f69b 100644 --- a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentFooter.swift +++ b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentFooter.swift @@ -367,7 +367,7 @@ public class CVComponentFooter: CVComponentBase, CVComponent { return false } let itemViewModel = CVItemViewModelImpl(renderItem: renderItem) - componentDelegate.cvc_didTapTruncatedTextMessage(itemViewModel) + componentDelegate.didTapTruncatedTextMessage(itemViewModel) return true } diff --git a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentGenericAttachment.swift b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentGenericAttachment.swift index cd99f8c85e..6b2e94e3b9 100644 --- a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentGenericAttachment.swift +++ b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentGenericAttachment.swift @@ -286,7 +286,7 @@ public class CVComponentGenericAttachment: CVComponentBase, CVComponent { renderItem: CVRenderItem) -> Bool { if attachmentStream != nil { - switch componentDelegate.cvc_didTapGenericAttachment(self) { + switch componentDelegate.didTapGenericAttachment(self) { case .handledByDelegate: break case .default: @@ -299,7 +299,7 @@ public class CVComponentGenericAttachment: CVComponentBase, CVComponent { owsFailDebug("Invalid interaction.") return true } - componentDelegate.cvc_didTapFailedOrPendingDownloads(message) + componentDelegate.didTapFailedOrPendingDownloads(message) case .enqueued, .downloading: break default: diff --git a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentGiftBadge.swift b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentGiftBadge.swift index 502b4a71b0..c167f20f7e 100644 --- a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentGiftBadge.swift +++ b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentGiftBadge.swift @@ -112,7 +112,7 @@ public class CVComponentGiftBadge: CVComponentBase, CVComponent { let giftBadgeView = componentView.giftBadgeView if giftBadgeView.giftWrap != nil { - componentDelegate.cvc_willUnwrapGift(itemViewModel) + componentDelegate.willUnwrapGift(itemViewModel) giftBadgeView.animateUnwrap() return true } @@ -132,7 +132,7 @@ public class CVComponentGiftBadge: CVComponentBase, CVComponent { } let giftBadge = self.giftBadge - componentDelegate.cvc_didTapGiftBadge( + componentDelegate.didTapGiftBadge( itemViewModel, profileBadge: profileBadge, isExpired: giftBadge.expirationDate.isBeforeNow, @@ -162,12 +162,12 @@ public class CVComponentGiftBadge: CVComponentBase, CVComponent { let giftWrap = self.giftBadgeView.giftWrap, let componentDelegate = self.componentDelegate, let messageUniqueId = self.messageUniqueId, - componentDelegate.cvc_willShakeGift(messageUniqueId) + componentDelegate.willShakeGift(messageUniqueId) else { return } - _ = componentDelegate.cvc_beginCellAnimation(maximumDuration: GiftWrap.shakeAnimationDuration) + _ = componentDelegate.beginCellAnimation(maximumDuration: GiftWrap.shakeAnimationDuration) giftWrap.animateShake() } diff --git a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentLinkPreview.swift b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentLinkPreview.swift index 0a4fd4508f..18b91a26b2 100644 --- a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentLinkPreview.swift +++ b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentLinkPreview.swift @@ -62,7 +62,7 @@ public class CVComponentLinkPreview: CVComponentBase, CVComponent { componentView: CVComponentView, renderItem: CVRenderItem) -> Bool { - componentDelegate.cvc_didTapLinkPreview(linkPreviewState.linkPreview) + componentDelegate.didTapLinkPreview(linkPreviewState.linkPreview) return true } diff --git a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentMessage.swift b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentMessage.swift index 45accdac52..4292404540 100644 --- a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentMessage.swift +++ b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentMessage.swift @@ -1589,10 +1589,10 @@ public class CVComponentMessage: CVComponentBase, CVRootComponent { switch outgoingMessage.messageState { case .failed: // Tap to retry. - componentDelegate.cvc_didTapFailedOutgoingMessage(outgoingMessage) + componentDelegate.didTapFailedOutgoingMessage(outgoingMessage) return true case .pending: - componentDelegate.cvc_didTapPendingOutgoingMessage(outgoingMessage) + componentDelegate.didTapPendingOutgoingMessage(outgoingMessage) case .sending: // Ignore taps on outgoing messages being sent. return true @@ -1603,7 +1603,7 @@ public class CVComponentMessage: CVComponentBase, CVRootComponent { if hasSenderAvatar, componentView.avatarView.containsGestureLocation(sender) { - componentDelegate.cvc_didTapSenderAvatar(interaction) + componentDelegate.didTapSenderAvatar(interaction) return true } @@ -1623,7 +1623,7 @@ public class CVComponentMessage: CVComponentBase, CVRootComponent { if let message = interaction as? TSMessage, nil != componentState.failedOrPendingDownloads { Logger.verbose("Retrying failed downloads.") - componentDelegate.cvc_didTapFailedOrPendingDownloads(message) + componentDelegate.didTapFailedOrPendingDownloads(message) return true } @@ -2273,7 +2273,7 @@ public class CVComponentMessage: CVComponentBase, CVRootComponent { // only become active if this message allows // swipe-to-reply. let itemViewModel = CVItemViewModelImpl(renderItem: renderItem) - if componentDelegate.cvc_shouldAllowReplyForItem(itemViewModel) { + if componentDelegate.shouldAllowReplyForItem(itemViewModel) { activeDirection = .right } else { activeDirection = .none @@ -2298,7 +2298,7 @@ public class CVComponentMessage: CVComponentBase, CVRootComponent { case .left: ImpactHapticFeedback.impactOccured(style: .light) panHandler.percentDrivenTransition = UIPercentDrivenInteractiveTransition() - componentDelegate.cvc_didTapShowMessageDetail(CVItemViewModelImpl(renderItem: renderItem)) + componentDelegate.didTapShowMessageDetail(CVItemViewModelImpl(renderItem: renderItem)) case .none: panHandler.percentDrivenTransition?.cancel() panHandler.percentDrivenTransition = nil @@ -2310,7 +2310,7 @@ public class CVComponentMessage: CVComponentBase, CVRootComponent { if isStarting { // Prepare the message detail view as soon as we start doing // any gesture, we may or may not want to present it. - componentDelegate.cvc_prepareMessageDetailForInteractivePresentation(CVItemViewModelImpl(renderItem: renderItem)) + componentDelegate.prepareMessageDetailForInteractivePresentation(CVItemViewModelImpl(renderItem: renderItem)) } if isStarting || didChangeActiveDirection { @@ -2358,7 +2358,7 @@ public class CVComponentMessage: CVComponentBase, CVRootComponent { } case .right: let itemViewModel = CVItemViewModelImpl(renderItem: renderItem) - componentDelegate.cvc_didTapReplyToItem(itemViewModel) + componentDelegate.didTapReplyToItem(itemViewModel) case .none: break } diff --git a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentQuotedReply.swift b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentQuotedReply.swift index 2c48e1bf9a..1672943d00 100644 --- a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentQuotedReply.swift +++ b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentQuotedReply.swift @@ -81,7 +81,7 @@ public class CVComponentQuotedReply: CVComponentBase, CVComponent { componentView: CVComponentView, renderItem: CVRenderItem) -> Bool { - componentDelegate.cvc_didTapQuotedReply(quotedReplyModel) + componentDelegate.didTapQuotedReply(quotedReplyModel) return true } diff --git a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentReactions.swift b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentReactions.swift index 541270daad..1d69ad9cc5 100644 --- a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentReactions.swift +++ b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentReactions.swift @@ -60,7 +60,7 @@ public class CVComponentReactions: CVComponentBase, CVComponent { owsFailDebug("Invalid interaction.") return false } - componentDelegate.cvc_didTapReactions(reactionState: reactionState, message: message) + componentDelegate.didTapReactions(reactionState: reactionState, message: message) return true } diff --git a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentSticker.swift b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentSticker.swift index 84ca90d5b9..8d52b500ca 100644 --- a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentSticker.swift +++ b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentSticker.swift @@ -145,7 +145,7 @@ public class CVComponentSticker: CVComponentBase, CVComponent { // Not yet downloaded. return false } - componentDelegate.cvc_didTapStickerPack(stickerMetadata.packInfo) + componentDelegate.didTapStickerPack(stickerMetadata.packInfo) return true } diff --git a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentSystemMessage.swift b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentSystemMessage.swift index 6045eafed1..e2e26819c2 100644 --- a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentSystemMessage.swift +++ b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentSystemMessage.swift @@ -3,7 +3,6 @@ // SPDX-License-Identifier: AGPL-3.0-only // -import Foundation import SignalMessaging import SignalServiceKit @@ -467,7 +466,7 @@ public class CVComponentSystemMessage: CVComponentBase, CVRootComponent { } if let item = componentView.textLabel.itemForGesture(sender: sender) { - componentDelegate.cvc_didTapSystemMessageItem(item) + componentDelegate.didTapSystemMessageItem(item) return true } @@ -892,14 +891,14 @@ extension CVComponentSystemMessage { let action = Action(title: CommonStrings.learnMore, accessibilityIdentifier: "unknown_thread_warning", - action: .cvc_didTapUnknownThreadWarningGroup) + action: .didTapUnknownThreadWarningGroup) return buildComponentState(title: labelText, action: action) } else { let title = NSLocalizedString("SYSTEM_MESSAGE_UNKNOWN_THREAD_WARNING_CONTACT", comment: "Indicator warning about an unknown contact thread.") let action = Action(title: CommonStrings.learnMore, accessibilityIdentifier: "unknown_thread_warning", - action: .cvc_didTapUnknownThreadWarningContact) + action: .didTapUnknownThreadWarningContact) return buildComponentState(title: title.attributedString(), action: action) } } @@ -967,11 +966,11 @@ extension CVComponentSystemMessage { return Action(title: NSLocalizedString("SYSTEM_MESSAGE_ACTION_VERIFY_SAFETY_NUMBER", comment: "Label for button to verify a user's safety number."), accessibilityIdentifier: "verify_safety_number", - action: .cvc_didTapPreviouslyVerifiedIdentityChange(address: address)) + action: .didTapPreviouslyVerifiedIdentityChange(address: address)) } else { return Action(title: CommonStrings.learnMore, accessibilityIdentifier: "learn_more", - action: .cvc_didTapUnverifiedIdentityChange(address: address)) + action: .didTapUnverifiedIdentityChange(address: address)) } case .wrongTrustedIdentityKey: guard let message = message as? TSInvalidIdentityKeyErrorMessage else { @@ -981,7 +980,7 @@ extension CVComponentSystemMessage { return Action(title: NSLocalizedString("SYSTEM_MESSAGE_ACTION_VERIFY_SAFETY_NUMBER", comment: "Label for button to verify a user's safety number."), accessibilityIdentifier: "verify_safety_number", - action: .cvc_didTapInvalidIdentityKeyErrorMessage(errorMessage: message)) + action: .didTapInvalidIdentityKeyErrorMessage(errorMessage: message)) case .invalidKeyException, .missingKeyId, .noSession, @@ -989,15 +988,15 @@ extension CVComponentSystemMessage { return Action(title: NSLocalizedString("FINGERPRINT_SHRED_KEYMATERIAL_BUTTON", comment: "Label for button to reset a session."), accessibilityIdentifier: "reset_session", - action: .cvc_didTapCorruptedMessage(errorMessage: message)) + action: .didTapCorruptedMessage(errorMessage: message)) case .sessionRefresh: return Action(title: CommonStrings.learnMore, accessibilityIdentifier: "learn_more", - action: .cvc_didTapSessionRefreshMessage(errorMessage: message)) + action: .didTapSessionRefreshMessage(errorMessage: message)) case .decryptionFailure: return Action(title: CommonStrings.learnMore, accessibilityIdentifier: "learn_more", - action: .cvc_didTapDeliveryIssueWarning(errorMessage: message)) + action: .didTapDeliveryIssueWarning(errorMessage: message)) case .duplicateMessage, .invalidVersion: return nil @@ -1007,7 +1006,7 @@ extension CVComponentSystemMessage { case .groupCreationFailed: return Action(title: CommonStrings.retryButton, accessibilityIdentifier: "retry_send_group", - action: .cvc_didTapResendGroupUpdate(errorMessage: message)) + action: .didTapResendGroupUpdate(errorMessage: message)) } } @@ -1041,7 +1040,7 @@ extension CVComponentSystemMessage { return Action(title: NSLocalizedString("GROUPS_INVITE_FRIENDS_BUTTON", comment: "Label for 'invite friends to group' button."), accessibilityIdentifier: "group_invite_friends", - action: .cvc_didTapGroupInviteLinkPromotion(groupModel: newGroupModel)) + action: .didTapGroupInviteLinkPromotion(groupModel: newGroupModel)) } guard let oldGroupModel = infoMessage.oldGroupModel else { return nil @@ -1058,7 +1057,7 @@ extension CVComponentSystemMessage { return Action( title: CommonStrings.learnMore, accessibilityIdentifier: "group_migration_learn_more", - action: .cvc_didTapShowGroupMigrationLearnMoreActionSheet( + action: .didTapShowGroupMigrationLearnMoreActionSheet( infoMessage: infoMessage, oldGroupModel: oldGroupModel, newGroupModel: newGroupModel @@ -1068,7 +1067,7 @@ extension CVComponentSystemMessage { return Action( title: CommonStrings.viewButton, accessibilityIdentifier: "group_description_view", - action: .cvc_didTapViewGroupDescription(groupModel: newGroupModel) + action: .didTapViewGroupDescription(groupModel: newGroupModel) ) default: break @@ -1115,7 +1114,7 @@ extension CVComponentSystemMessage { comment: "Label for button that lets the user block a request to join the group." ), accessibilityIdentifier: "block_join_request_button", - action: .cvc_didTapBlockRequest( + action: .didTapBlockRequest( groupModel: mostRecentGroupModel, requesterName: contactsManager.shortDisplayName( for: requesterAddress, @@ -1141,7 +1140,7 @@ extension CVComponentSystemMessage { return Action( title: title, accessibilityIdentifier: "show_group_requests_button", - action: .cvc_didTapShowConversationSettingsAndShowMemberRequests + action: .didTapShowConversationSettingsAndShowMemberRequests ) } case .typeGroupQuit: @@ -1157,7 +1156,7 @@ extension CVComponentSystemMessage { return Action(title: NSLocalizedString("UNKNOWN_PROTOCOL_VERSION_UPGRADE_BUTTON", comment: "Label for button that lets users upgrade the app."), accessibilityIdentifier: "show_upgrade_app_ui", - action: .cvc_didTapShowUpgradeAppUI) + action: .didTapShowUpgradeAppUI) case .typeDisappearingMessagesUpdate, .verificationStateChange, .userJoinedSignal, @@ -1195,14 +1194,14 @@ extension CVComponentSystemMessage { return Action(title: NSLocalizedString("UPDATE_CONTACT_ACTION", comment: "Action sheet item"), accessibilityIdentifier: "update_contact", - action: .cvc_didTapUpdateSystemContact(address: profileChangeAddress, - newNameComponents: profileChangeNewNameComponents)) + action: .didTapUpdateSystemContact(address: profileChangeAddress, + newNameComponents: profileChangeNewNameComponents)) case .phoneNumberChange: guard let uuidString = infoMessage.infoMessageUserInfo?[.changePhoneNumberUuid] as? String, let uuid = UUID(uuidString: uuidString), let phoneNumberOld = infoMessage.infoMessageUserInfo?[.changePhoneNumberOld] as? String, - let phoneNumberNew = infoMessage.infoMessageUserInfo?[.changePhoneNumberNew] as? String else { + let phoneNumberNew = infoMessage.infoMessageUserInfo?[.changePhoneNumberNew] as? String else { owsFailDebug("Invalid info message.") return nil } @@ -1219,9 +1218,9 @@ extension CVComponentSystemMessage { return Action(title: NSLocalizedString("UPDATE_CONTACT_ACTION", comment: "Action sheet item"), accessibilityIdentifier: "update_contact", - action: .cvc_didTapPhoneNumberChange(uuid: uuid, - phoneNumberOld: phoneNumberOld, - phoneNumberNew: phoneNumberNew)) + action: .didTapPhoneNumberChange(uuid: uuid, + phoneNumberOld: phoneNumberOld, + phoneNumberNew: phoneNumberNew)) } } @@ -1250,7 +1249,7 @@ extension CVComponentSystemMessage { // TODO: cvc_didTapGroupCall? return Action(title: NSLocalizedString("CALLBACK_BUTTON_TITLE", comment: "notification action"), accessibilityIdentifier: "call_back", - action: .cvc_didTapIndividualCall(call: call)) + action: .didTapIndividualCall(call: call)) case .outgoing, .outgoingMissed: guard !hasPendingMessageRequest() else { @@ -1260,7 +1259,7 @@ extension CVComponentSystemMessage { return Action(title: NSLocalizedString("CALL_AGAIN_BUTTON_TITLE", comment: "Label for button that lets users call a contact again."), accessibilityIdentifier: "call_again", - action: .cvc_didTapIndividualCall(call: call)) + action: .didTapIndividualCall(call: call)) case .outgoingIncomplete, .incomingIncomplete: return nil @@ -1293,6 +1292,6 @@ extension CVComponentSystemMessage { return Action(title: title, accessibilityIdentifier: "group_call_button", - action: .cvc_didTapGroupCall) + action: .didTapGroupCall) } } diff --git a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentViewOnce.swift b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentViewOnce.swift index d5a0ebfbd9..39c7195e20 100644 --- a/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentViewOnce.swift +++ b/Signal/src/ViewControllers/ConversationView/CV/CVComponents/CVComponentViewOnce.swift @@ -180,11 +180,11 @@ public class CVComponentViewOnce: CVComponentBase, CVComponent { .incomingInvalidContent: break case .incomingFailed, .incomingPending: - componentDelegate.cvc_didTapFailedOrPendingDownloads(message) + componentDelegate.didTapFailedOrPendingDownloads(message) case .incomingAvailable: - componentDelegate.cvc_didTapViewOnceAttachment(message) + componentDelegate.didTapViewOnceAttachment(message) case .incomingExpired, .outgoingSentExpired: - componentDelegate.cvc_didTapViewOnceExpired(message) + componentDelegate.didTapViewOnceExpired(message) case .outgoingFailed, .outgoingSending: break diff --git a/Signal/src/ViewControllers/ConversationView/Cells/AudioMessagePlaybackRateView.swift b/Signal/src/ViewControllers/ConversationView/Cells/AudioMessagePlaybackRateView.swift index de816d7de6..6ecd05a707 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/AudioMessagePlaybackRateView.swift +++ b/Signal/src/ViewControllers/ConversationView/Cells/AudioMessagePlaybackRateView.swift @@ -230,7 +230,7 @@ class AudioMessagePlaybackRateView: ManualLayoutViewWithLayer { self.cvAudioPlayer.setPlaybackRate(newPlaybackRate.rawValue, forThreadUniqueId: threadUniqueId) // Hold off updates until we animate the change. - let animationCompletion = componentDelegate?.cvc_beginCellAnimation( + let animationCompletion = componentDelegate?.beginCellAnimation( maximumDuration: Constants.maxAnimationDuration ) @@ -264,7 +264,7 @@ class AudioMessagePlaybackRateView: ManualLayoutViewWithLayer { // to reload only ThreadAssociatedData without a heavy refactor. // This only happens on direct user input, anyway, so its probably not a // big deal since it therefore only happens on human timescales. - componentDelegate?.cvc_enqueueReloadWithoutCaches() + componentDelegate?.enqueueReloadWithoutCaches() } return true diff --git a/Signal/src/ViewControllers/ConversationView/Cells/AudioMessageView.swift b/Signal/src/ViewControllers/ConversationView/Cells/AudioMessageView.swift index 41b6a4932d..2f916ac65a 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/AudioMessageView.swift +++ b/Signal/src/ViewControllers/ConversationView/Cells/AudioMessageView.swift @@ -512,7 +512,7 @@ class AudioMessageView: ManualStackView { if animated { playPauseAnimationEnd?() - let endCellAnimation = componentDelegate?.cvc_beginCellAnimation(maximumDuration: 0.2) + let endCellAnimation = componentDelegate?.beginCellAnimation(maximumDuration: 0.2) playPauseAnimationEnd = endCellAnimation playPauseAnimation.play(toProgress: destination) { _ in endCellAnimation?() @@ -584,7 +584,7 @@ class AudioMessageView: ManualStackView { if animated { playedDotAnimationEnd?() - let endCellAnimation = componentDelegate?.cvc_beginCellAnimation(maximumDuration: 0.2) + let endCellAnimation = componentDelegate?.beginCellAnimation(maximumDuration: 0.2) playedDotAnimationEnd = endCellAnimation playedDotAnimation.play(toProgress: destination) { _ in endCellAnimation?() diff --git a/Signal/src/ViewControllers/ConversationView/Cells/GiftBadgeView.swift b/Signal/src/ViewControllers/ConversationView/Cells/GiftBadgeView.swift index dd6e4f8d2d..24e181a30b 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/GiftBadgeView.swift +++ b/Signal/src/ViewControllers/ConversationView/Cells/GiftBadgeView.swift @@ -257,7 +257,7 @@ class GiftBadgeView: ManualStackView { switch state.badge { case .notLoaded(let loadPromise): loadPromise().done { [weak componentDelegate] in - componentDelegate?.cvc_enqueueReload() + componentDelegate?.enqueueReload() }.cauterize() // TODO: (GB) If an error occurs, we'll be stuck with a spinner. @@ -300,7 +300,7 @@ class GiftBadgeView: ManualStackView { subviews: [self.innerStack, self.buttonStack] ) - if state.wrapState == .unwrapped || !componentDelegate.cvc_willWrapGift(state.messageUniqueId) { + if state.wrapState == .unwrapped || !componentDelegate.willWrapGift(state.messageUniqueId) { self.giftWrap = nil } else if self.giftWrap?.isIncoming != state.isIncoming { // If `giftWrap` is nil, we'll also fall into this case. diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController+BodyTextItems.swift b/Signal/src/ViewControllers/ConversationView/ConversationViewController+BodyTextItems.swift index 0c082503ba..7e1ab61c28 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController+BodyTextItems.swift +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController+BodyTextItems.swift @@ -7,6 +7,8 @@ import Foundation import MessageUI import SignalCoreKit import SignalMessaging +import SignalServiceKit +import SignalUI // This extension reproduces some of the UITextView link interaction behavior. // This is how UITextView behaves: @@ -138,7 +140,7 @@ extension ConversationViewController { comment: "Label for button to open a sticker pack."), accessibilityIdentifier: "link_open_sticker_pack", style: .default) { [weak self] _ in - self?.cvc_didTapStickerPack(stickerPackInfo) + self?.didTapStickerPack(stickerPackInfo) }) } else { owsFailDebug("Invalid URL: \(dataItem.url)") @@ -148,14 +150,14 @@ extension ConversationViewController { comment: "Label for button to open a group invite."), accessibilityIdentifier: "link_open_group_invite", style: .default) { [weak self] _ in - self?.cvc_didTapGroupInviteLink(url: dataItem.url) + self?.didTapGroupInviteLink(url: dataItem.url) }) } else if SignalProxy.isValidProxyLink(dataItem.url) { actionSheet.addAction(ActionSheetAction(title: NSLocalizedString("MESSAGE_ACTION_LINK_OPEN_PROXY", comment: "Label for button to open a signal proxy."), accessibilityIdentifier: "link_open_proxy", style: .default) { [weak self] _ in - self?.cvc_didTapProxyLink(url: dataItem.url) + self?.didTapProxyLink(url: dataItem.url) }) } else { actionSheet.addAction(ActionSheetAction(title: NSLocalizedString("MESSAGE_ACTION_LINK_OPEN_LINK", @@ -323,11 +325,11 @@ extension ConversationViewController { owsFailDebug("Invalid URL: \(dataItem.url)") return } - cvc_didTapStickerPack(stickerPackInfo) + didTapStickerPack(stickerPackInfo) } else if GroupManager.isPossibleGroupInviteLink(dataItem.url) { - cvc_didTapGroupInviteLink(url: dataItem.url) + didTapGroupInviteLink(url: dataItem.url) } else if SignalProxy.isValidProxyLink(dataItem.url) { - cvc_didTapProxyLink(url: dataItem.url) + didTapProxyLink(url: dataItem.url) } else if SignalMe.isPossibleUrl(dataItem.url) { cvc_didTapSignalMeLink(url: dataItem.url) } else if isMailtoUrl(dataItem.url) { diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController+CVComponentDelegate.swift b/Signal/src/ViewControllers/ConversationView/ConversationViewController+CVComponentDelegate.swift index 74101acfba..b261e089cf 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController+CVComponentDelegate.swift +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController+CVComponentDelegate.swift @@ -3,11 +3,11 @@ // SPDX-License-Identifier: AGPL-3.0-only // -import Foundation import PassKit import QuickLook import SignalMessaging import SignalServiceKit +import SignalUI extension ConversationViewController: CVComponentDelegate { @@ -17,37 +17,19 @@ extension ConversationViewController: CVComponentDelegate { public var wallpaperBlurProvider: WallpaperBlurProvider? { backgroundContainer } - public func cvc_enqueueReload() { + public func enqueueReload() { self.loadCoordinator.enqueueReload() } - public func cvc_enqueueReloadWithoutCaches() { + public func enqueueReloadWithoutCaches() { self.loadCoordinator.enqueueReloadWithoutCaches() } - // MARK: - Body Text Items - - public func cvc_didTapBodyTextItem(_ item: CVTextLabel.Item) { - AssertIsOnMainThread() - - didTapBodyTextItem(item) - } - - public func cvc_didLongPressBodyTextItem(_ item: CVTextLabel.Item) { - didLongPressBodyTextItem(item) - } - - // MARK: - System Message Items - - public func cvc_didTapSystemMessageItem(_ item: CVTextLabel.Item) { - didTapSystemMessageItem(item) - } - // MARK: - Long Press - public func cvc_didLongPressTextViewItem(_ cell: CVCell, - itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool) { + public func didLongPressTextViewItem(_ cell: CVCell, + itemViewModel: CVItemViewModelImpl, + shouldAllowReply: Bool) { AssertIsOnMainThread() let messageActions = MessageActions.textActions(itemViewModel: itemViewModel, @@ -56,9 +38,9 @@ extension ConversationViewController: CVComponentDelegate { self.presentContextMenu(with: messageActions, focusedOn: cell, andModel: itemViewModel) } - public func cvc_didLongPressMediaViewItem(_ cell: CVCell, - itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool) { + public func didLongPressMediaViewItem(_ cell: CVCell, + itemViewModel: CVItemViewModelImpl, + shouldAllowReply: Bool) { AssertIsOnMainThread() let messageActions = MessageActions.mediaActions(itemViewModel: itemViewModel, @@ -67,9 +49,9 @@ extension ConversationViewController: CVComponentDelegate { self.presentContextMenu(with: messageActions, focusedOn: cell, andModel: itemViewModel) } - public func cvc_didLongPressQuote(_ cell: CVCell, - itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool) { + public func didLongPressQuote(_ cell: CVCell, + itemViewModel: CVItemViewModelImpl, + shouldAllowReply: Bool) { AssertIsOnMainThread() let messageActions = MessageActions.quotedMessageActions(itemViewModel: itemViewModel, @@ -78,8 +60,8 @@ extension ConversationViewController: CVComponentDelegate { self.presentContextMenu(with: messageActions, focusedOn: cell, andModel: itemViewModel) } - public func cvc_didLongPressSystemMessage(_ cell: CVCell, - itemViewModel: CVItemViewModelImpl) { + public func didLongPressSystemMessage(_ cell: CVCell, + itemViewModel: CVItemViewModelImpl) { AssertIsOnMainThread() let messageActions = MessageActions.infoMessageActions(itemViewModel: itemViewModel, @@ -87,9 +69,9 @@ extension ConversationViewController: CVComponentDelegate { self.presentContextMenu(with: messageActions, focusedOn: cell, andModel: itemViewModel) } - public func cvc_didLongPressSticker(_ cell: CVCell, - itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool) { + public func didLongPressSticker(_ cell: CVCell, + itemViewModel: CVItemViewModelImpl, + shouldAllowReply: Bool) { AssertIsOnMainThread() let messageActions = MessageActions.mediaActions(itemViewModel: itemViewModel, @@ -98,19 +80,19 @@ extension ConversationViewController: CVComponentDelegate { self.presentContextMenu(with: messageActions, focusedOn: cell, andModel: itemViewModel) } - public func cvc_didChangeLongpress(_ itemViewModel: CVItemViewModelImpl) { + public func didChangeLongPress(_ itemViewModel: CVItemViewModelImpl) { AssertIsOnMainThread() collectionViewActiveContextMenuInteraction?.initiatingGestureRecognizerDidChange() } - public func cvc_didEndLongpress(_ itemViewModel: CVItemViewModelImpl) { + public func didEndLongPress(_ itemViewModel: CVItemViewModelImpl) { AssertIsOnMainThread() collectionViewActiveContextMenuInteraction?.initiatingGestureRecognizerDidEnd() } - public func cvc_didCancelLongpress(_ itemViewModel: CVItemViewModelImpl) { + public func didCancelLongPress(_ itemViewModel: CVItemViewModelImpl) { AssertIsOnMainThread() collectionViewActiveContextMenuInteraction?.initiatingGestureRecognizerDidEnd() @@ -118,13 +100,13 @@ extension ConversationViewController: CVComponentDelegate { // MARK: - - public func cvc_didTapReplyToItem(_ itemViewModel: CVItemViewModelImpl) { + public func didTapReplyToItem(_ itemViewModel: CVItemViewModelImpl) { AssertIsOnMainThread() populateReplyForMessage(itemViewModel) } - public func cvc_didTapSenderAvatar(_ interaction: TSInteraction) { + public func didTapSenderAvatar(_ interaction: TSInteraction) { AssertIsOnMainThread() guard let incomingMessage = interaction as? TSIncomingMessage else { @@ -135,7 +117,7 @@ extension ConversationViewController: CVComponentDelegate { showMemberActionSheet(forAddress: incomingMessage.authorAddress, withHapticFeedback: false) } - public func cvc_shouldAllowReplyForItem(_ itemViewModel: CVItemViewModelImpl) -> Bool { + public func shouldAllowReplyForItem(_ itemViewModel: CVItemViewModelImpl) -> Bool { AssertIsOnMainThread() if thread.isGroupThread && !thread.isLocalUserFullMemberOfThread { @@ -165,8 +147,8 @@ extension ConversationViewController: CVComponentDelegate { return true } - public func cvc_didTapReactions(reactionState: InteractionReactionState, - message: TSMessage) { + public func didTapReactions(reactionState: InteractionReactionState, + message: TSMessage) { AssertIsOnMainThread() if !reactionState.hasReactions { @@ -179,33 +161,36 @@ extension ConversationViewController: CVComponentDelegate { self.reactionsDetailSheet = detailSheet } - public var cvc_hasPendingMessageRequest: Bool { + public var hasPendingMessageRequest: Bool { AssertIsOnMainThread() return self.threadViewModel.hasPendingMessageRequest } - public func cvc_didTapTruncatedTextMessage(_ itemViewModel: CVItemViewModelImpl) { + public func didTapTruncatedTextMessage(_ itemViewModel: CVItemViewModelImpl) { AssertIsOnMainThread() expandTruncatedTextOrPresentLongTextView(itemViewModel) } - public func cvc_didTapFailedOrPendingDownloads(_ message: TSMessage) { + public func didTapFailedOrPendingDownloads(_ message: TSMessage) { AssertIsOnMainThread() - attachmentDownloads.enqueueDownloadOfAttachments(forMessageId: message.uniqueId, - attachmentGroup: .allAttachmentsIncoming, - downloadBehavior: .bypassAll, - touchMessageImmediately: true, - success: { _ in - Logger.info("Successfully re-downloaded attachment.") - }, failure: { error in - Logger.warn("Failed to redownload message with error: \(error)") - }) + attachmentDownloads.enqueueDownloadOfAttachments( + forMessageId: message.uniqueId, + attachmentGroup: .allAttachmentsIncoming, + downloadBehavior: .bypassAll, + touchMessageImmediately: true, + success: { _ in + Logger.info("Successfully re-downloaded attachment.") + }, + failure: { error in + Logger.warn("Failed to redownload message with error: \(error)") + } + ) } - public func cvc_didTapBrokenVideo() { + public func didTapBrokenVideo() { let toastText = NSLocalizedString("VIDEO_BROKEN", comment: "Toast alert text shown when tapping on a video that cannot be played.") presentToastCVC(toastText) @@ -213,9 +198,9 @@ extension ConversationViewController: CVComponentDelegate { // MARK: - Messages - public func cvc_didTapBodyMedia(itemViewModel: CVItemViewModelImpl, - attachmentStream: TSAttachmentStream, - imageView: UIView) { + public func didTapBodyMedia(itemViewModel: CVItemViewModelImpl, + attachmentStream: TSAttachmentStream, + imageView: UIView) { AssertIsOnMainThread() dismissKeyBoard() @@ -225,7 +210,7 @@ extension ConversationViewController: CVComponentDelegate { self.present(pageVC, animated: true, completion: nil) } - public func cvc_didTapGenericAttachment(_ attachment: CVComponentGenericAttachment) -> CVAttachmentTapAction { + public func didTapGenericAttachment(_ attachment: CVComponentGenericAttachment) -> CVAttachmentTapAction { AssertIsOnMainThread() if attachment.canQuickLook { @@ -243,7 +228,7 @@ extension ConversationViewController: CVComponentDelegate { } } - public func cvc_didTapQuotedReply(_ quotedReply: OWSQuotedReplyModel) { + public func didTapQuotedReply(_ quotedReply: OWSQuotedReplyModel) { AssertIsOnMainThread() owsAssertDebug(quotedReply.timestamp > 0) owsAssertDebug(quotedReply.authorAddress.isValid) @@ -277,7 +262,7 @@ extension ConversationViewController: CVComponentDelegate { } } - public func cvc_didTapLinkPreview(_ linkPreview: OWSLinkPreview) { + public func didTapLinkPreview(_ linkPreview: OWSLinkPreview) { AssertIsOnMainThread() guard let urlString = linkPreview.urlString, @@ -297,12 +282,12 @@ extension ConversationViewController: CVComponentDelegate { } if GroupManager.isPossibleGroupInviteLink(url) { - cvc_didTapGroupInviteLink(url: url) + didTapGroupInviteLink(url: url) return } if SignalProxy.isValidProxyLink(url) { - cvc_didTapProxyLink(url: url) + didTapProxyLink(url: url) return } @@ -311,74 +296,64 @@ extension ConversationViewController: CVComponentDelegate { UIApplication.shared.open(url, options: [:], completionHandler: nil) } - public func cvc_didTapContactShare(_ contactShare: ContactShareViewModel) { + public func didTapContactShare(_ contactShare: ContactShareViewModel) { AssertIsOnMainThread() let view = ContactViewController(contactShare: contactShare) navigationController?.pushViewController(view, animated: true) } - public func cvc_didTapSendMessage(toContactShare contactShare: ContactShareViewModel) { + public func didTapSendMessage(toContactShare contactShare: ContactShareViewModel) { AssertIsOnMainThread() contactShareViewHelper.sendMessage(contactShare: contactShare, fromViewController: self) } - public func cvc_didTapSendInvite(toContactShare contactShare: ContactShareViewModel) { + public func didTapSendInvite(toContactShare contactShare: ContactShareViewModel) { AssertIsOnMainThread() contactShareViewHelper.showInviteContact(contactShare: contactShare, fromViewController: self) } - public func cvc_didTapAddToContacts(contactShare: ContactShareViewModel) { + public func didTapAddToContacts(contactShare: ContactShareViewModel) { AssertIsOnMainThread() contactShareViewHelper.showAddToContacts(contactShare: contactShare, fromViewController: self) } - public func cvc_didTapStickerPack(_ stickerPackInfo: StickerPackInfo) { + public func didTapStickerPack(_ stickerPackInfo: StickerPackInfo) { AssertIsOnMainThread() let packView = StickerPackViewController(stickerPackInfo: stickerPackInfo) packView.present(from: self, animated: true) } - public func cvc_didTapGroupInviteLink(url: URL) { + public func didTapGroupInviteLink(url: URL) { AssertIsOnMainThread() owsAssertDebug(GroupManager.isPossibleGroupInviteLink(url)) GroupInviteLinksUI.openGroupInviteLink(url, fromViewController: self) } - public func cvc_didTapProxyLink(url: URL) { + public func didTapProxyLink(url: URL) { AssertIsOnMainThread() guard let vc = ProxyLinkSheetViewController(url: url) else { return } present(vc, animated: true) } - public func cvc_willWrapGift(_ messageUniqueId: String) -> Bool { willWrapGift(messageUniqueId) } - - public func cvc_willShakeGift(_ messageUniqueId: String) -> Bool { willShakeGift(messageUniqueId) } - - public func cvc_willUnwrapGift(_ itemViewModel: CVItemViewModelImpl) { willUnwrapGift(itemViewModel) } - - public func cvc_didTapGiftBadge(_ itemViewModel: CVItemViewModelImpl, profileBadge: ProfileBadge, isExpired: Bool, isRedeemed: Bool) { - didTapGiftBadge(itemViewModel, profileBadge: profileBadge, isExpired: isExpired, isRedeemed: isRedeemed) - } - public func cvc_didTapSignalMeLink(url: URL) { SignalMe.openChat(url: url, fromViewController: self) } - public func cvc_didTapShowMessageDetail(_ itemViewModel: CVItemViewModelImpl) { + public func didTapShowMessageDetail(_ itemViewModel: CVItemViewModelImpl) { showDetailView(itemViewModel) } - public func cvc_prepareMessageDetailForInteractivePresentation(_ itemViewModel: CVItemViewModelImpl) { + public func prepareMessageDetailForInteractivePresentation(_ itemViewModel: CVItemViewModelImpl) { prepareDetailViewForInteractivePresentation(itemViewModel) } - public func cvc_beginCellAnimation(maximumDuration: TimeInterval) -> EndCellAnimation { + public func beginCellAnimation(maximumDuration: TimeInterval) -> EndCellAnimation { AssertIsOnMainThread() if maximumDuration > 0.8 { @@ -410,7 +385,7 @@ extension ConversationViewController: CVComponentDelegate { // MARK: - System Cell - public func cvc_didTapPreviouslyVerifiedIdentityChange(_ address: SignalServiceAddress) { + public func didTapPreviouslyVerifiedIdentityChange(_ address: SignalServiceAddress) { AssertIsOnMainThread() showFingerprint(address: address) @@ -426,7 +401,7 @@ extension ConversationViewController: CVComponentDelegate { FingerprintViewController.present(from: self, address: address) } - public func cvc_didTapUnverifiedIdentityChange(_ address: SignalServiceAddress) { + public func didTapUnverifiedIdentityChange(_ address: SignalServiceAddress) { AssertIsOnMainThread() owsAssertDebug(address.isValid) @@ -461,7 +436,7 @@ extension ConversationViewController: CVComponentDelegate { presentActionSheet(actionSheet) } - public func cvc_didTapInvalidIdentityKeyErrorMessage(_ message: TSInvalidIdentityKeyErrorMessage) { + public func didTapInvalidIdentityKeyErrorMessage(_ message: TSInvalidIdentityKeyErrorMessage) { AssertIsOnMainThread() let keyOwner = contactsManager.displayName(for: message.theirSignalAddress()) @@ -503,7 +478,7 @@ extension ConversationViewController: CVComponentDelegate { self.presentActionSheet(actionSheet) } - public func cvc_didTapCorruptedMessage(_ message: TSErrorMessage) { + public func didTapCorruptedMessage(_ message: TSErrorMessage) { AssertIsOnMainThread() let threadName = databaseStorage.read { transaction in @@ -536,7 +511,7 @@ extension ConversationViewController: CVComponentDelegate { self.presentActionSheet(alert) } - public func cvc_didTapSessionRefreshMessage(_ message: TSErrorMessage) { + public func didTapSessionRefreshMessage(_ message: TSErrorMessage) { dismissKeyBoard() let headerImageView = UIImageView(image: UIImage(named: "chat-session-refresh")) @@ -566,7 +541,7 @@ extension ConversationViewController: CVComponentDelegate { } // See: resendGroupUpdate - public func cvc_didTapResendGroupUpdateForErrorMessage(_ message: TSErrorMessage) { + public func didTapResendGroupUpdateForErrorMessage(_ message: TSErrorMessage) { AssertIsOnMainThread() guard let groupThread = self.thread as? TSGroupThread else { @@ -586,7 +561,7 @@ extension ConversationViewController: CVComponentDelegate { } } - public func cvc_didTapShowFingerprint(_ address: SignalServiceAddress) { + public func didTapShowFingerprint(_ address: SignalServiceAddress) { AssertIsOnMainThread() showFingerprint(address: address) @@ -594,7 +569,7 @@ extension ConversationViewController: CVComponentDelegate { // MARK: - - public func cvc_didTapIndividualCall(_ call: TSCall) { + public func didTapIndividualCall(_ call: TSCall) { AssertIsOnMainThread() owsAssertDebug(self.inputToolbar != nil) @@ -627,13 +602,13 @@ extension ConversationViewController: CVComponentDelegate { self.presentActionSheet(alert) } - public func cvc_didTapGroupCall() { + public func didTapGroupCall() { AssertIsOnMainThread() showGroupLobbyOrActiveCall() } - public func cvc_didTapPendingOutgoingMessage(_ message: TSOutgoingMessage) { + public func didTapPendingOutgoingMessage(_ message: TSOutgoingMessage) { AssertIsOnMainThread() if spamChallengeResolver.isPausingMessages { SpamCaptchaViewController.presentActionSheet(from: self) @@ -643,15 +618,15 @@ extension ConversationViewController: CVComponentDelegate { } - public func cvc_didTapFailedOutgoingMessage(_ message: TSOutgoingMessage) { + public func didTapFailedOutgoingMessage(_ message: TSOutgoingMessage) { AssertIsOnMainThread() resendFailedOutgoingMessage(message) } - public func cvc_didTapShowGroupMigrationLearnMoreActionSheet(infoMessage: TSInfoMessage, - oldGroupModel: TSGroupModel, - newGroupModel: TSGroupModel) { + public func didTapShowGroupMigrationLearnMoreActionSheet(infoMessage: TSInfoMessage, + oldGroupModel: TSGroupModel, + newGroupModel: TSGroupModel) { AssertIsOnMainThread() guard let groupThread = thread as? TSGroupThread else { @@ -665,13 +640,13 @@ extension ConversationViewController: CVComponentDelegate { actionSheet.present(fromViewController: self) } - public func cvc_didTapGroupInviteLinkPromotion(groupModel: TSGroupModel) { + public func didTapGroupInviteLinkPromotion(groupModel: TSGroupModel) { AssertIsOnMainThread() showGroupLinkPromotionActionSheet() } - public func cvc_didTapViewGroupDescription(groupModel: TSGroupModel?) { + public func didTapViewGroupDescription(groupModel: TSGroupModel?) { AssertIsOnMainThread() func getGroupModel() -> TSGroupModel? { @@ -693,19 +668,19 @@ extension ConversationViewController: CVComponentDelegate { self.presentFormSheet(navigationController, animated: true) } - public func cvc_didTapShowConversationSettings() { + public func didTapShowConversationSettings() { AssertIsOnMainThread() showConversationSettings() } - public func cvc_didTapShowConversationSettingsAndShowMemberRequests() { + public func didTapShowConversationSettingsAndShowMemberRequests() { AssertIsOnMainThread() showConversationSettingsAndShowMemberRequests() } - public func cvc_didTapBlockRequest( + public func didTapBlockRequest( groupModel: TSGroupModelV2, requesterName: String, requesterUuid: UUID @@ -755,15 +730,15 @@ extension ConversationViewController: CVComponentDelegate { OWSActionSheets.showActionSheet(actionSheet, fromViewController: self) } - public func cvc_didTapShowUpgradeAppUI() { + public func didTapShowUpgradeAppUI() { AssertIsOnMainThread() let url = "https://itunes.apple.com/us/app/signal-private-messenger/id874139669?mt=8" UIApplication.shared.open(URL(string: url)!, options: [:], completionHandler: nil) } - public func cvc_didTapUpdateSystemContact(_ address: SignalServiceAddress, - newNameComponents: PersonNameComponents) { + public func didTapUpdateSystemContact(_ address: SignalServiceAddress, + newNameComponents: PersonNameComponents) { AssertIsOnMainThread() guard contactsManagerImpl.supportsContactEditing else { @@ -782,9 +757,9 @@ extension ConversationViewController: CVComponentDelegate { navigationController?.pushViewController(contactViewController, animated: true) } - public func cvc_didTapPhoneNumberChange(uuid: UUID, - phoneNumberOld: String, - phoneNumberNew: String) { + public func didTapPhoneNumberChange(uuid: UUID, + phoneNumberOld: String, + phoneNumberNew: String) { AssertIsOnMainThread() guard contactsManagerImpl.supportsContactEditing else { @@ -812,13 +787,13 @@ extension ConversationViewController: CVComponentDelegate { navigationController?.pushViewController(contactViewController, animated: true) } - public func cvc_didTapViewOnceAttachment(_ interaction: TSInteraction) { + public func didTapViewOnceAttachment(_ interaction: TSInteraction) { AssertIsOnMainThread() ViewOnceMessageViewController.tryToPresent(interaction: interaction, from: self) } - public func cvc_didTapViewOnceExpired(_ interaction: TSInteraction) { + public func didTapViewOnceExpired(_ interaction: TSInteraction) { AssertIsOnMainThread() if interaction is TSOutgoingMessage { @@ -828,19 +803,19 @@ extension ConversationViewController: CVComponentDelegate { } } - public func cvc_didTapUnknownThreadWarningGroup() { + public func didTapUnknownThreadWarningGroup() { AssertIsOnMainThread() showUnknownThreadWarningAlert() } - public func cvc_didTapUnknownThreadWarningContact() { + public func didTapUnknownThreadWarningContact() { AssertIsOnMainThread() showUnknownThreadWarningAlert() } - public func cvc_didTapDeliveryIssueWarning(_ message: TSErrorMessage) { + public func didTapDeliveryIssueWarning(_ message: TSErrorMessage) { AssertIsOnMainThread() guard let senderAddress = message.sender else { owsFailDebug("Expected a sender address") diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController+GestureRecognizers.swift b/Signal/src/ViewControllers/ConversationView/ConversationViewController+GestureRecognizers.swift index 426f77cd60..0f0143261e 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController+GestureRecognizers.swift +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController+GestureRecognizers.swift @@ -216,7 +216,7 @@ extension ConversationViewController: UIGestureRecognizerDelegate { } let itemViewModel = CVItemViewModelImpl(renderItem: renderItem) - let shouldAllowReply = cvc_shouldAllowReplyForItem(itemViewModel) + let shouldAllowReply = shouldAllowReplyForItem(itemViewModel) let messageActions: [MessageAction] if itemViewModel.messageCellType == .systemMessage { messageActions = MessageActions.infoMessageActions(itemViewModel: itemViewModel, @@ -351,28 +351,28 @@ public struct CVLongPressHandler { return } - let shouldAllowReply = delegate.cvc_shouldAllowReplyForItem(itemViewModel) + let shouldAllowReply = delegate.shouldAllowReplyForItem(itemViewModel) switch gestureLocation { case .`default`: // TODO: Rename from "Text view item" to "default"? - delegate.cvc_didLongPressTextViewItem(cell, - itemViewModel: itemViewModel, - shouldAllowReply: shouldAllowReply) + delegate.didLongPressTextViewItem(cell, + itemViewModel: itemViewModel, + shouldAllowReply: shouldAllowReply) case .media: - delegate.cvc_didLongPressMediaViewItem(cell, - itemViewModel: itemViewModel, - shouldAllowReply: shouldAllowReply) + delegate.didLongPressMediaViewItem(cell, + itemViewModel: itemViewModel, + shouldAllowReply: shouldAllowReply) case .sticker: - delegate.cvc_didLongPressSticker(cell, - itemViewModel: itemViewModel, - shouldAllowReply: shouldAllowReply) + delegate.didLongPressSticker(cell, + itemViewModel: itemViewModel, + shouldAllowReply: shouldAllowReply) case .quotedReply: - delegate.cvc_didLongPressQuote(cell, - itemViewModel: itemViewModel, - shouldAllowReply: shouldAllowReply) + delegate.didLongPressQuote(cell, + itemViewModel: itemViewModel, + shouldAllowReply: shouldAllowReply) case .systemMessage: - delegate.cvc_didLongPressSystemMessage(cell, itemViewModel: itemViewModel) + delegate.didLongPressSystemMessage(cell, itemViewModel: itemViewModel) case .bodyText: break } @@ -386,7 +386,7 @@ public struct CVLongPressHandler { switch gestureLocation { case .bodyText(let item): - delegate.cvc_didLongPressBodyTextItem(item) + delegate.didLongPressBodyTextItem(item) default: // Case will be handled by context menu gesture recognizer break @@ -404,11 +404,11 @@ public struct CVLongPressHandler { // We use startGesture(cell:) to start handling the gesture. owsFailDebug("Unexpected state.") case .changed: - delegate.cvc_didChangeLongpress(itemViewModel) + delegate.didChangeLongPress(itemViewModel) case .ended: - delegate.cvc_didEndLongpress(itemViewModel) + delegate.didEndLongPress(itemViewModel) case .failed, .cancelled: - delegate.cvc_didCancelLongpress(itemViewModel) + delegate.didCancelLongPress(itemViewModel) case .possible: owsFailDebug("Unexpected state.") @unknown default: diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController+GiftBadges.swift b/Signal/src/ViewControllers/ConversationView/ConversationViewController+GiftBadges.swift index d7135e6489..e38de1e3d6 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController+GiftBadges.swift +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController+GiftBadges.swift @@ -9,7 +9,7 @@ import SignalServiceKit extension ConversationViewController { - func willWrapGift(_ messageUniqueId: String) -> Bool { + public func willWrapGift(_ messageUniqueId: String) -> Bool { // If a gift is unwrapped at roughly the same we're reloading the // conversation for an unrelated reason, there's a chance we'll try to // re-wrap a gift that was just unwrapped. This provides an opportunity to @@ -17,12 +17,12 @@ extension ConversationViewController { return !self.viewState.unwrappedGiftMessageIds.contains(messageUniqueId) } - func willShakeGift(_ messageUniqueId: String) -> Bool { + public func willShakeGift(_ messageUniqueId: String) -> Bool { let (justInserted, _) = self.viewState.shakenGiftMessageIds.insert(messageUniqueId) return justInserted } - func willUnwrapGift(_ itemViewModel: CVItemViewModelImpl) { + public func willUnwrapGift(_ itemViewModel: CVItemViewModelImpl) { self.viewState.unwrappedGiftMessageIds.insert(itemViewModel.interaction.uniqueId) self.markGiftAsOpened(itemViewModel.interaction) } @@ -43,7 +43,7 @@ extension ConversationViewController { } } - func didTapGiftBadge(_ itemViewModel: CVItemViewModelImpl, profileBadge: ProfileBadge, isExpired: Bool, isRedeemed: Bool) { + public func didTapGiftBadge(_ itemViewModel: CVItemViewModelImpl, profileBadge: ProfileBadge, isExpired: Bool, isRedeemed: Bool) { AssertIsOnMainThread() let viewControllerToPresent: UIViewController diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController+SystemMessageItems.swift b/Signal/src/ViewControllers/ConversationView/ConversationViewController+SystemMessageItems.swift index b029966152..76384a83f4 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController+SystemMessageItems.swift +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController+SystemMessageItems.swift @@ -7,7 +7,8 @@ import Foundation import SignalCoreKit extension ConversationViewController { - func didTapSystemMessageItem(_ item: CVTextLabel.Item) { + + public func didTapSystemMessageItem(_ item: CVTextLabel.Item) { AssertIsOnMainThread() guard case .referencedUser(let referencedUserItem) = item else { diff --git a/Signal/src/ViewControllers/MessageDetailViewController.swift b/Signal/src/ViewControllers/MessageDetailViewController.swift index b5e9bd89bf..92a5603772 100644 --- a/Signal/src/ViewControllers/MessageDetailViewController.swift +++ b/Signal/src/ViewControllers/MessageDetailViewController.swift @@ -3,10 +3,10 @@ // SPDX-License-Identifier: AGPL-3.0-only // -import Foundation import QuickLook -import SignalServiceKit import SignalMessaging +import SignalServiceKit +import SignalUI protocol MessageDetailViewDelegate: AnyObject { func detailViewMessageWasDeleted(_ messageDetailViewController: MessageDetailViewController) @@ -919,75 +919,75 @@ extension MessageDetailViewController: DatabaseChangeDelegate { extension MessageDetailViewController: CVComponentDelegate { - func cvc_enqueueReload() { + func enqueueReload() { self.refreshContent() } - func cvc_enqueueReloadWithoutCaches() { + func enqueueReloadWithoutCaches() { self.refreshContentForDatabaseUpdate(forceImmediately: true) } // MARK: - Body Text Items - func cvc_didTapBodyTextItem(_ item: CVTextLabel.Item) {} + func didTapBodyTextItem(_ item: CVTextLabel.Item) {} - func cvc_didLongPressBodyTextItem(_ item: CVTextLabel.Item) {} + func didLongPressBodyTextItem(_ item: CVTextLabel.Item) {} // MARK: - System Message Items - func cvc_didTapSystemMessageItem(_ item: CVTextLabel.Item) {} + func didTapSystemMessageItem(_ item: CVTextLabel.Item) {} // MARK: - Long Press // TODO: - func cvc_didLongPressTextViewItem(_ cell: CVCell, - itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool) {} + func didLongPressTextViewItem(_ cell: CVCell, + itemViewModel: CVItemViewModelImpl, + shouldAllowReply: Bool) {} // TODO: - func cvc_didLongPressMediaViewItem(_ cell: CVCell, - itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool) {} + func didLongPressMediaViewItem(_ cell: CVCell, + itemViewModel: CVItemViewModelImpl, + shouldAllowReply: Bool) {} // TODO: - func cvc_didLongPressQuote(_ cell: CVCell, - itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool) {} + func didLongPressQuote(_ cell: CVCell, + itemViewModel: CVItemViewModelImpl, + shouldAllowReply: Bool) {} // TODO: - func cvc_didLongPressSystemMessage(_ cell: CVCell, - itemViewModel: CVItemViewModelImpl) {} + func didLongPressSystemMessage(_ cell: CVCell, + itemViewModel: CVItemViewModelImpl) {} // TODO: - func cvc_didLongPressSticker(_ cell: CVCell, - itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool) {} + func didLongPressSticker(_ cell: CVCell, + itemViewModel: CVItemViewModelImpl, + shouldAllowReply: Bool) {} // TODO: - func cvc_didChangeLongpress(_ itemViewModel: CVItemViewModelImpl) {} + func didChangeLongPress(_ itemViewModel: CVItemViewModelImpl) {} // TODO: - func cvc_didEndLongpress(_ itemViewModel: CVItemViewModelImpl) {} + func didEndLongPress(_ itemViewModel: CVItemViewModelImpl) {} // TODO: - func cvc_didCancelLongpress(_ itemViewModel: CVItemViewModelImpl) {} + func didCancelLongPress(_ itemViewModel: CVItemViewModelImpl) {} // MARK: - // TODO: - func cvc_didTapReplyToItem(_ itemViewModel: CVItemViewModelImpl) {} + func didTapReplyToItem(_ itemViewModel: CVItemViewModelImpl) {} // TODO: - func cvc_didTapSenderAvatar(_ interaction: TSInteraction) {} + func didTapSenderAvatar(_ interaction: TSInteraction) {} // TODO: - func cvc_shouldAllowReplyForItem(_ itemViewModel: CVItemViewModelImpl) -> Bool { false } + func shouldAllowReplyForItem(_ itemViewModel: CVItemViewModelImpl) -> Bool { false } // TODO: - func cvc_didTapReactions(reactionState: InteractionReactionState, - message: TSMessage) {} + func didTapReactions(reactionState: InteractionReactionState, + message: TSMessage) {} - func cvc_didTapTruncatedTextMessage(_ itemViewModel: CVItemViewModelImpl) { + func didTapTruncatedTextMessage(_ itemViewModel: CVItemViewModelImpl) { AssertIsOnMainThread() let viewController = LongTextViewController(itemViewModel: itemViewModel) @@ -996,15 +996,15 @@ extension MessageDetailViewController: CVComponentDelegate { } // TODO: - var cvc_hasPendingMessageRequest: Bool { false } + var hasPendingMessageRequest: Bool { false } - func cvc_didTapFailedOrPendingDownloads(_ message: TSMessage) {} + func didTapFailedOrPendingDownloads(_ message: TSMessage) {} - func cvc_didTapBrokenVideo() {} + func didTapBrokenVideo() {} // MARK: - Messages - func cvc_didTapBodyMedia( + func didTapBodyMedia( itemViewModel: CVItemViewModelImpl, attachmentStream: TSAttachmentStream, imageView: UIView @@ -1022,7 +1022,7 @@ extension MessageDetailViewController: CVComponentDelegate { present(mediaPageVC, animated: true) } - func cvc_didTapGenericAttachment(_ attachment: CVComponentGenericAttachment) -> CVAttachmentTapAction { + func didTapGenericAttachment(_ attachment: CVComponentGenericAttachment) -> CVAttachmentTapAction { if attachment.canQuickLook { let previewController = QLPreviewController() previewController.dataSource = attachment @@ -1033,9 +1033,9 @@ extension MessageDetailViewController: CVComponentDelegate { } } - func cvc_didTapQuotedReply(_ quotedReply: OWSQuotedReplyModel) {} + func didTapQuotedReply(_ quotedReply: OWSQuotedReplyModel) {} - func cvc_didTapLinkPreview(_ linkPreview: OWSLinkPreview) { + func didTapLinkPreview(_ linkPreview: OWSLinkPreview) { guard let urlString = linkPreview.urlString else { owsFailDebug("Missing url.") return @@ -1047,48 +1047,48 @@ extension MessageDetailViewController: CVComponentDelegate { UIApplication.shared.open(url, options: [:]) } - func cvc_didTapContactShare(_ contactShare: ContactShareViewModel) { + func didTapContactShare(_ contactShare: ContactShareViewModel) { let contactViewController = ContactViewController(contactShare: contactShare) self.navigationController?.pushViewController(contactViewController, animated: true) } - func cvc_didTapSendMessage(toContactShare contactShare: ContactShareViewModel) { + func didTapSendMessage(toContactShare contactShare: ContactShareViewModel) { contactShareViewHelper.sendMessage(contactShare: contactShare, fromViewController: self) } - func cvc_didTapSendInvite(toContactShare contactShare: ContactShareViewModel) { + func didTapSendInvite(toContactShare contactShare: ContactShareViewModel) { contactShareViewHelper.showInviteContact(contactShare: contactShare, fromViewController: self) } - func cvc_didTapAddToContacts(contactShare: ContactShareViewModel) { + func didTapAddToContacts(contactShare: ContactShareViewModel) { contactShareViewHelper.showAddToContacts(contactShare: contactShare, fromViewController: self) } - func cvc_didTapStickerPack(_ stickerPackInfo: StickerPackInfo) { + func didTapStickerPack(_ stickerPackInfo: StickerPackInfo) { let packView = StickerPackViewController(stickerPackInfo: stickerPackInfo) packView.present(from: self, animated: true) } - func cvc_didTapGroupInviteLink(url: URL) { + func didTapGroupInviteLink(url: URL) { GroupInviteLinksUI.openGroupInviteLink(url, fromViewController: self) } - func cvc_didTapProxyLink(url: URL) {} + func didTapProxyLink(url: URL) {} - func cvc_didTapShowMessageDetail(_ itemViewModel: CVItemViewModelImpl) {} + func didTapShowMessageDetail(_ itemViewModel: CVItemViewModelImpl) {} // Never wrap gifts on the message details screen - func cvc_willWrapGift(_ messageUniqueId: String) -> Bool { false } + func willWrapGift(_ messageUniqueId: String) -> Bool { false } - func cvc_willShakeGift(_ messageUniqueId: String) -> Bool { false } + func willShakeGift(_ messageUniqueId: String) -> Bool { false } - func cvc_willUnwrapGift(_ itemViewModel: CVItemViewModelImpl) {} + func willUnwrapGift(_ itemViewModel: CVItemViewModelImpl) {} - func cvc_didTapGiftBadge(_ itemViewModel: CVItemViewModelImpl, profileBadge: ProfileBadge, isExpired: Bool, isRedeemed: Bool) {} + func didTapGiftBadge(_ itemViewModel: CVItemViewModelImpl, profileBadge: ProfileBadge, isExpired: Bool, isRedeemed: Bool) {} - func cvc_prepareMessageDetailForInteractivePresentation(_ itemViewModel: CVItemViewModelImpl) {} + func prepareMessageDetailForInteractivePresentation(_ itemViewModel: CVItemViewModelImpl) {} - func cvc_beginCellAnimation(maximumDuration: TimeInterval) -> EndCellAnimation { + func beginCellAnimation(maximumDuration: TimeInterval) -> EndCellAnimation { return {} } @@ -1103,72 +1103,72 @@ extension MessageDetailViewController: CVComponentDelegate { // MARK: - System Cell // TODO: - func cvc_didTapPreviouslyVerifiedIdentityChange(_ address: SignalServiceAddress) {} + func didTapPreviouslyVerifiedIdentityChange(_ address: SignalServiceAddress) {} // TODO: - func cvc_didTapUnverifiedIdentityChange(_ address: SignalServiceAddress) {} + func didTapUnverifiedIdentityChange(_ address: SignalServiceAddress) {} // TODO: - func cvc_didTapInvalidIdentityKeyErrorMessage(_ message: TSInvalidIdentityKeyErrorMessage) {} + func didTapInvalidIdentityKeyErrorMessage(_ message: TSInvalidIdentityKeyErrorMessage) {} // TODO: - func cvc_didTapCorruptedMessage(_ message: TSErrorMessage) {} + func didTapCorruptedMessage(_ message: TSErrorMessage) {} // TODO: - func cvc_didTapSessionRefreshMessage(_ message: TSErrorMessage) {} + func didTapSessionRefreshMessage(_ message: TSErrorMessage) {} // See: resendGroupUpdate // TODO: - func cvc_didTapResendGroupUpdateForErrorMessage(_ errorMessage: TSErrorMessage) {} + func didTapResendGroupUpdateForErrorMessage(_ errorMessage: TSErrorMessage) {} // TODO: - func cvc_didTapShowFingerprint(_ address: SignalServiceAddress) {} + func didTapShowFingerprint(_ address: SignalServiceAddress) {} // TODO: - func cvc_didTapIndividualCall(_ call: TSCall) {} + func didTapIndividualCall(_ call: TSCall) {} // TODO: - func cvc_didTapGroupCall() {} + func didTapGroupCall() {} // TODO: - func cvc_didTapPendingOutgoingMessage(_ message: TSOutgoingMessage) {} + func didTapPendingOutgoingMessage(_ message: TSOutgoingMessage) {} // TODO: - func cvc_didTapFailedOutgoingMessage(_ message: TSOutgoingMessage) {} + func didTapFailedOutgoingMessage(_ message: TSOutgoingMessage) {} // TODO: - func cvc_didTapShowGroupMigrationLearnMoreActionSheet(infoMessage: TSInfoMessage, - oldGroupModel: TSGroupModel, - newGroupModel: TSGroupModel) {} + func didTapShowGroupMigrationLearnMoreActionSheet(infoMessage: TSInfoMessage, + oldGroupModel: TSGroupModel, + newGroupModel: TSGroupModel) {} - func cvc_didTapGroupInviteLinkPromotion(groupModel: TSGroupModel) {} + func didTapGroupInviteLinkPromotion(groupModel: TSGroupModel) {} - func cvc_didTapViewGroupDescription(groupModel: TSGroupModel?) {} + func didTapViewGroupDescription(groupModel: TSGroupModel?) {} // TODO: - func cvc_didTapShowConversationSettings() {} + func didTapShowConversationSettings() {} // TODO: - func cvc_didTapShowConversationSettingsAndShowMemberRequests() {} + func didTapShowConversationSettingsAndShowMemberRequests() {} // TODO: - func cvc_didTapBlockRequest( + func didTapBlockRequest( groupModel: TSGroupModelV2, requesterName: String, requesterUuid: UUID ) {} // TODO: - func cvc_didTapShowUpgradeAppUI() {} + func didTapShowUpgradeAppUI() {} // TODO: - func cvc_didTapUpdateSystemContact(_ address: SignalServiceAddress, - newNameComponents: PersonNameComponents) {} + func didTapUpdateSystemContact(_ address: SignalServiceAddress, + newNameComponents: PersonNameComponents) {} // TODO: - func cvc_didTapPhoneNumberChange(uuid: UUID, phoneNumberOld: String, phoneNumberNew: String) {} + func didTapPhoneNumberChange(uuid: UUID, phoneNumberOld: String, phoneNumberNew: String) {} - func cvc_didTapViewOnceAttachment(_ interaction: TSInteraction) { + func didTapViewOnceAttachment(_ interaction: TSInteraction) { guard let renderItem = renderItem else { owsFailDebug("Missing renderItem.") return @@ -1179,13 +1179,13 @@ extension MessageDetailViewController: CVComponentDelegate { } // TODO: - func cvc_didTapViewOnceExpired(_ interaction: TSInteraction) {} + func didTapViewOnceExpired(_ interaction: TSInteraction) {} // TODO: - func cvc_didTapUnknownThreadWarningGroup() {} + func didTapUnknownThreadWarningGroup() {} // TODO: - func cvc_didTapUnknownThreadWarningContact() {} - func cvc_didTapDeliveryIssueWarning(_ message: TSErrorMessage) {} + func didTapUnknownThreadWarningContact() {} + func didTapDeliveryIssueWarning(_ message: TSErrorMessage) {} } extension MessageDetailViewController: UINavigationControllerDelegate { diff --git a/Signal/src/views/MockConversationView.swift b/Signal/src/views/MockConversationView.swift index ff7458a524..6076ce2fdc 100644 --- a/Signal/src/views/MockConversationView.swift +++ b/Signal/src/views/MockConversationView.swift @@ -274,100 +274,100 @@ private class MockOutgoingMessage: TSOutgoingMessage { extension MockConversationView: CVComponentDelegate { - func cvc_enqueueReload() {} + func enqueueReload() {} - func cvc_enqueueReloadWithoutCaches() {} + func enqueueReloadWithoutCaches() {} - func cvc_didTapBodyTextItem(_ item: CVTextLabel.Item) {} + func didTapBodyTextItem(_ item: CVTextLabel.Item) {} - func cvc_didLongPressBodyTextItem(_ item: CVTextLabel.Item) {} + func didLongPressBodyTextItem(_ item: CVTextLabel.Item) {} - func cvc_didTapSystemMessageItem(_ item: CVTextLabel.Item) {} + func didTapSystemMessageItem(_ item: CVTextLabel.Item) {} - func cvc_didLongPressTextViewItem(_ cell: CVCell, - itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool) {} + func didLongPressTextViewItem(_ cell: CVCell, + itemViewModel: CVItemViewModelImpl, + shouldAllowReply: Bool) {} - func cvc_didLongPressMediaViewItem(_ cell: CVCell, - itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool) {} + func didLongPressMediaViewItem(_ cell: CVCell, + itemViewModel: CVItemViewModelImpl, + shouldAllowReply: Bool) {} - func cvc_didLongPressQuote(_ cell: CVCell, - itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool) {} + func didLongPressQuote(_ cell: CVCell, + itemViewModel: CVItemViewModelImpl, + shouldAllowReply: Bool) {} - func cvc_didLongPressSystemMessage(_ cell: CVCell, - itemViewModel: CVItemViewModelImpl) {} + func didLongPressSystemMessage(_ cell: CVCell, + itemViewModel: CVItemViewModelImpl) {} - func cvc_didLongPressSticker(_ cell: CVCell, - itemViewModel: CVItemViewModelImpl, - shouldAllowReply: Bool) {} + func didLongPressSticker(_ cell: CVCell, + itemViewModel: CVItemViewModelImpl, + shouldAllowReply: Bool) {} - func cvc_didChangeLongpress(_ itemViewModel: CVItemViewModelImpl) {} + func didChangeLongPress(_ itemViewModel: CVItemViewModelImpl) {} - func cvc_didEndLongpress(_ itemViewModel: CVItemViewModelImpl) {} + func didEndLongPress(_ itemViewModel: CVItemViewModelImpl) {} - func cvc_didCancelLongpress(_ itemViewModel: CVItemViewModelImpl) {} + func didCancelLongPress(_ itemViewModel: CVItemViewModelImpl) {} // MARK: - - func cvc_didTapReplyToItem(_ itemViewModel: CVItemViewModelImpl) {} + func didTapReplyToItem(_ itemViewModel: CVItemViewModelImpl) {} - func cvc_didTapSenderAvatar(_ interaction: TSInteraction) {} + func didTapSenderAvatar(_ interaction: TSInteraction) {} - func cvc_shouldAllowReplyForItem(_ itemViewModel: CVItemViewModelImpl) -> Bool { false } + func shouldAllowReplyForItem(_ itemViewModel: CVItemViewModelImpl) -> Bool { false } - func cvc_didTapReactions(reactionState: InteractionReactionState, - message: TSMessage) {} + func didTapReactions(reactionState: InteractionReactionState, + message: TSMessage) {} - func cvc_didTapTruncatedTextMessage(_ itemViewModel: CVItemViewModelImpl) {} + func didTapTruncatedTextMessage(_ itemViewModel: CVItemViewModelImpl) {} - var cvc_hasPendingMessageRequest: Bool { false } + var hasPendingMessageRequest: Bool { false } - func cvc_didTapFailedOrPendingDownloads(_ message: TSMessage) {} + func didTapFailedOrPendingDownloads(_ message: TSMessage) {} - func cvc_didTapBrokenVideo() {} + func didTapBrokenVideo() {} // MARK: - Messages - func cvc_didTapBodyMedia(itemViewModel: CVItemViewModelImpl, - attachmentStream: TSAttachmentStream, - imageView: UIView) {} + func didTapBodyMedia(itemViewModel: CVItemViewModelImpl, + attachmentStream: TSAttachmentStream, + imageView: UIView) {} - func cvc_didTapGenericAttachment(_ attachment: CVComponentGenericAttachment) -> CVAttachmentTapAction { .default } + func didTapGenericAttachment(_ attachment: CVComponentGenericAttachment) -> CVAttachmentTapAction { .default } - func cvc_didTapQuotedReply(_ quotedReply: OWSQuotedReplyModel) {} + func didTapQuotedReply(_ quotedReply: OWSQuotedReplyModel) {} - func cvc_didTapLinkPreview(_ linkPreview: OWSLinkPreview) {} + func didTapLinkPreview(_ linkPreview: OWSLinkPreview) {} - func cvc_didTapContactShare(_ contactShare: ContactShareViewModel) {} + func didTapContactShare(_ contactShare: ContactShareViewModel) {} - func cvc_didTapSendMessage(toContactShare contactShare: ContactShareViewModel) {} + func didTapSendMessage(toContactShare contactShare: ContactShareViewModel) {} - func cvc_didTapSendInvite(toContactShare contactShare: ContactShareViewModel) {} + func didTapSendInvite(toContactShare contactShare: ContactShareViewModel) {} - func cvc_didTapAddToContacts(contactShare: ContactShareViewModel) {} + func didTapAddToContacts(contactShare: ContactShareViewModel) {} - func cvc_didTapStickerPack(_ stickerPackInfo: StickerPackInfo) {} + func didTapStickerPack(_ stickerPackInfo: StickerPackInfo) {} - func cvc_didTapGroupInviteLink(url: URL) {} + func didTapGroupInviteLink(url: URL) {} - func cvc_didTapProxyLink(url: URL) {} + func didTapProxyLink(url: URL) {} - func cvc_didTapShowMessageDetail(_ itemViewModel: CVItemViewModelImpl) {} + func didTapShowMessageDetail(_ itemViewModel: CVItemViewModelImpl) {} // Never wrap gifts on the mock conversation view - func cvc_willWrapGift(_ messageUniqueId: String) -> Bool { false } + func willWrapGift(_ messageUniqueId: String) -> Bool { false } - func cvc_willShakeGift(_ messageUniqueId: String) -> Bool { false } + func willShakeGift(_ messageUniqueId: String) -> Bool { false } - func cvc_willUnwrapGift(_ itemViewModel: CVItemViewModelImpl) {} + func willUnwrapGift(_ itemViewModel: CVItemViewModelImpl) {} - func cvc_didTapGiftBadge(_ itemViewModel: CVItemViewModelImpl, profileBadge: ProfileBadge, isExpired: Bool, isRedeemed: Bool) {} + func didTapGiftBadge(_ itemViewModel: CVItemViewModelImpl, profileBadge: ProfileBadge, isExpired: Bool, isRedeemed: Bool) {} - func cvc_prepareMessageDetailForInteractivePresentation(_ itemViewModel: CVItemViewModelImpl) {} + func prepareMessageDetailForInteractivePresentation(_ itemViewModel: CVItemViewModelImpl) {} - func cvc_beginCellAnimation(maximumDuration: TimeInterval) -> EndCellAnimation { + func beginCellAnimation(maximumDuration: TimeInterval) -> EndCellAnimation { return {} } @@ -383,58 +383,58 @@ extension MockConversationView: CVComponentDelegate { // MARK: - System Cell - func cvc_didTapPreviouslyVerifiedIdentityChange(_ address: SignalServiceAddress) {} + func didTapPreviouslyVerifiedIdentityChange(_ address: SignalServiceAddress) {} - func cvc_didTapUnverifiedIdentityChange(_ address: SignalServiceAddress) {} + func didTapUnverifiedIdentityChange(_ address: SignalServiceAddress) {} - func cvc_didTapInvalidIdentityKeyErrorMessage(_ message: TSInvalidIdentityKeyErrorMessage) {} + func didTapInvalidIdentityKeyErrorMessage(_ message: TSInvalidIdentityKeyErrorMessage) {} - func cvc_didTapCorruptedMessage(_ message: TSErrorMessage) {} + func didTapCorruptedMessage(_ message: TSErrorMessage) {} - func cvc_didTapSessionRefreshMessage(_ message: TSErrorMessage) {} + func didTapSessionRefreshMessage(_ message: TSErrorMessage) {} - func cvc_didTapResendGroupUpdateForErrorMessage(_ errorMessage: TSErrorMessage) {} + func didTapResendGroupUpdateForErrorMessage(_ errorMessage: TSErrorMessage) {} - func cvc_didTapShowFingerprint(_ address: SignalServiceAddress) {} + func didTapShowFingerprint(_ address: SignalServiceAddress) {} - func cvc_didTapIndividualCall(_ call: TSCall) {} + func didTapIndividualCall(_ call: TSCall) {} - func cvc_didTapGroupCall() {} + func didTapGroupCall() {} - func cvc_didTapPendingOutgoingMessage(_ message: TSOutgoingMessage) {} + func didTapPendingOutgoingMessage(_ message: TSOutgoingMessage) {} - func cvc_didTapFailedOutgoingMessage(_ message: TSOutgoingMessage) {} + func didTapFailedOutgoingMessage(_ message: TSOutgoingMessage) {} - func cvc_didTapShowGroupMigrationLearnMoreActionSheet(infoMessage: TSInfoMessage, - oldGroupModel: TSGroupModel, - newGroupModel: TSGroupModel) {} + func didTapShowGroupMigrationLearnMoreActionSheet(infoMessage: TSInfoMessage, + oldGroupModel: TSGroupModel, + newGroupModel: TSGroupModel) {} - func cvc_didTapGroupInviteLinkPromotion(groupModel: TSGroupModel) {} + func didTapGroupInviteLinkPromotion(groupModel: TSGroupModel) {} - func cvc_didTapViewGroupDescription(groupModel: TSGroupModel?) {} + func didTapViewGroupDescription(groupModel: TSGroupModel?) {} - func cvc_didTapShowConversationSettings() {} + func didTapShowConversationSettings() {} - func cvc_didTapShowConversationSettingsAndShowMemberRequests() {} + func didTapShowConversationSettingsAndShowMemberRequests() {} - func cvc_didTapBlockRequest( + func didTapBlockRequest( groupModel: TSGroupModelV2, requesterName: String, requesterUuid: UUID ) {} - func cvc_didTapShowUpgradeAppUI() {} + func didTapShowUpgradeAppUI() {} - func cvc_didTapUpdateSystemContact(_ address: SignalServiceAddress, - newNameComponents: PersonNameComponents) {} + func didTapUpdateSystemContact(_ address: SignalServiceAddress, + newNameComponents: PersonNameComponents) {} - func cvc_didTapPhoneNumberChange(uuid: UUID, phoneNumberOld: String, phoneNumberNew: String) {} + func didTapPhoneNumberChange(uuid: UUID, phoneNumberOld: String, phoneNumberNew: String) {} - func cvc_didTapViewOnceAttachment(_ interaction: TSInteraction) {} + func didTapViewOnceAttachment(_ interaction: TSInteraction) {} - func cvc_didTapViewOnceExpired(_ interaction: TSInteraction) {} + func didTapViewOnceExpired(_ interaction: TSInteraction) {} - func cvc_didTapUnknownThreadWarningGroup() {} - func cvc_didTapUnknownThreadWarningContact() {} - func cvc_didTapDeliveryIssueWarning(_ message: TSErrorMessage) {} + func didTapUnknownThreadWarningGroup() {} + func didTapUnknownThreadWarningContact() {} + func didTapDeliveryIssueWarning(_ message: TSErrorMessage) {} }