Repo created

This commit is contained in:
Fr4nz D13trich 2025-11-22 13:58:55 +01:00
parent 4af19165ec
commit 68073add76
12458 changed files with 12350765 additions and 2 deletions

View file

@ -0,0 +1,15 @@
@objc(MWMUGCSelectImpressionCell)
final class UGCSelectImpressionCell: MWMTableViewCell {
@IBOutlet private var buttons: [UIButton]!
private weak var delegate: MWMPlacePageButtonsProtocol?
@objc func configWith(delegate: MWMPlacePageButtonsProtocol?) {
self.delegate = delegate
}
@IBAction private func tap(on: UIButton) {
buttons.forEach { $0.isSelected = false }
on.isSelected = true
delegate?.review(on: on.tag)
}
}

View file

@ -0,0 +1,32 @@
@objc(MWMUGCSpecificReviewDelegate)
protocol UGCSpecificReviewDelegate: NSObjectProtocol {
func changeReviewRate(_ rate: Int, atIndexPath: NSIndexPath)
}
@objc(MWMUGCSpecificReviewCell)
final class UGCSpecificReviewCell: MWMTableViewCell {
@IBOutlet private weak var specification: UILabel!
@IBOutlet private var stars: [UIButton]!
private var indexPath: NSIndexPath = NSIndexPath()
private var delegate: UGCSpecificReviewDelegate?
@objc func configWith(specification: String, rate: Int, atIndexPath: NSIndexPath, delegate: UGCSpecificReviewDelegate?) {
self.specification.text = specification
self.delegate = delegate
indexPath = atIndexPath
stars.forEach { $0.isSelected = $0.tag <= rate }
}
@IBAction private func tap(on: UIButton) {
stars.forEach { $0.isSelected = $0.tag <= on.tag }
delegate?.changeReviewRate(on.tag, atIndexPath: indexPath)
}
// TODO: Make highlighting and dragging.
@IBAction private func highlight(on _: UIButton) {}
@IBAction private func touchingCanceled(on _: UIButton) {}
@IBAction private func drag(inside _: UIButton) {}
}

View file

@ -0,0 +1,38 @@
@objc(MWMUGCTextReviewDelegate)
protocol UGCTextReviewDelegate: NSObjectProtocol {
func changeReviewText(_ text: String)
}
@objc(MWMUGCTextReviewCell)
final class UGCTextReviewCell: MWMTableViewCell, UITextViewDelegate {
private enum Consts {
static let kMaxNumberOfSymbols = 400
}
@IBOutlet private weak var textView: MWMTextView!
@IBOutlet private weak var countLabel: UILabel!
private weak var delegate: UGCTextReviewDelegate?
private var indexPath: NSIndexPath = NSIndexPath()
@objc func configWith(delegate: UGCTextReviewDelegate?) {
self.delegate = delegate
setCount(textView.text.characters.count)
}
private func setCount(_ count: Int) {
countLabel.text = "\(count)/\(Consts.kMaxNumberOfSymbols)"
}
// MARK: UITextViewDelegate
func textView(_ textView: UITextView, shouldChangeTextIn _: NSRange, replacementText _: String) -> Bool {
return textView.text.characters.count <= Consts.kMaxNumberOfSymbols
}
func textViewDidChange(_ textView: UITextView) {
setCount(textView.text.characters.count)
}
func textViewDidEndEditing(_ textView: UITextView) {
delegate?.changeReviewText(textView.text)
}
}