Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/iphone
diff options
context:
space:
mode:
authorVladimir Byko-Ianko <v.bykoianko@corp.mail.ru>2015-08-11 15:51:04 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 03:01:06 +0300
commitd87f145c7e5483dd3130b9208ed8ca445c5602b1 (patch)
tree9d9aae7bca4ce9ca83fdba474fda145bceed27c0 /iphone
parentd53a7da394a48a1c1e703b2cc1eed1889eb5e12b (diff)
iOS. Switch on-off sound turn notifications by enterying ?sound or ?nosound.
Diffstat (limited to 'iphone')
-rw-r--r--iphone/Maps/Classes/CustomViews/NavigationDashboard/Sound/MWMTextToSpeech.h2
-rw-r--r--iphone/Maps/Classes/CustomViews/NavigationDashboard/Sound/MWMTextToSpeech.mm10
-rw-r--r--iphone/Maps/Classes/SearchView.mm26
3 files changed, 24 insertions, 14 deletions
diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Sound/MWMTextToSpeech.h b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Sound/MWMTextToSpeech.h
index ee69b84696..608bcfb2fe 100644
--- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Sound/MWMTextToSpeech.h
+++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Sound/MWMTextToSpeech.h
@@ -15,8 +15,6 @@
@interface MWMTextToSpeech : NSObject
- (instancetype)init;
-- (bool)isEnabled;
-- (void)enable:(bool)enalbed;
- (void)speakNotifications: (vector<string> const &)turnNotifications;
@end
diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Sound/MWMTextToSpeech.mm b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Sound/MWMTextToSpeech.mm
index 3d6da4898d..da113203ac 100644
--- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Sound/MWMTextToSpeech.mm
+++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Sound/MWMTextToSpeech.mm
@@ -83,16 +83,6 @@
[self.speechSynthesizer speakUtterance:utterance];
}
-- (bool)isEnabled
-{
- return GetFramework().AreTurnNotificationsEnabled();
-}
-
-- (void)enable:(bool)enalbed
-{
- GetFramework().EnableTurnNotifications(enalbed);
-}
-
- (void)speakNotifications: (vector<string> const &)turnNotifications
{
if (turnNotifications.empty())
diff --git a/iphone/Maps/Classes/SearchView.mm b/iphone/Maps/Classes/SearchView.mm
index 21e8fb7867..76bce6c7b6 100644
--- a/iphone/Maps/Classes/SearchView.mm
+++ b/iphone/Maps/Classes/SearchView.mm
@@ -368,7 +368,7 @@ static BOOL keyboardLoaded = NO;
[self setState:SearchViewStateHidden animated:YES];
}
-// TODO: This code only for demonstration purposes and will be removed soon
+// TODO: This code only for demonstration purposes and will be removed soon.
- (BOOL)tryChangeMapStyleCmd:(NSString *)cmd
{
// Hook for shell command on change map style
@@ -388,13 +388,35 @@ static BOOL keyboardLoaded = NO;
return YES;
}
+// TODO: This code only for demonstration purposes and will be removed soon.
+- (BOOL)trySwitchOnTurnSound:(NSString *)cmd
+{
+ // Hook for shell command on change map style
+ BOOL const sound = [cmd isEqualToString:@"?sound"];
+ BOOL const nosound = sound ? NO : [cmd isEqualToString:@"?nosound"];
+
+ if (!sound && !nosound)
+ return NO;
+
+ // turn notification
+ if (sound)
+ GetFramework().EnableTurnNotifications(true);
+ if (nosound)
+ GetFramework().EnableTurnNotifications(false);
+ return YES;
+}
+
- (void)textFieldTextChanged:(id)sender
{
NSString * currentText = self.searchBar.textField.text;
- // TODO: This code only for demonstration purposes and will be removed soon
+ // TODO: This code only for demonstration purposes and will be removed soon.
if ([self tryChangeMapStyleCmd:currentText])
return;
+
+ // TODO: This code only for demonstration purposes and will be removed soon.
+ if ([self trySwitchOnTurnSound:currentText])
+ return;
if ([currentText length])
{