summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlapinskijw <jlapinski.dev@gmail.com>2020-05-05 10:13:13 -0400
committerlapinskijw <jlapinski.dev@gmail.com>2020-05-05 10:13:13 -0400
commiteacb44fd09ca3148d6b1f9713d947d1ae7ab9cf9 (patch)
treee0c09fc0a84f0060d84dca664322495ae56489d9
parent92c172b8460b16554ab7678247130e71ffe32884 (diff)
downloadsdl_ios-eacb44fd09ca3148d6b1f9713d947d1ae7ab9cf9.tar.gz
added button press mode to initializer and updated SDLButtonPressSpec tests
-rw-r--r--SmartDeviceLink/SDLButtonPress.h5
-rw-r--r--SmartDeviceLink/SDLButtonPress.m3
-rw-r--r--SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLButtonPressSpec.m3
3 files changed, 7 insertions, 4 deletions
diff --git a/SmartDeviceLink/SDLButtonPress.h b/SmartDeviceLink/SDLButtonPress.h
index 56b9bcadd..f22d870fe 100644
--- a/SmartDeviceLink/SDLButtonPress.h
+++ b/SmartDeviceLink/SDLButtonPress.h
@@ -24,7 +24,7 @@ Constructs a newly allocated SDLButtonPress object with the given parameters
@return An instance of the SDLButtonPress class.
*/
-- (instancetype)initWithButtonName:(SDLButtonName)buttonName moduleType:(SDLModuleType)moduleType __deprecated_msg(("Use initWithButtonName:moduleType:moduleId: instead"));;
+- (instancetype)initWithButtonName:(SDLButtonName)buttonName moduleType:(SDLModuleType)moduleType __deprecated_msg(("Use initWithButtonName:moduleType:moduleId:buttonPressMode: instead"));;
/**
Constructs a newly allocated SDLButtonPress object with the given parameters
@@ -32,10 +32,11 @@ Constructs a newly allocated SDLButtonPress object with the given parameters
@param buttonName the name of the button
@param moduleType the module where the button should be pressed
@param moduleId the id of the module
+@param buttonPressMode indicates LONG or SHORT button press event
@return An instance of the SDLButtonPress class.
*/
-- (instancetype)initWithButtonName:(SDLButtonName)buttonName moduleType:(SDLModuleType)moduleType moduleId:(nullable NSString *)moduleId;
+- (instancetype)initWithButtonName:(SDLButtonName)buttonName moduleType:(SDLModuleType)moduleType moduleId:(nullable NSString *)moduleId buttonPressMode:(SDLButtonPressMode)buttonPressMode;
/**
* The module where the button should be pressed.
diff --git a/SmartDeviceLink/SDLButtonPress.m b/SmartDeviceLink/SDLButtonPress.m
index 4f215c206..4feb9a73f 100644
--- a/SmartDeviceLink/SDLButtonPress.m
+++ b/SmartDeviceLink/SDLButtonPress.m
@@ -32,7 +32,7 @@ NS_ASSUME_NONNULL_BEGIN
return self;
}
-- (instancetype)initWithButtonName:(SDLButtonName)buttonName moduleType:(SDLModuleType)moduleType moduleId:(nullable NSString *)moduleId {
+- (instancetype)initWithButtonName:(SDLButtonName)buttonName moduleType:(SDLModuleType)moduleType moduleId:(nullable NSString *)moduleId buttonPressMode:(SDLButtonPressMode)buttonPressMode {
self = [self init];
if (!self) {
return nil;
@@ -41,6 +41,7 @@ NS_ASSUME_NONNULL_BEGIN
self.buttonName = buttonName;
self.moduleType = moduleType;
self.moduleId = moduleId;
+ self.buttonPressMode = buttonPressMode;
return self;
}
diff --git a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLButtonPressSpec.m b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLButtonPressSpec.m
index 23f2b4916..4b6b35060 100644
--- a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLButtonPressSpec.m
+++ b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLButtonPressSpec.m
@@ -54,11 +54,12 @@ describe(@"Getter/Setter Tests", ^ {
});
it(@"Should get correctly using initializer", ^ {
- SDLButtonPress *testRequest = [[SDLButtonPress alloc] initWithButtonName:SDLButtonNameAC moduleType:SDLModuleTypeClimate moduleId:@"123"];
+ SDLButtonPress *testRequest = [[SDLButtonPress alloc] initWithButtonName:SDLButtonNameAC moduleType:SDLModuleTypeClimate moduleId:@"123" buttonPressMode:SDLButtonPressModeShort];
expect(testRequest.buttonName).to(equal(SDLButtonNameAC));
expect(testRequest.moduleType).to(equal(SDLModuleTypeClimate));
expect(testRequest.moduleId).to(equal(@"123"));
+ expect(testRequest.buttonPressMode).to(equal(SDLButtonPressModeShort));
});
it(@"Should return nil if not set", ^ {