Unverified Commit a2cda322 authored by Zach Knox's avatar Zach Knox
Browse files

Show All -> Select All/None, way nicer functionalty

parent 358dbe6e
......@@ -49,14 +49,8 @@ class FilterSelectionTableViewController: UITableViewController {
let values = getFunc()
// Configure the cell...
if(indexPath.row == 0) {
cell.textLabel?.text = "Show All"
cell.accessoryType = .checkmark
for v in values {
if(v.value == false) {
cell.accessoryType = .none
break
}
}
cell.textLabel?.text = "Select All/None"
cell.accessoryType = .none
}
else {
var i = 1
......
......@@ -334,13 +334,60 @@ class FiltersTableViewController: UITableViewController {
}
func selectAllFunc() -> Bool {
if((sender as! UITableViewCell).textLabel?.text! == "Categories") {
var foundFalse = false
for v in filters.onlyFromCategories {
filters.onlyFromCategories.updateValue(true, forKey: v.key)
if !foundFalse {
if !v.value {
foundFalse = true
filters.onlyFromCategories.updateValue(true, forKey: v.key)
}
}
else {
filters.onlyFromCategories.updateValue(true, forKey: v.key)
}
}
if !foundFalse {
for v in filters.onlyFromCategories {
filters.onlyFromCategories.updateValue(false, forKey: v.key)
}
}
}
else if((sender as! UITableViewCell).textLabel?.text! == "Alerts") {
var foundFalse = false
for v in filters.showAlerts {
if !foundFalse {
if !v.value {
foundFalse = true
filters.showAlerts.updateValue(true, forKey: v.key)
}
}
else {
filters.showAlerts.updateValue(true, forKey: v.key)
}
}
if !foundFalse {
for v in filters.showAlerts {
filters.showAlerts.updateValue(false, forKey: v.key)
}
}
}
else {
var foundFalse = false
for v in filters.onlyFromLocations {
filters.onlyFromLocations.updateValue(true, forKey: v.key)
if !foundFalse {
if !v.value {
foundFalse = true
filters.onlyFromLocations.updateValue(true, forKey: v.key)
}
}
else {
filters.onlyFromLocations.updateValue(true, forKey: v.key)
}
}
if !foundFalse {
for v in filters.onlyFromLocations {
filters.onlyFromLocations.updateValue(false, forKey: v.key)
}
}
}
return true
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment