[ios] refactor search screen cells and tab bar
- remove xibs - update cells style (fonts, colors, icons) - reload the history VC on appear Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
This commit is contained in:
parent
3229ca602d
commit
bf2efed0be
26 changed files with 307 additions and 434 deletions
9
iphone/Maps/Categories/UIImage+FilledWithColor.swift
Normal file
9
iphone/Maps/Categories/UIImage+FilledWithColor.swift
Normal file
|
@ -0,0 +1,9 @@
|
|||
extension UIImage {
|
||||
static func filled(with color: UIColor, size: CGSize = CGSize(width: 1, height: 1)) -> UIImage {
|
||||
let renderer = UIGraphicsImageRenderer(size: size)
|
||||
return renderer.image { context in
|
||||
color.setFill()
|
||||
context.fill(CGRect(origin: .zero, size: size))
|
||||
}
|
||||
}
|
||||
}
|
|
@ -23,8 +23,7 @@
|
|||
- (void)setIsSeparatorHidden:(BOOL)isSeparatorHidden
|
||||
{
|
||||
_isSeparatorHidden = isSeparatorHidden;
|
||||
if (isSeparatorHidden)
|
||||
[self hideSeparators];
|
||||
isSeparatorHidden ? [self hideSeparators] : [self showSeparators];
|
||||
}
|
||||
|
||||
- (void)hideSeparators
|
||||
|
@ -33,6 +32,12 @@
|
|||
view.hidden = [[[view class] className] isEqualToString:@"_UITableViewCellSeparatorView"];
|
||||
}
|
||||
|
||||
- (void)showSeparators
|
||||
{
|
||||
for (UIView * view in self.subviews)
|
||||
view.hidden = NO;
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
|
|
|
@ -8,6 +8,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
@interface SearchResult : NSObject
|
||||
|
||||
@property (nonatomic, readonly) NSString * titleText;
|
||||
@property (nonatomic, readonly) NSString * iconImageName;
|
||||
@property (nonatomic, readonly) NSString * addressText;
|
||||
@property (nonatomic, readonly) NSString * infoText;
|
||||
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
|
||||
|
@ -21,6 +22,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
@property (nonatomic, readonly) NSArray<NSValue *> * highlightRanges;
|
||||
@property (nonatomic, readonly) SearchItemType itemType;
|
||||
|
||||
/// This initializer is intended only for testing purposes.
|
||||
- (instancetype)initWithTitleText:(NSString *)titleText type:(SearchItemType)type suggestion:(NSString *)suggestion;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
|
@ -6,9 +6,22 @@
|
|||
#import "platform/localization.hpp"
|
||||
#import "platform/distance.hpp"
|
||||
|
||||
#include "map/bookmark_helpers.hpp"
|
||||
|
||||
#import "geometry/mercator.hpp"
|
||||
|
||||
@implementation SearchResult
|
||||
|
||||
- (instancetype)initWithTitleText:(NSString *)titleText type:(SearchItemType)type suggestion:(NSString *)suggestion {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_titleText = titleText;
|
||||
_itemType = type;
|
||||
_suggestion = suggestion;
|
||||
};
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation SearchResult(Core)
|
||||
|
@ -80,6 +93,14 @@
|
|||
_highlightRanges = [ranges copy];
|
||||
|
||||
_itemType = itemType;
|
||||
|
||||
if (result.GetResultType() == search::Result::Type::Feature) {
|
||||
auto const featureType = result.GetFeatureType();
|
||||
auto const bookmarkImage = GetBookmarkIconByFeatureType(featureType);
|
||||
_iconImageName = [NSString stringWithFormat:@"%@%@",
|
||||
@"ic_bm_",
|
||||
[@(kml::ToString(bookmarkImage).c_str()) lowercaseString]];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
var medium9: UIFont { get }
|
||||
var medium10: UIFont { get }
|
||||
var medium12: UIFont { get }
|
||||
var medium13: UIFont { get }
|
||||
var medium14: UIFont { get }
|
||||
var medium16: UIFont { get }
|
||||
var medium17: UIFont { get }
|
||||
|
|
|
@ -17,6 +17,7 @@ enum FontStyleSheet: String, CaseIterable {
|
|||
case medium9
|
||||
case medium10
|
||||
case medium12
|
||||
case medium13
|
||||
case medium14
|
||||
case medium16
|
||||
case medium17
|
||||
|
@ -83,6 +84,7 @@ extension FontStyleSheet: IStyleSheet {
|
|||
case .medium9: return fonts.medium9
|
||||
case .medium10: return fonts.medium10
|
||||
case .medium12: return fonts.medium12
|
||||
case .medium13: return fonts.medium13
|
||||
case .medium14: return fonts.medium14
|
||||
case .medium16: return fonts.medium16
|
||||
case .medium17: return fonts.medium17
|
||||
|
|
|
@ -16,6 +16,7 @@ class Fonts: IFonts {
|
|||
var medium9 = UIFont.systemFont(ofSize: 9, weight:UIFont.Weight.medium)
|
||||
var medium10 = UIFont.systemFont(ofSize: 10, weight:UIFont.Weight.medium)
|
||||
var medium12 = UIFont.systemFont(ofSize: 12, weight:UIFont.Weight.medium)
|
||||
var medium13 = UIFont.systemFont(ofSize: 13, weight:UIFont.Weight.medium)
|
||||
var medium14 = UIFont.systemFont(ofSize: 14, weight:UIFont.Weight.medium)
|
||||
var medium16 = UIFont.systemFont(ofSize: 16, weight:UIFont.Weight.medium)
|
||||
var medium17 = UIFont.systemFont(ofSize: 17, weight:UIFont.Weight.medium)
|
||||
|
|
|
@ -11,11 +11,10 @@
|
|||
1DFA2F6A20D3B57400FB2C66 /* UIColor+PartnerColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DFA2F6920D3B57400FB2C66 /* UIColor+PartnerColor.m */; };
|
||||
3304306D21D4EAFB00317CA3 /* SearchCategoryCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3304306C21D4EAFB00317CA3 /* SearchCategoryCell.swift */; };
|
||||
33046832219C57180041F3A8 /* CategorySettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33046831219C57180041F3A8 /* CategorySettingsViewController.swift */; };
|
||||
337F98A321D37B5800C8AC27 /* SearchHistoryViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 337F98A021D37B5700C8AC27 /* SearchHistoryViewController.xib */; };
|
||||
337F98A621D37B7400C8AC27 /* SearchTabViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 337F98A521D37B7400C8AC27 /* SearchTabViewController.swift */; };
|
||||
337F98B221D3BAE600C8AC27 /* SearchCategoriesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 337F98B121D3BAE600C8AC27 /* SearchCategoriesViewController.swift */; };
|
||||
337F98B421D3C9F200C8AC27 /* SearchHistoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 337F98B321D3C9F200C8AC27 /* SearchHistoryViewController.swift */; };
|
||||
337F98B821D3D67E00C8AC27 /* SearchHistoryQueryCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 337F98B721D3D67E00C8AC27 /* SearchHistoryQueryCell.swift */; };
|
||||
337F98B821D3D67E00C8AC27 /* SearchHistoryCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 337F98B721D3D67E00C8AC27 /* SearchHistoryCell.swift */; };
|
||||
340416481E7BF28E00E2B6D6 /* UIView+Snapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 340416461E7BF28E00E2B6D6 /* UIView+Snapshot.swift */; };
|
||||
3404164C1E7BF42E00E2B6D6 /* UIView+Coordinates.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3404164A1E7BF42D00E2B6D6 /* UIView+Coordinates.swift */; };
|
||||
3404754D1E081A4600C92850 /* MWMKeyboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 340475191E081A4600C92850 /* MWMKeyboard.m */; };
|
||||
|
@ -521,6 +520,7 @@
|
|||
ED808D0F2C38407800D52585 /* CircleImageButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED808D0E2C38407800D52585 /* CircleImageButton.swift */; };
|
||||
ED810EC52D566E9B00ECDE2C /* SearchOnMapTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED810EC42D566E9B00ECDE2C /* SearchOnMapTests.swift */; };
|
||||
ED8270F02C2071A3005966DA /* SettingsTableViewDetailedSwitchCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED8270EF2C2071A3005966DA /* SettingsTableViewDetailedSwitchCell.swift */; };
|
||||
ED83880F2D54DEB3002A0536 /* UIImage+FilledWithColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED83880E2D54DEA4002A0536 /* UIImage+FilledWithColor.swift */; };
|
||||
ED914AB22D35063A00973C45 /* TextColorStyleSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED914AB12D35063A00973C45 /* TextColorStyleSheet.swift */; };
|
||||
ED914AB82D351DF000973C45 /* StyleApplicable.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED914AB72D351DF000973C45 /* StyleApplicable.swift */; };
|
||||
ED914ABE2D351FF800973C45 /* UILabel+SetFontStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED914ABD2D351FF800973C45 /* UILabel+SetFontStyle.swift */; };
|
||||
|
@ -635,9 +635,6 @@
|
|||
F6E2FEE51E097BA00083EBEC /* MWMSearchNoResults.m in Sources */ = {isa = PBXBuildFile; fileRef = F6E2FCFD1E097B9F0083EBEC /* MWMSearchNoResults.m */; };
|
||||
F6E2FEE81E097BA00083EBEC /* MWMSearchNoResults.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6E2FCFE1E097B9F0083EBEC /* MWMSearchNoResults.xib */; };
|
||||
F6E2FEEE1E097BA00083EBEC /* MWMSearchView.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6E2FD011E097B9F0083EBEC /* MWMSearchView.xib */; };
|
||||
F6E2FF001E097BA00083EBEC /* SearchCategoryCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6E2FD0E1E097B9F0083EBEC /* SearchCategoryCell.xib */; };
|
||||
F6E2FF061E097BA00083EBEC /* SearchHistoryClearCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6E2FD121E097B9F0083EBEC /* SearchHistoryClearCell.xib */; };
|
||||
F6E2FF151E097BA00083EBEC /* SearchHistoryQueryCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6E2FD1A1E097B9F0083EBEC /* SearchHistoryQueryCell.xib */; };
|
||||
F6E2FF2D1E097BA00083EBEC /* MWMSearchCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6E2FD2A1E097BA00083EBEC /* MWMSearchCell.mm */; };
|
||||
F6E2FF301E097BA00083EBEC /* MWMSearchCommonCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6E2FD2C1E097BA00083EBEC /* MWMSearchCommonCell.mm */; };
|
||||
F6E2FF331E097BA00083EBEC /* MWMSearchCommonCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6E2FD2D1E097BA00083EBEC /* MWMSearchCommonCell.xib */; };
|
||||
|
@ -810,11 +807,10 @@
|
|||
30034C602B3F0B8A005D961A /* az */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = az; path = az.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
3304306C21D4EAFB00317CA3 /* SearchCategoryCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchCategoryCell.swift; sourceTree = "<group>"; };
|
||||
33046831219C57180041F3A8 /* CategorySettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategorySettingsViewController.swift; sourceTree = "<group>"; };
|
||||
337F98A021D37B5700C8AC27 /* SearchHistoryViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SearchHistoryViewController.xib; sourceTree = "<group>"; };
|
||||
337F98A521D37B7400C8AC27 /* SearchTabViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchTabViewController.swift; sourceTree = "<group>"; };
|
||||
337F98B121D3BAE600C8AC27 /* SearchCategoriesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchCategoriesViewController.swift; sourceTree = "<group>"; };
|
||||
337F98B321D3C9F200C8AC27 /* SearchHistoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchHistoryViewController.swift; sourceTree = "<group>"; };
|
||||
337F98B721D3D67E00C8AC27 /* SearchHistoryQueryCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchHistoryQueryCell.swift; sourceTree = "<group>"; };
|
||||
337F98B721D3D67E00C8AC27 /* SearchHistoryCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchHistoryCell.swift; sourceTree = "<group>"; };
|
||||
340416461E7BF28E00E2B6D6 /* UIView+Snapshot.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Snapshot.swift"; sourceTree = "<group>"; };
|
||||
3404164A1E7BF42D00E2B6D6 /* UIView+Coordinates.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Coordinates.swift"; sourceTree = "<group>"; };
|
||||
340475181E081A4600C92850 /* MWMKeyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMKeyboard.h; sourceTree = "<group>"; };
|
||||
|
@ -1501,6 +1497,7 @@
|
|||
ED808D0E2C38407800D52585 /* CircleImageButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CircleImageButton.swift; sourceTree = "<group>"; };
|
||||
ED810EC42D566E9B00ECDE2C /* SearchOnMapTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchOnMapTests.swift; sourceTree = "<group>"; };
|
||||
ED8270EF2C2071A3005966DA /* SettingsTableViewDetailedSwitchCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsTableViewDetailedSwitchCell.swift; sourceTree = "<group>"; };
|
||||
ED83880E2D54DEA4002A0536 /* UIImage+FilledWithColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+FilledWithColor.swift"; sourceTree = "<group>"; };
|
||||
ED914AB12D35063A00973C45 /* TextColorStyleSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextColorStyleSheet.swift; sourceTree = "<group>"; };
|
||||
ED914AB72D351DF000973C45 /* StyleApplicable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StyleApplicable.swift; sourceTree = "<group>"; };
|
||||
ED914ABD2D351FF800973C45 /* UILabel+SetFontStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UILabel+SetFontStyle.swift"; sourceTree = "<group>"; };
|
||||
|
@ -1701,9 +1698,6 @@
|
|||
F6E2FCFD1E097B9F0083EBEC /* MWMSearchNoResults.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = MWMSearchNoResults.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||
F6E2FCFE1E097B9F0083EBEC /* MWMSearchNoResults.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMSearchNoResults.xib; sourceTree = "<group>"; };
|
||||
F6E2FD011E097B9F0083EBEC /* MWMSearchView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMSearchView.xib; sourceTree = "<group>"; };
|
||||
F6E2FD0E1E097B9F0083EBEC /* SearchCategoryCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SearchCategoryCell.xib; sourceTree = "<group>"; };
|
||||
F6E2FD121E097B9F0083EBEC /* SearchHistoryClearCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SearchHistoryClearCell.xib; sourceTree = "<group>"; };
|
||||
F6E2FD1A1E097B9F0083EBEC /* SearchHistoryQueryCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SearchHistoryQueryCell.xib; sourceTree = "<group>"; };
|
||||
F6E2FD231E097BA00083EBEC /* MWMSearchTabbedViewProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMSearchTabbedViewProtocol.h; sourceTree = "<group>"; };
|
||||
F6E2FD291E097BA00083EBEC /* MWMSearchCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMSearchCell.h; sourceTree = "<group>"; };
|
||||
F6E2FD2A1E097BA00083EBEC /* MWMSearchCell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMSearchCell.mm; sourceTree = "<group>"; };
|
||||
|
@ -2266,6 +2260,7 @@
|
|||
3454D7981E07F045004AF2AD /* Categories */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
ED83880E2D54DEA4002A0536 /* UIImage+FilledWithColor.swift */,
|
||||
99A614E223CDD1D900D8D8D0 /* UIButton+RuntimeAttributes.h */,
|
||||
99A614E323CDD1D900D8D8D0 /* UIButton+RuntimeAttributes.m */,
|
||||
34D3B04D1E38A20C004100F9 /* Bundle+Init.swift */,
|
||||
|
@ -3935,7 +3930,6 @@
|
|||
children = (
|
||||
337F98B121D3BAE600C8AC27 /* SearchCategoriesViewController.swift */,
|
||||
3304306C21D4EAFB00317CA3 /* SearchCategoryCell.swift */,
|
||||
F6E2FD0E1E097B9F0083EBEC /* SearchCategoryCell.xib */,
|
||||
);
|
||||
path = CategoriesTab;
|
||||
sourceTree = "<group>";
|
||||
|
@ -3943,11 +3937,8 @@
|
|||
F6E2FD0F1E097B9F0083EBEC /* HistoryTab */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F6E2FD121E097B9F0083EBEC /* SearchHistoryClearCell.xib */,
|
||||
337F98B721D3D67E00C8AC27 /* SearchHistoryQueryCell.swift */,
|
||||
F6E2FD1A1E097B9F0083EBEC /* SearchHistoryQueryCell.xib */,
|
||||
337F98B721D3D67E00C8AC27 /* SearchHistoryCell.swift */,
|
||||
337F98B321D3C9F200C8AC27 /* SearchHistoryViewController.swift */,
|
||||
337F98A021D37B5700C8AC27 /* SearchHistoryViewController.xib */,
|
||||
);
|
||||
path = HistoryTab;
|
||||
sourceTree = "<group>";
|
||||
|
@ -4389,7 +4380,6 @@
|
|||
FA637ED529A500BE00D8921A /* drules_proto_outdoors_dark.bin in Resources */,
|
||||
4554B6EC1E55F0EF0084017F /* drules_proto_vehicle_light.bin in Resources */,
|
||||
47CA68F2250B54AF00671019 /* BookmarksListCell.xib in Resources */,
|
||||
337F98A321D37B5800C8AC27 /* SearchHistoryViewController.xib in Resources */,
|
||||
F6E2FE761E097BA00083EBEC /* MWMOpeningHoursCell.xib in Resources */,
|
||||
34AB66351FC5AA330078E451 /* RouteManagerCell.xib in Resources */,
|
||||
F6E2FE011E097BA00083EBEC /* MWMOpeningHoursClosedSpanTableViewCell.xib in Resources */,
|
||||
|
@ -4406,12 +4396,9 @@
|
|||
F6E2FE851E097BA00083EBEC /* MWMPlacePageOpeningHoursWeekDayView.xib in Resources */,
|
||||
6741A9601BF340DE002C974C /* MWMRoutingDisclaimerAlert.xib in Resources */,
|
||||
B3E3B4FD20D463B700DA8C13 /* BMCCategoriesHeader.xib in Resources */,
|
||||
F6E2FF001E097BA00083EBEC /* SearchCategoryCell.xib in Resources */,
|
||||
F6E2FF331E097BA00083EBEC /* MWMSearchCommonCell.xib in Resources */,
|
||||
F6E2FF061E097BA00083EBEC /* SearchHistoryClearCell.xib in Resources */,
|
||||
BB7626B61E85599C0031D71C /* icudt75l.dat in Resources */,
|
||||
34AB665C1FC5AA330078E451 /* TransportTransitIntermediatePoint.xib in Resources */,
|
||||
F6E2FF151E097BA00083EBEC /* SearchHistoryQueryCell.xib in Resources */,
|
||||
F6E2FEE81E097BA00083EBEC /* MWMSearchNoResults.xib in Resources */,
|
||||
34AB660E1FC5AA320078E451 /* NavigationControlView.xib in Resources */,
|
||||
408645FC21495EB1000A4A1D /* categories_cuisines.txt in Resources */,
|
||||
|
@ -4750,6 +4737,7 @@
|
|||
99012852244732DB00C72B10 /* BottomTabBarBuilder.swift in Sources */,
|
||||
99012847243F0D6900C72B10 /* UIViewController+alternative.swift in Sources */,
|
||||
995739062355CAC40019AEE7 /* ImageViewCrossDisolve.swift in Sources */,
|
||||
ED83880F2D54DEB3002A0536 /* UIImage+FilledWithColor.swift in Sources */,
|
||||
47B9065221C7FA400079C85E /* MWMWebImage.m in Sources */,
|
||||
47A13CAD24BE9AA500027D4F /* DatePickerViewRenderer.swift in Sources */,
|
||||
ED2E328E2D10500900807A08 /* TrackRecordingButtonArea.swift in Sources */,
|
||||
|
@ -4850,7 +4838,7 @@
|
|||
47E460AD240D737D00385B45 /* OpeinigHoursLocalization.swift in Sources */,
|
||||
99F9A0E52462CA0E00AE21E0 /* DownloadAllView.swift in Sources */,
|
||||
F6E2FF301E097BA00083EBEC /* MWMSearchCommonCell.mm in Sources */,
|
||||
337F98B821D3D67E00C8AC27 /* SearchHistoryQueryCell.swift in Sources */,
|
||||
337F98B821D3D67E00C8AC27 /* SearchHistoryCell.swift in Sources */,
|
||||
34AB66621FC5AA330078E451 /* TransportTransitSeparator.swift in Sources */,
|
||||
CDCA2743223F8D1E00167D87 /* ListItemInfo.swift in Sources */,
|
||||
993DF11F23F6BDB100AC231A /* UITableViewCellRenderer.swift in Sources */,
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
|
||||
@class SearchResult;
|
||||
|
||||
static CGFloat const kSearchCellSeparatorInset = 48;
|
||||
|
||||
@interface MWMSearchCell : MWMTableViewCell
|
||||
|
||||
- (void)configureWith:(SearchResult * _Nonnull)result;
|
||||
- (void)configureWith:(SearchResult * _Nonnull)result isPartialMatching:(BOOL)isPartialMatching;
|
||||
|
||||
@end
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
@implementation MWMSearchCell
|
||||
|
||||
- (void)configureWith:(SearchResult * _Nonnull)result {
|
||||
- (void)configureWith:(SearchResult * _Nonnull)result isPartialMatching:(BOOL)isPartialMatching {
|
||||
NSString * title = result.titleText;
|
||||
|
||||
if (title.length == 0)
|
||||
|
@ -27,9 +27,10 @@
|
|||
}
|
||||
NSMutableAttributedString * attributedTitle =
|
||||
[[NSMutableAttributedString alloc] initWithString:title];
|
||||
[attributedTitle addAttributes:unselectedTitleAttributes range:NSMakeRange(0, title.length)];
|
||||
NSDictionary * titleAttributes = isPartialMatching ? unselectedTitleAttributes : selectedTitleAttributes;
|
||||
|
||||
NSArray<NSValue *> *highlightRanges = result.highlightRanges;
|
||||
[attributedTitle addAttributes:titleAttributes range:NSMakeRange(0, title.length)];
|
||||
|
||||
for (NSValue *rangeValue in highlightRanges) {
|
||||
NSRange range = [rangeValue rangeValue];
|
||||
|
|
|
@ -5,6 +5,6 @@
|
|||
NS_SWIFT_NAME(SearchCommonCell)
|
||||
@interface MWMSearchCommonCell : MWMSearchCell
|
||||
|
||||
- (void)configureWith:(SearchResult * _Nonnull)result;
|
||||
- (void)configureWith:(SearchResult * _Nonnull)result isPartialMatching:(BOOL)isPartialMatching;
|
||||
|
||||
@end
|
||||
|
|
|
@ -4,13 +4,6 @@
|
|||
#import "SwiftBridge.h"
|
||||
#import "SearchResult.h"
|
||||
|
||||
#include "map/place_page_info.hpp"
|
||||
|
||||
#include "geometry/mercator.hpp"
|
||||
|
||||
#include "platform/localization.hpp"
|
||||
#include "platform/distance.hpp"
|
||||
|
||||
@interface MWMSearchCommonCell ()
|
||||
|
||||
@property(weak, nonatomic) IBOutlet UILabel * distanceLabel;
|
||||
|
@ -18,35 +11,41 @@
|
|||
@property(weak, nonatomic) IBOutlet UILabel * locationLabel;
|
||||
@property(weak, nonatomic) IBOutlet UILabel * openLabel;
|
||||
@property(weak, nonatomic) IBOutlet UIView * popularView;
|
||||
@property(weak, nonatomic) IBOutlet UIImageView * iconImageView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMSearchCommonCell
|
||||
|
||||
- (void)configureWith:(SearchResult * _Nonnull)result {
|
||||
[super configureWith:result];
|
||||
- (void)configureWith:(SearchResult * _Nonnull)result isPartialMatching:(BOOL)isPartialMatching {
|
||||
[super configureWith:result isPartialMatching:isPartialMatching];
|
||||
self.locationLabel.text = result.addressText;
|
||||
[self.locationLabel sizeToFit];
|
||||
|
||||
self.infoLabel.text = result.infoText;
|
||||
self.distanceLabel.text = result.distanceText;
|
||||
self.popularView.hidden = YES;
|
||||
self.openLabel.text = result.openStatusText;
|
||||
self.openLabel.textColor = result.openStatusColor;
|
||||
[self.openLabel setHidden:result.openStatusText.length == 0];
|
||||
[self setStyleNameAndApply: @"Background"];
|
||||
[self setStyleNameAndApply:@"Background"];
|
||||
[self.iconImageView setStyleNameAndApply:@"BlueBackground"];
|
||||
self.iconImageView.image = [UIImage imageNamed:result.iconImageName];
|
||||
self.separatorInset = UIEdgeInsetsMake(0, kSearchCellSeparatorInset, 0, 0);
|
||||
}
|
||||
|
||||
- (NSDictionary *)selectedTitleAttributes
|
||||
{
|
||||
- (void)layoutSubviews {
|
||||
[super layoutSubviews];
|
||||
[self.iconImageView.layer setCornerRadius:self.iconImageView.height / 2];
|
||||
}
|
||||
|
||||
- (NSDictionary *)selectedTitleAttributes {
|
||||
return @{
|
||||
NSForegroundColorAttributeName : [UIColor blackPrimaryText],
|
||||
NSFontAttributeName : [UIFont bold17]
|
||||
};
|
||||
}
|
||||
|
||||
- (NSDictionary *)unselectedTitleAttributes
|
||||
{
|
||||
- (NSDictionary *)unselectedTitleAttributes {
|
||||
return @{
|
||||
NSForegroundColorAttributeName : [UIColor blackPrimaryText],
|
||||
NSFontAttributeName : [UIFont regular17]
|
||||
|
|
|
@ -1,50 +1,41 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
<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="default" indentationWidth="10" reuseIdentifier="MWMSearchCommonCell" rowHeight="86" id="KGk-i7-Jjw" customClass="MWMSearchCommonCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="86"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="MWMSearchCommonCell" rowHeight="85" id="KGk-i7-Jjw" customClass="MWMSearchCommonCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="321" height="85"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="86"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="321" height="85"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="752" text="New York Cafe" textAlignment="natural" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4FD-RE-ffF">
|
||||
<rect key="frame" x="16" y="12" width="220" height="20"/>
|
||||
<rect key="frame" x="52" y="12" width="185" height="20.5"/>
|
||||
<accessibility key="accessibilityConfiguration" identifier="searchTitle"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
|
||||
<color key="textColor" red="0.12941176470588234" green="0.12941176470588234" blue="0.12941176470588234" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17:blackPrimaryText"/>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="blackPrimaryText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="P8X-Xp-AaE">
|
||||
<rect key="frame" x="236" y="73" width="68" height="0.0"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<rect key="frame" x="237" y="57" width="68" height="0.0"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="13"/>
|
||||
<color key="textColor" red="0.12549019607843137" green="0.58823529411764708" blue="0.95294117647058818" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:linkBlueText"/>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium13:linkBlueText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HGm-lZ-JNr" userLabel="Separator">
|
||||
<rect key="frame" x="16" y="85" width="304" height="1"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="ZWt-cn-KrT"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Divider"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<view hidden="YES" contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="uWz-7m-GUu">
|
||||
<rect key="frame" x="262.5" y="16" width="41.5" height="20"/>
|
||||
<subviews>
|
||||
|
@ -71,60 +62,67 @@
|
|||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="SearchPopularView"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Сafe" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5UO-MD-Hgx">
|
||||
<rect key="frame" x="16" y="36" width="26" height="14"/>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Сafe" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5UO-MD-Hgx">
|
||||
<rect key="frame" x="52" y="36.5" width="29" height="1"/>
|
||||
<accessibility key="accessibilityConfiguration" identifier="searchType"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="26" id="O31-Vq-Bsz"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="13"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular12:blackSecondaryText"/>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="medium13:blackSecondaryText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalCompressionResistancePriority="751" verticalCompressionResistancePriority="751" text="Open" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SDd-3c-YeL">
|
||||
<rect key="frame" x="274.5" y="36" width="29.5" height="14"/>
|
||||
<rect key="frame" x="271.5" y="21.5" width="33.5" height="16"/>
|
||||
<accessibility key="accessibilityConfiguration" identifier="searchType"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="26" id="tqr-8N-JwN"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="13"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" ambiguous="YES" text="Russia, Moscow & Central, Moscow" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6pc-4s-GyP">
|
||||
<rect key="frame" x="16" y="59" width="220" height="14"/>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" text="Russia, Moscow & Central, Moscow" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6pc-4s-GyP">
|
||||
<rect key="frame" x="52" y="41.5" width="185" height="31.5"/>
|
||||
<accessibility key="accessibilityConfiguration" identifier="searchSubTitle"/>
|
||||
<fontDescription key="fontDescription" type="italicSystem" pointSize="12"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="13"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="italic12:blackSecondaryText"/>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular13:blackSecondaryText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="YIa-Hb-PGV" userLabel="Icon ImageView">
|
||||
<rect key="frame" x="16" y="30.5" width="24" height="24"/>
|
||||
<color key="backgroundColor" systemColor="linkColor"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="24" id="fPn-mC-8Je"/>
|
||||
<constraint firstAttribute="width" constant="24" id="sJ9-6S-sMG"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="P8X-Xp-AaE" firstAttribute="leading" secondItem="6pc-4s-GyP" secondAttribute="trailing" id="0hr-QT-t0D"/>
|
||||
<constraint firstItem="5UO-MD-Hgx" firstAttribute="top" secondItem="4FD-RE-ffF" secondAttribute="bottom" constant="4" id="5dn-ca-dCn"/>
|
||||
<constraint firstItem="6pc-4s-GyP" firstAttribute="top" secondItem="5UO-MD-Hgx" secondAttribute="bottom" constant="8" id="7pm-XZ-vLK"/>
|
||||
<constraint firstItem="4FD-RE-ffF" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="Qld-dY-CQN"/>
|
||||
<constraint firstItem="6pc-4s-GyP" firstAttribute="top" secondItem="5UO-MD-Hgx" secondAttribute="bottom" constant="4" id="7pm-XZ-vLK"/>
|
||||
<constraint firstAttribute="bottom" secondItem="6pc-4s-GyP" secondAttribute="bottom" constant="12" id="HWe-cz-8hm"/>
|
||||
<constraint firstItem="5UO-MD-Hgx" firstAttribute="trailing" relation="lessThanOrEqual" secondItem="SDd-3c-YeL" secondAttribute="leading" id="SJj-b5-T2k"/>
|
||||
<constraint firstAttribute="trailing" secondItem="4FD-RE-ffF" secondAttribute="trailing" constant="84" id="Ugu-lP-b9G"/>
|
||||
<constraint firstAttribute="trailing" secondItem="P8X-Xp-AaE" secondAttribute="trailing" constant="16" id="VJE-wo-TBb"/>
|
||||
<constraint firstItem="YIa-Hb-PGV" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="WRp-Ac-GmE"/>
|
||||
<constraint firstItem="YIa-Hb-PGV" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="g6c-sx-War"/>
|
||||
<constraint firstItem="5UO-MD-Hgx" firstAttribute="leading" secondItem="4FD-RE-ffF" secondAttribute="leading" id="gNK-ED-O8W"/>
|
||||
<constraint firstItem="4FD-RE-ffF" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="12" id="hM6-br-iKE"/>
|
||||
<constraint firstItem="6pc-4s-GyP" firstAttribute="leading" secondItem="5UO-MD-Hgx" secondAttribute="leading" id="jvQ-jd-XUJ"/>
|
||||
<constraint firstItem="HGm-lZ-JNr" firstAttribute="top" secondItem="6pc-4s-GyP" secondAttribute="bottom" constant="12" id="m1K-R2-0LQ"/>
|
||||
<constraint firstItem="5UO-MD-Hgx" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="nGL-Ta-pBZ"/>
|
||||
<constraint firstItem="4FD-RE-ffF" firstAttribute="leading" secondItem="YIa-Hb-PGV" secondAttribute="trailing" constant="12" id="nKc-RK-2zd"/>
|
||||
<constraint firstAttribute="trailing" secondItem="6pc-4s-GyP" secondAttribute="trailing" constant="84" id="nfE-NI-LX9"/>
|
||||
<constraint firstItem="6pc-4s-GyP" firstAttribute="bottom" secondItem="P8X-Xp-AaE" secondAttribute="bottom" id="q7E-Jg-MYT"/>
|
||||
<constraint firstItem="HGm-lZ-JNr" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="sq9-C3-M3R"/>
|
||||
<constraint firstAttribute="bottom" secondItem="HGm-lZ-JNr" secondAttribute="bottom" id="vJc-aE-MsA"/>
|
||||
<constraint firstItem="6pc-4s-GyP" firstAttribute="baseline" secondItem="P8X-Xp-AaE" secondAttribute="firstBaseline" id="q7E-Jg-MYT"/>
|
||||
<constraint firstAttribute="trailing" secondItem="SDd-3c-YeL" secondAttribute="trailing" constant="16" id="vay-ux-6dA"/>
|
||||
<constraint firstItem="SDd-3c-YeL" firstAttribute="bottom" secondItem="5UO-MD-Hgx" secondAttribute="bottom" id="wXg-ce-SnG"/>
|
||||
<constraint firstAttribute="trailing" secondItem="HGm-lZ-JNr" secondAttribute="trailing" id="xt0-86-Efu"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<userDefinedRuntimeAttributes>
|
||||
|
@ -132,13 +130,19 @@
|
|||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<outlet property="distanceLabel" destination="P8X-Xp-AaE" id="Kaw-aR-8uJ"/>
|
||||
<outlet property="iconImageView" destination="YIa-Hb-PGV" id="oQP-F5-9hw"/>
|
||||
<outlet property="infoLabel" destination="5UO-MD-Hgx" id="lgJ-zE-omX"/>
|
||||
<outlet property="locationLabel" destination="6pc-4s-GyP" id="Te0-y3-sVQ"/>
|
||||
<outlet property="openLabel" destination="SDd-3c-YeL" id="5Rv-fO-g4x"/>
|
||||
<outlet property="popularView" destination="uWz-7m-GUu" id="LAK-NA-Fea"/>
|
||||
<outlet property="titleLabel" destination="4FD-RE-ffF" id="OQm-o8-LUd"/>
|
||||
<outlet property="infoLabel" destination="5UO-MD-Hgx" id="lgJ-zE-omX"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="314.49275362318843" y="297.99107142857139"/>
|
||||
<point key="canvasLocation" x="315.21739130434787" y="296.98660714285711"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<systemColor name="linkColor">
|
||||
<color red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
@interface MWMSearchSuggestionCell ()
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIImageView * icon;
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint * separatorLeftOffset;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -31,7 +30,7 @@
|
|||
- (void)setIsLastCell:(BOOL)isLastCell
|
||||
{
|
||||
_isLastCell = isLastCell;
|
||||
self.separatorLeftOffset.constant = isLastCell ? 0.0 : 60.0;
|
||||
self.separatorInset = UIEdgeInsetsMake(0, isLastCell ? 0 : kSearchCellSeparatorInset, 0, 0);
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
|
@ -12,44 +12,34 @@
|
|||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="MWMSearchSuggestionCell" propertyAccessControl="none">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<tableViewCellContentView key="contentView" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" ambiguous="YES" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_search" translatesAutoresizingMaskIntoConstraints="NO" id="1IA-T9-KOb">
|
||||
<rect key="frame" x="16" y="7" width="28" height="28"/>
|
||||
<rect key="frame" x="16" y="8" width="24" height="24"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="28" id="TPv-Js-EXq"/>
|
||||
<constraint firstAttribute="height" constant="28" id="bse-BN-jT9"/>
|
||||
<constraint firstAttribute="width" constant="24" id="TPv-Js-EXq"/>
|
||||
<constraint firstAttribute="height" constant="24" id="bse-BN-jT9"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMBlue"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="GqR-59-j1h" userLabel="Separator">
|
||||
<rect key="frame" x="60" y="43" width="260" height="1"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="Lg7-yQ-W1g"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="New Arbat Avenue" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gWP-Zj-GCt">
|
||||
<rect key="frame" x="60" y="11.5" width="244" height="21"/>
|
||||
<rect key="frame" x="52" y="9.5" width="252" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/>
|
||||
<color key="textColor" red="0.12549019610000001" green="0.58823529409999997" blue="0.95294117649999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="GqR-59-j1h" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="60" id="2a5-qd-cFD"/>
|
||||
<constraint firstAttribute="centerY" secondItem="gWP-Zj-GCt" secondAttribute="centerY" id="97n-6D-RYM"/>
|
||||
<constraint firstAttribute="trailing" secondItem="GqR-59-j1h" secondAttribute="trailing" id="Bws-x7-MnZ"/>
|
||||
<constraint firstAttribute="bottom" secondItem="GqR-59-j1h" secondAttribute="bottom" id="ECE-wu-FiJ"/>
|
||||
<constraint firstAttribute="bottom" secondItem="1IA-T9-KOb" secondAttribute="bottom" constant="8" id="0He-dX-gNg"/>
|
||||
<constraint firstAttribute="trailing" secondItem="gWP-Zj-GCt" secondAttribute="trailing" constant="16" id="c1H-CR-1P7"/>
|
||||
<constraint firstAttribute="bottom" secondItem="1IA-T9-KOb" secondAttribute="bottom" priority="750" constant="8" id="e9l-fY-cym"/>
|
||||
<constraint firstItem="gWP-Zj-GCt" firstAttribute="centerY" secondItem="1IA-T9-KOb" secondAttribute="centerY" id="iJZ-pk-VCW"/>
|
||||
<constraint firstItem="1IA-T9-KOb" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="l2F-lx-j3x"/>
|
||||
<constraint firstItem="gWP-Zj-GCt" firstAttribute="leading" secondItem="1IA-T9-KOb" secondAttribute="trailing" constant="16" id="xfc-Vx-bth"/>
|
||||
<constraint firstItem="1IA-T9-KOb" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="7" id="y24-rC-y5X"/>
|
||||
<constraint firstItem="gWP-Zj-GCt" firstAttribute="leading" secondItem="1IA-T9-KOb" secondAttribute="trailing" constant="12" id="xfc-Vx-bth"/>
|
||||
<constraint firstItem="1IA-T9-KOb" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="8" id="y24-rC-y5X"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<userDefinedRuntimeAttributes>
|
||||
|
@ -57,7 +47,6 @@
|
|||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<outlet property="icon" destination="1IA-T9-KOb" id="eBB-Wj-yU5"/>
|
||||
<outlet property="separatorLeftOffset" destination="2a5-qd-cFD" id="1MR-I8-VWr"/>
|
||||
<outlet property="titleLabel" destination="gWP-Zj-GCt" id="P6N-C2-ce6"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="139" y="154"/>
|
||||
|
|
|
@ -90,14 +90,14 @@ NSString *GetLocalizedTypeName(search::Result const &result) {
|
|||
{
|
||||
auto cell = static_cast<MWMSearchCommonCell *>(
|
||||
[tableView dequeueReusableCellWithCellClass:[MWMSearchCommonCell class] indexPath:indexPath]);
|
||||
[cell configureWith:result];
|
||||
[cell configureWith:result isPartialMatching:YES];
|
||||
return cell;
|
||||
}
|
||||
case SearchItemTypeSuggestion:
|
||||
{
|
||||
auto cell = static_cast<MWMSearchSuggestionCell *>(
|
||||
[tableView dequeueReusableCellWithCellClass:[MWMSearchSuggestionCell class] indexPath:indexPath]);
|
||||
[cell configureWith:result];
|
||||
[cell configureWith:result isPartialMatching:YES];
|
||||
cell.isLastCell = row == [MWMSearch suggestionsCount] - 1;
|
||||
return cell;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
protocol SearchCategoriesViewControllerDelegate: AnyObject {
|
||||
protocol SearchCategoriesViewControllerDelegate: SearchOnMapScrollViewDelegate {
|
||||
func categoriesViewController(_ viewController: SearchCategoriesViewController,
|
||||
didSelect category: String)
|
||||
}
|
||||
|
@ -12,36 +12,48 @@ final class SearchCategoriesViewController: MWMTableViewController {
|
|||
categories = frameworkHelper.searchCategories()
|
||||
super.init(nibName: nil, bundle: nil)
|
||||
}
|
||||
|
||||
|
||||
@available(*, unavailable)
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
tableView.registerNib(cellClass: SearchCategoryCell.self)
|
||||
tableView.separatorStyle = .none
|
||||
tableView.setStyle(.background)
|
||||
tableView.register(cell: SearchCategoryCell.self)
|
||||
tableView.keyboardDismissMode = .onDrag
|
||||
}
|
||||
|
||||
|
||||
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
return categories.count
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
let cell = tableView.dequeueReusableCell(cell: SearchCategoryCell.self, indexPath: indexPath)
|
||||
cell.update(with: category(at: indexPath))
|
||||
cell.configure(with: category(at: indexPath))
|
||||
return cell
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
let selectedCategory = category(at: indexPath)
|
||||
delegate?.categoriesViewController(self, didSelect: selectedCategory)
|
||||
tableView.deselectRow(at: indexPath, animated: true)
|
||||
}
|
||||
|
||||
|
||||
override func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||
delegate?.scrollViewDidScroll(scrollView)
|
||||
}
|
||||
|
||||
func category(at indexPath: IndexPath) -> String {
|
||||
let index = indexPath.row
|
||||
return categories[index]
|
||||
}
|
||||
}
|
||||
|
||||
extension SearchCategoriesViewController: ModallyPresentedViewController {
|
||||
func translationYDidUpdate(_ translationY: CGFloat) {
|
||||
guard isViewLoaded else { return }
|
||||
tableView.contentInset.bottom = translationY + view.safeAreaInsets.bottom
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,25 @@
|
|||
final class SearchCategoryCell: MWMTableViewCell {
|
||||
@IBOutlet weak var iconImageView: UIImageView!
|
||||
@IBOutlet weak var titleLabel: UILabel!
|
||||
final class SearchCategoryCell: UITableViewCell {
|
||||
|
||||
private var category: String = ""
|
||||
func update(with category: String) {
|
||||
self.category = category
|
||||
iconImageView.mwm_name = String(format: "ic_%@", category)
|
||||
titleLabel.text = L(category)
|
||||
private var categoryName: String = ""
|
||||
|
||||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||
super.init(style: .default, reuseIdentifier: reuseIdentifier)
|
||||
setStyle(.defaultTableViewCell)
|
||||
}
|
||||
|
||||
@available(*, unavailable)
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
func configure(with categoryName: String) {
|
||||
self.categoryName = categoryName
|
||||
textLabel?.text = L(categoryName)
|
||||
imageView?.mwm_name = String(format: "ic_%@", categoryName)
|
||||
}
|
||||
|
||||
override func applyTheme() {
|
||||
super.applyTheme()
|
||||
iconImageView.mwm_name = String(format: "ic_%@", category)
|
||||
imageView?.mwm_name = String(format: "ic_%@", categoryName)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
|
||||
<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="default" indentationWidth="10" rowHeight="44" id="KGk-i7-Jjw" userLabel="SearchCategoryCell" customClass="SearchCategoryCell" customModule="OMaps" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_food_light" translatesAutoresizingMaskIntoConstraints="NO" id="Enr-Zg-Z5s" userLabel="Icon">
|
||||
<rect key="frame" x="16" y="8" width="28" height="28"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="28" id="Ms6-Dt-ZN5"/>
|
||||
<constraint firstAttribute="width" constant="28" id="sIw-t0-DIm"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="WO3-AY-H0S" userLabel="Separator">
|
||||
<rect key="frame" x="60" y="43" width="260" height="1"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="W6j-8r-VpK"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Divider"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Food" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ACg-C3-HtA" userLabel="Category label">
|
||||
<rect key="frame" x="60" y="12" width="244" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<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="styleName" value="regular17:blackPrimaryText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="centerY" secondItem="Enr-Zg-Z5s" secondAttribute="centerY" id="1q9-qQ-crG"/>
|
||||
<constraint firstAttribute="bottom" secondItem="WO3-AY-H0S" secondAttribute="bottom" id="4A4-Tc-rGy"/>
|
||||
<constraint firstAttribute="trailing" secondItem="WO3-AY-H0S" secondAttribute="trailing" id="9AW-4d-CWP"/>
|
||||
<constraint firstAttribute="bottom" secondItem="ACg-C3-HtA" secondAttribute="bottom" constant="11" id="ALN-MG-O9u"/>
|
||||
<constraint firstAttribute="trailing" secondItem="ACg-C3-HtA" secondAttribute="trailing" constant="16" id="CG1-fx-Dcg"/>
|
||||
<constraint firstItem="WO3-AY-H0S" firstAttribute="leading" secondItem="Enr-Zg-Z5s" secondAttribute="trailing" constant="16" id="c0m-Qo-lBf"/>
|
||||
<constraint firstItem="Enr-Zg-Z5s" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="naz-Qh-tGQ"/>
|
||||
<constraint firstItem="ACg-C3-HtA" firstAttribute="leading" secondItem="WO3-AY-H0S" secondAttribute="leading" id="uzK-Ai-LsP"/>
|
||||
<constraint firstItem="ACg-C3-HtA" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="12" id="yKg-DY-edk"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="iconImageView" destination="Enr-Zg-Z5s" id="hN6-KJ-cc5"/>
|
||||
<outlet property="titleLabel" destination="ACg-C3-HtA" id="Wug-sf-nZZ"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="139" y="154"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="ic_food_light" width="28" height="28"/>
|
||||
</resources>
|
||||
</document>
|
|
@ -0,0 +1,34 @@
|
|||
final class SearchHistoryCell: MWMTableViewCell {
|
||||
enum Content {
|
||||
case query(String)
|
||||
case clear
|
||||
}
|
||||
|
||||
static private let placeholderImage = UIImage.filled(with: .clear, size: CGSize(width: 28, height: 28))
|
||||
|
||||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||
super.init(style: .default, reuseIdentifier: reuseIdentifier)
|
||||
setStyle(.defaultTableViewCell)
|
||||
}
|
||||
|
||||
@available(*, unavailable)
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
func configure(for content: Content) {
|
||||
switch content {
|
||||
case .query(let query):
|
||||
textLabel?.text = query
|
||||
textLabel?.setFontStyleAndApply(.regular17, color: .blackSecondary)
|
||||
imageView?.image = UIImage(resource: .icSearch)
|
||||
imageView?.setStyleAndApply(.black)
|
||||
isSeparatorHidden = false
|
||||
case .clear:
|
||||
textLabel?.text = L("clear_search")
|
||||
textLabel?.setFontStyleAndApply(.regular14, color: .linkBlue)
|
||||
imageView?.image = Self.placeholderImage
|
||||
isSeparatorHidden = true
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
|
||||
<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="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="MWMTableViewCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_search_clear" translatesAutoresizingMaskIntoConstraints="NO" id="hch-c6-ulY" userLabel="Icon">
|
||||
<rect key="frame" x="16" y="8" width="28" height="28"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="28" id="Fs9-lR-wuD"/>
|
||||
<constraint firstAttribute="width" constant="28" id="sop-aE-OIT"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMBlack"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="6x5-bn-Z1n" userLabel="Separator">
|
||||
<rect key="frame" x="60" y="43" width="260" height="1"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="fa3-ZJ-pk5"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Divider"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Clear History" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uUE-gB-cha" userLabel="Clear label">
|
||||
<rect key="frame" x="60" y="12" width="244" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.54000000000000004" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17:blackSecondaryText"/>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="clear_search"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="6x5-bn-Z1n" secondAttribute="bottom" id="06Q-0q-3Tu"/>
|
||||
<constraint firstAttribute="centerY" secondItem="hch-c6-ulY" secondAttribute="centerY" id="51N-L0-MsL"/>
|
||||
<constraint firstAttribute="bottom" secondItem="uUE-gB-cha" secondAttribute="bottom" constant="11" id="Bn3-BC-B6d"/>
|
||||
<constraint firstItem="hch-c6-ulY" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="EmW-eh-qMa"/>
|
||||
<constraint firstAttribute="trailing" secondItem="uUE-gB-cha" secondAttribute="trailing" constant="16" id="UyN-wL-XYy"/>
|
||||
<constraint firstItem="uUE-gB-cha" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="12" id="ZbM-oP-QKn"/>
|
||||
<constraint firstItem="uUE-gB-cha" firstAttribute="leading" secondItem="6x5-bn-Z1n" secondAttribute="leading" id="bJD-xj-etH"/>
|
||||
<constraint firstItem="6x5-bn-Z1n" firstAttribute="leading" secondItem="hch-c6-ulY" secondAttribute="trailing" constant="16" id="z5E-on-8XQ"/>
|
||||
<constraint firstAttribute="trailing" secondItem="6x5-bn-Z1n" secondAttribute="trailing" id="zbS-mM-SJH"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<point key="canvasLocation" x="139" y="154"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="ic_search_clear" width="28" height="28"/>
|
||||
</resources>
|
||||
</document>
|
|
@ -1,7 +0,0 @@
|
|||
final class SearchHistoryQueryCell: MWMTableViewCell {
|
||||
@IBOutlet weak var queryLabel: UILabel!
|
||||
|
||||
func update(with query: String) {
|
||||
queryLabel.text = query
|
||||
}
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
|
||||
<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="default" indentationWidth="10" id="KGk-i7-Jjw" userLabel="SearchHistoryQueryCell" customClass="SearchHistoryQueryCell" customModule="OMaps" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_history_label" translatesAutoresizingMaskIntoConstraints="NO" id="k5o-Xw-buz" userLabel="Icon">
|
||||
<rect key="frame" x="16" y="8" width="28" height="28"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="28" id="Gjo-VG-g4T"/>
|
||||
<constraint firstAttribute="width" constant="28" id="jp9-B7-91r"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMBlack"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="L0x-sD-vTW" userLabel="Separator">
|
||||
<rect key="frame" x="60" y="43" width="260" height="1"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="bSd-Nh-svm"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Divider"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="t8W-bQ-Jgd">
|
||||
<rect key="frame" x="60" y="12" width="244" height="20"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.12941176470588234" green="0.12941176470588234" blue="0.12941176470588234" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17:blackSecondaryText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="k5o-Xw-buz" firstAttribute="centerY" secondItem="t8W-bQ-Jgd" secondAttribute="centerY" id="3Iy-eY-txd"/>
|
||||
<constraint firstItem="t8W-bQ-Jgd" firstAttribute="leading" secondItem="L0x-sD-vTW" secondAttribute="leading" id="9Kd-5m-e66"/>
|
||||
<constraint firstAttribute="trailing" secondItem="L0x-sD-vTW" secondAttribute="trailing" id="HKO-nm-dox"/>
|
||||
<constraint firstAttribute="bottom" secondItem="L0x-sD-vTW" secondAttribute="bottom" id="IMW-TE-eBM"/>
|
||||
<constraint firstAttribute="bottom" secondItem="t8W-bQ-Jgd" secondAttribute="bottom" constant="12" id="a6j-eH-Xha"/>
|
||||
<constraint firstItem="L0x-sD-vTW" firstAttribute="leading" secondItem="k5o-Xw-buz" secondAttribute="trailing" constant="16" id="bqE-Pi-Dlv"/>
|
||||
<constraint firstItem="k5o-Xw-buz" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="kRk-cw-mQt"/>
|
||||
<constraint firstItem="t8W-bQ-Jgd" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="12" id="nAw-8U-Ibx"/>
|
||||
<constraint firstAttribute="trailing" secondItem="t8W-bQ-Jgd" secondAttribute="trailing" constant="16" id="w0g-Q7-D2m"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="queryLabel" destination="t8W-bQ-Jgd" id="bF0-gL-81j"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="139" y="154"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="ic_history_label" width="28" height="28"/>
|
||||
</resources>
|
||||
</document>
|
|
@ -1,72 +1,106 @@
|
|||
protocol SearchHistoryViewControllerDelegate: AnyObject {
|
||||
protocol SearchHistoryViewControllerDelegate: SearchOnMapScrollViewDelegate {
|
||||
func searchHistoryViewController(_ viewController: SearchHistoryViewController,
|
||||
didSelect query: String)
|
||||
}
|
||||
|
||||
final class SearchHistoryViewController: MWMViewController {
|
||||
private weak var delegate: SearchHistoryViewControllerDelegate?
|
||||
private var lastQueries: [String]
|
||||
private var lastQueries: [String] = []
|
||||
private let frameworkHelper: MWMSearchFrameworkHelper
|
||||
private static let clearCellIdentifier = "SearchHistoryViewController_clearCellIdentifier"
|
||||
|
||||
@IBOutlet private var tableView: UITableView!
|
||||
@IBOutlet private weak var noResultsViewContainer: UIView!
|
||||
|
||||
private let emptyHistoryView = PlaceholderView(title: L("search_history_title"),
|
||||
subtitle: L("search_history_text"))
|
||||
|
||||
private let tableView = UITableView()
|
||||
|
||||
// MARK: - Init
|
||||
init(frameworkHelper: MWMSearchFrameworkHelper, delegate: SearchHistoryViewControllerDelegate?) {
|
||||
self.delegate = delegate
|
||||
self.lastQueries = frameworkHelper.lastSearchQueries()
|
||||
self.frameworkHelper = frameworkHelper
|
||||
super.init(nibName: nil, bundle: nil)
|
||||
}
|
||||
|
||||
|
||||
@available(*, unavailable)
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Lifecycle
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
if frameworkHelper.isSearchHistoryEmpty() {
|
||||
showNoResultsView()
|
||||
} else {
|
||||
tableView.registerNib(cellClass: SearchHistoryQueryCell.self)
|
||||
let nib = UINib(nibName: "SearchHistoryClearCell", bundle: nil)
|
||||
tableView.register(nib, forCellReuseIdentifier: SearchHistoryViewController.clearCellIdentifier)
|
||||
}
|
||||
setupTableView()
|
||||
setupNoResultsView()
|
||||
}
|
||||
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
reload()
|
||||
}
|
||||
|
||||
// MARK: - Private methods
|
||||
private func setupTableView() {
|
||||
tableView.setStyle(.background)
|
||||
tableView.register(cell: SearchHistoryCell.self)
|
||||
tableView.keyboardDismissMode = .onDrag
|
||||
tableView.delegate = self
|
||||
tableView.dataSource = self
|
||||
tableView.tableFooterView = UIView(frame: CGRect(x: 0, y: 0, width: 400, height: 1))
|
||||
|
||||
view.addSubview(tableView)
|
||||
tableView.translatesAutoresizingMaskIntoConstraints = false
|
||||
NSLayoutConstraint.activate([
|
||||
tableView.topAnchor.constraint(equalTo: view.topAnchor),
|
||||
tableView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
||||
tableView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
||||
tableView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
|
||||
])
|
||||
}
|
||||
|
||||
func showNoResultsView() {
|
||||
guard let noResultsView = MWMSearchNoResults.view(with: nil,
|
||||
title: L("search_history_title"),
|
||||
text: L("search_history_text")) else {
|
||||
assertionFailure()
|
||||
return
|
||||
|
||||
private func setupNoResultsView() {
|
||||
view.addSubview(emptyHistoryView)
|
||||
emptyHistoryView.translatesAutoresizingMaskIntoConstraints = false
|
||||
NSLayoutConstraint.activate([
|
||||
emptyHistoryView.topAnchor.constraint(equalTo: view.topAnchor),
|
||||
emptyHistoryView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
||||
emptyHistoryView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
||||
emptyHistoryView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
|
||||
])
|
||||
}
|
||||
|
||||
private func showEmptyHistoryView(_ isVisible: Bool = true, animated: Bool = true) {
|
||||
UIView.transition(with: emptyHistoryView,
|
||||
duration: animated ? kDefaultAnimationDuration : 0,
|
||||
options: [.transitionCrossDissolve, .curveEaseInOut]) {
|
||||
self.emptyHistoryView.alpha = isVisible ? 1.0 : 0.0
|
||||
self.emptyHistoryView.isHidden = !isVisible
|
||||
}
|
||||
noResultsViewContainer.addSubview(noResultsView)
|
||||
tableView.isHidden = true
|
||||
}
|
||||
|
||||
func clearSearchHistory() {
|
||||
private func clearSearchHistory() {
|
||||
frameworkHelper.clearSearchHistory()
|
||||
lastQueries = []
|
||||
reload()
|
||||
}
|
||||
|
||||
// MARK: - Public methods
|
||||
func reload() {
|
||||
guard isViewLoaded else { return }
|
||||
lastQueries = frameworkHelper.lastSearchQueries()
|
||||
showEmptyHistoryView(lastQueries.isEmpty ? true : false)
|
||||
tableView.reloadData()
|
||||
}
|
||||
}
|
||||
|
||||
extension SearchHistoryViewController: UITableViewDataSource {
|
||||
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
return frameworkHelper.isSearchHistoryEmpty() ? 0 : lastQueries.count + 1
|
||||
return lastQueries.isEmpty ? 0 : lastQueries.count + 1
|
||||
}
|
||||
|
||||
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
let cell = tableView.dequeueReusableCell(cell: SearchHistoryCell.self, indexPath: indexPath)
|
||||
if indexPath.row == lastQueries.count {
|
||||
let cell = tableView.dequeueReusableCell(withIdentifier: SearchHistoryViewController.clearCellIdentifier,
|
||||
for: indexPath)
|
||||
return cell
|
||||
cell.configure(for: .clear)
|
||||
} else {
|
||||
cell.configure(for: .query(lastQueries[indexPath.row]))
|
||||
}
|
||||
|
||||
let cell = tableView.dequeueReusableCell(cell: SearchHistoryQueryCell.self, indexPath: indexPath)
|
||||
cell.update(with: lastQueries[indexPath.row])
|
||||
return cell
|
||||
}
|
||||
}
|
||||
|
@ -75,15 +109,22 @@ extension SearchHistoryViewController: UITableViewDelegate {
|
|||
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
if indexPath.row == lastQueries.count {
|
||||
clearSearchHistory()
|
||||
UIView.animate(withDuration: kDefaultAnimationDuration,
|
||||
animations: {
|
||||
tableView.alpha = 0.0
|
||||
}) { _ in
|
||||
self.showNoResultsView()
|
||||
}
|
||||
} else {
|
||||
let query = lastQueries[indexPath.row]
|
||||
delegate?.searchHistoryViewController(self, didSelect: query)
|
||||
}
|
||||
tableView.deselectRow(at: indexPath, animated: true)
|
||||
}
|
||||
|
||||
func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||
delegate?.scrollViewDidScroll(scrollView)
|
||||
}
|
||||
}
|
||||
|
||||
extension SearchHistoryViewController: ModallyPresentedViewController {
|
||||
func translationYDidUpdate(_ translationY: CGFloat) {
|
||||
guard isViewLoaded else { return }
|
||||
tableView.contentInset.bottom = translationY
|
||||
emptyHistoryView.translationYDidUpdate(translationY)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="SearchHistoryViewController" customModule="OMaps" customModuleProvider="target">
|
||||
<connections>
|
||||
<outlet property="noResultsViewContainer" destination="bcr-zs-NMw" id="zpc-sP-fbF"/>
|
||||
<outlet property="tableView" destination="cDq-G7-5cR" id="Qo8-a6-Q6V"/>
|
||||
<outlet property="view" destination="iN0-l3-epB" id="Ybt-gX-7O4"/>
|
||||
</connections>
|
||||
</placeholder>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view contentMode="scaleToFill" id="iN0-l3-epB">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="cDq-G7-5cR">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="-1" id="XhM-2x-4kQ"/>
|
||||
<outlet property="delegate" destination="-1" id="sDX-YJ-iGy"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<view userInteractionEnabled="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bcr-zs-NMw">
|
||||
<rect key="frame" x="27.5" y="173.5" width="320" height="320"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="320" id="07E-Xc-KMw"/>
|
||||
<constraint firstAttribute="width" constant="320" id="sCQ-Q9-Pdw"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="cDq-G7-5cR" secondAttribute="bottom" id="9QA-Kd-FQb"/>
|
||||
<constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="cDq-G7-5cR" secondAttribute="trailing" id="T3b-23-qG6"/>
|
||||
<constraint firstItem="bcr-zs-NMw" firstAttribute="centerY" secondItem="vUN-kp-3ea" secondAttribute="centerY" id="Y7z-3L-jl5"/>
|
||||
<constraint firstItem="cDq-G7-5cR" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" id="ezl-g4-mlD"/>
|
||||
<constraint firstItem="cDq-G7-5cR" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="ot8-FU-S6n"/>
|
||||
<constraint firstItem="bcr-zs-NMw" firstAttribute="centerX" secondItem="vUN-kp-3ea" secondAttribute="centerX" id="uMb-A3-NrS"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<point key="canvasLocation" x="53.600000000000001" y="48.125937031484263"/>
|
||||
</view>
|
||||
</objects>
|
||||
</document>
|
|
@ -1,7 +1,6 @@
|
|||
import CoreFoundation
|
||||
@objc(MWMSearchTabViewControllerDelegate)
|
||||
protocol SearchTabViewControllerDelegate: AnyObject {
|
||||
func searchTabController(_ viewContoller: SearchTabViewController, didSearch: String, withCategory: Bool)
|
||||
protocol SearchTabViewControllerDelegate: SearchOnMapScrollViewDelegate {
|
||||
func searchTabController(_ viewController: SearchTabViewController, didSearch: String, withCategory: Bool)
|
||||
}
|
||||
|
||||
@objc(MWMSearchTabViewController)
|
||||
|
@ -48,6 +47,22 @@ final class SearchTabViewController: TabViewController {
|
|||
super.viewDidDisappear(animated)
|
||||
activeTab = SearchActiveTab.init(rawValue: tabView.selectedIndex ?? 0) ?? .categories
|
||||
}
|
||||
|
||||
func reloadSearchHistory() {
|
||||
(viewControllers[SearchActiveTab.history.rawValue] as? SearchHistoryViewController)?.reload()
|
||||
}
|
||||
}
|
||||
|
||||
extension SearchTabViewController: ModallyPresentedViewController {
|
||||
func translationYDidUpdate(_ translationY: CGFloat) {
|
||||
viewControllers.forEach { ($0 as? ModallyPresentedViewController)?.translationYDidUpdate(translationY) }
|
||||
}
|
||||
}
|
||||
|
||||
extension SearchTabViewController: SearchOnMapScrollViewDelegate {
|
||||
func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||
delegate?.scrollViewDidScroll(scrollView)
|
||||
}
|
||||
}
|
||||
|
||||
extension SearchTabViewController: SearchCategoriesViewControllerDelegate {
|
||||
|
|
Reference in a new issue