Merge pull request #4173 from igrechuhin/MAPSME-2233

[ios] Refactored settings.
This commit is contained in:
Sergey Yershov 2016-08-30 16:21:40 +04:00 committed by GitHub
commit 11a4e21c76
43 changed files with 2620 additions and 1385 deletions

View file

@ -10,26 +10,59 @@
display: none;
}
dt {
font-style: italic;
font-weight: bold;
font-size: 1.1em;
padding-top: 0.8em;
border-top: 1px solid green;
font-style: normal;
font-weight: bold;
font-size: 14px;
line-height: 1.4;
}
dd {
margin: 0.5em 0 2.0em 0;
margin-top: 0.5em;
margin-right: 0;
margin-left: 0;
margin-bottom: 16px;
font-size: 14px;
color: #757575;
line-height: 1.4;
padding-bottom: 24px;
border-bottom: 1px solid #E0E0E0;
}
dl {
margin: 0 0 2em 0;
}
body {
font-family: "Helvetica Neue", "Roboto", "Arial", "sans-serif";
margin-right: 16px;
margin-left: 16px;
margin-bottom: 16px;
font-family: "Helvetica Neue", "Roboto", "Arial", "sans-serif";
color: #000000;
}
html {
-webkit-text-size-adjust: none;
}
a {
color: #1E96F0;
text-decoration: none;
}
h3 {
font-size: 21px;
line-height: 1.1;
padding-top: 12px;
}
.contentTable {
color: #757575;
font-size: 13px;
line-height: 2;
padding-bottom: 24px;
border-bottom: 1px solid #E0E0E0;
}
</style>
<script type="text/javascript">
@ -52,52 +85,57 @@
<body onload="showLanguage()">
<h3 lang="en">Frequently Asked Questions</h3>
<h3 lang="ru">Часто задаваемые вопросы</h3>
<h3 lang="de">FAQ</h3>
<h3 lang="es">FAQ</h3>
<div class="contentTable">
<ul>
<li><a lang="en" href="#mapdata">Map data</a>
<li><a href="#mapdata" class="link" lang="en">Map data</a>
<a lang="ru" href="#mapdata">Картографические данные</a>
<a lang="de" href="#mapdata">Kartendaten</a>
<a lang="es" href="#mapdata">Datos de los mapas</a></li>
<li><a lang="en" href="#mapeditor">Map editor</a>
<li><a href="#mapeditor" class="link" lang="en">Map editor</a>
<a lang="ru" href="#mapeditor">Редактор карты</a>
<a lang="de" href="#mapeditor">Karten-Editor</a>
<a lang="es" href="#mapeditor">Editor de mapas</a></li>
<li><a lang="en" href="#gps">GPS and positioning</a>
<li><a href="#gps" class="link" lang="en">GPS and positioning</a>
<a lang="ru" href="#gps">GPS и определение позиции</a>
<a lang="de" href="#gps">GPS</a>
<a lang="es" href="#gps">GPS</a></li>
<li><a lang="en" href="#navigation">Navigation, routing and tracks</a>
<li><a href="#navigation" class="link" lang="en">Navigation, routing and tracks</a>
<a lang="ru" href="#navigation">Навигация, маршруты и треки</a>
<a lang="de" href="#navigation">Navigation, routing and tracks</a>
<a lang="es" href="#navigation">Navegación, rutas e itinerarios</a></li>
<li><a lang="en" href="#search">Search</a>
<li><a href="#search" class="link" lang="en">Search</a>
<a lang="ru" href="#search">Поиск</a>
<a lang="de" href="#search">Suchen</a>
<a lang="es" href="#search">Búsqueda</a></li>
<li><a lang="en" href="#bookmarks">Bookmarks (pins)</a>
<li><a href="#bookmarks" class="link" lang="en">Bookmarks (pins)</a>
<a lang="ru" href="#bookmarks">Метки (закладки, пины)</a>
<a lang="de" href="#bookmarks">Lesezeichen (Pins)</a>
<a lang="es" href="#bookmarks">Marcadores</a></li>
<li><a lang="en" href="#settings">App Settings</a>
<li><a href="#settings" class="link" lang="en">App Settings</a>
<a lang="ru" href="#settings">Настройки</a>
<a lang="de" href="#settings">Präferenzen</a>
<a lang="es" href="#settings">Preferencias</a></li>
<li><a lang="en" href="#problems">Problems with the app</a>
<li><a href="#problems" class="link" lang="en">Problems with the app</a>
<a lang="ru" href="#problems">Проблемы с приложением</a>
<a lang="de" href="#problems">Probleme mit der App</a>
<a lang="es" href="#problems">Problemas con la aplicación</a></li>
<li><a lang="en" href="#miscellaneous">Miscellaneous</a>
<li><a href="#miscellaneous" class="link" lang="en">Miscellaneous</a>
<a lang="ru" href="#miscellaneous">Разное</a>
<a lang="de" href="#miscellaneous">Sonstiges</a>
<a lang="es" href="#miscellaneous">Misceláneo</a></li>
</ul>
</div>
<h3 lang="en">Map data</h3>
<h3 class="title" lang="en">Map data</h3>
<h3 lang="ru">Картографические данные</h3>
<h3 lang="de">Kartendaten</h3>
<h3 lang="es">Datos de los mapas</h3>
@ -109,15 +147,15 @@
<dt lang="de">Auf der Karte fehlen Orte oder sie haben falsche Namen.</dt>
<dt lang="es">Algunos lugares no aparecen en el mapa o tienen un nombre incorrecto.</dt>
<dd lang="en">Here at MAPS.ME we develop the app and its algorithms, but we get all the data
from <a href="http://www.openstreetmap.org/">OpenStreetMap</a> (OSM). This is a mapping project
from <a href="http://www.openstreetmap.org/" class="link">OpenStreetMap</a> (OSM). This is a mapping project
similar to Wikipedia, where anybody can create and edit maps.
<p></p>
If you see incorrect information, or if you find that some objects are missing on the map, you
can become an OSM contributor and improve the map. Its simple and fun you just need to <a href="https://www.openstreetmap.org/user/new">register
can become an OSM contributor and improve the map. Its simple and fun you just need to <a href="https://www.openstreetmap.org/user/new" class="link">register
on their website</a>.
<p></p>
You can also add new places, edit existing POI and building info (addresses, opening hours,
names) <a href="https://support.maps.me/hc/en-us/sections/201941155-Map-editor">directly
names) <a href="https://support.maps.me/hc/en-us/sections/201941155-Map-editor" class="link">directly
from MAPS.ME</a>. Once you log in with your account your edits will be automatically uploaded
to OSM. Please be careful when editing, as your edits will be seen by the whole OSM community.
@ -182,7 +220,7 @@ de tiempo que la comunidad abierta trace el mapa de todo el planeta.</dd>
settings. Please try again later or use a different Wi-Fi access point. In addition, make sure,
that you have enough free space to download maps.
<p></p>
If you have a slow internet connection, you can <a href="http://direct.mapswithme.com/direct/latest/">download
If you have a slow internet connection, you can <a href="http://direct.mapswithme.com/direct/latest/" class="link">download
maps</a> directly via PC and then transfer them to the MAPS.ME folder on your device. On Android
maps (.mwm files) are stored at MapsWithMe folder. On iOS, you need to connect your device to
a computer and copy maps via iTunes (select your device, then Apps scroll down the page, select
@ -261,7 +299,7 @@ detailliert sie ist?</dt>
<dt lang="es">¿Cómo puedo saber si MAPS.ME tiene el mapa de un país determinado y el nivel de
detalle?</dt>
<dd lang="en">MAPS.ME has maps for every country in the world, including islands. You can check
how detailed they are on <a href="http://www.openstreetmap.org/">OpenStreetMap.org</a></dd>
how detailed they are on <a href="http://www.openstreetmap.org/" class="link">OpenStreetMap.org</a></dd>
<dd lang="ru">В приложении есть карты всех стран мира, включая острова. Детализацию вы можете
проверить <a href="http://www.openstreetmap.org/">на сайте OpenStreetMap.org</a></dd>
<dd lang="de">MAPS.ME enthält Karten für jedes Land weltweit, einschließlich der Inseln. Sie
@ -361,7 +399,7 @@ cambios se cargarán automáticamente a OSM.</dd>
and tap Done in the top right-hand corner. Then select a category, for example cafe, add the
info and tap Save. If you want to delete added place, tap Edit place scroll page down and
select Remove. Please be very careful when adding new places: once your edits have been uploaded
to OSM, you should delete them directly at <a href="http://www.openstreetmap.org/">OpenStreetMap.org</a>.</dd>
to OSM, you should delete them directly at <a href="http://www.openstreetmap.org/" class="link">OpenStreetMap.org</a>.</dd>
<dd lang="ru">Нажмите кнопку меню и выберите Добавить место. Потяните карту, чтобы выбрать правильное
местоположение объекта и нажмите Готово в правом верхнем углу. Затем выберите категорию, например,
кафе, добавьте информацию и нажмите Сохранить. Чтобы удалить добавленный объект, нажмите Редактировать
@ -386,7 +424,7 @@ cargado a OSM, debes eliminarlas directamente en <a href="http://www.openstreetm
<dt lang="de">Wie kann ich Orte auf der Karte verschieben oder löschen?</dt>
<dt lang="es">¿Cómo puedo desplazar o eliminar lugares del mapa?</dt>
<dd lang="en">You can leave a note for OSM contributors with the description of the issue if
you tap Edit place on a place page. Alternatively, you can do it yourself at <a href="http://www.openstreetmap.org/">OpenStreetMap</a>.</dd>
you tap Edit place on a place page. Alternatively, you can do it yourself at <a href="http://www.openstreetmap.org/" class="link">OpenStreetMap</a>.</dd>
<dd lang="ru">Вы можете оставить заметку для участников OSM с описанием проблемы, нажав на место,
раскрыв белую панель и выбрав Редактировать место. Также вы можете внести изменения самостоятельно
на сайте <a href="http://www.openstreetmap.org/">OpenStreetMap</a>.</dd>
@ -446,7 +484,6 @@ We recommend you to check info about place and add your changes (if necessary) d
<li>информация о категории объекта была удалена в OSM</li>
<li>добавление информации к некоторым сложным геометрическим объектам не поддерживается в текущей
версии редактора.</li></ul>
<p></p>
Рекомендуем проверить информацию об объекте и при необходимости внести изменения напрямую на
сайте Openstreetmap.org.</dd>
<dd lang="de">Bitte stellen Sie sicher, dass Sie mit dem Internet verbunden sind und den richtigen
@ -636,6 +673,18 @@ haya bloqueado algún servicio antivirus, por lo que comprueba también estos aj
a habilitar (o a deshabilitar si ya está habilitado) «Usar Servicios de Google Play» en los
ajustes de la aplicación y, a continuación, reinicia el dispositivo.</dd>
<dt lang="en">How can I see my current speed and altitude?</dt>
<dt lang="ru">Как посмотреть мою текущую скорость и высоту над уровнем моря?</dt>
<dt lang="de">Wo kann ich meine aktuelle Geschwindigkeit und Höhe ablesen?</dt>
<dt lang="es">¿Cómo consulto la velocidad a la que voy y la altitud a la que me encuentro?</dt>
<dd lang="en">Make sure that you get GPS signal and then select your current position on the
map.</dd>
<dd lang="ru">Когда позиция определилась с помощью GPS-спутников (не по Wi-Fi или сотовой сети),
выберите ваше текущее местоположение на карте.</dd>
<dd lang="de">Stellen Sie sicher, dass Sie ein GPS-Signal empfangen und wählen Sie Ihre aktuelle
Position auf der Karte.</dd>
<dd lang="es">Comprueba que captas una señal de GPS y selecciona tu posición en el mapa.</dd>
<dt lang="en">What does the auto-follow mode stand for and how can I activate it?</dt>
<dt lang="ru">Что такое режим автоследования и как мне его активировать?</dt>
<dt lang="de">Wofür steht der Modus „Automatisch folgen“ und wie kann ich ihn aktivieren?</dt>
@ -686,35 +735,33 @@ want to go. Tap the "Route" icon in the pop-up window. You can change the route
the Car, Pedestrian or Bike icon. If you want to choose a different start location, tap “Route”
icon on the main screen. You will see the Planning Route window. Tap “From” to select a start
point, tap “To” for a destination point. Press "Start" to begin moving (navigation is only available
when you create a route from your current location). Press the arrow sign in the lower right corner
of the screen and tap Stop to finish the route.</dd>
when you create a route from your current location). Press the cross in the top left corner
of the screen to finish the route.</dd>
<dd lang="ru">Убедитесь, что ваше местоположение определено, затем выберите на карте точку,
к которой хотите проложить маршрут. В выпадающем меню нажмите иконку "Маршрут". Тип маршрута
можно изменить, нажав на иконку автомобиля, пешехода или велосипеда вверху экрана. Чтобы изменить
точку старта, нажмите на кнопку “Маршрут” на главном экране, откроется окно “Планирование маршрута”,
здесь вы можете задать начальную и конечную точки маршрута. Для движения по маршруту, нажмите
кнопку “Начать” (навигация доступна только из текущего местоположения). Чтобы закончить движение
по маршруту нажмите на значок стрелки в правом нижнем углу экрана и нажмите Стоп.</dd>
по маршруту нажмите на крестик в левом верхнем углу экрана.</dd>
<dd lang="de">Stellen Sie sicher, dass Ihre Position bestimmt ist und wählen Sie dann mit Ihrem
Finger einen Punkt auf der Karte, wohin Sie möchten. Tippen Sie im Popup-fenster auf das Symbol
"Route“. Sie können den Routentyp ändern, indem Sie oben im Bildschirm auf das Symbol "Auto", "Fußgänger"
oder "Fahrrad" drücken. Falls Sie einen anderen Startpunkt wählen möchten, tippen Sie auf das "Route"-Symbol
auf dem Hauptbildschirm. Dort sehen Sie das Routenplanungs-Fenster. Tippen Sie auf "Von“, um
einen Startpunkt zu wählen und tippen Sie auf "Nach“, um das Ziel zu wählen. Drücken Sie auf
"Start“, um zu beginnen. (Navigation ist nur verfügbar, wenn Sie eine neue Route von Ihrer aktuellen
Position aus berechnen lassen). Drücken Sie auf "Start“ und fahren Sie los. Drücken Sie die
Pfeil-Zeichen in der rechten unteren Ecke
des Bildschirms und tippen Sie auf "Anhalten" um die Strecke zu beenden.</dd>
„Route“. Sie können den Routentyp ändern, indem Sie oben im Bildschirm auf das Symbol „Fußgänger“
oder „Auto“ drücken. Falls Sie einen anderen Startpunkt wählen möchten, tippen Sie auf das „Route“-Symbol
auf dem Hauptbildschirm. Dort sehen Sie das Routenplanungs-Fenster. Tippen Sie auf „Von“, um
einen Startpunkt zu wählen und tippen Sie auf „Nach“, um das Ziel zu wählen. Drücken Sie auf
„Start“, um zu beginnen. (Navigation ist nur verfügbar, wenn Sie eine neue Route von Ihrer aktuellen
Position aus berechnen lassen). Drücken Sie auf „Start“ und fahren Sie los. Drücken Sie auf
das Kreuz oben links im Bildschirm, um die Route fertigzustellen.</dd>
<dd lang="es">Confirma que se haya establecido tu posición; a continuación, elige con el dedo
el punto del mapa al que quieras ir. Toca el icono "Ruta" en la ventana emergente. Para cambiar
el tipo de ruta, pulsa los iconos "En
automóvil", "A pie" o "En bicicleta" situados en la parte superior de la pantalla.
el punto del mapa al que quieras ir. Toca el icono «Ruta» en la ventana emergente. Para cambiar
el tipo de ruta, pulsa los iconos «A pie» o «En coche» situados en la parte superior de la pantalla.
Si quieres elegir otra ubicación de inicio, pulsa el icono «Ruta» en la pantalla principal.
Aparecerá la ventana de Planificación de ruta. Pulsa en "Desde" para seleccionar un punto de
Aparecerá la ventana de Planificación de ruta. Pulsa en «Desde» para seleccionar un punto de
partida y pulsa en «A» para un punto de destino. Presiona el botón «Inicio» para empezar a moverte
(la navegación solo está disponible cuando se crea una ruta desde tu ubicación actual). Pulsa
"Empezar" para empezar a moverte. Pulse el signo de la flecha en la esquina inferior derecha
de la pantalla y toque "Detener" para finalizar la ruta.</dd>
«Empezar» para empezar a moverte. Pulsa la «X» situada en la esquina superior izquierda de la
pantalla para finalizar la ruta.</dd>
<dt lang="en">How can I manage voice instructions settings?</dt>
<dt lang="ru">Настройки голосовой навигации.</dt>

View file

