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 16:15:49 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 03:01:06 +0300
commitec9e089cb5f9078a952a1edaea80d679c2f8241b (patch)
treef378852c649dabbe9ccb2feca5f30ccbc3618502 /iphone
parentd87f145c7e5483dd3130b9208ed8ca445c5602b1 (diff)
Corrections after colleagues comments.
Diffstat (limited to 'iphone')
-rw-r--r--iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.mm6
-rw-r--r--iphone/Maps/Classes/CustomViews/NavigationDashboard/Sound/MWMTextToSpeech.h7
-rw-r--r--iphone/Maps/Classes/CustomViews/NavigationDashboard/Sound/MWMTextToSpeech.mm32
3 files changed, 19 insertions, 26 deletions
diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.mm b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.mm
index 17c92801ed..960f85a423 100644
--- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.mm
+++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/MWMNavigationDashboardManager.mm
@@ -12,7 +12,7 @@
#import "MWMNavigationDashboardEntity.h"
#import "MWMNavigationDashboardManager.h"
#import "MWMRoutePreview.h"
-#import "MwmTextToSpeech.h"
+#import "MWMTextToSpeech.h"
@interface MWMNavigationDashboardManager ()
@@ -27,8 +27,8 @@
@property (weak, nonatomic) UIView * ownerView;
@property (weak, nonatomic) id<MWMNavigationDashboardManagerProtocol> delegate;
-@property (nonatomic, readwrite) MWMNavigationDashboardEntity * entity;
-@property (nonatomic, readwrite) MWMTextToSpeech * tts;
+@property (nonatomic) MWMNavigationDashboardEntity * entity;
+@property (nonatomic) MWMTextToSpeech * tts;
@end
@implementation MWMNavigationDashboardManager
diff --git a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Sound/MWMTextToSpeech.h b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Sound/MWMTextToSpeech.h
index 608bcfb2fe..ab481d3fb2 100644
--- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Sound/MWMTextToSpeech.h
+++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Sound/MWMTextToSpeech.h
@@ -2,7 +2,7 @@
// MWMTextToSpeech.h
// Maps
//
-// Created by Vladimir Byko-Ianko on 10.08.15.
+// Created by vbykoianko on 10.08.15.
// Copyright (c) 2015 MapsWithMe. All rights reserved.
//
@@ -11,10 +11,9 @@
#include "std/string.hpp"
#include "std/vector.hpp"
-
-@interface MWMTextToSpeech : NSObject
+@interface MWMTextToSpeech : NSObject
- (instancetype)init;
-- (void)speakNotifications: (vector<string> const &)turnNotifications;
+- (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 da113203ac..c6f900bc69 100644
--- a/iphone/Maps/Classes/CustomViews/NavigationDashboard/Sound/MWMTextToSpeech.mm
+++ b/iphone/Maps/Classes/CustomViews/NavigationDashboard/Sound/MWMTextToSpeech.mm
@@ -2,18 +2,18 @@
// MWMTextToSpeech.cpp
// Maps
//
-// Created by Vladimir Byko-Ianko on 10.08.15.
+// Created by vbykoianko on 10.08.15.
// Copyright (c) 2015 MapsWithMe. All rights reserved.
//
#import <AVFoundation/AVFoundation.h>
+#import "Common.h"
+#import "MWMTextToSpeech.h"
-#include "MWMTextToSpeech.h"
#include "Framework.h"
-
@interface MWMTextToSpeech()
-@property (readwrite, nonatomic, strong) AVSpeechSynthesizer *speechSynthesizer;
+@property (nonatomic) AVSpeechSynthesizer * speechSynthesizer;
@property (nonatomic) AVSpeechSynthesisVoice * speechVoice;
@property (nonatomic) float speechRate;
@end
@@ -31,15 +31,12 @@
// [AVSpeechSynthesisVoice currentLanguageCode] is used now because of we need a language code in BCP-47.
[self setLocaleIfAvailable:[AVSpeechSynthesisVoice currentLanguageCode]];
// iOS has an issue with speechRate. AVSpeechUtteranceDefaultSpeechRate does not work correctly. It's a work around.
- if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_7_1)
- self.speechRate = 0.15;
- else
- self.speechRate = 0.3;
+ self.speechRate = isIOSVersionLessThan(@"7.1.1") ? 0.3 : 0.15;
}
return self;
}
-+ (NSString *)TwineFromBCP47:(NSString *)bcp47LangName
++ (NSString *)twineFromBCP47:(NSString *)bcp47LangName
{
NSAssert(bcp47LangName, @"bcp47LangName is nil");
@@ -60,15 +57,14 @@
NSAssert(locale, @"locale is nil");
NSArray * availTtsLangs = [AVSpeechSynthesisVoice speechVoices];
- NSAssert(locale, @"availTtsLangs is nil");
+ NSAssert(availTtsLangs, @"availTtsLangs is nil");
- NSString * localeToSet = locale;
- AVSpeechSynthesisVoice * voiceToSet = [AVSpeechSynthesisVoice voiceWithLanguage:localeToSet];
- if(!voiceToSet || ![availTtsLangs containsObject:voiceToSet])
- localeToSet = @"en-GB";
+ AVSpeechSynthesisVoice * voice = [AVSpeechSynthesisVoice voiceWithLanguage:locale];
+ if(!voice || ![availTtsLangs containsObject:voice])
+ locale = @"en-GB";
- self.speechVoice = [AVSpeechSynthesisVoice voiceWithLanguage:localeToSet];
- GetFramework().SetTurnNotificationsLocale([[MWMTextToSpeech TwineFromBCP47:localeToSet] UTF8String]);
+ self.speechVoice = [AVSpeechSynthesisVoice voiceWithLanguage:locale];
+ GetFramework().SetTurnNotificationsLocale([[MWMTextToSpeech twineFromBCP47:locale] UTF8String]);
}
- (void)speakText:(NSString *)textToSpeak
@@ -83,15 +79,13 @@
[self.speechSynthesizer speakUtterance:utterance];
}
-- (void)speakNotifications: (vector<string> const &)turnNotifications
+- (void)speakNotifications:(vector<string> const &)turnNotifications
{
if (turnNotifications.empty())
return;
for (auto const & text : turnNotifications)
- {
[self speakText:@(text.c_str())];
- }
}
@end