forked from organicmaps/organicmaps-tmp
[MAPSME-5476] [ios] Fixed routing point type on tooltip search.
This commit is contained in:
parent
5a369cff5e
commit
8be0092e30
4 changed files with 29 additions and 17 deletions
|
@ -125,29 +125,31 @@ BOOL defaultOrientation(CGSize const & size)
|
|||
|
||||
if (hasStart)
|
||||
{
|
||||
[toastView configWithText:L(@"routing_add_finish_point") withLocationButton:NO];
|
||||
[toastView configWithIsStart:NO withLocationButton:NO];
|
||||
return;
|
||||
}
|
||||
|
||||
if (hasFinish)
|
||||
{
|
||||
[toastView configWithText:L(@"routing_add_start_point") withLocationButton:self.hasLocation];
|
||||
[toastView configWithIsStart:YES withLocationButton:self.hasLocation];
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.hasLocation)
|
||||
[toastView configWithText:L(@"routing_add_finish_point") withLocationButton:NO];
|
||||
[toastView configWithIsStart:NO withLocationButton:NO];
|
||||
else
|
||||
[toastView configWithText:L(@"routing_add_start_point") withLocationButton:NO];
|
||||
[toastView configWithIsStart:YES withLocationButton:NO];
|
||||
}
|
||||
|
||||
- (IBAction)openSearch
|
||||
{
|
||||
BOOL const isStart = ([MWMRouter startPoint] == nil);
|
||||
BOOL const isStart = self.toastView.isStart;
|
||||
auto const type = isStart ? kStatRoutingPointTypeStart : kStatRoutingPointTypeFinish;
|
||||
[Statistics logEvent:kStatRoutingTooltipClicked withParameters:@{kStatRoutingPointType : type}];
|
||||
auto searchManager = [MWMSearchManager manager];
|
||||
searchManager.isRoutingTooltipSearch = YES;
|
||||
|
||||
searchManager.routingTooltipSearch = isStart ? MWMSearchManagerRoutingTooltipSearchStart
|
||||
: MWMSearchManagerRoutingTooltipSearchFinish;
|
||||
searchManager.state = MWMSearchManagerStateDefault;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,11 @@ final class NavigationAddPointToastView: UIView {
|
|||
}
|
||||
}
|
||||
|
||||
func config(text: String, withLocationButton: Bool) {
|
||||
private(set) var isStart = true
|
||||
|
||||
func config(isStart: Bool, withLocationButton: Bool) {
|
||||
self.isStart = isStart
|
||||
let text = isStart ? L("routing_add_start_point") : L("routing_add_finish_point")
|
||||
actionButton.setTitle(text, for: .normal)
|
||||
backgroundColor = UIColor.white()
|
||||
|
||||
|
|
|
@ -3,6 +3,12 @@
|
|||
#import "MWMSearchManagerState.h"
|
||||
#import "MWMSearchTextField.h"
|
||||
|
||||
typedef NS_ENUM(NSInteger, MWMSearchManagerRoutingTooltipSearch) {
|
||||
MWMSearchManagerRoutingTooltipSearchNone,
|
||||
MWMSearchManagerRoutingTooltipSearchStart,
|
||||
MWMSearchManagerRoutingTooltipSearchFinish
|
||||
};
|
||||
|
||||
@interface MWMSearchManager : NSObject
|
||||
|
||||
+ (nonnull MWMSearchManager *)manager;
|
||||
|
@ -12,7 +18,7 @@
|
|||
@property(nullable, weak, nonatomic) IBOutlet MWMSearchTextField * searchTextField;
|
||||
|
||||
@property(nonatomic) MWMSearchManagerState state;
|
||||
@property(nonatomic) BOOL isRoutingTooltipSearch;
|
||||
@property(nonatomic) MWMSearchManagerRoutingTooltipSearch routingTooltipSearch;
|
||||
|
||||
@property(nonnull, nonatomic) IBOutletCollection(UIView) NSArray * topViews;
|
||||
|
||||
|
|
|
@ -190,24 +190,24 @@ using Observers = NSHashTable<Observer>;
|
|||
- (void)dismissKeyboard { [self.searchTextField resignFirstResponder]; }
|
||||
- (void)processSearchWithResult:(search::Result const &)result
|
||||
{
|
||||
if (self.isRoutingTooltipSearch)
|
||||
if (self.routingTooltipSearch == MWMSearchManagerRoutingTooltipSearchNone)
|
||||
{
|
||||
BOOL const hasFinish = ([MWMRouter finishPoint] != nil);
|
||||
[MWMSearch showResult:result];
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOL const isStart = self.routingTooltipSearch == MWMSearchManagerRoutingTooltipSearchStart;
|
||||
auto point = [[MWMRoutePoint alloc]
|
||||
initWithPoint:result.GetFeatureCenter()
|
||||
title:@(result.GetString().c_str())
|
||||
subtitle:@(result.GetAddress().c_str())
|
||||
type:hasFinish ? MWMRoutePointTypeStart : MWMRoutePointTypeFinish
|
||||
type:isStart ? MWMRoutePointTypeStart : MWMRoutePointTypeFinish
|
||||
intermediateIndex:0];
|
||||
if (hasFinish)
|
||||
if (isStart)
|
||||
[MWMRouter buildFromPoint:point bestRouter:NO];
|
||||
else
|
||||
[MWMRouter buildToPoint:point bestRouter:NO];
|
||||
}
|
||||
else
|
||||
{
|
||||
[MWMSearch showResult:result];
|
||||
}
|
||||
if (!IPAD || [MWMNavigationDashboardManager manager].state != MWMNavigationDashboardStateHidden)
|
||||
self.state = MWMSearchManagerStateHidden;
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ using Observers = NSHashTable<Observer>;
|
|||
|
||||
- (void)changeToHiddenState
|
||||
{
|
||||
self.isRoutingTooltipSearch = NO;
|
||||
self.routingTooltipSearch = MWMSearchManagerRoutingTooltipSearchNone;
|
||||
[self endSearch];
|
||||
[self.tabbedController resetSelectedTab];
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue