mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-23 14:43:43 +00:00
1. add an new screen (layout) 2. add TR icon for the bottom tabbar 3. share current location from the TR PP 4. refactor TR manager to properly handle state updates and pass them to the LiveActivityManager and PlacePage 5. add init/update with TrackInfo/EleInfo methods to the PlacePageData and PlacePagePreviewData to update the PP state Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
72 lines
2.1 KiB
Swift
72 lines
2.1 KiB
Swift
protocol PlacePageHeaderPresenterProtocol: AnyObject {
|
|
var objectType: PlacePageObjectType { get }
|
|
|
|
func configure()
|
|
func onClosePress()
|
|
func onExpandPress()
|
|
func onShareButtonPress(from sourceView: UIView)
|
|
func onExportTrackButtonPress(_ type: KmlFileType, from sourceView: UIView)
|
|
}
|
|
|
|
protocol PlacePageHeaderViewControllerDelegate: AnyObject {
|
|
func previewDidPressClose()
|
|
func previewDidPressExpand()
|
|
func previewDidPressShare(from sourceView: UIView)
|
|
func previewDidPressExportTrack(_ type: KmlFileType, from sourceView: UIView)
|
|
}
|
|
|
|
class PlacePageHeaderPresenter {
|
|
enum HeaderType {
|
|
case flexible
|
|
case fixed
|
|
}
|
|
|
|
private weak var view: PlacePageHeaderViewProtocol?
|
|
private let placePagePreviewData: PlacePagePreviewData
|
|
let objectType: PlacePageObjectType
|
|
private weak var delegate: PlacePageHeaderViewControllerDelegate?
|
|
private let headerType: HeaderType
|
|
|
|
init(view: PlacePageHeaderViewProtocol,
|
|
placePagePreviewData: PlacePagePreviewData,
|
|
objectType: PlacePageObjectType,
|
|
delegate: PlacePageHeaderViewControllerDelegate?,
|
|
headerType: HeaderType) {
|
|
self.view = view
|
|
self.delegate = delegate
|
|
self.placePagePreviewData = placePagePreviewData
|
|
self.objectType = objectType
|
|
self.headerType = headerType
|
|
}
|
|
}
|
|
|
|
extension PlacePageHeaderPresenter: PlacePageHeaderPresenterProtocol {
|
|
func configure() {
|
|
view?.setTitle(placePagePreviewData.title, secondaryTitle: placePagePreviewData.secondaryTitle)
|
|
switch headerType {
|
|
case .flexible:
|
|
view?.isExpandViewHidden = false
|
|
view?.isShadowViewHidden = true
|
|
case .fixed:
|
|
view?.isExpandViewHidden = true
|
|
view?.isShadowViewHidden = false
|
|
}
|
|
}
|
|
|
|
func onClosePress() {
|
|
delegate?.previewDidPressClose()
|
|
}
|
|
|
|
func onExpandPress() {
|
|
delegate?.previewDidPressExpand()
|
|
}
|
|
|
|
func onShareButtonPress(from sourceView: UIView) {
|
|
delegate?.previewDidPressShare(from: sourceView)
|
|
}
|
|
|
|
func onExportTrackButtonPress(_ type: KmlFileType, from sourceView: UIView) {
|
|
delegate?.previewDidPressExportTrack(type, from: sourceView)
|
|
}
|
|
}
|