[ios] Move branch data to PlacePagePreview

Signed-off-by: eisa01 <eisa01@gmail.com>
This commit is contained in:
eisa01
2025-08-27 21:08:18 +02:00
committed by Konstantin Pastbin
parent 49391bb39e
commit 47b18e7753
5 changed files with 10 additions and 5 deletions

View File

@@ -35,12 +35,14 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, readonly, nullable) NSString *title; @property(nonatomic, readonly, nullable) NSString *title;
@property(nonatomic, readonly, nullable) NSString *secondaryTitle; @property(nonatomic, readonly, nullable) NSString *secondaryTitle;
@property(nonatomic, readonly, nullable) NSString *subtitle; @property(nonatomic, readonly, nullable) NSString *subtitle;
@property(nonatomic, readonly, nullable) NSString *branch;
@property(nonatomic, readonly, nullable) NSString *coordinates; @property(nonatomic, readonly, nullable) NSString *coordinates;
@property(nonatomic, readonly, nullable) NSString *secondarySubtitle; @property(nonatomic, readonly, nullable) NSString *secondarySubtitle;
@property(nonatomic, readonly) PlacePageDataSchedule schedule; @property(nonatomic, readonly) PlacePageDataSchedule schedule;
@property(nonatomic, readonly) BOOL isMyPosition; @property(nonatomic, readonly) BOOL isMyPosition;
- (instancetype)initWithTrackInfo:(TrackInfo * _Nonnull)trackInfo; - (instancetype)initWithTrackInfo:(TrackInfo * _Nonnull)trackInfo;
- (void)setBranch:(NSString * _Nullable)branch;
@end @end

View File

@@ -59,6 +59,10 @@ static PlacePageDataSchedule convertOpeningHours(std::string_view rawOH)
return self; return self;
} }
- (void)setBranch:(NSString * _Nullable)branch {
_branch = branch;
}
@end @end
@implementation PlacePagePreviewData (Core) @implementation PlacePagePreviewData (Core)

View File

@@ -75,6 +75,9 @@ static PlacePageRoadType convertRoadType(RoadWarningMarkType roadType) {
}]; }];
} }
_previewData = [[PlacePagePreviewData alloc] initWithRawData:rawData()]; _previewData = [[PlacePagePreviewData alloc] initWithRawData:rawData()];
// Set branch from infoData to previewData
[_previewData setBranch:_infoData.branch];
auto const &countryId = rawData().GetCountryId(); auto const &countryId = rawData().GetCountryId();
if (!countryId.empty()) { if (!countryId.empty()) {

View File

@@ -6,7 +6,6 @@ class PlacePageHeaderBuilder {
let viewController = storyboard.instantiateViewController(ofType: PlacePageHeaderViewController.self); let viewController = storyboard.instantiateViewController(ofType: PlacePageHeaderViewController.self);
let presenter = PlacePageHeaderPresenter(view: viewController, let presenter = PlacePageHeaderPresenter(view: viewController,
placePagePreviewData: data.previewData, placePagePreviewData: data.previewData,
branch: data.infoData?.branch,
objectType: data.objectType, objectType: data.objectType,
delegate: delegate, delegate: delegate,
headerType: headerType) headerType: headerType)

View File

@@ -23,21 +23,18 @@ class PlacePageHeaderPresenter {
private weak var view: PlacePageHeaderViewProtocol? private weak var view: PlacePageHeaderViewProtocol?
private let placePagePreviewData: PlacePagePreviewData private let placePagePreviewData: PlacePagePreviewData
private let branch: String?
let objectType: PlacePageObjectType let objectType: PlacePageObjectType
private weak var delegate: PlacePageHeaderViewControllerDelegate? private weak var delegate: PlacePageHeaderViewControllerDelegate?
private let headerType: HeaderType private let headerType: HeaderType
init(view: PlacePageHeaderViewProtocol, init(view: PlacePageHeaderViewProtocol,
placePagePreviewData: PlacePagePreviewData, placePagePreviewData: PlacePagePreviewData,
branch: String?,
objectType: PlacePageObjectType, objectType: PlacePageObjectType,
delegate: PlacePageHeaderViewControllerDelegate?, delegate: PlacePageHeaderViewControllerDelegate?,
headerType: HeaderType) { headerType: HeaderType) {
self.view = view self.view = view
self.delegate = delegate self.delegate = delegate
self.placePagePreviewData = placePagePreviewData self.placePagePreviewData = placePagePreviewData
self.branch = branch
self.objectType = objectType self.objectType = objectType
self.headerType = headerType self.headerType = headerType
} }
@@ -45,7 +42,7 @@ class PlacePageHeaderPresenter {
extension PlacePageHeaderPresenter: PlacePageHeaderPresenterProtocol { extension PlacePageHeaderPresenter: PlacePageHeaderPresenterProtocol {
func configure() { func configure() {
view?.setTitle(placePagePreviewData.title, secondaryTitle: placePagePreviewData.secondaryTitle, branch: branch) view?.setTitle(placePagePreviewData.title, secondaryTitle: placePagePreviewData.secondaryTitle, branch: placePagePreviewData.branch)
switch headerType { switch headerType {
case .flexible: case .flexible:
view?.isExpandViewHidden = false view?.isExpandViewHidden = false