|
@@ -961,9 +961,9 @@ extension SecondTabViewController: UITableViewDelegate, UITableViewDataSource {
|
|
|
NSLayoutConstraint.activate([
|
|
|
imageView.leadingAnchor.constraint(equalTo: content.leadingAnchor, constant: 10.0),
|
|
|
imageView.topAnchor.constraint(equalTo: content.topAnchor, constant: 10.0),
|
|
|
- imageView.bottomAnchor.constraint(equalTo: content.bottomAnchor, constant: -25.0),
|
|
|
- imageView.widthAnchor.constraint(equalToConstant: 40.0),
|
|
|
- imageView.heightAnchor.constraint(equalToConstant: 40.0)
|
|
|
+ imageView.bottomAnchor.constraint(equalTo: content.bottomAnchor, constant: -10.0),
|
|
|
+ imageView.widthAnchor.constraint(equalToConstant: 55.0),
|
|
|
+ imageView.heightAnchor.constraint(equalToConstant: 55.0)
|
|
|
])
|
|
|
if data.profile.isEmpty && data.pin != "-999" {
|
|
|
if data.messageScope == "3" {
|
|
@@ -1041,12 +1041,53 @@ extension SecondTabViewController: UITableViewDelegate, UITableViewDataSource {
|
|
|
}
|
|
|
messageView.numberOfLines = 2
|
|
|
|
|
|
+ let timeView = UILabel()
|
|
|
+ content.addSubview(timeView)
|
|
|
+ timeView.translatesAutoresizingMaskIntoConstraints = false
|
|
|
+ NSLayoutConstraint.activate([
|
|
|
+ timeView.topAnchor.constraint(equalTo: content.topAnchor, constant: 10.0),
|
|
|
+ timeView.trailingAnchor.constraint(equalTo: content.trailingAnchor, constant: -20.0),
|
|
|
+ ])
|
|
|
+ timeView.textColor = .gray
|
|
|
+ timeView.font = UIFont.systemFont(ofSize: 14)
|
|
|
+
|
|
|
+ let date = Date(milliseconds: Int64(data.serverDate)!)
|
|
|
+ let calendar = Calendar.current
|
|
|
+
|
|
|
+ if (calendar.isDateInToday(date)) {
|
|
|
+ let formatter = DateFormatter()
|
|
|
+ formatter.dateFormat = "HH:mm"
|
|
|
+ formatter.locale = NSLocale(localeIdentifier: "id") as Locale?
|
|
|
+ timeView.text = formatter.string(from: date as Date)
|
|
|
+ } else {
|
|
|
+ let startOfNow = calendar.startOfDay(for: Date())
|
|
|
+ let startOfTimeStamp = calendar.startOfDay(for: date)
|
|
|
+ let components = calendar.dateComponents([.day], from: startOfNow, to: startOfTimeStamp)
|
|
|
+ let day = -(components.day!)
|
|
|
+ if day == 1 {
|
|
|
+ timeView.text = "Yesterday".localized()
|
|
|
+ } else {
|
|
|
+ if day < 7 {
|
|
|
+ let formatter = DateFormatter()
|
|
|
+ formatter.dateFormat = "EEEE"
|
|
|
+ timeView.text = formatter.string(from: date)
|
|
|
+ } else {
|
|
|
+ let formatter = DateFormatter()
|
|
|
+ formatter.dateFormat = "MM/dd/yy"
|
|
|
+ formatter.locale = NSLocale(localeIdentifier: "id") as Locale?
|
|
|
+ let stringFormat = formatter.string(from: date as Date)
|
|
|
+ timeView.text = stringFormat
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if data.counter != "0" {
|
|
|
+ timeView.textColor = .systemRed
|
|
|
let viewCounter = UIView()
|
|
|
content.addSubview(viewCounter)
|
|
|
viewCounter.translatesAutoresizingMaskIntoConstraints = false
|
|
|
NSLayoutConstraint.activate([
|
|
|
- viewCounter.centerYAnchor.constraint(equalTo: content.centerYAnchor),
|
|
|
+ viewCounter.topAnchor.constraint(equalTo: timeView.bottomAnchor, constant: 5.0),
|
|
|
viewCounter.trailingAnchor.constraint(equalTo: content.trailingAnchor, constant: -20),
|
|
|
viewCounter.widthAnchor.constraint(greaterThanOrEqualToConstant: 20),
|
|
|
viewCounter.heightAnchor.constraint(equalToConstant: 20)
|