diff options
author | Frank Elias <francois.elias@livio.io> | 2020-09-21 13:20:24 -0400 |
---|---|---|
committer | Frank Elias <francois.elias@livio.io> | 2020-09-21 13:20:24 -0400 |
commit | 81788c680cd4544d947dd52479df09fe5611df04 (patch) | |
tree | 52edc05c8da39c9f231b78c7099dbb082312f5bc | |
parent | c70cfcca62ec61938344fd139e6fb7c43763877f (diff) | |
download | sdl_ios-81788c680cd4544d947dd52479df09fe5611df04.tar.gz |
deprecate autoCompleteText property in SDLKeyboardProperties
deprecate autoCompleteText property in SDLKeyboardProperties
-rw-r--r-- | SmartDeviceLink/public/SDLKeyboardProperties.h | 25 | ||||
-rw-r--r-- | SmartDeviceLink/public/SDLKeyboardProperties.m | 15 | ||||
-rw-r--r-- | SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardPropertiesSpec.m | 21 |
3 files changed, 47 insertions, 14 deletions
diff --git a/SmartDeviceLink/public/SDLKeyboardProperties.h b/SmartDeviceLink/public/SDLKeyboardProperties.h index 5939d398f..3ba15bfff 100644 --- a/SmartDeviceLink/public/SDLKeyboardProperties.h +++ b/SmartDeviceLink/public/SDLKeyboardProperties.h @@ -25,7 +25,17 @@ NS_ASSUME_NONNULL_BEGIN @param autoCompleteList A list of strings to show the user to complete what they are typing. @return The RPC object */ -- (instancetype)initWithLanguage:(nullable SDLLanguage)language layout:(nullable SDLKeyboardLayout)layout keypressMode:(nullable SDLKeypressMode)keypressMode limitedCharacterList:(nullable NSArray<NSString *> *)limitedCharacterList autoCompleteText:(nullable NSString *)autoCompleteText autoCompleteList:(nullable NSArray<NSString *> *)autoCompleteList; +- (instancetype)initWithLanguage:(nullable SDLLanguage)language layout:(nullable SDLKeyboardLayout)layout keypressMode:(nullable SDLKeypressMode)keypressMode limitedCharacterList:(nullable NSArray<NSString *> *)limitedCharacterList autoCompleteText:(nullable NSString *)autoCompleteText autoCompleteList:(nullable NSArray<NSString *> *)autoCompleteList __deprecated_msg("Use initWithLanguage:keyboardLayout:keypressMode:limitedCharacterList:autoCompleteList: instead"); + +/** + * @param language - language + * @param keyboardLayout - keyboardLayout + * @param keypressMode - keypressMode + * @param limitedCharacterList - limitedCharacterList + * @param autoCompleteList - autoCompleteList + * @return A SDLKeyboardProperties object + */ +- (instancetype)initWithLanguage:(nullable SDLLanguage)language keyboardLayout:(nullable SDLKeyboardLayout)keyboardLayout keypressMode:(nullable SDLKeypressMode)keypressMode limitedCharacterList:(nullable NSArray<NSString *> *)limitedCharacterList autoCompleteList:(nullable NSArray<NSString *> *)autoCompleteList; /** The keyboard language @@ -58,11 +68,16 @@ NS_ASSUME_NONNULL_BEGIN @property (nullable, strong, nonatomic) NSArray<NSString *> *limitedCharacterList; /** - Allows an app to prepopulate the text field with a suggested or completed entry as the user types - - Optional + * Deprecated, use autoCompleteList instead. + * {"string_min_length": 1, "string_max_length": 1000} + * + * @deprecated in SmartDeviceLink 6.0.0 + * @added in SmartDeviceLink 3.0.0 */ -@property (nullable, strong, nonatomic) NSString *autoCompleteText; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +@property (nullable, strong, nonatomic) NSString *autoCompleteText __deprecated; +#pragma clang diagnostic pop /** Allows an app to show a list of possible autocomplete suggestions as the user types diff --git a/SmartDeviceLink/public/SDLKeyboardProperties.m b/SmartDeviceLink/public/SDLKeyboardProperties.m index 5f6fa82dd..364a9d6b3 100644 --- a/SmartDeviceLink/public/SDLKeyboardProperties.m +++ b/SmartDeviceLink/public/SDLKeyboardProperties.m @@ -11,16 +11,19 @@ NS_ASSUME_NONNULL_BEGIN @implementation SDLKeyboardProperties - (instancetype)initWithLanguage:(nullable SDLLanguage)language layout:(nullable SDLKeyboardLayout)layout keypressMode:(nullable SDLKeypressMode)keypressMode limitedCharacterList:(nullable NSArray<NSString *> *)limitedCharacterList autoCompleteText:(nullable NSString *)autoCompleteText autoCompleteList:(nullable NSArray<NSString *> *)autoCompleteList { + return [self initWithLanguage:language keyboardLayout:layout keypressMode:keypressMode limitedCharacterList:limitedCharacterList autoCompleteList:autoCompleteList]; +} + +- (instancetype)initWithLanguage:(nullable SDLLanguage)language keyboardLayout:(nullable SDLKeyboardLayout)keyboardLayout keypressMode:(nullable SDLKeypressMode)keypressMode limitedCharacterList:(nullable NSArray<NSString *> *)limitedCharacterList autoCompleteList:(nullable NSArray<NSString *> *)autoCompleteList { self = [self init]; if (!self) { return nil; } self.language = language; - self.keyboardLayout = layout; + self.keyboardLayout = keyboardLayout; self.keypressMode = keypressMode; - self.limitedCharacterList = [limitedCharacterList mutableCopy]; - self.autoCompleteText = autoCompleteText; + self.limitedCharacterList = limitedCharacterList; self.autoCompleteList = autoCompleteList; return self; @@ -58,11 +61,17 @@ NS_ASSUME_NONNULL_BEGIN return [self.store sdl_objectsForName:SDLRPCParameterNameLimitedCharacterList ofClass:NSString.class error:nil]; } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" - (void)setAutoCompleteText:(nullable NSString *)autoCompleteText { +#pragma clang diagnostic pop [self.store sdl_setObject:autoCompleteText forName:SDLRPCParameterNameAutoCompleteText]; } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" - (nullable NSString *)autoCompleteText { +#pragma clang diagnostic pop return [self.store sdl_objectForName:SDLRPCParameterNameAutoCompleteText ofClass:NSString.class error:nil]; } diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardPropertiesSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardPropertiesSpec.m index 7b1e28362..b8a646a8a 100644 --- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardPropertiesSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardPropertiesSpec.m @@ -32,14 +32,12 @@ describe(@"Getter/Setter Tests", ^ { testStruct.keyboardLayout = testLayout; testStruct.keypressMode = testMode; testStruct.limitedCharacterList = testLimitedCharacterList; - testStruct.autoCompleteText = testAutoCompleteText; testStruct.autoCompleteList = testAutoCompleteList; expect(testStruct.language).to(equal(testLanguage)); expect(testStruct.keyboardLayout).to(equal(testLayout)); expect(testStruct.keypressMode).to(equal(testMode)); expect(testStruct.limitedCharacterList).to(equal(testLimitedCharacterList)); - expect(testStruct.autoCompleteText).to(equal(testAutoCompleteText)); expect(testStruct.autoCompleteList).to(equal(testAutoCompleteList)); }); @@ -48,7 +46,6 @@ describe(@"Getter/Setter Tests", ^ { SDLRPCParameterNameKeyboardLayout: testLayout, SDLRPCParameterNameKeypressMode: testMode, SDLRPCParameterNameLimitedCharacterList: testLimitedCharacterList, - SDLRPCParameterNameAutoCompleteText: testAutoCompleteText, SDLRPCParameterNameAutoCompleteList: testAutoCompleteList }; SDLKeyboardProperties* testStruct = [[SDLKeyboardProperties alloc] initWithDictionary:dict]; @@ -57,18 +54,31 @@ describe(@"Getter/Setter Tests", ^ { expect(testStruct.keyboardLayout).to(equal(testLayout)); expect(testStruct.keypressMode).to(equal(testMode)); expect(testStruct.limitedCharacterList).to(equal(testLimitedCharacterList)); - expect(testStruct.autoCompleteText).to(equal(testAutoCompleteText)); expect(testStruct.autoCompleteList).to(equal(testAutoCompleteList)); }); it(@"Should get correctly when initialized with initWithLanguage:layout:keypressMode:limitedCharacterList:autoCompleteText:autoCompleteList:", ^ { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" SDLKeyboardProperties *testStruct = [[SDLKeyboardProperties alloc] initWithLanguage:testLanguage layout:testLayout keypressMode:testMode limitedCharacterList:testLimitedCharacterList autoCompleteText:testAutoCompleteText autoCompleteList:testAutoCompleteList]; +#pragma clang diagnostic pop + expect(testStruct.language).to(equal(testLanguage)); + expect(testStruct.keyboardLayout).to(equal(testLayout)); + expect(testStruct.keypressMode).to(equal(testMode)); + expect(testStruct.limitedCharacterList).to(equal(testLimitedCharacterList)); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + expect(testStruct.autoCompleteText).to(beNil()); +#pragma clang diagnostic pop + expect(testStruct.autoCompleteList).to(equal(testAutoCompleteList)); + }); + it(@"Should get correctly when initialized with initWithLanguage:keyboardLayout:keypressMode:limitedCharacterList:autoCompleteList:", ^ { + SDLKeyboardProperties *testStruct = [[SDLKeyboardProperties alloc] initWithLanguage:testLanguage keyboardLayout:testLayout keypressMode:testMode limitedCharacterList:testLimitedCharacterList autoCompleteList:testAutoCompleteList]; expect(testStruct.language).to(equal(testLanguage)); expect(testStruct.keyboardLayout).to(equal(testLayout)); expect(testStruct.keypressMode).to(equal(testMode)); expect(testStruct.limitedCharacterList).to(equal(testLimitedCharacterList)); - expect(testStruct.autoCompleteText).to(equal(testAutoCompleteText)); expect(testStruct.autoCompleteList).to(equal(testAutoCompleteList)); }); @@ -79,7 +89,6 @@ describe(@"Getter/Setter Tests", ^ { expect(testStruct.keyboardLayout).to(beNil()); expect(testStruct.keypressMode).to(beNil()); expect(testStruct.limitedCharacterList).to(beNil()); - expect(testStruct.autoCompleteText).to(beNil()); expect(testStruct.autoCompleteList).to(beNil()); }); }); |