diff options
author | Frank Elias <francois.elias@livio.io> | 2020-10-16 10:46:14 -0400 |
---|---|---|
committer | Frank Elias <francois.elias@livio.io> | 2020-10-16 10:46:14 -0400 |
commit | 2d6cddfa3666940dc1eebf9526948c10d63aa349 (patch) | |
tree | 9e44425a5c5629a4812b89984aebaef2a41c5da4 | |
parent | 791968d281baba2a3d681df8d24b6233a4377e71 (diff) | |
download | sdl_ios-2d6cddfa3666940dc1eebf9526948c10d63aa349.tar.gz |
Comment Review
Re-set autoCompleteText property
Remove warnings
9 files changed, 26 insertions, 16 deletions
diff --git a/SmartDeviceLink/private/SDLChoiceSetManager.m b/SmartDeviceLink/private/SDLChoiceSetManager.m index 80d691b87..a8a0de0e7 100644 --- a/SmartDeviceLink/private/SDLChoiceSetManager.m +++ b/SmartDeviceLink/private/SDLChoiceSetManager.m @@ -502,7 +502,10 @@ UInt16 const ChoiceCellCancelIdMin = 1; _keyboardConfiguration = [self sdl_defaultKeyboardConfiguration]; } else { SDLLogD(@"Updating keyboard configuration to a new configuration: %@", keyboardConfiguration); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" _keyboardConfiguration = [[SDLKeyboardProperties alloc] initWithLanguage:keyboardConfiguration.language layout:keyboardConfiguration.keyboardLayout keypressMode:SDLKeypressModeResendCurrentEntry limitedCharacterList:keyboardConfiguration.limitedCharacterList autoCompleteText:keyboardConfiguration.autoCompleteText autoCompleteList:keyboardConfiguration.autoCompleteList]; +#pragma clang diagnostic pop if (keyboardConfiguration.keypressMode != SDLKeypressModeResendCurrentEntry) { SDLLogW(@"Attempted to set a keyboard configuration with an invalid keypress mode; only .resentCurrentEntry is valid. This value will be ignored, the rest of the properties will be set."); @@ -511,7 +514,7 @@ UInt16 const ChoiceCellCancelIdMin = 1; } - (SDLKeyboardProperties *)sdl_defaultKeyboardConfiguration { - return [[SDLKeyboardProperties alloc] initWithLanguage:SDLLanguageEnUs layout:SDLKeyboardLayoutQWERTY keypressMode:SDLKeypressModeResendCurrentEntry limitedCharacterList:nil autoCompleteText:nil autoCompleteList:nil]; + return [[SDLKeyboardProperties alloc] initWithLanguage:SDLLanguageEnUs keyboardLayout:SDLKeyboardLayoutQWERTY keypressMode:SDLKeypressModeResendCurrentEntry limitedCharacterList:nil autoCompleteList:nil]; } #pragma mark - Getters diff --git a/SmartDeviceLink/private/SDLPresentChoiceSetOperation.m b/SmartDeviceLink/private/SDLPresentChoiceSetOperation.m index 0788b0b97..f0fbbf28a 100644 --- a/SmartDeviceLink/private/SDLPresentChoiceSetOperation.m +++ b/SmartDeviceLink/private/SDLPresentChoiceSetOperation.m @@ -278,7 +278,10 @@ NS_ASSUME_NONNULL_BEGIN } weakself.keyboardProperties.autoCompleteList = (newList.count > 0) ? newList : @[]; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" weakself.keyboardProperties.autoCompleteText = (newList.count > 0) ? newList.firstObject : nil; +#pragma clang diagnostic pop [weakself sdl_updateKeyboardPropertiesWithCompletionHandler:nil]; }]; } diff --git a/SmartDeviceLink/private/SDLPresentKeyboardOperation.m b/SmartDeviceLink/private/SDLPresentKeyboardOperation.m index 633ccfba6..798e046af 100644 --- a/SmartDeviceLink/private/SDLPresentKeyboardOperation.m +++ b/SmartDeviceLink/private/SDLPresentKeyboardOperation.m @@ -192,7 +192,10 @@ NS_ASSUME_NONNULL_BEGIN } weakself.keyboardProperties.autoCompleteList = (newList.count > 0) ? newList : @[]; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" weakself.keyboardProperties.autoCompleteText = (newList.count > 0) ? newList.firstObject : nil; +#pragma clang diagnostic pop [weakself sdl_updateKeyboardPropertiesWithCompletionHandler:nil]; }]; } diff --git a/SmartDeviceLink/public/SDLKeyboardProperties.h b/SmartDeviceLink/public/SDLKeyboardProperties.h index 3ba15bfff..a538b52bd 100644 --- a/SmartDeviceLink/public/SDLKeyboardProperties.h +++ b/SmartDeviceLink/public/SDLKeyboardProperties.h @@ -28,6 +28,8 @@ NS_ASSUME_NONNULL_BEGIN - (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"); /** + * Convenience init with all properties. + * * @param language - language * @param keyboardLayout - keyboardLayout * @param keypressMode - keypressMode @@ -74,10 +76,7 @@ NS_ASSUME_NONNULL_BEGIN * @deprecated in SmartDeviceLink 6.0.0 * @added in SmartDeviceLink 3.0.0 */ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -@property (nullable, strong, nonatomic) NSString *autoCompleteText __deprecated; -#pragma clang diagnostic pop +@property (nullable, strong, nonatomic) NSString *autoCompleteText __deprecated_msg("Use autoCompleteList instead"); /** 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 364a9d6b3..7adf4ef5a 100644 --- a/SmartDeviceLink/public/SDLKeyboardProperties.m +++ b/SmartDeviceLink/public/SDLKeyboardProperties.m @@ -11,7 +11,9 @@ 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]; + SDLKeyboardProperties *keyboardProperties = [[SDLKeyboardProperties alloc] initWithLanguage:language keyboardLayout:layout keypressMode:keypressMode limitedCharacterList:limitedCharacterList autoCompleteList:autoCompleteList]; + keyboardProperties.autoCompleteText = autoCompleteText; + return keyboardProperties; } - (instancetype)initWithLanguage:(nullable SDLLanguage)language keyboardLayout:(nullable SDLKeyboardLayout)keyboardLayout keypressMode:(nullable SDLKeypressMode)keypressMode limitedCharacterList:(nullable NSArray<NSString *> *)limitedCharacterList autoCompleteList:(nullable NSArray<NSString *> *)autoCompleteList { @@ -61,17 +63,11 @@ 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/DevAPISpecs/SDLChoiceSetManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLChoiceSetManagerSpec.m index 47156d1c0..321a2dde6 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLChoiceSetManagerSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLChoiceSetManagerSpec.m @@ -105,7 +105,7 @@ describe(@"choice set manager tests", ^{ it(@"should be in the correct startup state", ^{ expect(testManager.currentState).to(equal(SDLChoiceManagerStateShutdown)); - SDLKeyboardProperties *defaultProperties = [[SDLKeyboardProperties alloc] initWithLanguage:SDLLanguageEnUs layout:SDLKeyboardLayoutQWERTY keypressMode:SDLKeypressModeResendCurrentEntry limitedCharacterList:nil autoCompleteText:nil autoCompleteList:nil]; + SDLKeyboardProperties *defaultProperties = [[SDLKeyboardProperties alloc] initWithLanguage:SDLLanguageEnUs keyboardLayout:SDLKeyboardLayoutQWERTY keypressMode:SDLKeypressModeResendCurrentEntry limitedCharacterList:nil autoCompleteList:nil]; expect(testManager.keyboardConfiguration).to(equal(defaultProperties)); }); diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLPresentChoiceSetOperationSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLPresentChoiceSetOperationSpec.m index 7ca891608..883720b82 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLPresentChoiceSetOperationSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLPresentChoiceSetOperationSpec.m @@ -60,7 +60,7 @@ describe(@"present choice operation", ^{ testKeyboardDelegate = OCMProtocolMock(@protocol(SDLKeyboardDelegate)); OCMStub([testKeyboardDelegate customKeyboardConfiguration]).andReturn(nil); - testKeyboardProperties = [[SDLKeyboardProperties alloc] initWithLanguage:SDLLanguageArSa layout:SDLKeyboardLayoutAZERTY keypressMode:SDLKeypressModeResendCurrentEntry limitedCharacterList:nil autoCompleteText:nil autoCompleteList:nil]; + testKeyboardProperties = [[SDLKeyboardProperties alloc] initWithLanguage:SDLLanguageArSa keyboardLayout:SDLKeyboardLayoutAZERTY keypressMode:SDLKeypressModeResendCurrentEntry limitedCharacterList:nil autoCompleteList:nil]; }); it(@"should have a priority of 'normal'", ^{ @@ -460,7 +460,10 @@ describe(@"present choice operation", ^{ expect(testConnectionManager.receivedRequests.lastObject).to(beAnInstanceOf([SDLSetGlobalProperties class])); SDLSetGlobalProperties *setProperties = testConnectionManager.receivedRequests.lastObject; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" expect(setProperties.keyboardProperties.autoCompleteText).to(equal(inputData)); +#pragma clang diagnostic pop }); it(@"should respond to text input notification with character set", ^{ diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLPresentKeyboardOperationSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLPresentKeyboardOperationSpec.m index 08424949d..29ed6d0b0 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLPresentKeyboardOperationSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLPresentKeyboardOperationSpec.m @@ -43,7 +43,7 @@ describe(@"present keyboard operation", ^{ testDelegate = OCMProtocolMock(@protocol(SDLKeyboardDelegate)); OCMStub([testDelegate customKeyboardConfiguration]).andReturn(nil); - testInitialProperties = [[SDLKeyboardProperties alloc] initWithLanguage:SDLLanguageArSa layout:SDLKeyboardLayoutAZERTY keypressMode:SDLKeypressModeResendCurrentEntry limitedCharacterList:nil autoCompleteText:nil autoCompleteList:nil]; + testInitialProperties = [[SDLKeyboardProperties alloc] initWithLanguage:SDLLanguageArSa keyboardLayout:SDLKeyboardLayoutAZERTY keypressMode:SDLKeypressModeResendCurrentEntry limitedCharacterList:nil autoCompleteList:nil]; }); it(@"should have a priority of 'normal'", ^{ @@ -194,7 +194,10 @@ describe(@"present keyboard operation", ^{ expect(testConnectionManager.receivedRequests.lastObject).to(beAnInstanceOf([SDLSetGlobalProperties class])); SDLSetGlobalProperties *setProperties = testConnectionManager.receivedRequests.lastObject; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" expect(setProperties.keyboardProperties.autoCompleteText).to(equal(inputData)); +#pragma clang diagnostic pop }); it(@"should respond to text input notification with character set", ^{ diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardPropertiesSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardPropertiesSpec.m index b8a646a8a..63428febf 100644 --- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardPropertiesSpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLKeyboardPropertiesSpec.m @@ -68,7 +68,7 @@ describe(@"Getter/Setter Tests", ^ { expect(testStruct.limitedCharacterList).to(equal(testLimitedCharacterList)); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - expect(testStruct.autoCompleteText).to(beNil()); + expect(testStruct.autoCompleteText).to(equal(testAutoCompleteText)); #pragma clang diagnostic pop expect(testStruct.autoCompleteList).to(equal(testAutoCompleteList)); }); |