Skip to main content

Reaction Sheet

Overview

The LMChatReactionViewController is a customizable view controller responsible for displaying and managing a bottom sheet of reaction options for chat messages. It provides a user interface for viewing and interacting with message reactions within a chat application.

Functionality

Protocols

LMReactionViewControllerDelegate

  • reactionDeleted(chatroomId:conversationId:): Called when a reaction is deleted.

UI Components

  • containerView: A LMView that serves as the main container for the bottom sheet.
  • dimmedView: A LMView that provides a dimmed background when the bottom sheet is presented.
  • tableView: A LMTableView that displays the reaction emojis and their counts.
  • collectionView: A LMCollectionView that shows reaction categories or filters.
  • titleLabel: A LMLabel displaying the title "Reactions".
  • bottomLine: A LMView that serves as a separator between the collection view and table view.

Properties

  • delegate: A weak reference to an object conforming to LMReactionViewControllerDelegate.
  • titleData: An array of LMChatReactionTitleCell.ContentModel for the collection view.
  • emojiData: An array of LMChatReactionViewCell.ContentModel for the table view.

Methods

  • animatePresentContainer(): Animates the presentation of the container view.
  • animateShowDimmedView(): Animates the appearance of the dimmed background.
  • didTapDimmedView(): Dismisses the view controller when the dimmed area is tapped.

Customization

class CustomReactionViewController: LMChatReactionViewController {
override func setupViews() {
super.setupViews()
containerView.backgroundColor = .systemBackground
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
LMUIComponents.shared.reactionListScreen = CustomReactionViewController.self
// ...
return true
}