Secret Chatroom Invite Cell
Overview
The LMChatHomeFeedSecretChatroomInviteCell
is a table view cell designed to display secret chatroom invites in the home feed. It presents essential chatroom details along with two action buttons: Accept and Reject. The cell leverages a delegate pattern to handle user interactions.
UI Components
chatroomView
: An instance of LMChatHomeFeedChatroomView that displays the chatroom details.sepratorView
: A separator view used for visual structuring.rejectButton
: A button to reject the chatroom invite.acceptButton
: A button to accept the chatroom invite.
Key Methods
configure(with:delegate:)
: Configures the cell with chatroom invite data and a delegate for handling user actions.setChatroomData(_:)
: Populates the UI elements with relevant invite details.didTapAcceptButton()
: Handles the tap action for the accept button.didTapRejectButton()
: Handles the tap action for the reject button.
Delegate Methods
The LMChatHomeFeedSecretChatroomInviteCellDelegate
protocol provides methods to handle user actions.
METHOD | DESCRIPTION |
---|---|
didTapAcceptButton(in data: ContentModel) | Called when the user taps the Accept button. |
didTapRejectButton(in data: ContentModel) | Called when the user taps the Reject button. |
Example Implementation:
class HomeFeedViewController: UIViewController, LMChatHomeFeedSecretChatroomInviteCellDelegate {
func didTapAcceptButton(in data: LMChatHomeFeedSecretChatroomInviteCell.ContentModel) {
print("Invite accepted for chatroom ID: \(data.chatroom.id)")
}
func didTapRejectButton(in data: LMChatHomeFeedSecretChatroomInviteCell.ContentModel) {
print("Invite rejected for chatroom ID: \(data.chatroom.id)")
}
}
Customization
CustomSecretChatroomInviteCell.swift
class CustomSecretChatroomInviteCell: LMChatHomeFeedSecretChatroomInviteCell {
override func setupViews() {
super.setupViews()
// Customize views if needed
}
override func setupAppearance() {
super.setupAppearance()
// Modify appearance of UI elements
sepratorView.backgroundColor = .lightGray
}
override func configure(with data: ContentModel, delegate: LMChatHomeFeedSecretChatroomInviteCellDelegate?) {
super.configure(with: data, delegate: delegate)
// Add additional customization
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
LMUIComponents.shared.homeFeedSecretChatroomInviteCell = CustomSecretChatroomInviteCell.self
// ...
return true
}
Models
ContentModel
A data model representing a secret chatroom invite.
VARIABLE | TYPE | DESCRIPTION | Optional |
---|---|---|---|
chatroom | ChatroomViewData | Data related to the chatroom associated with the invite. | |
createdAt | Int64 | Timestamp(in ms) when the invite was created. | |
id | Int | Unique identifier of the invite. | |
inviteStatus | Int | Status of the invite. | |
updatedAt | Int64 | Timestamp when the invite was last updated. | |
inviteSender | MemberViewData | User data of the invite sender. | |
inviteReceiver | MemberViewData | User Data of the invite receiver. |