Skip to content
Snippets Groups Projects
Select Git revision
  • d3ade0369d20640d8348eec25d1c04f9b86123eb
  • release default
  • master protected
  • hotfix/gtnNoToken
  • XX-4441
  • Jakub/rootless-CI
  • jonah/refactorProviders
  • Ace/Huawei
  • AceVentura/AccountBackup
  • hotfix/delete-error
  • waitingRoundsRewrite
  • dev
  • quantumSecure
  • hotfix/ratelimit
  • fullRateLimit
  • XX-3564/TlsCipherSuite
  • hotfix/notifications-db
  • hotfix/groupNotification
  • Project/LastMile
  • notls
  • url-repo-rename
  • v2.3.0
  • v2.2.0
  • v2.1.0
  • v2.0.0
  • v1.0.0
26 results

main.go

Blame
  • DocumentMessageView.swift 2.11 KiB
    import UIKit
    import Shared
    
    typealias OutgoingDocumentCell = CollectionCell<FlexibleSpace, DocumentMessageView>
    typealias IncomingDocumentCell = CollectionCell<DocumentMessageView, FlexibleSpace>
    
    final class DocumentMessageView: UIView, CollectionCellContent {
        // MARK: UI
    
        let titleLabel = UILabel()
        let imageView = UIImageView()
    
        // MARK: Lifecycle
    
        override init(frame: CGRect) {
            super.init(frame: frame)
            setup()
        }
    
        required init?(coder: NSCoder) { nil }
    
        func prepareForReuse() {
            imageView.image = nil
            titleLabel.text = nil
        }
    
        // MARK: Private
    
        private func setup() {
            layer.borderWidth = 2
            layer.borderColor = Asset.accentWarning.color.cgColor
            imageView.clipsToBounds = true
            imageView.contentMode = .scaleAspectFill
    
            titleLabel.textColor = Asset.neutralDark.color
            titleLabel.font = Fonts.Mulish.semiBold.font(size: 15.0)
    
            addSubview(imageView)
            imageView.addSubview(titleLabel)
    
            insetsLayoutMarginsFromSafeArea = false
            translatesAutoresizingMaskIntoConstraints = false
            imageView.translatesAutoresizingMaskIntoConstraints = false
            imageView.widthAnchor.constraint(equalToConstant: 200).isActive = true
            imageView.heightAnchor.constraint(equalToConstant: 150).isActive = true
            imageView.topAnchor.constraint(equalTo: layoutMarginsGuide.topAnchor).isActive = true
            imageView.bottomAnchor.constraint(equalTo: layoutMarginsGuide.bottomAnchor).isActive = true
            imageView.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor).isActive = true
            imageView.trailingAnchor.constraint(equalTo: layoutMarginsGuide.trailingAnchor).isActive = true
    
            titleLabel.translatesAutoresizingMaskIntoConstraints = false
            titleLabel.bottomAnchor.constraint(equalTo: imageView.bottomAnchor, constant: -15).isActive = true
            titleLabel.leadingAnchor.constraint(equalTo: imageView.leadingAnchor, constant: 15).isActive = true
            titleLabel.trailingAnchor.constraint(equalTo: imageView.trailingAnchor, constant: -15).isActive = true
        }
    }