diff --git a/SmartDeviceLink/SDLTemplateConfiguration.h b/SmartDeviceLink/SDLTemplateConfiguration.h index 6a2b3a66e..39d0b0df7 100644 --- a/SmartDeviceLink/SDLTemplateConfiguration.h +++ b/SmartDeviceLink/SDLTemplateConfiguration.h @@ -9,7 +9,7 @@ NS_ASSUME_NONNULL_BEGIN /** Used to set an alternate template layout to a window. - + @since SDL 6.0 */ @interface SDLTemplateConfiguration : SDLRPCStruct @@ -22,9 +22,11 @@ NS_ASSUME_NONNULL_BEGIN */ - (instancetype)initWithPredefinedLayout:(SDLPredefinedLayout)predefinedLayout; +// HAX: We are doing this because `template` is a C++ keyword and won't compile. +#ifndef __cplusplus /** Init with the required values. - + @param template Predefined or dynamically created window template. Currently only predefined window template layouts are defined. */ - (instancetype)initWithTemplate:(NSString *)template; @@ -32,7 +34,7 @@ NS_ASSUME_NONNULL_BEGIN /** Convinience constructor with all the parameters. - + @param template Predefined or dynamically created window template. Currently only predefined window template layouts are defined. @param dayColorScheme The color scheme to use when the head unit is in a light / day situation. If nil, the existing color scheme will be used. @param nightColorScheme The color scheme to use when the head unit is in a dark / night situation. @@ -43,6 +45,31 @@ NS_ASSUME_NONNULL_BEGIN Predefined or dynamically created window template. Currently only predefined window template layouts are defined. */ @property (strong, nonatomic) NSString *template; +#endif + +#ifdef __cplusplus +/** + Init with the required values. + + @param templateName Predefined or dynamically created window template. Currently only predefined window template layouts are defined. + */ +- (instancetype)initWithTemplate:(NSString *)templateName; + + +/** + Convinience constructor with all the parameters. + + @param templateName Predefined or dynamically created window template. Currently only predefined window template layouts are defined. + @param dayColorScheme The color scheme to use when the head unit is in a light / day situation. If nil, the existing color scheme will be used. + @param nightColorScheme The color scheme to use when the head unit is in a dark / night situation. + */ +- (instancetype)initWithTemplate:(NSString *)templateName dayColorScheme:(nullable SDLTemplateColorScheme *)dayColorScheme nightColorScheme:(nullable SDLTemplateColorScheme *)nightColorScheme; + +/** + Predefined or dynamically created window template. Currently only predefined window template layouts are defined. + */ +@property (strong, nonatomic) NSString *templateName; +#endif /** The color scheme to use when the head unit is in a light / day situation. diff --git a/SmartDeviceLink/SDLTemplateConfiguration.m b/SmartDeviceLink/SDLTemplateConfiguration.m index 1f2d2cca1..9407a0d33 100644 --- a/SmartDeviceLink/SDLTemplateConfiguration.m +++ b/SmartDeviceLink/SDLTemplateConfiguration.m @@ -14,6 +14,7 @@ - (instancetype)initWithPredefinedLayout:(SDLPredefinedLayout)predefinedLayout { return [self initWithTemplate:predefinedLayout]; } +#ifndef __cplusplus - (instancetype)initWithTemplate:(NSString *)template { self = [super init]; if (!self) { @@ -40,6 +41,36 @@ - (void)setTemplate:(NSString *)template { - (NSString *)template { return [self.store sdl_objectForName:SDLRPCParameterNameTemplate ofClass:NSString.class error:nil]; } +#endif + +#ifdef _cplusplus +- (instancetype)initWithTemplate:(NSString *)templateName { + self = [super init]; + if (!self) { + return nil; + } + self.templateName = templateName; + return self; +} + +- (instancetype)initWithTemplate:(NSString *)templateName dayColorScheme:(nullable SDLTemplateColorScheme *)dayColorScheme nightColorScheme:(nullable SDLTemplateColorScheme *)nightColorScheme; { + self = [self initWithTemplate:templateName]; + if (!self) { + return nil; + } + self.dayColorScheme = dayColorScheme; + self.nightColorScheme = nightColorScheme; + return self; +} + +- (void)setTemplateName:(NSString *)templateName { + [self.store sdl_setObject:template forName:SDLRPCParameterNameTemplate]; +} + +- (NSString *)templateName { + return [self.store sdl_objectForName:SDLRPCParameterNameTemplate ofClass:NSString.class error:nil]; +} +#endif - (void)setDayColorScheme:(nullable SDLTemplateColorScheme *)dayColorScheme { [self.store sdl_setObject:dayColorScheme forName:SDLRPCParameterNameDayColorScheme];