| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- //
- // LNRoomMessageInputView.swift
- // Gami
- //
- // Created by OneeChan on 2026/3/11.
- //
- import Foundation
- import UIKit
- import SnapKit
- class LNRoomMessageInputView: UIView {
- private weak var roomSession: LNRoomViewModel?
-
- override init(frame: CGRect) {
- super.init(frame: frame)
-
- setupViews()
- }
-
- func update(_ room: LNRoomViewModel?) {
- roomSession = room
- }
-
- required init?(coder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
- }
- }
- extension LNRoomMessageInputView {
- private func setupViews() {
- onTap { [weak self] in
- guard let self else { return }
- let panel = LNCommonInputPanel()
- panel.handler = { [weak self] message in
- guard let self else { return }
- guard let roomSession else { return }
- roomSession.sendMessage(text: message) { success in }
- }
- panel.popup()
- }
-
- backgroundColor = .fill.withAlphaComponent(0.15)
- layer.cornerRadius = 15
- snp.makeConstraints { make in
- make.width.equalTo(140)
- make.height.equalTo(30)
- }
-
- let titleLabel = UILabel()
- titleLabel.text = .init(key: "A00325")
- titleLabel.font = .body_s
- titleLabel.textColor = .text_1
- addSubview(titleLabel)
- titleLabel.snp.makeConstraints { make in
- make.horizontalEdges.equalToSuperview().inset(10)
- make.centerY.equalToSuperview()
- }
- }
- }
|