Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -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,
Expand All @@ -37,27 +28,19 @@ 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
self.inputViewCornerRadius = inputViewCornerRadius
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public extension PHAsset {
}
}

extension PHAsset: Identifiable {
extension PHAsset: @retroactive Identifiable {
public var id: String {
localIdentifier
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public struct MessageListView<Factory: ViewFactory>: 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,6 @@ public struct ChannelAvatarView: View {
@State private var channelAvatar = UIImage()
let channel: ChatChannel?

@available(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took this deprecation away after seeing that we use it for non-channels as well (channel members which use this init).

*,
deprecated,
renamed: "init(channel:showOnlineIndicator:size:)",
message: "Use automatically refreshing avatar initializer."
)
public init(
avatar: UIImage,
showOnlineIndicator: Bool,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import UIKit.UIApplication
#endif

// Internal memory-cache implementation.
final class NukeCache<Key: Hashable, Value>: @unchecked Sendable {
final class NukeCache<Key: Hashable & Sendable, Value>: @unchecked Sendable {
// Can't use `NSCache` because it is not LRU

struct Configuration {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Loading