diff --git a/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.h b/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.h index 2e835b0e3..0c62f5c69 100644 --- a/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.h +++ b/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.h @@ -27,6 +27,7 @@ NS_ASSUME_NONNULL_BEGIN @property(nonatomic, readonly, nullable) NSURL *emailUrl; @property(nonatomic, readonly, nullable) NSString *cuisine; @property(nonatomic, readonly, nullable) NSString *ppOperator; +@property(nonatomic, readonly, nullable) NSString *branch; @property(nonatomic, readonly, nullable) NSString *address; @property(nonatomic, readonly, nullable) NSArray *coordFormats; @property(nonatomic, readonly, nullable) NSString *wifiAvailable; diff --git a/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.mm b/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.mm index 520402756..82045d40f 100644 --- a/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.mm +++ b/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePageInfoData.mm @@ -116,6 +116,7 @@ NSDate * _Nullable ParseDateString(NSString * _Nullable dateString) { case MetadataID::FMD_CONTACT_BLUESKY: _bluesky = ToNSString(value); break; case MetadataID::FMD_PANORAMAX: _panoramax = ToNSString(value); break; case MetadataID::FMD_OPERATOR: _ppOperator = [NSString stringWithFormat:NSLocalizedString(@"operator", nil), ToNSString(value)]; break; + case MetadataID::FMD_BRANCH: _branch = ToNSString(value); break; case MetadataID::FMD_INTERNET: _wifiAvailable = (rawData.GetInternet() == feature::Internet::No) ? NSLocalizedString(@"no_available", nil) : NSLocalizedString(@"yes_available", nil); diff --git a/iphone/Maps/UI/PlacePage/Components/PlacePageHeader/PlacePageHeaderBuilder.swift b/iphone/Maps/UI/PlacePage/Components/PlacePageHeader/PlacePageHeaderBuilder.swift index 73d52a8e5..08df08516 100644 --- a/iphone/Maps/UI/PlacePage/Components/PlacePageHeader/PlacePageHeaderBuilder.swift +++ b/iphone/Maps/UI/PlacePage/Components/PlacePageHeader/PlacePageHeaderBuilder.swift @@ -6,6 +6,7 @@ class PlacePageHeaderBuilder { let viewController = storyboard.instantiateViewController(ofType: PlacePageHeaderViewController.self); let presenter = PlacePageHeaderPresenter(view: viewController, placePagePreviewData: data.previewData, + branch: data.infoData?.branch, objectType: data.objectType, delegate: delegate, headerType: headerType) diff --git a/iphone/Maps/UI/PlacePage/Components/PlacePageHeader/PlacePageHeaderPresenter.swift b/iphone/Maps/UI/PlacePage/Components/PlacePageHeader/PlacePageHeaderPresenter.swift index daf2b7f32..75ecc2f3a 100644 --- a/iphone/Maps/UI/PlacePage/Components/PlacePageHeader/PlacePageHeaderPresenter.swift +++ b/iphone/Maps/UI/PlacePage/Components/PlacePageHeader/PlacePageHeaderPresenter.swift @@ -23,18 +23,21 @@ class PlacePageHeaderPresenter { private weak var view: PlacePageHeaderViewProtocol? private let placePagePreviewData: PlacePagePreviewData + private let branch: String? let objectType: PlacePageObjectType private weak var delegate: PlacePageHeaderViewControllerDelegate? private let headerType: HeaderType init(view: PlacePageHeaderViewProtocol, placePagePreviewData: PlacePagePreviewData, + branch: String?, objectType: PlacePageObjectType, delegate: PlacePageHeaderViewControllerDelegate?, headerType: HeaderType) { self.view = view self.delegate = delegate self.placePagePreviewData = placePagePreviewData + self.branch = branch self.objectType = objectType self.headerType = headerType } @@ -42,7 +45,7 @@ class PlacePageHeaderPresenter { extension PlacePageHeaderPresenter: PlacePageHeaderPresenterProtocol { func configure() { - view?.setTitle(placePagePreviewData.title, secondaryTitle: placePagePreviewData.secondaryTitle) + view?.setTitle(placePagePreviewData.title, secondaryTitle: placePagePreviewData.secondaryTitle, branch: branch) switch headerType { case .flexible: view?.isExpandViewHidden = false diff --git a/iphone/Maps/UI/PlacePage/Components/PlacePageHeader/PlacePageHeaderViewController.swift b/iphone/Maps/UI/PlacePage/Components/PlacePageHeader/PlacePageHeaderViewController.swift index 2681d73b7..245277497 100644 --- a/iphone/Maps/UI/PlacePage/Components/PlacePageHeader/PlacePageHeaderViewController.swift +++ b/iphone/Maps/UI/PlacePage/Components/PlacePageHeader/PlacePageHeaderViewController.swift @@ -3,7 +3,7 @@ protocol PlacePageHeaderViewProtocol: AnyObject { var isExpandViewHidden: Bool { get set } var isShadowViewHidden: Bool { get set } - func setTitle(_ title: String?, secondaryTitle: String?) + func setTitle(_ title: String?, secondaryTitle: String?, branch: String?) func showShareTrackMenu() } @@ -21,6 +21,7 @@ class PlacePageHeaderViewController: UIViewController { private var titleText: String? private var secondaryText: String? + private var branchText: String? override func viewDidLoad() { super.viewDidLoad() @@ -54,7 +55,7 @@ class PlacePageHeaderViewController: UIViewController { override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { super.traitCollectionDidChange(previousTraitCollection) guard traitCollection.userInterfaceStyle != previousTraitCollection?.userInterfaceStyle else { return } - setTitle(titleText, secondaryTitle: secondaryText) + setTitle(titleText, secondaryTitle: secondaryText, branch: branchText) } } @@ -77,9 +78,11 @@ extension PlacePageHeaderViewController: PlacePageHeaderViewProtocol { } } - func setTitle(_ title: String?, secondaryTitle: String?) { + func setTitle(_ title: String?, secondaryTitle: String?, branch: String? = nil) { titleText = title secondaryText = secondaryTitle + branchText = branch + // XCode 13 is not smart enough to detect that title is used below, and requires explicit unwrapped variable. guard let unwrappedTitle = title else { titleLabel?.attributedText = nil @@ -92,6 +95,15 @@ extension PlacePageHeaderViewController: PlacePageHeaderViewProtocol { ] let attributedText = NSMutableAttributedString(string: unwrappedTitle, attributes: titleAttributes) + + // Add branch with thinner font weight if present and not already in title + if let branch = branch, !branch.isEmpty, !unwrappedTitle.contains(branch) { + let branchAttributes: [NSAttributedString.Key: Any] = [ + .font: StyleManager.shared.theme!.fonts.regular20, + .foregroundColor: UIColor.blackPrimaryText() + ] + attributedText.append(NSAttributedString(string: " \(branch)", attributes: branchAttributes)) + } guard let unwrappedSecondaryTitle = secondaryTitle else { titleLabel?.attributedText = attributedText