Merge pull request #3856 from igrechuhin/MAPSME-1951

[ios] Fixed tts.
This commit is contained in:
Vladimir Byko-Ianko 2016-07-21 09:31:44 +03:00 committed by GitHub
commit adb5442e5e
14 changed files with 96 additions and 58 deletions

View file

@ -197,17 +197,18 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell) {
self.routingInfoPageControl.currentPage =
(self.routingInfoPageControl.currentPage + 1) % self.routingInfoPageControl.numberOfPages;
[self updateNavigationInfo:self.navigationInfo];
[self refreshRoutingDiminishTimer];
}
- (IBAction)routingStartTouchUpInside { [[MWMRouter router] start]; }
- (IBAction)routingStopTouchUpInside { [[MWMRouter router] stop]; }
- (IBAction)soundTouchUpInside:(MWMButton *)sender
{
BOOL const isEnable = !sender.selected;
BOOL const isEnable = sender.selected;
[Statistics logEvent:kStatEventName(kStatNavigationDashboard, isEnable ? kStatOn : kStatOff)];
sender.coloring = isEnable ? MWMButtonColoringGray : MWMButtonColoringBlue;
sender.coloring = isEnable ? MWMButtonColoringBlue : MWMButtonColoringGray;
[MWMTextToSpeech tts].active = isEnable;
sender.selected = isEnable;
[self refreshRoutingDiminishTimer];
}
#pragma mark - Refresh Collection View layout
@ -253,7 +254,7 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell) {
MWMButton * ttsButton = self.ttsSoundButton;
ttsButton.hidden = isPedestrianRouting || ![MWMTextToSpeech isTTSEnabled];
if (!ttsButton.hidden)
ttsButton.selected = [MWMTextToSpeech tts].active;
ttsButton.selected = ![MWMTextToSpeech tts].active;
}
#pragma mark - UICollectionViewDataSource
@ -619,6 +620,7 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell) {
[_ttsSoundButton setImage:[UIImage imageNamed:@"ic_voice_off"] forState:UIControlStateSelected];
[_ttsSoundButton setImage:[UIImage imageNamed:@"ic_voice_off"]
forState:UIControlStateSelected | UIControlStateHighlighted];
[self ttsButtonStatusChanged:nil];
}
@end

View file

@ -3,7 +3,7 @@
@interface MWMTextToSpeech : NSObject
+ (instancetype)tts;
+ (MWMTextToSpeech *)tts;
+ (BOOL)isTTSEnabled;
+ (void)setTTSEnabled:(BOOL)enabled;
+ (NSString *)savedLanguage;

View file

@ -56,7 +56,7 @@ vector<pair<string, string>> availableLanguages()
@implementation MWMTextToSpeech
+ (instancetype)tts
+ (MWMTextToSpeech *)tts
{
static dispatch_once_t onceToken;
static MWMTextToSpeech * tts = nil;
@ -106,6 +106,7 @@ vector<pair<string, string>> availableLanguages()
{
LOG(LWARNING, ("[ setCategory]] error.", [err localizedDescription]));
}
self.active = YES;
}
return self;
}
@ -145,10 +146,12 @@ vector<pair<string, string>> availableLanguages()
if (active && ![self isValid])
[self createSynthesizer];
GetFramework().EnableTurnNotifications(active ? true : false);
[[NSNotificationCenter defaultCenter]
postNotificationName:[MWMTextToSpeech ttsStatusNotificationKey]
object:nil
userInfo:nil];
runAsyncOnMainQueue(^{
[[NSNotificationCenter defaultCenter]
postNotificationName:[MWMTextToSpeech ttsStatusNotificationKey]
object:nil
userInfo:nil];
});
}
- (BOOL)active

View file

@ -19,5 +19,8 @@
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}

View file

@ -2,22 +2,25 @@
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "round_then.png"
"filename" : "round_then.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "round_then@2x.png"
"filename" : "round_then@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "round_then@3x.png"
"filename" : "round_then@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}

View file

@ -2,22 +2,25 @@
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "sharp_left_then.png"
"filename" : "sharp_left_then.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "sharp_left_then@2x.png"
"filename" : "sharp_left_then@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "sharp_left_then@3x.png"
"filename" : "sharp_left_then@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}

View file

@ -2,22 +2,25 @@
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "sharp_right_then.png"
"filename" : "sharp_right_then.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "sharp_right_then@2x.png"
"filename" : "sharp_right_then@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "sharp_right_then@3x.png"
"filename" : "sharp_right_then@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}

View file

@ -2,22 +2,25 @@
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "simple_left_then.png"
"filename" : "simple_left_then.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "simple_left_then@2x.png"
"filename" : "simple_left_then@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "simple_left_then@3x.png"
"filename" : "simple_left_then@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}

View file

@ -2,22 +2,25 @@
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "simple_right_then.png"
"filename" : "simple_right_then.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "simple_right_then@2x.png"
"filename" : "simple_right_then@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "simple_right_then@3x.png"
"filename" : "simple_right_then@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}

View file

@ -2,22 +2,25 @@
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "slight_left_then.png"
"filename" : "slight_left_then.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "slight_left_then@2x.png"
"filename" : "slight_left_then@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "slight_left_then@3x.png"
"filename" : "slight_left_then@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}

View file

@ -2,22 +2,25 @@
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "slight_right_then.png"
"filename" : "slight_right_then.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "slight_right_then@2x.png"
"filename" : "slight_right_then@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "slight_right_then@3x.png"
"filename" : "slight_right_then@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}

View file

@ -2,22 +2,25 @@
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "straight_then.png"
"filename" : "straight_then.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "straight_then@2x.png"
"filename" : "straight_then@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "straight_then@3x.png"
"filename" : "straight_then@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}

View file

@ -19,5 +19,8 @@
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}

View file

@ -19,5 +19,8 @@
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}