2022-01-27 14:23:39 +01:00
//
// N o t i f i c a t i o n V i e w + V i e w M o d e l . s w i f t
// M a s t o d o n
//
// C r e a t e d b y M a i n a s u K o n 2 0 2 2 - 1 - 2 1 .
//
import UIKit
import CoreDataStack
extension NotificationTableViewCell {
final class ViewModel {
let value : Value
init ( value : Value ) {
self . value = value
}
enum Value {
case feed ( Feed )
}
}
}
extension NotificationTableViewCell {
func configure (
tableView : UITableView ,
viewModel : ViewModel ,
delegate : NotificationTableViewCellDelegate ?
) {
if notificationView . frame = = . zero {
// s e t s t a t u s v i e w w i d t h
2022-02-10 08:03:57 +01:00
notificationView . frame . size . width = tableView . frame . width - containerViewHorizontalMargin
2022-01-27 14:23:39 +01:00
logger . log ( level : . debug , " \( ( #file as NSString ) . lastPathComponent , privacy : . public ) [ \( #line , privacy : . public ) ], \( #function , privacy : . public ) : did layout for new cell " )
2022-02-10 08:03:57 +01:00
notificationView . statusView . frame . size . width = tableView . frame . width - containerViewHorizontalMargin
notificationView . quoteStatusView . frame . size . width = tableView . frame . width - StatusView . containerLayoutMargin . left - StatusView . containerLayoutMargin . right - containerViewHorizontalMargin
2022-01-27 14:23:39 +01:00
}
switch viewModel . value {
case . feed ( let feed ) :
notificationView . configure ( feed : feed )
}
2022-01-29 12:51:40 +01:00
//
2022-01-27 14:23:39 +01:00
self . delegate = delegate
}
}