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.
UI Components
containerScrollView
: A scroll view that contains thestackView
.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.- Registered Cells: LMFeedReportItem
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 theotherReasonTextView
.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 theotherReasonTextView
.
Methods
setupButton(isEnabled: Bool)
: Enables or disables thesubmitButton
based on the provided boolean value.didTapSubmitButton()
: Called when thesubmitButton
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 thecontainerScrollView
content inset to accommodate the keyboard.keyboardWillHide()
: Resets thecontainerScrollView
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
}