forked from organicmaps/organicmaps
[swift] Review fixes.
This commit is contained in:
parent
3b7a716dc7
commit
959974e43c
6 changed files with 40 additions and 68 deletions
3
iphone/Maps/Classes/MWMTableViewCell+CellId.swift
Normal file
3
iphone/Maps/Classes/MWMTableViewCell+CellId.swift
Normal file
|
@ -0,0 +1,3 @@
|
|||
extension MWMTableViewCell {
|
||||
static func cellId() -> String { return String(describing: self) }
|
||||
}
|
|
@ -16,6 +16,9 @@
|
|||
34002A6E1D2F9D0700AC201E /* MWMRouter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34002A6C1D2F9D0700AC201E /* MWMRouter.mm */; };
|
||||
3400A6811CA29D7D003DA0EC /* NSString+Categories.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3400A6801CA29D7D003DA0EC /* NSString+Categories.mm */; };
|
||||
3400A6821CA29D7D003DA0EC /* NSString+Categories.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3400A6801CA29D7D003DA0EC /* NSString+Categories.mm */; };
|
||||
3400AB381E02E8CE004036E2 /* MWMTableViewCell+CellId.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3400AB371E02E8CE004036E2 /* MWMTableViewCell+CellId.swift */; };
|
||||
3400AB391E02E8CE004036E2 /* MWMTableViewCell+CellId.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3400AB371E02E8CE004036E2 /* MWMTableViewCell+CellId.swift */; };
|
||||
3400AB3A1E02E8CE004036E2 /* MWMTableViewCell+CellId.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3400AB371E02E8CE004036E2 /* MWMTableViewCell+CellId.swift */; };
|
||||
3401CD671C3C03A80028C6F8 /* MWMEditorTextTableViewCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3401CD651C3C03A80028C6F8 /* MWMEditorTextTableViewCell.mm */; };
|
||||
3401CD681C3C03A80028C6F8 /* MWMEditorTextTableViewCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3401CD651C3C03A80028C6F8 /* MWMEditorTextTableViewCell.mm */; };
|
||||
3401CD691C3C03A80028C6F8 /* MWMEditorTextTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3401CD661C3C03A80028C6F8 /* MWMEditorTextTableViewCell.xib */; };
|
||||
|
@ -1416,6 +1419,7 @@
|
|||
34002A6C1D2F9D0700AC201E /* MWMRouter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMRouter.mm; sourceTree = "<group>"; };
|
||||
3400A67F1CA29D7D003DA0EC /* NSString+Categories.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSString+Categories.h"; path = "Categories/NSString+Categories.h"; sourceTree = "<group>"; };
|
||||
3400A6801CA29D7D003DA0EC /* NSString+Categories.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = "NSString+Categories.mm"; path = "Categories/NSString+Categories.mm"; sourceTree = "<group>"; };
|
||||
3400AB371E02E8CE004036E2 /* MWMTableViewCell+CellId.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "MWMTableViewCell+CellId.swift"; sourceTree = "<group>"; };
|
||||
3401CD641C3C03A80028C6F8 /* MWMEditorTextTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMEditorTextTableViewCell.h; sourceTree = "<group>"; };
|
||||
3401CD651C3C03A80028C6F8 /* MWMEditorTextTableViewCell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMEditorTextTableViewCell.mm; sourceTree = "<group>"; };
|
||||
3401CD661C3C03A80028C6F8 /* MWMEditorTextTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMEditorTextTableViewCell.xib; sourceTree = "<group>"; };
|
||||
|
@ -2417,6 +2421,7 @@
|
|||
974D041B1977DE430081D0A7 /* LocalNotificationManager.mm */,
|
||||
B0DFE62F1A1B78A200B6C35E /* LocalNotifications.plist */,
|
||||
F626D52C1C3E6CAA00C17D15 /* MWMTableViewCell.h */,
|
||||
3400AB371E02E8CE004036E2 /* MWMTableViewCell+CellId.swift */,
|
||||
F626D52D1C3E6CAA00C17D15 /* MWMTableViewCell.mm */,
|
||||
46F26CD610F623BA00ECCA39 /* EAGLView.h */,
|
||||
46F26CD710F623BA00ECCA39 /* EAGLView.mm */,
|
||||
|
@ -4880,6 +4885,7 @@
|
|||
3491E7CB1C06F1F10042FE24 /* MWMPlacePageButtonCell.mm in Sources */,
|
||||
348C26051D701B9F00813924 /* MWMHelpController.mm in Sources */,
|
||||
348868EB1D8721650069BBA3 /* MWMSearchNoResults.mm in Sources */,
|
||||
3400AB381E02E8CE004036E2 /* MWMTableViewCell+CellId.swift in Sources */,
|
||||
346B42AB1DD5E3D20094EBEE /* MWMLocationNotFoundAlert.mm in Sources */,
|
||||
34BBB7231DD0853B0002E025 /* MWMSearchManager+Layout.mm in Sources */,
|
||||
341F99D91C6B1165001C67B8 /* MWMMapDownloaderPlaceTableViewCell.mm in Sources */,
|
||||
|
@ -5133,6 +5139,7 @@
|
|||
6741AA1D1BF340DE002C974C /* MWMDownloadTransitMapAlert.mm in Sources */,
|
||||
341F99DA1C6B1165001C67B8 /* MWMMapDownloaderPlaceTableViewCell.mm in Sources */,
|
||||
341F99D61C6B1165001C67B8 /* MWMMapDownloaderLargeCountryTableViewCell.mm in Sources */,
|
||||
3400AB391E02E8CE004036E2 /* MWMTableViewCell+CellId.swift in Sources */,
|
||||
346B42AC1DD5E3D20094EBEE /* MWMLocationNotFoundAlert.mm in Sources */,
|
||||
34BBB7241DD0853B0002E025 /* MWMSearchManager+Layout.mm in Sources */,
|
||||
348C26061D701B9F00813924 /* MWMHelpController.mm in Sources */,
|
||||
|
@ -5336,6 +5343,7 @@
|
|||
849CF71A1DE842290024A8A5 /* MWMDropDown.mm in Sources */,
|
||||
849CF71B1DE842290024A8A5 /* MWMEditorSelectTableViewCell.mm in Sources */,
|
||||
849CF71C1DE842290024A8A5 /* MWMPageController.mm in Sources */,
|
||||
3400AB3A1E02E8CE004036E2 /* MWMTableViewCell+CellId.swift in Sources */,
|
||||
849CF71D1DE842290024A8A5 /* MWMNavigationDashboardManager.mm in Sources */,
|
||||
849CF71E1DE842290024A8A5 /* MWMEditorViewController.mm in Sources */,
|
||||
849CF71F1DE842290024A8A5 /* MWMMapDownloaderExtendedDataSourceWithAds.mm in Sources */,
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
@objc final class SettingsTableViewLinkCell: MWMTableViewCell {
|
||||
|
||||
static let cellId = "SettingsTableViewLinkCell"
|
||||
|
||||
@IBOutlet fileprivate weak var title: UILabel!
|
||||
@IBOutlet fileprivate weak var info: UILabel!
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
@objc final class SettingsTableViewSelectableCell: MWMTableViewCell {
|
||||
|
||||
static let cellId = "SettingsTableViewSelectableCell"
|
||||
|
||||
@IBOutlet fileprivate weak var title: UILabel!
|
||||
|
||||
func config(title: String) {
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
@objc final class SettingsTableViewSwitchCell: MWMTableViewCell {
|
||||
|
||||
static let cellId = "SettingsTableViewSwitchCell"
|
||||
|
||||
@IBOutlet fileprivate weak var title: UILabel!
|
||||
@IBOutlet fileprivate weak var switchButton: UISwitch! {
|
||||
didSet {
|
||||
|
|
|
@ -70,15 +70,13 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
|
||||
- (void)configCommonSection
|
||||
{
|
||||
NSString * units = nil;
|
||||
switch ([MWMSettings measurementUnits])
|
||||
{
|
||||
case measurement_utils::Units::Metric:
|
||||
[self.unitsCell configWithTitle:L(@"measurement_units") info:L(@"kilometres")];
|
||||
break;
|
||||
case measurement_utils::Units::Imperial:
|
||||
[self.unitsCell configWithTitle:L(@"measurement_units") info:L(@"miles")];
|
||||
break;
|
||||
case measurement_utils::Units::Metric: units = L(@"kilometres"); break;
|
||||
case measurement_utils::Units::Imperial: units = L(@"miles"); break;
|
||||
}
|
||||
[self.unitsCell configWithTitle:L(@"measurement_units") info:units];
|
||||
|
||||
[self.zoomButtonsCell configWithDelegate:self
|
||||
title:L(@"pref_zoom_title")
|
||||
|
@ -92,53 +90,36 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
title:L(@"autodownload")
|
||||
isOn:[MWMSettings autoDownloadEnabled]];
|
||||
|
||||
NSString * mobileInternet = nil;
|
||||
using stage = platform::NetworkPolicy::Stage;
|
||||
switch (network_policy::GetStage())
|
||||
{
|
||||
case stage::Always:
|
||||
[self.mobileInternetCell configWithTitle:L(@"mobile_data")
|
||||
info:L(@"mobile_data_option_always")];
|
||||
break;
|
||||
case stage::Session:
|
||||
[self.mobileInternetCell configWithTitle:L(@"mobile_data") info:L(@"mobile_data_option_today")];
|
||||
break;
|
||||
case stage::Never:
|
||||
[self.mobileInternetCell configWithTitle:L(@"mobile_data") info:L(@"mobile_data_option_never")];
|
||||
break;
|
||||
case stage::Always: mobileInternet = L(@"mobile_data_option_always"); break;
|
||||
case stage::Session: mobileInternet = L(@"mobile_data_option_today"); break;
|
||||
case stage::Never: mobileInternet = L(@"mobile_data_option_never"); break;
|
||||
}
|
||||
[self.mobileInternetCell configWithTitle:L(@"mobile_data") info:mobileInternet];
|
||||
|
||||
|
||||
NSString * recentTrack = nil;
|
||||
if (!GpsTracker::Instance().IsEnabled())
|
||||
{
|
||||
[self.recentTrackCell configWithTitle:L(@"pref_track_record_title")
|
||||
info:L(@"duration_disabled")];
|
||||
recentTrack = L(@"duration_disabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (GpsTracker::Instance().GetDuration().count())
|
||||
{
|
||||
case 1:
|
||||
[self.recentTrackCell configWithTitle:L(@"pref_track_record_title")
|
||||
info:L(@"duration_1_hour")];
|
||||
break;
|
||||
case 2:
|
||||
[self.recentTrackCell configWithTitle:L(@"pref_track_record_title")
|
||||
info:L(@"duration_2_hours")];
|
||||
break;
|
||||
case 6:
|
||||
[self.recentTrackCell configWithTitle:L(@"pref_track_record_title")
|
||||
info:L(@"duration_6_hours")];
|
||||
break;
|
||||
case 12:
|
||||
[self.recentTrackCell configWithTitle:L(@"pref_track_record_title")
|
||||
info:L(@"duration_12_hours")];
|
||||
break;
|
||||
case 24:
|
||||
[self.recentTrackCell configWithTitle:L(@"pref_track_record_title")
|
||||
info:L(@"duration_1_day")];
|
||||
break;
|
||||
case 1: recentTrack = L(@"duration_1_hour"); break;
|
||||
case 2: recentTrack = L(@"duration_2_hours"); break;
|
||||
case 6: recentTrack = L(@"duration_6_hours"); break;
|
||||
case 12: recentTrack = L(@"duration_12_hours"); break;
|
||||
case 24: recentTrack = L(@"duration_1_day"); break;
|
||||
default: NSAssert(false, @"Incorrect hours value"); break;
|
||||
}
|
||||
}
|
||||
[self.recentTrackCell configWithTitle:L(@"pref_track_record_title") info:recentTrack];
|
||||
|
||||
|
||||
[self.compassCalibrationCell configWithDelegate:self
|
||||
title:L(@"pref_calibration_title")
|
||||
|
@ -155,24 +136,14 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
|
||||
- (void)configNavigationSection
|
||||
{
|
||||
NSString * nightMode = nil;
|
||||
if ([MWMSettings autoNightModeEnabled])
|
||||
{
|
||||
[self.nightModeCell configWithTitle:L(@"pref_map_style_title") info:L(@"pref_map_style_auto")];
|
||||
}
|
||||
nightMode = L(@"pref_map_style_auto");
|
||||
else if (GetFramework().GetMapStyle() == MapStyleDark)
|
||||
nightMode = L(@"pref_map_style_night");
|
||||
else
|
||||
{
|
||||
switch (GetFramework().GetMapStyle())
|
||||
{
|
||||
case MapStyleDark:
|
||||
[self.nightModeCell configWithTitle:L(@"pref_map_style_title")
|
||||
info:L(@"pref_map_style_night")];
|
||||
break;
|
||||
default:
|
||||
[self.nightModeCell configWithTitle:L(@"pref_map_style_title")
|
||||
info:L(@"pref_map_style_default")];
|
||||
break;
|
||||
}
|
||||
}
|
||||
nightMode = L(@"pref_map_style_default");
|
||||
[self.nightModeCell configWithTitle:L(@"pref_map_style_title") info:nightMode];
|
||||
|
||||
bool _ = true, on = true;
|
||||
GetFramework().Load3dMode(on, _);
|
||||
|
@ -182,25 +153,21 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
title:L(@"pref_map_auto_zoom")
|
||||
isOn:GetFramework().LoadAutoZoom()];
|
||||
|
||||
NSString * voiceInstructions = nil;
|
||||
if ([MWMTextToSpeech isTTSEnabled])
|
||||
{
|
||||
NSString * savedLanguage = [MWMTextToSpeech savedLanguage];
|
||||
if (savedLanguage.length != 0)
|
||||
{
|
||||
string const savedLanguageTwine = locale_translator::bcp47ToTwineLanguage(savedLanguage);
|
||||
NSString * language = @(tts::translatedTwine(savedLanguageTwine).c_str());
|
||||
[self.voiceInstructionsCell configWithTitle:L(@"pref_tts_language_title") info:language];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self.voiceInstructionsCell configWithTitle:L(@"pref_tts_language_title") info:nil];
|
||||
voiceInstructions = @(tts::translatedTwine(savedLanguageTwine).c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[self.voiceInstructionsCell configWithTitle:L(@"pref_tts_language_title")
|
||||
info:L(@"duration_disabled")];
|
||||
voiceInstructions = L(@"duration_disabled");
|
||||
}
|
||||
[self.voiceInstructionsCell configWithTitle:L(@"pref_tts_language_title") info:voiceInstructions];
|
||||
}
|
||||
|
||||
- (void)configInfoSection
|
||||
|
|
Loading…
Add table
Reference in a new issue