forked from organicmaps/organicmaps
[ios] Restored auto download switch.
This commit is contained in:
parent
ab63ada373
commit
f921e3e088
2 changed files with 32 additions and 4 deletions
|
@ -15,12 +15,18 @@
|
|||
|
||||
#include "platform/local_country_file_utils.hpp"
|
||||
|
||||
extern char const * kAutoDownloadEnabledKey;
|
||||
|
||||
namespace
|
||||
{
|
||||
CGSize constexpr kInitialDialogSize = {200, 200};
|
||||
|
||||
BOOL canAutoDownload(TCountryId const & countryId)
|
||||
{
|
||||
bool autoDownloadEnabled = true;
|
||||
(void)settings::Get(kAutoDownloadEnabledKey, autoDownloadEnabled);
|
||||
if (!autoDownloadEnabled)
|
||||
return NO;
|
||||
LocationManager * locationManager = MapsAppDelegate.theApp.locationManager;
|
||||
if (![locationManager lastLocationIsValid])
|
||||
return NO;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
extern char const * kStatisticsEnabledSettingsKey;
|
||||
char const * kAdForbiddenSettingsKey = "AdForbidden";
|
||||
char const * kAdServerForbiddenKey = "AdServerForbidden";
|
||||
char const * kAutoDownloadEnabledKey = "AutoDownloadEnabled";
|
||||
extern NSString * const kTTSStatusWasChangedNotification = @"TTFStatusWasChangedFromSettingsNotification";
|
||||
|
||||
typedef NS_ENUM(NSUInteger, Section)
|
||||
|
@ -75,7 +76,7 @@ typedef NS_ENUM(NSUInteger, Section)
|
|||
case SectionRouting:
|
||||
return 3;
|
||||
case SectionMap:
|
||||
return 4;
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,7 +132,20 @@ typedef NS_ENUM(NSUInteger, Section)
|
|||
customCell.titleLabel.text = indexPath.row == 0 ? L(@"pref_map_style_title") : L(@"pref_track_record_title");
|
||||
break;
|
||||
}
|
||||
// Auto download
|
||||
case 2:
|
||||
{
|
||||
bool autoDownloadEnabled = true;
|
||||
(void)settings::Get(kAutoDownloadEnabledKey, autoDownloadEnabled);
|
||||
cell = [tableView dequeueReusableCellWithIdentifier:[SwitchCell className]];
|
||||
SwitchCell * customCell = static_cast<SwitchCell *>(cell);
|
||||
customCell.titleLabel.text = L(@"autodownload");
|
||||
customCell.switchButton.on = autoDownloadEnabled;
|
||||
customCell.delegate = self;
|
||||
break;
|
||||
}
|
||||
// 3D buildings
|
||||
case 3:
|
||||
{
|
||||
cell = [tableView dequeueReusableCellWithIdentifier:[SwitchCell className]];
|
||||
SwitchCell * customCell = static_cast<SwitchCell *>(cell);
|
||||
|
@ -143,7 +157,7 @@ typedef NS_ENUM(NSUInteger, Section)
|
|||
break;
|
||||
}
|
||||
// Zoom buttons
|
||||
case 3:
|
||||
case 4:
|
||||
{
|
||||
cell = [tableView dequeueReusableCellWithIdentifier:[SwitchCell className]];
|
||||
SwitchCell * customCell = static_cast<SwitchCell *>(cell);
|
||||
|
@ -248,8 +262,16 @@ typedef NS_ENUM(NSUInteger, Section)
|
|||
case 0:
|
||||
case 1:
|
||||
break;
|
||||
// 3D buildings
|
||||
// Auto download
|
||||
case 2:
|
||||
{
|
||||
[Statistics logEvent:kStatEventName(kStatSettings, kStatAutoDownload)
|
||||
withParameters:@{kStatValue : (value ? kStatOn : kStatOff)}];
|
||||
settings::Set(kAutoDownloadEnabledKey, (bool)value);
|
||||
break;
|
||||
}
|
||||
// 3D buildings
|
||||
case 3:
|
||||
{
|
||||
[Statistics logEvent:kStatEventName(kStatSettings, kStat3DBuildings)
|
||||
withParameters:@{kStatValue : (value ? kStatOn : kStatOff)}];
|
||||
|
@ -262,7 +284,7 @@ typedef NS_ENUM(NSUInteger, Section)
|
|||
break;
|
||||
}
|
||||
// Zoom buttons
|
||||
case 3:
|
||||
case 4:
|
||||
{
|
||||
[Statistics logEvent:kStatEventName(kStatSettings, kStatToggleZoomButtonsVisibility)
|
||||
withParameters:@{kStatValue : (value ? kStatVisible : kStatHidden)}];
|
||||
|
|
Loading…
Add table
Reference in a new issue