// 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: ThemeValue, 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: ThemeValue, isOutgoing: Bool) { // Title let titleLabel = UILabel() titleLabel.font = .boldSystemFont(ofSize: Values.largeFontSize) titleLabel.text = name titleLabel.themeTextColor = textColor titleLabel.lineBreakMode = .byTruncatingTail // Subtitle let subtitleLabel = UILabel() subtitleLabel.font = .systemFont(ofSize: Values.smallFontSize) subtitleLabel.text = "view_open_group_invitation_description".localized() subtitleLabel.themeTextColor = textColor subtitleLabel.lineBreakMode = .byTruncatingTail // URL let urlLabel = UILabel() urlLabel.font = .systemFont(ofSize: Values.verySmallFontSize) urlLabel.text = { if let range = rawUrl.range(of: "?public_key=") { return String(rawUrl[..