diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm index aefc5fd8e9..d05d129e1b 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.mm +++ b/iphone/Maps/Classes/MapsAppDelegate.mm @@ -22,6 +22,7 @@ #include +#include "map/gps_tracker.hpp" #include "storage/storage_defines.hpp" #import "platform/http_thread_apple.h" @@ -47,6 +48,7 @@ static NSString * const kUDWatchEventAlreadyTracked = @"WatchEventAlreadyTracked static NSString * const kPushDeviceTokenLogEvent = @"iOSPushDeviceToken"; static NSString * const kIOSIDFA = @"IFA"; static NSString * const kBundleVersion = @"BundleVersion"; +static NSString * const kUDEnableTrackingKey = @"EnableTrackingForTheFirstTime"; extern string const kCountryCodeKey; extern string const kUniqueIdKey; @@ -276,6 +278,7 @@ void InitLocalizedStrings() [self incrementSessionsCountAndCheckForAlert]; [self enableTTSForTheFirstTime]; + [self enableTrackingForTheFirstTime]; [MWMTextToSpeech activateAudioSession]; return returnValue; @@ -592,6 +595,19 @@ void InitLocalizedStrings() return; [ud setBool:YES forKey:kUserDafaultsNeedToEnableTTS]; [ud synchronize]; + +} + +#pragma mark - Tracks + +- (void)enableTrackingForTheFirstTime +{ + NSUserDefaults * ud = [NSUserDefaults standardUserDefaults]; + if ([ud boolForKey:kUDEnableTrackingKey]) + return; + [ud setBool:YES forKey:kUDEnableTrackingKey]; + [ud synchronize]; + GpsTracker::Instance().SetDuration(hours(48)); } #pragma mark - Standby diff --git a/iphone/Maps/MWMRecentTrackSettingsController.mm b/iphone/Maps/MWMRecentTrackSettingsController.mm index a21224ba6a..7cbf98771f 100644 --- a/iphone/Maps/MWMRecentTrackSettingsController.mm +++ b/iphone/Maps/MWMRecentTrackSettingsController.mm @@ -11,7 +11,8 @@ typedef NS_ENUM(NSUInteger, DurationInHours) Two = 2, Six = 6, Twelve = 12, - Day = 24 + Day = 24, + TwoDays = 48 }; @interface MWMRecentTrackSettingsController () @@ -22,6 +23,7 @@ typedef NS_ENUM(NSUInteger, DurationInHours) @property (weak, nonatomic) IBOutlet SelectableCell * sixHours; @property (weak, nonatomic) IBOutlet SelectableCell * twelveHours; @property (weak, nonatomic) IBOutlet SelectableCell * oneDay; +@property (weak, nonatomic) IBOutlet SelectableCell * twoDays; @property (weak, nonatomic) SelectableCell * selectedCell; @end @@ -56,6 +58,9 @@ typedef NS_ENUM(NSUInteger, DurationInHours) case Day: _selectedCell = self.oneDay; break; + case TwoDays: + _selectedCell = self.twoDays; + break; default: NSAssert(false, @"Incorrect hours value"); break; @@ -86,8 +91,10 @@ typedef NS_ENUM(NSUInteger, DurationInHours) GpsTracker::Instance().SetDuration(hours(Six)); else if ([selectedCell isEqual:self.twelveHours]) GpsTracker::Instance().SetDuration(hours(Twelve)); - else + else if ([selectedCell isEqual:self.oneDay]) GpsTracker::Instance().SetDuration(hours(Day)); + else + GpsTracker::Instance().SetDuration(hours(TwoDays)); } selectedCell.accessoryType = UITableViewCellAccessoryCheckmark; } diff --git a/iphone/Maps/Mapsme.storyboard b/iphone/Maps/Mapsme.storyboard index 715a81906a..772416c096 100644 --- a/iphone/Maps/Mapsme.storyboard +++ b/iphone/Maps/Mapsme.storyboard @@ -174,7 +174,7 @@ - + @@ -328,6 +328,31 @@ + + + + + + + + + + + + + + + + + + + + @@ -342,6 +367,7 @@ +