Skip to main content

Gallery Content View

Overview

The LMChatGalleryContentView is a specialized view component for displaying gallery content within chat messages. It extends LMChatMessageContentView and integrates the LMChatMessageGallaryView to show multiple images or videos in a message bubble.

UI Components

  • galleryView: An instance of LMChatMessageGallaryView for displaying the gallery content.
  • cancelRetryContainerStackView: A container for cancel and retry buttons (inherited from superclass).
  • loaderView: A view to display loading state (inherited from superclass).
  • retryView: A view to display retry option for failed messages (inherited from superclass).

Methods

  • setDataView(_ data: LMChatMessageCell.ContentModel, index: IndexPath): Configures the view with message data.
  • attachmentView(_ data: LMChatMessageCell.ContentModel, index: IndexPath): Handles the display of attachments.
  • galleryPreview(_ attachments: [LMChatMessageListView.ContentModel.Attachment]): Prepares and displays the gallery preview.
  • updateRetryButton(_ data: LMChatMessageCell.ContentModel): Updates the visibility of loader and retry views based on message status.

Customization

CustomGalleryContentView.swift
class CustomGalleryContentView: LMChatGalleryContentView {
override func setDataView(_ data: LMChatMessageCell.ContentModel, index: IndexPath) {
super.setDataView(data, index: index)
// Customize data setting behavior
}

override func attachmentView(_ data: LMChatMessageCell.ContentModel, index: IndexPath) {
super.attachmentView(data, index: index)
// Customize attachment display logic
}
}
AppDelegate.swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
LMUIComponents.shared.galleryContentView = CustomGalleryContentView.self
// ...
return true
}