Skip to content
Snippets Groups Projects
Select Git revision
  • 7514ca973518adeef5677f28d39447a61b394238
  • 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

databaseImpl.go

Blame
  • StackMessageView.swift 3.64 KiB
    import UIKit
    import Shared
    
    typealias IncomingTextCell = CollectionCell<StackMessageView, FlexibleSpace>
    typealias OutgoingTextCell = CollectionCell<FlexibleSpace, StackMessageView>
    typealias OutgoingFailedTextCell = CollectionCell<FlexibleSpace, StackMessageView>
    
    final class StackMessageView: UIView, CollectionCellContent {
        let roundButton = UIButton()
        let dateLabel = UILabel()
        let textView = TextView()
        let lockerView = LockerView()
        let senderLabel = UILabel()
        private let stackView = UIStackView()
        private let shapeLayer = CAShapeLayer()
        private let bottomStack = UIStackView()
    
        var didTapShowRound: (() -> Void)?
    
        override init(frame: CGRect) {
            super.init(frame: frame)
            setup()
        }
    
        override func layoutSubviews() {
            super.layoutSubviews()
            updatePath()
        }
    
        required init?(coder: NSCoder) { nil }
    
        func prepareForReuse() {
            dateLabel.text = nil
            textView.text = nil
            senderLabel.text = nil
            textView.resignFirstResponder()
            lockerView.icon.layer.removeAllAnimations()
            didTapShowRound = nil
        }
    
        func revertBottomStackOrder() {
            dateLabel.removeFromSuperview()
            bottomStack.insertArrangedSubview(dateLabel, at: 1)
        }
    
        private func setup() {
            roundButton.addTarget(
                self,
                action: #selector(didTapRoundButton),
                for: .touchUpInside
            )
    
            let attrString = NSAttributedString(
                string: "show mix",
                attributes: [
                    .underlineStyle: NSUnderlineStyle.single.rawValue,
                    .underlineColor: Asset.neutralWhite.color,
                    .foregroundColor: Asset.neutralWhite.color,
                    .font: Fonts.Mulish.regular.font(size: 12.0) as Any
                ]
            )
    
            roundButton.setAttributedTitle(attrString, for: .normal)
            senderLabel.textColor = Asset.brandDefault.color
            senderLabel.font = Fonts.Mulish.semiBold.font(size: 10.0)
            dateLabel.font = Fonts.Mulish.regular.font(size: 12.0)
            layoutMargins = UIEdgeInsets(top: 8, left: 15, bottom: 8, right: 15)
    
            bottomStack.spacing = 3
            bottomStack.addArrangedSubview(FlexibleSpace())