summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Elias <francois.elias@livio.io>2020-10-22 16:07:20 -0400
committerFrank Elias <francois.elias@livio.io>2020-10-22 16:07:20 -0400
commit586cb1fc79fd91814ff0bf134d19b16460dffa9e (patch)
tree36124bcc9c4759593583ca6995d1440602330706
parent4eadcdd3351dacb2b1763663cdec6172edfb4390 (diff)
downloadsdl_ios-586cb1fc79fd91814ff0bf134d19b16460dffa9e.tar.gz
Comment review
Comment review
-rw-r--r--SmartDeviceLink/private/SDLSoftButtonManager.m3
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLSoftButtonManagerSpec.m4
2 files changed, 4 insertions, 3 deletions
diff --git a/SmartDeviceLink/private/SDLSoftButtonManager.m b/SmartDeviceLink/private/SDLSoftButtonManager.m
index efd964151..64573f382 100644
--- a/SmartDeviceLink/private/SDLSoftButtonManager.m
+++ b/SmartDeviceLink/private/SDLSoftButtonManager.m
@@ -125,7 +125,8 @@ NS_ASSUME_NONNULL_BEGIN
// Set the soft button ids. Check to make sure no two soft buttons have the same name, there aren't many soft buttons, so n^2 isn't going to be bad
for (NSUInteger i = 0; i < softButtonObjects.count; i++) {
NSString *buttonName = softButtonObjects[i].name;
- softButtonObjects[i].buttonId = (i * 100) ? (i * 100) : (i + 1);
+ // HAX: Due to a SYNC 3.0 bug (https://github.com/smartdevicelink/sdl_ios/issues/1793#issue-708356008), a `buttonId` can not be zero. As a workaround we will start the `buttonId`s from 1.
+ softButtonObjects[i].buttonId = (i + 1);
for (NSUInteger j = (i + 1); j < softButtonObjects.count; j++) {
if ([softButtonObjects[j].name isEqualToString:buttonName]) {
_softButtonObjects = @[];
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLSoftButtonManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLSoftButtonManagerSpec.m
index 4f708087b..6a5996116 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLSoftButtonManagerSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLSoftButtonManagerSpec.m
@@ -172,8 +172,8 @@ describe(@"a soft button manager", ^{
it(@"should set soft buttons correctly", ^{
expect(testManager.softButtonObjects).toNot(beNil());
- expect(testObject1.buttonId).to(equal(0));
- expect(testObject2.buttonId).to(equal(100));
+ expect(testObject1.buttonId).to(equal(1));
+ expect(testObject2.buttonId).to(equal(2));
expect(testObject1.manager).to(equal(testManager));
expect(testObject2.manager).to(equal(testManager));