[cleanup] [ios] Place page code cleanup.

This commit is contained in:
Ilya Grechuhin 2017-01-25 15:25:22 +03:00
parent 0d1d127714
commit 55936089e1
9 changed files with 175 additions and 146 deletions

View file

@ -1107,15 +1107,15 @@
F6E2FE841E097BA00083EBEC /* MWMPlacePageOpeningHoursWeekDayView.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6E2FCC01E097B9F0083EBEC /* MWMPlacePageOpeningHoursWeekDayView.xib */; };
F6E2FE851E097BA00083EBEC /* MWMPlacePageOpeningHoursWeekDayView.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6E2FCC01E097B9F0083EBEC /* MWMPlacePageOpeningHoursWeekDayView.xib */; };
F6E2FE861E097BA00083EBEC /* MWMPlacePageOpeningHoursWeekDayView.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6E2FCC01E097B9F0083EBEC /* MWMPlacePageOpeningHoursWeekDayView.xib */; };
F6E2FE871E097BA00083EBEC /* MWMPlacePageInfoCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6E2FCC31E097B9F0083EBEC /* MWMPlacePageInfoCell.mm */; };
F6E2FE881E097BA00083EBEC /* MWMPlacePageInfoCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6E2FCC31E097B9F0083EBEC /* MWMPlacePageInfoCell.mm */; };
F6E2FE891E097BA00083EBEC /* MWMPlacePageInfoCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6E2FCC31E097B9F0083EBEC /* MWMPlacePageInfoCell.mm */; };
F6E2FE8A1E097BA00083EBEC /* PlacePageInfoCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6E2FCC41E097B9F0083EBEC /* PlacePageInfoCell.xib */; };
F6E2FE8B1E097BA00083EBEC /* PlacePageInfoCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6E2FCC41E097B9F0083EBEC /* PlacePageInfoCell.xib */; };
F6E2FE8C1E097BA00083EBEC /* PlacePageInfoCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6E2FCC41E097B9F0083EBEC /* PlacePageInfoCell.xib */; };
F6E2FE8D1E097BA00083EBEC /* PlacePageLinkCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6E2FCC51E097B9F0083EBEC /* PlacePageLinkCell.xib */; };
F6E2FE8E1E097BA00083EBEC /* PlacePageLinkCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6E2FCC51E097B9F0083EBEC /* PlacePageLinkCell.xib */; };
F6E2FE8F1E097BA00083EBEC /* PlacePageLinkCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6E2FCC51E097B9F0083EBEC /* PlacePageLinkCell.xib */; };
F6E2FE871E097BA00083EBEC /* MWMPlacePageRegularCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6E2FCC31E097B9F0083EBEC /* MWMPlacePageRegularCell.mm */; };
F6E2FE881E097BA00083EBEC /* MWMPlacePageRegularCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6E2FCC31E097B9F0083EBEC /* MWMPlacePageRegularCell.mm */; };
F6E2FE891E097BA00083EBEC /* MWMPlacePageRegularCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6E2FCC31E097B9F0083EBEC /* MWMPlacePageRegularCell.mm */; };
F6E2FE8A1E097BA00083EBEC /* MWMPlacePageInfoCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6E2FCC41E097B9F0083EBEC /* MWMPlacePageInfoCell.xib */; };
F6E2FE8B1E097BA00083EBEC /* MWMPlacePageInfoCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6E2FCC41E097B9F0083EBEC /* MWMPlacePageInfoCell.xib */; };
F6E2FE8C1E097BA00083EBEC /* MWMPlacePageInfoCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6E2FCC41E097B9F0083EBEC /* MWMPlacePageInfoCell.xib */; };
F6E2FE8D1E097BA00083EBEC /* MWMPlacePageLinkCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6E2FCC51E097B9F0083EBEC /* MWMPlacePageLinkCell.xib */; };
F6E2FE8E1E097BA00083EBEC /* MWMPlacePageLinkCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6E2FCC51E097B9F0083EBEC /* MWMPlacePageLinkCell.xib */; };
F6E2FE8F1E097BA00083EBEC /* MWMPlacePageLinkCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6E2FCC51E097B9F0083EBEC /* MWMPlacePageLinkCell.xib */; };
F6E2FE901E097BA00083EBEC /* MWMPlacePageTaxiCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6E2FCC81E097B9F0083EBEC /* MWMPlacePageTaxiCell.mm */; };
F6E2FE911E097BA00083EBEC /* MWMPlacePageTaxiCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6E2FCC81E097B9F0083EBEC /* MWMPlacePageTaxiCell.mm */; };
F6E2FE921E097BA00083EBEC /* MWMPlacePageTaxiCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6E2FCC81E097B9F0083EBEC /* MWMPlacePageTaxiCell.mm */; };
@ -2018,17 +2018,17 @@
F6E2FCB71E097B9F0083EBEC /* MWMOpeningHours.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMOpeningHours.mm; sourceTree = "<group>"; };
F6E2FCB81E097B9F0083EBEC /* MWMOpeningHoursCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMOpeningHoursCell.xib; sourceTree = "<group>"; };
F6E2FCB91E097B9F0083EBEC /* MWMOpeningHoursLayoutHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMOpeningHoursLayoutHelper.h; sourceTree = "<group>"; };
F6E2FCBA1E097B9F0083EBEC /* MWMOpeningHoursLayoutHelper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMOpeningHoursLayoutHelper.mm; sourceTree = "<group>"; };
F6E2FCBA1E097B9F0083EBEC /* MWMOpeningHoursLayoutHelper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = MWMOpeningHoursLayoutHelper.mm; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
F6E2FCBB1E097B9F0083EBEC /* MWMPlacePageOpeningHoursCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMPlacePageOpeningHoursCell.h; sourceTree = "<group>"; };
F6E2FCBC1E097B9F0083EBEC /* MWMPlacePageOpeningHoursCell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMPlacePageOpeningHoursCell.mm; sourceTree = "<group>"; };
F6E2FCBD1E097B9F0083EBEC /* MWMPlacePageOpeningHoursCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMPlacePageOpeningHoursCell.xib; sourceTree = "<group>"; };
F6E2FCBE1E097B9F0083EBEC /* MWMPlacePageOpeningHoursDayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMPlacePageOpeningHoursDayView.h; sourceTree = "<group>"; };
F6E2FCBF1E097B9F0083EBEC /* MWMPlacePageOpeningHoursDayView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMPlacePageOpeningHoursDayView.mm; sourceTree = "<group>"; };
F6E2FCC01E097B9F0083EBEC /* MWMPlacePageOpeningHoursWeekDayView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMPlacePageOpeningHoursWeekDayView.xib; sourceTree = "<group>"; };
F6E2FCC21E097B9F0083EBEC /* MWMPlacePageInfoCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMPlacePageInfoCell.h; sourceTree = "<group>"; };
F6E2FCC31E097B9F0083EBEC /* MWMPlacePageInfoCell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMPlacePageInfoCell.mm; sourceTree = "<group>"; };
F6E2FCC41E097B9F0083EBEC /* PlacePageInfoCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PlacePageInfoCell.xib; sourceTree = "<group>"; };
F6E2FCC51E097B9F0083EBEC /* PlacePageLinkCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PlacePageLinkCell.xib; sourceTree = "<group>"; };
F6E2FCC21E097B9F0083EBEC /* MWMPlacePageRegularCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMPlacePageRegularCell.h; sourceTree = "<group>"; };
F6E2FCC31E097B9F0083EBEC /* MWMPlacePageRegularCell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMPlacePageRegularCell.mm; sourceTree = "<group>"; };
F6E2FCC41E097B9F0083EBEC /* MWMPlacePageInfoCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMPlacePageInfoCell.xib; sourceTree = "<group>"; };
F6E2FCC51E097B9F0083EBEC /* MWMPlacePageLinkCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMPlacePageLinkCell.xib; sourceTree = "<group>"; };
F6E2FCC71E097B9F0083EBEC /* MWMPlacePageTaxiCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMPlacePageTaxiCell.h; sourceTree = "<group>"; };
F6E2FCC81E097B9F0083EBEC /* MWMPlacePageTaxiCell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMPlacePageTaxiCell.mm; sourceTree = "<group>"; };
F6E2FCC91E097B9F0083EBEC /* MWMPlacePageTaxiCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMPlacePageTaxiCell.xib; sourceTree = "<group>"; };
@ -2052,7 +2052,7 @@
F6E2FCDD1E097B9F0083EBEC /* _MWMPPPSubtitle.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = _MWMPPPSubtitle.xib; sourceTree = "<group>"; };
F6E2FCDE1E097B9F0083EBEC /* _MWMPPPTitle.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = _MWMPPPTitle.xib; sourceTree = "<group>"; };
F6E2FCDF1E097B9F0083EBEC /* MWMPPPreviewLayoutHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMPPPreviewLayoutHelper.h; sourceTree = "<group>"; };
F6E2FCE01E097B9F0083EBEC /* MWMPPPreviewLayoutHelper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMPPPreviewLayoutHelper.mm; sourceTree = "<group>"; };
F6E2FCE01E097B9F0083EBEC /* MWMPPPreviewLayoutHelper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = MWMPPPreviewLayoutHelper.mm; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
F6E2FCE31E097B9F0083EBEC /* MWMConsole.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMConsole.h; sourceTree = "<group>"; };
F6E2FCE41E097B9F0083EBEC /* MWMConsole.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMConsole.mm; sourceTree = "<group>"; };
F6E2FCE61E097B9F0083EBEC /* MWMSearchFilterPresentationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMSearchFilterPresentationController.h; sourceTree = "<group>"; };
@ -3622,10 +3622,10 @@
F6E2FCC11E097B9F0083EBEC /* RegularCell */ = {
isa = PBXGroup;
children = (
F6E2FCC21E097B9F0083EBEC /* MWMPlacePageInfoCell.h */,
F6E2FCC31E097B9F0083EBEC /* MWMPlacePageInfoCell.mm */,
F6E2FCC41E097B9F0083EBEC /* PlacePageInfoCell.xib */,
F6E2FCC51E097B9F0083EBEC /* PlacePageLinkCell.xib */,
F6E2FCC21E097B9F0083EBEC /* MWMPlacePageRegularCell.h */,
F6E2FCC31E097B9F0083EBEC /* MWMPlacePageRegularCell.mm */,
F6E2FCC41E097B9F0083EBEC /* MWMPlacePageInfoCell.xib */,
F6E2FCC51E097B9F0083EBEC /* MWMPlacePageLinkCell.xib */,
);
path = RegularCell;
sourceTree = "<group>";
@ -4104,7 +4104,7 @@
EE583CBB12F773F00042CBE3 /* unicode_blocks.txt in Resources */,
F6E2FDDC1E097BA00083EBEC /* MWMEditorTextTableViewCell.xib in Resources */,
340E1EF41E2F614400CE49BF /* SearchFilters.storyboard in Resources */,
F6E2FE8A1E097BA00083EBEC /* PlacePageInfoCell.xib in Resources */,
F6E2FE8A1E097BA00083EBEC /* MWMPlacePageInfoCell.xib in Resources */,
EEFE7C1412F8C9E1006AF8C3 /* fonts_blacklist.txt in Resources */,
F68FCB8C1DA7BD20007CC7D7 /* MWMTaxiPreviewCell.xib in Resources */,
F6E2FD581E097BA00083EBEC /* MWMMapDownloaderButtonTableViewCell.xib in Resources */,
@ -4168,8 +4168,7 @@
F6E2FE6F1E097BA00083EBEC /* _MWMOHSubCell.xib in Resources */,
F6172FA51BBD5A3E0081D325 /* MWMiPadRoutePreview.xib in Resources */,
97A5967F19B9CD47007A963F /* copyright.html in Resources */,
F6E2FDAF1E097BA00083EBEC /* MWMEditorAddAdditionalNameTableViewCell.xib in Resources */,
F6E2FE8D1E097BA00083EBEC /* PlacePageLinkCell.xib in Resources */,
F6E2FE8D1E097BA00083EBEC /* MWMPlacePageLinkCell.xib in Resources */,
F6E2FD671E097BA00083EBEC /* MWMMapDownloaderPlaceTableViewCell.xib in Resources */,
671182E31C7F0DD400CB8177 /* WorldCoasts_obsolete.mwm in Resources */,
3463BA681DE81DB90082417F /* MWMTrafficButtonViewController.xib in Resources */,
@ -4314,7 +4313,7 @@
6741A95C1BF340DE002C974C /* categories.txt in Resources */,
6741A95D1BF340DE002C974C /* types.txt in Resources */,
F6E2FF1B1E097BA00083EBEC /* MWMSearchTabbedCollectionViewCell.xib in Resources */,
F6E2FE8E1E097BA00083EBEC /* PlacePageLinkCell.xib in Resources */,
F6E2FE8E1E097BA00083EBEC /* MWMPlacePageLinkCell.xib in Resources */,
F6E2FDFB1E097BA00083EBEC /* MWMOpeningHoursAllDayTableViewCell.xib in Resources */,
6741A9601BF340DE002C974C /* MWMRoutingDisclaimerAlert.xib in Resources */,
F6E2FE761E097BA00083EBEC /* MWMOpeningHoursCell.xib in Resources */,
@ -4379,8 +4378,7 @@
F6E2FD591E097BA00083EBEC /* MWMMapDownloaderButtonTableViewCell.xib in Resources */,
F6E2FE521E097BA00083EBEC /* MWMActionBarButton.xib in Resources */,
349D1AE11E2E325C004A2006 /* MWMBottomMenuViewController.xib in Resources */,
F6E2FDD11E097BA00083EBEC /* MWMEditorSelectTableViewCell.xib in Resources */,
F6E2FE8B1E097BA00083EBEC /* PlacePageInfoCell.xib in Resources */,
F6E2FE8B1E097BA00083EBEC /* MWMPlacePageInfoCell.xib in Resources */,
F6E2FD741E097BA00083EBEC /* MWMMapDownloaderTableViewCell.xib in Resources */,
F64D9CA31C899C760063FA30 /* MWMEditorViralAlert.xib in Resources */,
F6E2FEA91E097BA00083EBEC /* _MWMPPPAddress.xib in Resources */,
@ -4437,7 +4435,7 @@
849CF5FE1DE842290024A8A5 /* MWMDefaultAlert.xib in Resources */,
849CF5FF1DE842290024A8A5 /* fonts_whitelist.txt in Resources */,
F6E2FDF61E097BA00083EBEC /* MWMOpeningHoursAddScheduleTableViewCell.xib in Resources */,
F6E2FE8C1E097BA00083EBEC /* PlacePageInfoCell.xib in Resources */,
F6E2FE8C1E097BA00083EBEC /* MWMPlacePageInfoCell.xib in Resources */,
849CF6011DE842290024A8A5 /* MWMDownloaderDialogHeader.xib in Resources */,
F6E2FF431E097BA00083EBEC /* MWMSearchTableViewController.xib in Resources */,
849CF6021DE842290024A8A5 /* World.mwm in Resources */,
@ -4506,7 +4504,7 @@
849CF6471DE842290024A8A5 /* MWMSideButtonsView.xib in Resources */,
849CF64A1DE842290024A8A5 /* editor.config in Resources */,
F6E2FEBC1E097BA00083EBEC /* _MWMPPPTitle.xib in Resources */,
F6E2FE8F1E097BA00083EBEC /* PlacePageLinkCell.xib in Resources */,
F6E2FE8F1E097BA00083EBEC /* MWMPlacePageLinkCell.xib in Resources */,
34F73FA41E08300E00AC1FD6 /* Images.xcassets in Resources */,
849CF64C1DE842290024A8A5 /* synonyms.txt in Resources */,
F6E2FF071E097BA00083EBEC /* MWMSearchHistoryClearCell.xib in Resources */,
@ -4758,7 +4756,7 @@
F6FEA82D1C58E89B007223CC /* MWMButton.mm in Sources */,
F6E2FE3C1E097BA00083EBEC /* MWMMigrationViewController.mm in Sources */,
F6E2FD4F1E097BA00083EBEC /* MWMMapDownloaderAdsTableViewCell.mm in Sources */,
F6E2FE871E097BA00083EBEC /* MWMPlacePageInfoCell.mm in Sources */,
F6E2FE871E097BA00083EBEC /* MWMPlacePageRegularCell.mm in Sources */,
34D3AFE91E378AF1004100F9 /* UINib+Init.swift in Sources */,
F6E2FD7F1E097BA00083EBEC /* MWMMapDownloaderExtendedDataSourceWithAds.mm in Sources */,
F6BD33871B62412E00F2CE18 /* MWMNavigationDashboardEntity.mm in Sources */,
@ -5012,7 +5010,7 @@
340475591E081A4600C92850 /* WebViewController.mm in Sources */,
F6E2FE3D1E097BA00083EBEC /* MWMMigrationViewController.mm in Sources */,
F6E2FD501E097BA00083EBEC /* MWMMapDownloaderAdsTableViewCell.mm in Sources */,
F6E2FE881E097BA00083EBEC /* MWMPlacePageInfoCell.mm in Sources */,
F6E2FE881E097BA00083EBEC /* MWMPlacePageRegularCell.mm in Sources */,
F6E2FD801E097BA00083EBEC /* MWMMapDownloaderExtendedDataSourceWithAds.mm in Sources */,
34D3AFEA1E378AF1004100F9 /* UINib+Init.swift in Sources */,
6741A9F11BF340DE002C974C /* MWMNavigationDashboardEntity.mm in Sources */,
@ -5268,7 +5266,7 @@
849CF6E91DE842290024A8A5 /* MWMCircularProgressView.mm in Sources */,
F6E2FE3E1E097BA00083EBEC /* MWMMigrationViewController.mm in Sources */,
F6E2FD511E097BA00083EBEC /* MWMMapDownloaderAdsTableViewCell.mm in Sources */,
F6E2FE891E097BA00083EBEC /* MWMPlacePageInfoCell.mm in Sources */,
F6E2FE891E097BA00083EBEC /* MWMPlacePageRegularCell.mm in Sources */,
34D3AFEB1E378AF1004100F9 /* UINib+Init.swift in Sources */,
F6E2FD811E097BA00083EBEC /* MWMMapDownloaderExtendedDataSourceWithAds.mm in Sources */,
849CF6EB1DE842290024A8A5 /* MWMAPIBar.mm in Sources */,

View file

@ -3,50 +3,10 @@
#import "MWMOpeningHours.h"
#import "MWMPlacePageData.h"
#import "MWMTableViewCell.h"
#import "SwiftBridge.h"
#include "std/array.hpp"
namespace
{
array<NSString *, 2> const kCells = {{@"_MWMOHHeaderCell", @"_MWMOHSubCell"}};
NSAttributedString * richStringFromDay(osmoh::Day const & day, BOOL isClosedNow)
{
auto const richString = ^NSMutableAttributedString * (NSString * str, UIFont * font, UIColor * color)
{
return [[NSMutableAttributedString alloc] initWithString:str
attributes:@{NSFontAttributeName : font,
NSForegroundColorAttributeName : color}];
};
auto str = richString(day.TodayTime(), [UIFont regular17], day.m_isOpen ? [UIColor blackPrimaryText] :
[UIColor red]);
if (day.m_isOpen)
{
auto lineBreak = [[NSAttributedString alloc] initWithString:@"\n"];
if (day.m_breaks.length)
{
[str appendAttributedString:lineBreak];
[str appendAttributedString:richString(day.m_breaks, [UIFont regular13], [UIColor blackSecondaryText])];
}
if (isClosedNow)
{
[str appendAttributedString:lineBreak];
[str appendAttributedString:richString(L(@"closed_now"), [UIFont regular13], [UIColor red])];
}
auto paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.lineSpacing = 4;
[str addAttributes:@{NSParagraphStyleAttributeName : paragraphStyle} range:{0, str.length}];
}
return str;
}
} // namespace
@interface MWMPlacePageData()
- (vector<place_page::MetainfoRows> &)mutableMetainfoRows;
@ -97,6 +57,48 @@ NSAttributedString * richStringFromDay(osmoh::Day const & day, BOOL isClosedNow)
@end
namespace
{
array<Class, 2> const kCells = {{[_MWMOHHeaderCell class], [_MWMOHSubCell class]}};
NSAttributedString * richStringFromDay(osmoh::Day const & day, BOOL isClosedNow)
{
auto const richString =
^NSMutableAttributedString *(NSString * str, UIFont * font, UIColor * color)
{
return [[NSMutableAttributedString alloc]
initWithString:str
attributes:@{NSFontAttributeName : font, NSForegroundColorAttributeName : color}];
};
auto str = richString(day.TodayTime(), [UIFont regular17],
day.m_isOpen ? [UIColor blackPrimaryText] : [UIColor red]);
if (day.m_isOpen)
{
auto lineBreak = [[NSAttributedString alloc] initWithString:@"\n"];
if (day.m_breaks.length)
{
[str appendAttributedString:lineBreak];
[str appendAttributedString:richString(day.m_breaks, [UIFont regular13],
[UIColor blackSecondaryText])];
}
if (isClosedNow)
{
[str appendAttributedString:lineBreak];
[str appendAttributedString:richString(L(@"closed_now"), [UIFont regular13], [UIColor red])];
}
auto paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.lineSpacing = 4;
[str addAttributes:@{ NSParagraphStyleAttributeName : paragraphStyle } range:{0, str.length}];
}
return str;
}
} // namespace
@interface MWMOpeningHoursLayoutHelper()
{
@ -127,8 +129,8 @@ NSAttributedString * richStringFromDay(osmoh::Day const & day, BOOL isClosedNow)
- (void)registerCells
{
for (auto name : kCells)
[self.tableView registerNib:[UINib nibWithNibName:name bundle:nil] forCellReuseIdentifier:name];
for (Class cls : kCells)
[self.tableView registerWithCellClass:cls];
}
- (void)configWithData:(MWMPlacePageData *)data
@ -146,7 +148,9 @@ NSAttributedString * richStringFromDay(osmoh::Day const & day, BOOL isClosedNow)
if (self.data.metainfoRows[indexPath.row] == place_page::MetainfoRows::OpeningHours)
{
_MWMOHHeaderCell * cell = [tableView dequeueReusableCellWithIdentifier:[_MWMOHHeaderCell className]];
Class cls = [_MWMOHHeaderCell class];
auto cell = static_cast<_MWMOHHeaderCell *>(
[tableView dequeueReusableCellWithCellClass:cls indexPath:indexPath]);
if (m_days.size() > 1)
{
@ -189,7 +193,9 @@ NSAttributedString * richStringFromDay(osmoh::Day const & day, BOOL isClosedNow)
}
else
{
_MWMOHSubCell * cell = [tableView dequeueReusableCellWithIdentifier:[_MWMOHSubCell className]];
Class cls = [_MWMOHSubCell class];
auto cell = static_cast<_MWMOHSubCell *>(
[tableView dequeueReusableCellWithCellClass:cls indexPath:indexPath]);
cell.days.text = day.m_workingDays;
cell.schedule.text = day.m_workingTimes ?: L(@"closed");
cell.breaks.text = day.m_breaks;

View file

@ -1,13 +0,0 @@
#import "MWMTableViewCell.h"
#import "MWMPlacePageData.h"
@interface MWMPlacePageInfoCell : MWMTableViewCell
- (void)configWithRow:(place_page::MetainfoRows)row
data:(MWMPlacePageData *)data;
@property(weak, nonatomic, readonly) IBOutlet UIImageView * icon;
@property(weak, nonatomic, readonly) IBOutlet id textContainer;
@end

View file

@ -1,13 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15A284" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="PlacePageInfoCell" id="VAd-kw-ZEC" customClass="MWMPlacePageInfoCell">
<tableViewCell contentMode="scaleToFill" restorationIdentifier="MWMPlacePageInfoCell" selectionStyle="none" indentationWidth="10" reuseIdentifier="MWMPlacePageInfoCell" id="VAd-kw-ZEC" customClass="MWMPlacePageInfoCell">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="VAd-kw-ZEC" id="KHz-zH-ymS">
@ -25,14 +29,14 @@
</userDefinedRuntimeAttributes>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="228" translatesAutoresizingMaskIntoConstraints="NO" id="viE-zJ-wsl" customClass="CopyLabel">
<rect key="frame" x="60" y="12" width="228" height="20"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<rect key="frame" x="60" y="12" width="228" height="19"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<gestureRecognizers/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" priority="750" constant="20" id="26Z-I0-jym"/>
</constraints>
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="17"/>
<color key="textColor" red="0.12941176469999999" green="0.12941176469999999" blue="0.12941176469999999" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="0.12941176469999999" green="0.12941176469999999" blue="0.12941176469999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular16"/>
@ -50,16 +54,16 @@
</userDefinedRuntimeAttributes>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vu9-VL-9jn">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
<state key="normal">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="cellTap" destination="VAd-kw-ZEC" eventType="touchUpInside" id="eLw-l7-FXA"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="xwC-DR-6Il" firstAttribute="leading" secondItem="KHz-zH-ymS" secondAttribute="leading" constant="16" id="4B0-o5-ixn"/>
<constraint firstAttribute="bottom" secondItem="viE-zJ-wsl" secondAttribute="bottom" constant="12" id="5Me-Rj-yun"/>
@ -78,7 +82,7 @@
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="white"/>
</userDefinedRuntimeAttributes>
</tableViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<gestureRecognizers/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="backgroundColorName" value="white"/>
@ -95,4 +99,9 @@
<resources>
<image name="ic_placepage_change" width="24" height="24"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4_7.fullscreen"/>
</simulatedMetricsContainer>
</document>

View file

@ -1,21 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11201" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="PlacePageLinkCell" id="DKh-ne-anv" customClass="MWMPlacePageInfoCell">
<tableViewCell contentMode="scaleToFill" restorationIdentifier="MWMPlacePageLinkCell" selectionStyle="none" indentationWidth="10" reuseIdentifier="MWMPlacePageLinkCell" id="DKh-ne-anv" customClass="MWMPlacePageLinkCell">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="DKh-ne-anv" id="M4j-cz-kSo">
<frame key="frameInset" width="320" height="43.5"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="DT5-2i-vCG">
<rect key="frame" x="16" y="8" width="28" height="28"/>
<constraints>
<constraint firstAttribute="width" constant="28" id="vLS-Ha-Cbl"/>
<constraint firstAttribute="height" constant="28" id="vvn-a9-Lfo"/>
@ -25,6 +29,7 @@
</userDefinedRuntimeAttributes>
</imageView>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" editable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="T5l-Sb-Hfo">
<rect key="frame" x="60" y="0.0" width="260" height="44"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
<fontDescription key="fontDescription" type="system" weight="light" pointSize="16"/>

View file

@ -0,0 +1,18 @@
#import "MWMTableViewCell.h"
#import "MWMPlacePageData.h"
@interface MWMPlacePageRegularCell : MWMTableViewCell
- (void)configWithRow:(place_page::MetainfoRows)row data:(MWMPlacePageData *)data;
@property(weak, nonatomic, readonly) IBOutlet UIImageView * icon;
@property(weak, nonatomic, readonly) IBOutlet id textContainer;
@end
@interface MWMPlacePageInfoCell : MWMPlacePageRegularCell
@end
@interface MWMPlacePageLinkCell : MWMPlacePageRegularCell
@end

View file

@ -1,4 +1,4 @@
#import "MWMPlacePageInfoCell.h"
#import "MWMPlacePageRegularCell.h"
#import "MWMCommon.h"
#import "MapViewController.h"
#import "MapsAppDelegate.h"
@ -8,7 +8,7 @@
#include "platform/measurement_utils.hpp"
#include "platform/settings.hpp"
@interface MWMPlacePageInfoCell ()<UITextViewDelegate>
@interface MWMPlacePageRegularCell ()<UITextViewDelegate>
@property(weak, nonatomic, readwrite) IBOutlet UIImageView * icon;
@property(weak, nonatomic, readwrite) IBOutlet id textContainer;
@ -21,7 +21,7 @@
@end
@implementation MWMPlacePageInfoCell
@implementation MWMPlacePageRegularCell
- (void)awakeFromNib
{
@ -172,3 +172,9 @@
}
@end
@implementation MWMPlacePageInfoCell
@end
@implementation MWMPlacePageLinkCell
@end

View file

@ -6,8 +6,8 @@
#import "MWMPlacePageButtonCell.h"
#import "MWMPlacePageCellUpdateProtocol.h"
#import "MWMPlacePageData.h"
#import "MWMPlacePageInfoCell.h"
#import "MWMPlacePageLayoutImpl.h"
#import "MWMPlacePageRegularCell.h"
#import "MWMPlacePageTaxiCell.h"
#import "MWMiPadPlacePageLayoutImpl.h"
#import "MWMiPhonePlacePageLayoutImpl.h"
@ -20,23 +20,18 @@
namespace
{
array<NSString *, 1> const kBookmarkCells = {{@"MWMBookmarkCell"}};
using place_page::MetainfoRows;
map<MetainfoRows, NSString *> const kMetaInfoCells = {
{MetainfoRows::Website, @"PlacePageLinkCell"},
{MetainfoRows::Address, @"PlacePageInfoCell"},
{MetainfoRows::Email, @"PlacePageLinkCell"},
{MetainfoRows::Phone, @"PlacePageLinkCell"},
{MetainfoRows::Cuisine, @"PlacePageInfoCell"},
{MetainfoRows::Operator, @"PlacePageInfoCell"},
{MetainfoRows::Coordinate, @"PlacePageInfoCell"},
{MetainfoRows::Internet, @"PlacePageInfoCell"},
{MetainfoRows::Taxi, @"MWMPlacePageTaxiCell"}};
array<NSString *, 1> const kButtonsCells = {{@"MWMPlacePageButtonCell"}};
map<MetainfoRows, Class> const kMetaInfoCells = {
{MetainfoRows::Website, [MWMPlacePageLinkCell class]},
{MetainfoRows::Address, [MWMPlacePageInfoCell class]},
{MetainfoRows::Email, [MWMPlacePageLinkCell class]},
{MetainfoRows::Phone, [MWMPlacePageLinkCell class]},
{MetainfoRows::Cuisine, [MWMPlacePageInfoCell class]},
{MetainfoRows::Operator, [MWMPlacePageInfoCell class]},
{MetainfoRows::Coordinate, [MWMPlacePageInfoCell class]},
{MetainfoRows::Internet, [MWMPlacePageInfoCell class]},
{MetainfoRows::Taxi, [MWMPlacePageTaxiCell class]}};
} // namespace
@interface MWMPlacePageLayout () <UITableViewDataSource,
@ -99,18 +94,12 @@ array<NSString *, 1> const kButtonsCells = {{@"MWMPlacePageButtonCell"}};
- (void)registerCells
{
auto tv = self.placePageView.tableView;
[tv registerNib:[UINib nibWithNibName:kButtonsCells[0] bundle:nil]
forCellReuseIdentifier:kButtonsCells[0]];
[tv registerNib:[UINib nibWithNibName:kBookmarkCells[0] bundle:nil]
forCellReuseIdentifier:kBookmarkCells[0]];
[tv registerWithCellClass:[MWMPlacePageButtonCell class]];
[tv registerWithCellClass:[MWMBookmarkCell class]];
// Register all meta info cells.
for (auto const & pair : kMetaInfoCells)
{
NSString * name = pair.second;
[tv registerNib:[UINib nibWithNibName:name bundle:nil] forCellReuseIdentifier:name];
}
[tv registerWithCellClass:pair.second];
}
- (void)layoutWithSize:(CGSize const &)size
@ -314,7 +303,9 @@ array<NSString *, 1> const kButtonsCells = {{@"MWMPlacePageButtonCell"}};
}
case Sections::Bookmark:
{
MWMBookmarkCell * c = [tableView dequeueReusableCellWithIdentifier:kBookmarkCells[0]];
Class cls = [MWMBookmarkCell class];
auto c = static_cast<MWMBookmarkCell *>(
[tableView dequeueReusableCellWithCellClass:cls indexPath:indexPath]);
[c configureWithText:data.bookmarkDescription
updateCellDelegate:self
editBookmarkDelegate:delegate
@ -338,13 +329,17 @@ array<NSString *, 1> const kButtonsCells = {{@"MWMPlacePageButtonCell"}};
case MetainfoRows::Internet:
case MetainfoRows::Coordinate:
{
MWMPlacePageInfoCell * c = [tableView dequeueReusableCellWithIdentifier:kMetaInfoCells.at(row)];
Class cls = kMetaInfoCells.at(row);
auto c = static_cast<MWMPlacePageRegularCell *>(
[tableView dequeueReusableCellWithCellClass:cls indexPath:indexPath]);
[c configWithRow:row data:data];
return c;
}
case MetainfoRows::Taxi:
{
MWMPlacePageTaxiCell * c = [tableView dequeueReusableCellWithIdentifier:kMetaInfoCells.at(row)];
Class cls = kMetaInfoCells.at(row);
auto c = static_cast<MWMPlacePageTaxiCell *>(
[tableView dequeueReusableCellWithCellClass:cls indexPath:indexPath]);
c.delegate = delegate;
return c;
}
@ -352,7 +347,9 @@ array<NSString *, 1> const kButtonsCells = {{@"MWMPlacePageButtonCell"}};
}
case Sections::Buttons:
{
MWMPlacePageButtonCell * c = [tableView dequeueReusableCellWithIdentifier:kButtonsCells[0]];
Class cls = [MWMPlacePageButtonCell class];
auto c = static_cast<MWMPlacePageButtonCell *>(
[tableView dequeueReusableCellWithCellClass:cls indexPath:indexPath]);
auto const row = data.buttonsRows[indexPath.row];
[c configForRow:row withDelegate:delegate];

View file

@ -1,19 +1,14 @@
#import "MWMPPPreviewLayoutHelper.h"
#import "MWMCommon.h"
#import "MWMDirectionView.h"
#import "MWMPlacePageData.h"
#import "MWMPPPreviewBannerCell.h"
#import "MWMPlacePageData.h"
#import "MWMTableViewCell.h"
#import "Statistics.h"
#import "SwiftBridge.h"
#include "std/array.hpp"
namespace
{
array<NSString *, 8> const kPreviewCells = {{@"_MWMPPPTitle", @"_MWMPPPExternalTitle", @"_MWMPPPSubtitle",
@"_MWMPPPSchedule", @"_MWMPPPBooking", @"_MWMPPPAddress", @"_MWMPPPSpace", @"MWMPPPreviewBannerCell"}};
} // namespace
#pragma mark - Base
// Base class for avoiding copy-paste in inheriting cells.
@interface _MWMPPPCellBase : MWMTableViewCell
@ -125,6 +120,14 @@ array<NSString *, 8> const kPreviewCells = {{@"_MWMPPPTitle", @"_MWMPPPExternalT
@implementation _MWMPPPSpace
@end
namespace
{
array<Class, 8> const kPreviewCells = {{[_MWMPPPTitle class], [_MWMPPPExternalTitle class],
[_MWMPPPSubtitle class], [_MWMPPPSchedule class],
[_MWMPPPBooking class], [_MWMPPPAddress class],
[_MWMPPPSpace class], [MWMPPPreviewBannerCell class]}};
} // namespace
@interface MWMPPPreviewLayoutHelper ()
@property(weak, nonatomic) UITableView * tableView;
@ -160,8 +163,8 @@ array<NSString *, 8> const kPreviewCells = {{@"_MWMPPPTitle", @"_MWMPPPExternalT
- (void)registerCells
{
for (auto name : kPreviewCells)
[self.tableView registerNib:[UINib nibWithNibName:name bundle:nil] forCellReuseIdentifier:name];
for (Class cls : kPreviewCells)
[self.tableView registerWithCellClass:cls];
}
- (void)configWithData:(MWMPlacePageData *)data
@ -180,9 +183,9 @@ array<NSString *, 8> const kPreviewCells = {{@"_MWMPPPTitle", @"_MWMPPPExternalT
using namespace place_page;
auto tableView = self.tableView;
auto const row = data.previewRows[indexPath.row];
auto cellName = kPreviewCells[static_cast<size_t>(row)];
Class cls = kPreviewCells[static_cast<size_t>(row)];
auto * c = [tableView dequeueReusableCellWithIdentifier:cellName];
auto * c = [tableView dequeueReusableCellWithCellClass:cls indexPath:indexPath];
switch(row)
{
case PreviewRows::Title: