Skip to content
Open
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 @@ -13,6 +13,7 @@ public struct ComposerConfig {
public var inputViewCornerRadius: CGFloat
public var inputFont: UIFont
public var gallerySupportedTypes: GallerySupportedTypes
public var maxGalleryAssetsCount: Int?
public var inputPaddingsConfig: PaddingsConfig
public var adjustMessageOnSend: (String) -> (String)
public var adjustMessageOnRead: (String) -> (String)
Expand All @@ -33,6 +34,7 @@ public struct ComposerConfig {
inputViewCornerRadius: CGFloat = 20,
inputFont: UIFont = UIFont.preferredFont(forTextStyle: .body),
gallerySupportedTypes: GallerySupportedTypes = .imagesAndVideo,
maxGalleryAssetsCount: Int? = nil,
inputPaddingsConfig: PaddingsConfig = .composerInput,
adjustMessageOnSend: @escaping (String) -> (String) = { $0 },
adjustMessageOnRead: @escaping (String) -> (String) = { $0 },
Expand All @@ -47,6 +49,7 @@ public struct ComposerConfig {
self.adjustMessageOnRead = adjustMessageOnRead
self.attachmentPayloadConverter = attachmentPayloadConverter
self.gallerySupportedTypes = gallerySupportedTypes
self.maxGalleryAssetsCount = maxGalleryAssetsCount
self.inputPaddingsConfig = inputPaddingsConfig
self.isVoiceRecordingEnabled = isVoiceRecordingEnabled
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,9 @@ open class MessageComposerViewModel: ObservableObject {
fetchOptions.predicate = predicate
}
fetchOptions.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: false)]
if let maxGalleryAssetsCount = utils.composerConfig.maxGalleryAssetsCount {
fetchOptions.fetchLimit = maxGalleryAssetsCount
}
let assets = PHAsset.fetchAssets(with: fetchOptions)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) { [weak self] in
self?.imageAssets = assets
Expand Down
Loading