@ -1,17 +1,17 @@
#import "AppInfo.h"
#import "MWMAlertViewController.h"
#import "MWMRateAlert.h"
#import "Statistics.h"
#import "UIColor+MapsMeColor.h"
#import <MessageUI/MFMailComposeViewController.h>
#import <sys/utsname.h>
#import "AppInfo.h"
#import "MWMAlertViewController.h"
#import "Statistics.h"
#import "UIColor+MapsMeColor.h"
#import "3party/Alohalytics/src/alohalytics_objc.h"
#include "platform/platform.hpp"
extern NSString * const kUDAlreadyRatedKey;
extern NSDictionary * const deviceNames;
extern NSDictionary * const kDeviceNames;
extern NSString * const kLocaleUsedInSupportEmails;
extern NSString * const kRateAlertEventName = @"rateAlertEvent";
static NSString * const kRateAlertNibName = @"MWMRateAlert";
@ -19,13 +19,13 @@ static NSString * const kRateEmail = @"rating@maps.me";
static NSString * const kStatisticsEvent = @"Rate Alert";
@interface MWMRateAlert () <MFMailComposeViewControllerDelegate>
@interface MWMRateAlert ()<MFMailComposeViewControllerDelegate>
@property (nonatomic) IBOutletCollection(UIButton) NSArray * buttons;
@property (nonatomic, weak) IBOutlet UIButton * rateButton;
@property (nonatomic, weak) IBOutlet UILabel * title;
@property (nonatomic, weak) IBOutlet UILabel * message;
@property (nonatomic) NSUInteger selectedTag;
@property(nonatomic) IBOutletCollection(UIButton) NSArray * buttons;
@property(nonatomic, weak) IBOutlet UIButton * rateButton;
@property(nonatomic, weak) IBOutlet UILabel * title;
@property(nonatomic, weak) IBOutlet UILabel * message;
@property(nonatomic) NSUInteger selectedTag;
@end
@ -34,7 +34,8 @@ static NSString * const kStatisticsEvent = @"Rate Alert";
+ (instancetype)alert
{
[Statistics logEvent:kStatisticsEvent withParameters:@{kStatAction : kStatOpen}];
MWMRateAlert * alert = [[[NSBundle mainBundle] loadNibNamed:kRateAlertNibName owner:self options:nil] firstObject];
MWMRateAlert * alert =
[[[NSBundle mainBundle] loadNibNamed:kRateAlertNibName owner:self options:nil] firstObject];
[alert configureButtons];
return alert;
}
@ -83,22 +84,14 @@ static NSString * const kStatisticsEvent = @"Rate Alert";
self.selectedTag = tag;
}
- (IBAction)starHighlighted:(UIButton *)sender
{
[self setHighlighted:sender.tag];
}
- (IBAction)starHighlighted:(UIButton *)sender { [self setHighlighted:sender.tag]; }
- (IBAction)starTouchCanceled
{
for (UIButton * b in self.buttons)
b.highlighted = NO;
}
- (IBAction)starDragInside:(UIButton *)sender
{
[self setHighlighted:sender.tag];
}
- (IBAction)starDragInside:(UIButton *)sender { [self setHighlighted:sender.tag]; }
- (void)setHighlighted:(NSUInteger)tag
{
for (UIButton * b in self.buttons)
@ -121,7 +114,9 @@ static NSString * const kStatisticsEvent = @"Rate Alert";
{
NSUInteger const tag = self.selectedTag;
[Statistics logEvent:kStatEventName(kStatisticsEvent, kStatRate)
withParameters:@{kStatValue : @(tag).stringValue}];
withParameters:@{
kStatValue : @(tag).stringValue
}];
if (tag == 5)
{
[[UIApplication sharedApplication] rateVersionFrom:@"ios_pro_popup"];
@ -153,38 +148,40 @@ static NSString * const kStatisticsEvent = @"Rate Alert";
struct utsname systemInfo;
uname(&systemInfo);
NSString * machine = @(systemInfo.machine);
NSString * device = deviceNames[machine];
NSString * device = kDeviceNames[machine];
if (!device)
device = machine;
NSString * languageCode = [[NSLocale preferredLanguages] firstObject];
NSString * language = [[NSLocale localeWithLocaleIdentifier:kLocaleUsedInSupportEmails]
displayNameForKey:NSLocaleLanguageCode
value:languageCode];
displayNameForKey:NSLocaleLanguageCode
value:languageCode];
NSString * locale = [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode];
NSString * country = [[NSLocale localeWithLocaleIdentifier:kLocaleUsedInSupportEmails]
displayNameForKey:NSLocaleCountryCode
value:locale];
displayNameForKey:NSLocaleCountryCode
value:locale];
NSString * bundleVersion = AppInfo.sharedInfo.bundleVersion;
NSString * text = [NSString stringWithFormat:@"\n\n\n\n- %@ (%@)\n- MAPS.ME %@\n- %@/%@", device,
[UIDevice currentDevice].systemVersion,
bundleVersion,
language,
country];
NSString * text = [NSString stringWithFormat:@"\n\n\n\n- %@ (%@)\n- MAPS.ME %@\n- %@/%@",
device, [UIDevice currentDevice].systemVersion,
bundleVersion, language, country];
MFMailComposeViewController * mailController = [[MFMailComposeViewController alloc] init];
mailController.mailComposeDelegate = self;
[mailController setSubject:[NSString stringWithFormat:@"%@ : %@", L(@"rating_just_rated"), @(self.selectedTag)]];
[mailController setToRecipients:@[kRateEmail]];
[mailController setSubject:[NSString stringWithFormat:@"%@ : %@", L(@"rating_just_rated"),
@(self.selectedTag)]];
[mailController setToRecipients:@[ kRateEmail ]];
[mailController setMessageBody:text isHTML:NO];
mailController.navigationBar.tintColor = [UIColor blackColor];
[self.alertController.ownerViewController presentViewController:mailController animated:YES completion:nil];
[self.alertController.ownerViewController presentViewController:mailController
animated:YES
completion:nil];
}
else
{
NSString * text = [NSString stringWithFormat:L(@"email_error_body"), kRateEmail];
[[[UIAlertView alloc] initWithTitle:L(@"email_error_title") message:text
delegate:nil
cancelButtonTitle:L(@"ok")
otherButtonTitles:nil] show];
[[[UIAlertView alloc] initWithTitle:L(@"email_error_title")
message:text
delegate:nil
cancelButtonTitle:L(@"ok")
otherButtonTitles:nil] show];
}
}
@ -194,11 +191,12 @@ static NSString * const kStatisticsEvent = @"Rate Alert";
didFinishWithResult:(MFMailComposeResult)result
error:(NSError *)error
{
[self.alertController.ownerViewController dismissViewControllerAnimated:YES completion:^
{
[Statistics logEvent:kStatEventName(kStatisticsEvent, kStatClose)];
[self close];
}];
[self.alertController.ownerViewController
dismissViewControllerAnimated:YES
completion:^{
[Statistics logEvent:kStatEventName(kStatisticsEvent, kStatClose)];
[self close];
}];
}
@end

View file

