Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ public struct WireCellsFactory {
)
}

public func makeDeleteNodesUseCase() -> any WireCellsDeleteNodesUseCaseProtocol {
WireCellsDeleteNodesUseCase(
repository: nodesAPI,
fileCache: fileCache,
localAssetStore: localAssetStore
)
}

}

public extension WireCellsFactory {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// Wire
// Copyright (C) 2025 Wire Swiss GmbH
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//

public import Foundation

public protocol WireCellsDeleteNodesUseCaseProtocol: Sendable {

func invoke(nodeIDs: [UUID]) async throws

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ package enum WireCellsDeleteNodesError: Error {
}

/// Deletes `WireCellNodes`s from both the server and locally cached data.
package struct WireCellsDeleteNodesUseCase: Sendable {
package struct WireCellsDeleteNodesUseCase: WireCellsDeleteNodesUseCaseProtocol {

private let repository: any WireCellsNodesRepositoryProtocol
private let fileCache: any FileCache
Expand Down
18 changes: 18 additions & 0 deletions wire-ios/Tests/Sourcery/generated/AutoMockable.generated.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions wire-ios/Wire-iOS Tests/ArticleViewTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ final class MockConversationMessageCellDelegate: ConversationMessageCellDelegate
) {
// no-op
}

func conversationMessageWantsToDeleteFiles(
_ attachments: [WireDataModel.MultipartMessageData.Attachment],
for multipartMessage: any WireDataModel.ZMConversationMessage,
deletionType: Wire.DeletionType
) {
// no-op
}
}

// MARK: - MockArticleViewDelegate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ final class ConversationContentViewControllerTests: XCTestCase, CoreDataFixtureT

// create deletionDialogPresenter
let message = MockMessageFactory.textMessage(withText: "test")
sut.messageAction(actionId: .delete, for: message, view: view)
sut.messageAction(actionId: .delete(), for: message, view: view)

try verify(matching: sut.deletionDialogPresenter!.deleteAlert(
message: mockMessage,
sourceView: view,
userSession: userSession
) { _ in })
) { _, _ in })
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ extension CollectionsViewController: CollectionCellDelegate {
forMessage: message,
source: source,
userSession: userSession
) { [weak self] deleted in
) { [weak self] deleted, _ in
guard deleted else { return }
_ = self?.navigationController?.popViewController(animated: true)
self?.refetchCollection()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
options: [:]
)
var buttonsBar: InputBarButtonsView!
lazy var deleteButton = iconButton(messageAction: .delete)
lazy var deleteButton = iconButton(messageAction: .delete())
let overlay = FeedbackOverlayView()
let separator: UIView = {
let view = UIView()
Expand Down Expand Up @@ -286,7 +286,7 @@

let emojiSketchButton = iconButton(messageAction: .sketchEmoji)

let revealButton = iconButton(messageAction: .showInConversation)

Check warning on line 289 in wire-ios/Wire-iOS/Sources/UserInterface/Collections/ConversationImagesViewController.swift

View workflow job for this annotation

GitHub Actions / Test Results

'shared()' is deprecated: This shared instance has been deprecated. Don't use it.

'shared()' is deprecated: This shared instance has been deprecated. Don't use it.
if !MediaShareRestrictionManager(sessionRestriction: ZMUserSession.shared()).canDownloadMedia {
buttons = [sketchButton, emojiSketchButton, revealButton]
} else {
Expand Down Expand Up @@ -444,7 +444,7 @@

@objc
func deleteCurrent(_ sender: AnyObject!) {
perform(action: .delete, sender: sender)
perform(action: .delete(), sender: sender)
}

@objc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@
@objc
private func didTapBackground(_ tapper: UITapGestureRecognizer?) {
isShowingChrome = !isShowingChrome
setSelectedByMenu(false, animated: false)

Check warning on line 604 in wire-ios/Wire-iOS/Sources/UserInterface/Components/Controllers/FullscreenImageViewController.swift

View workflow job for this annotation

GitHub Actions / Test Results

'UIMenuController' was deprecated in iOS 16.0: UIMenuController is deprecated. Use UIEditMenuInteraction instead.

'UIMenuController' was deprecated in iOS 16.0: UIMenuController is deprecated. Use UIEditMenuInteraction instead.
UIMenuController.shared.hideMenu()
delegate?.fadeAndHideMenu(delegate?.menuVisible == false)
}
Expand All @@ -612,11 +612,11 @@

NotificationCenter.default.addObserver(
self,
selector: #selector(menuDidHide(_:)),

Check warning on line 615 in wire-ios/Wire-iOS/Sources/UserInterface/Components/Controllers/FullscreenImageViewController.swift

View workflow job for this annotation

GitHub Actions / Test Results

'UIMenuController' was deprecated in iOS 16.0: UIMenuController is deprecated. Use UIEditMenuInteraction instead.

'UIMenuController' was deprecated in iOS 16.0: UIMenuController is deprecated. Use UIEditMenuInteraction instead.

Check warning on line 615 in wire-ios/Wire-iOS/Sources/UserInterface/Components/Controllers/FullscreenImageViewController.swift

View workflow job for this annotation

GitHub Actions / Test Results

'didHideMenuNotification' was deprecated in iOS 16.0: UIMenuController is deprecated. Use UIEditMenuInteraction instead.

'didHideMenuNotification' was deprecated in iOS 16.0: UIMenuController is deprecated. Use UIEditMenuInteraction instead.
name: UIMenuController.didHideMenuNotification,
object: nil
)

Check warning on line 619 in wire-ios/Wire-iOS/Sources/UserInterface/Components/Controllers/FullscreenImageViewController.swift

View workflow job for this annotation

GitHub Actions / Test Results

'UIMenuController' was deprecated in iOS 16.0: UIMenuController is deprecated. Use UIEditMenuInteraction instead.

'UIMenuController' was deprecated in iOS 16.0: UIMenuController is deprecated. Use UIEditMenuInteraction instead.
let menuController = UIMenuController.shared
menuController.menuItems = ConversationMessageActionController.allMessageActions

Expand All @@ -629,7 +629,7 @@
setSelectedByMenu(true, animated: true)
}

private func hideMenu() {

Check warning on line 632 in wire-ios/Wire-iOS/Sources/UserInterface/Components/Controllers/FullscreenImageViewController.swift

View workflow job for this annotation

GitHub Actions / Test Results

'UIMenuController' was deprecated in iOS 16.0: UIMenuController is deprecated. Use UIEditMenuInteraction instead.

'UIMenuController' was deprecated in iOS 16.0: UIMenuController is deprecated. Use UIEditMenuInteraction instead.
UIMenuController.shared.hideMenu()
}

Expand Down Expand Up @@ -766,7 +766,7 @@
}

