2020-09-23 01:00:56 +00:00
|
|
|
// Copyright © 2020 Metabolist. All rights reserved.
|
|
|
|
|
2020-10-30 07:11:24 +00:00
|
|
|
import UIKit
|
2020-09-23 01:00:56 +00:00
|
|
|
import ViewModels
|
|
|
|
|
2020-10-15 07:44:01 +00:00
|
|
|
extension CollectionItem {
|
2020-10-30 07:11:24 +00:00
|
|
|
static let cellClasses = [
|
|
|
|
StatusListCell.self,
|
|
|
|
AccountListCell.self,
|
|
|
|
LoadMoreCell.self,
|
2020-10-29 06:03:45 +00:00
|
|
|
NotificationListCell.self,
|
2021-01-24 03:12:30 +00:00
|
|
|
ConversationListCell.self,
|
|
|
|
TagTableViewCell.self]
|
2020-10-15 07:44:01 +00:00
|
|
|
|
2020-09-23 01:00:56 +00:00
|
|
|
var cellClass: AnyClass {
|
|
|
|
switch self {
|
|
|
|
case .status:
|
|
|
|
return StatusListCell.self
|
|
|
|
case .account:
|
|
|
|
return AccountListCell.self
|
2020-10-02 03:19:14 +00:00
|
|
|
case .loadMore:
|
|
|
|
return LoadMoreCell.self
|
2020-10-30 07:11:24 +00:00
|
|
|
case let .notification(_, statusConfiguration):
|
|
|
|
return statusConfiguration == nil ? NotificationListCell.self : StatusListCell.self
|
2020-10-29 06:03:45 +00:00
|
|
|
case .conversation:
|
|
|
|
return ConversationListCell.self
|
2021-01-24 03:12:30 +00:00
|
|
|
case .tag:
|
|
|
|
return TagTableViewCell.self
|
2020-09-23 01:00:56 +00:00
|
|
|
}
|
|
|
|
}
|
2021-01-19 00:46:38 +00:00
|
|
|
|
|
|
|
func estimatedHeight(width: CGFloat, identification: Identification) -> CGFloat {
|
|
|
|
switch self {
|
|
|
|
case let .status(status, configuration):
|
|
|
|
return StatusView.estimatedHeight(
|
|
|
|
width: width,
|
|
|
|
identification: identification,
|
|
|
|
status: status,
|
|
|
|
configuration: configuration)
|
2021-01-20 02:47:21 +00:00
|
|
|
case let .account(account):
|
|
|
|
return AccountView.estimatedHeight(width: width, account: account)
|
|
|
|
case .loadMore:
|
|
|
|
return LoadMoreView.estimatedHeight
|
|
|
|
case let .notification(notification, configuration):
|
|
|
|
return NotificationView.estimatedHeight(
|
|
|
|
width: width,
|
|
|
|
identification: identification,
|
|
|
|
notification: notification,
|
|
|
|
configuration: configuration)
|
|
|
|
case let .conversation(conversation):
|
|
|
|
return ConversationView.estimatedHeight(
|
|
|
|
width: width,
|
|
|
|
identification: identification,
|
|
|
|
conversation: conversation)
|
2021-01-24 03:12:30 +00:00
|
|
|
case let .tag(tag):
|
|
|
|
return TagView.estimatedHeight(width: width, tag: tag)
|
2021-01-19 00:46:38 +00:00
|
|
|
}
|
|
|
|
}
|
2020-09-23 01:00:56 +00:00
|
|
|
}
|