mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-04 11:53:47 +00:00
[iOS] Add Existence and Opening Hour confirmation to Place Page
Signed-off-by: eisa01 <your.email@example.com>
This commit is contained in:
committed by
Yannik Bloscheck
parent
795fe0ee09
commit
d1f9806901
@@ -23,26 +23,28 @@ class PlacePageHeaderPresenter {
|
||||
|
||||
private weak var view: PlacePageHeaderViewProtocol?
|
||||
private let placePagePreviewData: PlacePagePreviewData
|
||||
private let placePageData: PlacePageData
|
||||
let objectType: PlacePageObjectType
|
||||
private weak var delegate: PlacePageHeaderViewControllerDelegate?
|
||||
private let headerType: HeaderType
|
||||
|
||||
init(view: PlacePageHeaderViewProtocol,
|
||||
placePagePreviewData: PlacePagePreviewData,
|
||||
objectType: PlacePageObjectType,
|
||||
placePageData: PlacePageData,
|
||||
delegate: PlacePageHeaderViewControllerDelegate?,
|
||||
headerType: HeaderType) {
|
||||
self.view = view
|
||||
self.delegate = delegate
|
||||
self.placePagePreviewData = placePagePreviewData
|
||||
self.objectType = objectType
|
||||
self.placePageData = placePageData
|
||||
self.placePagePreviewData = placePageData.previewData
|
||||
self.objectType = placePageData.objectType
|
||||
self.headerType = headerType
|
||||
}
|
||||
}
|
||||
|
||||
extension PlacePageHeaderPresenter: PlacePageHeaderPresenterProtocol {
|
||||
func configure() {
|
||||
view?.setTitle(placePagePreviewData.title, secondaryTitle: placePagePreviewData.secondaryTitle)
|
||||
let existenceConfirmation = getExistenceConfirmationText()
|
||||
view?.setTitle(placePagePreviewData.title, secondaryTitle: placePagePreviewData.secondaryTitle, existenceConfirmation: existenceConfirmation)
|
||||
switch headerType {
|
||||
case .flexible:
|
||||
view?.isExpandViewHidden = false
|
||||
@@ -68,4 +70,10 @@ extension PlacePageHeaderPresenter: PlacePageHeaderPresenterProtocol {
|
||||
func onExportTrackButtonPress(_ type: KmlFileType, from sourceView: UIView) {
|
||||
delegate?.previewDidPressExportTrack(type, from: sourceView)
|
||||
}
|
||||
|
||||
private func getExistenceConfirmationText() -> String? {
|
||||
guard let mostRecentDate = placePageData.infoData?.getMostRecentCheckDate() else { return nil }
|
||||
let timeAgoText = mostRecentDate.formatTimeAgo()
|
||||
return String(format: L("existence_confirmed_time_ago"), timeAgoText)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user