// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved. import UIKit import SessionUIKit import SessionMessagingKit final class OpenGroupInvitationView: UIView { private static let iconSize: CGFloat = 24 private static let iconImageViewSize: CGFloat = 48 // MARK: - Lifecycle init(name: String, url: String, textColor: UIColor, isOutgoing: Bool) { super.init(frame: CGRect.zero) setUpViewHierarchy( name: name, rawUrl: url, textColor: textColor, isOutgoing: isOutgoing ) } override init(frame: CGRect) { preconditionFailure("Use init(name:url:textColor:) instead.") } required init?(coder: NSCoder) { preconditionFailure("Use init(name:url:textColor:) instead.") } private func setUpViewHierarchy(name: String, rawUrl: String, textColor: UIColor, isOutgoing: Bool) { // Title let titleLabel = UILabel() titleLabel.lineBreakMode = .byTruncatingTail titleLabel.text = name titleLabel.textColor = textColor titleLabel.font = .boldSystemFont(ofSize: Values.largeFontSize) // Subtitle let subtitleLabel = UILabel() subtitleLabel.lineBreakMode = .byTruncatingTail subtitleLabel.text = NSLocalizedString("view_open_group_invitation_description", comment: "") subtitleLabel.textColor = textColor subtitleLabel.font = .systemFont(ofSize: Values.smallFontSize) // URL let urlLabel = UILabel() urlLabel.lineBreakMode = .byCharWrapping urlLabel.text = { if let range = rawUrl.range(of: "?public_key=") { return String(rawUrl[..