Skip to content
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

Merged
merged 9 commits into from
Jul 13, 2018
Merged

Conversation

joeljfischer
Copy link
Contributor

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
  • Submenu commands / menu cells with subcells may now contain artwork.

CLA

@joeljfischer joeljfischer added enhancement proposal Accepted SDL Evolution Proposal labels Jun 21, 2018
@joeljfischer joeljfischer added this to the 6.1.0 milestone Jun 21, 2018
@joeljfischer joeljfischer self-assigned this Jun 21, 2018
@joeljfischer joeljfischer changed the title Implement SDL-0085 - SubMenu Icon Implement SDL-0085 SubMenu Icon Jun 21, 2018
@joeljfischer joeljfischer changed the base branch from master to develop June 22, 2018 17:57
Copy link
Contributor

@NicoleYarroch NicoleYarroch left a 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 {
Copy link
Contributor

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;

Copy link
Contributor Author

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)
Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Contributor

@NicoleYarroch NicoleYarroch left a 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't compile.

Copy link
Contributor Author

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));
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Contributor

@NicoleYarroch NicoleYarroch left a 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", ^{
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Contributor

@NicoleYarroch NicoleYarroch left a 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

@joeljfischer joeljfischer merged commit e689b71 into develop Jul 13, 2018
@joeljfischer joeljfischer deleted the feature/issue_719_submenu_icon branch July 13, 2018 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Accepted SDL Evolution Proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants