summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2019-07-11 14:00:00 -0400
committerJoel Fischer <joeljfischer@gmail.com>2019-07-11 14:00:00 -0400
commitff9cbce0b2f954a7fdb8e4c8c608c204a603e4df (patch)
treef286ec6880c2e06bd8d96e728bccc9650998559a
parentc819c439e04590f58398db7cf051156603f98e1b (diff)
downloadsdl_ios-ff9cbce0b2f954a7fdb8e4c8c608c204a603e4df.tar.gz
Implement SDL-0186 Template Titles
-rw-r--r--SmartDeviceLink/SDLRPCParameterNames.h1
-rw-r--r--SmartDeviceLink/SDLRPCParameterNames.m1
-rw-r--r--SmartDeviceLink/SDLScreenManager.h5
-rw-r--r--SmartDeviceLink/SDLScreenManager.m4
-rw-r--r--SmartDeviceLink/SDLShow.h7
-rw-r--r--SmartDeviceLink/SDLShow.m8
-rw-r--r--SmartDeviceLink/SDLTextAndGraphicManager.h1
-rw-r--r--SmartDeviceLink/SDLTextAndGraphicManager.m17
8 files changed, 44 insertions, 0 deletions
diff --git a/SmartDeviceLink/SDLRPCParameterNames.h b/SmartDeviceLink/SDLRPCParameterNames.h
index 6e346e357..d1decfe9b 100644
--- a/SmartDeviceLink/SDLRPCParameterNames.h
+++ b/SmartDeviceLink/SDLRPCParameterNames.h
@@ -591,6 +591,7 @@ extern SDLRPCParameterName const SDLRPCParameterNameTemperatureLow;
extern SDLRPCParameterName const SDLRPCParameterNameTemperatureUnit;
extern SDLRPCParameterName const SDLRPCParameterNameTemperatureUnitAvailable;
extern SDLRPCParameterName const SDLRPCParameterNameTemplatesAvailable;
+extern SDLRPCParameterName const SDLRPCParameterNameTemplateTitle;
extern SDLRPCParameterName const SDLRPCParameterNameTertiaryText;
extern SDLRPCParameterName const SDLRPCParameterNameText;
extern SDLRPCParameterName const SDLRPCParameterNameTextFields;
diff --git a/SmartDeviceLink/SDLRPCParameterNames.m b/SmartDeviceLink/SDLRPCParameterNames.m
index 0aae8440d..6af24aff2 100644
--- a/SmartDeviceLink/SDLRPCParameterNames.m
+++ b/SmartDeviceLink/SDLRPCParameterNames.m
@@ -586,6 +586,7 @@ SDLRPCParameterName const SDLRPCParameterNameTemperatureLow = @"temperatureLow";
SDLRPCParameterName const SDLRPCParameterNameTemperatureUnit = @"temperatureUnit";
SDLRPCParameterName const SDLRPCParameterNameTemperatureUnitAvailable = @"temperatureUnitAvailable";
SDLRPCParameterName const SDLRPCParameterNameTemplatesAvailable = @"templatesAvailable";
+SDLRPCParameterName const SDLRPCParameterNameTemplateTitle = @"templateTitle";
SDLRPCParameterName const SDLRPCParameterNameTertiaryText = @"tertiaryText";
SDLRPCParameterName const SDLRPCParameterNameText = @"text";
SDLRPCParameterName const SDLRPCParameterNameTextFields = @"textFields";
diff --git a/SmartDeviceLink/SDLScreenManager.h b/SmartDeviceLink/SDLScreenManager.h
index 1bdb67db4..ce2d2b2d6 100644
--- a/SmartDeviceLink/SDLScreenManager.h
+++ b/SmartDeviceLink/SDLScreenManager.h
@@ -106,6 +106,11 @@ typedef void(^SDLPreloadChoiceCompletionHandler)(NSError *__nullable error);
*/
@property (copy, nonatomic, nullable) SDLMetadataType textField4Type;
+/**
+ The title of the current template layout.
+ */
+@property (copy, nonatomic, nullable) NSString *title;
+
#pragma mark Soft Buttons
/**
diff --git a/SmartDeviceLink/SDLScreenManager.m b/SmartDeviceLink/SDLScreenManager.m
index f93ac21a1..4e5c06314 100644
--- a/SmartDeviceLink/SDLScreenManager.m
+++ b/SmartDeviceLink/SDLScreenManager.m
@@ -126,6 +126,10 @@ NS_ASSUME_NONNULL_BEGIN
self.textAndGraphicManager.textField4Type = textField4Type;
}
+- (void)setTitle:(nullable NSString *)title {
+ self.textAndGraphicManager.title = title;
+}
+
- (void)setSoftButtonObjects:(NSArray<SDLSoftButtonObject *> *)softButtonObjects {
self.softButtonManager.softButtonObjects = softButtonObjects;
}
diff --git a/SmartDeviceLink/SDLShow.h b/SmartDeviceLink/SDLShow.h
index 833a3dea1..f0b363b1c 100644
--- a/SmartDeviceLink/SDLShow.h
+++ b/SmartDeviceLink/SDLShow.h
@@ -246,6 +246,13 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (strong, nonatomic, nullable) SDLMetadataTags *metadataTags;
+/**
+ The title of the current template.
+
+ How this will be displayed is dependent on the OEM design and implementation of the template.
+ */
+@property (strong, nonatomic, nullable) NSString *templateTitle;
+
@end
NS_ASSUME_NONNULL_END
diff --git a/SmartDeviceLink/SDLShow.m b/SmartDeviceLink/SDLShow.m
index cb67f1b69..a90949e4f 100644
--- a/SmartDeviceLink/SDLShow.m
+++ b/SmartDeviceLink/SDLShow.m
@@ -204,6 +204,14 @@ NS_ASSUME_NONNULL_BEGIN
return [self.parameters sdl_objectForName:SDLRPCParameterNameMetadataTags ofClass:SDLMetadataTags.class error:nil];
}
+- (void)setTemplateTitle:(nullable NSString *)templateTitle {
+ [self.parameters sdl_setObject:templateTitle forName:SDLRPCParameterNameTemplateTitle];
+}
+
+- (nullable NSString *)templateTitle {
+ return [self.parameters sdl_objectForName:SDLRPCParameterNameTemplateTitle ofClass:NSString.class error:nil];
+}
+
@end
NS_ASSUME_NONNULL_END
diff --git a/SmartDeviceLink/SDLTextAndGraphicManager.h b/SmartDeviceLink/SDLTextAndGraphicManager.h
index a3a9c23be..48c9c7332 100644
--- a/SmartDeviceLink/SDLTextAndGraphicManager.h
+++ b/SmartDeviceLink/SDLTextAndGraphicManager.h
@@ -36,6 +36,7 @@ typedef void(^SDLTextAndGraphicUpdateCompletionHandler)(NSError *__nullable erro
@property (copy, nonatomic, nullable) NSString *textField3;
@property (copy, nonatomic, nullable) NSString *textField4;
@property (copy, nonatomic, nullable) NSString *mediaTrackTextField;
+@property (copy, nonatomic, nullable) NSString *title;
@property (strong, nonatomic, nullable) SDLArtwork *primaryGraphic;
@property (strong, nonatomic, nullable) SDLArtwork *secondaryGraphic;
diff --git a/SmartDeviceLink/SDLTextAndGraphicManager.m b/SmartDeviceLink/SDLTextAndGraphicManager.m
index 3c3395f14..5692ddaf3 100644
--- a/SmartDeviceLink/SDLTextAndGraphicManager.m
+++ b/SmartDeviceLink/SDLTextAndGraphicManager.m
@@ -282,6 +282,12 @@ NS_ASSUME_NONNULL_BEGIN
} else {
show.mediaTrack = @"";
}
+
+ if (self.title != nil) {
+ show.templateTitle = self.title;
+ } else {
+ show.templateTitle = @"";
+ }
NSArray *nonNilFields = [self sdl_findNonNilTextFields];
if (nonNilFields.count == 0) { return show; }
@@ -435,6 +441,7 @@ NS_ASSUME_NONNULL_BEGIN
show.mainField3 = @"";
show.mainField4 = @"";
show.mediaTrack = @"";
+ show.templateTitle = @"";
return show;
}
@@ -448,6 +455,7 @@ NS_ASSUME_NONNULL_BEGIN
newShow.mainField3 = show.mainField3;
newShow.mainField4 = show.mainField4;
newShow.mediaTrack = show.mediaTrack;
+ newShow.templateTitle = show.templateTitle;
newShow.metadataTags = show.metadataTags;
return newShow;
@@ -481,6 +489,7 @@ NS_ASSUME_NONNULL_BEGIN
self.currentScreenData.mainField3 = show.mainField3 ?: self.currentScreenData.mainField3;
self.currentScreenData.mainField4 = show.mainField4 ?: self.currentScreenData.mainField4;
self.currentScreenData.mediaTrack = show.mediaTrack ?: self.currentScreenData.mediaTrack;
+ self.currentScreenData.templateTitle = show.templateTitle ?: self.currentScreenData.templateTitle;
self.currentScreenData.metadataTags = show.metadataTags ?: self.currentScreenData.metadataTags;
self.currentScreenData.alignment = show.alignment ?: self.currentScreenData.alignment;
self.currentScreenData.graphic = show.graphic ?: self.currentScreenData.graphic;
@@ -596,6 +605,14 @@ NS_ASSUME_NONNULL_BEGIN
}
}
+- (void)setTitle:(nullable NSString *)title {
+ _title = title;
+ _isDirty = YES;
+ if (!self.isBatchingUpdates) {
+ [self updateWithCompletionHandler:nil];
+ }
+}
+
- (void)setPrimaryGraphic:(nullable SDLArtwork *)primaryGraphic {
_primaryGraphic = primaryGraphic;
_isDirty = YES;