@ -1,38 +1,37 @@
#import "MWMAuthorizationOSMLoginViewController.h"
#import "MWMAlertViewController.h"
#import "MWMAuthorizationCommon.h"
#import "MWMAuthorizationOSMLoginViewController.h"
#import "MWMCircularProgress.h"
#import "MWMSettingsViewController.h"
#import "Statistics.h"
#import "SettingsAndMoreVC.h"
#import "UIColor+MapsMeColor.h"
#import "UITextField+RuntimeAttributes.h"
#include "private.h"
#include "base/logging.hpp"
#include "editor/server_api.hpp"
#include "platform/platform.hpp"
#include "base/logging.hpp"
#include "private.h"
typedef NS_OPTIONS(NSUInteger, MWMFieldCorrect)
{
MWMFieldCorrectNO = 0,
MWMFieldCorrectLogin = 1 << 0,
typedef NS_OPTIONS(NSUInteger, MWMFieldCorrect) {
MWMFieldCorrectNO = 0,
MWMFieldCorrectLogin = 1 << 0,
MWMFieldCorrectPassword = 1 << 1,
MWMFieldCorrectAll = MWMFieldCorrectLogin | MWMFieldCorrectPassword
};
using namespace osm;
@interface MWMAuthorizationOSMLoginViewController () <UITextFieldDelegate>
@interface MWMAuthorizationOSMLoginViewController ()<UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UITextField * loginTextField;
@property (weak, nonatomic) IBOutlet UITextField * passwordTextField;
@property (weak, nonatomic) IBOutlet UIButton * loginButton;
@property (weak, nonatomic) IBOutlet UIButton * forgotButton;
@property (weak, nonatomic) IBOutlet UIView * spinnerView;
@property(weak, nonatomic) IBOutlet UITextField * loginTextField;
@property(weak, nonatomic) IBOutlet UITextField * passwordTextField;
@property(weak, nonatomic) IBOutlet UIButton * loginButton;
@property(weak, nonatomic) IBOutlet UIButton * forgotButton;
@property(weak, nonatomic) IBOutlet UIView * spinnerView;
@property (nonatomic) MWMFieldCorrect isCorrect;
@property(nonatomic) MWMFieldCorrect isCorrect;
@property (nonatomic) MWMCircularProgress * spinner;
@property(nonatomic) MWMCircularProgress * spinner;
@end
@ -54,19 +53,13 @@ using namespace osm;
[self.loginTextField becomeFirstResponder];
}
- (BOOL)shouldAutorotate
{
return NO;
}
- (void)checkConnection
{
self.forgotButton.enabled = Platform::IsConnected();
}
- (BOOL)shouldAutorotate { return NO; }
- (void)checkConnection { self.forgotButton.enabled = Platform::IsConnected(); }
#pragma mark - UITextFieldDelegate
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
- (BOOL)textField:(UITextField *)textField
shouldChangeCharactersInRange:(NSRange)range
replacementString:(NSString *)string
{
NSString * newString =
[textField.text stringByReplacingCharactersInRange:range withString:string];
@ -135,8 +128,7 @@ using namespace osm;
if (Platform::IsConnected())
{
[self startSpinner];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
string const username = self.loginTextField.text.UTF8String;
string const password = self.passwordTextField.text.UTF8String;
OsmOAuth auth = OsmOAuth::ServerAuth();
@ -147,22 +139,24 @@ using namespace osm;
catch (exception const & ex)
{
LOG(LWARNING, ("Error login", ex.what()));
[Statistics logEvent:@"Editor_Auth_request_result" withParameters:@{kStatIsSuccess : kStatNo,
kStatErrorData : @(ex.what()),
kStatType : kStatOSM}];
[Statistics logEvent:@"Editor_Auth_request_result"
withParameters:@{
kStatIsSuccess : kStatNo,
kStatErrorData : @(ex.what()),
kStatType : kStatOSM
}];
}
dispatch_async(dispatch_get_main_queue(), ^
{
dispatch_async(dispatch_get_main_queue(), ^{
[self stopSpinner];
if (auth.IsAuthorized())
{
osm_auth_ios::AuthorizationStoreCredentials(auth.GetKeySecret());
[Statistics logEvent:@"Editor_Auth_request_result" withParameters:@{kStatIsSuccess : kStatYes,
kStatType : kStatOSM}];
[Statistics logEvent:@"Editor_Auth_request_result"
withParameters:@{kStatIsSuccess : kStatYes, kStatType : kStatOSM}];
UIViewController * svc = nil;
for (UIViewController * vc in self.navigationController.viewControllers)
{
if ([vc isKindOfClass:[SettingsAndMoreVC class]])
if ([vc isKindOfClass:[MWMSettingsViewController class]])
{
svc = vc;
break;
@ -186,11 +180,7 @@ using namespace osm;
}
}
- (IBAction)cancel
{
[self.navigationController popViewControllerAnimated:YES];
}
- (IBAction)cancel { [self.navigationController popViewControllerAnimated:YES]; }
- (IBAction)forgotPassword
{
[self openUrl:[NSURL URLWithString:@(OsmOAuth::ServerAuth().GetResetPasswordURL().c_str())]];

View file

@ -1,10 +1,10 @@
#import "MWMAuthorizationWebViewLoginViewController.h"
#import "Common.h"
#import "MWMAlertViewController.h"
#import "MWMAuthorizationCommon.h"
#import "MWMAuthorizationWebViewLoginViewController.h"
#import "MWMCircularProgress.h"
#import "MWMSettingsViewController.h"
#import "Statistics.h"
#import "SettingsAndMoreVC.h"
#include "base/logging.hpp"
#include "editor/osm_auth.hpp"
@ -17,8 +17,8 @@ NSString * const kVerifierKey = @"oauth_verifier";
BOOL checkURLHasVerifierKey(NSString * urlString)
{
return isIOS7 ? [urlString rangeOfString:kVerifierKey].location != NSNotFound :
[urlString containsString:kVerifierKey];
return isIOS7 ? [urlString rangeOfString:kVerifierKey].location != NSNotFound
: [urlString containsString:kVerifierKey];
}
BOOL checkURLNeedsReload(NSString * urlString)
@ -27,7 +27,6 @@ BOOL checkURLNeedsReload(NSString * urlString)
if (!isIOS7)
return hasSlashSuffix || [urlString containsString:@"/welcome"];
return hasSlashSuffix || ([urlString rangeOfString:@"/welcome"].location != NSNotFound);
}
NSString * getVerifier(NSString * urlString)
@ -47,12 +46,12 @@ NSString * getVerifier(NSString * urlString)
}
} // namespace
@interface MWMAuthorizationWebViewLoginViewController () <UIWebViewDelegate>
@interface MWMAuthorizationWebViewLoginViewController ()<UIWebViewDelegate>
@property (weak, nonatomic) IBOutlet UIWebView * webView;
@property (weak, nonatomic) IBOutlet UIView * spinnerView;
@property(weak, nonatomic) IBOutlet UIWebView * webView;
@property(weak, nonatomic) IBOutlet UIView * spinnerView;
@property (nonatomic) MWMCircularProgress * spinner;
@property(nonatomic) MWMCircularProgress * spinner;
@end
@ -83,26 +82,20 @@ NSString * getVerifier(NSString * urlString)
- (void)loadAuthorizationPage
{
[self startSpinner];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
OsmOAuth const auth = OsmOAuth::ServerAuth();
try
{
OsmOAuth::TUrlRequestToken urt;
switch (self.authType)
{
case MWMWebViewAuthorizationTypeGoogle:
urt = auth.GetGoogleOAuthURL();
break;
case MWMWebViewAuthorizationTypeFacebook:
urt = auth.GetFacebookOAuthURL();
break;
case MWMWebViewAuthorizationTypeGoogle: urt = auth.GetGoogleOAuthURL(); break;
case MWMWebViewAuthorizationTypeFacebook: urt = auth.GetFacebookOAuthURL(); break;
}
self->m_requestToken = urt.second;
NSURL * url = [NSURL URLWithString:@(urt.first.c_str())];
NSURLRequest * request = [NSURLRequest requestWithURL:url];
dispatch_async(dispatch_get_main_queue(), ^
{
dispatch_async(dispatch_get_main_queue(), ^{
[self stopSpinner];
self.webView.hidden = NO;
[self.webView loadRequest:request];
@ -110,8 +103,7 @@ NSString * getVerifier(NSString * urlString)
}
catch (exception const & ex)
{
dispatch_async(dispatch_get_main_queue(), ^
{
dispatch_async(dispatch_get_main_queue(), ^{
[self stopSpinner];
[self.alertController presentInternalErrorAlert];
});
@ -140,16 +132,15 @@ NSString * getVerifier(NSString * urlString)
{
switch (self.authType)
{
case MWMWebViewAuthorizationTypeGoogle: return kStatGoogle;
case MWMWebViewAuthorizationTypeFacebook: return kStatFacebook;
case MWMWebViewAuthorizationTypeGoogle: return kStatGoogle;
case MWMWebViewAuthorizationTypeFacebook: return kStatFacebook;
}
}
- (void)checkAuthorization:(NSString *)verifier
{
[self startSpinner];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
OsmOAuth const auth = OsmOAuth::ServerAuth();
TKeySecret ks;
try
@ -159,22 +150,24 @@ NSString * getVerifier(NSString * urlString)
catch (exception const & ex)
{
LOG(LWARNING, ("checkAuthorization error", ex.what()));
[Statistics logEvent:@"Editor_Auth_request_result" withParameters:@{kStatIsSuccess : kStatNo,
kStatErrorData : @(ex.what()),
kStatType : self.authTypeAsString}];
[Statistics logEvent:@"Editor_Auth_request_result"
withParameters:@{
kStatIsSuccess : kStatNo,
kStatErrorData : @(ex.what()),
kStatType : self.authTypeAsString
}];
}
dispatch_async(dispatch_get_main_queue(), ^
{
dispatch_async(dispatch_get_main_queue(), ^{
[self stopSpinner];
if (OsmOAuth::IsValid(ks))
{
osm_auth_ios::AuthorizationStoreCredentials(ks);
[Statistics logEvent:@"Editor_Auth_request_result" withParameters:@{kStatIsSuccess : kStatYes,
kStatType : self.authTypeAsString}];
[Statistics logEvent:@"Editor_Auth_request_result"
withParameters:@{kStatIsSuccess : kStatYes, kStatType : self.authTypeAsString}];
UIViewController * svc = nil;
for (UIViewController * vc in self.navigationController.viewControllers)
{
if ([vc isKindOfClass:[SettingsAndMoreVC class]])
if ([vc isKindOfClass:[MWMSettingsViewController class]])
{
svc = vc;
break;
@ -197,18 +190,10 @@ NSString * getVerifier(NSString * urlString)
#pragma mark - Actions
- (void)onCancel
{
[self.navigationController popViewControllerAnimated:YES];
}
- (void)onCancel { [self.navigationController popViewControllerAnimated:YES]; }
#pragma mark - UIWebViewDelegate
- (void)webViewDidStartLoad:(UIWebView *)webView
{
[self startSpinner];
}
- (void)webViewDidStartLoad:(UIWebView *)webView { [self startSpinner]; }
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
[self stopSpinner];

View file

@ -13,11 +13,10 @@
#import "MWMMapViewControlsManager.h"
#import "MWMRouter.h"
#import "MWMSearchManager.h"
#import "MWMSettingsViewController.h"
#import "MWMTextToSpeech.h"
#import "MapViewController.h"
#import "MapsAppDelegate.h"
#import "SettingsAndMoreVC.h"
#import "SettingsViewController.h"
#import "Statistics.h"
#import "TimeUtils.h"
#import "UIColor+MapsMeColor.h"
@ -362,23 +361,12 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell) {
[self.delegate actionDownloadMaps:mwm::DownloaderMode::Downloaded];
}
- (void)menuActionOpenSettings
- (IBAction)menuActionOpenSettings
{
[Statistics logEvent:kStatMenu withParameters:@{kStatButton : kStatSettings}];
self.state = self.restoreState;
[Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"settingsAndMore"];
SettingsAndMoreVC * vc = [[SettingsAndMoreVC alloc] initWithStyle:UITableViewStyleGrouped];
[self.controller.navigationController pushViewController:vc animated:YES];
}
- (IBAction)menuActionOpenSubSettings
{
[Statistics logEvent:kStatMenu withParameters:@{kStatButton : kStatSettings}];
self.state = self.restoreState;
[Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"settingsMiles"];
SettingsViewController * vc = [self.mainStoryboard
instantiateViewControllerWithIdentifier:[SettingsViewController className]];
[self.controller.navigationController pushViewController:vc animated:YES];
[self.controller performSegueWithIdentifier:@"Map2Settings" sender:nil];
}
- (void)menuActionShareLocation

View file

@ -358,7 +358,7 @@
<userDefinedRuntimeAttribute type="string" keyPath="coloringName" value="MWMBlack"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="menuActionOpenSubSettings" destination="-1" eventType="touchUpInside" id="C7M-L9-gWG"/>
<action selector="menuActionOpenSettings" destination="-1" eventType="touchUpInside" id="CTJ-mX-3im"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="q6M-3k-tKX" customClass="MWMButton">

View file

@ -225,8 +225,6 @@ extern NSString * const kAlohalyticsTapEventKey;
}
}
#pragma mark - MWMBottomMenuControllerProtocol
- (void)closeInfoScreens
{
if (IPAD)
@ -244,16 +242,12 @@ extern NSString * const kAlohalyticsTapEventKey;
}
}
#pragma mark - MWMBottomMenuControllerProtocol
- (void)didFinishAddingPlace
{
self.menuState = MWMBottomMenuStateInactive;
static_cast<EAGLView *>(self.ownerController.view).widgetsManager.fullScreen = NO;
}
#pragma mark - MWMBottomMenuControllerProtocol
- (void)addPlace:(BOOL)isBusiness hasPoint:(BOOL)hasPoint point:(m2::PointD const &)point
{
self.menuState = MWMBottomMenuStateHidden;

View file

@ -2,6 +2,7 @@
#import "Common.h"
#import "MWMButton.h"
#import "MWMRouter.h"
#import "MWMSettings.h"
#import "MWMSideButtonsView.h"
#import "Statistics.h"
#import "UIColor+MapsMeColor.h"
@ -197,20 +198,13 @@ NSArray<UIImage *> * animationImages(NSString * animationTemplate, NSUInteger im
#pragma mark - Properties
- (BOOL)isZoomEnabled
{
bool zoomButtonsEnabled = true;
(void)settings::Get("ZoomButtonsEnabled", zoomButtonsEnabled);
return zoomButtonsEnabled;
}
- (BOOL)zoomHidden { return self.sideView.zoomHidden; }
- (void)setZoomHidden:(BOOL)zoomHidden
{
if (GetFramework().IsRoutingActive())
self.sideView.zoomHidden = NO;
else
self.sideView.zoomHidden = [self isZoomEnabled] ? zoomHidden : YES;
self.sideView.zoomHidden = [MWMSettings zoomButtonsEnabled] ? zoomHidden : YES;
}
- (BOOL)hidden { return self.sideView.hidden; }

View file

@ -1,7 +1,8 @@
#import "Common.h"
#import "MapsAppDelegate.h"
#import "MWMLocationManager.h"
#import "MWMNavigationDashboardEntity.h"
#import "Common.h"
#import "MWMLocationManager.h"
#import "MWMSettings.h"
#import "MapsAppDelegate.h"
#include "Framework.h"
#include "geometry/distance_on_sphere.hpp"
@ -26,16 +27,16 @@ using namespace routing::turns;
string distance;
CLLocationCoordinate2D const & coordinate = lastLocation.coordinate;
_pedestrianDirectionPosition = info.m_pedestrianDirectionPos;
//TODO: Not the best solution, but this solution is temporary and will be replaced in future
// TODO: Not the best solution, but this solution is temporary and will be replaced in future
measurement_utils::FormatDistance(
ms::DistanceOnEarth(coordinate.latitude, coordinate.longitude,
_pedestrianDirectionPosition.lat, _pedestrianDirectionPosition.lon),
distance);
istringstream is (distance);
istringstream is(distance);
string dist;
string units;
is>>dist;
is>>units;
is >> dist;
is >> units;
_nextTurnImage = nil;
_distanceToTurn = @(dist.c_str());
_turnUnits = @(units.c_str());
@ -69,47 +70,23 @@ UIImage * image(routing::turns::TurnDirection t, bool isNextTurn)
NSString * imageName;
switch (t)
{
case TurnDirection::TurnSlightRight:
imageName = @"slight_right";
break;
case TurnDirection::TurnRight:
imageName = @"simple_right";
break;
case TurnDirection::TurnSharpRight:
imageName = @"sharp_right";
break;
case TurnDirection::TurnSlightLeft:
imageName = @"slight_left";
break;
case TurnDirection::TurnLeft:
imageName = @"simple_left";
break;
case TurnDirection::TurnSharpLeft:
imageName = @"sharp_left";
break;
case TurnDirection::UTurnLeft:
imageName = @"uturn_left";
break;
case TurnDirection::UTurnRight:
imageName = @"uturn_right";
break;
case TurnDirection::ReachedYourDestination:
imageName = @"finish_point";
break;
case TurnDirection::LeaveRoundAbout:
case TurnDirection::EnterRoundAbout:
imageName = @"round";
break;
case TurnDirection::GoStraight:
imageName = @"straight";
break;
case TurnDirection::StartAtEndOfStreet:
case TurnDirection::StayOnRoundAbout:
case TurnDirection::TakeTheExit:
case TurnDirection::Count:
case TurnDirection::NoTurn:
imageName = isNextTurn ? nil : @"straight";
break;
case TurnDirection::TurnSlightRight: imageName = @"slight_right"; break;
case TurnDirection::TurnRight: imageName = @"simple_right"; break;
case TurnDirection::TurnSharpRight: imageName = @"sharp_right"; break;
case TurnDirection::TurnSlightLeft: imageName = @"slight_left"; break;
case TurnDirection::TurnLeft: imageName = @"simple_left"; break;
case TurnDirection::TurnSharpLeft: imageName = @"sharp_left"; break;
case TurnDirection::UTurnLeft: imageName = @"uturn_left"; break;
case TurnDirection::UTurnRight: imageName = @"uturn_right"; break;
case TurnDirection::ReachedYourDestination: imageName = @"finish_point"; break;
case TurnDirection::LeaveRoundAbout:
case TurnDirection::EnterRoundAbout: imageName = @"round"; break;
case TurnDirection::GoStraight: imageName = @"straight"; break;
case TurnDirection::StartAtEndOfStreet:
case TurnDirection::StayOnRoundAbout:
case TurnDirection::TakeTheExit:
case TurnDirection::Count:
case TurnDirection::NoTurn: imageName = isNextTurn ? nil : @"straight"; break;
}
if (!imageName)
return nil;
@ -121,15 +98,13 @@ UIImage * image(routing::turns::TurnDirection t, bool isNextTurn)
CLLocation * lastLocation = [MWMLocationManager lastLocation];
if (!lastLocation || lastLocation.speed < 0)
return nil;
auto units = measurement_utils::Units::Metric;
UNUSED_VALUE(settings::Get(settings::kMeasurementUnits, units));
auto const units = [MWMSettings measurementUnits];
return @(measurement_utils::FormatSpeed(lastLocation.speed, units).c_str());
}
- (NSString *)speedUnits
{
auto units = measurement_utils::Units::Metric;
UNUSED_VALUE(settings::Get(settings::kMeasurementUnits, units));
auto const units = [MWMSettings measurementUnits];
return @(measurement_utils::FormatSpeedUnits(units).c_str());
}

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
@ -11,7 +11,7 @@
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="22f-XO-fEh">

View file

@ -23,6 +23,7 @@
#import "MWMPlacePageEntity.h"
#import "MWMRouter.h"
#import "MWMRouterSavedState.h"
#import "MWMSettings.h"
#import "MWMStorage.h"
#import "MWMTableViewController.h"
#import "MWMWhatsNewNavigationController.h"
@ -57,8 +58,6 @@ extern NSString * const kAlohalyticsTapEventKey = @"$onClick";
extern NSString * const kMap2OsmLoginSegue = @"Map2OsmLogin";
extern NSString * const kMap2FBLoginSegue = @"Map2FBLogin";
extern NSString * const kMap2GoogleLoginSegue = @"Map2GoogleLogin";
extern char const * kAdForbiddenSettingsKey;
extern char const * kAdServerForbiddenKey;
typedef NS_ENUM(NSUInteger, UserTouchesAction) {
UserTouchesActionNone,
@ -172,9 +171,9 @@ BOOL gIsFirstMyPositionMode = YES;
df::TouchEvent e;
UITouch * touch = [allTouches objectAtIndex:0];
CGPoint const pt = [touch locationInView:v];
e.SetTouchType(type);
df::Touch t0;
t0.m_location = m2::PointD(pt.x * scaleFactor, pt.y * scaleFactor);
t0.m_id = reinterpret_cast<int64_t>(touch);
@ -186,7 +185,7 @@ BOOL gIsFirstMyPositionMode = YES;
{
UITouch * touch = [allTouches objectAtIndex:1];
CGPoint const pt = [touch locationInView:v];
df::Touch t1;
t1.m_location = m2::PointD(pt.x * scaleFactor, pt.y * scaleFactor);
t1.m_id = reinterpret_cast<int64_t>(touch);
@ -542,11 +541,7 @@ BOOL gIsFirstMyPositionMode = YES;
- (void)refreshAd
{
bool adServerForbidden = false;
(void)settings::Get(kAdServerForbiddenKey, adServerForbidden);
bool adForbidden = false;
(void)settings::Get(kAdForbiddenSettingsKey, adForbidden);
if (isIOS7 || adServerForbidden || adForbidden)
if (isIOS7 || [MWMSettings adServerForbidden] || [MWMSettings adForbidden])
{
self.appWallAd = nil;
return;

View file

@ -50,7 +50,6 @@ typedef NS_ENUM(NSUInteger, MWMRoutingPlaneMode) {
- (void)stopMapStyleChecker;
- (void)showAlertIfRequired;
+ (void)setAutoNightModeOff:(BOOL)off;
+ (BOOL)isAutoNightMode;
+ (void)resetToDefaultMapStyle;
+ (void)changeMapStyleIfNedeed;

View file

@ -14,10 +14,10 @@
#import "MWMLocationManager.h"
#import "MWMRouter.h"
#import "MWMRouterSavedState.h"
#import "MWMSettings.h"
#import "MWMStorage.h"
#import "MWMTextToSpeech.h"
#import "MapViewController.h"
#import "Preferences.h"
#import "Statistics.h"
#import "UIColor+MapsMeColor.h"
#import "UIFont+MapsMeFonts.h"
@ -67,8 +67,6 @@ extern string const kCountryCodeKey;
extern string const kUniqueIdKey;
extern string const kLanguageKey;
extern char const * kAdServerForbiddenKey;
/// Adds needed localized strings to C++ code
/// @TODO Refactor localization mechanism to make it simpler
void InitLocalizedStrings()
@ -233,11 +231,7 @@ using namespace osm_auth_ios;
return ((EAGLView *)self.mapViewController.view).drapeEngineCreated;
}
- (BOOL)hasApiURL
{
return m_geoURL || m_mwmURL || m_fileURL;
}
- (BOOL)hasApiURL { return m_geoURL || m_mwmURL || m_fileURL; }
- (void)handleURLs
{
if (!self.isDrapeEngineCreated)
@ -329,7 +323,7 @@ using namespace osm_auth_ios;
{
[HttpThread setDownloadIndicatorProtocol:self];
InitLocalizedStrings();
[Preferences setup];
GetFramework().SetupMeasurementSystem();
[MWMFrameworkListener addObserver:self];
[MapsAppDelegate customizeAppearance];
@ -344,7 +338,7 @@ using namespace osm_auth_ios;
- (void)determineMapStyle
{
auto & f = GetFramework();
if ([MapsAppDelegate isAutoNightMode])
if ([MWMSettings autoNightModeEnabled])
{
f.SetMapStyle(MapStyleClear);
[UIColor setNightMode:NO];
@ -357,21 +351,14 @@ using namespace osm_auth_ios;
+ (void)setAutoNightModeOff:(BOOL)off
{
NSUserDefaults * ud = [NSUserDefaults standardUserDefaults];
[ud setBool:off forKey:kUDAutoNightModeOff];
[ud synchronize];
[MWMSettings setAutoNightModeEnabled:!off];
if (!off)
[MapsAppDelegate.theApp stopMapStyleChecker];
}
+ (BOOL)isAutoNightMode
{
return ![[NSUserDefaults standardUserDefaults] boolForKey:kUDAutoNightModeOff];
}
- (void)startMapStyleChecker
{
if (![MapsAppDelegate isAutoNightMode])
if (![MWMSettings autoNightModeEnabled])
return;
self.mapStyleSwitchTimer =
[NSTimer scheduledTimerWithTimeInterval:(30 * 60)
@ -398,7 +385,7 @@ using namespace osm_auth_ios;
+ (void)changeMapStyleIfNedeed
{
if (![MapsAppDelegate isAutoNightMode])
if (![MWMSettings autoNightModeEnabled])
return;
auto & f = GetFramework();
CLLocation * lastLocation = [MWMLocationManager lastLocation];
@ -1083,8 +1070,8 @@ using namespace osm_auth_ios;
NSURLSessionDataTask * task = [session
dataTaskWithURL:url
completionHandler:^(NSData * data, NSURLResponse * response, NSError * error) {
bool adServerForbidden = (error || [(NSHTTPURLResponse *)response statusCode] != 200);
settings::Set(kAdServerForbiddenKey, adServerForbidden);
bool const adServerForbidden = (error || [(NSHTTPURLResponse *)response statusCode] != 200);
[MWMSettings setAdServerForbidden:adServerForbidden];
dispatch_async(dispatch_get_main_queue(), ^{
[self.mapViewController refreshAd];
});

View file

@ -8,6 +8,7 @@
#import "MWMNavigationDashboardManager.h"
#import "MWMRouterSavedState.h"
#import "MWMSearch.h"
#import "MWMSettings.h"
#import "MWMStorage.h"
#import "MWMTextToSpeech.h"
#import "MapViewController.h"
@ -226,7 +227,7 @@ bool isMarkerPoint(MWMRoutePoint const & point) { return point.IsValid() && !poi
MapsAppDelegate * app = [MapsAppDelegate theApp];
app.routingPlaneMode = MWMRoutingPlaneModeNone;
[MWMRouterSavedState remove];
if ([MapsAppDelegate isAutoNightMode])
if ([MWMSettings autoNightModeEnabled])
[MapsAppDelegate resetToDefaultMapStyle];
[app showAlertIfRequired];
}

View file

@ -1,13 +1,14 @@
#import "MWMMapDownloadDialog.h"
#import "Common.h"
#import "MapsAppDelegate.h"
#import "MapViewController.h"
#import "MWMAlertViewController.h"
#import "MWMCircularProgress.h"
#import "MWMFrameworkListener.h"
#import "MWMFrameworkObservers.h"
#import "MWMLocationManager.h"
#import "MWMMapDownloadDialog.h"
#import "MWMSettings.h"
#import "MWMStorage.h"
#import "MapViewController.h"
#import "MapsAppDelegate.h"
#import "Statistics.h"
#import "UIColor+MapsMeColor.h"
@ -15,17 +16,13 @@
#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)
if (![MWMSettings autoDownloadEnabled])
return NO;
if (GetPlatform().ConnectionStatus() != Platform::EConnectionType::CONNECTION_WIFI)
return NO;
@ -37,26 +34,25 @@ BOOL canAutoDownload(TCountryId const & countryId)
return NO;
return !platform::migrate::NeedMigrate();
}
} // namespace
} // namespace
using namespace storage;
@interface MWMMapDownloadDialog ()<MWMFrameworkStorageObserver,
MWMCircularProgressProtocol>
@property (weak, nonatomic) IBOutlet UILabel * parentNode;
@property (weak, nonatomic) IBOutlet UILabel * node;
@property (weak, nonatomic) IBOutlet UILabel * nodeSize;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint * nodeTopOffset;
@property (weak, nonatomic) IBOutlet UIButton * downloadButton;
@property (weak, nonatomic) IBOutlet UIView * progressWrapper;
@interface MWMMapDownloadDialog ()<MWMFrameworkStorageObserver, MWMCircularProgressProtocol>
@property(weak, nonatomic) IBOutlet UILabel * parentNode;
@property(weak, nonatomic) IBOutlet UILabel * node;
@property(weak, nonatomic) IBOutlet UILabel * nodeSize;
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * nodeTopOffset;
@property(weak, nonatomic) IBOutlet UIButton * downloadButton;
@property(weak, nonatomic) IBOutlet UIView * progressWrapper;
@property (weak, nonatomic) MapViewController * controller;
@property(weak, nonatomic) MapViewController * controller;
@property (nonatomic) MWMCircularProgress * progress;
@property(nonatomic) MWMCircularProgress * progress;
@property (nonatomic) NSMutableArray<NSDate *> * skipDownloadTimes;
@property(nonatomic) NSMutableArray<NSDate *> * skipDownloadTimes;
@property (nonatomic) BOOL isAutoDownloadCancelled;
@property(nonatomic) BOOL isAutoDownloadCancelled;
@end
@ -68,7 +64,8 @@ using namespace storage;
+ (instancetype)dialogForController:(MapViewController *)controller
{
MWMMapDownloadDialog * dialog = [[NSBundle mainBundle] loadNibNamed:[self className] owner:nil options:nil].firstObject;
MWMMapDownloadDialog * dialog =
[[NSBundle mainBundle] loadNibNamed:[self className] owner:nil options:nil].firstObject;
dialog.autoresizingMask = UIViewAutoresizingFlexibleHeight;
dialog.controller = controller;
dialog.size = kInitialDialogSize;
@ -79,15 +76,16 @@ using namespace storage;
{
UIView * superview = self.superview;
self.center = {superview.midX, superview.midY};
[UIView animateWithDuration:kDefaultAnimationDuration animations:^
{
CGSize const newSize = [self systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];
if (CGSizeEqualToSize(newSize, self.size))
return;
self.size = newSize;
self.center = {superview.midX, superview.midY};
[self layoutIfNeeded];
}];
[UIView animateWithDuration:kDefaultAnimationDuration
animations:^{
CGSize const newSize =
[self systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];
if (CGSizeEqualToSize(newSize, self.size))
return;
self.size = newSize;
self.center = {superview.midX, superview.midY};
[self layoutIfNeeded];
}];
[super layoutSubviews];
if (isIOS7)
{
@ -113,7 +111,8 @@ using namespace storage;
BOOL const noParrent = (nodeAttrs.m_parentInfo[0].m_id == s.GetRootId());
BOOL const hideParent = (noParrent || isMultiParent);
self.parentNode.hidden = hideParent;
self.nodeTopOffset.priority = hideParent ? UILayoutPriorityDefaultHigh : UILayoutPriorityDefaultLow;
self.nodeTopOffset.priority =
hideParent ? UILayoutPriorityDefaultHigh : UILayoutPriorityDefaultLow;
if (!hideParent)
self.parentNode.text = @(nodeAttrs.m_topmostParentInfo[0].m_localName.c_str());
self.node.text = @(nodeAttrs.m_nodeLocalName.c_str());
@ -123,47 +122,47 @@ using namespace storage;
switch (nodeAttrs.m_status)
{
case NodeStatus::NotDownloaded:
case NodeStatus::Partly:
case NodeStatus::NotDownloaded:
case NodeStatus::Partly:
{
BOOL const isMapVisible =
[self.controller.navigationController.topViewController isEqual:self.controller];
if (isMapVisible && !self.isAutoDownloadCancelled && canAutoDownload(m_countryId))
{
BOOL const isMapVisible = [self.controller.navigationController.topViewController isEqual:self.controller];
if (isMapVisible && !self.isAutoDownloadCancelled && canAutoDownload(m_countryId))
{
[Statistics logEvent:kStatDownloaderMapAction
withParameters:@{
kStatAction : kStatDownload,
kStatIsAuto : kStatYes,
kStatFrom : kStatMap,
kStatScenario : kStatDownload
}];
m_autoDownloadCountryId = m_countryId;
[MWMStorage downloadNode:m_countryId
alertController:self.controller.alertController
onSuccess:^{ [self showInQueue]; }];
}
else
{
m_autoDownloadCountryId = kInvalidCountryId;
[self showDownloadRequest];
}
break;
[Statistics logEvent:kStatDownloaderMapAction
withParameters:@{
kStatAction : kStatDownload,
kStatIsAuto : kStatYes,
kStatFrom : kStatMap,
kStatScenario : kStatDownload
}];
m_autoDownloadCountryId = m_countryId;
[MWMStorage downloadNode:m_countryId
alertController:self.controller.alertController
onSuccess:^{
[self showInQueue];
}];
}
case NodeStatus::Downloading:
if (nodeAttrs.m_downloadingProgress.second != 0)
[self showDownloading:static_cast<CGFloat>(nodeAttrs.m_downloadingProgress.first) / nodeAttrs.m_downloadingProgress.second];
break;
case NodeStatus::InQueue:
[self showInQueue];
break;
case NodeStatus::Undefined:
case NodeStatus::Error:
if (p.IsAutoRetryDownloadFailed())
[self showError:nodeAttrs.m_error];
break;
case NodeStatus::OnDisk:
case NodeStatus::OnDiskOutOfDate:
[self removeFromSuperview];
break;
else
{
m_autoDownloadCountryId = kInvalidCountryId;
[self showDownloadRequest];
}
break;
}
case NodeStatus::Downloading:
if (nodeAttrs.m_downloadingProgress.second != 0)
[self showDownloading:static_cast<CGFloat>(nodeAttrs.m_downloadingProgress.first) /
nodeAttrs.m_downloadingProgress.second];
break;
case NodeStatus::InQueue: [self showInQueue]; break;
case NodeStatus::Undefined:
case NodeStatus::Error:
if (p.IsAutoRetryDownloadFailed())
[self showError:nodeAttrs.m_error];
break;
case NodeStatus::OnDisk:
case NodeStatus::OnDiskOutOfDate: [self removeFromSuperview]; break;
}
}
else
@ -201,8 +200,7 @@ using namespace storage;
self.progress.state = MWMCircularProgressStateFailed;
MWMAlertViewController * avc = self.controller.alertController;
[self addToSuperview];
auto const retryBlock = ^
{
auto const retryBlock = ^{
[Statistics logEvent:kStatDownloaderMapAction
withParameters:@{
kStatAction : kStatRetry,
@ -213,24 +211,20 @@ using namespace storage;
[self showInQueue];
[MWMStorage retryDownloadNode:self->m_countryId];
};
auto const cancelBlock = ^
{
auto const cancelBlock = ^{
[Statistics logEvent:kStatDownloaderDownloadCancel withParameters:@{kStatFrom : kStatMap}];
[MWMStorage cancelDownloadNode:self->m_countryId];
};
switch (errorCode)
{
case NodeErrorCode::NoError:
break;
case NodeErrorCode::UnknownError:
[avc presentDownloaderInternalErrorAlertWithOkBlock:retryBlock cancelBlock:cancelBlock];
break;
case NodeErrorCode::OutOfMemFailed:
[avc presentDownloaderNotEnoughSpaceAlert];
break;
case NodeErrorCode::NoInetConnection:
[avc presentDownloaderNoConnectionAlertWithOkBlock:retryBlock cancelBlock:cancelBlock];
break;
case NodeErrorCode::NoError: break;
case NodeErrorCode::UnknownError:
[avc presentDownloaderInternalErrorAlertWithOkBlock:retryBlock cancelBlock:cancelBlock];
break;
case NodeErrorCode::OutOfMemFailed: [avc presentDownloaderNotEnoughSpaceAlert]; break;
case NodeErrorCode::NoInetConnection:
[avc presentDownloaderNoConnectionAlertWithOkBlock:retryBlock cancelBlock:cancelBlock];
break;
}
}
@ -244,7 +238,8 @@ using namespace storage;
- (void)showDownloading:(CGFloat)progress
{
self.nodeSize.textColor = [UIColor blackSecondaryText];
self.nodeSize.text = [NSString stringWithFormat:@"%@ %@%%", L(@"downloader_downloading"), @(static_cast<NSUInteger>(progress * 100))];
self.nodeSize.text = [NSString stringWithFormat:@"%@ %@%%", L(@"downloader_downloading"),
@(static_cast<NSUInteger>(progress * 100))];
self.downloadButton.hidden = YES;
self.progressWrapper.hidden = NO;
self.progress.progress = progress;
@ -282,7 +277,8 @@ using namespace storage;
[self removeFromSuperview];
}
- (void)processCountry:(TCountryId const &)countryId progress:(MapFilesDownloader::TProgress const &)progress
- (void)processCountry:(TCountryId const &)countryId
progress:(MapFilesDownloader::TProgress const &)progress
{
if (self.superview && m_countryId == countryId)
[self showDownloading:static_cast<CGFloat>(progress.first) / progress.second];
@ -326,14 +322,16 @@ using namespace storage;
{
[Statistics logEvent:kStatDownloaderMapAction
withParameters:@{
kStatAction : kStatDownload,
kStatIsAuto : kStatNo,
kStatFrom : kStatMap,
kStatScenario : kStatDownload
}];
kStatAction : kStatDownload,
kStatIsAuto : kStatNo,
kStatFrom : kStatMap,
kStatScenario : kStatDownload
}];
[MWMStorage downloadNode:m_countryId
alertController:self.controller.alertController
onSuccess:^{ [self showInQueue]; }];
onSuccess:^{
[self showInQueue];
}];
}
}

View file

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "imgLogo.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "imgLogo@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "imgLogo@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View file

@ -0,0 +1,5 @@
#import "MWMTableViewController.h"
@interface MWMAboutController : MWMTableViewController
@end

View file

@ -0,0 +1,127 @@
#import "MWMAboutController.h"
#import <MessageUI/MFMailComposeViewController.h>
#import "AppInfo.h"
#import "LinkCell.h"
#import "Statistics.h"
#import "WebViewController.h"
#import "3party/Alohalytics/src/alohalytics_objc.h"
#include "platform/platform.hpp"
extern NSString * const kAlohalyticsTapEventKey;
@interface MWMAboutController ()<MFMailComposeViewControllerDelegate>
@property(weak, nonatomic) IBOutlet UILabel * versionLabel;
@property(weak, nonatomic) IBOutlet UILabel * dateLabel;
@property(weak, nonatomic) IBOutlet LinkCell * websiteCell;
@property(weak, nonatomic) IBOutlet LinkCell * blogCell;
@property(weak, nonatomic) IBOutlet LinkCell * facebookCell;
@property(weak, nonatomic) IBOutlet LinkCell * twitterCell;
@property(weak, nonatomic) IBOutlet LinkCell * subscribeCell;
@property(weak, nonatomic) IBOutlet LinkCell * rateCell;
@property(weak, nonatomic) IBOutlet LinkCell * copyrightCell;
@end
@implementation MWMAboutController
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = L(@"about_menu_title");
AppInfo * appInfo = [AppInfo sharedInfo];
self.versionLabel.text = [NSString stringWithFormat:L(@"version"), appInfo.bundleVersion];
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.dateStyle = NSDateFormatterShortStyle;
dateFormatter.timeStyle = NSDateFormatterNoStyle;
self.dateLabel.text = [NSString
stringWithFormat:@"%@ %@", L(@"date"), [dateFormatter stringFromDate:appInfo.buildDate]];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
LinkCell * cell = static_cast<LinkCell *>([tableView cellForRowAtIndexPath:indexPath]);
if (cell == self.websiteCell)
{
[Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"website"];
[self openUrl:[NSURL URLWithString:@"https://maps.me"]];
}
else if (cell == self.blogCell)
{
[Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"blog"];
[self openUrl:[NSURL URLWithString:@"http://blog.maps.me"]];
}
else if (cell == self.facebookCell)
{
[Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"likeOnFb"];
[self openUrl:[NSURL URLWithString:@"https://facebook.com/MapsWithMe"]];
}
else if (cell == self.twitterCell)
{
[Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"followOnTwitter"];
[self openUrl:[NSURL URLWithString:@"https://twitter.com/MAPS_ME"]];
}
else if (cell == self.subscribeCell)
{
[Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"subscribeToNews"];
[self sendEmailWithText:L(@"subscribe_me_body")
subject:L(@"subscribe_me_subject")
toRecipient:@"subscribe@maps.me"];
}
else if (cell == self.rateCell)
{
[Statistics logEvent:kStatSettingsOpenSection withParameters:@{kStatName : kStatRate}];
[Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"rate"];
[[UIApplication sharedApplication] rateVersionFrom:@"rate_menu_item"];
}
else if (cell == self.copyrightCell)
{
[Statistics logEvent:kStatSettingsOpenSection withParameters:@{kStatName : kStatCopyright}];
[Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"copyright"];
string s;
GetPlatform().GetReader("copyright.html")->ReadAsString(s);
NSString * text = [NSString stringWithFormat:@"%@\n%@", self.versionLabel.text, @(s.c_str())];
WebViewController * aboutViewController =
[[WebViewController alloc] initWithHtml:text baseUrl:nil andTitleOrNil:L(@"copyright")];
aboutViewController.openInSafari = YES;
[self.navigationController pushViewController:aboutViewController animated:YES];
}
}
- (void)sendEmailWithText:(NSString *)text subject:(NSString *)subject toRecipient:(NSString *)email
{
if ([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController * vc = [[MFMailComposeViewController alloc] init];
vc.mailComposeDelegate = self;
[vc setSubject:subject];
[vc setMessageBody:text isHTML:NO];
[vc setToRecipients:@[ email ]];
[self presentViewController:vc animated:YES completion:nil];
}
else
{
NSString * text = [NSString stringWithFormat:L(@"email_error_body"), email];
[[[UIAlertView alloc] initWithTitle:L(@"email_error_title")
message:text
delegate:nil
cancelButtonTitle:L(@"ok")
otherButtonTitles:nil] show];
}
}
- (void)mailComposeController:(MFMailComposeViewController *)controller
didFinishWithResult:(MFMailComposeResult)result
error:(NSError *)error
{
[self dismissViewControllerAnimated:YES completion:nil];
}
@end

View file

@ -0,0 +1,5 @@
#import "MWMViewController.h"
@interface MWMHelpController : MWMViewController
@end

View file

@ -0,0 +1,284 @@
#import "MWMHelpController.h"
#import <MessageUI/MFMailComposeViewController.h>
#import <sys/utsname.h>
#import "Common.h"
#import "Statistics.h"
#import "UIColor+MapsMeColor.h"
#import "WebViewController.h"
#import "3party/Alohalytics/src/alohalytics_objc.h"
#include "platform/platform.hpp"
extern NSString * const kAlohalyticsTapEventKey;
extern NSString * const kLocaleUsedInSupportEmails = @"en_gb";
extern NSDictionary * const kDeviceNames = @{
@"i386" : @"Simulator",
@"iPad1,1" : @"iPad WiFi",
@"iPad1,2" : @"iPad GSM",
@"iPad2,1" : @"iPad 2 WiFi",
@"iPad2,2" : @"iPad 2 CDMA",
@"iPad2,2" : @"iPad 2 GSM",
@"iPad2,3" : @"iPad 2 GSM EV-DO",
@"iPad2,4" : @"iPad 2",
@"iPad2,5" : @"iPad Mini WiFi",
@"iPad2,6" : @"iPad Mini GSM",
@"iPad2,7" : @"iPad Mini CDMA",
@"iPad3,1" : @"iPad 3rd gen. WiFi",
@"iPad3,2" : @"iPad 3rd gen. GSM",
@"iPad3,3" : @"iPad 3rd gen. CDMA",
@"iPad3,4" : @"iPad 4th gen. WiFi",
@"iPad3,5" : @"iPad 4th gen. GSM",
@"iPad3,6" : @"iPad 4th gen. CDMA",
@"iPad4,1" : @"iPad Air WiFi",
@"iPad4,2" : @"iPad Air GSM",
@"iPad4,3" : @"iPad Air CDMA",
@"iPad4,4" : @"iPad Mini 2nd gen. WiFi",
@"iPad4,5" : @"iPad Mini 2nd gen. GSM",
@"iPad4,6" : @"iPad Mini 2nd gen. CDMA",
@"iPad5,3" : @"iPad Air 2 WiFi",
@"iPad5,4" : @"iPad Air 2 GSM",
@"iPad6,3" : @"iPad Pro (9.7 inch) WiFi",
@"iPad6,4" : @"iPad Pro (9.7 inch) GSM",
@"iPad6,7" : @"iPad Pro (12.9 inch) WiFi",
@"iPad6,8" : @"iPad Pro (12.9 inch) GSM",
@"iPhone1,1" : @"iPhone",
@"iPhone1,2" : @"iPhone 3G",
@"iPhone2,1" : @"iPhone 3GS",
@"iPhone3,1" : @"iPhone 4 GSM",
@"iPhone3,2" : @"iPhone 4 CDMA",
@"iPhone3,3" : @"iPhone 4 GSM EV-DO",
@"iPhone4,1" : @"iPhone 4S",
@"iPhone4,2" : @"iPhone 4S",
@"iPhone4,3" : @"iPhone 4S",
@"iPhone5,1" : @"iPhone 5",
@"iPhone5,2" : @"iPhone 5",
@"iPhone5,3" : @"iPhone 5c",
@"iPhone5,4" : @"iPhone 5c",
@"iPhone6,1" : @"iPhone 5s",
@"iPhone6,2" : @"iPhone 5s",
@"iPhone7,1" : @"iPhone 6 Plus",
@"iPhone7,2" : @"iPhone 6",
@"iPhone8,1" : @"iPhone 6s",
@"iPhone8,2" : @"iPhone 6s Plus",
@"iPhone8,4" : @"iPhone SE",
@"iPod1,1" : @"iPod Touch",
@"iPod2,1" : @"iPod Touch 2nd gen.",
@"iPod3,1" : @"iPod Touch 3rd gen.",
@"iPod4,1" : @"iPod Touch 4th gen.",
@"iPod5,1" : @"iPod Touch 5th gen.",
@"x86_64" : @"Simulator",
};
namespace
{
NSString * const kCommonReportActionTitle = L(@"leave_a_review");
NSString * const kBugReportActionTitle = L(@"something_is_not_working");
NSString * const kCancelActionTitle = L(@"cancel");
NSString * const kiOSEmail = @"ios@maps.me";
}
@interface MWMHelpController ()<UIActionSheetDelegate, MFMailComposeViewControllerDelegate>
@property(nonatomic) WebViewController * aboutViewController;
@property(weak, nonatomic) IBOutlet UIView * separatorView;
@end // namespace
@implementation MWMHelpController
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = L(@"help");
NSString * html;
if (GetPlatform().ConnectionStatus() == Platform::EConnectionType::CONNECTION_NONE)
{
NSString * path = [[NSBundle mainBundle] pathForResource:@"faq" ofType:@"html"];
html = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
self.aboutViewController =
[[WebViewController alloc] initWithHtml:html baseUrl:nil andTitleOrNil:nil];
}
else
{
NSURL * url = [NSURL URLWithString:@"https://support.maps.me"];
self.aboutViewController = [[WebViewController alloc] initWithUrl:url andTitleOrNil:nil];
}
self.aboutViewController.openInSafari = NO;
UIView * aboutView = self.aboutViewController.view;
[self addChildViewController:self.aboutViewController];
[self.view addSubview:aboutView];
aboutView.translatesAutoresizingMaskIntoConstraints = NO;
NSLayoutConstraint * top = [NSLayoutConstraint constraintWithItem:self.view
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
toItem:aboutView
attribute:NSLayoutAttributeTop
multiplier:1.0
constant:0.0];
NSLayoutConstraint * bottom = [NSLayoutConstraint constraintWithItem:self.separatorView
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
toItem:aboutView
attribute:NSLayoutAttributeBottom
multiplier:1.0
constant:0.0];
NSLayoutConstraint * left = [NSLayoutConstraint constraintWithItem:self.view
attribute:NSLayoutAttributeLeft
relatedBy:NSLayoutRelationEqual
toItem:aboutView
attribute:NSLayoutAttributeLeft
multiplier:1.0
constant:0.0];
NSLayoutConstraint * right = [NSLayoutConstraint constraintWithItem:self.view
attribute:NSLayoutAttributeRight
relatedBy:NSLayoutRelationEqual
toItem:aboutView
attribute:NSLayoutAttributeRight
multiplier:1.0
constant:0.0];
[self.view addConstraints:@[ top, bottom, left, right ]];
}
- (IBAction)reportBug
{
if (isIOS7)
[self reportIOS7];
else
[self reportRegular];
}
- (void)reportIOS7
{
UIActionSheet * actionSheet =
[[UIActionSheet alloc] initWithTitle:nil
delegate:self
cancelButtonTitle:kCancelActionTitle
destructiveButtonTitle:nil
otherButtonTitles:kCommonReportActionTitle, kBugReportActionTitle, nil];
[actionSheet showInView:self.view];
}
- (void)reportRegular
{
UIAlertController * alert =
[UIAlertController alertControllerWithTitle:L(@"report_a_bug")
message:nil
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction * commonReport = [UIAlertAction actionWithTitle:kCommonReportActionTitle
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * _Nonnull action) {
[self commonReportAction];
}];
[alert addAction:commonReport];
UIAlertAction * bugReport = [UIAlertAction actionWithTitle:kBugReportActionTitle
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * _Nonnull action) {
[self bugReportAction];
}];
[alert addAction:bugReport];
UIAlertAction * cancel =
[UIAlertAction actionWithTitle:kCancelActionTitle style:UIAlertActionStyleCancel handler:nil];
[alert addAction:cancel];
alert.preferredAction = cancel;
[self presentViewController:alert animated:YES completion:nil];
}
#pragma mark - Actions
- (void)commonReportAction
{
[Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"contactUs"];
[self sendEmailWithText:nil subject:@"MAPS.ME" toRecipient:kiOSEmail];
}
- (void)bugReportAction
{
[Statistics logEvent:kStatSettingsOpenSection withParameters:@{kStatName : kStatReport}];
[Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"reportABug"];
struct utsname systemInfo;
uname(&systemInfo);
NSString * machine =
[NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
NSString * device = kDeviceNames[machine];
if (!device)
device = machine;
NSString * languageCode = [[NSLocale preferredLanguages] firstObject];
NSString * language = [[NSLocale localeWithLocaleIdentifier:kLocaleUsedInSupportEmails]
displayNameForKey:NSLocaleLanguageCode
value:languageCode];
NSString * locale = [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode];
NSString * country = [[NSLocale localeWithLocaleIdentifier:kLocaleUsedInSupportEmails]
displayNameForKey:NSLocaleCountryCode
value:locale];
NSString * bundleVersion =
[[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey];
NSString * text = [NSString stringWithFormat:@"\n\n\n\n- %@ (%@)\n- MAPS.ME %@\n- %@/%@", device,
[UIDevice currentDevice].systemVersion,
bundleVersion, language, country];
NSString * alohalyticsId = [Alohalytics installationId];
if (alohalyticsId)
text = [NSString stringWithFormat:@"%@\n- %@", text, alohalyticsId];
[self sendEmailWithText:text subject:@"MAPS.ME" toRecipient:kiOSEmail];
}
#pragma mark - Email
- (void)sendEmailWithText:(NSString *)text subject:(NSString *)subject toRecipient:(NSString *)email
{
if ([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController * vc = [[MFMailComposeViewController alloc] init];
vc.mailComposeDelegate = self;
[vc setSubject:subject];
[vc setMessageBody:text isHTML:NO];
[vc setToRecipients:@[ email ]];
[vc.navigationBar setTintColor:[UIColor whitePrimaryText]];
[self presentViewController:vc animated:YES completion:nil];
}
else
{
NSString * text = [NSString stringWithFormat:L(@"email_error_body"), email];
[[[UIAlertView alloc] initWithTitle:L(@"email_error_title")
message:text
delegate:nil
cancelButtonTitle:L(@"ok")
otherButtonTitles:nil] show];
}
}
- (void)mailComposeController:(MFMailComposeViewController *)controller
didFinishWithResult:(MFMailComposeResult)result
error:(NSError *)error
{
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark - UIActionSheetDelegate
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (actionSheet.numberOfButtons == 0 || buttonIndex >= actionSheet.numberOfButtons ||
buttonIndex < 0)
{
[actionSheet dismissWithClickedButtonIndex:0 animated:NO];
return;
}
NSString * btnTitle = [actionSheet buttonTitleAtIndex:buttonIndex];
if ([btnTitle isEqualToString:kCommonReportActionTitle])
[self commonReportAction];
else if ([btnTitle isEqualToString:kBugReportActionTitle])
[self bugReportAction];
}
@end

View file

@ -1,5 +1,6 @@
#import "MapsAppDelegate.h"
#import "MWMNightModeController.h"
#import "MWMSettings.h"
#import "MapsAppDelegate.h"
#import "SelectableCell.h"
#import "Statistics.h"
#import "UIColor+MapsMeColor.h"
@ -8,10 +9,10 @@
@interface MWMNightModeController ()
@property (weak, nonatomic) IBOutlet SelectableCell * autoSwitch;
@property (weak, nonatomic) IBOutlet SelectableCell * on;
@property (weak, nonatomic) IBOutlet SelectableCell * off;
@property (weak, nonatomic) SelectableCell * selectedCell;
@property(weak, nonatomic) IBOutlet SelectableCell * autoSwitch;
@property(weak, nonatomic) IBOutlet SelectableCell * on;
@property(weak, nonatomic) IBOutlet SelectableCell * off;
@property(weak, nonatomic) SelectableCell * selectedCell;
@end
@ -21,7 +22,7 @@
{
[super viewDidLoad];
self.title = L(@"pref_map_style_title");
if ([MapsAppDelegate isAutoNightMode])
if ([MWMSettings autoNightModeEnabled])
{
self.autoSwitch.accessoryType = UITableViewCellAccessoryCheckmark;
_selectedCell = self.autoSwitch;
@ -40,8 +41,7 @@
_selectedCell = self.off;
break;
case MapStyleMerged:
case MapStyleCount:
break;
case MapStyleCount: break;
}
}
@ -86,8 +86,7 @@
statValue = kStatValue;
}
[Statistics logEvent:kStatNightMode
withParameters:@{kStatValue : statValue}];
[Statistics logEvent:kStatNightMode withParameters:@{kStatValue : statValue}];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

27
iphone/Maps/MWMSettings.h Normal file
View file

@ -0,0 +1,27 @@
#include "platform/measurement_utils.hpp"
@interface MWMSettings : NSObject
+ (BOOL)adServerForbidden;
+ (void)setAdServerForbidden:(BOOL)adServerForbidden;
+ (BOOL)adForbidden;
+ (BOOL)autoDownloadEnabled;
+ (void)setAutoDownloadEnabled:(BOOL)autoDownloadEnabled;
+ (measurement_utils::Units)measurementUnits;
+ (void)setMeasurementUnits:(measurement_utils::Units)measurementUnits;
+ (BOOL)zoomButtonsEnabled;
+ (void)setZoomButtonsEnabled:(BOOL)zoomButtonsEnabled;
+ (BOOL)compassCalibrationEnabled;
+ (void)setCompassCalibrationEnabled:(BOOL)compassCalibrationEnabled;
+ (BOOL)statisticsEnabled;
+ (BOOL)autoNightModeEnabled;
+ (void)setAutoNightModeEnabled:(BOOL)autoNightModeEnabled;
@end

111
iphone/Maps/MWMSettings.mm Normal file
View file

@ -0,0 +1,111 @@
#import "MWMSettings.h"
#import "MWMMapViewControlsManager.h"
#include "Framework.h"
#include "platform/settings.hpp"
extern char const * kStatisticsEnabledSettingsKey;
namespace
{
char const * kAdForbiddenSettingsKey = "AdForbidden";
char const * kAdServerForbiddenKey = "AdServerForbidden";
char const * kAutoDownloadEnabledKey = "AutoDownloadEnabled";
char const * kZoomButtonsEnabledKey = "ZoomButtonsEnabled";
char const * kCompassCalibrationEnabledKey = "CompassCalibrationEnabled";
NSString * const kUDAutoNightModeOff = @"AutoNightModeOff";
} // namespace
@implementation MWMSettings
+ (BOOL)adServerForbidden
{
bool adServerForbidden = false;
UNUSED_VALUE(settings::Get(kAdServerForbiddenKey, adServerForbidden));
return adServerForbidden;
}
+ (void)setAdServerForbidden:(BOOL)adServerForbidden
{
settings::Set(kAdServerForbiddenKey, static_cast<bool>(adServerForbidden));
}
+ (BOOL)adForbidden
{
bool adForbidden = false;
UNUSED_VALUE(settings::Get(kAdForbiddenSettingsKey, adForbidden));
return adForbidden;
}
+ (BOOL)autoDownloadEnabled
{
bool autoDownloadEnabled = true;
UNUSED_VALUE(settings::Get(kAutoDownloadEnabledKey, autoDownloadEnabled));
return autoDownloadEnabled;
}
+ (void)setAutoDownloadEnabled:(BOOL)autoDownloadEnabled
{
settings::Set(kAutoDownloadEnabledKey, static_cast<bool>(autoDownloadEnabled));
}
+ (measurement_utils::Units)measurementUnits
{
auto units = measurement_utils::Units::Metric;
UNUSED_VALUE(settings::Get(settings::kMeasurementUnits, units));
return units;
}
+ (void)setMeasurementUnits:(measurement_utils::Units)measurementUnits
{
settings::Set(settings::kMeasurementUnits, measurementUnits);
GetFramework().SetupMeasurementSystem();
}
+ (BOOL)zoomButtonsEnabled
{
bool enabled = true;
UNUSED_VALUE(settings::Get(kZoomButtonsEnabledKey, enabled));
return enabled;
}
+ (void)setZoomButtonsEnabled:(BOOL)zoomButtonsEnabled
{
settings::Set(kZoomButtonsEnabledKey, static_cast<bool>(zoomButtonsEnabled));
[MWMMapViewControlsManager manager].zoomHidden = !zoomButtonsEnabled;
}
+ (BOOL)compassCalibrationEnabled
{
bool enabled = true;
UNUSED_VALUE(settings::Get(kCompassCalibrationEnabledKey, enabled));
return enabled;
}
+ (void)setCompassCalibrationEnabled:(BOOL)compassCalibrationEnabled
{
settings::Set(kCompassCalibrationEnabledKey, static_cast<bool>(compassCalibrationEnabled));
}
+ (BOOL)statisticsEnabled
{
bool enabled = true;
UNUSED_VALUE(settings::Get(kStatisticsEnabledSettingsKey, enabled));
return enabled;
}
+ (BOOL)autoNightModeEnabled
{
return ![[NSUserDefaults standardUserDefaults] boolForKey:kUDAutoNightModeOff];
}
+ (void)setAutoNightModeEnabled:(BOOL)autoNightModeEnabled
{
NSUserDefaults * ud = [NSUserDefaults standardUserDefaults];
[ud setBool:!autoNightModeEnabled forKey:kUDAutoNightModeOff];
[ud synchronize];
}
@end

View file

@ -1,6 +1,7 @@
#import "MWMTableViewController.h"
#include "std/utility.hpp"
#include "std/string.hpp"
@interface MWMTTSSettingsViewController : MWMTableViewController

View file

@ -1,11 +1,11 @@
#import "MWMTTSSettingsViewController.h"
#import <AVFoundation/AVFoundation.h>
#import "LinkCell.h"
#import "MWMTextToSpeech.h"
#import "MWMTTSSettingsViewController.h"
#import "SelectableCell.h"
#import "Statistics.h"
#import "UIColor+MapsMeColor.h"
#import "WebViewController.h"
#import <AVFoundation/AVFoundation.h>
#include "LocaleTranslator.h"
@ -19,7 +19,7 @@ using namespace locale_translator;
vector<pair<string, string>> _languages;
}
@property (nonatomic) BOOL isLocaleLanguageAbsent;
@property(nonatomic) BOOL isLocaleLanguageAbsent;
@end
@ -73,21 +73,15 @@ using namespace locale_translator;
}
switch (size)
{
case 1:
_languages.push_back(_additionalTTSLanguage);
break;
case 2:
if (self.isLocaleLanguageAbsent)
_languages[size - 1] = _additionalTTSLanguage;
else
_languages.push_back(_additionalTTSLanguage);
break;
case 3:
case 1: _languages.push_back(_additionalTTSLanguage); break;
case 2:
if (self.isLocaleLanguageAbsent)
_languages[size - 1] = _additionalTTSLanguage;
break;
default:
NSAssert(false, @"Incorrect language's count");
break;
else
_languages.push_back(_additionalTTSLanguage);
break;
case 3: _languages[size - 1] = _additionalTTSLanguage; break;
default: NSAssert(false, @"Incorrect language's count"); break;
}
[self.tableView reloadData];
}
@ -100,34 +94,58 @@ using namespace locale_translator;
#pragma mark - UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 2;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 2; }
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (section == 0)
return _languages.size() + 1;
return _languages.size() + 2;
else
return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 0 && indexPath.row != _languages.size())
if (indexPath.section == 0)
{
SelectableCell * cell = (SelectableCell *)[tableView dequeueReusableCellWithIdentifier:[SelectableCell className]];
pair<string, string> const p = _languages[indexPath.row];
cell.titleLabel.text = @(p.second.c_str());
BOOL const isSelected = [@(p.first.c_str()) isEqualToString:[MWMTextToSpeech savedLanguage]];
cell.accessoryType = isSelected ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone;
return cell;
if (indexPath.row == 0)
{
SelectableCell * cell = (SelectableCell *)[tableView
dequeueReusableCellWithIdentifier:[SelectableCell className]];
cell.titleLabel.text = L(@"duration_disabled");
cell.accessoryType = [MWMTextToSpeech isTTSEnabled] ? UITableViewCellAccessoryNone : UITableViewCellAccessoryCheckmark;
return cell;
}
else
{
NSInteger const row = indexPath.row - 1;
if (row == _languages.size())
{
LinkCell * cell =
(LinkCell *)[tableView dequeueReusableCellWithIdentifier:[LinkCell className]];
cell.titleLabel.text = L(@"pref_tts_other_section_title");
return cell;
}
else
{
SelectableCell * cell = (SelectableCell *)[tableView
dequeueReusableCellWithIdentifier:[SelectableCell className]];
pair<string, string> const p = _languages[row];
cell.titleLabel.text = @(p.second.c_str());
BOOL const isSelected =
[@(p.first.c_str()) isEqualToString:[MWMTextToSpeech savedLanguage]];
cell.accessoryType = [MWMTextToSpeech isTTSEnabled] && isSelected
? UITableViewCellAccessoryCheckmark
: UITableViewCellAccessoryNone;
return cell;
}
}
}
else
{
LinkCell * cell = (LinkCell *)[tableView dequeueReusableCellWithIdentifier:[LinkCell className]];
cell.titleLabel.text = indexPath.section == 0 ? L(@"pref_tts_other_section_title") : L(@"pref_tts_how_to_set_up_voice");
LinkCell * cell =
(LinkCell *)[tableView dequeueReusableCellWithIdentifier:[LinkCell className]];
cell.titleLabel.text = L(@"pref_tts_how_to_set_up_voice");
return cell;
}
}
@ -136,25 +154,46 @@ using namespace locale_translator;
{
if (indexPath.section == 0)
{
if (indexPath.row == _languages.size())
if (indexPath.row == 0)
{
[Statistics logEvent:kStatEventName(kStatTTSSettings, kStatChangeLanguage)
withParameters:@{kStatValue : kStatOther}];
[self performSegueWithIdentifier:kSelectTTSLanguageSegueName sender:nil];
[Statistics logEvent:kStatEventName(kStatSettings, kStatTTS)
withParameters:@{kStatValue : kStatOff}];
[MWMTextToSpeech setTTSEnabled:NO];
[tableView reloadSections:[NSIndexSet indexSetWithIndex:0]
withRowAnimation:UITableViewRowAnimationFade];
}
else
{
[[MWMTextToSpeech tts] setNotificationsLocale:@(_languages[indexPath.row].first.c_str())];
[tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationFade];
[Statistics logEvent:kStatEventName(kStatSettings, kStatTTS)
withParameters:@{kStatValue : kStatOn}];
[MWMTextToSpeech setTTSEnabled:YES];
NSInteger const row = indexPath.row - 1;
if (row == _languages.size())
{
[Statistics logEvent:kStatEventName(kStatTTSSettings, kStatChangeLanguage)
withParameters:@{kStatValue : kStatOther}];
[self performSegueWithIdentifier:kSelectTTSLanguageSegueName sender:nil];
}
else
{
[[MWMTextToSpeech tts] setNotificationsLocale:@(_languages[row].first.c_str())];
[tableView reloadSections:[NSIndexSet indexSetWithIndex:0]
withRowAnimation:UITableViewRowAnimationFade];
}
}
}
else if (indexPath.section == 1)
{
[Statistics logEvent:kStatEventName(kStatTTSSettings, kStatHelp)];
NSString * path = [[NSBundle mainBundle] pathForResource:@"tts-how-to-set-up-voice" ofType:@"html"];
NSString * html = [[NSString alloc] initWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
NSString * path =
[[NSBundle mainBundle] pathForResource:@"tts-how-to-set-up-voice" ofType:@"html"];
NSString * html =
[[NSString alloc] initWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
NSURL * baseURL = [NSURL fileURLWithPath:path];
WebViewController * vc = [[WebViewController alloc] initWithHtml:html baseUrl:baseURL andTitleOrNil:L(@"pref_tts_how_to_set_up_voice")];
WebViewController * vc =
[[WebViewController alloc] initWithHtml:html
baseUrl:baseURL
andTitleOrNil:L(@"pref_tts_how_to_set_up_voice")];
[self.navigationController pushViewController:vc animated:YES];
}
}

View file

@ -0,0 +1,5 @@
#import "MWMTableViewController.h"
@interface MWMUnitsController : MWMTableViewController
@end

View file

@ -0,0 +1,56 @@
#import "MWMUnitsController.h"
#import "MWMSettings.h"
#import "SelectableCell.h"
#import "Statistics.h"
@interface MWMUnitsController ()
@property(weak, nonatomic) IBOutlet SelectableCell * kilometers;
@property(weak, nonatomic) IBOutlet SelectableCell * miles;
@property(weak, nonatomic) SelectableCell * selectedCell;
@end
@implementation MWMUnitsController
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = L(@"measurement_units");
switch ([MWMSettings measurementUnits])
{
case measurement_utils::Units::Metric: self.selectedCell = self.kilometers; break;
case measurement_utils::Units::Imperial: self.selectedCell = self.miles; break;
}
}
- (void)setSelectedCell:(SelectableCell *)cell
{
if ([_selectedCell isEqual:cell])
return;
_selectedCell.accessoryType = UITableViewCellAccessoryNone;
_selectedCell = cell;
_selectedCell.accessoryType = UITableViewCellAccessoryCheckmark;
_selectedCell.selected = NO;
if (cell == self.kilometers)
{
[Statistics logEvent:kStatEventName(kStatSettings, kStatChangeMeasureUnits)
withParameters:@{kStatValue : kStatKilometers}];
[MWMSettings setMeasurementUnits:measurement_utils::Units::Metric];
}
else
{
[Statistics logEvent:kStatEventName(kStatSettings, kStatChangeMeasureUnits)
withParameters:@{kStatValue : kStatMiles}];
[MWMSettings setMeasurementUnits:measurement_utils::Units::Imperial];
}
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
self.selectedCell = [tableView cellForRowAtIndexPath:indexPath];
}
@end

View file

@ -117,6 +117,8 @@
345FD7EB1CEC7DA800F58045 /* MWMEditorAdditionalNamesHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = 345FD7E91CEC7DA800F58045 /* MWMEditorAdditionalNamesHeader.xib */; };
345FDD261C3BB3AF0070C459 /* MWMEditorViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 345FDD251C3BB3AF0070C459 /* MWMEditorViewController.mm */; };
345FDD271C3BB3AF0070C459 /* MWMEditorViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 345FDD251C3BB3AF0070C459 /* MWMEditorViewController.mm */; };
34618BFD1D6DAAE600EDEEF4 /* MWMSettings.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34618BFC1D6DAAE600EDEEF4 /* MWMSettings.mm */; };
34618BFE1D6DAAE600EDEEF4 /* MWMSettings.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34618BFC1D6DAAE600EDEEF4 /* MWMSettings.mm */; };
34634B1B1BB42D270013573C /* MWMBottomMenuCollectionViewLandscapeCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 34634B1A1BB42D270013573C /* MWMBottomMenuCollectionViewLandscapeCell.xib */; };
3465E7D81B6658C000854C4D /* MWMAPIBar.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3465E7D71B6658C000854C4D /* MWMAPIBar.mm */; };
34664CFA1D4A0262003D7096 /* MWMWhatsNewNavigationController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34664CF91D4A0262003D7096 /* MWMWhatsNewNavigationController.mm */; };
@ -170,6 +172,8 @@
347FDDA11BB59B4E00871410 /* Mapsme.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 347FDDA01BB59B4E00871410 /* Mapsme.storyboard */; };
3485C0121B85C20E00F7712D /* MWMSearchTableViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3485C0101B85C20E00F7712D /* MWMSearchTableViewController.mm */; };
3485C0131B85C20E00F7712D /* MWMSearchTableViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3485C0111B85C20E00F7712D /* MWMSearchTableViewController.xib */; };
348C26051D701B9F00813924 /* MWMHelpController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 348C26041D701B9F00813924 /* MWMHelpController.mm */; };
348C26061D701B9F00813924 /* MWMHelpController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 348C26041D701B9F00813924 /* MWMHelpController.mm */; };
3490D2DE1CE9DD2500D0B838 /* MWMSideButtons.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3490D2DA1CE9DD2500D0B838 /* MWMSideButtons.mm */; };
3490D2DF1CE9DD2500D0B838 /* MWMSideButtons.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3490D2DA1CE9DD2500D0B838 /* MWMSideButtons.mm */; };
3490D2E01CE9DD2500D0B838 /* MWMSideButtonsView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3490D2DC1CE9DD2500D0B838 /* MWMSideButtonsView.mm */; };
@ -222,6 +226,10 @@
34ABA62C1C2D57D500FE1BEC /* MWMInputPasswordValidator.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34ABA62B1C2D57D500FE1BEC /* MWMInputPasswordValidator.mm */; };
34ABA62D1C2D57D500FE1BEC /* MWMInputPasswordValidator.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34ABA62B1C2D57D500FE1BEC /* MWMInputPasswordValidator.mm */; };
34ABA6301C2D58F300FE1BEC /* MWMInputEmailValidator.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34ABA62F1C2D58F300FE1BEC /* MWMInputEmailValidator.mm */; };
34B104221D6EE45700C8B577 /* MWMUnitsController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34B104211D6EE45700C8B577 /* MWMUnitsController.mm */; };
34B104231D6EE45700C8B577 /* MWMUnitsController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34B104211D6EE45700C8B577 /* MWMUnitsController.mm */; };
34B104261D6F040E00C8B577 /* MWMAboutController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34B104251D6F040E00C8B577 /* MWMAboutController.mm */; };
34B104271D6F040E00C8B577 /* MWMAboutController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34B104251D6F040E00C8B577 /* MWMAboutController.mm */; };
34B646BD1CEB6FC000E0C7A5 /* MWMEditorAdditionalNameTableViewCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34B646BC1CEB6FC000E0C7A5 /* MWMEditorAdditionalNameTableViewCell.mm */; };
34B646BE1CEB6FC000E0C7A5 /* MWMEditorAdditionalNameTableViewCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34B646BC1CEB6FC000E0C7A5 /* MWMEditorAdditionalNameTableViewCell.mm */; };
34B646C01CEB6FE000E0C7A5 /* MWMEditorAdditionalNameTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 34B646BF1CEB6FE000E0C7A5 /* MWMEditorAdditionalNameTableViewCell.xib */; };
@ -483,12 +491,11 @@
6741A9E61BF340DE002C974C /* MWMPlacePage+Animation.mm in Sources */ = {isa = PBXBuildFile; fileRef = F65243341B0B634F00BFA9D4 /* MWMPlacePage+Animation.mm */; };
6741A9E71BF340DE002C974C /* MWMCircularProgressView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 349A35791B53D4C9009677EE /* MWMCircularProgressView.mm */; };
6741A9E81BF340DE002C974C /* MWMAPIBar.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3465E7D71B6658C000854C4D /* MWMAPIBar.mm */; };
6741A9E91BF340DE002C974C /* Preferences.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA29FDA9141E77F8004ADF66 /* Preferences.mm */; };
6741A9EB1BF340DE002C974C /* ContextViews.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6D409F91B319BD70041730F /* ContextViews.mm */; };
6741A9EC1BF340DE002C974C /* MWMCircularProgress.mm in Sources */ = {isa = PBXBuildFile; fileRef = 349A35761B53D4C9009677EE /* MWMCircularProgress.mm */; };
6741A9EE1BF340DE002C974C /* MWMSearchCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = 34B82AD91B847FFC00180497 /* MWMSearchCell.mm */; };
6741A9EF1BF340DE002C974C /* MWMiPadPlacePage.mm in Sources */ = {isa = PBXBuildFile; fileRef = F66A8FAB1B09F137001B9C97 /* MWMiPadPlacePage.mm */; };
6741A9F01BF340DE002C974C /* SettingsViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 978F9239183B660F000D6C7C /* SettingsViewController.mm */; };
6741A9F01BF340DE002C974C /* MWMSettingsViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 978F9239183B660F000D6C7C /* MWMSettingsViewController.mm */; };
6741A9F11BF340DE002C974C /* MWMNavigationDashboardEntity.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6BD33861B62412E00F2CE18 /* MWMNavigationDashboardEntity.mm */; };
6741A9F21BF340DE002C974C /* MWMPlacePageInfoCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6CB215F1AEE7A5B00FB8963 /* MWMPlacePageInfoCell.mm */; };
6741A9F31BF340DE002C974C /* MWMSearchHistoryManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 340E105F1B944DAB00D975D5 /* MWMSearchHistoryManager.mm */; };
@ -520,7 +527,6 @@
6741AA171BF340DE002C974C /* SwitchCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = 978F923B183B660F000D6C7C /* SwitchCell.mm */; };
6741AA181BF340DE002C974C /* UIView+RuntimeAttributes.mm in Sources */ = {isa = PBXBuildFile; fileRef = 342AD7711B53D32F00E0B997 /* UIView+RuntimeAttributes.mm */; };
6741AA191BF340DE002C974C /* MWMDownloaderDialogCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = F64F4B6C1B46A51F0081A24A /* MWMDownloaderDialogCell.mm */; };
6741AA1A1BF340DE002C974C /* SettingsAndMoreVC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 97508422199522D300A7457D /* SettingsAndMoreVC.mm */; };
6741AA1B1BF340DE002C974C /* MWMDirectionView.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6ED13531B1643900095C6DE /* MWMDirectionView.mm */; };
6741AA1C1BF340DE002C974C /* MWMRoutingDisclaimerAlert.mm in Sources */ = {isa = PBXBuildFile; fileRef = F63774E91B59376F00BCF54D /* MWMRoutingDisclaimerAlert.mm */; };
6741AA1D1BF340DE002C974C /* MWMDownloadTransitMapAlert.mm in Sources */ = {isa = PBXBuildFile; fileRef = F64F19971AB81A00006EAF7E /* MWMDownloadTransitMapAlert.mm */; };
@ -616,13 +622,12 @@
9747264318323080006B7CB7 /* UIKitCategories.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9747264118323080006B7CB7 /* UIKitCategories.mm */; };
9747278418338F0C006B7CB7 /* UIViewController+Navigation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9747278318338F0C006B7CB7 /* UIViewController+Navigation.mm */; };
974D041D1977DE430081D0A7 /* LocalNotificationManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 974D041B1977DE430081D0A7 /* LocalNotificationManager.mm */; };
97508423199522D300A7457D /* SettingsAndMoreVC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 97508422199522D300A7457D /* SettingsAndMoreVC.mm */; };
97719D451843B6DC00BDD815 /* MessageUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 97719D441843B6DC00BDD815 /* MessageUI.framework */; };
97719D491843B6F700BDD815 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 97719D471843B6F200BDD815 /* Security.framework */; };
978D4A251996B0EC00D72CA7 /* CommunityVC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 978D4A241996B0EC00D72CA7 /* CommunityVC.mm */; };
978D4A291996C17300D72CA7 /* RichTextVC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 978D4A281996C17300D72CA7 /* RichTextVC.mm */; };
978D4A31199A11E600D72CA7 /* faq.html in Resources */ = {isa = PBXBuildFile; fileRef = 978D4A30199A11E600D72CA7 /* faq.html */; };
978F9240183B660F000D6C7C /* SettingsViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 978F9239183B660F000D6C7C /* SettingsViewController.mm */; };
978F9240183B660F000D6C7C /* MWMSettingsViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 978F9239183B660F000D6C7C /* MWMSettingsViewController.mm */; };
978F9242183B660F000D6C7C /* SelectableCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = 978F923A183B660F000D6C7C /* SelectableCell.mm */; };
978F9244183B660F000D6C7C /* SwitchCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = 978F923B183B660F000D6C7C /* SwitchCell.mm */; };
97A5967F19B9CD47007A963F /* copyright.html in Resources */ = {isa = PBXBuildFile; fileRef = 97A5967E19B9CD47007A963F /* copyright.html */; };
@ -813,7 +818,6 @@
F6FEA82D1C58E89B007223CC /* MWMButton.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6FEA82C1C58E89B007223CC /* MWMButton.mm */; };
F6FEA82E1C58F108007223CC /* MWMButton.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6FEA82C1C58E89B007223CC /* MWMButton.mm */; };
FA054612155C465E001F4E37 /* SelectSetVC.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA054611155C465E001F4E37 /* SelectSetVC.mm */; };
FA29FDAA141E77F8004ADF66 /* Preferences.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA29FDA9141E77F8004ADF66 /* Preferences.mm */; };
FA36B80D15403A4F004560CC /* BookmarksVC.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA36B80615403A4F004560CC /* BookmarksVC.mm */; };
FA459EB414327AF700B5BB3C /* WorldCoasts.mwm in Resources */ = {isa = PBXBuildFile; fileRef = FA459EB314327AF700B5BB3C /* WorldCoasts.mwm */; };
FA46DA2C12D4166E00968C36 /* countries.txt in Resources */ = {isa = PBXBuildFile; fileRef = FA46DA2B12D4166E00968C36 /* countries.txt */; };
@ -992,6 +996,8 @@
345FDD241C3BB3AF0070C459 /* MWMEditorViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMEditorViewController.h; sourceTree = "<group>"; };
345FDD251C3BB3AF0070C459 /* MWMEditorViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = MWMEditorViewController.mm; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
3460B4C11BF369A2003EE796 /* StatisticsStrings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StatisticsStrings.h; sourceTree = "<group>"; };
34618BFB1D6DAAE600EDEEF4 /* MWMSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMSettings.h; sourceTree = "<group>"; };
34618BFC1D6DAAE600EDEEF4 /* MWMSettings.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMSettings.mm; sourceTree = "<group>"; };
34634B1A1BB42D270013573C /* MWMBottomMenuCollectionViewLandscapeCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMBottomMenuCollectionViewLandscapeCell.xib; sourceTree = "<group>"; };
3465E7D61B6658C000854C4D /* MWMAPIBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMAPIBar.h; sourceTree = "<group>"; };
3465E7D71B6658C000854C4D /* MWMAPIBar.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMAPIBar.mm; sourceTree = "<group>"; };
@ -1044,6 +1050,8 @@
3485C00F1B85C20E00F7712D /* MWMSearchTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMSearchTableViewController.h; sourceTree = "<group>"; };
3485C0101B85C20E00F7712D /* MWMSearchTableViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = MWMSearchTableViewController.mm; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
3485C0111B85C20E00F7712D /* MWMSearchTableViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMSearchTableViewController.xib; sourceTree = "<group>"; };
348C26031D701B9F00813924 /* MWMHelpController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMHelpController.h; sourceTree = "<group>"; };
348C26041D701B9F00813924 /* MWMHelpController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMHelpController.mm; sourceTree = "<group>"; };
348D1DF91C525B8300860465 /* MWMTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMTypes.h; sourceTree = "<group>"; };
348E57981B0F49D8000FA02A /* maps.me dbg.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "maps.me dbg.app"; sourceTree = BUILT_PRODUCTS_DIR; };
3490D2D91CE9DD2500D0B838 /* MWMSideButtons.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMSideButtons.h; sourceTree = "<group>"; };
@ -1095,6 +1103,10 @@
34ABA62B1C2D57D500FE1BEC /* MWMInputPasswordValidator.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMInputPasswordValidator.mm; sourceTree = "<group>"; };
34ABA62E1C2D58F300FE1BEC /* MWMInputEmailValidator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMInputEmailValidator.h; sourceTree = "<group>"; };
34ABA62F1C2D58F300FE1BEC /* MWMInputEmailValidator.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMInputEmailValidator.mm; sourceTree = "<group>"; };
34B104201D6EE45700C8B577 /* MWMUnitsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMUnitsController.h; sourceTree = "<group>"; };
34B104211D6EE45700C8B577 /* MWMUnitsController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMUnitsController.mm; sourceTree = "<group>"; };
34B104241D6F040E00C8B577 /* MWMAboutController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMAboutController.h; sourceTree = "<group>"; };
34B104251D6F040E00C8B577 /* MWMAboutController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMAboutController.mm; sourceTree = "<group>"; };
34B646BB1CEB6FC000E0C7A5 /* MWMEditorAdditionalNameTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMEditorAdditionalNameTableViewCell.h; sourceTree = "<group>"; };
34B646BC1CEB6FC000E0C7A5 /* MWMEditorAdditionalNameTableViewCell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMEditorAdditionalNameTableViewCell.mm; sourceTree = "<group>"; };
34B646BF1CEB6FE000E0C7A5 /* MWMEditorAdditionalNameTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMEditorAdditionalNameTableViewCell.xib; sourceTree = "<group>"; };
@ -1297,8 +1309,6 @@
9747278318338F0C006B7CB7 /* UIViewController+Navigation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = "UIViewController+Navigation.mm"; path = "Classes/UIViewController+Navigation.mm"; sourceTree = "<group>"; };
974D041B1977DE430081D0A7 /* LocalNotificationManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = LocalNotificationManager.mm; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
974D041C1977DE430081D0A7 /* LocalNotificationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalNotificationManager.h; sourceTree = "<group>"; };
97508421199522D300A7457D /* SettingsAndMoreVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsAndMoreVC.h; sourceTree = "<group>"; };
97508422199522D300A7457D /* SettingsAndMoreVC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SettingsAndMoreVC.mm; sourceTree = "<group>"; };
97719D441843B6DC00BDD815 /* MessageUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MessageUI.framework; path = System/Library/Frameworks/MessageUI.framework; sourceTree = SDKROOT; };
97719D471843B6F200BDD815 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
978D4A231996B0EC00D72CA7 /* CommunityVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommunityVC.h; sourceTree = "<group>"; };
@ -1306,12 +1316,12 @@
978D4A271996C17300D72CA7 /* RichTextVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RichTextVC.h; sourceTree = "<group>"; };
978D4A281996C17300D72CA7 /* RichTextVC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RichTextVC.mm; sourceTree = "<group>"; };
978D4A30199A11E600D72CA7 /* faq.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = faq.html; path = ../../data/faq.html; sourceTree = "<group>"; };
978F9239183B660F000D6C7C /* SettingsViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = SettingsViewController.mm; path = Settings/SettingsViewController.mm; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
978F9239183B660F000D6C7C /* MWMSettingsViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = MWMSettingsViewController.mm; path = Settings/MWMSettingsViewController.mm; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
978F923A183B660F000D6C7C /* SelectableCell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SelectableCell.mm; path = Settings/SelectableCell.mm; sourceTree = "<group>"; };
978F923B183B660F000D6C7C /* SwitchCell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SwitchCell.mm; path = Settings/SwitchCell.mm; sourceTree = "<group>"; };
978F923D183B660F000D6C7C /* SwitchCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SwitchCell.h; path = Settings/SwitchCell.h; sourceTree = "<group>"; };
978F923E183B660F000D6C7C /* SelectableCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SelectableCell.h; path = Settings/SelectableCell.h; sourceTree = "<group>"; };
978F923F183B660F000D6C7C /* SettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SettingsViewController.h; path = Settings/SettingsViewController.h; sourceTree = "<group>"; };
978F923F183B660F000D6C7C /* MWMSettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MWMSettingsViewController.h; path = Settings/MWMSettingsViewController.h; sourceTree = "<group>"; };
97A5967E19B9CD47007A963F /* copyright.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = copyright.html; path = ../../data/copyright.html; sourceTree = "<group>"; };
97C98520186AE3CF00AF7E9E /* AppInfo.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = AppInfo.mm; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
97C98521186AE3CF00AF7E9E /* AppInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppInfo.h; sourceTree = "<group>"; };
@ -1543,8 +1553,6 @@
F7DD848614FE7FE0005695E1 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = "<group>"; };
FA054610155C465E001F4E37 /* SelectSetVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SelectSetVC.h; path = Bookmarks/SelectSetVC.h; sourceTree = SOURCE_ROOT; };
FA054611155C465E001F4E37 /* SelectSetVC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SelectSetVC.mm; path = Bookmarks/SelectSetVC.mm; sourceTree = SOURCE_ROOT; };
FA29FDA8141E77F8004ADF66 /* Preferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Preferences.h; path = Settings/Preferences.h; sourceTree = "<group>"; };
FA29FDA9141E77F8004ADF66 /* Preferences.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = Preferences.mm; path = Settings/Preferences.mm; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
FA36B80515403A4F004560CC /* BookmarksVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = BookmarksVC.h; path = Bookmarks/BookmarksVC.h; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
FA36B80615403A4F004560CC /* BookmarksVC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; name = BookmarksVC.mm; path = Bookmarks/BookmarksVC.mm; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
FA459EB314327AF700B5BB3C /* WorldCoasts.mwm */ = {isa = PBXFileReference; lastKnownFileType = file; name = WorldCoasts.mwm; path = ../../data/WorldCoasts.mwm; sourceTree = "<group>"; };
@ -3096,8 +3104,8 @@
isa = PBXGroup;
children = (
978F924D183BB5D6000D6C7C /* Cells */,
978F923F183B660F000D6C7C /* SettingsViewController.h */,
978F9239183B660F000D6C7C /* SettingsViewController.mm */,
978F923F183B660F000D6C7C /* MWMSettingsViewController.h */,
978F9239183B660F000D6C7C /* MWMSettingsViewController.mm */,
F668F6541BCD4507002D6FFC /* MWMTTSSettingsViewController.h */,
F668F6551BCD4507002D6FFC /* MWMTTSSettingsViewController.mm */,
F63BA36F1BCD5B520044C504 /* MWMTTSLanguageViewController.h */,
@ -3106,12 +3114,16 @@
F6C641AF1C15BBE6008FCAF3 /* MWMRecentTrackSettingsController.mm */,
F6B2E61D1C3D5F31005562DF /* MWMNightModeController.h */,
F6B2E61E1C3D5F31005562DF /* MWMNightModeController.mm */,
97508421199522D300A7457D /* SettingsAndMoreVC.h */,
97508422199522D300A7457D /* SettingsAndMoreVC.mm */,
978D4A231996B0EC00D72CA7 /* CommunityVC.h */,
978D4A241996B0EC00D72CA7 /* CommunityVC.mm */,
FA29FDA8141E77F8004ADF66 /* Preferences.h */,
FA29FDA9141E77F8004ADF66 /* Preferences.mm */,
34618BFB1D6DAAE600EDEEF4 /* MWMSettings.h */,
34618BFC1D6DAAE600EDEEF4 /* MWMSettings.mm */,
34B104201D6EE45700C8B577 /* MWMUnitsController.h */,
34B104211D6EE45700C8B577 /* MWMUnitsController.mm */,
34B104241D6F040E00C8B577 /* MWMAboutController.h */,
34B104251D6F040E00C8B577 /* MWMAboutController.mm */,
348C26031D701B9F00813924 /* MWMHelpController.h */,
348C26041D701B9F00813924 /* MWMHelpController.mm */,
);
name = Settings;
path = ..;
@ -3612,6 +3624,7 @@
EED10A4511F78D120095FAD4 /* MapViewController.mm in Sources */,
34CCFDD11C21945500F28959 /* MWMPlacePageOpeningHoursDayView.mm in Sources */,
F61579341AC2CE9A0032D8E9 /* MWMRateAlert.mm in Sources */,
34618BFD1D6DAAE600EDEEF4 /* MWMSettings.mm in Sources */,
F6BB6CC61BB18C0900DF1DF2 /* MWMRoutePointCell.m in Sources */,
347D7C691C2C0703006B2D0A /* UITextView+RuntimeAttributes.mm in Sources */,
34181EB91C0ED1C30081B586 /* MWMOpeningHoursSection.mm in Sources */,
@ -3678,8 +3691,8 @@
341F99ED1C6B28A7001C67B8 /* MWMMapDownloaderExtendedDataSource.mm in Sources */,
F65243351B0B634F00BFA9D4 /* MWMPlacePage+Animation.mm in Sources */,
349A357C1B53D4C9009677EE /* MWMCircularProgressView.mm in Sources */,
34B104261D6F040E00C8B577 /* MWMAboutController.mm in Sources */,
3465E7D81B6658C000854C4D /* MWMAPIBar.mm in Sources */,
FA29FDAA141E77F8004ADF66 /* Preferences.mm in Sources */,
F6D409FA1B319BD70041730F /* ContextViews.mm in Sources */,
342CC5F11C2D7730005F3FE5 /* MWMAuthorizationLoginViewController.mm in Sources */,
347FD8851C60B2CE002FB65E /* MWMOpeningHoursTimeSelectorTableViewCell.mm in Sources */,
@ -3688,7 +3701,7 @@
34B82ADA1B847FFC00180497 /* MWMSearchCell.mm in Sources */,
F6FEA82D1C58E89B007223CC /* MWMButton.mm in Sources */,
F66A8FAC1B09F137001B9C97 /* MWMiPadPlacePage.mm in Sources */,
978F9240183B660F000D6C7C /* SettingsViewController.mm in Sources */,
978F9240183B660F000D6C7C /* MWMSettingsViewController.mm in Sources */,
F6BD33871B62412E00F2CE18 /* MWMNavigationDashboardEntity.mm in Sources */,
F6CB21601AEE7A5B00FB8963 /* MWMPlacePageInfoCell.mm in Sources */,
340E10601B944DAB00D975D5 /* MWMSearchHistoryManager.mm in Sources */,
@ -3712,6 +3725,7 @@
F653CE161C71F60200A453F1 /* MWMAddPlaceNavigationBar.mm in Sources */,
A32B6D4D1A14980500E54A65 /* iosOGLContextFactory.mm in Sources */,
349C3AEC1D33A933002AC7A9 /* MWMNavigationInfoView.mm in Sources */,
34B104221D6EE45700C8B577 /* MWMUnitsController.mm in Sources */,
347FD8671C60B2CE002FB65E /* MWMOpeningHoursAddClosedTableViewCell.mm in Sources */,
FA054612155C465E001F4E37 /* SelectSetVC.mm in Sources */,
FAA614B8155F16950031C345 /* AddSetVC.mm in Sources */,
@ -3760,7 +3774,7 @@
F626D52E1C3E6CAA00C17D15 /* MWMTableViewCell.mm in Sources */,
F64F4B6D1B46A51F0081A24A /* MWMDownloaderDialogCell.mm in Sources */,
3491E7CB1C06F1F10042FE24 /* MWMPlacePageButtonCell.mm in Sources */,
97508423199522D300A7457D /* SettingsAndMoreVC.mm in Sources */,
348C26051D701B9F00813924 /* MWMHelpController.mm in Sources */,
341F99D91C6B1165001C67B8 /* MWMMapDownloaderPlaceTableViewCell.mm in Sources */,
345FD7E71CEC7D8400F58045 /* MWMEditorAdditionalNamesHeader.mm in Sources */,
341F99D51C6B1165001C67B8 /* MWMMapDownloaderLargeCountryTableViewCell.mm in Sources */,
@ -3837,6 +3851,7 @@
6741A9B91BF340DE002C974C /* MWMRateAlert.mm in Sources */,
6741A9BA1BF340DE002C974C /* MWMRoutePointCell.m in Sources */,
347D7C6A1C2C0703006B2D0A /* UITextView+RuntimeAttributes.mm in Sources */,
34618BFE1D6DAAE600EDEEF4 /* MWMSettings.mm in Sources */,
6741A9BE1BF340DE002C974C /* UILabel+RuntimeAttributes.mm in Sources */,
6741A9BF1BF340DE002C974C /* MWMSearchTabbedCollectionViewCell.mm in Sources */,
6741A9C01BF340DE002C974C /* MWMTextView.mm in Sources */,
@ -3903,14 +3918,14 @@
6741A9E71BF340DE002C974C /* MWMCircularProgressView.mm in Sources */,
F626D5301C3E840600C17D15 /* MWMNightModeController.mm in Sources */,
6741A9E81BF340DE002C974C /* MWMAPIBar.mm in Sources */,
6741A9E91BF340DE002C974C /* Preferences.mm in Sources */,
34B104271D6F040E00C8B577 /* MWMAboutController.mm in Sources */,
347FD8861C60B2CE002FB65E /* MWMOpeningHoursTimeSelectorTableViewCell.mm in Sources */,
6741A9EB1BF340DE002C974C /* ContextViews.mm in Sources */,
6741A9EC1BF340DE002C974C /* MWMCircularProgress.mm in Sources */,
342CC5F21C2D7730005F3FE5 /* MWMAuthorizationLoginViewController.mm in Sources */,
6741A9EE1BF340DE002C974C /* MWMSearchCell.mm in Sources */,
6741A9EF1BF340DE002C974C /* MWMiPadPlacePage.mm in Sources */,
6741A9F01BF340DE002C974C /* SettingsViewController.mm in Sources */,
6741A9F01BF340DE002C974C /* MWMSettingsViewController.mm in Sources */,
6741A9F11BF340DE002C974C /* MWMNavigationDashboardEntity.mm in Sources */,
6741A9F21BF340DE002C974C /* MWMPlacePageInfoCell.mm in Sources */,
6741A9F31BF340DE002C974C /* MWMSearchHistoryManager.mm in Sources */,
@ -3937,6 +3952,7 @@
6741A9FF1BF340DE002C974C /* AddSetVC.mm in Sources */,
6741AA011BF340DE002C974C /* MWMSearchTabbedViewLayout.mm in Sources */,
349C3AED1D33A933002AC7A9 /* MWMNavigationInfoView.mm in Sources */,
34B104231D6EE45700C8B577 /* MWMUnitsController.mm in Sources */,
6741AA021BF340DE002C974C /* BookmarksRootVC.mm in Sources */,
6741AA031BF340DE002C974C /* MWMActivityViewController.mm in Sources */,
34DDD5341BFDB0B600407F2F /* MWMMapDownloaderViewController.mm in Sources */,
@ -3979,13 +3995,13 @@
F626D5331C3E846E00C17D15 /* UIImageView+Coloring.mm in Sources */,
343FAC4B1CBFBDFC00A45D3B /* MWMNoMapsView.mm in Sources */,
6741AA191BF340DE002C974C /* MWMDownloaderDialogCell.mm in Sources */,
6741AA1A1BF340DE002C974C /* SettingsAndMoreVC.mm in Sources */,
6741AA1B1BF340DE002C974C /* MWMDirectionView.mm in Sources */,
3491E7CC1C06F1F10042FE24 /* MWMPlacePageButtonCell.mm in Sources */,
6741AA1C1BF340DE002C974C /* MWMRoutingDisclaimerAlert.mm in Sources */,
6741AA1D1BF340DE002C974C /* MWMDownloadTransitMapAlert.mm in Sources */,
341F99DA1C6B1165001C67B8 /* MWMMapDownloaderPlaceTableViewCell.mm in Sources */,
341F99D61C6B1165001C67B8 /* MWMMapDownloaderLargeCountryTableViewCell.mm in Sources */,
348C26061D701B9F00813924 /* MWMHelpController.mm in Sources */,
6741AA1E1BF340DE002C974C /* LinkCell.mm in Sources */,
345FD7E81CEC7D8400F58045 /* MWMEditorAdditionalNamesHeader.mm in Sources */,
347FD8701C60B2CE002FB65E /* MWMOpeningHoursAllDayTableViewCell.mm in Sources */,

