Skip to main content

Notification

Overview

The LMFeedNotificationFeedScreen is designed to present a list of notifications to the user. Users can pull to refresh the list of notifications, and the screen shows an empty state view when there are no notifications to display. It supports navigating to different parts of the app based on the notification's content.

LMFeedNotificationScreen

UI Components

  • notificationListView: A LMTableView used to display notifications
  • refreshControl: UIRefreshControl for tableView
  • emptyNotificationView: An instance of LMFeedEmptyNotificationView to show when there are no notifications to view.

Data Variables

  • notificationData: An array of notifications cell data

Methods

  • pullToRefresh(): Triggers a refresh of the notifications list.
  • navigateToPost(from:): Handles navigation to a specific post based on a given route. This method takes a String route as input and uses LMFeedRouter to fetch the corresponding view controller. If successful, it pushes the view controller onto the navigation stack.
  • showHideLoaderView(isShow: Bool, backgroundColor: UIColor): Controls the visibility of the loading indicator. When isShow is true, it starts the refreshControl animation. When isShow is false, it stops the refreshControl animation.

Customisation

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