Skip to main content

Report

Overview

The LMFeedReportScreen is designed to allow users to report content by selecting a reason from a list of tags or providing a custom reason via a text view. It supports displaying a collection view of tags, a text view for custom reasons, and a submit button to initiate the report process.

LMFeedReportContentScreen

UI Components

  • containerScrollView: A scroll view that contains the stackView.
  • stackView: A vertical stack view that arranges the title label, subtitle label, collection view, text view, and separator view.
  • titleLabel: A label displaying the main title.
  • subtitleLabel: A label displaying a subtitle or instructions.
  • reportCollectionView: A collection view that displays the list of report tags.
  • otherReasonTextView: A text view for users to enter a custom reason.
  • separatorView: A separator view between the collection view and text view.
  • submitButton: A button to submit the report.

Data Variables

  • textInputHeight: The height of the otherReasonTextView.
  • tagsData: An array of tuples containing the tag name and tag ID.
  • selectedTag: The ID of the currently selected tag.
  • placeholderText: The placeholder text for the otherReasonTextView.

Methods

  • setupButton(isEnabled: Bool): Enables or disables the submitButton based on the provided boolean value.
  • didTapSubmitButton(): Called when the submitButton is tapped. It checks if a tag is selected and either reports the content with a custom reason (if the "Other" tag is selected) or without a reason.
  • keyboardWillShow(): Adjusts the containerScrollView content inset to accommodate the keyboard.
  • keyboardWillHide(): Resets the containerScrollView content inset when the keyboard is hidden.

Customization

CustomReportContentScreen.swift
class CustomReportContentScreen: LMFeedReportContentScreen {
override func setupAppearance() {
super.setupAppearance()
collectionView.backgroundColor = .lightGray
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
Components.shared.reportContentScreen = CustomReportContentScreen.self
// ...
return true
}