[iOS] Add Existence and Opening Hour confirmation to Place Page

Signed-off-by: eisa01 <your.email@example.com>
This commit is contained in:
Eivind Samseth
2025-08-08 19:19:03 +02:00
committed by Yannik Bloscheck
parent 795fe0ee09
commit d1f9806901
11 changed files with 114 additions and 9 deletions

View File

@@ -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)
}
}