mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
2.1 KiB
Swift
67 lines
2.1 KiB
Swift
8 years ago
|
//
|
||
7 years ago
|
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||
8 years ago
|
//
|
||
|
|
||
|
import UIKit
|
||
5 years ago
|
import SignalUtilitiesKit
|
||
8 years ago
|
|
||
|
@objc class GroupTableViewCell: UITableViewCell {
|
||
|
|
||
7 years ago
|
// MARK: -
|
||
|
|
||
5 years ago
|
// private let avatarView = AvatarImageView()
|
||
8 years ago
|
private let nameLabel = UILabel()
|
||
|
private let subtitleLabel = UILabel()
|
||
|
|
||
|
init() {
|
||
7 years ago
|
super.init(style: .default, reuseIdentifier: GroupTableViewCell.logTag())
|
||
8 years ago
|
|
||
|
// Font config
|
||
7 years ago
|
nameLabel.font = .ows_dynamicTypeBody
|
||
7 years ago
|
nameLabel.textColor = Theme.primaryColor
|
||
7 years ago
|
subtitleLabel.font = UIFont.ows_regularFont(withSize: 11.0)
|
||
7 years ago
|
subtitleLabel.textColor = Theme.secondaryColor
|
||
8 years ago
|
|
||
|
// Layout
|
||
|
|
||
5 years ago
|
// avatarView.autoSetDimension(.width, toSize: CGFloat(kStandardAvatarSize))
|
||
|
// avatarView.autoPinToSquareAspectRatio()
|
||
8 years ago
|
|
||
7 years ago
|
let textRows = UIStackView(arrangedSubviews: [nameLabel, subtitleLabel])
|
||
|
textRows.axis = .vertical
|
||
|
textRows.alignment = .leading
|
||
|
|
||
5 years ago
|
let columns = UIStackView(arrangedSubviews: [ textRows ])
|
||
7 years ago
|
columns.axis = .horizontal
|
||
|
columns.alignment = .center
|
||
|
columns.spacing = kContactCellAvatarTextMargin
|
||
|
|
||
|
self.contentView.addSubview(columns)
|
||
|
columns.autoPinEdgesToSuperviewMargins()
|
||
8 years ago
|
}
|
||
|
|
||
|
required init?(coder aDecoder: NSCoder) {
|
||
7 years ago
|
notImplemented()
|
||
8 years ago
|
}
|
||
|
|
||
7 years ago
|
@objc
|
||
7 years ago
|
public func configure(thread: TSGroupThread) {
|
||
7 years ago
|
OWSTableItem.configureCell(self)
|
||
|
|
||
8 years ago
|
if let groupName = thread.groupModel.groupName, !groupName.isEmpty {
|
||
|
self.nameLabel.text = groupName
|
||
|
} else {
|
||
|
self.nameLabel.text = MessageStrings.newGroupDefaultTitle
|
||
|
}
|
||
|
|
||
|
let groupMemberIds: [String] = thread.groupModel.groupMemberIds
|
||
|
let groupMemberNames = groupMemberIds.map { (recipientId: String) in
|
||
5 years ago
|
SSKEnvironment.shared.profileManager.profileNameForRecipient(withID: recipientId, avoidingWriteTransaction: true)!
|
||
8 years ago
|
}.joined(separator: ", ")
|
||
|
self.subtitleLabel.text = groupMemberNames
|
||
|
|
||
5 years ago
|
// self.avatarView.image = OWSAvatarBuilder.buildImage(thread: thread, diameter: kStandardAvatarSize)
|
||
8 years ago
|
}
|
||
|
|
||
|
}
|