Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions SmartDeviceLinkService.m
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,14 @@ - (void)presentForecastInteractionWithList:(NSArray *)forecasts ofType:(MWInfoTy
dateFormatShow.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:0];
dateFormatShow.locale = self.localization.locale;

NSRelativeDateTimeFormatter *hourlyDateFormatShow = [[NSRelativeDateTimeFormatter alloc] init];
[hourlyDateFormatShow setUnitsStyle:NSRelativeDateTimeFormatterUnitsStyleShort];
Comment on lines +257 to +258
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get rid of the warnings by moving this to iOS 13.0+


NSDateFormatter *dateFormatSpeak = [[NSDateFormatter alloc] init];
dateFormatSpeak.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:0];
dateFormatSpeak.locale = self.localization.locale;

if (isHourlyForecast) {
dateFormatShow.dateFormat = self.localization[@"forecast.hourly.choice.show"];
dateFormatSpeak.dateFormat = self.localization[@"forecast.hourly.choice.speak"];
} else {
dateFormatShow.dateFormat = self.localization[@"forecast.daily.choice.show"];
Expand All @@ -282,7 +284,9 @@ - (void)presentForecastInteractionWithList:(NSArray *)forecasts ofType:(MWInfoTy
}

NSString *precipitationChanceString = [NSString stringWithFormat:@"Precipitation chance: %@", [forecast.precipitationChance stringValueForUnit:UnitPercentageDefault shortened:YES localization:self.localization]];
SDLChoiceCell *cell = [[SDLChoiceCell alloc] initWithText:[dateFormatShow stringFromDate:forecast.date] secondaryText:precipitationChanceString tertiaryText:nil voiceCommands:[vrCommands copy] artwork:[SDLArtwork artworkWithImage:[[[ImageProcessor sharedProcessor] imageFromConditionImage:forecast.conditionIcon] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] asImageFormat:SDLArtworkImageFormatPNG] secondaryArtwork:nil];
NSString *dateString = isHourlyForecast ? [hourlyDateFormatShow localizedStringForDate:forecast.date relativeToDate:[[NSDate alloc] init]] : [dateFormatShow stringFromDate:forecast.date];

SDLChoiceCell *cell = [[SDLChoiceCell alloc] initWithText:dateString secondaryText:precipitationChanceString tertiaryText:nil voiceCommands:[vrCommands copy] artwork:[SDLArtwork artworkWithImage:[[[ImageProcessor sharedProcessor] imageFromConditionImage:forecast.conditionIcon] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] asImageFormat:SDLArtworkImageFormatPNG] secondaryArtwork:nil];
[choices addObject:cell];
}

Expand Down Expand Up @@ -449,8 +453,8 @@ - (void)showForecastAtIndex:(NSUInteger)index fromList:(NSArray<Forecast *> *)fo
self.manager.screenManager.textField2Type = SDLMetadataTypeMinimumTemperature;

self.manager.screenManager.textField3 = [forecast.lowTemperature stringValueForUnit:temperatureType shortened:YES localization:self.localization];
self.manager.screenManager.textField3Type = SDLMetadataTypeMaximumTemperature
;
self.manager.screenManager.textField3Type = SDLMetadataTypeMaximumTemperature;

self.manager.screenManager.textField4 = [forecast.precipitationChance stringValueForUnit:percentageType shortened:YES localization:self.localization];
}

Expand Down