forked from organicmaps/organicmaps
Merge pull request #5045 from igrechuhin/cleanup
iOS Project structure cleanup.
This commit is contained in:
commit
de2a75aa81
96 changed files with 186 additions and 246 deletions
12
iphone/Maps/Categories/DateComponentsFormatter+ETA.swift
Normal file
12
iphone/Maps/Categories/DateComponentsFormatter+ETA.swift
Normal file
|
@ -0,0 +1,12 @@
|
|||
extension DateComponentsFormatter {
|
||||
|
||||
static func etaString(from ti: TimeInterval) -> String? {
|
||||
let formatter = DateComponentsFormatter()
|
||||
formatter.allowedUnits = [.minute, .hour, .day]
|
||||
formatter.maximumUnitCount = 2
|
||||
formatter.unitsStyle = .abbreviated
|
||||
formatter.zeroFormattingBehavior = .dropAll
|
||||
return formatter.string(from: ti)
|
||||
}
|
||||
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NSDateFormatter (Utils)
|
||||
|
||||
+ (NSString *)estimatedArrivalTimeWithSeconds:(NSTimeInterval)seconds;
|
||||
|
||||
@end
|
|
@ -1,16 +0,0 @@
|
|||
#import "TimeUtils.h"
|
||||
#import "Common.h"
|
||||
|
||||
@implementation NSDateFormatter (Seconds)
|
||||
|
||||
+ (NSString *)estimatedArrivalTimeWithSeconds:(NSTimeInterval)seconds
|
||||
{
|
||||
NSDateComponentsFormatter * formatter = [[NSDateComponentsFormatter alloc] init];
|
||||
formatter.allowedUnits = NSCalendarUnitMinute | NSCalendarUnitHour | NSCalendarUnitDay;
|
||||
formatter.maximumUnitCount = 2;
|
||||
formatter.unitsStyle = NSDateComponentsFormatterUnitsStyleAbbreviated;
|
||||
formatter.zeroFormattingBehavior = NSDateComponentsFormatterZeroFormattingBehaviorDropAll;
|
||||
return [formatter stringFromTimeInterval:seconds];
|
||||
}
|
||||
|
||||
@end
|
|
@ -19,7 +19,7 @@
|
|||
#import "MapViewController.h"
|
||||
#import "MapsAppDelegate.h"
|
||||
#import "Statistics.h"
|
||||
#import "TimeUtils.h"
|
||||
#import "SwiftBridge.h"
|
||||
#import "UIColor+MapsMeColor.h"
|
||||
#import "UIFont+MapsMeFonts.h"
|
||||
#import "UIImageView+Coloring.h"
|
||||
|
@ -175,7 +175,7 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell) {
|
|||
self.navigationInfo = info;
|
||||
if (self.routingInfoPageControl.currentPage == 0)
|
||||
{
|
||||
self.timeLabel.text = [NSDateFormatter estimatedArrivalTimeWithSeconds:info.timeToTarget];
|
||||
self.timeLabel.text = [NSDateComponentsFormatter etaStringFrom:info.timeToTarget];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#import "MWMLocationManager.h"
|
||||
#import "MWMSettings.h"
|
||||
#import "MapsAppDelegate.h"
|
||||
#import "TimeUtils.h"
|
||||
#import "SwiftBridge.h"
|
||||
#import "UIColor+MapsMeColor.h"
|
||||
#import "UIFont+MapsMeFonts.h"
|
||||
|
||||
|
@ -58,7 +58,7 @@ using namespace routing::turns;
|
|||
NSForegroundColorAttributeName : UIColor.blackPrimaryText,
|
||||
NSFontAttributeName : UIFont.medium17
|
||||
};
|
||||
NSString * eta = [NSDateFormatter estimatedArrivalTimeWithSeconds:_timeToTarget];
|
||||
NSString * eta = [NSDateComponentsFormatter etaStringFrom:_timeToTarget];
|
||||
NSString * resultString =
|
||||
[NSString stringWithFormat:@"%@ • %@ %@", eta, _targetDistance, _targetUnits];
|
||||
NSMutableAttributedString * result =
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#import "MWMTaxiPreviewCell.h"
|
||||
#import "TimeUtils.h"
|
||||
#import "SwiftBridge.h"
|
||||
|
||||
#include "partners_api/uber_api.hpp"
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
|||
if (!strings::to_double(product.m_time, time))
|
||||
NSAssert(false, @"Incorrect time");
|
||||
|
||||
NSString * formatted = [NSDateFormatter estimatedArrivalTimeWithSeconds:time];
|
||||
NSString * formatted = [NSDateComponentsFormatter etaStringFrom:time];
|
||||
NSString * pattern = [L(@"taxi_wait") stringByReplacingOccurrencesOfString:@"%s" withString:@"%@"];
|
||||
self.waitingTime.text = [NSString stringWithFormat:pattern, formatted];
|
||||
self.price.text = @(product.m_price.c_str());
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#import "MapViewController.h"
|
||||
#import "MapsAppDelegate.h"
|
||||
#import "Statistics.h"
|
||||
#import "TimeUtils.h"
|
||||
|
||||
#import "3party/Alohalytics/src/alohalytics_objc.h"
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<array/>
|
||||
</plist>
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<array/>
|
||||
</plist>
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<array/>
|
||||
</plist>
|
|
@ -101,8 +101,6 @@
|
|||
</array>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>LocalNotificationsFileName</key>
|
||||
<string>LocalNotifications</string>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue