forked from organicmaps/organicmaps
[ios] Added ETA estimation to navigation dashboard entity.
This commit is contained in:
parent
31051b5739
commit
a6d70f8031
2 changed files with 16 additions and 0 deletions
|
@ -20,6 +20,7 @@
|
|||
@property(nonatomic, readonly) CGFloat progress;
|
||||
//@property (nonatomic, readonly) vector<location::FollowingInfo::SingleLaneInfoClient> lanes;
|
||||
@property(nonatomic, readonly) BOOL isPedestrian;
|
||||
@property(nonatomic, readonly) NSAttributedString * estimate;
|
||||
|
||||
- (void)updateFollowingInfo:(location::FollowingInfo const &)info;
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
#import "MWMLocationManager.h"
|
||||
#import "MWMSettings.h"
|
||||
#import "MapsAppDelegate.h"
|
||||
#import "TimeUtils.h"
|
||||
#import "UIColor+MapsMeColor.h"
|
||||
#import "UIFont+MapsMeFonts.h"
|
||||
|
||||
#include "Framework.h"
|
||||
#include "geometry/distance_on_sphere.hpp"
|
||||
|
@ -51,6 +54,18 @@ using namespace routing::turns;
|
|||
_nextTurnImage = image(info.m_nextTurn, true);
|
||||
}
|
||||
|
||||
NSDictionary * etaAttributes = @{
|
||||
NSForegroundColorAttributeName : UIColor.blackPrimaryText,
|
||||
NSFontAttributeName : UIFont.medium17
|
||||
};
|
||||
NSString * eta = [NSDateFormatter estimatedArrivalTimeWithSeconds:_timeToTarget];
|
||||
NSString * resultString =
|
||||
[NSString stringWithFormat:@"%@ • %@ %@", eta, _targetDistance, _targetUnits];
|
||||
NSMutableAttributedString * result =
|
||||
[[NSMutableAttributedString alloc] initWithString:resultString];
|
||||
[result addAttributes:etaAttributes range:NSMakeRange(0, eta.length)];
|
||||
_estimate = [result copy];
|
||||
|
||||
TurnDirection const turn = info.m_turn;
|
||||
_turnImage = image(turn, false);
|
||||
BOOL const isRound = turn == TurnDirection::EnterRoundAbout ||
|
||||
|
|
Loading…
Add table
Reference in a new issue