CallReactionView.swift 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
  3. // SPDX-License-Identifier: GPL-3.0-or-later
  4. //
  5. import Foundation
  6. @objcMembers class CallReactionView: UIView {
  7. @IBOutlet var contentView: UIView!
  8. @IBOutlet weak var reactionLabel: UILabel!
  9. @IBOutlet weak var actorLabelView: UIView!
  10. @IBOutlet weak var actorLabel: UILabel!
  11. override init(frame: CGRect) {
  12. super.init(frame: frame)
  13. commonInit()
  14. }
  15. required init?(coder aDecoder: NSCoder) {
  16. super.init(coder: aDecoder)
  17. commonInit()
  18. }
  19. func commonInit() {
  20. Bundle.main.loadNibNamed("CallReactionView", owner: self, options: nil)
  21. addSubview(contentView)
  22. contentView.frame = frame
  23. contentView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
  24. actorLabelView.layer.cornerRadius = 4.0
  25. actorLabelView.layer.shadowOpacity = 0.8
  26. actorLabelView.layer.shadowOffset = CGSize(width: 2.0, height: 2.0)
  27. }
  28. func setReaction(reaction: String, actor: String) {
  29. reactionLabel.text = reaction
  30. actorLabel.text = actor
  31. actorLabelView.backgroundColor = ColorGenerator.shared.usernameToColor(actor)
  32. }
  33. }