File diff suppressed because it is too large Load diff

View file

@ -2,6 +2,7 @@
@interface LinkCell : MWMTableViewCell
@property (nonatomic) IBOutlet UILabel * titleLabel;
@property(nonatomic) IBOutlet UILabel * titleLabel;
@property(nonatomic) IBOutlet UILabel * infoLabel;
@end

View file

@ -0,0 +1,5 @@
#import "MWMTableViewController.h"
@interface MWMSettingsViewController : MWMTableViewController
@end

View file

@ -0,0 +1,289 @@
#import "MWMSettingsViewController.h"
#import "LinkCell.h"
#import "LocaleTranslator.h"
#import "MWMAuthorizationCommon.h"
#import "MWMSettings.h"
#import "MWMTextToSpeech.h"
#import "Statistics.h"
#import "SwitchCell.h"
#import "WebViewController.h"
#import "3party/Alohalytics/src/alohalytics_objc.h"
#include "Framework.h"
#include "map/gps_tracker.hpp"
extern NSString * const kAlohalyticsTapEventKey;
@interface MWMSettingsViewController ()<SwitchCellDelegate>
@property(weak, nonatomic) IBOutlet LinkCell * profileCell;
@property(weak, nonatomic) IBOutlet LinkCell * unitsCell;
@property(weak, nonatomic) IBOutlet SwitchCell * zoomButtonsCell;
@property(weak, nonatomic) IBOutlet SwitchCell * is3dCell;
@property(weak, nonatomic) IBOutlet SwitchCell * autoDownloadCell;
@property(weak, nonatomic) IBOutlet LinkCell * recentTrackCell;
@property(weak, nonatomic) IBOutlet SwitchCell * compassCalibrationCell;
@property(weak, nonatomic) IBOutlet SwitchCell * statisticsCell;
@property(weak, nonatomic) IBOutlet LinkCell * nightModeCell;
@property(weak, nonatomic) IBOutlet SwitchCell * perspectiveViewCell;
@property(weak, nonatomic) IBOutlet SwitchCell * autoZoomCell;
@property(weak, nonatomic) IBOutlet LinkCell * voiceInstructionsCell;
@property(weak, nonatomic) IBOutlet LinkCell * helpCell;
@property(weak, nonatomic) IBOutlet LinkCell * aboutCell;
@end
@implementation MWMSettingsViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = L(@"settings");
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self configCells];
}
- (void)configCells
{
[self configProfileSection];
[self configCommonSection];
[self configNavigationSection];
}
- (void)configProfileSection
{
NSString * userName = osm_auth_ios::OSMUserName();
self.profileCell.infoLabel.text = userName.length != 0 ? userName : @"";
}
- (void)configCommonSection
{
switch ([MWMSettings measurementUnits])
{
case measurement_utils::Units::Metric: self.unitsCell.infoLabel.text = L(@"kilometres"); break;
case measurement_utils::Units::Imperial: self.unitsCell.infoLabel.text = L(@"miles"); break;
}
self.zoomButtonsCell.switchButton.on = [MWMSettings zoomButtonsEnabled];
self.zoomButtonsCell.delegate = self;
bool on = true, _ = true;
GetFramework().Load3dMode(_, on);
self.is3dCell.switchButton.on = on;
self.is3dCell.delegate = self;
self.autoDownloadCell.switchButton.on = [MWMSettings autoDownloadEnabled];
self.autoDownloadCell.delegate = self;
if (!GpsTracker::Instance().IsEnabled())
{
self.recentTrackCell.infoLabel.text = L(@"duration_disabled");
}
else
{
switch (GpsTracker::Instance().GetDuration().count())
{
case 1: self.recentTrackCell.infoLabel.text = L(@"duration_1_hour"); break;
case 2: self.recentTrackCell.infoLabel.text = L(@"duration_2_hours"); break;
case 6: self.recentTrackCell.infoLabel.text = L(@"duration_6_hours"); break;
case 12: self.recentTrackCell.infoLabel.text = L(@"duration_12_hours"); break;
case 24: self.recentTrackCell.infoLabel.text = L(@"duration_1_day"); break;
default: NSAssert(false, @"Incorrect hours value"); break;
}
}
self.compassCalibrationCell.switchButton.on = [MWMSettings compassCalibrationEnabled];
self.compassCalibrationCell.delegate = self;
self.statisticsCell.switchButton.on = [MWMSettings statisticsEnabled];
self.statisticsCell.delegate = self;
}
- (void)configNavigationSection
{
if ([MWMSettings autoNightModeEnabled])
{
self.nightModeCell.infoLabel.text = L(@"pref_map_style_auto");
}
else
{
switch (GetFramework().GetMapStyle())
{
case MapStyleDark: self.nightModeCell.infoLabel.text = L(@"pref_map_style_night"); break;
default: self.nightModeCell.infoLabel.text = L(@"pref_map_style_default"); break;
}
}
bool _ = true, on = true;
GetFramework().Load3dMode(on, _);
self.perspectiveViewCell.switchButton.on = on;
self.perspectiveViewCell.delegate = self;
self.autoZoomCell.switchButton.on = GetFramework().LoadAutoZoom();
self.autoZoomCell.delegate = self;
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.infoLabel.text = language;
}
else
{
self.voiceInstructionsCell.infoLabel.text = @"";
}
}
else
{
self.voiceInstructionsCell.infoLabel.text = L(@"duration_disabled");
}
}
#pragma mark - SwitchCellDelegate
- (void)switchCell:(SwitchCell *)cell didChangeValue:(BOOL)value
{
if (cell == self.zoomButtonsCell)
{
[Statistics logEvent:kStatEventName(kStatSettings, kStatToggleZoomButtonsVisibility)
withParameters:@{kStatValue : (value ? kStatVisible : kStatHidden)}];
[MWMSettings setZoomButtonsEnabled:value];
}
else if (cell == self.is3dCell)
{
[Statistics logEvent:kStatEventName(kStatSettings, kStat3DBuildings)
withParameters:@{kStatValue : (value ? kStatOn : kStatOff)}];
auto & f = GetFramework();
bool _ = true, is3dBuildings = true;
f.Load3dMode(_, is3dBuildings);
is3dBuildings = static_cast<bool>(value);
f.Save3dMode(_, is3dBuildings);
f.Allow3dMode(_, is3dBuildings);
}
else if (cell == self.autoDownloadCell)
{
[Statistics logEvent:kStatEventName(kStatSettings, kStatAutoDownload)
withParameters:@{kStatValue : (value ? kStatOn : kStatOff)}];
[MWMSettings setAutoDownloadEnabled:value];
}
else if (cell == self.compassCalibrationCell)
{
[Statistics logEvent:kStatEventName(kStatSettings, kStatToggleCompassCalibration)
withParameters:@{kStatValue : (value ? kStatOn : kStatOff)}];
[MWMSettings setCompassCalibrationEnabled:value];
}
else if (cell == self.statisticsCell)
{
[Statistics logEvent:kStatEventName(kStatSettings, kStatToggleStatistics)
withParameters:@{
kStatAction : kStatToggleStatistics,
kStatValue : (value ? kStatOn : kStatOff)
}];
if (value)
[[Statistics instance] enableOnNextAppLaunch];
else
[[Statistics instance] disableOnNextAppLaunch];
}
else if (cell == self.perspectiveViewCell)
{
[Statistics logEvent:kStatEventName(kStatSettings, kStat3D)
withParameters:@{kStatValue : (value ? kStatOn : kStatOff)}];
auto & f = GetFramework();
bool _ = true, is3d = true;
f.Load3dMode(is3d, _);
is3d = static_cast<bool>(value);
f.Save3dMode(is3d, _);
f.Allow3dMode(is3d, _);
}
else if (cell == self.autoZoomCell)
{
[Statistics logEvent:kStatEventName(kStatSettings, kStatAutoZoom)
withParameters:@{kStatValue : value ? kStatOn : kStatOff}];
auto & f = GetFramework();
f.AllowAutoZoom(value);
f.SaveAutoZoom(value);
}
}
#pragma mark - UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
LinkCell * cell = static_cast<LinkCell *>([tableView cellForRowAtIndexPath:indexPath]);
if (cell == self.profileCell)
{
[Statistics logEvent:kStatSettingsOpenSection withParameters:@{kStatName : kStatAuthorization}];
[self performSegueWithIdentifier:@"SettingsToProfileSegue" sender:nil];
}
else if (cell == self.unitsCell)
{
[Statistics logEvent:kStatEventName(kStatSettings, kStatChangeMeasureUnits)
withParameters:@{kStatAction : kStatChangeMeasureUnits}];
[self performSegueWithIdentifier:@"SettingsToUnits" sender:nil];
}
else if (cell == self.recentTrackCell)
{
[Statistics logEvent:kStatEventName(kStatSettings, kStatRecentTrack)
withParameters:@{kStatAction : kStatChangeRecentTrack}];
[self performSegueWithIdentifier:@"SettingsToRecentTrackSegue" sender:nil];
}
else if (cell == self.nightModeCell)
{
[Statistics logEvent:kStatEventName(kStatSettings, kStatNightMode)
withParameters:@{kStatAction : kStatChangeNightMode}];
[self performSegueWithIdentifier:@"SettingsToNightMode" sender:nil];
}
else if (cell == self.voiceInstructionsCell)
{
[Statistics logEvent:kStatEventName(kStatSettings, kStatTTS)
withParameters:@{kStatAction : kStatChangeLanguage}];
[self performSegueWithIdentifier:@"SettingsToTTSSegue" sender:nil];
}
else if (cell == self.helpCell)
{
[Statistics logEvent:kStatSettingsOpenSection withParameters:@{kStatName : kStatHelp}];
[Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"help"];
[self performSegueWithIdentifier:@"SettingsToHelp" sender:nil];
}
else if (cell == self.aboutCell)
{
[Statistics logEvent:kStatSettingsOpenSection withParameters:@{kStatName : kStatAbout}];
[self performSegueWithIdentifier:@"SettingsToAbout" sender:nil];
}
}
#pragma mark - UITableViewDataSource
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
switch (section)
{
case 1: return L(@"general_settings");
case 2: return L(@"prefs_group_route");
case 3: return L(@"info");
default: return nil;
}
}
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section
{
switch (section)
{
case 1: return L(@"allow_statistics_hint");
default: return nil;
}
}
@end

