@@ -137,8 +137,8 @@ - (void)hmiLevel:(SDLHMILevel)oldLevel didChangeToLevel:(SDLHMILevel)newLevel {
137
137
// check current HMI level of the app
138
138
if ([SDLHMILevelFull isEqualToEnum: newLevel] && !self.hasFirstHMIFullOccurred ) {
139
139
self.firstHMIFullOccurred = YES ;
140
- // the app is just started by the user. Send everything needed to be done once
141
- [self sendWelcomeMessageWithSpeak :YES ];
140
+ // The app is just started by the user. Send everything needed to be done once and start on the current weather screen
141
+ [self sendWeatherConditions: [WeatherDataManager sharedManager ].weatherConditions withSpeak: YES firstWindow :YES ];
142
142
[self sendDefaultGlobalProperties ];
143
143
[self preloadChangeUnitsChoices ];
144
144
@@ -215,7 +215,7 @@ - (void)handleWeatherDataUpdate:(NSNotification *)notification {
215
215
MWInfoType infoType = self.currentInfoType ;
216
216
if ([MWInfoTypeWeatherConditions isEqualToString: infoType]) {
217
217
WeatherConditions *conditions = notification.userInfo [@" weatherConditions" ];
218
- [self sendWeatherConditions: conditions withSpeak: NO ];
218
+ [self sendWeatherConditions: conditions withSpeak: NO firstWindow: NO ];
219
219
} else if ([MWInfoTypeDailyForecast isEqualToString: infoType]) {
220
220
NSArray *forecast = notification.userInfo [@" dailyForecast" ];
221
221
[self sendForecastList: forecast infoType: infoType withSpeak: NO ];
@@ -299,24 +299,7 @@ - (void)presentForecastInteractionWithList:(NSArray *)forecasts ofType:(MWInfoTy
299
299
300
300
#pragma mark - Template updates
301
301
302
- - (void )sendWelcomeMessageWithSpeak : (BOOL )withSpeak {
303
- self.currentInfoType = MWInfoTypeNone;
304
- [self .manager.screenManager beginUpdates ];
305
- self.manager .screenManager .textField1 = self.localization [@" show.welcome.field1" ];
306
- self.manager .screenManager .textField2 = self.localization [@" show.welcome.field2" ];
307
- self.manager .screenManager .textField3 = self.localization [@" show.welcome.field3" ];
308
- self.manager .screenManager .textField4 = self.localization [@" show.welcome.field4" ];
309
- self.manager .screenManager .textAlignment = SDLTextAlignmentCenter;
310
- self.manager .screenManager .softButtonObjects = [self buildDefaultSoftButtons ];
311
- [self .manager.screenManager endUpdatesWithCompletionHandler: nil ];
312
-
313
- if (withSpeak) {
314
- SDLSpeak *speak = [[SDLSpeak alloc ] initWithTTS: self .localization[@" speak.welcome" ]];
315
- [self .manager sendRequest: speak];
316
- }
317
- }
318
-
319
- - (void )sendWeatherConditions : (WeatherConditions *)conditions withSpeak : (BOOL )withSpeak {
302
+ - (void )sendWeatherConditions : (WeatherConditions *)conditions withSpeak : (BOOL )withSpeak firstWindow : (BOOL )firstWindow {
320
303
if (conditions == nil ) {
321
304
SDLAlertView *alertRequest = [[SDLAlertView alloc ] initWithText: self .localization[@" alert.no-conditions.field1" ] secondaryText: self .localization[@" alert.no-conditions.field2" ] tertiaryText: nil timeout: @(10 ) showWaitIndicator: nil audioIndication: [[SDLAlertAudioData alloc ] initWithSpeechSynthesizerString: self .localization[@" alert.no-forecast.prompt" ]] buttons: nil icon: nil ];
322
305
[self .manager.screenManager presentAlert: alertRequest withCompletionHandler: nil ];
@@ -353,7 +336,15 @@ - (void)sendWeatherConditions:(WeatherConditions *)conditions withSpeak:(BOOL)wi
353
336
[self .manager.screenManager endUpdatesWithCompletionHandler: nil ];
354
337
355
338
if (withSpeak) {
356
- SDLSpeak *speakRequest = [[SDLSpeak alloc ] initWithTTS: [self .localization stringForKey: @" conditions.speak" , conditions.conditionTitle, [conditions.temperature stringValueForUnit: temperatureType shortened: NO localization: self .localization], [conditions.humidity stringValueForUnit: percentageType shortened: NO localization: self .localization], [conditions.windSpeed stringValueForUnit: speedType shortened: NO localization: self .localization]]];
339
+ SDLSpeak *speakRequest;
340
+ SDLTTSChunk *welcomeTTS = [[SDLTTSChunk alloc ] initWithText: self .localization[@" speak.welcome" ] type: SDLSpeechCapabilitiesText];
341
+ SDLTTSChunk *weatherConditionTTS = [[SDLTTSChunk alloc ] initWithText: [self .localization stringForKey: @" conditions.speak" , conditions.conditionTitle, [conditions.temperature stringValueForUnit: temperatureType shortened: NO localization: self .localization], [conditions.humidity stringValueForUnit: percentageType shortened: NO localization: self .localization], [conditions.windSpeed stringValueForUnit: speedType shortened: NO localization: self .localization]] type: SDLSpeechCapabilitiesText];
342
+ if (firstWindow) {
343
+ speakRequest = [[SDLSpeak alloc ] initWithTTSChunks: @[welcomeTTS, weatherConditionTTS]];
344
+ } else {
345
+ speakRequest = [[SDLSpeak alloc ] initWithTTSChunks: @[weatherConditionTTS]];
346
+ }
347
+
357
348
[self .manager sendRequest: speakRequest];
358
349
}
359
350
}
@@ -593,7 +584,7 @@ - (void)closeListInfoType:(MWInfoType)infoType {
593
584
[self setCurrentInfoTypeList: nil ];
594
585
self.currentInfoTypeListIndex = -1 ;
595
586
596
- [self sendWelcomeMessageWithSpeak :NO ];
587
+ [self sendWeatherConditions: [WeatherDataManager sharedManager ].weatherConditions withSpeak: NO firstWindow :NO ];
597
588
[self sendDefaultGlobalProperties ];
598
589
599
590
self.manager .screenManager .menu = [self weatherMenuCells ];
@@ -602,7 +593,7 @@ - (void)closeListInfoType:(MWInfoType)infoType {
602
593
- (void )repeatWeatherInformation {
603
594
MWInfoType infoType = self.currentInfoType ;
604
595
if ([MWInfoTypeWeatherConditions isEqualToString: infoType]) {
605
- [self sendWeatherConditions: [WeatherDataManager sharedManager ].weatherConditions withSpeak: YES ];
596
+ [self sendWeatherConditions: [WeatherDataManager sharedManager ].weatherConditions withSpeak: YES firstWindow: NO ];
606
597
} else if ([MWInfoTypeDailyForecast isEqualToString: infoType] || [MWInfoTypeHourlyForecast isEqualToString: infoType]) {
607
598
[self showForecastAtIndex: self .currentInfoTypeListIndex fromList: self .currentInfoTypeList infoType: infoType withSpeak: YES ];
608
599
} else if ([MWInfoTypeAlerts isEqualToString: infoType]) {
@@ -620,7 +611,7 @@ - (void)repeatWeatherInformation {
620
611
return ;
621
612
}
622
613
623
- [weakSelf sendWeatherConditions: [WeatherDataManager sharedManager ].weatherConditions withSpeak: YES ];
614
+ [weakSelf sendWeatherConditions: [WeatherDataManager sharedManager ].weatherConditions withSpeak: YES firstWindow: NO ];
624
615
}];
625
616
626
617
SDLSoftButtonState *dailyForecastState = [[SDLSoftButtonState alloc ] initWithStateName: @" state" text: self .localization[@" sb.daily" ] image: [[UIImage imageNamed: @" menu-day" ] imageWithRenderingMode: UIImageRenderingModeAlwaysTemplate]];
@@ -722,7 +713,7 @@ - (void)repeatWeatherInformation {
722
713
- (NSArray <SDLMenuCell *> *)weatherMenuCells {
723
714
__weak typeof (self) weakSelf = self;
724
715
SDLMenuCell *showWeatherConditions = [[SDLMenuCell alloc ] initWithTitle: self .localization[@" cmd.current-conditions" ] secondaryText: nil tertiaryText: nil icon: [[SDLArtwork alloc ] initWithImage: [[UIImage imageNamed: @" clear-day" ] imageWithRenderingMode: UIImageRenderingModeAlwaysTemplate] persistent: YES asImageFormat: SDLArtworkImageFormatPNG] secondaryArtwork: nil voiceCommands: @[self .localization[@" vr.current" ],self .localization[@" vr.conditions" ], self .localization[@" vr.current-conditions" ], self .localization[@" vr.show-conditions" ], self .localization[@" vr.show-current-conditions" ]] handler: ^(SDLTriggerSource _Nonnull triggerSource) {
725
- [weakSelf sendWeatherConditions: [WeatherDataManager sharedManager ].weatherConditions withSpeak: YES ];
716
+ [weakSelf sendWeatherConditions: [WeatherDataManager sharedManager ].weatherConditions withSpeak: YES firstWindow: NO ];
726
717
}];
727
718
728
719
SDLMenuCell *showDailyForecast = [[SDLMenuCell alloc ] initWithTitle: self .localization[@" cmd.daily-forecast" ] secondaryText: nil tertiaryText: nil icon: [[SDLArtwork alloc ] initWithImage: [[UIImage imageNamed: @" menu-day" ] imageWithRenderingMode: UIImageRenderingModeAlwaysTemplate] persistent: YES asImageFormat: SDLArtworkImageFormatPNG] secondaryArtwork: nil voiceCommands: @[self .localization[@" vr.daily" ], self .localization[@" vr.daily-forecast" ], self .localization[@" vr.show-daily-forecast" ]] handler: ^(SDLTriggerSource _Nonnull triggerSource) {
0 commit comments