session-ios/Session/Conversations/Message Cells/DateHeaderCell.swift
Morgan Pretty d0be7f786c Fixed a hang, removed redundant libs, files and code
Fixed an issue where returning the app from the background would result in the app staying permanently on the splash screen
Included a CRC32 implementation so we can drop the CryptoSwift dependenciy (using CryptoKit everywhere else)
Removed 'SocketRocket' (unused)
Removed the `xcode_14_3_workaround` post-install hook (fixed with CocoaPods 1.12.1)
Removed the `enable_fts5_support` post-install hook (enabled by default since GRDB 6.7.0 so redundant)
Removed the `enable_whole_module_optimization_for_crypto_swift` post-install hook (dropped CryptoSwift support)
Cleared out a bunch of headers from the Signal-Bridging-header file (direct imports instead to reduce incremental build sizes)
Deleted some unused code
2023-06-29 16:58:23 +10:00

56 lines
1.7 KiB
Swift

// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
import UIKit
import SignalUtilitiesKit
import SessionUtilitiesKit
import SessionMessagingKit
import SessionUIKit
final class DateHeaderCell: MessageCell {
// MARK: - UI
private lazy var dateLabel: UILabel = {
let result: UILabel = UILabel()
result.font = .boldSystemFont(ofSize: Values.verySmallFontSize)
result.themeTextColor = .textPrimary
result.textAlignment = .center
return result
}()
// MARK: - Lifecycle
override func setUpViewHierarchy() {
super.setUpViewHierarchy()
contentView.addSubview(dateLabel)
dateLabel.pin(.top, to: .top, of: contentView, withInset: Values.mediumSpacing)
dateLabel.pin(.leading, to: .leading, of: contentView)
dateLabel.pin(.trailing, to: .trailing, of: contentView)
dateLabel.pin(.bottom, to: .bottom, of: contentView, withInset: -Values.smallSpacing)
}
// MARK: - Updating
override func prepareForReuse() {
super.prepareForReuse()
dateLabel.text = ""
}
override func update(
with cellViewModel: MessageViewModel,
mediaCache: NSCache<NSString, AnyObject>,
playbackInfo: ConversationViewModel.PlaybackInfo?,
showExpandedReactions: Bool,
lastSearchText: String?
) {
guard cellViewModel.cellType == .dateHeader else { return }
dateLabel.text = cellViewModel.dateForUI.formattedForDisplay
}
override func dynamicUpdate(with cellViewModel: MessageViewModel, playbackInfo: ConversationViewModel.PlaybackInfo?) {}
}