Files
comaps/iphone/Maps/Classes/CustomAlert/SpinnerAlert/SpinnerAlert.swift
Konstantin Pastbin e3e4a1985a 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
2025-05-08 21:10:51 +07:00

44 lines
1.1 KiB
Swift

@objc(MWMSpinnerAlert)
final class SpinnerAlert: MWMAlert {
@IBOutlet private weak var progressView: UIView!
@IBOutlet private weak var title: UILabel!
@IBOutlet private weak var cancelHeight: NSLayoutConstraint!
@IBOutlet private weak var cancelButton: UIButton!
@IBOutlet private weak var divider: UIView!
private var cancel: MWMVoidBlock?
private lazy var progress: MWMCircularProgress = {
var p = MWMCircularProgress.downloaderProgress(forParentView: progressView)
return p
}()
@objc static func alert(title: String, cancel: MWMVoidBlock?) -> SpinnerAlert? {
guard let alert = Bundle.main.loadNibNamed(className(), owner: nil, options: nil)?.first
as? SpinnerAlert else {
assertionFailure()
return nil
}
alert.title.text = title
alert.progress.state = .spinner
alert.progress.setCancelButtonHidden()
if let cancel = cancel {
alert.cancel = cancel
} else {
alert.cancelHeight.constant = 0
alert.cancelButton.isHidden = true
alert.divider.isHidden = true
alert.setNeedsLayout()
}
return alert
}
@IBAction private func tap() {
close(cancel)
}
}