diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2021-03-04 07:41:48 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-04 07:41:48 -0800 |
commit | ee70ad16db0c0eb3793196860a153bab4387cef7 (patch) | |
tree | d3492c23d21058bca7c72aa24a0217aa37bfd6c9 | |
parent | ab95191870654e556caa5448dbccfb1d72cef612 (diff) | |
parent | ec63ef4ba5ccf8ff5ff87769be5a3ea005d6d4dd (diff) | |
download | sdl_ios-ee70ad16db0c0eb3793196860a153bab4387cef7.tar.gz |
Merge pull request #1932 from smartdevicelink/bugfix/issue-1931-update-SDLMenuCell-params-order
Updated SDLMenuCell params order
-rw-r--r-- | Example Apps/Example ObjC/MenuManager.m | 26 | ||||
-rw-r--r-- | Example Apps/Example Swift/MenuManager.swift | 26 | ||||
-rw-r--r-- | SmartDeviceLink/public/SDLMenuCell.h | 18 | ||||
-rw-r--r-- | SmartDeviceLink/public/SDLMenuCell.m | 8 | ||||
-rw-r--r-- | SmartDeviceLinkTests/DevAPISpecs/SDLMenuCellSpec.m | 14 | ||||
-rw-r--r-- | SmartDeviceLinkTests/DevAPISpecs/SDLMenuManagerSpec.m | 28 | ||||
-rw-r--r-- | SmartDeviceLinkTests/SDLMenuUpdateAlgorithmSpec.m | 26 |
7 files changed, 73 insertions, 73 deletions
diff --git a/Example Apps/Example ObjC/MenuManager.m b/Example Apps/Example ObjC/MenuManager.m index b4f370477..be553c459 100644 --- a/Example Apps/Example ObjC/MenuManager.m +++ b/Example Apps/Example ObjC/MenuManager.m @@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - Menu Items + (SDLMenuCell *)sdlex_menuCellSpeakNameWithManager:(SDLManager *)manager { - return [[SDLMenuCell alloc] initWithTitle:ACSpeakAppNameMenuName icon:[SDLArtwork artworkWithImage:[[UIImage imageNamed:SpeakBWIconImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] asImageFormat:SDLArtworkImageFormatPNG] voiceCommands:@[ACSpeakAppNameMenuName] secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) { + return [[SDLMenuCell alloc] initWithTitle:ACSpeakAppNameMenuName secondaryText:nil tertiaryText:nil icon:[SDLArtwork artworkWithImage:[[UIImage imageNamed:SpeakBWIconImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] asImageFormat:SDLArtworkImageFormatPNG] secondaryArtwork:nil voiceCommands:@[ACSpeakAppNameMenuName] handler:^(SDLTriggerSource _Nonnull triggerSource) { [manager sendRequest:[[SDLSpeak alloc] initWithTTS:ExampleAppNameTTS]]; }]; } @@ -52,13 +52,13 @@ NS_ASSUME_NONNULL_BEGIN NSMutableArray *submenuItems = [[NSMutableArray alloc] init]; NSArray<NSString *> *allVehicleDataTypes = [self sdlex_allVehicleDataTypes]; for (NSString *vehicleDataType in allVehicleDataTypes) { - SDLMenuCell *cell = [[SDLMenuCell alloc] initWithTitle:vehicleDataType icon:[SDLArtwork artworkWithStaticIcon:SDLStaticIconNameSettings] voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) { + SDLMenuCell *cell = [[SDLMenuCell alloc] initWithTitle:vehicleDataType secondaryText:nil tertiaryText:nil icon:[SDLArtwork artworkWithStaticIcon:SDLStaticIconNameSettings] secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) { [VehicleDataManager getAllVehicleDataWithManager:manager triggerSource:triggerSource vehicleDataType:vehicleDataType]; }]; [submenuItems addObject:cell]; } - return [[SDLMenuCell alloc] initWithTitle:ACGetAllVehicleDataMenuName icon:[SDLArtwork artworkWithImage:[[UIImage imageNamed:CarBWIconImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] asImageFormat:SDLArtworkImageFormatPNG] submenuLayout:SDLMenuLayoutTiles subCells:submenuItems secondaryText:nil tertiaryText:nil secondaryArtwork:nil]; + return [[SDLMenuCell alloc] initWithTitle:ACGetAllVehicleDataMenuName secondaryText:nil tertiaryText:nil icon:[SDLArtwork artworkWithImage:[[UIImage imageNamed:CarBWIconImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] asImageFormat:SDLArtworkImageFormatPNG] secondaryArtwork:nil submenuLayout:SDLMenuLayoutTiles subCells:submenuItems]; } + (NSArray<NSString *> *)sdlex_allVehicleDataTypes { @@ -66,20 +66,20 @@ NS_ASSUME_NONNULL_BEGIN } + (SDLMenuCell *)sdlex_menuCellShowPerformInteractionWithManager:(SDLManager *)manager performManager:(PerformInteractionManager *)performManager { - return [[SDLMenuCell alloc] initWithTitle:ACShowChoiceSetMenuName icon:[SDLArtwork artworkWithImage:[[UIImage imageNamed:MenuBWIconImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] asImageFormat:SDLArtworkImageFormatPNG] voiceCommands:@[ACShowChoiceSetMenuName] secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) { + return [[SDLMenuCell alloc] initWithTitle:ACShowChoiceSetMenuName secondaryText:nil tertiaryText:nil icon:[SDLArtwork artworkWithImage:[[UIImage imageNamed:MenuBWIconImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] asImageFormat:SDLArtworkImageFormatPNG] secondaryArtwork:nil voiceCommands:@[ACShowChoiceSetMenuName] handler:^(SDLTriggerSource _Nonnull triggerSource) { [performManager showWithTriggerSource:triggerSource]; }]; } + (SDLMenuCell *)sdlex_menuCellRecordInCarMicrophoneAudioWithManager:(SDLManager *)manager { AudioManager *audioManager = [[AudioManager alloc] initWithManager:manager]; - return [[SDLMenuCell alloc] initWithTitle:ACRecordInCarMicrophoneAudioMenuName icon:[SDLArtwork artworkWithImage:[[UIImage imageNamed:MicrophoneBWIconImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] asImageFormat:SDLArtworkImageFormatPNG] voiceCommands:@[ACRecordInCarMicrophoneAudioMenuName] secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) { + return [[SDLMenuCell alloc] initWithTitle:ACRecordInCarMicrophoneAudioMenuName secondaryText:nil tertiaryText:nil icon:[SDLArtwork artworkWithImage:[[UIImage imageNamed:MicrophoneBWIconImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] asImageFormat:SDLArtworkImageFormatPNG] secondaryArtwork:nil voiceCommands:@[ACRecordInCarMicrophoneAudioMenuName] handler:^(SDLTriggerSource _Nonnull triggerSource) { [audioManager startRecording]; }]; } + (SDLMenuCell *)sdlex_menuCellDialNumberWithManager:(SDLManager *)manager { - return [[SDLMenuCell alloc] initWithTitle:ACDialPhoneNumberMenuName icon:[SDLArtwork artworkWithImage:[[UIImage imageNamed:PhoneBWIconImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] asImageFormat:SDLArtworkImageFormatPNG] voiceCommands:@[ACDialPhoneNumberMenuName] secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) { + return [[SDLMenuCell alloc] initWithTitle:ACDialPhoneNumberMenuName secondaryText:nil tertiaryText:nil icon:[SDLArtwork artworkWithImage:[[UIImage imageNamed:PhoneBWIconImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] asImageFormat:SDLArtworkImageFormatPNG] secondaryArtwork:nil voiceCommands:@[ACDialPhoneNumberMenuName] handler:^(SDLTriggerSource _Nonnull triggerSource) { if (![RPCPermissionsManager isDialNumberRPCAllowedWithManager:manager]) { [AlertManager sendAlertWithManager:manager image:nil textField1:AlertDialNumberPermissionsWarningText textField2:nil]; return; @@ -96,7 +96,7 @@ NS_ASSUME_NONNULL_BEGIN NSString *errorMessage = @"Changing the template failed"; // Non - Media - SDLMenuCell *cell = [[SDLMenuCell alloc] initWithTitle:@"Non - Media (Default)" icon:nil voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) { + SDLMenuCell *cell = [[SDLMenuCell alloc] initWithTitle:@"Non - Media (Default)" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) { [manager.screenManager changeLayout:[[SDLTemplateConfiguration alloc] initWithPredefinedLayout:SDLPredefinedLayoutNonMedia] withCompletionHandler:^(NSError * _Nullable error) { if (error != nil) { [AlertManager sendAlertWithManager:manager image:nil textField1:errorMessage textField2:nil]; @@ -106,7 +106,7 @@ NS_ASSUME_NONNULL_BEGIN [submenuItems addObject:cell]; // Graphic With Text - SDLMenuCell *cell2 = [[SDLMenuCell alloc] initWithTitle:@"Graphic With Text" icon:nil voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) { + SDLMenuCell *cell2 = [[SDLMenuCell alloc] initWithTitle:@"Graphic With Text" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) { [manager.screenManager changeLayout:[[SDLTemplateConfiguration alloc] initWithPredefinedLayout:SDLPredefinedLayoutGraphicWithText] withCompletionHandler:^(NSError * _Nullable error) { if (error != nil) { [AlertManager sendAlertWithManager:manager image:nil textField1:errorMessage textField2:nil]; @@ -115,23 +115,23 @@ NS_ASSUME_NONNULL_BEGIN }]; [submenuItems addObject:cell2]; - return [[SDLMenuCell alloc] initWithTitle:ACSubmenuTemplateMenuName icon:nil submenuLayout:SDLMenuLayoutList subCells:[submenuItems copy] secondaryText:nil tertiaryText:nil secondaryArtwork:nil]; + return [[SDLMenuCell alloc] initWithTitle:ACSubmenuTemplateMenuName secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil submenuLayout:SDLMenuLayoutList subCells:[submenuItems copy]]; } + (SDLMenuCell *)sdlex_menuCellWithSubmenuWithManager:(SDLManager *)manager { NSMutableArray *submenuItems = [NSMutableArray array]; for (int i = 0; i < 75; i++) { - SDLMenuCell *cell = [[SDLMenuCell alloc] initWithTitle:[NSString stringWithFormat:@"%@ %i", ACSubmenuItemMenuName, i] icon:[SDLArtwork artworkWithImage:[[UIImage imageNamed:MenuBWIconImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] asImageFormat:SDLArtworkImageFormatPNG] voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) { + SDLMenuCell *cell = [[SDLMenuCell alloc] initWithTitle:[NSString stringWithFormat:@"%@ %i", ACSubmenuItemMenuName, i] secondaryText:nil tertiaryText:nil icon:[SDLArtwork artworkWithImage:[[UIImage imageNamed:MenuBWIconImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] asImageFormat:SDLArtworkImageFormatPNG] secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) { [AlertManager sendAlertWithManager:manager image:nil textField1:[NSString stringWithFormat:@"You selected %@ %i", ACSubmenuItemMenuName, i] textField2:nil]; }]; [submenuItems addObject:cell]; } - return [[SDLMenuCell alloc] initWithTitle:ACSubmenuMenuName icon:[SDLArtwork artworkWithImage:[[UIImage imageNamed:MenuBWIconImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] asImageFormat:SDLArtworkImageFormatPNG] submenuLayout:SDLMenuLayoutList subCells:[submenuItems copy] secondaryText:nil tertiaryText:nil secondaryArtwork:nil]; + return [[SDLMenuCell alloc] initWithTitle:ACSubmenuMenuName secondaryText:nil tertiaryText:nil icon:[SDLArtwork artworkWithImage:[[UIImage imageNamed:MenuBWIconImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] asImageFormat:SDLArtworkImageFormatPNG] secondaryArtwork:nil submenuLayout:SDLMenuLayoutList subCells:[submenuItems copy]]; } + (SDLMenuCell *)sdlex_sliderMenuCellWithManager:(SDLManager *)manager { - return [[SDLMenuCell alloc] initWithTitle:ACSliderMenuName icon:nil voiceCommands:@[ACSliderMenuName] secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) { + return [[SDLMenuCell alloc] initWithTitle:ACSliderMenuName secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:@[ACSliderMenuName] handler:^(SDLTriggerSource _Nonnull triggerSource) { SDLSlider *sliderRPC = [[SDLSlider alloc] initWithNumTicks:3 position:1 sliderHeader:@"Select a letter" sliderFooters:@[@"A", @"B", @"C"] timeout:10000]; [manager sendRequest:sliderRPC withResponseHandler:^(__kindof SDLRPCRequest * _Nullable request, __kindof SDLRPCResponse * _Nullable response, NSError * _Nullable error) { if(![response.resultCode isEqualToEnum:SDLResultSuccess]) { @@ -148,7 +148,7 @@ NS_ASSUME_NONNULL_BEGIN } + (SDLMenuCell *)sdlex_scrollableMessageMenuCellWithManager:(SDLManager *)manager { - return [[SDLMenuCell alloc] initWithTitle:ACScrollableMessageMenuName icon:nil voiceCommands:@[ACScrollableMessageMenuName] secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) { + return [[SDLMenuCell alloc] initWithTitle:ACScrollableMessageMenuName secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:@[ACScrollableMessageMenuName] handler:^(SDLTriggerSource _Nonnull triggerSource) { SDLScrollableMessage *messageRPC = [[SDLScrollableMessage alloc] initWithMessage:@"This is a scrollable message\nIt can contain many lines"]; [manager sendRequest:messageRPC withResponseHandler:^(__kindof SDLRPCRequest * _Nullable request, __kindof SDLRPCResponse * _Nullable response, NSError * _Nullable error) { if(![response.resultCode isEqualToEnum:SDLResultSuccess]) { diff --git a/Example Apps/Example Swift/MenuManager.swift b/Example Apps/Example Swift/MenuManager.swift index f7466f06d..1da1f3ced 100644 --- a/Example Apps/Example Swift/MenuManager.swift +++ b/Example Apps/Example Swift/MenuManager.swift @@ -48,7 +48,7 @@ private extension MenuManager { /// - Parameter manager: The SDL Manager /// - Returns: A SDLMenuCell object class func menuCellSpeakName(with manager: SDLManager) -> SDLMenuCell { - return SDLMenuCell(title: ACSpeakAppNameMenuName, icon: SDLArtwork(image: UIImage(named: SpeakBWIconImageName)!.withRenderingMode(.alwaysTemplate), persistent: true, as: .PNG), voiceCommands: [ACSpeakAppNameMenuName], secondaryText: nil, tertiaryText: nil, secondaryArtwork: nil, handler: { _ in + return SDLMenuCell(title: ACSpeakAppNameMenuName, secondaryText: nil, tertiaryText: nil, icon: SDLArtwork(image: UIImage(named: SpeakBWIconImageName)!.withRenderingMode(.alwaysTemplate), persistent: true, as: .PNG), secondaryArtwork: nil, voiceCommands: [ACSpeakAppNameMenuName], handler: { _ in manager.send(request: SDLSpeak(tts: ExampleAppNameTTS), responseHandler: { (_, response, error) in guard response?.resultCode == .success else { return } SDLLog.e("Error sending the Speak RPC: \(error?.localizedDescription ?? "no error message")") @@ -62,12 +62,12 @@ private extension MenuManager { /// - Returns: A SDLMenuCell object class func menuCellGetAllVehicleData(with manager: SDLManager) -> SDLMenuCell { let submenuItems = allVehicleDataTypes.map { submenuName in - SDLMenuCell(title: submenuName, icon: SDLArtwork(staticIcon: .settings), voiceCommands: nil, secondaryText: nil, tertiaryText: nil, secondaryArtwork: nil, handler: { triggerSource in + SDLMenuCell(title: submenuName, secondaryText: nil, tertiaryText: nil, icon: SDLArtwork(staticIcon: .settings), secondaryArtwork: nil, voiceCommands: nil, handler: { triggerSource in VehicleDataManager.getAllVehicleData(with: manager, triggerSource: triggerSource, vehicleDataType: submenuName) }) } - return SDLMenuCell(title: ACGetAllVehicleDataMenuName, icon: SDLArtwork(image: UIImage(named: CarBWIconImageName)!.withRenderingMode(.alwaysTemplate), persistent: true, as: .PNG), submenuLayout: .tiles, subCells: submenuItems, secondaryText: nil, tertiaryText: nil, secondaryArtwork: nil) + return SDLMenuCell(title: ACGetAllVehicleDataMenuName, secondaryText: nil, tertiaryText: nil, icon: SDLArtwork(image: UIImage(named: CarBWIconImageName)!.withRenderingMode(.alwaysTemplate), persistent: true, as: .PNG), secondaryArtwork: nil, submenuLayout: .tiles, subCells: submenuItems) } /// A list of all possible vehicle data types @@ -80,7 +80,7 @@ private extension MenuManager { /// - Parameter manager: The SDL Manager /// - Returns: A SDLMenuCell object class func menuCellShowPerformInteraction(with manager: SDLManager, choiceSetManager: PerformInteractionManager) -> SDLMenuCell { - return SDLMenuCell(title: ACShowChoiceSetMenuName, icon: SDLArtwork(image: UIImage(named: MenuBWIconImageName)!.withRenderingMode(.alwaysTemplate), persistent: true, as: .PNG), voiceCommands: [ACShowChoiceSetMenuName], secondaryText: nil, tertiaryText: nil, secondaryArtwork: nil, handler: { triggerSource in + return SDLMenuCell(title: ACShowChoiceSetMenuName, secondaryText: nil, tertiaryText: nil, icon: SDLArtwork(image: UIImage(named: MenuBWIconImageName)!.withRenderingMode(.alwaysTemplate), persistent: true, as: .PNG), secondaryArtwork: nil, voiceCommands: [ACShowChoiceSetMenuName], handler: { triggerSource in choiceSetManager.show(from: triggerSource) }) } @@ -91,7 +91,7 @@ private extension MenuManager { /// - Returns: A SDLMenuCell object class func menuCellRecordInCarMicrophoneAudio(with manager: SDLManager) -> SDLMenuCell { let audioManager = AudioManager(sdlManager: manager) - return SDLMenuCell(title: ACRecordInCarMicrophoneAudioMenuName, icon: SDLArtwork(image: UIImage(named: MicrophoneBWIconImageName)!.withRenderingMode(.alwaysTemplate), persistent: true, as: .PNG), voiceCommands: [ACRecordInCarMicrophoneAudioMenuName], secondaryText: nil, tertiaryText: nil, secondaryArtwork: nil, handler: { _ in + return SDLMenuCell(title: ACRecordInCarMicrophoneAudioMenuName, secondaryText: nil, tertiaryText: nil, icon: SDLArtwork(image: UIImage(named: MicrophoneBWIconImageName)!.withRenderingMode(.alwaysTemplate), persistent: true, as: .PNG), secondaryArtwork: nil, voiceCommands: [ACRecordInCarMicrophoneAudioMenuName], handler: { _ in audioManager.startRecording() }) } @@ -101,7 +101,7 @@ private extension MenuManager { /// - Parameter manager: The SDL Manager /// - Returns: A SDLMenuCell object class func menuCellDialNumber(with manager: SDLManager) -> SDLMenuCell { - return SDLMenuCell(title: ACDialPhoneNumberMenuName, icon: SDLArtwork(image: UIImage(named: PhoneBWIconImageName)!.withRenderingMode(.alwaysTemplate), persistent: true, as: .PNG), voiceCommands: [ACDialPhoneNumberMenuName], secondaryText: nil, tertiaryText: nil, secondaryArtwork: nil, handler: { _ in + return SDLMenuCell(title: ACDialPhoneNumberMenuName, secondaryText: nil, tertiaryText: nil, icon: SDLArtwork(image: UIImage(named: PhoneBWIconImageName)!.withRenderingMode(.alwaysTemplate), persistent: true, as: .PNG), secondaryArtwork: nil, voiceCommands: [ACDialPhoneNumberMenuName], handler: { _ in guard RPCPermissionsManager.isDialNumberRPCAllowed(with: manager) else { AlertManager.sendAlert(textField1: AlertDialNumberPermissionsWarningText, sdlManager: manager) return @@ -123,7 +123,7 @@ private extension MenuManager { /// Non-Media let submenuTitleNonMedia = "Non - Media (Default)" - submenuItems.append(SDLMenuCell(title: submenuTitleNonMedia, icon: nil, voiceCommands: nil, secondaryText: nil, tertiaryText: nil, secondaryArtwork: nil, handler: { (triggerSource) in + submenuItems.append(SDLMenuCell(title: submenuTitleNonMedia, secondaryText: nil, tertiaryText: nil, icon: nil, secondaryArtwork: nil, voiceCommands: nil, handler: { (triggerSource) in manager.screenManager.changeLayout(SDLTemplateConfiguration(predefinedLayout: .nonMedia)) { err in if err != nil { AlertManager.sendAlert(textField1: errorMessage, sdlManager: manager) @@ -134,7 +134,7 @@ private extension MenuManager { /// Graphic with Text let submenuTitleGraphicText = "Graphic With Text" - submenuItems.append(SDLMenuCell(title: submenuTitleGraphicText, icon: nil, voiceCommands: nil, secondaryText: nil, tertiaryText: nil, secondaryArtwork: nil, handler: { (triggerSource) in + submenuItems.append(SDLMenuCell(title: submenuTitleGraphicText, secondaryText: nil, tertiaryText: nil, icon: nil, secondaryArtwork: nil, voiceCommands: nil, handler: { (triggerSource) in manager.screenManager.changeLayout(SDLTemplateConfiguration(predefinedLayout: .graphicWithText)) { err in if err != nil { AlertManager.sendAlert(textField1: errorMessage, sdlManager: manager) @@ -143,7 +143,7 @@ private extension MenuManager { } })) - return SDLMenuCell(title: ACSubmenuTemplateMenuName, icon: nil, submenuLayout: .list, subCells: submenuItems, secondaryText: nil, tertiaryText: nil, secondaryArtwork: nil) + return SDLMenuCell(title: ACSubmenuTemplateMenuName, secondaryText: nil, tertiaryText: nil, icon: nil, secondaryArtwork: nil, submenuLayout: .list, subCells: submenuItems) } /// Menu item that opens a submenu when selected @@ -154,7 +154,7 @@ private extension MenuManager { var submenuItems = [SDLMenuCell]() for i in 0 ..< 10 { let submenuTitle = "Submenu Item \(i)" - submenuItems.append(SDLMenuCell(title: submenuTitle, icon: SDLArtwork(image: UIImage(named: MenuBWIconImageName)!.withRenderingMode(.alwaysTemplate), persistent: true, as: .PNG), voiceCommands: nil, secondaryText: nil, tertiaryText: nil, secondaryArtwork: nil, handler: { (triggerSource) in + submenuItems.append(SDLMenuCell(title: submenuTitle, secondaryText: nil, tertiaryText: nil, icon: SDLArtwork(image: UIImage(named: MenuBWIconImageName)!.withRenderingMode(.alwaysTemplate), persistent: true, as: .PNG), secondaryArtwork: nil, voiceCommands: nil, handler: { (triggerSource) in let message = "\(submenuTitle) selected!" switch triggerSource { case .menu: @@ -166,11 +166,11 @@ private extension MenuManager { })) } - return SDLMenuCell(title: ACSubmenuMenuName, icon: SDLArtwork(image: #imageLiteral(resourceName: "choice_set").withRenderingMode(.alwaysTemplate), persistent: true, as: .PNG), submenuLayout: .list, subCells: submenuItems, secondaryText: nil, tertiaryText: nil, secondaryArtwork: nil) + return SDLMenuCell(title: ACSubmenuMenuName, secondaryText: nil, tertiaryText: nil, icon: SDLArtwork(image: #imageLiteral(resourceName: "choice_set").withRenderingMode(.alwaysTemplate), persistent: true, as: .PNG), secondaryArtwork: nil, submenuLayout: .list, subCells: submenuItems) } private class func sliderMenuCell(with manager: SDLManager) -> SDLMenuCell { - return SDLMenuCell(title: ACSliderMenuName, icon: nil, voiceCommands: [ACSliderMenuName], secondaryText: nil, tertiaryText: nil, secondaryArtwork: nil, handler: { _ in + return SDLMenuCell(title: ACSliderMenuName, secondaryText: nil, tertiaryText: nil, icon: nil, secondaryArtwork: nil, voiceCommands: [ACSliderMenuName], handler: { _ in let slider = SDLSlider(numTicks: 3, position: 1, sliderHeader: "Select a letter", sliderFooters: ["A", "B", "C"], timeout: 3000) manager.send(request: slider, responseHandler: { (request, response, error) in guard let response = response else { return } @@ -189,7 +189,7 @@ private extension MenuManager { } private class func scrollableMessageMenuCell(with manager: SDLManager) -> SDLMenuCell { - return SDLMenuCell(title: ACScrollableMessageMenuName, icon: nil, voiceCommands: [ACScrollableMessageMenuName], secondaryText: nil, tertiaryText: nil, secondaryArtwork: nil, handler: { _ in + return SDLMenuCell(title: ACScrollableMessageMenuName, secondaryText: nil, tertiaryText: nil, icon: nil, secondaryArtwork: nil, voiceCommands: [ACScrollableMessageMenuName], handler: { _ in let scrollableMessage = SDLScrollableMessage(message: "This is a scrollable message\nIt can contain many lines") manager.send(request: scrollableMessage, responseHandler: { (request, response, error) in guard let response = response else { return } diff --git a/SmartDeviceLink/public/SDLMenuCell.h b/SmartDeviceLink/public/SDLMenuCell.h index b3181156d..3c32d70e0 100644 --- a/SmartDeviceLink/public/SDLMenuCell.h +++ b/SmartDeviceLink/public/SDLMenuCell.h @@ -79,7 +79,7 @@ typedef void(^SDLMenuCellSelectionHandler)(SDLTriggerSource triggerSource); @param handler The code that will be run when the menu cell is selected @return The menu cell */ -- (instancetype)initWithTitle:(NSString *)title icon:(nullable SDLArtwork *)icon voiceCommands:(nullable NSArray<NSString *> *)voiceCommands handler:(SDLMenuCellSelectionHandler)handler __deprecated_msg("Use initWithTitle:icon:voiceCommands:secondaryText:tertiaryText:secondaryArtwork:handler: instead"); +- (instancetype)initWithTitle:(NSString *)title icon:(nullable SDLArtwork *)icon voiceCommands:(nullable NSArray<NSString *> *)voiceCommands handler:(SDLMenuCellSelectionHandler)handler __deprecated_msg("Use initWithTitle:secondaryText:tertiaryText:icon:secondaryArtwork:voiceCommands:handler: instead"); /** Create a menu cell that has subcells and when selected will go into a deeper part of the menu @@ -90,35 +90,35 @@ typedef void(^SDLMenuCellSelectionHandler)(SDLTriggerSource triggerSource); @param subCells The subcells that will appear when the cell is selected @return The menu cell */ -- (instancetype)initWithTitle:(NSString *)title icon:(nullable SDLArtwork *)icon submenuLayout:(nullable SDLMenuLayout)layout subCells:(NSArray<SDLMenuCell *> *)subCells __deprecated_msg("Use initWithTitle:icon:submenuLayout:subCells:secondaryText:tertiaryText:secondaryArtwork: instead"); +- (instancetype)initWithTitle:(NSString *)title icon:(nullable SDLArtwork *)icon submenuLayout:(nullable SDLMenuLayout)layout subCells:(NSArray<SDLMenuCell *> *)subCells __deprecated_msg("Use initWithTitle:secondaryText:tertiaryText:icon:secondaryArtwork:submenuLayout:subCells: instead"); /** Create a menu cell that has no subcells. @param title The cell's primary text - @param icon The cell's image - @param voiceCommands Voice commands that will activate the menu cell @param secondaryText - secondaryText @param tertiaryText - tertiaryText + @param icon The cell's image @param secondaryArtwork - secondaryArtwork + @param voiceCommands Voice commands that will activate the menu cell @param handler The code that will be run when the menu cell is selected @return The menu cell */ -- (instancetype)initWithTitle:(NSString *)title icon:(nullable SDLArtwork *)icon voiceCommands:(nullable NSArray<NSString *> *)voiceCommands secondaryText:(nullable NSString *)secondaryText tertiaryText:(nullable NSString *)tertiaryText secondaryArtwork:(nullable SDLArtwork *)secondaryArtwork handler:(SDLMenuCellSelectionHandler)handler; +- (instancetype)initWithTitle:(NSString *)title secondaryText:(nullable NSString *)secondaryText tertiaryText:(nullable NSString *)tertiaryText icon:(nullable SDLArtwork *)icon secondaryArtwork:(nullable SDLArtwork *)secondaryArtwork voiceCommands:(nullable NSArray<NSString *> *)voiceCommands handler:(SDLMenuCellSelectionHandler)handler; /** Create a menu cell that has subcells and when selected will go into a deeper part of the menu @param title The cell's primary text - @param icon The cell's image - @param layout The layout that the subCells will be layed out in if that submenu is entered - @param subCells The subcells that will appear when the cell is selected @param secondaryText - secondaryText @param tertiaryText - tertiaryText + @param icon The cell's image @param secondaryArtwork - secondaryArtwork + @param layout The layout that the subCells will be layed out in if that submenu is entered + @param subCells The subcells that will appear when the cell is selected @return The menu cell */ -- (instancetype)initWithTitle:(NSString *)title icon:(nullable SDLArtwork *)icon submenuLayout:(nullable SDLMenuLayout)layout subCells:(NSArray<SDLMenuCell *> *)subCells secondaryText:(nullable NSString *)secondaryText tertiaryText:(nullable NSString *)tertiaryText secondaryArtwork:(nullable SDLArtwork *)secondaryArtwork; +- (instancetype)initWithTitle:(NSString *)title secondaryText:(nullable NSString *)secondaryText tertiaryText:(nullable NSString *)tertiaryText icon:(nullable SDLArtwork *)icon secondaryArtwork:(nullable SDLArtwork *)secondaryArtwork submenuLayout:(nullable SDLMenuLayout)layout subCells:(NSArray<SDLMenuCell *> *)subCells; @end diff --git a/SmartDeviceLink/public/SDLMenuCell.m b/SmartDeviceLink/public/SDLMenuCell.m index 963f31995..e5bc7f13e 100644 --- a/SmartDeviceLink/public/SDLMenuCell.m +++ b/SmartDeviceLink/public/SDLMenuCell.m @@ -22,14 +22,14 @@ NS_ASSUME_NONNULL_BEGIN @implementation SDLMenuCell - (instancetype)initWithTitle:(NSString *)title icon:(nullable SDLArtwork *)icon voiceCommands:(nullable NSArray<NSString *> *)voiceCommands handler:(SDLMenuCellSelectionHandler)handler { - return [self initWithTitle:title icon:icon voiceCommands:voiceCommands secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:handler]; + return [self initWithTitle:title secondaryText:nil tertiaryText:nil icon:icon secondaryArtwork:nil voiceCommands:voiceCommands handler:handler]; } - (instancetype)initWithTitle:(NSString *)title icon:(nullable SDLArtwork *)icon submenuLayout:(nullable SDLMenuLayout)layout subCells:(NSArray<SDLMenuCell *> *)subCells { - return [self initWithTitle:title icon:icon submenuLayout:layout subCells:subCells secondaryText:nil tertiaryText:nil secondaryArtwork:nil]; + return [self initWithTitle:title secondaryText:nil tertiaryText:nil icon:icon secondaryArtwork:nil submenuLayout:layout subCells:subCells]; } -- (instancetype)initWithTitle:(NSString *)title icon:(nullable SDLArtwork *)icon voiceCommands:(nullable NSArray<NSString *> *)voiceCommands secondaryText:(nullable NSString *)secondaryText tertiaryText:(nullable NSString *)tertiaryText secondaryArtwork:(nullable SDLArtwork *)secondaryArtwork handler:(SDLMenuCellSelectionHandler)handler { +- (instancetype)initWithTitle:(NSString *)title secondaryText:(nullable NSString *)secondaryText tertiaryText:(nullable NSString *)tertiaryText icon:(nullable SDLArtwork *)icon secondaryArtwork:(nullable SDLArtwork *)secondaryArtwork voiceCommands:(nullable NSArray<NSString *> *)voiceCommands handler:(SDLMenuCellSelectionHandler)handler { self = [super init]; if (!self) { return nil; } @@ -48,7 +48,7 @@ NS_ASSUME_NONNULL_BEGIN return self; } -- (instancetype)initWithTitle:(NSString *)title icon:(nullable SDLArtwork *)icon submenuLayout:(nullable SDLMenuLayout)layout subCells:(NSArray<SDLMenuCell *> *)subCells secondaryText:(nullable NSString *)secondaryText tertiaryText:(nullable NSString *)tertiaryText secondaryArtwork:(nullable SDLArtwork *)secondaryArtwork { +- (instancetype)initWithTitle:(NSString *)title secondaryText:(nullable NSString *)secondaryText tertiaryText:(nullable NSString *)tertiaryText icon:(nullable SDLArtwork *)icon secondaryArtwork:(nullable SDLArtwork *)secondaryArtwork submenuLayout:(nullable SDLMenuLayout)layout subCells:(NSArray<SDLMenuCell *> *)subCells { self = [super init]; if (!self) { return nil; } diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLMenuCellSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLMenuCellSpec.m index e2b34727d..33381055e 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLMenuCellSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLMenuCellSpec.m @@ -31,7 +31,7 @@ describe(@"a menu cell", ^{ beforeEach(^{ someVoiceCommands = @[@"some command"]; - SDLMenuCell *subcell = [[SDLMenuCell alloc] initWithTitle:@"Hello" icon:nil voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + SDLMenuCell *subcell = [[SDLMenuCell alloc] initWithTitle:@"Hello" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; someSubcells = @[subcell]; }); @@ -66,7 +66,7 @@ describe(@"a menu cell", ^{ }); it(@"should set initWithTitle:icon:voiceCommands:secondaryText:tertiaryText:secondaryArtwork:handler: properly", ^{ - testCell = [[SDLMenuCell alloc] initWithTitle:someTitle icon:someArtwork voiceCommands:someVoiceCommands secondaryText:someSecondaryTitle tertiaryText:someTertiaryTitle secondaryArtwork:someSecondaryArtwork handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + testCell = [[SDLMenuCell alloc] initWithTitle:someTitle secondaryText:someSecondaryTitle tertiaryText:someTertiaryTitle icon:someArtwork secondaryArtwork:someSecondaryArtwork voiceCommands:someVoiceCommands handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; expect(testCell.title).to(equal(someTitle)); expect(testCell.icon).to(equal(someArtwork)); @@ -78,7 +78,7 @@ describe(@"a menu cell", ^{ }); it(@"should initWithTitle:icon:submenuLayout:subCells:secondaryText:tertiaryText:secondaryArtwork: initialize", ^{ - testCell = [[SDLMenuCell alloc] initWithTitle:someTitle icon:someArtwork submenuLayout:testLayout subCells:someSubcells secondaryText:someSecondaryTitle tertiaryText:someTertiaryTitle secondaryArtwork:someSecondaryArtwork]; + testCell = [[SDLMenuCell alloc] initWithTitle:someTitle secondaryText:someSecondaryTitle tertiaryText:someTertiaryTitle icon:someArtwork secondaryArtwork:someSecondaryArtwork submenuLayout:testLayout subCells:someSubcells]; expect(testCell.title).to(equal(someTitle)); expect(testCell.icon).to(equal(someArtwork)); @@ -93,15 +93,15 @@ describe(@"a menu cell", ^{ describe(@"check cell eqality", ^{ it(@"should compare cells and return true if cells equal", ^{ - testCell = [[SDLMenuCell alloc] initWithTitle:someTitle icon:nil submenuLayout:testLayout subCells:@[] secondaryText:someSecondaryTitle tertiaryText:someTertiaryTitle secondaryArtwork:someSecondaryArtwork]; - testCell2 = [[SDLMenuCell alloc] initWithTitle:someTitle icon:nil submenuLayout:testLayout subCells:@[] secondaryText:someSecondaryTitle tertiaryText:someTertiaryTitle secondaryArtwork:someSecondaryArtwork]; + testCell = [[SDLMenuCell alloc] initWithTitle:someTitle secondaryText:someSecondaryTitle tertiaryText:someTertiaryTitle icon:nil secondaryArtwork:someSecondaryArtwork submenuLayout:testLayout subCells:@[]]; + testCell2 = [[SDLMenuCell alloc] initWithTitle:someTitle secondaryText:someSecondaryTitle tertiaryText:someTertiaryTitle icon:nil secondaryArtwork:someSecondaryArtwork submenuLayout:testLayout subCells:@[]]; expect([testCell isEqual:testCell2]).to(equal(true)); }); it(@"should compare cells and return false if not equal ", ^{ - testCell = [[SDLMenuCell alloc] initWithTitle:@"True" icon:nil submenuLayout:testLayout subCells:@[] secondaryText:someSecondaryTitle tertiaryText:someTertiaryTitle secondaryArtwork:someSecondaryArtwork]; - testCell2 = [[SDLMenuCell alloc] initWithTitle:@"False" icon:nil submenuLayout:testLayout subCells:@[] secondaryText:nil tertiaryText:nil secondaryArtwork:nil]; + testCell = [[SDLMenuCell alloc] initWithTitle:@"True" secondaryText:someSecondaryTitle tertiaryText:someTertiaryTitle icon:nil secondaryArtwork:someSecondaryArtwork submenuLayout:testLayout subCells:@[]]; + testCell2 = [[SDLMenuCell alloc] initWithTitle:@"False" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil submenuLayout:testLayout subCells:@[]]; expect([testCell isEqual:testCell2]).to(equal(false)); }); diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLMenuManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLMenuManagerSpec.m index 7e5c89925..816091d98 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLMenuManagerSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLMenuManagerSpec.m @@ -64,11 +64,11 @@ describe(@"menu manager", ^{ testArtwork3 = [[SDLArtwork alloc] initWithData:[@"Test data 3" dataUsingEncoding:NSUTF8StringEncoding] name:@"some artwork name" fileExtension:@"png" persistent:NO]; testArtwork3.overwrite = YES; - textOnlyCell = [[SDLMenuCell alloc] initWithTitle:@"Test 1" icon:nil voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; - textAndImageCell = [[SDLMenuCell alloc] initWithTitle:@"Test 2" icon:testArtwork voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; - submenuCell = [[SDLMenuCell alloc] initWithTitle:@"Test 3" icon:nil submenuLayout:nil subCells:@[textOnlyCell, textAndImageCell] secondaryText:nil tertiaryText:nil secondaryArtwork:nil]; - submenuImageCell = [[SDLMenuCell alloc] initWithTitle:@"Test 4" icon:testArtwork2 submenuLayout:SDLMenuLayoutTiles subCells:@[textOnlyCell] secondaryText:nil tertiaryText:nil secondaryArtwork:nil]; - textOnlyCell2 = [[SDLMenuCell alloc] initWithTitle:@"Test 5" icon:nil voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + textOnlyCell = [[SDLMenuCell alloc] initWithTitle:@"Test 1" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + textAndImageCell = [[SDLMenuCell alloc] initWithTitle:@"Test 2" secondaryText:nil tertiaryText:nil icon:testArtwork secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + submenuCell = [[SDLMenuCell alloc] initWithTitle:@"Test 3" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil submenuLayout:nil subCells:@[textOnlyCell, textAndImageCell]]; + submenuImageCell = [[SDLMenuCell alloc] initWithTitle:@"Test 4" secondaryText:nil tertiaryText:nil icon:testArtwork2 secondaryArtwork:nil submenuLayout:SDLMenuLayoutTiles subCells:@[textOnlyCell]]; + textOnlyCell2 = [[SDLMenuCell alloc] initWithTitle:@"Test 5" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; testMenuConfiguration = [[SDLMenuConfiguration alloc] initWithMainMenuLayout:SDLMenuLayoutTiles defaultSubmenuLayout:SDLMenuLayoutList]; @@ -196,8 +196,8 @@ describe(@"menu manager", ^{ }); context(@"duplicate VR commands", ^{ - __block SDLMenuCell *textAndVRCell1 = [[SDLMenuCell alloc] initWithTitle:@"Test 1" icon:nil voiceCommands:@[@"Cat", @"Turtle"] secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; - __block SDLMenuCell *textAndVRCell2 = [[SDLMenuCell alloc] initWithTitle:@"Test 3" icon:nil voiceCommands:@[@"Cat", @"Dog"] secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + __block SDLMenuCell *textAndVRCell1 = [[SDLMenuCell alloc] initWithTitle:@"Test 1" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:@[@"Cat", @"Turtle"] handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + __block SDLMenuCell *textAndVRCell2 = [[SDLMenuCell alloc] initWithTitle:@"Test 3" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:@[@"Cat", @"Dog"] handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; it(@"should fail when menu items have duplicate vr commands", ^{ testManager.menuCells = @[textAndVRCell1, textAndVRCell2]; @@ -206,14 +206,14 @@ describe(@"menu manager", ^{ }); it(@"should check if all artworks are uploaded and return NO", ^{ - textAndImageCell = [[SDLMenuCell alloc] initWithTitle:@"Test 2" icon:nil voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:testArtwork handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + textAndImageCell = [[SDLMenuCell alloc] initWithTitle:@"Test 2" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:testArtwork voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; testManager.menuCells = @[textAndImageCell, textOnlyCell]; OCMVerify([testManager sdl_shouldRPCsIncludeImages:testManager.menuCells]); expect([testManager sdl_shouldRPCsIncludeImages:testManager.menuCells]).to(beFalse()); }); it(@"should check if all artworks are uploaded and return NO", ^{ - textAndImageCell = [[SDLMenuCell alloc] initWithTitle:@"Test 2" icon:testArtwork3 voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + textAndImageCell = [[SDLMenuCell alloc] initWithTitle:@"Test 2" secondaryText:nil tertiaryText:nil icon:testArtwork3 secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; testManager.menuCells = @[textAndImageCell, textOnlyCell]; OCMVerify([testManager sdl_shouldRPCsIncludeImages:testManager.menuCells]); expect([testManager sdl_shouldRPCsIncludeImages:testManager.menuCells]).to(beFalse()); @@ -253,7 +253,7 @@ describe(@"menu manager", ^{ }); it(@"should check if all artworks are uploaded", ^{ - textAndImageCell = [[SDLMenuCell alloc] initWithTitle:@"Test 2" icon:testArtwork3 voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + textAndImageCell = [[SDLMenuCell alloc] initWithTitle:@"Test 2" secondaryText:nil tertiaryText:nil icon:testArtwork3 secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; testManager.menuCells = @[textAndImageCell, textOnlyCell]; OCMVerify([testManager sdl_shouldRPCsIncludeImages:testManager.menuCells]); expect([testManager sdl_shouldRPCsIncludeImages:testManager.menuCells]).to(beTrue()); @@ -279,7 +279,7 @@ describe(@"menu manager", ^{ it(@"should properly overwrite an image cell", ^{ OCMStub([mockFileManager fileNeedsUpload:[OCMArg isNotNil]]).andReturn(YES); - textAndImageCell = [[SDLMenuCell alloc] initWithTitle:@"Test 2" icon:testArtwork3 voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + textAndImageCell = [[SDLMenuCell alloc] initWithTitle:@"Test 2" secondaryText:nil tertiaryText:nil icon:testArtwork3 secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; testManager.menuCells = @[textAndImageCell, submenuImageCell]; OCMVerify([mockFileManager uploadArtworks:[OCMArg any] completionHandler:[OCMArg any]]); }); @@ -565,7 +565,7 @@ describe(@"menu manager", ^{ context(@"on a main menu cell", ^{ beforeEach(^{ - cellWithHandler = [[SDLMenuCell alloc] initWithTitle:@"Hello" icon:nil voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) { + cellWithHandler = [[SDLMenuCell alloc] initWithTitle:@"Hello" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) { cellCalled = YES; testTriggerSource = triggerSource; }]; @@ -588,12 +588,12 @@ describe(@"menu manager", ^{ context(@"on a submenu menu cell", ^{ beforeEach(^{ - cellWithHandler = [[SDLMenuCell alloc] initWithTitle:@"Hello" icon:nil voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) { + cellWithHandler = [[SDLMenuCell alloc] initWithTitle:@"Hello" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) { cellCalled = YES; testTriggerSource = triggerSource; }]; - SDLMenuCell *submenuCell = [[SDLMenuCell alloc] initWithTitle:@"Submenu" icon:nil submenuLayout:SDLMenuLayoutTiles subCells:@[cellWithHandler] secondaryText:nil tertiaryText:nil secondaryArtwork:nil]; + SDLMenuCell *submenuCell = [[SDLMenuCell alloc] initWithTitle:@"Submenu" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil submenuLayout:SDLMenuLayoutTiles subCells:@[cellWithHandler]]; testManager.menuCells = @[submenuCell]; }); diff --git a/SmartDeviceLinkTests/SDLMenuUpdateAlgorithmSpec.m b/SmartDeviceLinkTests/SDLMenuUpdateAlgorithmSpec.m index 9c554c02c..63eb97f95 100644 --- a/SmartDeviceLinkTests/SDLMenuUpdateAlgorithmSpec.m +++ b/SmartDeviceLinkTests/SDLMenuUpdateAlgorithmSpec.m @@ -42,19 +42,19 @@ describe(@"menuUpdateAlgorithm", ^{ // 0 = Delete 1 = Add 2 = Keep describe(@"compare old and new menu cells", ^{ beforeEach(^{ - oldCell1 = [[SDLMenuCell alloc] initWithTitle:@"Cell 1" icon:nil voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; - oldCell2 = [[SDLMenuCell alloc] initWithTitle:@"Cell 2" icon:nil voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; - oldCell3 = [[SDLMenuCell alloc] initWithTitle:@"Cell 3" icon:nil voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; - oldCell4 = [[SDLMenuCell alloc] initWithTitle:@"Cell 4" icon:nil voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; - oldCell5 = [[SDLMenuCell alloc] initWithTitle:@"Cell 5" icon:nil voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; - oldCell6 = [[SDLMenuCell alloc] initWithTitle:@"Cell 6" icon:nil voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; - - newCell1 = [[SDLMenuCell alloc] initWithTitle:@"Cell 1" icon:nil voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; - newCell2 = [[SDLMenuCell alloc] initWithTitle:@"Cell 2" icon:nil voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; - newCell3 = [[SDLMenuCell alloc] initWithTitle:@"Cell 3" icon:nil voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; - newCell4 = [[SDLMenuCell alloc] initWithTitle:@"Cell 4" icon:nil voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; - newCell5 = [[SDLMenuCell alloc] initWithTitle:@"Cell 5" icon:nil voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; - newCell6 = [[SDLMenuCell alloc] initWithTitle:@"Cell 6" icon:nil voiceCommands:nil secondaryText:nil tertiaryText:nil secondaryArtwork:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + oldCell1 = [[SDLMenuCell alloc] initWithTitle:@"Cell 1" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + oldCell2 = [[SDLMenuCell alloc] initWithTitle:@"Cell 2" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + oldCell3 = [[SDLMenuCell alloc] initWithTitle:@"Cell 3" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + oldCell4 = [[SDLMenuCell alloc] initWithTitle:@"Cell 4" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + oldCell5 = [[SDLMenuCell alloc] initWithTitle:@"Cell 5" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + oldCell6 = [[SDLMenuCell alloc] initWithTitle:@"Cell 6" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + + newCell1 = [[SDLMenuCell alloc] initWithTitle:@"Cell 1" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + newCell2 = [[SDLMenuCell alloc] initWithTitle:@"Cell 2" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + newCell3 = [[SDLMenuCell alloc] initWithTitle:@"Cell 3" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + newCell4 = [[SDLMenuCell alloc] initWithTitle:@"Cell 4" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + newCell5 = [[SDLMenuCell alloc] initWithTitle:@"Cell 5" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + newCell6 = [[SDLMenuCell alloc] initWithTitle:@"Cell 6" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; }); it(@"should have a new menu status of 22221 and an old menu status of 2222 on best run", ^{ |