-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement SDL-0085 SubMenu Icon #997
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a merge conflict with develop. The menu was changed in the fuelRange
PR.
# Conflicts: # SmartDeviceLink_Example/MenuManager.m # SmartDeviceLink_Example/MenuManager.swift
submenu.position = @(position); | ||
|
||
return submenu; | ||
- (SDLAddSubMenu *)sdl_subMenuCommandForMenuCell:(SDLMenuCell *)cell withArtwork:(BOOL)shouldHaveArtwork position:(UInt16)position { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If sending two submenus, one with artwork and one without, the manager will add an image without a name to the the AddSubMenu
RPC. The command then fails because the image is missing a name.
The following method should also check if cell.icon.name
is nil
and not just check if shouldHaveArtwork
is true.
SDLImage *icon = shouldHaveArtwork ? [[SDLImage alloc] initWithName:cell.icon.name] : nil;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
* Fix not using templates
|
||
return SDLMenuCell(title: ACSubmenuMenuName, subCells: submenuItems) | ||
return SDLMenuCell(title: ACSubmenuMenuName, icon: SDLArtwork(image: #imageLiteral(resourceName: "choice_set"), persistent: true, as: .PNG), subCells: submenuItems) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The artwork needs to be templated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -119,7 +119,7 @@ private extension MenuManager { | |||
/// - Returns: A SDLMenuCell object | |||
class func menuCellWithSubmenu(with manager: SDLManager) -> SDLMenuCell { | |||
var submenuItems = [SDLMenuCell]() | |||
for i in 0..<75 { | |||
for i in 0 ..< 10 { | |||
let submenuTitle = "Submenu Item \(i)" | |||
submenuItems.append(SDLMenuCell(title: submenuTitle, icon: SDLArtwork(image: UIImage(named: MenuBWIconImageName)!, persistent: true, as: .PNG), voiceCommands: [submenuTitle, "Item \(i)", "\(i)"], handler: { (triggerSource) in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The artwork needs to be templated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example apps need to be updated
@@ -63,7 +63,8 @@ private extension MenuManager { | |||
VehicleDataManager.getAllVehicleData(with: manager, triggerSource: triggerSource, vehicleDataType: submenuName) | |||
}) | |||
} | |||
return SDLMenuCell(title: ACGetAllVehicleDataMenuName, subCells: submenuItems) | |||
|
|||
return SDLMenuCell(title: ACGetAllVehicleDataMenuName, icon: UIImage(named: CarBWIconImageName)!.withRenderingMode(.alwaysTemplate) subCells: submenuItems) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't compile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
NSArray *submenu = [[mockConnectionManager.receivedRequests copy] filteredArrayUsingPredicate:addSubmenuPredicate]; | ||
SDLAddSubMenu *sentSubmenu = submenu.firstObject; | ||
|
||
expect(add).to(haveCount(2)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few failed test cases in this spec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The swift example app does not compile. There are also a few failed menu manager test cases.
@@ -47,18 +47,28 @@ @interface SDLMenuManager() | |||
|
|||
QuickSpecBegin(SDLMenuManagerSpec) | |||
|
|||
describe(@"menu manager", ^{ | |||
fdescribe(@"menu manager", ^{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the f from fdescribe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove focus from test case
Fixes #719
This PR is ready for review.
Risk
This PR makes minor API changes.
Testing Plan
Unit tests are added, tested against Ford Sync Gen 3 and Core v5.0.0 in-dev.
Summary
Submenu commands / menu cells with subcells may now contain artwork.
Changelog
Enhancements
CLA