Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)

To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
This commit is contained in:
Konstantin Pastbin
2025-04-13 16:37:30 +07:00
commit e3e4a1985a
12931 changed files with 13195100 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
protocol BookmarksListInfoViewControllerDelegate: AnyObject {
func didPressDescription()
func didUpdateContent()
}
final class BookmarksListInfoViewController: UIViewController {
var info: IBookmarksListInfoViewModel? {
didSet {
guard isViewLoaded, let info = info else { return }
updateInfo(info)
}
}
weak var delegate: BookmarksListInfoViewControllerDelegate?
@IBOutlet private var titleImageView: UIImageView!
@IBOutlet private var titleLabel: UILabel!
@IBOutlet private var descriptionButton: UIButton!
@IBOutlet private var authorContainerView: UIView!
@IBOutlet private var infoStack: UIStackView!
@IBOutlet private var separatorsConstraints: [NSLayoutConstraint]!
@IBAction private func onDescription(_ sender: UIButton) {
delegate?.didPressDescription()
}
override func viewDidLoad() {
super.viewDidLoad()
separatorsConstraints.forEach { $0.constant = 1 / UIScreen.main.scale }
descriptionButton.titleLabel?.numberOfLines = 2
guard let info = info else { return }
updateInfo(info)
}
private func updateInfo(_ info: IBookmarksListInfoViewModel) {
titleLabel.text = info.title
descriptionButton.isHidden = !info.hasDescription
if info.hasDescription {
let description = info.isHtmlDescription
? BookmarksListInfoViewController.getPlainText(info.description)
: info.description
descriptionButton.setTitle(description, for: .normal)
}
titleImageView.isHidden = true
if let imageUrl = info.imageUrl {
titleImageView.wi_setImage(with: imageUrl, transitionDuration: 0) { [weak self] (image, error) in
guard image != nil else { return }
self?.titleImageView.isHidden = false
self?.delegate?.didUpdateContent()
}
}
}
private static func getPlainText(_ htmlText: String) -> String? {
let formattedText = NSAttributedString.string(withHtml: htmlText, defaultAttributes: [:])
return formattedText?.string
}
}