View file

@ -1,6 +0,0 @@
// Initialize default preferences if they're not initialized
@interface Preferences : NSObject
+ (void)setup;
@end

View file

@ -1,24 +0,0 @@
#import "Preferences.h"
#include "Framework.h"
#include "platform/settings.hpp"
@implementation Preferences
// TODO: Export this logic to C++
+ (void)setup
{
auto units = measurement_utils::Units::Metric;
if (!settings::Get(settings::kMeasurementUnits, units))
{
// get system locale preferences
BOOL const isMetric = [[[NSLocale autoupdatingCurrentLocale] objectForKey:NSLocaleUsesMetricSystem] boolValue];
units = isMetric ? measurement_utils::Units::Metric : measurement_utils::Units::Imperial;
settings::Set(settings::kMeasurementUnits, units);
}
GetFramework().SetupMeasurementSystem();
}
@end

View file

@ -1,5 +0,0 @@
#import "MWMTableViewController.h"
@interface SettingsViewController : MWMTableViewController
@end

View file

@ -1,418 +0,0 @@
#import "Common.h"
#import "LinkCell.h"
#import "MapsAppDelegate.h"
#import "MapViewController.h"
#import "MWMMapDownloadDialog.h"
#import "MWMMapViewControlsManager.h"
#import "MWMTextToSpeech.h"
#import "SelectableCell.h"
#import "SettingsViewController.h"
#import "Statistics.h"
#import "SwitchCell.h"
#import "UIColor+MapsMeColor.h"
#import "WebViewController.h"
#include "Framework.h"
#include "platform/settings.hpp"
#include "platform/platform.hpp"
#include "platform/preferred_languages.hpp"
extern char const * kStatisticsEnabledSettingsKey;
char const * kAdForbiddenSettingsKey = "AdForbidden";
char const * kAdServerForbiddenKey = "AdServerForbidden";
char const * kAutoDownloadEnabledKey = "AutoDownloadEnabled";
typedef NS_ENUM(NSUInteger, Section)
{
SectionMetrics,
SectionMap,
SectionRouting,
SectionCalibration,
SectionAd,
SectionStatistics
};
@interface SettingsViewController () <SwitchCellDelegate>
@end
@implementation SettingsViewController
{
vector<Section> sections;
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = L(@"settings");
self.tableView.backgroundView = nil;
bool adServerForbidden = false;
(void)settings::Get(kAdServerForbiddenKey, adServerForbidden);
if (isIOS7 || adServerForbidden)
sections = {SectionMetrics, SectionMap, SectionRouting, SectionCalibration, SectionStatistics};
else
sections = {SectionMetrics, SectionMap, SectionRouting, SectionCalibration, SectionAd, SectionStatistics};
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return sections.size();
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
switch (sections[section])
{
case SectionAd:
case SectionStatistics:
case SectionCalibration:
return 1;
case SectionMetrics:
return 2;
case SectionRouting:
return 4;
case SectionMap:
return 5;
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell * cell = nil;
switch (sections[indexPath.section])
{
case SectionMetrics:
{
cell = [tableView dequeueReusableCellWithIdentifier:[SelectableCell className]];
auto units = measurement_utils::Units::Metric;
UNUSED_VALUE(settings::Get(settings::kMeasurementUnits, units));
BOOL const selected = units == unitsForIndex(indexPath.row);
SelectableCell * customCell = (SelectableCell *)cell;
customCell.accessoryType = selected ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone;
customCell.titleLabel.text = indexPath.row == 0 ? L(@"kilometres") : L(@"miles");
break;
}
case SectionAd:
{
cell = [tableView dequeueReusableCellWithIdentifier:[SwitchCell className]];
SwitchCell * customCell = (SwitchCell *)cell;
bool forbidden = false;
(void)settings::Get(kAdForbiddenSettingsKey, forbidden);
customCell.switchButton.on = !forbidden;
customCell.titleLabel.text = L(@"showcase_settings_title");
customCell.delegate = self;
break;
}
case SectionStatistics:
{
cell = [tableView dequeueReusableCellWithIdentifier:[SwitchCell className]];
SwitchCell * customCell = (SwitchCell *)cell;
bool on = [Statistics isStatisticsEnabledByDefault];
(void)settings::Get(kStatisticsEnabledSettingsKey, on);
customCell.switchButton.on = on;
customCell.titleLabel.text = L(@"allow_statistics");
customCell.delegate = self;
break;
}
case SectionMap:
{
switch (indexPath.row)
{
// Night mode
// Recent track
case 0:
case 1:
{
cell = [tableView dequeueReusableCellWithIdentifier:[LinkCell className]];
LinkCell * customCell = static_cast<LinkCell *>(cell);
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);
bool on = true, _ = true;
GetFramework().Load3dMode(_, on);
customCell.titleLabel.text = L(@"pref_map_3d_buildings_title");
customCell.switchButton.on = on;
customCell.delegate = self;
break;
}
// Zoom buttons
case 4:
{
cell = [tableView dequeueReusableCellWithIdentifier:[SwitchCell className]];
SwitchCell * customCell = static_cast<SwitchCell *>(cell);
bool on = true;
(void)settings::Get("ZoomButtonsEnabled", on);
customCell.titleLabel.text = L(@"pref_zoom_title");
customCell.switchButton.on = on;
customCell.delegate = self;
break;
}
}
break;
}
case SectionRouting:
{
switch (indexPath.row)
{
// 3D mode
case 0:
{
cell = [tableView dequeueReusableCellWithIdentifier:[SwitchCell className]];
SwitchCell * customCell = (SwitchCell *)cell;
customCell.titleLabel.text = L(@"pref_map_3d_title");
customCell.delegate = self;
bool _ = true, on = true;
GetFramework().Load3dMode(on, _);
customCell.switchButton.on = on;
break;
}
// Allow autozoom
case 1:
{
cell = [tableView dequeueReusableCellWithIdentifier:[SwitchCell className]];
SwitchCell * customCell = static_cast<SwitchCell *>(cell);
customCell.switchButton.on = GetFramework().LoadAutoZoom();
customCell.titleLabel.text = L(@"pref_map_auto_zoom");
customCell.delegate = self;
break;
}
// Enable TTS
case 2:
{
cell = [tableView dequeueReusableCellWithIdentifier:[SwitchCell className]];
SwitchCell * customCell = (SwitchCell *)cell;
customCell.switchButton.on = [MWMTextToSpeech isTTSEnabled];
customCell.titleLabel.text = L(@"pref_tts_enable_title");
customCell.delegate = self;
break;
}
// Change TTS language
case 3:
{
cell = [tableView dequeueReusableCellWithIdentifier:[LinkCell className]];
LinkCell * customCell = (LinkCell *)cell;
customCell.titleLabel.text = L(@"pref_tts_language_title");
break;
}
default:
NSAssert(false, @"Incorrect index path!");
break;
}
break;
}
case SectionCalibration:
{
cell = [tableView dequeueReusableCellWithIdentifier:[SwitchCell className]];
SwitchCell * customCell = (SwitchCell *)cell;
bool on = false;
(void)settings::Get("CompassCalibrationEnabled", on);
customCell.switchButton.on = on;
customCell.titleLabel.text = L(@"pref_calibration_title");
customCell.delegate = self;
break;
}
}
return cell;
}
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section
{
if (section == SectionStatistics)
return L(@"allow_statistics_hint");
return nil;
}
- (void)switchCell:(SwitchCell *)cell didChangeValue:(BOOL)value
{
NSIndexPath * indexPath = [self.tableView indexPathForCell:cell];
Statistics * stat = [Statistics instance];
switch (sections[indexPath.section])
{
case SectionAd:
[Statistics logEvent:kStatSettings
withParameters:@{kStatAction : kStatMoreApps, kStatValue : (value ? kStatOn : kStatOff)}];
settings::Set(kAdForbiddenSettingsKey, static_cast<bool>(!value));
break;
case SectionStatistics:
[Statistics logEvent:kStatEventName(kStatSettings, kStatToggleStatistics)
withParameters: @{kStatAction : kStatToggleStatistics, kStatValue : (value ? kStatOn : kStatOff)}];
if (value)
[stat enableOnNextAppLaunch];
else
[stat disableOnNextAppLaunch];
break;
case SectionMap:
switch (indexPath.row)
{
// Night mode
// Recent track
case 0:
case 1:
break;
// Auto download
case 2:
{
[Statistics logEvent:kStatEventName(kStatSettings, kStatAutoDownload)
withParameters:@{kStatValue : (value ? kStatOn : kStatOff)}];
settings::Set(kAutoDownloadEnabledKey, static_cast<bool>(value));
break;
}
// 3D buildings
case 3:
{
[Statistics logEvent:kStatEventName(kStatSettings, kStat3DBuildings)
withParameters:@{kStatValue : (value ? kStatOn : kStatOff)}];
auto & f = GetFramework();
bool _ = true, is3dBuildings = true;
f.Load3dMode(_, is3dBuildings);
is3dBuildings = static_cast<bool>(value);
f.Save3dMode(_, is3dBuildings);
f.Allow3dMode(_, is3dBuildings);
break;
}
// Zoom buttons
case 4:
{
[Statistics logEvent:kStatEventName(kStatSettings, kStatToggleZoomButtonsVisibility)
withParameters:@{kStatValue : (value ? kStatVisible : kStatHidden)}];
settings::Set("ZoomButtonsEnabled", static_cast<bool>(value));
[MapViewController controller].controlsManager.zoomHidden = !value;
break;
}
}
break;
case SectionCalibration:
[Statistics logEvent:kStatEventName(kStatSettings, kStatToggleCompassCalibration)
withParameters:@{kStatValue : (value ? kStatOn : kStatOff)}];
settings::Set("CompassCalibrationEnabled", static_cast<bool>(value));
break;
case SectionRouting:
// 3D mode
if (indexPath.row == 0)
{
[Statistics logEvent:kStatEventName(kStatSettings, kStat3D)
withParameters:@{kStatValue : (value ? kStatOn : kStatOff)}];
auto & f = GetFramework();
bool _ = true, is3d = true;
f.Load3dMode(is3d, _);
is3d = static_cast<bool>(value);
f.Save3dMode(is3d, _);
f.Allow3dMode(is3d, _);
}
// Enable autozoom
else if (indexPath.row == 1)
{
[Statistics logEvent:kStatEventName(kStatSettings, kStatAutoZoom)
withParameters:@{kStatValue : value ? kStatOn : kStatOff}];
auto & f = GetFramework();
f.AllowAutoZoom(value);
f.SaveAutoZoom(value);
}
// Enable TTS
else if (indexPath.row == 2)
{
[Statistics logEvent:kStatEventName(kStatSettings, kStatTTS)
withParameters:@{kStatValue : value ? kStatOn : kStatOff}];
[MWMTextToSpeech setTTSEnabled:value];
}
break;
case SectionMetrics:
break;
}
}
measurement_utils::Units unitsForIndex(NSInteger index)
{
return index == 0 ? measurement_utils::Units::Metric : measurement_utils::Units::Imperial;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
switch (sections[indexPath.section])
{
case SectionMetrics:
{
auto const units = unitsForIndex(indexPath.row);
[Statistics logEvent:kStatEventName(kStatSettings, kStatChangeMeasureUnits)
withParameters:@{
kStatValue : (units == measurement_utils::Units::Metric ? kStatKilometers : kStatMiles)
}];
settings::Set(settings::kMeasurementUnits, units);
[tableView reloadSections:[NSIndexSet indexSetWithIndex:SectionMetrics] withRowAnimation:UITableViewRowAnimationFade];
GetFramework().SetupMeasurementSystem();
break;
}
case SectionRouting:
// Change TTS language
if (indexPath.row == 3)
{
[Statistics logEvent:kStatEventName(kStatSettings, kStatTTS)
withParameters:@{kStatAction : kStatChangeLanguage}];
[self performSegueWithIdentifier:@"SettingsToTTSSegue" sender:nil];
}
break;
case SectionMap:
// Change night mode
if (indexPath.row == 0)
{
[Statistics logEvent:kStatEventName(kStatSettings, kStatNightMode)
withParameters:@{kStatAction : kStatChangeNightMode}];
[self performSegueWithIdentifier:@"SettingsToNightMode" sender:nil];
}
else if (indexPath.row == 1)
{
[Statistics logEvent:kStatEventName(kStatSettings, kStatRecentTrack)
withParameters:@{kStatAction : kStatChangeRecentTrack}];
[self performSegueWithIdentifier:@"SettingsToRecentTrackSegue" sender:nil];
}
break;
case SectionAd:
case SectionCalibration:
case SectionStatistics:
break;
}
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
switch (sections[section])
{
case SectionMetrics:
return L(@"measurement_units");
case SectionRouting:
return L(@"prefs_group_route");
case SectionMap:
return L(@"prefs_group_map");
case SectionCalibration:
case SectionAd:
case SectionStatistics:
return nil;
}
}
@end

