diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2022-04-08 10:10:15 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-08 10:10:15 -0400 |
commit | 4b5b1b8eec59e0f9fb0a48363cf31146369ef3b1 (patch) | |
tree | 76f7f17e57b6e6081bede24f0fa69d5464dec471 | |
parent | faab4b4cec01fbcbccbb53bdb0d4bf02ad6ec9c7 (diff) | |
parent | 762c5808729caafec5e951a190a313e5a4191f9b (diff) | |
download | sdl_ios-4b5b1b8eec59e0f9fb0a48363cf31146369ef3b1.tar.gz |
Merge pull request #2080 from smartdevicelink/bugfix/issue-2079-alert-softbutton-images-on-by-default
Update alert operation soft button image to display if no soft button capability is present
-rw-r--r-- | SmartDeviceLink/private/SDLPresentAlertOperation.m | 8 | ||||
-rw-r--r-- | SmartDeviceLinkTests/SDLPresentAlertOperationSpec.m | 19 |
2 files changed, 25 insertions, 2 deletions
diff --git a/SmartDeviceLink/private/SDLPresentAlertOperation.m b/SmartDeviceLink/private/SDLPresentAlertOperation.m index 6999bf55d..9359106f5 100644 --- a/SmartDeviceLink/private/SDLPresentAlertOperation.m +++ b/SmartDeviceLink/private/SDLPresentAlertOperation.m @@ -335,9 +335,13 @@ static const int SDLAlertSoftButtonCount = 4; } /// Checks if the connected module or current template supports soft button images. -/// @return True if soft button images are currently supported; false if not. +/// @return True if soft button images are currently supported or unknown; false if not. - (BOOL)sdl_supportsSoftButtonImages { - return self.currentWindowCapability.softButtonCapabilities.firstObject.imageSupported.boolValue; + if (self.currentWindowCapability.softButtonCapabilities.count > 0) { + return self.currentWindowCapability.softButtonCapabilities.firstObject.imageSupported.boolValue; + } else { + return YES; + } } /// Checks if the connected module supports audio files. Using an audio file in an alert will only work if connected to modules supporting RPC spec versions 5.0+. If the module does not return a speechCapabilities, assume that the module supports playing an audio file. diff --git a/SmartDeviceLinkTests/SDLPresentAlertOperationSpec.m b/SmartDeviceLinkTests/SDLPresentAlertOperationSpec.m index 599afa415..5e53a7d45 100644 --- a/SmartDeviceLinkTests/SDLPresentAlertOperationSpec.m +++ b/SmartDeviceLinkTests/SDLPresentAlertOperationSpec.m @@ -553,6 +553,25 @@ describe(@"SDLPresentAlertOperation", ^{ OCMVerifyAll(strictMockCurrentWindowCapability); }); + it(@"should upload the soft button images if soft button image support is unknown", ^{ + testPresentAlertOperation = [[SDLPresentAlertOperation alloc] initWithConnectionManager:mockConnectionManager fileManager:strictMockFileManager systemCapabilityManager:strictMockSystemCapabilityManager currentWindowCapability:nil alertView:testAlertView cancelID:testCancelID]; + + OCMStub([strictMockFileManager fileNeedsUpload:[OCMArg any]]).andReturn(YES); + + OCMExpect([strictMockFileManager uploadArtworks:[OCMArg checkWithBlock:^BOOL(id value) { + NSArray<SDLArtwork *> *files = (NSArray<SDLArtwork *> *)value; + expect(files.count).to(equal(1)); + expect(files[0].name).to(equal(testAlertView.icon.name)); + return [value isKindOfClass:[NSArray class]]; + }] progressHandler:[OCMArg invokeBlock] completionHandler:[OCMArg invokeBlock]]); + + [testPresentAlertOperation start]; + + OCMVerifyAll(strictMockFileManager); + OCMVerifyAll(strictMockSystemCapabilityManager); + OCMVerifyAll(strictMockCurrentWindowCapability); + }); + it(@"should not upload the soft button images if soft button images are not supported on the module", ^{ testPresentAlertOperation = [[SDLPresentAlertOperation alloc] initWithConnectionManager:mockConnectionManager fileManager:strictMockFileManager systemCapabilityManager:strictMockSystemCapabilityManager currentWindowCapability:strictMockCurrentWindowCapability alertView:testAlertView cancelID:testCancelID]; |