From 91bd5ec5b96391e425694b8b323dab28639a5592 Mon Sep 17 00:00:00 2001 From: Eivind Samseth Date: Mon, 10 Jun 2024 22:53:16 +0200 Subject: [PATCH 1/2] Add check_date to the map generator Utilize the url validator as a placeholder for validation. Should likely check if it's a date string as the spec Signed-off-by: Eivind Samseth --- generator/osm2meta.cpp | 1 + indexer/feature_meta.cpp | 3 +++ indexer/feature_meta.hpp | 1 + 3 files changed, 5 insertions(+) diff --git a/generator/osm2meta.cpp b/generator/osm2meta.cpp index 1d0a89f715..5eea6c69cb 100644 --- a/generator/osm2meta.cpp +++ b/generator/osm2meta.cpp @@ -503,6 +503,7 @@ void MetadataTagProcessor::operator()(std::string const & k, std::string const & break; case Metadata::FMD_WEBSITE: valid = ValidateAndFormat_url(v); break; case Metadata::FMD_WEBSITE_MENU: valid = ValidateAndFormat_url(v); break; + case Metadata::FMD_CHECK_DATE: valid = ValidateAndFormat_url(v); break; case Metadata::FMD_CONTACT_FACEBOOK: valid = osm::ValidateAndFormat_facebook(v); break; case Metadata::FMD_CONTACT_INSTAGRAM: valid = osm::ValidateAndFormat_instagram(v); break; case Metadata::FMD_CONTACT_TWITTER: valid = osm::ValidateAndFormat_twitter(v); break; diff --git a/indexer/feature_meta.cpp b/indexer/feature_meta.cpp index f57ac1d655..33b33f4f1d 100644 --- a/indexer/feature_meta.cpp +++ b/indexer/feature_meta.cpp @@ -136,6 +136,8 @@ bool Metadata::TypeFromString(string_view k, Metadata::EType & outType) outType = Metadata::FMD_DRIVE_THROUGH; else if (k == "website:menu") outType = Metadata::FMD_WEBSITE_MENU; + else if (k == "check_date") + outType = Metadata::FMD_CHECK_DATE; else return false; @@ -256,6 +258,7 @@ string ToString(Metadata::EType type) case Metadata::FMD_LOCAL_REF: return "local_ref"; case Metadata::FMD_DRIVE_THROUGH: return "drive_through"; case Metadata::FMD_WEBSITE_MENU: return "website:menu"; + case Metadata::FMD_CHECK_DATE: return "check_date"; case Metadata::FMD_COUNT: CHECK(false, ("FMD_COUNT can not be used as a type.")); }; diff --git a/indexer/feature_meta.hpp b/indexer/feature_meta.hpp index 84a823303a..be3561e355 100644 --- a/indexer/feature_meta.hpp +++ b/indexer/feature_meta.hpp @@ -152,6 +152,7 @@ public: FMD_LOCAL_REF = 44, FMD_DRIVE_THROUGH = 45, FMD_WEBSITE_MENU = 46, + FMD_CHECK_DATE = 47, FMD_COUNT }; -- 2.45.3 From 052d3816c96aa94fba2ee48bf8780367169aa1a0 Mon Sep 17 00:00:00 2001 From: Eivind Samseth Date: Mon, 10 Jun 2024 22:53:59 +0200 Subject: [PATCH 2/2] Add iOS implementation of showing the check_date field Signed-off-by: Eivind Samseth --- .../CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.h | 1 + .../CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.mm | 1 + .../UI/PlacePage/Components/PlacePageInfoViewController.swift | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.h b/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.h index 93ea1ae20f..03a4ad2455 100644 --- a/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.h +++ b/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.h @@ -32,6 +32,7 @@ NS_ASSUME_NONNULL_BEGIN @property(nonatomic, readonly, nullable) NSString *wheelchair; @property(nonatomic, readonly, nullable) NSString *driveThrough; @property(nonatomic, readonly, nullable) NSString *websiteMenu; +@property(nonatomic, readonly, nullable) NSString *checkDate; @end diff --git a/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.mm b/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.mm index 0495fa5889..329be81f1b 100644 --- a/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.mm +++ b/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.mm @@ -50,6 +50,7 @@ using namespace osm; break; } case MetadataID::FMD_WEBSITE: _website = ToNSString(value); break; + case MetadataID::FMD_CHECK_DATE: _checkDate = ToNSString(value); break; case MetadataID::FMD_EXTERNAL_URI: { NSString *countryIsoCode = [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] ?: @"US"; diff --git a/iphone/Maps/UI/PlacePage/Components/PlacePageInfoViewController.swift b/iphone/Maps/UI/PlacePage/Components/PlacePageInfoViewController.swift index 2022b96b62..49a4093d4a 100644 --- a/iphone/Maps/UI/PlacePage/Components/PlacePageInfoViewController.swift +++ b/iphone/Maps/UI/PlacePage/Components/PlacePageInfoViewController.swift @@ -81,6 +81,7 @@ class PlacePageInfoViewController: UIViewController { private var phoneView: InfoItemViewController? private var websiteView: InfoItemViewController? private var websiteMenuView: InfoItemViewController? + private var checkDateView: InfoItemViewController? private var kayakView: InfoItemViewController? private var wikipediaView: InfoItemViewController? private var wikimediaCommonsView: InfoItemViewController? @@ -144,6 +145,9 @@ class PlacePageInfoViewController: UIViewController { self?.delegate?.didCopy(phone) }) } + if let checkDate = placePageInfoData.checkDate { + checkDateView = createInfoItem(checkDate, icon: UIImage(named: "ic_placepage_operator")) + } if let ppOperator = placePageInfoData.ppOperator { operatorView = createInfoItem(ppOperator, icon: UIImage(named: "ic_placepage_operator")) -- 2.45.3