View file

@ -1,5 +0,0 @@
#import "MWMTableViewController.h"
@interface SettingsAndMoreVC : MWMTableViewController
@end

View file

@ -1,304 +0,0 @@
#import "SettingsAndMoreVC.h"
#import <MessageUI/MFMailComposeViewController.h>
#import <sys/utsname.h>
#import "CommunityVC.h"
#import "MWMAuthorizationCommon.h"
#import "MWMAuthorizationLoginViewController.h"
#import "RichTextVC.h"
#import "SettingsViewController.h"
#import "Statistics.h"
#import "UIColor+MapsMeColor.h"
#import "UIViewController+Navigation.h"
#import "WebViewController.h"
#import "UIImageView+Coloring.h"
#import "3party/Alohalytics/src/alohalytics_objc.h"
#include "platform/platform.hpp"
@interface SettingsAndMoreVC ()<MFMailComposeViewControllerDelegate>
@property(nonatomic) NSArray * items;
@end
static NSString * const kiOSEmail = @"ios@maps.me";
extern NSString * const kLocaleUsedInSupportEmails = @"en_gb";
extern NSString * const kAlohalyticsTapEventKey;
extern NSDictionary * const deviceNames = @{
@"x86_64" : @"Simulator",
@"i386" : @"Simulator",
@"iPod1,1" : @"iPod Touch",
@"iPod2,1" : @"iPod Touch 2nd gen.",
@"iPod3,1" : @"iPod Touch 3rd gen.",
@"iPod4,1" : @"iPod Touch 4th gen.",
@"iPod5,1" : @"iPod Touch 5th gen.",
@"iPhone1,1" : @"iPhone",
@"iPhone1,2" : @"iPhone 3G",
@"iPhone2,1" : @"iPhone 3GS",
@"iPhone3,1" : @"iPhone 4",
@"iPhone4,1" : @"iPhone 4S",
@"iPhone4,2" : @"iPhone 4S",
@"iPhone4,3" : @"iPhone 4S",
@"iPhone5,1" : @"iPhone 5",
@"iPhone5,2" : @"iPhone 5",
@"iPhone5,3" : @"iPhone 5c",
@"iPhone5,4" : @"iPhone 5c",
@"iPhone6,1" : @"iPhone 5s",
@"iPhone6,2" : @"iPhone 5s",
@"iPad1,1" : @"iPad WiFi",
@"iPad1,2" : @"iPad GSM",
@"iPad2,1" : @"iPad 2 WiFi",
@"iPad2,2" : @"iPad 2 GSM",
@"iPad2,2" : @"iPad 2 CDMA",
@"iPad3,1" : @"iPad 3rd gen. WiFi",
@"iPad3,2" : @"iPad 3rd gen. GSM",
@"iPad3,3" : @"iPad 3rd gen. CDMA",
@"iPad3,4" : @"iPad 4th gen. WiFi",
@"iPad3,5" : @"iPad 4th gen. GSM",
@"iPad3,6" : @"iPad 4th gen. CDMA",
@"iPad4,1" : @"iPad Air WiFi",
@"iPad4,2" : @"iPad Air GSM",
@"iPad4,3" : @"iPad Air CDMA",
@"iPad2,5" : @"iPad Mini WiFi",
@"iPad2,6" : @"iPad Mini GSM",
@"iPad2,7" : @"iPad Mini CDMA",
@"iPad4,4" : @"iPad Mini 2nd gen. WiFi",
@"iPad4,5" : @"iPad Mini 2nd gen. GSM",
@"iPad4,6" : @"iPad Mini 2nd gen. CDMA"
};
@implementation SettingsAndMoreVC
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = L(@"settings_and_more");
self.items = @[
@{
@"Title" : @"",
@"Items" : @[
@{@"Id" : @"Settings", @"Title" : L(@"settings"), @"Icon" : @"ic_settings_settings"},
@{@"Id" : @"Help", @"Title" : L(@"help"), @"Icon" : @"ic_settings_help"},
@{@"Id" : @"ReportBug", @"Title" : L(@"report_a_bug"), @"Icon" : @"ic_settings_feedback"}
]
},
@{
@"Title" : @"",
@"Items" : @[
@{@"Id" : @"Authorization", @"Title" : L(@"profile"), @"Icon" : @"ic_settings_login"}, @{
@"Id" : @"Community",
@"Title" : L(@"maps_me_community"),
@"Icon" : @"ic_settings_community"
},
@{@"Id" : @"RateApp", @"Title" : L(@"rate_the_app"), @"Icon" : @"ic_settings_rate"}
]
},
@{
@"Title" : @"",
@"Items" : @[
@{@"Id" : @"About", @"Title" : L(@"about_menu_title"), @"Icon" : @"IconAbout"},
@{@"Id" : @"Copyright", @"Title" : L(@"copyright"), @"Icon" : @"IconCopyright"}
]
}
];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:1]
withRowAnimation:UITableViewRowAnimationAutomatic];
}
#pragma mark - TableView
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return [self.items count]; }
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return 0.001;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 20;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
return self.items[section][@"Title"];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [self.items[section][@"Items"] count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSDictionary * item = self.items[indexPath.section][@"Items"][indexPath.row];
UITableViewCell * cell =
[tableView dequeueReusableCellWithIdentifier:[UITableViewCell className]];
if (!cell) // iOS 5
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:[UITableViewCell className]];
NSString * osmUserName = osm_auth_ios::OSMUserName();
cell.textLabel.text =
[item[@"Id"] isEqualToString:@"Authorization"] && osmUserName ? osmUserName : item[@"Title"];
cell.imageView.image = [UIImage imageNamed:item[@"Icon"]];
cell.imageView.mwm_coloring = MWMImageColoringBlack;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
NSString * itemId = self.items[indexPath.section][@"Items"][indexPath.row][@"Id"];
if ([itemId isEqualToString:@"About"])
[self about];
else if ([itemId isEqualToString:@"Authorization"])
[self authorization];
else if ([itemId isEqualToString:@"Community"])
[self community];
else if ([itemId isEqualToString:@"RateApp"])
[self rateApp];
else if ([itemId isEqualToString:@"Settings"])
[self settings];
else if ([itemId isEqualToString:@"ReportBug"])
[self reportBug];
else if ([itemId isEqualToString:@"Help"])
[self help];
else if ([itemId isEqualToString:@"Copyright"])
[self copyright];
}
- (void)settings
{
[Statistics logEvent:kStatSettingsOpenSection withParameters:@{kStatName : kStatSettings}];
[Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"settingsMiles"];
SettingsViewController * vc = [self.mainStoryboard
instantiateViewControllerWithIdentifier:[SettingsViewController className]];
[self.navigationController pushViewController:vc animated:YES];
}
- (void)authorization
{
[Statistics logEvent:kStatSettingsOpenSection withParameters:@{kStatName : kStatAuthorization}];
UINavigationController * vc = [self.mainStoryboard
instantiateViewControllerWithIdentifier:@"AuthorizationLoginViewController"];
[self.navigationController pushViewController:vc animated:YES];
}
- (void)community
{
[Statistics logEvent:kStatSettingsOpenSection withParameters:@{kStatName : kStatSocial}];
[Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"community"];
CommunityVC * vc = [[CommunityVC alloc] initWithStyle:UITableViewStyleGrouped];
[self.navigationController pushViewController:vc animated:YES];
}
- (void)help
{
[Statistics logEvent:kStatSettingsOpenSection withParameters:@{kStatName : kStatHelp}];
[Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"help"];
NSString * path = [[NSBundle mainBundle] pathForResource:@"faq" ofType:@"html"];
NSString * html =
[[NSString alloc] initWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
WebViewController * aboutViewController =
[[WebViewController alloc] initWithHtml:html baseUrl:nil andTitleOrNil:L(@"help")];
aboutViewController.openInSafari = YES;
[self.navigationController pushViewController:aboutViewController animated:YES];
}
- (void)about
{
[Statistics logEvent:kStatSettingsOpenSection withParameters:@{kStatName : kStatAbout}];
[Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"about"];
RichTextVC * vc = [[RichTextVC alloc] initWithText:L(@"about_text")];
vc.title = L(@"about_menu_title");
[self.navigationController pushViewController:vc animated:YES];
}
- (void)copyright
{
[Statistics logEvent:kStatSettingsOpenSection withParameters:@{kStatName : kStatCopyright}];
[Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"copyright"];
string s;
GetPlatform().GetReader("copyright.html")->ReadAsString(s);
NSString * str =
[NSString stringWithFormat:@"Version: %@ \n",
[[NSBundle mainBundle] infoDictionary][@"CFBundleVersion"]];
NSString * text = [NSString stringWithFormat:@"%@%@", str, @(s.c_str())];
WebViewController * aboutViewController =
[[WebViewController alloc] initWithHtml:text baseUrl:nil andTitleOrNil:L(@"copyright")];
aboutViewController.openInSafari = YES;
[self.navigationController pushViewController:aboutViewController animated:YES];
}
- (void)rateApp
{
[Statistics logEvent:kStatSettingsOpenSection withParameters:@{kStatName : kStatRate}];
[Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"rate"];
[[UIApplication sharedApplication] rateVersionFrom:@"rate_menu_item"];
}
- (void)reportBug
{
[Statistics logEvent:kStatSettingsOpenSection withParameters:@{kStatName : kStatReport}];
[Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"reportABug"];
struct utsname systemInfo;
uname(&systemInfo);
NSString * machine =
[NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
NSString * device = deviceNames[machine];
if (!device)
device = machine;
NSString * languageCode = [[NSLocale preferredLanguages] firstObject];
NSString * language = [[NSLocale localeWithLocaleIdentifier:kLocaleUsedInSupportEmails]
displayNameForKey:NSLocaleLanguageCode
value:languageCode];
NSString * locale = [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode];
NSString * country = [[NSLocale localeWithLocaleIdentifier:kLocaleUsedInSupportEmails]
displayNameForKey:NSLocaleCountryCode
value:locale];
NSString * bundleVersion =
[[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey];
NSString * text = [NSString stringWithFormat:@"\n\n\n\n- %@ (%@)\n- MAPS.ME %@\n- %@/%@", device,
[UIDevice currentDevice].systemVersion,
bundleVersion, language, country];
NSString * alohalyticsId = [Alohalytics installationId];
if (alohalyticsId)
text = [NSString stringWithFormat:@"%@\n- %@", text, alohalyticsId];
if ([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController * vc = [[MFMailComposeViewController alloc] init];
vc.mailComposeDelegate = self;
[vc setSubject:@"MAPS.ME"];
[vc setToRecipients:@[ kiOSEmail ]];
[vc setMessageBody:text isHTML:NO];
[vc.navigationBar setTintColor:[UIColor whitePrimaryText]];
[self presentViewController:vc animated:YES completion:nil];
}
else
{
NSString * text = [NSString stringWithFormat:L(@"email_error_body"), kiOSEmail];
[[[UIAlertView alloc] initWithTitle:L(@"email_error_title")
message:text
delegate:nil
cancelButtonTitle:L(@"ok")
otherButtonTitles:nil] show];
}
}
- (void)mailComposeController:(MFMailComposeViewController *)controller
didFinishWithResult:(MFMailComposeResult)result
error:(NSError *)error
{
[self dismissViewControllerAnimated:YES completion:nil];
}
@end

View file

@ -5,10 +5,11 @@
+ (instancetype)sharedInfo;
- (instancetype)init __attribute__((unavailable("init is not available")));
@property (nonatomic, readonly) NSString * countryCode;
@property (nonatomic, readonly) NSString * uniqueId;
@property (nonatomic, readonly) NSString * bundleVersion;
@property (nonatomic, readonly) NSUUID * advertisingId;
@property (nonatomic, readonly) NSString * languageId;
@property(nonatomic, readonly) NSString * countryCode;
@property(nonatomic, readonly) NSString * uniqueId;
@property(nonatomic, readonly) NSString * bundleVersion;
@property(nonatomic, readonly) NSUUID * advertisingId;
@property(nonatomic, readonly) NSString * languageId;
@property(nonatomic, readonly) NSDate * buildDate;
@end

View file

@ -1,8 +1,8 @@
#import "AppInfo.h"
#import <AdSupport/ASIdentifierManager.h>
#import <CoreTelephony/CTCarrier.h>
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#import <sys/utsname.h>
#import <AdSupport/ASIdentifierManager.h>
#include "platform/settings.hpp"
@ -10,14 +10,14 @@ extern string const kCountryCodeKey = "CountryCode";
extern string const kUniqueIdKey = "UniqueId";
extern string const kLanguageKey = "Language";
@interface AppInfo ()
@interface AppInfo()
@property (nonatomic) NSString * countryCode;
@property (nonatomic) NSString * uniqueId;
@property (nonatomic) NSString * bundleVersion;
@property (nonatomic) NSString * deviceInfo;
@property (nonatomic) NSUUID * advertisingId;
@property(nonatomic) NSString * countryCode;
@property(nonatomic) NSString * uniqueId;
@property(nonatomic) NSString * bundleVersion;
@property(nonatomic) NSString * deviceInfo;
@property(nonatomic) NSUUID * advertisingId;
@property(nonatomic) NSDate * buildDate;
@end
@ -27,8 +27,7 @@ extern string const kLanguageKey = "Language";
{
static AppInfo * appInfo;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^
{
dispatch_once(&onceToken, ^{
appInfo = [[self alloc] init];
});
return appInfo;
@ -48,23 +47,26 @@ extern string const kLanguageKey = "Language";
{
CTTelephonyNetworkInfo * networkInfo = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier * carrier = networkInfo.subscriberCellularProvider;
if ([carrier.isoCountryCode length]) // if device can access sim card info
if ([carrier.isoCountryCode length]) // if device can access sim card info
_countryCode = [carrier.isoCountryCode uppercaseString];
else // else, getting system country code
else // else, getting system country code
_countryCode = [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] uppercaseString];
std::string codeString;
if (settings::Get(kCountryCodeKey, codeString)) // if country code stored in settings
if (settings::Get(kCountryCodeKey, codeString)) // if country code stored in settings
{
if (carrier.isoCountryCode) // if device can access sim card info
settings::Set(kCountryCodeKey, std::string([_countryCode UTF8String])); // then save new code instead
if (carrier.isoCountryCode) // if device can access sim card info
settings::Set(kCountryCodeKey,
std::string([_countryCode UTF8String])); // then save new code instead
else
_countryCode = @(codeString.c_str()); // if device can NOT access sim card info then using saved code
_countryCode =
@(codeString.c_str()); // if device can NOT access sim card info then using saved code
}
else
{
if (_countryCode)
settings::Set(kCountryCodeKey, std::string([_countryCode UTF8String])); // saving code first time
settings::Set(kCountryCodeKey,
std::string([_countryCode UTF8String])); // saving code first time
else
_countryCode = @"";
}
@ -77,14 +79,14 @@ extern string const kLanguageKey = "Language";
if (!_uniqueId)
{
string uniqueString;
if (settings::Get(kUniqueIdKey, uniqueString)) // if id stored in settings
if (settings::Get(kUniqueIdKey, uniqueString)) // if id stored in settings
{
_uniqueId = @(uniqueString.c_str());
}
else // if id not stored in settings
else // if id not stored in settings
{
_uniqueId = [[UIDevice currentDevice].identifierForVendor UUIDString];
if (_uniqueId) // then saving in settings
if (_uniqueId) // then saving in settings
settings::Set(kUniqueIdKey, std::string([_uniqueId UTF8String]));
}
}
@ -115,4 +117,20 @@ extern string const kLanguageKey = "Language";
return languages.count == 0 ? nil : languages[0];
}
- (NSDate *)buildDate
{
if (!_buildDate)
{
NSString * dateStr =
[NSString stringWithFormat:@"%@ %@", [NSString stringWithUTF8String:__DATE__],
[NSString stringWithUTF8String:__TIME__]];
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"LLL d yyyy HH:mm:ss"];
[dateFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]];
_buildDate = [dateFormatter dateFromString:dateStr];
}
return _buildDate;
}
@end