@objc
private func menuDidHide(_ notification: Notification?) {

Check warning on line 769 in wire-ios/Wire-iOS/Sources/UserInterface/Components/Controllers/FullscreenImageViewController.swift

View workflow job for this annotation

GitHub Actions / Test Results

'UIMenuController' was deprecated in iOS 16.0: UIMenuController is deprecated. Use UIEditMenuInteraction instead.

'UIMenuController' was deprecated in iOS 16.0: UIMenuController is deprecated. Use UIEditMenuInteraction instead.

Check warning on line 769 in wire-ios/Wire-iOS/Sources/UserInterface/Components/Controllers/FullscreenImageViewController.swift

View workflow job for this annotation

GitHub Actions / Test Results

'didHideMenuNotification' was deprecated in iOS 16.0: UIMenuController is deprecated. Use UIEditMenuInteraction instead.

'didHideMenuNotification' was deprecated in iOS 16.0: UIMenuController is deprecated. Use UIEditMenuInteraction instead.
NotificationCenter.default.removeObserver(self, name: UIMenuController.didHideMenuNotification, object: nil)
setSelectedByMenu(false, animated: true)
}
Expand Down Expand Up @@ -805,7 +805,7 @@

// iPad popover points to delete button of container is availible. The scrollView occupies most of the
// screen area and the popover is compressed.
= if action == .delete,
= if action == .delete(),
let conversationImagesViewController = delegate as? ConversationImagesViewController {
conversationImagesViewController.deleteButton
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
}

func messageToolboxViewDidSelectDelete(_ sender: UIView?) {
perform(action: .delete, sender: sender)
perform(action: .delete(), sender: sender)
}

func messageToolboxViewDidSelectResend(_ messageToolboxView: MessageToolboxView) {
Expand Down Expand Up @@ -131,7 +131,7 @@
weak var delegate: ConversationMessageCellDelegate?
weak var actionController: ConversationMessageActionController?

let containsHighlightableContent: Bool = false

Check warning on line 134 in wire-ios/Wire-iOS/Sources/UserInterface/Conversation/Content/Cells/ConfigurationMessageCell/Components/ConversationMessageToolboxCell.swift

View workflow job for this annotation

GitHub Actions / Test Results

'shared()' is deprecated: This shared instance has been deprecated. Don't use it.

'shared()' is deprecated: This shared instance has been deprecated. Don't use it.
lazy var shouldAlignMessageContentForBubbles: Bool = ZMUserSession.shared()?.isChatBubbleSimpleEnabled ?? false

let accessibilityIdentifier: String? = "MessageToolbox"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ final class ConversationMultipartMessageCell: UIView, ConversationMessageCell {

struct Configuration {
var attachments: [MultipartMessageData.Attachment]
var onDeletion: (DeletionType) -> Void
}

private var containerView = UIView()
weak var delegate: ConversationMessageCellDelegate?
weak var message: ZMConversationMessage?
weak var actionController: ConversationMessageActionController?

var onDeletion: ((DeletionType) -> Void)?
var isSelected: Bool = false

override init(frame: CGRect) {
Expand Down Expand Up @@ -83,6 +84,8 @@ final class ConversationMultipartMessageCell: UIView, ConversationMessageCell {
with object: Configuration,
animated: Bool
) {
onDeletion = object.onDeletion

let attachments = object.attachments.map {
WireCellsMessageAttachment(
nodeID: $0.nodeID,
Expand Down Expand Up @@ -139,12 +142,15 @@ final class ConversationMultipartMessageCellDescription: ConversationMessageCell

let accessibilityIdentifier: String? = nil
let accessibilityLabel: String? = nil
var supportsActions: Bool = true

init(
multipartMessage: MultipartMessageData
multipartMessage: MultipartMessageData,
onDeletion: @escaping (DeletionType) -> Void
) {
self.configuration = View.Configuration(
attachments: multipartMessage.attachments
attachments: multipartMessage.attachments,
onDeletion: onDeletion
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
struct Configuration: Equatable {
var attachment: LinkAttachment
var thumbnailResource: WireImageResource?
var onDeletion: ((DeletionType) -> Void)?

static func == (lhs: Configuration, rhs: Configuration) -> Bool {
lhs.attachment == rhs.attachment &&
Expand All @@ -50,6 +51,7 @@
var isSelected: Bool = false
var currentAttachment: LinkAttachment?
var attachmentViewHeightRatioConstraint: NSLayoutConstraint?
var onDeletion: ((DeletionType) -> Void)?

// MARK: - Initialization

Expand Down Expand Up @@ -96,7 +98,7 @@
bottomAnchor.constraint(equalTo: attachmentView.bottomAnchor),
widthConstraint
])

Check warning on line 101 in wire-ios/Wire-iOS/Sources/UserInterface/Conversation/Content/Cells/ConfigurationMessageCell/Content/Text/ConversationLinkAttachmentCell.swift

View workflow job for this annotation

GitHub Actions / Test Results

'shared()' is deprecated: This shared instance has been deprecated. Don't use it.

'shared()' is deprecated: This shared instance has been deprecated. Don't use it.
if ZMUserSession.shared()?.isChatBubbleSimpleEnabled ?? false {
NSLayoutConstraint.activate(chatBubbleConstraints)
} else {
Expand All @@ -118,6 +120,7 @@
// MARK: - Configuration

func configure(with object: Configuration, animated: Bool) {
onDeletion = object.onDeletion
currentAttachment = object.attachment
attachmentView.titleLabel.text = object.attachment.title
attachmentView.previewImageView.setImageResource(object.thumbnailResource, hideLoadingView: true)
Expand Down Expand Up @@ -180,14 +183,22 @@
weak var actionController: ConversationMessageActionController?

let supportsActions: Bool = true
let containsHighlightableContent: Bool = true

Check warning on line 186 in wire-ios/Wire-iOS/Sources/UserInterface/Conversation/Content/Cells/ConfigurationMessageCell/Content/Text/ConversationLinkAttachmentCell.swift

View workflow job for this annotation

GitHub Actions / Test Results

'shared()' is deprecated: This shared instance has been deprecated. Don't use it.

'shared()' is deprecated: This shared instance has been deprecated. Don't use it.
lazy var shouldAlignMessageContentForBubbles: Bool = ZMUserSession.shared()?.isChatBubbleSimpleEnabled ?? false

let accessibilityIdentifier: String? = nil
let accessibilityLabel: String? = nil

init(attachment: LinkAttachment, thumbnailResource: WireImageResource?) {
self.configuration = View.Configuration(attachment: attachment, thumbnailResource: thumbnailResource)
init(
attachment: LinkAttachment,
thumbnailResource: WireImageResource?,
onDeletion: ((DeletionType) -> Void)? = nil
) {
self.configuration = View.Configuration(
attachment: attachment,
thumbnailResource: thumbnailResource,
onDeletion: onDeletion
)
self.actionController = nil
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
let showImage: Bool
var message: ZMConversationMessage
var isObfuscated: Bool
let onDeletion: ((DeletionType) -> Void)?

static func == (lhs: Configuration, rhs: Configuration) -> Bool {
lhs.message == rhs.message &&
Expand All @@ -50,6 +51,7 @@
}

var configuration: Configuration?
var onDeletion: ((DeletionType) -> Void)?

override init(frame: CGRect) {
super.init(frame: frame)
Expand All @@ -69,7 +71,7 @@
}

private func configureConstraints() {
let margins = conversationHorizontalMargins

Check warning on line 74 in wire-ios/Wire-iOS/Sources/UserInterface/Conversation/Content/Cells/ConfigurationMessageCell/Content/Text/ConversationLinkPreviewArticleCell.swift

View workflow job for this annotation

GitHub Actions / Test Results

'shared()' is deprecated: This shared instance has been deprecated. Don't use it.

'shared()' is deprecated: This shared instance has been deprecated. Don't use it.
let insets: UIEdgeInsets = ZMUserSession.shared()?.isChatBubbleSimpleEnabled ?? false
? .zero
: UIEdgeInsets(top: 0, left: margins.left, bottom: 0, right: margins.right)
Expand All @@ -77,6 +79,7 @@
}

func configure(with object: Configuration, animated: Bool) {
onDeletion = object.onDeletion
configuration = object
articleView.configure(
withTextMessageData: object.textMessageData,
Expand Down Expand Up @@ -128,7 +131,7 @@
var bottomMargin: CGFloat = 0

let supportsActions: Bool = true
let containsHighlightableContent: Bool = true

Check warning on line 134 in wire-ios/Wire-iOS/Sources/UserInterface/Conversation/Content/Cells/ConfigurationMessageCell/Content/Text/ConversationLinkPreviewArticleCell.swift

View workflow job for this annotation

GitHub Actions / Test Results

'shared()' is deprecated: This shared instance has been deprecated. Don't use it.

'shared()' is deprecated: This shared instance has been deprecated. Don't use it.
lazy var shouldAlignMessageContentForBubbles: Bool = ZMUserSession.shared()?.isChatBubbleSimpleEnabled ?? false

var accessibilityIdentifier: String? {
Expand All @@ -137,14 +140,15 @@

let accessibilityLabel: String?

init(message: ZMConversationMessage, data: TextMessageData) {
init(message: ZMConversationMessage, data: TextMessageData, onDeletion: ((DeletionType) -> Void)?) {
let showImage = data.linkPreviewHasImage
self.configuration = View
.Configuration(
textMessageData: data,
showImage: showImage,
message: message,
isObfuscated: message.isObfuscated
isObfuscated: message.isObfuscated,
onDeletion: onDeletion
)
self.accessibilityLabel = L10n.Accessibility.ConversationSearch.LinkMessage.description
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

var quotedMessage: ZMConversationMessage?
let accentColor: AccentColor
let onDeletion: ((DeletionType) -> Void)?

static func == (lhs: Configuration, rhs: Configuration) -> Bool {
lhs.accentColor == rhs.accentColor &&
Expand Down Expand Up @@ -304,6 +305,8 @@
weak var message: ZMConversationMessage?
weak var actionController: ConversationMessageActionController?

var onDeletion: ((DeletionType) -> Void)?

override init(frame: CGRect) {
self.contentView = ConversationReplyContentView()
self.container = ReplyRoundCornersView(containedView: contentView)
Expand All @@ -324,7 +327,7 @@
}

private func configureConstraints() {
let margins = conversationHorizontalMargins

Check warning on line 330 in wire-ios/Wire-iOS/Sources/UserInterface/Conversation/Content/Cells/ConfigurationMessageCell/Content/Text/ConversationQuoteCell.swift

View workflow job for this annotation

GitHub Actions / Test Results

'shared()' is deprecated: This shared instance has been deprecated. Don't use it.

'shared()' is deprecated: This shared instance has been deprecated. Don't use it.
let insets: UIEdgeInsets = ZMUserSession.shared()?.isChatBubbleSimpleEnabled ?? false
? .zero
: UIEdgeInsets(top: 0, left: margins.left, bottom: 0, right: margins.right)
Expand All @@ -332,6 +335,7 @@
}

func configure(with object: Configuration, animated: Bool) {
onDeletion = object.onDeletion
contentView.configure(with: object)
}

Expand All @@ -352,7 +356,7 @@
var bottomMargin: CGFloat = 0

let supportsActions = false
let containsHighlightableContent: Bool = true

Check warning on line 359 in wire-ios/Wire-iOS/Sources/UserInterface/Conversation/Content/Cells/ConfigurationMessageCell/Content/Text/ConversationQuoteCell.swift

View workflow job for this annotation

GitHub Actions / Test Results

'shared()' is deprecated: This shared instance has been deprecated. Don't use it.

'shared()' is deprecated: This shared instance has been deprecated. Don't use it.
lazy var shouldAlignMessageContentForBubbles: Bool = ZMUserSession.shared()?.isChatBubbleSimpleEnabled ?? false

weak var message: ZMConversationMessage? {
Expand All @@ -369,11 +373,12 @@
let accessibilityLabel: String? = L10n.Localizable.Content.Message.originalLabel
let accessibilityIdentifier: String? = "ReplyCell"

init(quotedMessage: ZMConversationMessage?, accentColor: AccentColor) {
init(quotedMessage: ZMConversationMessage?, accentColor: AccentColor, onDeletion: ((DeletionType) -> Void)? = nil) {
self.configuration = View
.Configuration(
quotedMessage: quotedMessage,
accentColor: accentColor
accentColor: accentColor,
onDeletion: onDeletion
)
}
}
Expand Down
Loading
Loading