diff --git a/Sources/StreamChatSwiftUI/ChatChannel/Composer/ComposerConfig.swift b/Sources/StreamChatSwiftUI/ChatChannel/Composer/ComposerConfig.swift index cb55c353f..20cd8a4be 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/Composer/ComposerConfig.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/Composer/ComposerConfig.swift @@ -18,15 +18,6 @@ public struct ComposerConfig { public var adjustMessageOnSend: (String) -> (String) public var adjustMessageOnRead: (String) -> (String) - @available( - *, - deprecated, - message: """ - Override the MessageComposerViewModel.inputAttachmentsAsPayloads() in order to convert the message attachments to payloads. - """ - ) - public var attachmentPayloadConverter: (ChatMessage) -> [AnyAttachmentPayload] - public init( isVoiceRecordingEnabled: Bool = false, inputViewMinHeight: CGFloat = 38, @@ -37,9 +28,7 @@ public struct ComposerConfig { maxGalleryAssetsCount: Int? = nil, inputPaddingsConfig: PaddingsConfig = .composerInput, adjustMessageOnSend: @escaping (String) -> (String) = { $0 }, - adjustMessageOnRead: @escaping (String) -> (String) = { $0 }, - attachmentPayloadConverter: @escaping (ChatMessage) -> [AnyAttachmentPayload] - = ComposerConfig.defaultAttachmentPayloadConverter + adjustMessageOnRead: @escaping (String) -> (String) = { $0 } ) { self.inputViewMinHeight = inputViewMinHeight self.inputViewMaxHeight = inputViewMaxHeight @@ -47,17 +36,11 @@ public struct ComposerConfig { self.inputFont = inputFont self.adjustMessageOnSend = adjustMessageOnSend self.adjustMessageOnRead = adjustMessageOnRead - self.attachmentPayloadConverter = attachmentPayloadConverter self.gallerySupportedTypes = gallerySupportedTypes self.maxGalleryAssetsCount = maxGalleryAssetsCount self.inputPaddingsConfig = inputPaddingsConfig self.isVoiceRecordingEnabled = isVoiceRecordingEnabled } - - public nonisolated(unsafe) static var defaultAttachmentPayloadConverter: (ChatMessage) -> [AnyAttachmentPayload] = { _ in - /// This now returns empty array by default since attachmentPayloadConverter has been deprecated. - [] - } } public enum GallerySupportedTypes { diff --git a/Sources/StreamChatSwiftUI/ChatChannel/Composer/MessageComposerViewModel.swift b/Sources/StreamChatSwiftUI/ChatChannel/Composer/MessageComposerViewModel.swift index ff5c65d95..f6f058eea 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/Composer/MessageComposerViewModel.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/Composer/MessageComposerViewModel.swift @@ -731,16 +731,10 @@ import SwiftUI cid: channelId, messageId: message.id ) - - var newAttachments = attachments ?? [] - let fallbackAttachments = utils.composerConfig.attachmentPayloadConverter(message) - if !fallbackAttachments.isEmpty { - newAttachments = fallbackAttachments - } - + messageController.editMessage( text: adjustedText, - attachments: newAttachments + attachments: attachments ?? [] ) { [weak self] error in if error != nil { self?.errorShown = true diff --git a/Sources/StreamChatSwiftUI/ChatChannel/Composer/PhotoAssetsUtils.swift b/Sources/StreamChatSwiftUI/ChatChannel/Composer/PhotoAssetsUtils.swift index 59285afd8..7fe7b9948 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/Composer/PhotoAssetsUtils.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/Composer/PhotoAssetsUtils.swift @@ -111,7 +111,7 @@ public extension PHAsset { } } -extension PHAsset: Identifiable { +extension PHAsset: @retroactive Identifiable { public var id: String { localIdentifier } diff --git a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListView.swift b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListView.swift index d221f6c33..86468e82c 100644 --- a/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListView.swift +++ b/Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListView.swift @@ -116,7 +116,7 @@ public struct MessageListView: View, KeyboardReadable { factory: Factory = DefaultViewFactory.shared, channel: ChatChannel, viewModel: ChatChannelViewModel, - onLongPress: @escaping (MessageDisplayInfo) -> Void = { _ in } + onLongPress: @escaping @MainActor (MessageDisplayInfo) -> Void = { _ in } ) { self.init( factory: factory, diff --git a/Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListItem.swift b/Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListItem.swift index a4dac2fcc..d642de8bc 100644 --- a/Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListItem.swift +++ b/Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListItem.swift @@ -204,12 +204,6 @@ public struct ChannelAvatarView: View { @State private var channelAvatar = UIImage() let channel: ChatChannel? - @available( - *, - deprecated, - renamed: "init(channel:showOnlineIndicator:size:)", - message: "Use automatically refreshing avatar initializer." - ) public init( avatar: UIImage, showOnlineIndicator: Bool, diff --git a/Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListViewModel.swift b/Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListViewModel.swift index cd7cae8ac..5dab724ce 100644 --- a/Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListViewModel.swift +++ b/Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListViewModel.swift @@ -634,13 +634,13 @@ public func notifyHideTabBar() { } /// Enum for the type of alert presented in the channel list view. -public enum ChannelAlertType { +public enum ChannelAlertType: Equatable { case deleteChannel(ChatChannel) case error } /// Enum describing the type of the custom popup for channel actions. -public enum ChannelPopupType { +public enum ChannelPopupType: Equatable { /// Shows the 'more actions' popup. case moreActions(ChatChannel) } diff --git a/Sources/StreamChatSwiftUI/StreamNuke/Nuke/Caching/NukeCache.swift b/Sources/StreamChatSwiftUI/StreamNuke/Nuke/Caching/NukeCache.swift index 8332af026..323255db9 100644 --- a/Sources/StreamChatSwiftUI/StreamNuke/Nuke/Caching/NukeCache.swift +++ b/Sources/StreamChatSwiftUI/StreamNuke/Nuke/Caching/NukeCache.swift @@ -9,7 +9,7 @@ import UIKit.UIApplication #endif // Internal memory-cache implementation. -final class NukeCache: @unchecked Sendable { +final class NukeCache: @unchecked Sendable { // Can't use `NSCache` because it is not LRU struct Configuration { diff --git a/Sources/StreamChatSwiftUI/Utils/Common/ChatClient+Extensions.swift b/Sources/StreamChatSwiftUI/Utils/Common/ChatClient+Extensions.swift index f56edc6f7..06f33ea2f 100644 --- a/Sources/StreamChatSwiftUI/Utils/Common/ChatClient+Extensions.swift +++ b/Sources/StreamChatSwiftUI/Utils/Common/ChatClient+Extensions.swift @@ -23,7 +23,11 @@ extension ChatClient { if let maxAttachmentSize, maxAttachmentSize > 0 { return maxAttachmentSize } else { - return config.maxAttachmentSize + if let customCDNClient = config.customCDNClient { + return type(of: customCDNClient).maxAttachmentSize + } else { + return 100 * 1024 * 1024 + } } } } diff --git a/StreamChatSwiftUITests/Tests/ChatChannelList/ChatChannelListTestHelpers.swift b/StreamChatSwiftUITests/Tests/ChatChannelList/ChatChannelListTestHelpers.swift index 0c5bc7310..f44e6b53c 100644 --- a/StreamChatSwiftUITests/Tests/ChatChannelList/ChatChannelListTestHelpers.swift +++ b/StreamChatSwiftUITests/Tests/ChatChannelList/ChatChannelListTestHelpers.swift @@ -8,29 +8,3 @@ import UIKit /// The default view controller size. Simulates an iPhone in portrait mode. let defaultScreenSize = CGSize(width: 360, height: 700) - -extension ChannelAlertType: Equatable { - public static func == (lhs: ChannelAlertType, rhs: ChannelAlertType) -> Bool { - if case let .deleteChannel(channel1) = lhs, - case let .deleteChannel(channel2) = rhs { - return channel1 == channel2 - } - - if case .error = lhs, case .error = rhs { - return true - } - - return false - } -} - -extension ChannelPopupType: Equatable { - public static func == (lhs: ChannelPopupType, rhs: ChannelPopupType) -> Bool { - if case let .moreActions(channel1) = lhs, - case let .moreActions(channel2) = rhs { - return channel1 == channel2 - } - - return false - } -} diff --git a/StreamChatSwiftUITests/Tests/Utils/ViewFactory_Tests.swift b/StreamChatSwiftUITests/Tests/Utils/ViewFactory_Tests.swift index f613f9493..5548eaa70 100644 --- a/StreamChatSwiftUITests/Tests/Utils/ViewFactory_Tests.swift +++ b/StreamChatSwiftUITests/Tests/Utils/ViewFactory_Tests.swift @@ -1157,7 +1157,7 @@ import XCTest } } -extension ChannelAction: Equatable { +extension ChannelAction: @retroactive Equatable { public static func == (lhs: ChannelAction, rhs: ChannelAction) -> Bool { lhs.id == rhs.id }