Skip to content

Commit

Permalink
Hide "View Required Ingredients" if there are no required ingredients
Browse files Browse the repository at this point in the history
Closes #84
  • Loading branch information
skjiisa committed Jul 1, 2020
1 parent a1c7ab7 commit 152ef21
Showing 1 changed file with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,29 @@ class CharacterDetailTableViewController: UITableViewController, CharacterTracke

guard let tempSection = attributeTypeSectionController?.sectionToShow(section) else {
// Module options section
if let tempSection = attributeTypeSectionController?.sectionToShow(section - 1),
tempSection.collapsed {
return 0
if let tempSection = attributeTypeSectionController?.sectionToShow(section - 1) {
if tempSection.collapsed {
return 0
}

if editMode {
return 2
}

if let tempModules = moduleController.getTempModules(from: tempSection.section) {
if tempModules.firstIndex(where: { $0.ingredients?.count ?? 0 > 0 }) != nil {
// If there is at least one module that has ingredients,
// show the "View Required Ingredients" cell
return 1
}

// There are no modules with ingredients
return 0
}
}

return 1 + editMode.int
// Hopefully this never gets called
return 0
}

if tempSection.collapsed {
Expand Down

0 comments on commit 152ef21

Please sign in to comment.